Ran a lot of times openposedemo, whether it is video, webcam or images, are running the results of a flash, but we want to certainly not just look at the results of the operation is finished, in many cases, we want to be able to run the results of the image, joint point coordinate information, The number of statistics and other data are preserved so that we can more in-depth analysis and application of openpose, then the role of this blog is to tell you how to save the results of these operations.
There are two ways to save the results of the Openposedemo program, one is to use the official GitHub directly Openpose Demo of the 1.0.1 release version of the command line operation, the other is to modify the Openposedemo source code, so that the compilation of the release version of the program directly can save the results of the run. Below, the author in two ways to do a detailed introduction.
One, command-line mode
According to the official GitHub Quick-start documentation, the program running Openposedemo 1.0.1 on Windows is as follows,
According to the above command, if you need to save the running picture results, or to save the joint points (feature points) of the coordinate information, or to save the statistics of the information content, you can run the following command
"PS" The following commands only provide images commands, and other video and webcam are saved in the same manner as images.
Under the Examples/folder, create a folder Media_out with the Media folder, and then run the following program
Save Image
bin/OpenPose.exe --image_dir examples/media/ --write_images examples/media_out/
Write_images: The source code gives the explanation for "Directory to write rendered frames in write_images_format
image Format.examples", which is the path setting for the stored run result image, in the format write_images_format
The default is png
format. The above command defaults to saving the image with the bones added to the media_out
folder.
Save JSON file
bin/OpenPose.exe --image_dir examples/media/ --write_keypoint_json examples/media_out/
Write_keypoint_json: The source code is interpreted as "Directory to write the people body pose keypoint data. Set format with write_keypoint_format
", which is the joint point data file for human skeleton posture, the file format is the write_keypoint_format
default json
format. The above command defaults to saving the image with the bones added to the media_out
folder.
A JSON file that represents the key point of a human skeleton, the author does not run the face and hand model, and thus shows only the data information of the pose joint point.
"Pose_keypoints" is the current image of the human body 18 joint points of data information, its specific meaning still needs to be deeply understood, here the author does not do a deep dive, as to how to see is 18 joint point, in fact, we casually look at this data set, immediately can see about 3 data for a group, That represents a joint point, with just 18 sets of information.
"2017/8/6" read the official GitHub documentation output.md only to know that the original joint point information includes (x,y,score)
three information, x and y is the coordinate information in the image, the value range is (0,image.size), and score represents the predictive score, A normalized processing, the value range (0,1), the closer the 1 value means that the more accurate the prediction, the higher the reduction of the joint point, the higher the reduction of the attitude.
The coordinate information of the above joint points can be referenced by the model given in the official documentation, as below, for research
"PS" This model provides a skeleton model of the Coco 18 joint point.
Save Yml File
bin/OpenPose.exe --image_dir examples/media/ --write_keypoint examples/media_out/
Write_keypoint: The source code is interpreted as "File extension and format for write_keypoint
: JSON, XML, Yaml & Yml. Json not available for OpenCV < 3.0, use write_keypoint_json
instead ", which is the joint point data file for the human skeleton posture, the file format is write_keypoint
the default yml
format. The above command defaults to saving the image with the bones added to the media_out
folder.
"PS" note OPENCV less than 3.0 versions, does not support JSON-formatted text output, of course, the official OPENCV is higher than 3.0, everyone started to learn to avoid problems, as far as possible to use the official version.
A yml file that represents the key point of a human skeleton, the author does not run the face and hand models, and thus only shows the data information of the pose joint point.
Using the same method can generate XML files, as for the specific meaning of the Yml file, here the author is no longer described in detail, because the author has not yet figured out, welcome to have made clear the small partners to the author of the message.
"2017/8/6"
About the Yml file
"%yaml:1.0" indicates that the current YAML version is 1.0;
"Pose_0" represents the current processing of the image of the entire attitude information, including single-person situation and multiple cases;
"Sizes" means that the current "data" is the size of the 1*18*3 matrix, where "1" represents the number of people, "18" indicates the number of joint points used by the model should be detected, the author uses Coco, so is the 18,3 represents a joint point coordinates and score information.
"DT" This east the author has not been clear, suspect is the format of the data for float, still to be verified.
The meaning of the specific data in "data" is not understood for the time being.
Second, the source code modification compilation Release mode
Source modification is more convenient, now let us look at Openposedemo source code content,
There is such a paragraph, here I see clearly see the annotated "//result saving" information, the above 9 value field is to save the results of the preparation, the specific meaning, the author here is no longer a random translation, we can see the right side of the field interpretation, After you modify the results you want to save and the path to save the results, you can execute the OPENPOSEDEMO program, generate the executable, and see the command-line pattern scenario for the generated content.
Third, off-topic-about Ubuntu
In the process of helping netizens to save running results on Ubuntu, the author finds that the commands on Ubuntu and windows are consistent, as long as the executable commands are replaced with Ubuntu, as shown below
./build/examples/openpose/openpose.bin --image_dir examples/media/ --write_images examples/media_out/
Other commands can be modified by analogy.
"PS" above content for the author to explore the Openpose process of humble opinion, welcome all Openpose enthusiasts point out problems and technical exchanges, if there is inappropriate, please leave a message to the author.
"Openpose-windows" Run OpenposeDemo.exe how to save image running results and joint point information