{"id":2005,"date":"2018-08-06T16:30:03","date_gmt":"2018-08-06T08:30:03","guid":{"rendered":"http:\/\/www.magicandlove.com\/blog\/?p=2005"},"modified":"2018-08-06T16:43:41","modified_gmt":"2018-08-06T08:43:41","slug":"openpose-in-processing-and-opencv-dnn","status":"publish","type":"post","link":"http:\/\/www.magicandlove.com\/blog\/2018\/08\/06\/openpose-in-processing-and-opencv-dnn\/","title":{"rendered":"OpenPose in Processing and OpenCV (DNN)"},"content":{"rendered":"<p>This is the 2nd test of the OpenCV dnn module in Processing through my CVImage library. It used the <a href=\"https:\/\/github.com\/CMU-Perceptual-Computing-Lab\/openpose\" target=\"_blank\" rel=\"noopener\">OpenPose<\/a> pre-trained Caffe model.<\/p>\n<div id='gallery-1' class='gallery galleryid-2005 gallery-columns-3 gallery-size-thumbnail'><figure class='gallery-item'>\n\t\t\t<div class='gallery-icon landscape'>\n\t\t\t\t<a href='http:\/\/www.magicandlove.com\/blog\/wp-content\/uploads\/2018\/08\/openpose0066.png'><img loading=\"lazy\" decoding=\"async\" width=\"150\" height=\"150\" src=\"http:\/\/www.magicandlove.com\/blog\/wp-content\/uploads\/2018\/08\/openpose0066-150x150.png\" class=\"attachment-thumbnail size-thumbnail\" alt=\"\" srcset=\"http:\/\/www.magicandlove.com\/blog\/wp-content\/uploads\/2018\/08\/openpose0066-150x150.png 150w, http:\/\/www.magicandlove.com\/blog\/wp-content\/uploads\/2018\/08\/openpose0066-100x100.png 100w\" sizes=\"auto, (max-width: 150px) 100vw, 150px\" \/><\/a>\n\t\t\t<\/div><\/figure><figure class='gallery-item'>\n\t\t\t<div class='gallery-icon landscape'>\n\t\t\t\t<a href='http:\/\/www.magicandlove.com\/blog\/wp-content\/uploads\/2018\/08\/openpose0043.png'><img loading=\"lazy\" decoding=\"async\" width=\"150\" height=\"150\" src=\"http:\/\/www.magicandlove.com\/blog\/wp-content\/uploads\/2018\/08\/openpose0043-150x150.png\" class=\"attachment-thumbnail size-thumbnail\" alt=\"\" srcset=\"http:\/\/www.magicandlove.com\/blog\/wp-content\/uploads\/2018\/08\/openpose0043-150x150.png 150w, http:\/\/www.magicandlove.com\/blog\/wp-content\/uploads\/2018\/08\/openpose0043-100x100.png 100w\" sizes=\"auto, (max-width: 150px) 100vw, 150px\" \/><\/a>\n\t\t\t<\/div><\/figure><figure class='gallery-item'>\n\t\t\t<div class='gallery-icon landscape'>\n\t\t\t\t<a href='http:\/\/www.magicandlove.com\/blog\/wp-content\/uploads\/2018\/08\/openpose0050.png'><img loading=\"lazy\" decoding=\"async\" width=\"150\" height=\"150\" src=\"http:\/\/www.magicandlove.com\/blog\/wp-content\/uploads\/2018\/08\/openpose0050-150x150.png\" class=\"attachment-thumbnail size-thumbnail\" alt=\"\" srcset=\"http:\/\/www.magicandlove.com\/blog\/wp-content\/uploads\/2018\/08\/openpose0050-150x150.png 150w, http:\/\/www.magicandlove.com\/blog\/wp-content\/uploads\/2018\/08\/openpose0050-100x100.png 100w\" sizes=\"auto, (max-width: 150px) 100vw, 150px\" \/><\/a>\n\t\t\t<\/div><\/figure>\n\t\t<\/div>\n\n<p>Since the OpenCV dnn module can read the Caffe model through the <strong>readNetFromCaffe()<\/strong> function, the demo sends the real time webcam image to the model for human pose detection. It made use of the configuration file <strong>openpose_pose_coco.prototxt<\/strong> and the saved model <strong>pose_iter_440000.caffemodel<\/strong>. The original reference of the demo is from the <a href=\"https:\/\/github.com\/opencv\/opencv\/blob\/master\/samples\/dnn\/openpose.cpp\" target=\"_blank\" rel=\"noopener\">openpose.cpp<\/a> official OpenCV sample and the Java implementation from\u00a0 the GitHub of <a href=\"https:\/\/gist.github.com\/berak\/eef67a1afb4b6445d117ea1a0135c8db\" target=\"_blank\" rel=\"noopener\">berak<\/a>. You can download the model details below<\/p>\n<ul>\n<li><a href=\"https:\/\/raw.githubusercontent.com\/opencv\/opencv_extra\/master\/testdata\/dnn\/openpose_pose_coco.prototxt\" target=\"_blank\" rel=\"noopener\">openpose_pose_coco.prototxt<\/a><\/li>\n<li><a href=\"http:\/\/posefs1.perception.cs.cmu.edu\/OpenPose\/models\/pose\/coco\/pose_iter_440000.caffemodel\" target=\"_blank\" rel=\"noopener\">pose_iter_440000.caffemodel<\/a><\/li>\n<\/ul>\n<p>The description of the <a href=\"https:\/\/github.com\/CMU-Perceptual-Computing-Lab\/openpose\/blob\/master\/doc\/output.md\" target=\"_blank\" rel=\"noopener\">OpenPose output<\/a> can be found in their official GitHub site. The figure below is the posture information I used in my demo.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full\" src=\"https:\/\/raw.githubusercontent.com\/CMU-Perceptual-Computing-Lab\/openpose\/master\/doc\/media\/keypoints_pose_18.png\" width=\"480\" height=\"637\" \/><\/p>\n<p>Again, the source code is maintained in my Magicandlove repositories of my GitHub. You can download from <a href=\"https:\/\/github.com\/chungbwc\/Magicandlove\/tree\/master\/ml20180806b\" target=\"_blank\" rel=\"noopener\">here<\/a>.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>This is the 2nd test of the OpenCV dnn module in Processing through my CVImage library. It used the OpenPose pre-trained Caffe model. Since the OpenCV dnn module can read the Caffe model through the readNetFromCaffe() function, the demo sends the real time webcam image to the model for human pose detection. It made use [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[89,79],"tags":[160,3,161,62],"class_list":["post-2005","post","type-post","status-publish","format-standard","hentry","category-research","category-software-2","tag-caffe","tag-opencv","tag-openpose","tag-processing-org"],"_links":{"self":[{"href":"http:\/\/www.magicandlove.com\/blog\/wp-json\/wp\/v2\/posts\/2005","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/www.magicandlove.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.magicandlove.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.magicandlove.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.magicandlove.com\/blog\/wp-json\/wp\/v2\/comments?post=2005"}],"version-history":[{"count":2,"href":"http:\/\/www.magicandlove.com\/blog\/wp-json\/wp\/v2\/posts\/2005\/revisions"}],"predecessor-version":[{"id":2010,"href":"http:\/\/www.magicandlove.com\/blog\/wp-json\/wp\/v2\/posts\/2005\/revisions\/2010"}],"wp:attachment":[{"href":"http:\/\/www.magicandlove.com\/blog\/wp-json\/wp\/v2\/media?parent=2005"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.magicandlove.com\/blog\/wp-json\/wp\/v2\/categories?post=2005"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.magicandlove.com\/blog\/wp-json\/wp\/v2\/tags?post=2005"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}