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

我自己的网站免费开发软件制作平台

我自己的网站,免费开发软件制作平台,wordpress 文章行距,莱芜网站优化平台使用opencv c 来调用caffemodel 使用opencv 得dnn 模块调用 caffemodel得程序,图片自己输入就行,不做过多得解释,看代码清单。 定义手指关节点 const int POSE_PAIRS[20][2] { {0,1}, {1,2}, {2,3}, {3,4}, // thumb {0,5}, {5,6}, {6,7}…

使用opencv c++ 来调用caffemodel

使用opencv 得dnn 模块调用 caffemodel得程序,图片自己输入就行,不做过多得解释,看代码清单。
在这里插入图片描述

在这里插入图片描述

定义手指关节点

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;

代码清单

#include <opencv2/dnn.hpp>
#include <opencv2/imgproc.hpp>
#include <opencv2/highgui.hpp>
#include <iostream>using namespace std;
using namespace cv;
using namespace cv::dnn;
#ifdef _DEBUG
#pragma comment(lib,"opencv_world455d.lib")
#else
#pragma comment(lib,"opencv_world455.lib")
#endifconst 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)
{string imageFile = "qianbo2.jpg";// Take arguments from commmand lineif (argc == 2){imageFile = argv[1];}float thresh = 0.01;Mat frame = imread(imageFile);Mat frameCopy = frame.clone();int frameWidth = frame.cols;int frameHeight = frame.rows;float aspect_ratio = frameWidth / (float)frameHeight;int inHeight = 368;int inWidth = (int(aspect_ratio*inHeight) * 8) / 8;cout << "inWidth = " << inWidth << " ; inHeight = " << inHeight << endl;double t = (double)cv::getTickCount();Net net = readNetFromCaffe(protoFile, weightsFile);Mat inpBlob = blobFromImage(frame, 1.0 / 255, Size(inWidth, inHeight), Scalar(0, 0, 0), false, false);net.setInput(inpBlob);Mat output = net.forward();int H = output.size[2];int W = output.size[3];// find the position of the body partsvector<Point> points(nPoints);for (int n = 0; n < nPoints; n++){// Probability map of corresponding body's part.Mat probMap(H, W, CV_32F, output.ptr(0, n));resize(probMap, probMap, Size(frameWidth, frameHeight));Point maxLoc;double prob;minMaxLoc(probMap, 0, &prob, 0, &maxLoc);if (prob > thresh){circle(frameCopy, cv::Point((int)maxLoc.x, (int)maxLoc.y), 8, Scalar(0, 255, 255), -1);cv::putText(frameCopy, cv::format("%d", n), cv::Point((int)maxLoc.x, (int)maxLoc.y), cv::FONT_HERSHEY_COMPLEX, 1, cv::Scalar(0, 0, 255), 2);}points[n] = maxLoc;}int nPairs = sizeof(POSE_PAIRS) / sizeof(POSE_PAIRS[0]);for (int n = 0; n < nPairs; n++){// lookup 2 connected body/hand partsPoint2f partA = points[POSE_PAIRS[n][0]];Point2f partB = points[POSE_PAIRS[n][1]];if (partA.x <= 0 || partA.y <= 0 || partB.x <= 0 || partB.y <= 0)continue;line(frame, partA, partB, Scalar(0, 255, 255), 8);circle(frame, partA, 8, Scalar(0, 0, 255), -1);circle(frame, partB, 8, Scalar(0, 0, 255), -1);}t = ((double)cv::getTickCount() - t) / cv::getTickFrequency();cout << "Time Taken = " << t << endl;imshow("Keypoints", frameCopy);imshow("Skeleton", frame);imwrite("out.jpg", frame);waitKey();return 0;
}
http://www.hkea.cn/news/35133/

相关文章:

  • 做网站软件wd惠州seo外包
  • 聊城做网站seo关键词分类
  • 网站做公司女生学网络营销这个专业好吗
  • 网络运营主要工作内容seo教程自学入门教材
  • 用其他商标在自己网站做宣传百度云网盘资源分享网站
  • 对商家而言网站建设的好处淘宝关键词查询工具哪个好
  • 做简单网站代码关键词推广价格
  • 做品牌折扣的网站百度推广的五大优势
  • 南宁比较有好的网站制作公司百度推广后台登录页面
  • 长沙企业网站排名优化windows优化大师和360哪个好
  • 珠海网站开发维护科技公司免费的网络推广渠道有哪些
  • wp建站系统微信营销管理软件
  • 本地打开WordPress慢百度seo优化分析
  • 适合友情链接的网站排名函数
  • 开发公司岗位设置广州seo招聘网
  • 国内web设计网站宣传推广
  • 深圳高端网站定制公司小时seo
  • wordpress主菜单下拉箭头怎么设置台州seo排名优化
  • 网站系统管理员模块关键词查找工具
  • 望江县建设局网站外贸seo推广招聘
  • 微信网站上传图片手机怎么制作网站
  • 简单做网站需要学什么搜索引擎有哪些网站
  • 网站备案信息加到哪里如何进行网站推广
  • 昭通网站制作aso优化技巧
  • 制作网站时怎样做滚动字幕新网站多久会被百度收录
  • 余姚物流做网站微信指数是搜索量吗
  • 怎样做网站轮播今日国内重大新闻事件
  • 想给大学做网站百度网盘搜索神器
  • jsp网站开发论文官方app下载安装
  • 关于机场建设的网站今日疫情最新情况