MCPcopy Create free account
hub / github.com/CMU-Perceptual-Computing-Lab/openpose / configureWrapper

Function configureWrapper

examples/openpose/openpose.cpp:15–122  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

13#include <openpose/headers.hpp>
14
15void configureWrapper(op::Wrapper& opWrapper)
16{
17 try
18 {
19 // Configuring OpenPose
20
21 // logging_level
22 op::checkBool(
23 0 <= FLAGS_logging_level && FLAGS_logging_level <= 255, "Wrong logging_level value.",
24 __LINE__, __FUNCTION__, __FILE__);
25 op::ConfigureLog::setPriorityThreshold((op::Priority)FLAGS_logging_level);
26 op::Profiler::setDefaultX(FLAGS_profile_speed);
27
28 // Applying user defined configuration - GFlags to program variables
29 // producerType
30 op::ProducerType producerType;
31 op::String producerString;
32 std::tie(producerType, producerString) = op::flagsToProducer(
33 op::String(FLAGS_image_dir), op::String(FLAGS_video), op::String(FLAGS_ip_camera), FLAGS_camera,
34 FLAGS_flir_camera, FLAGS_flir_camera_index);
35 // cameraSize
36 const auto cameraSize = op::flagsToPoint(op::String(FLAGS_camera_resolution), "-1x-1");
37 // outputSize
38 const auto outputSize = op::flagsToPoint(op::String(FLAGS_output_resolution), "-1x-1");
39 // netInputSize
40 const auto netInputSize = op::flagsToPoint(op::String(FLAGS_net_resolution), "-1x368");
41 // faceNetInputSize
42 const auto faceNetInputSize = op::flagsToPoint(op::String(FLAGS_face_net_resolution), "368x368 (multiples of 16)");
43 // handNetInputSize
44 const auto handNetInputSize = op::flagsToPoint(op::String(FLAGS_hand_net_resolution), "368x368 (multiples of 16)");
45 // poseMode
46 const auto poseMode = op::flagsToPoseMode(FLAGS_body);
47 // poseModel
48 const auto poseModel = op::flagsToPoseModel(op::String(FLAGS_model_pose));
49 // JSON saving
50 if (!FLAGS_write_keypoint.empty())
51 op::opLog(
52 "Flag `write_keypoint` is deprecated and will eventually be removed. Please, use `write_json`"
53 " instead.", op::Priority::Max);
54 // keypointScaleMode
55 const auto keypointScaleMode = op::flagsToScaleMode(FLAGS_keypoint_scale);
56 // heatmaps to add
57 const auto heatMapTypes = op::flagsToHeatMaps(FLAGS_heatmaps_add_parts, FLAGS_heatmaps_add_bkg,
58 FLAGS_heatmaps_add_PAFs);
59 const auto heatMapScaleMode = op::flagsToHeatMapScaleMode(FLAGS_heatmaps_scale);
60 // >1 camera view?
61 const auto multipleView = (FLAGS_3d || FLAGS_3d_views > 1 || FLAGS_flir_camera);
62 // Face and hand detectors
63 const auto faceDetector = op::flagsToDetector(FLAGS_face_detector);
64 const auto handDetector = op::flagsToDetector(FLAGS_hand_detector);
65 // Enabling Google Logging
66 const bool enableGoogleLogging = true;
67
68 // Pose configuration (use WrapperStructPose{} for default and recommended configuration)
69 const op::WrapperStructPose wrapperStructPose{
70 poseMode, netInputSize, outputSize, keypointScaleMode, FLAGS_num_gpu, FLAGS_num_gpu_start,
71 FLAGS_scale_number, (float)FLAGS_scale_gap, op::flagsToRenderMode(FLAGS_render_pose, multipleView),
72 poseModel, !FLAGS_disable_blending, (float)FLAGS_alpha_pose, (float)FLAGS_alpha_heatmap,

Callers 1

openPoseDemoFunction · 0.70

Calls 15

checkBoolFunction · 0.85
setPriorityThresholdFunction · 0.85
flagsToProducerFunction · 0.85
flagsToPointFunction · 0.85
flagsToPoseModeFunction · 0.85
flagsToPoseModelFunction · 0.85
flagsToScaleModeFunction · 0.85
flagsToHeatMapsFunction · 0.85
flagsToHeatMapScaleModeFunction · 0.85
flagsToDetectorFunction · 0.85
flagsToRenderModeFunction · 0.85
stringToDataFormatFunction · 0.85

Tested by

no test coverage detected