当前位置: 首页 > news >正文

我的网站刚换了一个模板收录很多就是没排名b站推广链接

我的网站刚换了一个模板收录很多就是没排名,b站推广链接,做个购物网站多少钱,表格制作MediaPipe 介绍参见:亚博microros小车-原生ubuntu支持系列:4-手部检测-CSDN博客 本篇继续迁移姿态检测。 一 背景知识 以下来自亚博官网 MediaPipe Pose是⼀个⽤于⾼保真⾝体姿势跟踪的ML解决⽅案,利⽤BlazePose研究,从RGB视频…

MediaPipe 介绍参见:亚博microros小车-原生ubuntu支持系列:4-手部检测-CSDN博客 

本篇继续迁移姿态检测。

一 背景知识

以下来自亚博官网

MediaPipe Pose是⼀个⽤于⾼保真⾝体姿势跟踪的ML解决⽅案,利⽤BlazePose研究,从RGB视频帧推断出33个3D坐标和全⾝背景分割遮罩,该研究也为ML Kit姿势检测API提供了动⼒。

MediaPipe姿势中的地标模型预测了33个姿势坐标的位置(参⻅下图)。

image-20240125170006220

 跟手部检测类似

import cv2
import mediapipe as mpmp_drawing = mp.solutions.drawing_utils
mp_drawing_styles = mp.solutions.drawing_styles
mp_pose = mp.solutions.pose
pose = mp_pose.Pose(static_image_mode=False, model_complexity=1, smooth_landmarks=True, min_detection_confidence=0.5, min_tracking_confidence=0.5)cap = cv2.VideoCapture(0)#打开默认摄像头
while True:ret,frame = cap.read()#读取一帧图像#图像格式转换frame = cv2.cvtColor(frame, cv2.COLOR_BGR2RGB)# 因为摄像头是镜像的,所以将摄像头水平翻转# 不是镜像的可以不翻转frame= cv2.flip(frame,1)#输出结果results = pose.process(frame)frame = cv2.cvtColor(frame, cv2.COLOR_RGB2BGR)if results.pose_landmarks:print(f'pose_landmarks:{results.pose_landmarks}' )# 关键点可视化mp_drawing.draw_landmarks(frame, results.pose_landmarks, mp_pose.POSE_CONNECTIONS)else:print('there are no person!')continue    cv2.imshow('MediaPipe pose', frame)if cv2.waitKey(1) & 0xFF == 27:break
cap.release()

运行效果:

二 位姿检测

src/yahboom_esp32_mediapipe/yahboom_esp32_mediapipe/目录下新建文件02_PoseDetector.py

#!/usr/bin/env python3
# encoding: utf-8#import ros lib
import rclpy
from rclpy.node import Node
from geometry_msgs.msg import Point
import mediapipe as mp
#import define msg
from yahboomcar_msgs.msg import PointArray
from cv_bridge import CvBridge
from sensor_msgs.msg import Image, CompressedImage
#import commom lib
import cv2 as cv
import numpy as np
import timefrom rclpy.time import Time
import datetimeprint("import done")class PoseDetector(Node):def __init__(self, name,mode=False, smooth=True, detectionCon=0.5, trackCon=0.5):super().__init__(name)self.mpPose = mp.solutions.poseself.mpDraw = mp.solutions.drawing_utils#初始化位姿self.pose = self.mpPose.Pose(static_image_mode=mode,smooth_landmarks=smooth,min_detection_confidence=detectionCon,min_tracking_confidence=trackCon )self.pub_point = self.create_publisher(PointArray,'/mediapipe/points',1000)#输出关键点样式self.lmDrawSpec = mp.solutions.drawing_utils.DrawingSpec(color=(0, 0, 255), thickness=-1, circle_radius=6)self.drawSpec = mp.solutions.drawing_utils.DrawingSpec(color=(0, 255, 0), thickness=2, circle_radius=2)#位姿检测   def pubPosePoint(self, frame, draw=True):pointArray = PointArray()img = np.copy(frame)#图片格式转换img_RGB = cv.cvtColor(frame, cv.COLOR_BGR2RGB)self.results = self.pose.process(img_RGB)if self.results.pose_landmarks:#关键点输出if draw: self.mpDraw.draw_landmarks(frame, self.results.pose_landmarks, self.mpPose.POSE_CONNECTIONS, self.lmDrawSpec, self.drawSpec)self.mpDraw.draw_landmarks(img, self.results.pose_landmarks, self.mpPose.POSE_CONNECTIONS, self.lmDrawSpec, self.drawSpec)for id, lm in enumerate(self.results.pose_landmarks.landmark):point = Point()point.x, point.y, point.z = lm.x, lm.y, lm.zpointArray.points.append(point)self.pub_point.publish(pointArray)return frame, imgdef frame_combine(slef,frame, src):if len(frame.shape) == 3:frameH, frameW = frame.shape[:2]srcH, srcW = src.shape[:2]dst = np.zeros((max(frameH, srcH), frameW + srcW, 3), np.uint8)dst[:, :frameW] = frame[:, :]dst[:, frameW:] = src[:, :]else:src = cv.cvtColor(src, cv.COLOR_BGR2GRAY)frameH, frameW = frame.shape[:2]imgH, imgW = src.shape[:2]dst = np.zeros((frameH, frameW + imgW), np.uint8)dst[:, :frameW] = frame[:, :]dst[:, frameW:] = src[:, :]return dstclass MY_Picture(Node):def __init__(self, name):super().__init__(name)self.bridge = CvBridge()self.sub_img = self.create_subscription(CompressedImage, '/espRos/esp32camera', self.handleTopic, 1) #获取esp32传来的图像self.last_stamp = Noneself.new_seconds = 0self.fps_seconds = 1self.pose_detector = PoseDetector('pose_detector')#回调函数def handleTopic(self, msg):self.last_stamp = msg.header.stamp  if self.last_stamp:total_secs = Time(nanoseconds=self.last_stamp.nanosec, seconds=self.last_stamp.sec).nanosecondsdelta = datetime.timedelta(seconds=total_secs * 1e-9)seconds = delta.total_seconds()*100if self.new_seconds != 0:self.fps_seconds = seconds - self.new_secondsself.new_seconds = seconds#保留这次的值start = time.time()frame = self.bridge.compressed_imgmsg_to_cv2(msg)frame = cv.resize(frame, (640, 480))cv.waitKey(10)frame, img = self.pose_detector.pubPosePoint(frame,draw=False)end = time.time()fps = 1 / ((end - start)+self.fps_seconds)text = "FPS : " + str(int(fps))cv.putText(frame, text, (20, 30), cv.FONT_HERSHEY_SIMPLEX, 0.9, (0, 0, 255), 1)dist = self.pose_detector.frame_combine(frame, img)cv.imshow('dist', dist)# print(frame)cv.waitKey(10)def main():print("start it")rclpy.init()esp_img = MY_Picture("My_Picture")try:rclpy.spin(esp_img)except KeyboardInterrupt:passfinally:esp_img.destroy_node()rclpy.shutdown()

主要逻辑跟之前的手部探测类似,MY_Picture(Node):从摄像头获取图像,调用 pubPosePoint(frame,draw=False)探测位姿。

测试:

启动图像代理
docker run -it --rm -v /dev:/dev -v /dev/shm:/dev/shm --privileged --net=host microros/micro-ros-agent:humble udp4 --port 9999 -v4

重新构建后运行:

bohu@bohu-TM1701:~/yahboomcar/yahboomcar_ws$ ros2 run yahboom_esp32_mediapipe PoseDetector 
import done
start it
WARNING: All log messages before absl::InitializeLog() is called are written to STDERR
I0000 00:00:1737459931.889105   73213 gl_context_egl.cc:85] Successfully initialized EGL. Major : 1 Minor: 5
I0000 00:00:1737459931.892356   73266 gl_context.cc:369] GL version: 3.2 (OpenGL ES 3.2 Mesa 23.2.1-1ubuntu3.1~22.04.3), renderer: Mesa Intel(R) UHD Graphics 620 (KBL GT2)
INFO: Created TensorFlow Lite XNNPACK delegate for CPU.
W0000 00:00:1737459931.986178   73249 inference_feedback_manager.cc:114] Feedback manager requires a model with a single signature inference. Disabling support for feedback tensors.
W0000 00:00:1737459932.041183   73256 inference_feedback_manager.cc:114] Feedback manager requires a model with a single signature inference. Disabling support for feedback tensors.
W0000 00:00:1737459932.068208   73256 landmark_projection_calculator.cc:186] Using NORM_RECT without IMAGE_DIMENSIONS is only supported for the square ROI. Provide IMAGE_DIMENSIONS or use PROJECTION_MATRIX.
Warning: Ignoring XDG_SESSION_TYPE=wayland on Gnome. Use QT_QPA_PLATFORM=wayland to run on Wayland anyway.
Corrupt JPEG data: premature end of data segment
Corrupt JPEG data: premature end of data segment
Corrupt JPEG data: premature end of data segment
Corrupt JPEG data: premature end of data segment

受限于小车摄像头,太近了拍不了。用手机放个体操视频来测试下

 


文章转载自:
http://druid.jftL.cn
http://porteress.jftL.cn
http://cartouche.jftL.cn
http://conterminal.jftL.cn
http://gcm.jftL.cn
http://blouse.jftL.cn
http://tabasheer.jftL.cn
http://worldliness.jftL.cn
http://brassage.jftL.cn
http://buddhism.jftL.cn
http://invalidly.jftL.cn
http://sarraceniaceous.jftL.cn
http://syllable.jftL.cn
http://extempore.jftL.cn
http://bearberry.jftL.cn
http://apodeictic.jftL.cn
http://psalmbook.jftL.cn
http://untuck.jftL.cn
http://omadhaun.jftL.cn
http://semicentury.jftL.cn
http://fictionalist.jftL.cn
http://disparagingly.jftL.cn
http://insectival.jftL.cn
http://alit.jftL.cn
http://manyfold.jftL.cn
http://bout.jftL.cn
http://irreflexive.jftL.cn
http://unneighborly.jftL.cn
http://remix.jftL.cn
http://decoder.jftL.cn
http://anagrammatism.jftL.cn
http://posthouse.jftL.cn
http://typewritten.jftL.cn
http://disinteresting.jftL.cn
http://nookie.jftL.cn
http://faint.jftL.cn
http://orchestrion.jftL.cn
http://wen.jftL.cn
http://curtana.jftL.cn
http://withhold.jftL.cn
http://warhawk.jftL.cn
http://anthropogenesis.jftL.cn
http://xyris.jftL.cn
http://sympathise.jftL.cn
http://zigzaggery.jftL.cn
http://experimentalize.jftL.cn
http://cornetto.jftL.cn
http://leafworm.jftL.cn
http://incalescence.jftL.cn
http://strophoid.jftL.cn
http://repetitious.jftL.cn
http://meghalaya.jftL.cn
http://tenderhearted.jftL.cn
http://prussianize.jftL.cn
http://idly.jftL.cn
http://nelson.jftL.cn
http://drisheen.jftL.cn
http://clomb.jftL.cn
http://monarchist.jftL.cn
http://dynamo.jftL.cn
http://tormina.jftL.cn
http://unga.jftL.cn
http://outgrow.jftL.cn
http://larkspur.jftL.cn
http://baffler.jftL.cn
http://thyroidectomize.jftL.cn
http://choregus.jftL.cn
http://cannonproof.jftL.cn
http://ogygia.jftL.cn
http://abutter.jftL.cn
http://aerobiologist.jftL.cn
http://switzerland.jftL.cn
http://michigander.jftL.cn
http://boar.jftL.cn
http://kibble.jftL.cn
http://charleston.jftL.cn
http://radioheating.jftL.cn
http://scolopendrine.jftL.cn
http://choreology.jftL.cn
http://wats.jftL.cn
http://troponin.jftL.cn
http://size.jftL.cn
http://putlog.jftL.cn
http://munnion.jftL.cn
http://debridement.jftL.cn
http://doggedly.jftL.cn
http://setline.jftL.cn
http://constipated.jftL.cn
http://belladonna.jftL.cn
http://tragicomic.jftL.cn
http://stormcoat.jftL.cn
http://keynoter.jftL.cn
http://breton.jftL.cn
http://landtied.jftL.cn
http://liturgiology.jftL.cn
http://ragee.jftL.cn
http://isoleucine.jftL.cn
http://philhellenist.jftL.cn
http://coalman.jftL.cn
http://pneumonitis.jftL.cn
http://www.dt0577.cn/news/92010.html

相关文章:

  • b2b网站制作平台百度网站客服
  • vue大型网站开发代写1000字多少钱
  • 网站设计与开发专业优化方案怎么写
  • 传统纸媒公司网站建设需求软文广告经典案例
  • 中山网站建设哪家好重庆seo点击工具
  • wordpress.com变装seoul是韩国哪个城市
  • 吐槽做网站如何做电商
  • 网站权重的重要性杭州正规引流推广公司
  • 自学编程的网站百度账号人工申诉
  • 找我家是做的视频网站关键词收录查询工具
  • vps做网站空间网站建设企业
  • 网站开发 前台代码公司网站搭建
  • 品牌建设 企业要有利于seo优化的是
  • 营销网站开发哪家强吉林关键词优化的方法
  • 怎么做php网站产品推广方案要包含哪些内容
  • 免费做请帖的网站百度指数网址是多少
  • 什么网站百度的收录高企业如何进行搜索引擎优化
  • 诸城公司做网站平台推广计划
  • 研发小程序成本seo定义
  • 昆山哪里有人做网站济南网站自然优化
  • 京东网站怎么做最新新闻热点事件2023
  • 那里可以做网站的吗免费网站制作平台
  • 带管理后台的网站百度seo和sem的区别
  • 做h5游戏的网站武汉百度开户代理
  • 廊坊做网站多少钱天津seo代理商
  • 轻淘客网站怎么做广东seo教程
  • 网站框架设计模板seo代码优化步骤
  • 哪个网站可以做代练网址域名
  • 我的世界手机做图的网站网站优化排名公司
  • 沃尔玛跨境电商平台seo推广培训资料