Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to write the sample code for OpenCV hand key point detection?

2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/01 Report--

How to write the sample code of OpenCV hand key point detection? in view of this problem, this article introduces the corresponding analysis and solution in detail, hoping to help more partners who want to solve this problem to find a more simple and feasible method.

Algorithm thought

The algorithm model used by the author in this paper is CMU Perceptual Computing Lab's open source library OpenPose for human body, face and hand key point detection, in which the hand key point detection (Hand Keypoint detector) algorithm comes from CVPR2017's paper "Hand Keypoint Detection in Single Images using Multiview Bootstrapping".

Because of different viewing angles and flexible fine movements in 3D space, it is difficult to get accurately labeled data sets. In this paper, the author proposes an improved iterative algorithm for hand key point detection called Multiview Bootstrapping, and realizes a detection algorithm with high precision.

As shown in the figure above, the author proposes to first train the Convolutional Pose Machines neural network with a small number of labeled data sets containing human key points, use 31 high-definition cameras with different viewing angles to photograph hands, use the above detection model to initially detect the key points, construct a triangle (triangulation) of these key points according to the position and posture of the camera, and get the 3D position of the key points. Then the calculated 3D point position is reprojected to each 2D image with different visual angle, and then these 2D images and key point labeling are used to train the detection model network. After several iterations, a more accurate hand key point detection model can be obtained.

The model proposed in the original paper can generate 22 key points, of which 21 points belong to the human hand and the 22nd point represents the background. The following figure shows the 21 key points of the human hand.

The main process of OpenCV hand key point detection

1) download the model

Run the getModels.sh download model in open source project

Or directly on the website:

Http://posefs1.perception.cs.cmu.edu/OpenPose/models/hand/pose_iter_102000.caffemodel

download. Put the model under the hand/ folder.

2) load models and images

Use the OpenCV DNN function readNetFromCaffe function to load model weights.

3) inference and prediction

BlobFromImage converts the image into a blob,forward function to realize network inference.

4) get the exact position of the key point and display it

The result of the above network calculation is 22 matrixes, each matrix represents the heat map where a particular key point is most likely to appear in the image, we need to call the minmaxLoc function to find the exact location, and then draw it and mark the sequence number.

5) draw the skeleton

This is the answer to the question on how to write the sample code for OpenCV hand key point detection. I hope the above content can be of some help to you. If you still have a lot of doubts to be solved, you can follow the industry information channel for more related knowledge.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report