手识识别
使用caffe训练的pose_iter_102000.caffemodel 可以直接识别手的各个关节和重要点,这里我们使用opencv 4.4.0,当然我们可以使用更高的版本,区别不大
另外一个就是要使用opencv的dnn模块 在这里插入图片描述
在这里插入图片描述
#include
using namespace std;
using namespace cv;
using namespace cv::dnn;
#ifdef _DEBUG
#pragma comment(lib,"opencv_world440d.lib")
#else
#pragma comment(lib,"opencv_world440.lib")
#endif
const int POSE_PAIRS[20][2] =
{
{0,1}, {1,2}, {2,3}, {3,4}, // thumb
{0,5}, {5,6}, {6,7}, {7,8}, // index
{0,9}, {9,10}, {10,11}, {11,12}, // middle
{0,13}, {13,14}, {14,15}, {15,16}, // ring
{0,17}, {17,18}, {18,19}, {19,20} // small
};
string protoFile = "hand/pose_deploy.prototxt";
string weightsFile = "hand/pose_iter_102000.caffemodel";
int nPoints = 22;
int main(int argc, char **argv)
{
cout
关注
打赏