diff --git a/doc/release_notes.md b/doc/release_notes.md index 8acbad11..69623b32 100644 --- a/doc/release_notes.md +++ b/doc/release_notes.md @@ -385,12 +385,14 @@ OpenPose Library - Release Notes ## Current version - Future OpenPose 1.6.0 1. Main improvements: - 1. Headers do not contain any 3rd-party library includes nor functions. This way, OpenPose can be exported without needing 3rd-party includes nor static library files (e.g., lib files in Windows), allowing people to use their own versions of OpenCV, Eigen, etc. without conflicting with OpenPose. Dynamic library files (e.g., `dll` files in Windows, `so` in Ubuntu) are still required. - 2. Created the `openpose_private` directory with some internal headers that, if exported with OpenPose, would require including 3rd-party headers and static library files. - 3. Default OpenCV version for Windows upgraded to version 4.1.1, extracted from their oficial website: section `Releases`, subsection `OpenCV - 4.1.1`, `Windows` version. - 4. In all `*.cpp` files, their include of their analog `*.hpp` file has been moved to the first line of those `*.cpp` files to slightly speed up compiling time. + 1. Created Matrix as container of cv::Mat, and String as container of std::string. + 2. After replacing cv::Mat by Matrix, headers do not contain any 3rd-party library includes nor functions. This way, OpenPose can be exported without needing 3rd-party includes nor static library files (e.g., lib files in Windows), allowing people to use their own versions of OpenCV, Eigen, etc. without conflicting with OpenPose. Dynamic library files (e.g., `dll` files in Windows, `so` in Ubuntu) are still required. + 3. Created the `openpose_private` directory with some internal headers that, if exported with OpenPose, would require including 3rd-party headers and static library files. + 4. Default OpenCV version for Windows upgraded to version 4.1.1, extracted from their oficial website: section `Releases`, subsection `OpenCV - 4.1.1`, `Windows` version. + 5. In all `*.cpp` files, their include of their analog `*.hpp` file has been moved to the first line of those `*.cpp` files to slightly speed up compiling time. + 6. String is used in `include/openpose/wrapper/` to avoid std::string to cause errors for using diferent std DLLs. 2. Functions or parameters renamed: - 1. All headers moved into `openpose_private` and all 3rd-party library calls in headers. + 1. All headers moved into `openpose_private`, all 3rd-party library calls in headers, and std::string calls in `include/openpose/wrapper/`. 2. Renamed `dLog()` as `opLogIfDebug()`, `log()` as `opLog()`, `check()` as `checkBool()`, and also renamed all the `checkX()` functions in `include/openpose/utilities/check.hpp`. This avoids compiling crashes when exporting OpenPose to other projects which contain other 3rd-party libraries that define functions with the same popular names with `#define`. 3. Main bugs fixed: 1. Removed many Visual Studio (Windows) warnings. diff --git a/examples/calibration/calibration.cpp b/examples/calibration/calibration.cpp index 004a6cbd..8079c001 100644 --- a/examples/calibration/calibration.cpp +++ b/examples/calibration/calibration.cpp @@ -48,7 +48,7 @@ int openPoseDemo() op::ConfigureLog::setPriorityThreshold((op::Priority)FLAGS_logging_level); // Common parameters - const auto gridInnerCorners = op::flagsToPoint(FLAGS_grid_number_inner_corners, "12x7"); + const auto gridInnerCorners = op::flagsToPoint(op::String(FLAGS_grid_number_inner_corners), "12x7"); const auto calibrationImageDir = op::formatAsDirectory(FLAGS_calibration_image_dir); const auto gridSqureSizeMm = (float)FLAGS_grid_square_size_mm; diff --git a/examples/openpose/openpose.cpp b/examples/openpose/openpose.cpp index c4453c01..c6a2eaa3 100755 --- a/examples/openpose/openpose.cpp +++ b/examples/openpose/openpose.cpp @@ -28,23 +28,24 @@ void configureWrapper(op::Wrapper& opWrapper) // Applying user defined configuration - GFlags to program variables // producerType op::ProducerType producerType; - std::string producerString; + op::String producerString; std::tie(producerType, producerString) = op::flagsToProducer( - FLAGS_image_dir, FLAGS_video, FLAGS_ip_camera, FLAGS_camera, FLAGS_flir_camera, FLAGS_flir_camera_index); + op::String(FLAGS_image_dir), op::String(FLAGS_video), op::String(FLAGS_ip_camera), FLAGS_camera, + FLAGS_flir_camera, FLAGS_flir_camera_index); // cameraSize - const auto cameraSize = op::flagsToPoint(FLAGS_camera_resolution, "-1x-1"); + const auto cameraSize = op::flagsToPoint(op::String(FLAGS_camera_resolution), "-1x-1"); // outputSize - const auto outputSize = op::flagsToPoint(FLAGS_output_resolution, "-1x-1"); + const auto outputSize = op::flagsToPoint(op::String(FLAGS_output_resolution), "-1x-1"); // netInputSize - const auto netInputSize = op::flagsToPoint(FLAGS_net_resolution, "-1x368"); + const auto netInputSize = op::flagsToPoint(op::String(FLAGS_net_resolution), "-1x368"); // faceNetInputSize - const auto faceNetInputSize = op::flagsToPoint(FLAGS_face_net_resolution, "368x368 (multiples of 16)"); + const auto faceNetInputSize = op::flagsToPoint(op::String(FLAGS_face_net_resolution), "368x368 (multiples of 16)"); // handNetInputSize - const auto handNetInputSize = op::flagsToPoint(FLAGS_hand_net_resolution, "368x368 (multiples of 16)"); + const auto handNetInputSize = op::flagsToPoint(op::String(FLAGS_hand_net_resolution), "368x368 (multiples of 16)"); // poseMode const auto poseMode = op::flagsToPoseMode(FLAGS_body); // poseModel - const auto poseModel = op::flagsToPoseModel(FLAGS_model_pose); + const auto poseModel = op::flagsToPoseModel(op::String(FLAGS_model_pose)); // JSON saving if (!FLAGS_write_keypoint.empty()) op::opLog( @@ -69,9 +70,10 @@ void configureWrapper(op::Wrapper& opWrapper) poseMode, netInputSize, outputSize, keypointScaleMode, FLAGS_num_gpu, FLAGS_num_gpu_start, FLAGS_scale_number, (float)FLAGS_scale_gap, op::flagsToRenderMode(FLAGS_render_pose, multipleView), poseModel, !FLAGS_disable_blending, (float)FLAGS_alpha_pose, (float)FLAGS_alpha_heatmap, - FLAGS_part_to_show, FLAGS_model_folder, heatMapTypes, heatMapScaleMode, FLAGS_part_candidates, + FLAGS_part_to_show, op::String(FLAGS_model_folder), heatMapTypes, heatMapScaleMode, FLAGS_part_candidates, (float)FLAGS_render_threshold, FLAGS_number_people_max, FLAGS_maximize_positives, FLAGS_fps_max, - FLAGS_prototxt_path, FLAGS_caffemodel_path, (float)FLAGS_upsampling_ratio, enableGoogleLogging}; + op::String(FLAGS_prototxt_path), op::String(FLAGS_caffemodel_path), + (float)FLAGS_upsampling_ratio, enableGoogleLogging}; opWrapper.configure(wrapperStructPose); // Face configuration (use op::WrapperStructFace{} to disable it) const op::WrapperStructFace wrapperStructFace{ @@ -93,15 +95,17 @@ void configureWrapper(op::Wrapper& opWrapper) const op::WrapperStructInput wrapperStructInput{ producerType, producerString, FLAGS_frame_first, FLAGS_frame_step, FLAGS_frame_last, FLAGS_process_real_time, FLAGS_frame_flip, FLAGS_frame_rotate, FLAGS_frames_repeat, - cameraSize, FLAGS_camera_parameter_path, FLAGS_frame_undistort, FLAGS_3d_views}; + cameraSize, op::String(FLAGS_camera_parameter_path), FLAGS_frame_undistort, FLAGS_3d_views}; opWrapper.configure(wrapperStructInput); // Output (comment or use default argument to disable any output) const op::WrapperStructOutput wrapperStructOutput{ - FLAGS_cli_verbose, FLAGS_write_keypoint, op::stringToDataFormat(FLAGS_write_keypoint_format), - FLAGS_write_json, FLAGS_write_coco_json, FLAGS_write_coco_json_variants, FLAGS_write_coco_json_variant, - FLAGS_write_images, FLAGS_write_images_format, FLAGS_write_video, FLAGS_write_video_fps, - FLAGS_write_video_with_audio, FLAGS_write_heatmaps, FLAGS_write_heatmaps_format, FLAGS_write_video_3d, - FLAGS_write_video_adam, FLAGS_write_bvh, FLAGS_udp_host, FLAGS_udp_port}; + FLAGS_cli_verbose, op::String(FLAGS_write_keypoint), op::stringToDataFormat(FLAGS_write_keypoint_format), + op::String(FLAGS_write_json), op::String(FLAGS_write_coco_json), FLAGS_write_coco_json_variants, + FLAGS_write_coco_json_variant, op::String(FLAGS_write_images), op::String(FLAGS_write_images_format), + op::String(FLAGS_write_video), FLAGS_write_video_fps, FLAGS_write_video_with_audio, + op::String(FLAGS_write_heatmaps), op::String(FLAGS_write_heatmaps_format), op::String(FLAGS_write_video_3d), + op::String(FLAGS_write_video_adam), op::String(FLAGS_write_bvh), op::String(FLAGS_udp_host), + op::String(FLAGS_udp_port)}; opWrapper.configure(wrapperStructOutput); // GUI (comment or use default argument to disable any visual output) const op::WrapperStructGui wrapperStructGui{ diff --git a/examples/tests/handFromJsonTest.cpp b/examples/tests/handFromJsonTest.cpp index 3adb14d6..f409057a 100644 --- a/examples/tests/handFromJsonTest.cpp +++ b/examples/tests/handFromJsonTest.cpp @@ -41,7 +41,7 @@ int handFromJsonTest() // Applying user defined configuration - GFlags to program variables // handNetInputSize - const auto handNetInputSize = op::flagsToPoint(FLAGS_hand_net_resolution, "368x368 (multiples of 16)"); + const auto handNetInputSize = op::flagsToPoint(op::String(FLAGS_hand_net_resolution), "368x368 (multiples of 16)"); // producerType const auto producerSharedPtr = op::createProducer(op::ProducerType::ImageDirectory, FLAGS_image_dir); diff --git a/examples/tutorial_add_module/1_custom_post_processing.cpp b/examples/tutorial_add_module/1_custom_post_processing.cpp index 5233a9ef..a74884c7 100644 --- a/examples/tutorial_add_module/1_custom_post_processing.cpp +++ b/examples/tutorial_add_module/1_custom_post_processing.cpp @@ -46,23 +46,24 @@ void configureWrapper(op::WrapperT& opWrapperT) // Applying user defined configuration - GFlags to program variables // producerType op::ProducerType producerType; - std::string producerString; + op::String producerString; std::tie(producerType, producerString) = op::flagsToProducer( - FLAGS_image_dir, FLAGS_video, FLAGS_ip_camera, FLAGS_camera, FLAGS_flir_camera, FLAGS_flir_camera_index); + op::String(FLAGS_image_dir), op::String(FLAGS_video), op::String(FLAGS_ip_camera), FLAGS_camera, + FLAGS_flir_camera, FLAGS_flir_camera_index); // cameraSize - const auto cameraSize = op::flagsToPoint(FLAGS_camera_resolution, "-1x-1"); + const auto cameraSize = op::flagsToPoint(op::String(FLAGS_camera_resolution), "-1x-1"); // outputSize - const auto outputSize = op::flagsToPoint(FLAGS_output_resolution, "-1x-1"); + const auto outputSize = op::flagsToPoint(op::String(FLAGS_output_resolution), "-1x-1"); // netInputSize - const auto netInputSize = op::flagsToPoint(FLAGS_net_resolution, "-1x368"); + const auto netInputSize = op::flagsToPoint(op::String(FLAGS_net_resolution), "-1x368"); // faceNetInputSize - const auto faceNetInputSize = op::flagsToPoint(FLAGS_face_net_resolution, "368x368 (multiples of 16)"); + const auto faceNetInputSize = op::flagsToPoint(op::String(FLAGS_face_net_resolution), "368x368 (multiples of 16)"); // handNetInputSize - const auto handNetInputSize = op::flagsToPoint(FLAGS_hand_net_resolution, "368x368 (multiples of 16)"); + const auto handNetInputSize = op::flagsToPoint(op::String(FLAGS_hand_net_resolution), "368x368 (multiples of 16)"); // poseMode const auto poseMode = op::flagsToPoseMode(FLAGS_body); // poseModel - const auto poseModel = op::flagsToPoseModel(FLAGS_model_pose); + const auto poseModel = op::flagsToPoseModel(op::String(FLAGS_model_pose)); // JSON saving if (!FLAGS_write_keypoint.empty()) op::opLog( @@ -87,9 +88,10 @@ void configureWrapper(op::WrapperT& opWrapperT) poseMode, netInputSize, outputSize, keypointScaleMode, FLAGS_num_gpu, FLAGS_num_gpu_start, FLAGS_scale_number, (float)FLAGS_scale_gap, op::flagsToRenderMode(FLAGS_render_pose, multipleView), poseModel, !FLAGS_disable_blending, (float)FLAGS_alpha_pose, (float)FLAGS_alpha_heatmap, - FLAGS_part_to_show, FLAGS_model_folder, heatMapTypes, heatMapScaleMode, FLAGS_part_candidates, + FLAGS_part_to_show, op::String(FLAGS_model_folder), heatMapTypes, heatMapScaleMode, FLAGS_part_candidates, (float)FLAGS_render_threshold, FLAGS_number_people_max, FLAGS_maximize_positives, FLAGS_fps_max, - FLAGS_prototxt_path, FLAGS_caffemodel_path, (float)FLAGS_upsampling_ratio, enableGoogleLogging}; + op::String(FLAGS_prototxt_path), op::String(FLAGS_caffemodel_path), + (float)FLAGS_upsampling_ratio, enableGoogleLogging}; opWrapperT.configure(wrapperStructPose); // Face configuration (use op::WrapperStructFace{} to disable it) const op::WrapperStructFace wrapperStructFace{ @@ -111,15 +113,17 @@ void configureWrapper(op::WrapperT& opWrapperT) const op::WrapperStructInput wrapperStructInput{ producerType, producerString, FLAGS_frame_first, FLAGS_frame_step, FLAGS_frame_last, FLAGS_process_real_time, FLAGS_frame_flip, FLAGS_frame_rotate, FLAGS_frames_repeat, - cameraSize, FLAGS_camera_parameter_path, FLAGS_frame_undistort, FLAGS_3d_views}; + cameraSize, op::String(FLAGS_camera_parameter_path), FLAGS_frame_undistort, FLAGS_3d_views}; opWrapperT.configure(wrapperStructInput); // Output (comment or use default argument to disable any output) const op::WrapperStructOutput wrapperStructOutput{ - FLAGS_cli_verbose, FLAGS_write_keypoint, op::stringToDataFormat(FLAGS_write_keypoint_format), - FLAGS_write_json, FLAGS_write_coco_json, FLAGS_write_coco_json_variants, FLAGS_write_coco_json_variant, - FLAGS_write_images, FLAGS_write_images_format, FLAGS_write_video, FLAGS_write_video_fps, - FLAGS_write_video_with_audio, FLAGS_write_heatmaps, FLAGS_write_heatmaps_format, FLAGS_write_video_3d, - FLAGS_write_video_adam, FLAGS_write_bvh, FLAGS_udp_host, FLAGS_udp_port}; + FLAGS_cli_verbose, op::String(FLAGS_write_keypoint), op::stringToDataFormat(FLAGS_write_keypoint_format), + op::String(FLAGS_write_json), op::String(FLAGS_write_coco_json), FLAGS_write_coco_json_variants, + FLAGS_write_coco_json_variant, op::String(FLAGS_write_images), op::String(FLAGS_write_images_format), + op::String(FLAGS_write_video), FLAGS_write_video_fps, FLAGS_write_video_with_audio, + op::String(FLAGS_write_heatmaps), op::String(FLAGS_write_heatmaps_format), op::String(FLAGS_write_video_3d), + op::String(FLAGS_write_video_adam), op::String(FLAGS_write_bvh), op::String(FLAGS_udp_host), + op::String(FLAGS_udp_port)}; opWrapperT.configure(wrapperStructOutput); // GUI (comment or use default argument to disable any visual output) const op::WrapperStructGui wrapperStructGui{ diff --git a/examples/tutorial_api_cpp/03_keypoints_from_image.cpp b/examples/tutorial_api_cpp/03_keypoints_from_image.cpp index 6e2b8db7..d5eec836 100644 --- a/examples/tutorial_api_cpp/03_keypoints_from_image.cpp +++ b/examples/tutorial_api_cpp/03_keypoints_from_image.cpp @@ -79,17 +79,17 @@ void configureWrapper(op::Wrapper& opWrapper) // Applying user defined configuration - GFlags to program variables // outputSize - const auto outputSize = op::flagsToPoint(FLAGS_output_resolution, "-1x-1"); + const auto outputSize = op::flagsToPoint(op::String(FLAGS_output_resolution), "-1x-1"); // netInputSize - const auto netInputSize = op::flagsToPoint(FLAGS_net_resolution, "-1x368"); + const auto netInputSize = op::flagsToPoint(op::String(FLAGS_net_resolution), "-1x368"); // faceNetInputSize - const auto faceNetInputSize = op::flagsToPoint(FLAGS_face_net_resolution, "368x368 (multiples of 16)"); + const auto faceNetInputSize = op::flagsToPoint(op::String(FLAGS_face_net_resolution), "368x368 (multiples of 16)"); // handNetInputSize - const auto handNetInputSize = op::flagsToPoint(FLAGS_hand_net_resolution, "368x368 (multiples of 16)"); + const auto handNetInputSize = op::flagsToPoint(op::String(FLAGS_hand_net_resolution), "368x368 (multiples of 16)"); // poseMode const auto poseMode = op::flagsToPoseMode(FLAGS_body); // poseModel - const auto poseModel = op::flagsToPoseModel(FLAGS_model_pose); + const auto poseModel = op::flagsToPoseModel(op::String(FLAGS_model_pose)); // JSON saving if (!FLAGS_write_keypoint.empty()) op::opLog( @@ -114,9 +114,10 @@ void configureWrapper(op::Wrapper& opWrapper) poseMode, netInputSize, outputSize, keypointScaleMode, FLAGS_num_gpu, FLAGS_num_gpu_start, FLAGS_scale_number, (float)FLAGS_scale_gap, op::flagsToRenderMode(FLAGS_render_pose, multipleView), poseModel, !FLAGS_disable_blending, (float)FLAGS_alpha_pose, (float)FLAGS_alpha_heatmap, - FLAGS_part_to_show, FLAGS_model_folder, heatMapTypes, heatMapScaleMode, FLAGS_part_candidates, + FLAGS_part_to_show, op::String(FLAGS_model_folder), heatMapTypes, heatMapScaleMode, FLAGS_part_candidates, (float)FLAGS_render_threshold, FLAGS_number_people_max, FLAGS_maximize_positives, FLAGS_fps_max, - FLAGS_prototxt_path, FLAGS_caffemodel_path, (float)FLAGS_upsampling_ratio, enableGoogleLogging}; + op::String(FLAGS_prototxt_path), op::String(FLAGS_caffemodel_path), + (float)FLAGS_upsampling_ratio, enableGoogleLogging}; opWrapper.configure(wrapperStructPose); // Face configuration (use op::WrapperStructFace{} to disable it) const op::WrapperStructFace wrapperStructFace{ @@ -136,11 +137,13 @@ void configureWrapper(op::Wrapper& opWrapper) opWrapper.configure(wrapperStructExtra); // Output (comment or use default argument to disable any output) const op::WrapperStructOutput wrapperStructOutput{ - FLAGS_cli_verbose, FLAGS_write_keypoint, op::stringToDataFormat(FLAGS_write_keypoint_format), - FLAGS_write_json, FLAGS_write_coco_json, FLAGS_write_coco_json_variants, FLAGS_write_coco_json_variant, - FLAGS_write_images, FLAGS_write_images_format, FLAGS_write_video, FLAGS_write_video_fps, - FLAGS_write_video_with_audio, FLAGS_write_heatmaps, FLAGS_write_heatmaps_format, FLAGS_write_video_3d, - FLAGS_write_video_adam, FLAGS_write_bvh, FLAGS_udp_host, FLAGS_udp_port}; + FLAGS_cli_verbose, op::String(FLAGS_write_keypoint), op::stringToDataFormat(FLAGS_write_keypoint_format), + op::String(FLAGS_write_json), op::String(FLAGS_write_coco_json), FLAGS_write_coco_json_variants, + FLAGS_write_coco_json_variant, op::String(FLAGS_write_images), op::String(FLAGS_write_images_format), + op::String(FLAGS_write_video), FLAGS_write_video_fps, FLAGS_write_video_with_audio, + op::String(FLAGS_write_heatmaps), op::String(FLAGS_write_heatmaps_format), op::String(FLAGS_write_video_3d), + op::String(FLAGS_write_video_adam), op::String(FLAGS_write_bvh), op::String(FLAGS_udp_host), + op::String(FLAGS_udp_port)}; opWrapper.configure(wrapperStructOutput); // No GUI. Equivalent to: opWrapper.configure(op::WrapperStructGui{}); // Set to single-thread (for sequential processing and/or debugging and/or reducing latency) diff --git a/examples/tutorial_api_cpp/04_keypoints_from_images.cpp b/examples/tutorial_api_cpp/04_keypoints_from_images.cpp index 71695dd5..80b80296 100644 --- a/examples/tutorial_api_cpp/04_keypoints_from_images.cpp +++ b/examples/tutorial_api_cpp/04_keypoints_from_images.cpp @@ -81,17 +81,17 @@ void configureWrapper(op::Wrapper& opWrapper) // Applying user defined configuration - GFlags to program variables // outputSize - const auto outputSize = op::flagsToPoint(FLAGS_output_resolution, "-1x-1"); + const auto outputSize = op::flagsToPoint(op::String(FLAGS_output_resolution), "-1x-1"); // netInputSize - const auto netInputSize = op::flagsToPoint(FLAGS_net_resolution, "-1x368"); + const auto netInputSize = op::flagsToPoint(op::String(FLAGS_net_resolution), "-1x368"); // faceNetInputSize - const auto faceNetInputSize = op::flagsToPoint(FLAGS_face_net_resolution, "368x368 (multiples of 16)"); + const auto faceNetInputSize = op::flagsToPoint(op::String(FLAGS_face_net_resolution), "368x368 (multiples of 16)"); // handNetInputSize - const auto handNetInputSize = op::flagsToPoint(FLAGS_hand_net_resolution, "368x368 (multiples of 16)"); + const auto handNetInputSize = op::flagsToPoint(op::String(FLAGS_hand_net_resolution), "368x368 (multiples of 16)"); // poseMode const auto poseMode = op::flagsToPoseMode(FLAGS_body); // poseModel - const auto poseModel = op::flagsToPoseModel(FLAGS_model_pose); + const auto poseModel = op::flagsToPoseModel(op::String(FLAGS_model_pose)); // JSON saving if (!FLAGS_write_keypoint.empty()) op::opLog( @@ -116,9 +116,10 @@ void configureWrapper(op::Wrapper& opWrapper) poseMode, netInputSize, outputSize, keypointScaleMode, FLAGS_num_gpu, FLAGS_num_gpu_start, FLAGS_scale_number, (float)FLAGS_scale_gap, op::flagsToRenderMode(FLAGS_render_pose, multipleView), poseModel, !FLAGS_disable_blending, (float)FLAGS_alpha_pose, (float)FLAGS_alpha_heatmap, - FLAGS_part_to_show, FLAGS_model_folder, heatMapTypes, heatMapScaleMode, FLAGS_part_candidates, + FLAGS_part_to_show, op::String(FLAGS_model_folder), heatMapTypes, heatMapScaleMode, FLAGS_part_candidates, (float)FLAGS_render_threshold, FLAGS_number_people_max, FLAGS_maximize_positives, FLAGS_fps_max, - FLAGS_prototxt_path, FLAGS_caffemodel_path, (float)FLAGS_upsampling_ratio, enableGoogleLogging}; + op::String(FLAGS_prototxt_path), op::String(FLAGS_caffemodel_path), + (float)FLAGS_upsampling_ratio, enableGoogleLogging}; opWrapper.configure(wrapperStructPose); // Face configuration (use op::WrapperStructFace{} to disable it) const op::WrapperStructFace wrapperStructFace{ @@ -138,11 +139,13 @@ void configureWrapper(op::Wrapper& opWrapper) opWrapper.configure(wrapperStructExtra); // Output (comment or use default argument to disable any output) const op::WrapperStructOutput wrapperStructOutput{ - FLAGS_cli_verbose, FLAGS_write_keypoint, op::stringToDataFormat(FLAGS_write_keypoint_format), - FLAGS_write_json, FLAGS_write_coco_json, FLAGS_write_coco_json_variants, FLAGS_write_coco_json_variant, - FLAGS_write_images, FLAGS_write_images_format, FLAGS_write_video, FLAGS_write_video_fps, - FLAGS_write_video_with_audio, FLAGS_write_heatmaps, FLAGS_write_heatmaps_format, FLAGS_write_video_3d, - FLAGS_write_video_adam, FLAGS_write_bvh, FLAGS_udp_host, FLAGS_udp_port}; + FLAGS_cli_verbose, op::String(FLAGS_write_keypoint), op::stringToDataFormat(FLAGS_write_keypoint_format), + op::String(FLAGS_write_json), op::String(FLAGS_write_coco_json), FLAGS_write_coco_json_variants, + FLAGS_write_coco_json_variant, op::String(FLAGS_write_images), op::String(FLAGS_write_images_format), + op::String(FLAGS_write_video), FLAGS_write_video_fps, FLAGS_write_video_with_audio, + op::String(FLAGS_write_heatmaps), op::String(FLAGS_write_heatmaps_format), op::String(FLAGS_write_video_3d), + op::String(FLAGS_write_video_adam), op::String(FLAGS_write_bvh), op::String(FLAGS_udp_host), + op::String(FLAGS_udp_port)}; opWrapper.configure(wrapperStructOutput); // No GUI. Equivalent to: opWrapper.configure(op::WrapperStructGui{}); // Set to single-thread (for sequential processing and/or debugging and/or reducing latency) diff --git a/examples/tutorial_api_cpp/05_keypoints_from_images_multi_gpu.cpp b/examples/tutorial_api_cpp/05_keypoints_from_images_multi_gpu.cpp index e00a47c5..20442a54 100644 --- a/examples/tutorial_api_cpp/05_keypoints_from_images_multi_gpu.cpp +++ b/examples/tutorial_api_cpp/05_keypoints_from_images_multi_gpu.cpp @@ -87,17 +87,17 @@ void configureWrapper(op::Wrapper& opWrapper) // Applying user defined configuration - GFlags to program variables // outputSize - const auto outputSize = op::flagsToPoint(FLAGS_output_resolution, "-1x-1"); + const auto outputSize = op::flagsToPoint(op::String(FLAGS_output_resolution), "-1x-1"); // netInputSize - const auto netInputSize = op::flagsToPoint(FLAGS_net_resolution, "-1x368"); + const auto netInputSize = op::flagsToPoint(op::String(FLAGS_net_resolution), "-1x368"); // faceNetInputSize - const auto faceNetInputSize = op::flagsToPoint(FLAGS_face_net_resolution, "368x368 (multiples of 16)"); + const auto faceNetInputSize = op::flagsToPoint(op::String(FLAGS_face_net_resolution), "368x368 (multiples of 16)"); // handNetInputSize - const auto handNetInputSize = op::flagsToPoint(FLAGS_hand_net_resolution, "368x368 (multiples of 16)"); + const auto handNetInputSize = op::flagsToPoint(op::String(FLAGS_hand_net_resolution), "368x368 (multiples of 16)"); // poseMode const auto poseMode = op::flagsToPoseMode(FLAGS_body); // poseModel - const auto poseModel = op::flagsToPoseModel(FLAGS_model_pose); + const auto poseModel = op::flagsToPoseModel(op::String(FLAGS_model_pose)); // JSON saving if (!FLAGS_write_keypoint.empty()) op::opLog( @@ -122,9 +122,10 @@ void configureWrapper(op::Wrapper& opWrapper) poseMode, netInputSize, outputSize, keypointScaleMode, FLAGS_num_gpu, FLAGS_num_gpu_start, FLAGS_scale_number, (float)FLAGS_scale_gap, op::flagsToRenderMode(FLAGS_render_pose, multipleView), poseModel, !FLAGS_disable_blending, (float)FLAGS_alpha_pose, (float)FLAGS_alpha_heatmap, - FLAGS_part_to_show, FLAGS_model_folder, heatMapTypes, heatMapScaleMode, FLAGS_part_candidates, + FLAGS_part_to_show, op::String(FLAGS_model_folder), heatMapTypes, heatMapScaleMode, FLAGS_part_candidates, (float)FLAGS_render_threshold, FLAGS_number_people_max, FLAGS_maximize_positives, FLAGS_fps_max, - FLAGS_prototxt_path, FLAGS_caffemodel_path, (float)FLAGS_upsampling_ratio, enableGoogleLogging}; + op::String(FLAGS_prototxt_path), op::String(FLAGS_caffemodel_path), + (float)FLAGS_upsampling_ratio, enableGoogleLogging}; opWrapper.configure(wrapperStructPose); // Face configuration (use op::WrapperStructFace{} to disable it) const op::WrapperStructFace wrapperStructFace{ @@ -144,11 +145,13 @@ void configureWrapper(op::Wrapper& opWrapper) opWrapper.configure(wrapperStructExtra); // Output (comment or use default argument to disable any output) const op::WrapperStructOutput wrapperStructOutput{ - FLAGS_cli_verbose, FLAGS_write_keypoint, op::stringToDataFormat(FLAGS_write_keypoint_format), - FLAGS_write_json, FLAGS_write_coco_json, FLAGS_write_coco_json_variants, FLAGS_write_coco_json_variant, - FLAGS_write_images, FLAGS_write_images_format, FLAGS_write_video, FLAGS_write_video_fps, - FLAGS_write_video_with_audio, FLAGS_write_heatmaps, FLAGS_write_heatmaps_format, FLAGS_write_video_3d, - FLAGS_write_video_adam, FLAGS_write_bvh, FLAGS_udp_host, FLAGS_udp_port}; + FLAGS_cli_verbose, op::String(FLAGS_write_keypoint), op::stringToDataFormat(FLAGS_write_keypoint_format), + op::String(FLAGS_write_json), op::String(FLAGS_write_coco_json), FLAGS_write_coco_json_variants, + FLAGS_write_coco_json_variant, op::String(FLAGS_write_images), op::String(FLAGS_write_images_format), + op::String(FLAGS_write_video), FLAGS_write_video_fps, FLAGS_write_video_with_audio, + op::String(FLAGS_write_heatmaps), op::String(FLAGS_write_heatmaps_format), op::String(FLAGS_write_video_3d), + op::String(FLAGS_write_video_adam), op::String(FLAGS_write_bvh), op::String(FLAGS_udp_host), + op::String(FLAGS_udp_port)}; opWrapper.configure(wrapperStructOutput); // No GUI. Equivalent to: opWrapper.configure(op::WrapperStructGui{}); // Set to single-thread (for sequential processing and/or debugging and/or reducing latency) diff --git a/examples/tutorial_api_cpp/06_face_from_image.cpp b/examples/tutorial_api_cpp/06_face_from_image.cpp index a8259908..273a5083 100644 --- a/examples/tutorial_api_cpp/06_face_from_image.cpp +++ b/examples/tutorial_api_cpp/06_face_from_image.cpp @@ -82,17 +82,17 @@ void configureWrapper(op::Wrapper& opWrapper) // Applying user defined configuration - GFlags to program variables // outputSize - const auto outputSize = op::flagsToPoint(FLAGS_output_resolution, "-1x-1"); + const auto outputSize = op::flagsToPoint(op::String(FLAGS_output_resolution), "-1x-1"); // netInputSize - const auto netInputSize = op::flagsToPoint(FLAGS_net_resolution, "-1x368"); + const auto netInputSize = op::flagsToPoint(op::String(FLAGS_net_resolution), "-1x368"); // faceNetInputSize - const auto faceNetInputSize = op::flagsToPoint(FLAGS_face_net_resolution, "368x368 (multiples of 16)"); + const auto faceNetInputSize = op::flagsToPoint(op::String(FLAGS_face_net_resolution), "368x368 (multiples of 16)"); // handNetInputSize - const auto handNetInputSize = op::flagsToPoint(FLAGS_hand_net_resolution, "368x368 (multiples of 16)"); + const auto handNetInputSize = op::flagsToPoint(op::String(FLAGS_hand_net_resolution), "368x368 (multiples of 16)"); // poseMode const auto poseMode = op::flagsToPoseMode(FLAGS_body); // poseModel - const auto poseModel = op::flagsToPoseModel(FLAGS_model_pose); + const auto poseModel = op::flagsToPoseModel(op::String(FLAGS_model_pose)); // JSON saving if (!FLAGS_write_keypoint.empty()) op::opLog( @@ -117,9 +117,10 @@ void configureWrapper(op::Wrapper& opWrapper) poseMode, netInputSize, outputSize, keypointScaleMode, FLAGS_num_gpu, FLAGS_num_gpu_start, FLAGS_scale_number, (float)FLAGS_scale_gap, op::flagsToRenderMode(FLAGS_render_pose, multipleView), poseModel, !FLAGS_disable_blending, (float)FLAGS_alpha_pose, (float)FLAGS_alpha_heatmap, - FLAGS_part_to_show, FLAGS_model_folder, heatMapTypes, heatMapScaleMode, FLAGS_part_candidates, + FLAGS_part_to_show, op::String(FLAGS_model_folder), heatMapTypes, heatMapScaleMode, FLAGS_part_candidates, (float)FLAGS_render_threshold, FLAGS_number_people_max, FLAGS_maximize_positives, FLAGS_fps_max, - FLAGS_prototxt_path, FLAGS_caffemodel_path, (float)FLAGS_upsampling_ratio, enableGoogleLogging}; + op::String(FLAGS_prototxt_path), op::String(FLAGS_caffemodel_path), + (float)FLAGS_upsampling_ratio, enableGoogleLogging}; opWrapper.configure(wrapperStructPose); // Face configuration (use op::WrapperStructFace{} to disable it) const op::WrapperStructFace wrapperStructFace{ @@ -139,11 +140,13 @@ void configureWrapper(op::Wrapper& opWrapper) opWrapper.configure(wrapperStructExtra); // Output (comment or use default argument to disable any output) const op::WrapperStructOutput wrapperStructOutput{ - FLAGS_cli_verbose, FLAGS_write_keypoint, op::stringToDataFormat(FLAGS_write_keypoint_format), - FLAGS_write_json, FLAGS_write_coco_json, FLAGS_write_coco_json_variants, FLAGS_write_coco_json_variant, - FLAGS_write_images, FLAGS_write_images_format, FLAGS_write_video, FLAGS_write_video_fps, - FLAGS_write_video_with_audio, FLAGS_write_heatmaps, FLAGS_write_heatmaps_format, FLAGS_write_video_3d, - FLAGS_write_video_adam, FLAGS_write_bvh, FLAGS_udp_host, FLAGS_udp_port}; + FLAGS_cli_verbose, op::String(FLAGS_write_keypoint), op::stringToDataFormat(FLAGS_write_keypoint_format), + op::String(FLAGS_write_json), op::String(FLAGS_write_coco_json), FLAGS_write_coco_json_variants, + FLAGS_write_coco_json_variant, op::String(FLAGS_write_images), op::String(FLAGS_write_images_format), + op::String(FLAGS_write_video), FLAGS_write_video_fps, FLAGS_write_video_with_audio, + op::String(FLAGS_write_heatmaps), op::String(FLAGS_write_heatmaps_format), op::String(FLAGS_write_video_3d), + op::String(FLAGS_write_video_adam), op::String(FLAGS_write_bvh), op::String(FLAGS_udp_host), + op::String(FLAGS_udp_port)}; opWrapper.configure(wrapperStructOutput); // No GUI. Equivalent to: opWrapper.configure(op::WrapperStructGui{}); // Set to single-thread (for sequential processing and/or debugging and/or reducing latency) diff --git a/examples/tutorial_api_cpp/07_hand_from_image.cpp b/examples/tutorial_api_cpp/07_hand_from_image.cpp index 74894778..b2d67a47 100644 --- a/examples/tutorial_api_cpp/07_hand_from_image.cpp +++ b/examples/tutorial_api_cpp/07_hand_from_image.cpp @@ -82,17 +82,17 @@ void configureWrapper(op::Wrapper& opWrapper) // Applying user defined configuration - GFlags to program variables // outputSize - const auto outputSize = op::flagsToPoint(FLAGS_output_resolution, "-1x-1"); + const auto outputSize = op::flagsToPoint(op::String(FLAGS_output_resolution), "-1x-1"); // netInputSize - const auto netInputSize = op::flagsToPoint(FLAGS_net_resolution, "-1x368"); + const auto netInputSize = op::flagsToPoint(op::String(FLAGS_net_resolution), "-1x368"); // faceNetInputSize - const auto faceNetInputSize = op::flagsToPoint(FLAGS_face_net_resolution, "368x368 (multiples of 16)"); + const auto faceNetInputSize = op::flagsToPoint(op::String(FLAGS_face_net_resolution), "368x368 (multiples of 16)"); // handNetInputSize - const auto handNetInputSize = op::flagsToPoint(FLAGS_hand_net_resolution, "368x368 (multiples of 16)"); + const auto handNetInputSize = op::flagsToPoint(op::String(FLAGS_hand_net_resolution), "368x368 (multiples of 16)"); // poseMode const auto poseMode = op::flagsToPoseMode(FLAGS_body); // poseModel - const auto poseModel = op::flagsToPoseModel(FLAGS_model_pose); + const auto poseModel = op::flagsToPoseModel(op::String(FLAGS_model_pose)); // JSON saving if (!FLAGS_write_keypoint.empty()) op::opLog( @@ -117,9 +117,10 @@ void configureWrapper(op::Wrapper& opWrapper) poseMode, netInputSize, outputSize, keypointScaleMode, FLAGS_num_gpu, FLAGS_num_gpu_start, FLAGS_scale_number, (float)FLAGS_scale_gap, op::flagsToRenderMode(FLAGS_render_pose, multipleView), poseModel, !FLAGS_disable_blending, (float)FLAGS_alpha_pose, (float)FLAGS_alpha_heatmap, - FLAGS_part_to_show, FLAGS_model_folder, heatMapTypes, heatMapScaleMode, FLAGS_part_candidates, + FLAGS_part_to_show, op::String(FLAGS_model_folder), heatMapTypes, heatMapScaleMode, FLAGS_part_candidates, (float)FLAGS_render_threshold, FLAGS_number_people_max, FLAGS_maximize_positives, FLAGS_fps_max, - FLAGS_prototxt_path, FLAGS_caffemodel_path, (float)FLAGS_upsampling_ratio, enableGoogleLogging}; + op::String(FLAGS_prototxt_path), op::String(FLAGS_caffemodel_path), + (float)FLAGS_upsampling_ratio, enableGoogleLogging}; opWrapper.configure(wrapperStructPose); // Face configuration (use op::WrapperStructFace{} to disable it) const op::WrapperStructFace wrapperStructFace{ @@ -139,11 +140,13 @@ void configureWrapper(op::Wrapper& opWrapper) opWrapper.configure(wrapperStructExtra); // Output (comment or use default argument to disable any output) const op::WrapperStructOutput wrapperStructOutput{ - FLAGS_cli_verbose, FLAGS_write_keypoint, op::stringToDataFormat(FLAGS_write_keypoint_format), - FLAGS_write_json, FLAGS_write_coco_json, FLAGS_write_coco_json_variants, FLAGS_write_coco_json_variant, - FLAGS_write_images, FLAGS_write_images_format, FLAGS_write_video, FLAGS_write_video_fps, - FLAGS_write_video_with_audio, FLAGS_write_heatmaps, FLAGS_write_heatmaps_format, FLAGS_write_video_3d, - FLAGS_write_video_adam, FLAGS_write_bvh, FLAGS_udp_host, FLAGS_udp_port}; + FLAGS_cli_verbose, op::String(FLAGS_write_keypoint), op::stringToDataFormat(FLAGS_write_keypoint_format), + op::String(FLAGS_write_json), op::String(FLAGS_write_coco_json), FLAGS_write_coco_json_variants, + FLAGS_write_coco_json_variant, op::String(FLAGS_write_images), op::String(FLAGS_write_images_format), + op::String(FLAGS_write_video), FLAGS_write_video_fps, FLAGS_write_video_with_audio, + op::String(FLAGS_write_heatmaps), op::String(FLAGS_write_heatmaps_format), op::String(FLAGS_write_video_3d), + op::String(FLAGS_write_video_adam), op::String(FLAGS_write_bvh), op::String(FLAGS_udp_host), + op::String(FLAGS_udp_port)}; opWrapper.configure(wrapperStructOutput); // No GUI. Equivalent to: opWrapper.configure(op::WrapperStructGui{}); // Set to single-thread (for sequential processing and/or debugging and/or reducing latency) diff --git a/examples/tutorial_api_cpp/08_heatmaps_from_image.cpp b/examples/tutorial_api_cpp/08_heatmaps_from_image.cpp index 75acc86c..e1b5c451 100644 --- a/examples/tutorial_api_cpp/08_heatmaps_from_image.cpp +++ b/examples/tutorial_api_cpp/08_heatmaps_from_image.cpp @@ -110,17 +110,17 @@ void configureWrapper(op::Wrapper& opWrapper) // Applying user defined configuration - GFlags to program variables // outputSize - const auto outputSize = op::flagsToPoint(FLAGS_output_resolution, "-1x-1"); + const auto outputSize = op::flagsToPoint(op::String(FLAGS_output_resolution), "-1x-1"); // netInputSize - const auto netInputSize = op::flagsToPoint(FLAGS_net_resolution, "-1x368"); + const auto netInputSize = op::flagsToPoint(op::String(FLAGS_net_resolution), "-1x368"); // faceNetInputSize - const auto faceNetInputSize = op::flagsToPoint(FLAGS_face_net_resolution, "368x368 (multiples of 16)"); + const auto faceNetInputSize = op::flagsToPoint(op::String(FLAGS_face_net_resolution), "368x368 (multiples of 16)"); // handNetInputSize - const auto handNetInputSize = op::flagsToPoint(FLAGS_hand_net_resolution, "368x368 (multiples of 16)"); + const auto handNetInputSize = op::flagsToPoint(op::String(FLAGS_hand_net_resolution), "368x368 (multiples of 16)"); // poseMode const auto poseMode = op::flagsToPoseMode(FLAGS_body); // poseModel - const auto poseModel = op::flagsToPoseModel(FLAGS_model_pose); + const auto poseModel = op::flagsToPoseModel(op::String(FLAGS_model_pose)); // JSON saving if (!FLAGS_write_keypoint.empty()) op::opLog( @@ -145,9 +145,10 @@ void configureWrapper(op::Wrapper& opWrapper) poseMode, netInputSize, outputSize, keypointScaleMode, FLAGS_num_gpu, FLAGS_num_gpu_start, FLAGS_scale_number, (float)FLAGS_scale_gap, op::flagsToRenderMode(FLAGS_render_pose, multipleView), poseModel, !FLAGS_disable_blending, (float)FLAGS_alpha_pose, (float)FLAGS_alpha_heatmap, - FLAGS_part_to_show, FLAGS_model_folder, heatMapTypes, heatMapScaleMode, FLAGS_part_candidates, + FLAGS_part_to_show, op::String(FLAGS_model_folder), heatMapTypes, heatMapScaleMode, FLAGS_part_candidates, (float)FLAGS_render_threshold, FLAGS_number_people_max, FLAGS_maximize_positives, FLAGS_fps_max, - FLAGS_prototxt_path, FLAGS_caffemodel_path, (float)FLAGS_upsampling_ratio, enableGoogleLogging}; + op::String(FLAGS_prototxt_path), op::String(FLAGS_caffemodel_path), + (float)FLAGS_upsampling_ratio, enableGoogleLogging}; opWrapper.configure(wrapperStructPose); // Face configuration (use op::WrapperStructFace{} to disable it) const op::WrapperStructFace wrapperStructFace{ @@ -167,11 +168,13 @@ void configureWrapper(op::Wrapper& opWrapper) opWrapper.configure(wrapperStructExtra); // Output (comment or use default argument to disable any output) const op::WrapperStructOutput wrapperStructOutput{ - FLAGS_cli_verbose, FLAGS_write_keypoint, op::stringToDataFormat(FLAGS_write_keypoint_format), - FLAGS_write_json, FLAGS_write_coco_json, FLAGS_write_coco_json_variants, FLAGS_write_coco_json_variant, - FLAGS_write_images, FLAGS_write_images_format, FLAGS_write_video, FLAGS_write_video_fps, - FLAGS_write_video_with_audio, FLAGS_write_heatmaps, FLAGS_write_heatmaps_format, FLAGS_write_video_3d, - FLAGS_write_video_adam, FLAGS_write_bvh, FLAGS_udp_host, FLAGS_udp_port}; + FLAGS_cli_verbose, op::String(FLAGS_write_keypoint), op::stringToDataFormat(FLAGS_write_keypoint_format), + op::String(FLAGS_write_json), op::String(FLAGS_write_coco_json), FLAGS_write_coco_json_variants, + FLAGS_write_coco_json_variant, op::String(FLAGS_write_images), op::String(FLAGS_write_images_format), + op::String(FLAGS_write_video), FLAGS_write_video_fps, FLAGS_write_video_with_audio, + op::String(FLAGS_write_heatmaps), op::String(FLAGS_write_heatmaps_format), op::String(FLAGS_write_video_3d), + op::String(FLAGS_write_video_adam), op::String(FLAGS_write_bvh), op::String(FLAGS_udp_host), + op::String(FLAGS_udp_port)}; opWrapper.configure(wrapperStructOutput); // No GUI. Equivalent to: opWrapper.configure(op::WrapperStructGui{}); // Set to single-thread (for sequential processing and/or debugging and/or reducing latency) diff --git a/examples/tutorial_api_cpp/09_keypoints_from_heatmaps.cpp b/examples/tutorial_api_cpp/09_keypoints_from_heatmaps.cpp index 14c7af2f..152bf3f1 100644 --- a/examples/tutorial_api_cpp/09_keypoints_from_heatmaps.cpp +++ b/examples/tutorial_api_cpp/09_keypoints_from_heatmaps.cpp @@ -82,17 +82,17 @@ void configureWrapper(op::Wrapper& opWrapper) // Applying user defined configuration - GFlags to program variables // outputSize - const auto outputSize = op::flagsToPoint(FLAGS_output_resolution, "-1x-1"); + const auto outputSize = op::flagsToPoint(op::String(FLAGS_output_resolution), "-1x-1"); // netInputSize - const auto netInputSize = op::flagsToPoint(FLAGS_net_resolution, "-1x368"); + const auto netInputSize = op::flagsToPoint(op::String(FLAGS_net_resolution), "-1x368"); // faceNetInputSize - const auto faceNetInputSize = op::flagsToPoint(FLAGS_face_net_resolution, "368x368 (multiples of 16)"); + const auto faceNetInputSize = op::flagsToPoint(op::String(FLAGS_face_net_resolution), "368x368 (multiples of 16)"); // handNetInputSize - const auto handNetInputSize = op::flagsToPoint(FLAGS_hand_net_resolution, "368x368 (multiples of 16)"); + const auto handNetInputSize = op::flagsToPoint(op::String(FLAGS_hand_net_resolution), "368x368 (multiples of 16)"); // poseMode const auto poseMode = op::flagsToPoseMode(FLAGS_body); // poseModel - const auto poseModel = op::flagsToPoseModel(FLAGS_model_pose); + const auto poseModel = op::flagsToPoseModel(op::String(FLAGS_model_pose)); // JSON saving if (!FLAGS_write_keypoint.empty()) op::opLog( @@ -117,9 +117,10 @@ void configureWrapper(op::Wrapper& opWrapper) poseMode, netInputSize, outputSize, keypointScaleMode, FLAGS_num_gpu, FLAGS_num_gpu_start, FLAGS_scale_number, (float)FLAGS_scale_gap, op::flagsToRenderMode(FLAGS_render_pose, multipleView), poseModel, !FLAGS_disable_blending, (float)FLAGS_alpha_pose, (float)FLAGS_alpha_heatmap, - FLAGS_part_to_show, FLAGS_model_folder, heatMapTypes, heatMapScaleMode, FLAGS_part_candidates, + FLAGS_part_to_show, op::String(FLAGS_model_folder), heatMapTypes, heatMapScaleMode, FLAGS_part_candidates, (float)FLAGS_render_threshold, FLAGS_number_people_max, FLAGS_maximize_positives, FLAGS_fps_max, - FLAGS_prototxt_path, FLAGS_caffemodel_path, (float)FLAGS_upsampling_ratio, enableGoogleLogging}; + op::String(FLAGS_prototxt_path), op::String(FLAGS_caffemodel_path), + (float)FLAGS_upsampling_ratio, enableGoogleLogging}; opWrapper.configure(wrapperStructPose); // Face configuration (use op::WrapperStructFace{} to disable it) const op::WrapperStructFace wrapperStructFace{ @@ -139,11 +140,13 @@ void configureWrapper(op::Wrapper& opWrapper) opWrapper.configure(wrapperStructExtra); // Output (comment or use default argument to disable any output) const op::WrapperStructOutput wrapperStructOutput{ - FLAGS_cli_verbose, FLAGS_write_keypoint, op::stringToDataFormat(FLAGS_write_keypoint_format), - FLAGS_write_json, FLAGS_write_coco_json, FLAGS_write_coco_json_variants, FLAGS_write_coco_json_variant, - FLAGS_write_images, FLAGS_write_images_format, FLAGS_write_video, FLAGS_write_video_fps, - FLAGS_write_video_with_audio, FLAGS_write_heatmaps, FLAGS_write_heatmaps_format, FLAGS_write_video_3d, - FLAGS_write_video_adam, FLAGS_write_bvh, FLAGS_udp_host, FLAGS_udp_port}; + FLAGS_cli_verbose, op::String(FLAGS_write_keypoint), op::stringToDataFormat(FLAGS_write_keypoint_format), + op::String(FLAGS_write_json), op::String(FLAGS_write_coco_json), FLAGS_write_coco_json_variants, + FLAGS_write_coco_json_variant, op::String(FLAGS_write_images), op::String(FLAGS_write_images_format), + op::String(FLAGS_write_video), FLAGS_write_video_fps, FLAGS_write_video_with_audio, + op::String(FLAGS_write_heatmaps), op::String(FLAGS_write_heatmaps_format), op::String(FLAGS_write_video_3d), + op::String(FLAGS_write_video_adam), op::String(FLAGS_write_bvh), op::String(FLAGS_udp_host), + op::String(FLAGS_udp_port)}; opWrapper.configure(wrapperStructOutput); // No GUI. Equivalent to: opWrapper.configure(op::WrapperStructGui{}); // Set to single-thread (for sequential processing and/or debugging and/or reducing latency) diff --git a/examples/tutorial_api_cpp/10_asynchronous_custom_input.cpp b/examples/tutorial_api_cpp/10_asynchronous_custom_input.cpp index 9359e96a..2ce76ce1 100644 --- a/examples/tutorial_api_cpp/10_asynchronous_custom_input.cpp +++ b/examples/tutorial_api_cpp/10_asynchronous_custom_input.cpp @@ -93,17 +93,17 @@ void configureWrapper(op::Wrapper& opWrapper) // Applying user defined configuration - GFlags to program variables // outputSize - const auto outputSize = op::flagsToPoint(FLAGS_output_resolution, "-1x-1"); + const auto outputSize = op::flagsToPoint(op::String(FLAGS_output_resolution), "-1x-1"); // netInputSize - const auto netInputSize = op::flagsToPoint(FLAGS_net_resolution, "-1x368"); + const auto netInputSize = op::flagsToPoint(op::String(FLAGS_net_resolution), "-1x368"); // faceNetInputSize - const auto faceNetInputSize = op::flagsToPoint(FLAGS_face_net_resolution, "368x368 (multiples of 16)"); + const auto faceNetInputSize = op::flagsToPoint(op::String(FLAGS_face_net_resolution), "368x368 (multiples of 16)"); // handNetInputSize - const auto handNetInputSize = op::flagsToPoint(FLAGS_hand_net_resolution, "368x368 (multiples of 16)"); + const auto handNetInputSize = op::flagsToPoint(op::String(FLAGS_hand_net_resolution), "368x368 (multiples of 16)"); // poseMode const auto poseMode = op::flagsToPoseMode(FLAGS_body); // poseModel - const auto poseModel = op::flagsToPoseModel(FLAGS_model_pose); + const auto poseModel = op::flagsToPoseModel(op::String(FLAGS_model_pose)); // JSON saving if (!FLAGS_write_keypoint.empty()) op::opLog( @@ -128,9 +128,10 @@ void configureWrapper(op::Wrapper& opWrapper) poseMode, netInputSize, outputSize, keypointScaleMode, FLAGS_num_gpu, FLAGS_num_gpu_start, FLAGS_scale_number, (float)FLAGS_scale_gap, op::flagsToRenderMode(FLAGS_render_pose, multipleView), poseModel, !FLAGS_disable_blending, (float)FLAGS_alpha_pose, (float)FLAGS_alpha_heatmap, - FLAGS_part_to_show, FLAGS_model_folder, heatMapTypes, heatMapScaleMode, FLAGS_part_candidates, + FLAGS_part_to_show, op::String(FLAGS_model_folder), heatMapTypes, heatMapScaleMode, FLAGS_part_candidates, (float)FLAGS_render_threshold, FLAGS_number_people_max, FLAGS_maximize_positives, FLAGS_fps_max, - FLAGS_prototxt_path, FLAGS_caffemodel_path, (float)FLAGS_upsampling_ratio, enableGoogleLogging}; + op::String(FLAGS_prototxt_path), op::String(FLAGS_caffemodel_path), + (float)FLAGS_upsampling_ratio, enableGoogleLogging}; opWrapper.configure(wrapperStructPose); // Face configuration (use op::WrapperStructFace{} to disable it) const op::WrapperStructFace wrapperStructFace{ @@ -150,11 +151,13 @@ void configureWrapper(op::Wrapper& opWrapper) opWrapper.configure(wrapperStructExtra); // Output (comment or use default argument to disable any output) const op::WrapperStructOutput wrapperStructOutput{ - FLAGS_cli_verbose, FLAGS_write_keypoint, op::stringToDataFormat(FLAGS_write_keypoint_format), - FLAGS_write_json, FLAGS_write_coco_json, FLAGS_write_coco_json_variants, FLAGS_write_coco_json_variant, - FLAGS_write_images, FLAGS_write_images_format, FLAGS_write_video, FLAGS_write_video_fps, - FLAGS_write_video_with_audio, FLAGS_write_heatmaps, FLAGS_write_heatmaps_format, FLAGS_write_video_3d, - FLAGS_write_video_adam, FLAGS_write_bvh, FLAGS_udp_host, FLAGS_udp_port}; + FLAGS_cli_verbose, op::String(FLAGS_write_keypoint), op::stringToDataFormat(FLAGS_write_keypoint_format), + op::String(FLAGS_write_json), op::String(FLAGS_write_coco_json), FLAGS_write_coco_json_variants, + FLAGS_write_coco_json_variant, op::String(FLAGS_write_images), op::String(FLAGS_write_images_format), + op::String(FLAGS_write_video), FLAGS_write_video_fps, FLAGS_write_video_with_audio, + op::String(FLAGS_write_heatmaps), op::String(FLAGS_write_heatmaps_format), op::String(FLAGS_write_video_3d), + op::String(FLAGS_write_video_adam), op::String(FLAGS_write_bvh), op::String(FLAGS_udp_host), + op::String(FLAGS_udp_port)}; opWrapper.configure(wrapperStructOutput); // GUI (comment or use default argument to disable any visual output) const op::WrapperStructGui wrapperStructGui{ diff --git a/examples/tutorial_api_cpp/11_asynchronous_custom_output.cpp b/examples/tutorial_api_cpp/11_asynchronous_custom_output.cpp index 1e77fb63..ee16e363 100644 --- a/examples/tutorial_api_cpp/11_asynchronous_custom_output.cpp +++ b/examples/tutorial_api_cpp/11_asynchronous_custom_output.cpp @@ -106,23 +106,24 @@ void configureWrapper(op::Wrapper& opWrapper) // Applying user defined configuration - GFlags to program variables // producerType op::ProducerType producerType; - std::string producerString; + op::String producerString; std::tie(producerType, producerString) = op::flagsToProducer( - FLAGS_image_dir, FLAGS_video, FLAGS_ip_camera, FLAGS_camera, FLAGS_flir_camera, FLAGS_flir_camera_index); + op::String(FLAGS_image_dir), op::String(FLAGS_video), op::String(FLAGS_ip_camera), FLAGS_camera, + FLAGS_flir_camera, FLAGS_flir_camera_index); // cameraSize - const auto cameraSize = op::flagsToPoint(FLAGS_camera_resolution, "-1x-1"); + const auto cameraSize = op::flagsToPoint(op::String(FLAGS_camera_resolution), "-1x-1"); // outputSize - const auto outputSize = op::flagsToPoint(FLAGS_output_resolution, "-1x-1"); + const auto outputSize = op::flagsToPoint(op::String(FLAGS_output_resolution), "-1x-1"); // netInputSize - const auto netInputSize = op::flagsToPoint(FLAGS_net_resolution, "-1x368"); + const auto netInputSize = op::flagsToPoint(op::String(FLAGS_net_resolution), "-1x368"); // faceNetInputSize - const auto faceNetInputSize = op::flagsToPoint(FLAGS_face_net_resolution, "368x368 (multiples of 16)"); + const auto faceNetInputSize = op::flagsToPoint(op::String(FLAGS_face_net_resolution), "368x368 (multiples of 16)"); // handNetInputSize - const auto handNetInputSize = op::flagsToPoint(FLAGS_hand_net_resolution, "368x368 (multiples of 16)"); + const auto handNetInputSize = op::flagsToPoint(op::String(FLAGS_hand_net_resolution), "368x368 (multiples of 16)"); // poseMode const auto poseMode = op::flagsToPoseMode(FLAGS_body); // poseModel - const auto poseModel = op::flagsToPoseModel(FLAGS_model_pose); + const auto poseModel = op::flagsToPoseModel(op::String(FLAGS_model_pose)); // JSON saving if (!FLAGS_write_keypoint.empty()) op::opLog( @@ -147,9 +148,10 @@ void configureWrapper(op::Wrapper& opWrapper) poseMode, netInputSize, outputSize, keypointScaleMode, FLAGS_num_gpu, FLAGS_num_gpu_start, FLAGS_scale_number, (float)FLAGS_scale_gap, op::flagsToRenderMode(FLAGS_render_pose, multipleView), poseModel, !FLAGS_disable_blending, (float)FLAGS_alpha_pose, (float)FLAGS_alpha_heatmap, - FLAGS_part_to_show, FLAGS_model_folder, heatMapTypes, heatMapScaleMode, FLAGS_part_candidates, + FLAGS_part_to_show, op::String(FLAGS_model_folder), heatMapTypes, heatMapScaleMode, FLAGS_part_candidates, (float)FLAGS_render_threshold, FLAGS_number_people_max, FLAGS_maximize_positives, FLAGS_fps_max, - FLAGS_prototxt_path, FLAGS_caffemodel_path, (float)FLAGS_upsampling_ratio, enableGoogleLogging}; + op::String(FLAGS_prototxt_path), op::String(FLAGS_caffemodel_path), + (float)FLAGS_upsampling_ratio, enableGoogleLogging}; opWrapper.configure(wrapperStructPose); // Face configuration (use op::WrapperStructFace{} to disable it) const op::WrapperStructFace wrapperStructFace{ @@ -171,15 +173,17 @@ void configureWrapper(op::Wrapper& opWrapper) const op::WrapperStructInput wrapperStructInput{ producerType, producerString, FLAGS_frame_first, FLAGS_frame_step, FLAGS_frame_last, FLAGS_process_real_time, FLAGS_frame_flip, FLAGS_frame_rotate, FLAGS_frames_repeat, - cameraSize, FLAGS_camera_parameter_path, FLAGS_frame_undistort, FLAGS_3d_views}; + cameraSize, op::String(FLAGS_camera_parameter_path), FLAGS_frame_undistort, FLAGS_3d_views}; opWrapper.configure(wrapperStructInput); // Output (comment or use default argument to disable any output) const op::WrapperStructOutput wrapperStructOutput{ - FLAGS_cli_verbose, FLAGS_write_keypoint, op::stringToDataFormat(FLAGS_write_keypoint_format), - FLAGS_write_json, FLAGS_write_coco_json, FLAGS_write_coco_json_variants, FLAGS_write_coco_json_variant, - FLAGS_write_images, FLAGS_write_images_format, FLAGS_write_video, FLAGS_write_video_fps, - FLAGS_write_video_with_audio, FLAGS_write_heatmaps, FLAGS_write_heatmaps_format, FLAGS_write_video_3d, - FLAGS_write_video_adam, FLAGS_write_bvh, FLAGS_udp_host, FLAGS_udp_port}; + FLAGS_cli_verbose, op::String(FLAGS_write_keypoint), op::stringToDataFormat(FLAGS_write_keypoint_format), + op::String(FLAGS_write_json), op::String(FLAGS_write_coco_json), FLAGS_write_coco_json_variants, + FLAGS_write_coco_json_variant, op::String(FLAGS_write_images), op::String(FLAGS_write_images_format), + op::String(FLAGS_write_video), FLAGS_write_video_fps, FLAGS_write_video_with_audio, + op::String(FLAGS_write_heatmaps), op::String(FLAGS_write_heatmaps_format), op::String(FLAGS_write_video_3d), + op::String(FLAGS_write_video_adam), op::String(FLAGS_write_bvh), op::String(FLAGS_udp_host), + op::String(FLAGS_udp_port)}; opWrapper.configure(wrapperStructOutput); // No GUI. Equivalent to: opWrapper.configure(op::WrapperStructGui{}); // Set to single-thread (for sequential processing and/or debugging and/or reducing latency) diff --git a/examples/tutorial_api_cpp/12_asynchronous_custom_input_output_and_datum.cpp b/examples/tutorial_api_cpp/12_asynchronous_custom_input_output_and_datum.cpp index bb3f2582..e823f288 100644 --- a/examples/tutorial_api_cpp/12_asynchronous_custom_input_output_and_datum.cpp +++ b/examples/tutorial_api_cpp/12_asynchronous_custom_input_output_and_datum.cpp @@ -191,17 +191,17 @@ void configureWrapper(op::WrapperT& opWrapperT) // Applying user defined configuration - GFlags to program variables // outputSize - const auto outputSize = op::flagsToPoint(FLAGS_output_resolution, "-1x-1"); + const auto outputSize = op::flagsToPoint(op::String(FLAGS_output_resolution), "-1x-1"); // netInputSize - const auto netInputSize = op::flagsToPoint(FLAGS_net_resolution, "-1x368"); + const auto netInputSize = op::flagsToPoint(op::String(FLAGS_net_resolution), "-1x368"); // faceNetInputSize - const auto faceNetInputSize = op::flagsToPoint(FLAGS_face_net_resolution, "368x368 (multiples of 16)"); + const auto faceNetInputSize = op::flagsToPoint(op::String(FLAGS_face_net_resolution), "368x368 (multiples of 16)"); // handNetInputSize - const auto handNetInputSize = op::flagsToPoint(FLAGS_hand_net_resolution, "368x368 (multiples of 16)"); + const auto handNetInputSize = op::flagsToPoint(op::String(FLAGS_hand_net_resolution), "368x368 (multiples of 16)"); // poseMode const auto poseMode = op::flagsToPoseMode(FLAGS_body); // poseModel - const auto poseModel = op::flagsToPoseModel(FLAGS_model_pose); + const auto poseModel = op::flagsToPoseModel(op::String(FLAGS_model_pose)); // JSON saving if (!FLAGS_write_keypoint.empty()) op::opLog( @@ -226,9 +226,10 @@ void configureWrapper(op::WrapperT& opWrapperT) poseMode, netInputSize, outputSize, keypointScaleMode, FLAGS_num_gpu, FLAGS_num_gpu_start, FLAGS_scale_number, (float)FLAGS_scale_gap, op::flagsToRenderMode(FLAGS_render_pose, multipleView), poseModel, !FLAGS_disable_blending, (float)FLAGS_alpha_pose, (float)FLAGS_alpha_heatmap, - FLAGS_part_to_show, FLAGS_model_folder, heatMapTypes, heatMapScaleMode, FLAGS_part_candidates, + FLAGS_part_to_show, op::String(FLAGS_model_folder), heatMapTypes, heatMapScaleMode, FLAGS_part_candidates, (float)FLAGS_render_threshold, FLAGS_number_people_max, FLAGS_maximize_positives, FLAGS_fps_max, - FLAGS_prototxt_path, FLAGS_caffemodel_path, (float)FLAGS_upsampling_ratio, enableGoogleLogging}; + op::String(FLAGS_prototxt_path), op::String(FLAGS_caffemodel_path), + (float)FLAGS_upsampling_ratio, enableGoogleLogging}; opWrapperT.configure(wrapperStructPose); // Face configuration (use op::WrapperStructFace{} to disable it) const op::WrapperStructFace wrapperStructFace{ @@ -248,11 +249,13 @@ void configureWrapper(op::WrapperT& opWrapperT) opWrapperT.configure(wrapperStructExtra); // Output (comment or use default argument to disable any output) const op::WrapperStructOutput wrapperStructOutput{ - FLAGS_cli_verbose, FLAGS_write_keypoint, op::stringToDataFormat(FLAGS_write_keypoint_format), - FLAGS_write_json, FLAGS_write_coco_json, FLAGS_write_coco_json_variants, FLAGS_write_coco_json_variant, - FLAGS_write_images, FLAGS_write_images_format, FLAGS_write_video, FLAGS_write_video_fps, - FLAGS_write_video_with_audio, FLAGS_write_heatmaps, FLAGS_write_heatmaps_format, FLAGS_write_video_3d, - FLAGS_write_video_adam, FLAGS_write_bvh, FLAGS_udp_host, FLAGS_udp_port}; + FLAGS_cli_verbose, op::String(FLAGS_write_keypoint), op::stringToDataFormat(FLAGS_write_keypoint_format), + op::String(FLAGS_write_json), op::String(FLAGS_write_coco_json), FLAGS_write_coco_json_variants, + FLAGS_write_coco_json_variant, op::String(FLAGS_write_images), op::String(FLAGS_write_images_format), + op::String(FLAGS_write_video), FLAGS_write_video_fps, FLAGS_write_video_with_audio, + op::String(FLAGS_write_heatmaps), op::String(FLAGS_write_heatmaps_format), op::String(FLAGS_write_video_3d), + op::String(FLAGS_write_video_adam), op::String(FLAGS_write_bvh), op::String(FLAGS_udp_host), + op::String(FLAGS_udp_port)}; opWrapperT.configure(wrapperStructOutput); // No GUI. Equivalent to: opWrapper.configure(op::WrapperStructGui{}); // Set to single-thread (for sequential processing and/or debugging and/or reducing latency) diff --git a/examples/tutorial_api_cpp/13_synchronous_custom_input.cpp b/examples/tutorial_api_cpp/13_synchronous_custom_input.cpp index 8b1054f1..a0c105b4 100644 --- a/examples/tutorial_api_cpp/13_synchronous_custom_input.cpp +++ b/examples/tutorial_api_cpp/13_synchronous_custom_input.cpp @@ -98,17 +98,17 @@ void configureWrapper(op::Wrapper& opWrapper) // Applying user defined configuration - GFlags to program variables // outputSize - const auto outputSize = op::flagsToPoint(FLAGS_output_resolution, "-1x-1"); + const auto outputSize = op::flagsToPoint(op::String(FLAGS_output_resolution), "-1x-1"); // netInputSize - const auto netInputSize = op::flagsToPoint(FLAGS_net_resolution, "-1x368"); + const auto netInputSize = op::flagsToPoint(op::String(FLAGS_net_resolution), "-1x368"); // faceNetInputSize - const auto faceNetInputSize = op::flagsToPoint(FLAGS_face_net_resolution, "368x368 (multiples of 16)"); + const auto faceNetInputSize = op::flagsToPoint(op::String(FLAGS_face_net_resolution), "368x368 (multiples of 16)"); // handNetInputSize - const auto handNetInputSize = op::flagsToPoint(FLAGS_hand_net_resolution, "368x368 (multiples of 16)"); + const auto handNetInputSize = op::flagsToPoint(op::String(FLAGS_hand_net_resolution), "368x368 (multiples of 16)"); // poseMode const auto poseMode = op::flagsToPoseMode(FLAGS_body); // poseModel - const auto poseModel = op::flagsToPoseModel(FLAGS_model_pose); + const auto poseModel = op::flagsToPoseModel(op::String(FLAGS_model_pose)); // JSON saving if (!FLAGS_write_keypoint.empty()) op::opLog( @@ -141,9 +141,10 @@ void configureWrapper(op::Wrapper& opWrapper) poseMode, netInputSize, outputSize, keypointScaleMode, FLAGS_num_gpu, FLAGS_num_gpu_start, FLAGS_scale_number, (float)FLAGS_scale_gap, op::flagsToRenderMode(FLAGS_render_pose, multipleView), poseModel, !FLAGS_disable_blending, (float)FLAGS_alpha_pose, (float)FLAGS_alpha_heatmap, - FLAGS_part_to_show, FLAGS_model_folder, heatMapTypes, heatMapScaleMode, FLAGS_part_candidates, + FLAGS_part_to_show, op::String(FLAGS_model_folder), heatMapTypes, heatMapScaleMode, FLAGS_part_candidates, (float)FLAGS_render_threshold, FLAGS_number_people_max, FLAGS_maximize_positives, FLAGS_fps_max, - FLAGS_prototxt_path, FLAGS_caffemodel_path, (float)FLAGS_upsampling_ratio, enableGoogleLogging}; + op::String(FLAGS_prototxt_path), op::String(FLAGS_caffemodel_path), + (float)FLAGS_upsampling_ratio, enableGoogleLogging}; opWrapper.configure(wrapperStructPose); // Face configuration (use op::WrapperStructFace{} to disable it) const op::WrapperStructFace wrapperStructFace{ @@ -163,11 +164,13 @@ void configureWrapper(op::Wrapper& opWrapper) opWrapper.configure(wrapperStructExtra); // Output (comment or use default argument to disable any output) const op::WrapperStructOutput wrapperStructOutput{ - FLAGS_cli_verbose, FLAGS_write_keypoint, op::stringToDataFormat(FLAGS_write_keypoint_format), - FLAGS_write_json, FLAGS_write_coco_json, FLAGS_write_coco_json_variants, FLAGS_write_coco_json_variant, - FLAGS_write_images, FLAGS_write_images_format, FLAGS_write_video, FLAGS_write_video_fps, - FLAGS_write_video_with_audio, FLAGS_write_heatmaps, FLAGS_write_heatmaps_format, FLAGS_write_video_3d, - FLAGS_write_video_adam, FLAGS_write_bvh, FLAGS_udp_host, FLAGS_udp_port}; + FLAGS_cli_verbose, op::String(FLAGS_write_keypoint), op::stringToDataFormat(FLAGS_write_keypoint_format), + op::String(FLAGS_write_json), op::String(FLAGS_write_coco_json), FLAGS_write_coco_json_variants, + FLAGS_write_coco_json_variant, op::String(FLAGS_write_images), op::String(FLAGS_write_images_format), + op::String(FLAGS_write_video), FLAGS_write_video_fps, FLAGS_write_video_with_audio, + op::String(FLAGS_write_heatmaps), op::String(FLAGS_write_heatmaps_format), op::String(FLAGS_write_video_3d), + op::String(FLAGS_write_video_adam), op::String(FLAGS_write_bvh), op::String(FLAGS_udp_host), + op::String(FLAGS_udp_port)}; opWrapper.configure(wrapperStructOutput); // GUI (comment or use default argument to disable any visual output) const op::WrapperStructGui wrapperStructGui{ diff --git a/examples/tutorial_api_cpp/14_synchronous_custom_preprocessing.cpp b/examples/tutorial_api_cpp/14_synchronous_custom_preprocessing.cpp index 1bbb753d..a9656c47 100644 --- a/examples/tutorial_api_cpp/14_synchronous_custom_preprocessing.cpp +++ b/examples/tutorial_api_cpp/14_synchronous_custom_preprocessing.cpp @@ -61,23 +61,24 @@ void configureWrapper(op::Wrapper& opWrapper) // Applying user defined configuration - GFlags to program variables // producerType op::ProducerType producerType; - std::string producerString; + op::String producerString; std::tie(producerType, producerString) = op::flagsToProducer( - FLAGS_image_dir, FLAGS_video, FLAGS_ip_camera, FLAGS_camera, FLAGS_flir_camera, FLAGS_flir_camera_index); + op::String(FLAGS_image_dir), op::String(FLAGS_video), op::String(FLAGS_ip_camera), FLAGS_camera, + FLAGS_flir_camera, FLAGS_flir_camera_index); // cameraSize - const auto cameraSize = op::flagsToPoint(FLAGS_camera_resolution, "-1x-1"); + const auto cameraSize = op::flagsToPoint(op::String(FLAGS_camera_resolution), "-1x-1"); // outputSize - const auto outputSize = op::flagsToPoint(FLAGS_output_resolution, "-1x-1"); + const auto outputSize = op::flagsToPoint(op::String(FLAGS_output_resolution), "-1x-1"); // netInputSize - const auto netInputSize = op::flagsToPoint(FLAGS_net_resolution, "-1x368"); + const auto netInputSize = op::flagsToPoint(op::String(FLAGS_net_resolution), "-1x368"); // faceNetInputSize - const auto faceNetInputSize = op::flagsToPoint(FLAGS_face_net_resolution, "368x368 (multiples of 16)"); + const auto faceNetInputSize = op::flagsToPoint(op::String(FLAGS_face_net_resolution), "368x368 (multiples of 16)"); // handNetInputSize - const auto handNetInputSize = op::flagsToPoint(FLAGS_hand_net_resolution, "368x368 (multiples of 16)"); + const auto handNetInputSize = op::flagsToPoint(op::String(FLAGS_hand_net_resolution), "368x368 (multiples of 16)"); // poseMode const auto poseMode = op::flagsToPoseMode(FLAGS_body); // poseModel - const auto poseModel = op::flagsToPoseModel(FLAGS_model_pose); + const auto poseModel = op::flagsToPoseModel(op::String(FLAGS_model_pose)); // JSON saving if (!FLAGS_write_keypoint.empty()) op::opLog( @@ -109,9 +110,10 @@ void configureWrapper(op::Wrapper& opWrapper) poseMode, netInputSize, outputSize, keypointScaleMode, FLAGS_num_gpu, FLAGS_num_gpu_start, FLAGS_scale_number, (float)FLAGS_scale_gap, op::flagsToRenderMode(FLAGS_render_pose, multipleView), poseModel, !FLAGS_disable_blending, (float)FLAGS_alpha_pose, (float)FLAGS_alpha_heatmap, - FLAGS_part_to_show, FLAGS_model_folder, heatMapTypes, heatMapScaleMode, FLAGS_part_candidates, + FLAGS_part_to_show, op::String(FLAGS_model_folder), heatMapTypes, heatMapScaleMode, FLAGS_part_candidates, (float)FLAGS_render_threshold, FLAGS_number_people_max, FLAGS_maximize_positives, FLAGS_fps_max, - FLAGS_prototxt_path, FLAGS_caffemodel_path, (float)FLAGS_upsampling_ratio, enableGoogleLogging}; + op::String(FLAGS_prototxt_path), op::String(FLAGS_caffemodel_path), + (float)FLAGS_upsampling_ratio, enableGoogleLogging}; opWrapper.configure(wrapperStructPose); // Face configuration (use op::WrapperStructFace{} to disable it) const op::WrapperStructFace wrapperStructFace{ @@ -133,15 +135,17 @@ void configureWrapper(op::Wrapper& opWrapper) const op::WrapperStructInput wrapperStructInput{ producerType, producerString, FLAGS_frame_first, FLAGS_frame_step, FLAGS_frame_last, FLAGS_process_real_time, FLAGS_frame_flip, FLAGS_frame_rotate, FLAGS_frames_repeat, - cameraSize, FLAGS_camera_parameter_path, FLAGS_frame_undistort, FLAGS_3d_views}; + cameraSize, op::String(FLAGS_camera_parameter_path), FLAGS_frame_undistort, FLAGS_3d_views}; opWrapper.configure(wrapperStructInput); // Output (comment or use default argument to disable any output) const op::WrapperStructOutput wrapperStructOutput{ - FLAGS_cli_verbose, FLAGS_write_keypoint, op::stringToDataFormat(FLAGS_write_keypoint_format), - FLAGS_write_json, FLAGS_write_coco_json, FLAGS_write_coco_json_variants, FLAGS_write_coco_json_variant, - FLAGS_write_images, FLAGS_write_images_format, FLAGS_write_video, FLAGS_write_video_fps, - FLAGS_write_video_with_audio, FLAGS_write_heatmaps, FLAGS_write_heatmaps_format, FLAGS_write_video_3d, - FLAGS_write_video_adam, FLAGS_write_bvh, FLAGS_udp_host, FLAGS_udp_port}; + FLAGS_cli_verbose, op::String(FLAGS_write_keypoint), op::stringToDataFormat(FLAGS_write_keypoint_format), + op::String(FLAGS_write_json), op::String(FLAGS_write_coco_json), FLAGS_write_coco_json_variants, + FLAGS_write_coco_json_variant, op::String(FLAGS_write_images), op::String(FLAGS_write_images_format), + op::String(FLAGS_write_video), FLAGS_write_video_fps, FLAGS_write_video_with_audio, + op::String(FLAGS_write_heatmaps), op::String(FLAGS_write_heatmaps_format), op::String(FLAGS_write_video_3d), + op::String(FLAGS_write_video_adam), op::String(FLAGS_write_bvh), op::String(FLAGS_udp_host), + op::String(FLAGS_udp_port)}; opWrapper.configure(wrapperStructOutput); // GUI (comment or use default argument to disable any visual output) const op::WrapperStructGui wrapperStructGui{ diff --git a/examples/tutorial_api_cpp/15_synchronous_custom_postprocessing.cpp b/examples/tutorial_api_cpp/15_synchronous_custom_postprocessing.cpp index 102a0733..eeaed2ef 100644 --- a/examples/tutorial_api_cpp/15_synchronous_custom_postprocessing.cpp +++ b/examples/tutorial_api_cpp/15_synchronous_custom_postprocessing.cpp @@ -62,23 +62,24 @@ void configureWrapper(op::Wrapper& opWrapper) // Applying user defined configuration - GFlags to program variables // producerType op::ProducerType producerType; - std::string producerString; + op::String producerString; std::tie(producerType, producerString) = op::flagsToProducer( - FLAGS_image_dir, FLAGS_video, FLAGS_ip_camera, FLAGS_camera, FLAGS_flir_camera, FLAGS_flir_camera_index); + op::String(FLAGS_image_dir), op::String(FLAGS_video), op::String(FLAGS_ip_camera), FLAGS_camera, + FLAGS_flir_camera, FLAGS_flir_camera_index); // cameraSize - const auto cameraSize = op::flagsToPoint(FLAGS_camera_resolution, "-1x-1"); + const auto cameraSize = op::flagsToPoint(op::String(FLAGS_camera_resolution), "-1x-1"); // outputSize - const auto outputSize = op::flagsToPoint(FLAGS_output_resolution, "-1x-1"); + const auto outputSize = op::flagsToPoint(op::String(FLAGS_output_resolution), "-1x-1"); // netInputSize - const auto netInputSize = op::flagsToPoint(FLAGS_net_resolution, "-1x368"); + const auto netInputSize = op::flagsToPoint(op::String(FLAGS_net_resolution), "-1x368"); // faceNetInputSize - const auto faceNetInputSize = op::flagsToPoint(FLAGS_face_net_resolution, "368x368 (multiples of 16)"); + const auto faceNetInputSize = op::flagsToPoint(op::String(FLAGS_face_net_resolution), "368x368 (multiples of 16)"); // handNetInputSize - const auto handNetInputSize = op::flagsToPoint(FLAGS_hand_net_resolution, "368x368 (multiples of 16)"); + const auto handNetInputSize = op::flagsToPoint(op::String(FLAGS_hand_net_resolution), "368x368 (multiples of 16)"); // poseMode const auto poseMode = op::flagsToPoseMode(FLAGS_body); // poseModel - const auto poseModel = op::flagsToPoseModel(FLAGS_model_pose); + const auto poseModel = op::flagsToPoseModel(op::String(FLAGS_model_pose)); // JSON saving if (!FLAGS_write_keypoint.empty()) op::opLog( @@ -110,9 +111,10 @@ void configureWrapper(op::Wrapper& opWrapper) poseMode, netInputSize, outputSize, keypointScaleMode, FLAGS_num_gpu, FLAGS_num_gpu_start, FLAGS_scale_number, (float)FLAGS_scale_gap, op::flagsToRenderMode(FLAGS_render_pose, multipleView), poseModel, !FLAGS_disable_blending, (float)FLAGS_alpha_pose, (float)FLAGS_alpha_heatmap, - FLAGS_part_to_show, FLAGS_model_folder, heatMapTypes, heatMapScaleMode, FLAGS_part_candidates, + FLAGS_part_to_show, op::String(FLAGS_model_folder), heatMapTypes, heatMapScaleMode, FLAGS_part_candidates, (float)FLAGS_render_threshold, FLAGS_number_people_max, FLAGS_maximize_positives, FLAGS_fps_max, - FLAGS_prototxt_path, FLAGS_caffemodel_path, (float)FLAGS_upsampling_ratio, enableGoogleLogging}; + op::String(FLAGS_prototxt_path), op::String(FLAGS_caffemodel_path), + (float)FLAGS_upsampling_ratio, enableGoogleLogging}; opWrapper.configure(wrapperStructPose); // Face configuration (use op::WrapperStructFace{} to disable it) const op::WrapperStructFace wrapperStructFace{ @@ -134,15 +136,17 @@ void configureWrapper(op::Wrapper& opWrapper) const op::WrapperStructInput wrapperStructInput{ producerType, producerString, FLAGS_frame_first, FLAGS_frame_step, FLAGS_frame_last, FLAGS_process_real_time, FLAGS_frame_flip, FLAGS_frame_rotate, FLAGS_frames_repeat, - cameraSize, FLAGS_camera_parameter_path, FLAGS_frame_undistort, FLAGS_3d_views}; + cameraSize, op::String(FLAGS_camera_parameter_path), FLAGS_frame_undistort, FLAGS_3d_views}; opWrapper.configure(wrapperStructInput); // Output (comment or use default argument to disable any output) const op::WrapperStructOutput wrapperStructOutput{ - FLAGS_cli_verbose, FLAGS_write_keypoint, op::stringToDataFormat(FLAGS_write_keypoint_format), - FLAGS_write_json, FLAGS_write_coco_json, FLAGS_write_coco_json_variants, FLAGS_write_coco_json_variant, - FLAGS_write_images, FLAGS_write_images_format, FLAGS_write_video, FLAGS_write_video_fps, - FLAGS_write_video_with_audio, FLAGS_write_heatmaps, FLAGS_write_heatmaps_format, FLAGS_write_video_3d, - FLAGS_write_video_adam, FLAGS_write_bvh, FLAGS_udp_host, FLAGS_udp_port}; + FLAGS_cli_verbose, op::String(FLAGS_write_keypoint), op::stringToDataFormat(FLAGS_write_keypoint_format), + op::String(FLAGS_write_json), op::String(FLAGS_write_coco_json), FLAGS_write_coco_json_variants, + FLAGS_write_coco_json_variant, op::String(FLAGS_write_images), op::String(FLAGS_write_images_format), + op::String(FLAGS_write_video), FLAGS_write_video_fps, FLAGS_write_video_with_audio, + op::String(FLAGS_write_heatmaps), op::String(FLAGS_write_heatmaps_format), op::String(FLAGS_write_video_3d), + op::String(FLAGS_write_video_adam), op::String(FLAGS_write_bvh), op::String(FLAGS_udp_host), + op::String(FLAGS_udp_port)}; opWrapper.configure(wrapperStructOutput); // GUI (comment or use default argument to disable any visual output) const op::WrapperStructGui wrapperStructGui{ diff --git a/examples/tutorial_api_cpp/16_synchronous_custom_output.cpp b/examples/tutorial_api_cpp/16_synchronous_custom_output.cpp index fb2703bc..114fe446 100644 --- a/examples/tutorial_api_cpp/16_synchronous_custom_output.cpp +++ b/examples/tutorial_api_cpp/16_synchronous_custom_output.cpp @@ -114,23 +114,24 @@ void configureWrapper(op::Wrapper& opWrapper) // Applying user defined configuration - GFlags to program variables // producerType op::ProducerType producerType; - std::string producerString; + op::String producerString; std::tie(producerType, producerString) = op::flagsToProducer( - FLAGS_image_dir, FLAGS_video, FLAGS_ip_camera, FLAGS_camera, FLAGS_flir_camera, FLAGS_flir_camera_index); + op::String(FLAGS_image_dir), op::String(FLAGS_video), op::String(FLAGS_ip_camera), FLAGS_camera, + FLAGS_flir_camera, FLAGS_flir_camera_index); // cameraSize - const auto cameraSize = op::flagsToPoint(FLAGS_camera_resolution, "-1x-1"); + const auto cameraSize = op::flagsToPoint(op::String(FLAGS_camera_resolution), "-1x-1"); // outputSize - const auto outputSize = op::flagsToPoint(FLAGS_output_resolution, "-1x-1"); + const auto outputSize = op::flagsToPoint(op::String(FLAGS_output_resolution), "-1x-1"); // netInputSize - const auto netInputSize = op::flagsToPoint(FLAGS_net_resolution, "-1x368"); + const auto netInputSize = op::flagsToPoint(op::String(FLAGS_net_resolution), "-1x368"); // faceNetInputSize - const auto faceNetInputSize = op::flagsToPoint(FLAGS_face_net_resolution, "368x368 (multiples of 16)"); + const auto faceNetInputSize = op::flagsToPoint(op::String(FLAGS_face_net_resolution), "368x368 (multiples of 16)"); // handNetInputSize - const auto handNetInputSize = op::flagsToPoint(FLAGS_hand_net_resolution, "368x368 (multiples of 16)"); + const auto handNetInputSize = op::flagsToPoint(op::String(FLAGS_hand_net_resolution), "368x368 (multiples of 16)"); // poseMode const auto poseMode = op::flagsToPoseMode(FLAGS_body); // poseModel - const auto poseModel = op::flagsToPoseModel(FLAGS_model_pose); + const auto poseModel = op::flagsToPoseModel(op::String(FLAGS_model_pose)); // JSON saving if (!FLAGS_write_keypoint.empty()) op::opLog( @@ -162,9 +163,10 @@ void configureWrapper(op::Wrapper& opWrapper) poseMode, netInputSize, outputSize, keypointScaleMode, FLAGS_num_gpu, FLAGS_num_gpu_start, FLAGS_scale_number, (float)FLAGS_scale_gap, op::flagsToRenderMode(FLAGS_render_pose, multipleView), poseModel, !FLAGS_disable_blending, (float)FLAGS_alpha_pose, (float)FLAGS_alpha_heatmap, - FLAGS_part_to_show, FLAGS_model_folder, heatMapTypes, heatMapScaleMode, FLAGS_part_candidates, + FLAGS_part_to_show, op::String(FLAGS_model_folder), heatMapTypes, heatMapScaleMode, FLAGS_part_candidates, (float)FLAGS_render_threshold, FLAGS_number_people_max, FLAGS_maximize_positives, FLAGS_fps_max, - FLAGS_prototxt_path, FLAGS_caffemodel_path, (float)FLAGS_upsampling_ratio, enableGoogleLogging}; + op::String(FLAGS_prototxt_path), op::String(FLAGS_caffemodel_path), + (float)FLAGS_upsampling_ratio, enableGoogleLogging}; opWrapper.configure(wrapperStructPose); // Face configuration (use op::WrapperStructFace{} to disable it) const op::WrapperStructFace wrapperStructFace{ @@ -186,15 +188,17 @@ void configureWrapper(op::Wrapper& opWrapper) const op::WrapperStructInput wrapperStructInput{ producerType, producerString, FLAGS_frame_first, FLAGS_frame_step, FLAGS_frame_last, FLAGS_process_real_time, FLAGS_frame_flip, FLAGS_frame_rotate, FLAGS_frames_repeat, - cameraSize, FLAGS_camera_parameter_path, FLAGS_frame_undistort, FLAGS_3d_views}; + cameraSize, op::String(FLAGS_camera_parameter_path), FLAGS_frame_undistort, FLAGS_3d_views}; opWrapper.configure(wrapperStructInput); // Output (comment or use default argument to disable any output) const op::WrapperStructOutput wrapperStructOutput{ - FLAGS_cli_verbose, FLAGS_write_keypoint, op::stringToDataFormat(FLAGS_write_keypoint_format), - FLAGS_write_json, FLAGS_write_coco_json, FLAGS_write_coco_json_variants, FLAGS_write_coco_json_variant, - FLAGS_write_images, FLAGS_write_images_format, FLAGS_write_video, FLAGS_write_video_fps, - FLAGS_write_video_with_audio, FLAGS_write_heatmaps, FLAGS_write_heatmaps_format, FLAGS_write_video_3d, - FLAGS_write_video_adam, FLAGS_write_bvh, FLAGS_udp_host, FLAGS_udp_port}; + FLAGS_cli_verbose, op::String(FLAGS_write_keypoint), op::stringToDataFormat(FLAGS_write_keypoint_format), + op::String(FLAGS_write_json), op::String(FLAGS_write_coco_json), FLAGS_write_coco_json_variants, + FLAGS_write_coco_json_variant, op::String(FLAGS_write_images), op::String(FLAGS_write_images_format), + op::String(FLAGS_write_video), FLAGS_write_video_fps, FLAGS_write_video_with_audio, + op::String(FLAGS_write_heatmaps), op::String(FLAGS_write_heatmaps_format), op::String(FLAGS_write_video_3d), + op::String(FLAGS_write_video_adam), op::String(FLAGS_write_bvh), op::String(FLAGS_udp_host), + op::String(FLAGS_udp_port)}; opWrapper.configure(wrapperStructOutput); // No GUI. Equivalent to: opWrapper.configure(op::WrapperStructGui{}); // Set to single-thread (for sequential processing and/or debugging and/or reducing latency) diff --git a/examples/tutorial_api_cpp/17_synchronous_custom_all_and_datum.cpp b/examples/tutorial_api_cpp/17_synchronous_custom_all_and_datum.cpp index 369b82ba..1bb26412 100644 --- a/examples/tutorial_api_cpp/17_synchronous_custom_all_and_datum.cpp +++ b/examples/tutorial_api_cpp/17_synchronous_custom_all_and_datum.cpp @@ -235,17 +235,17 @@ void configureWrapper(op::WrapperT& opWrapperT) // Applying user defined configuration - GFlags to program variables // outputSize - const auto outputSize = op::flagsToPoint(FLAGS_output_resolution, "-1x-1"); + const auto outputSize = op::flagsToPoint(op::String(FLAGS_output_resolution), "-1x-1"); // netInputSize - const auto netInputSize = op::flagsToPoint(FLAGS_net_resolution, "-1x368"); + const auto netInputSize = op::flagsToPoint(op::String(FLAGS_net_resolution), "-1x368"); // faceNetInputSize - const auto faceNetInputSize = op::flagsToPoint(FLAGS_face_net_resolution, "368x368 (multiples of 16)"); + const auto faceNetInputSize = op::flagsToPoint(op::String(FLAGS_face_net_resolution), "368x368 (multiples of 16)"); // handNetInputSize - const auto handNetInputSize = op::flagsToPoint(FLAGS_hand_net_resolution, "368x368 (multiples of 16)"); + const auto handNetInputSize = op::flagsToPoint(op::String(FLAGS_hand_net_resolution), "368x368 (multiples of 16)"); // poseMode const auto poseMode = op::flagsToPoseMode(FLAGS_body); // poseModel - const auto poseModel = op::flagsToPoseModel(FLAGS_model_pose); + const auto poseModel = op::flagsToPoseModel(op::String(FLAGS_model_pose)); // JSON saving if (!FLAGS_write_keypoint.empty()) op::opLog( @@ -288,9 +288,10 @@ void configureWrapper(op::WrapperT& opWrapperT) poseMode, netInputSize, outputSize, keypointScaleMode, FLAGS_num_gpu, FLAGS_num_gpu_start, FLAGS_scale_number, (float)FLAGS_scale_gap, op::flagsToRenderMode(FLAGS_render_pose, multipleView), poseModel, !FLAGS_disable_blending, (float)FLAGS_alpha_pose, (float)FLAGS_alpha_heatmap, - FLAGS_part_to_show, FLAGS_model_folder, heatMapTypes, heatMapScaleMode, FLAGS_part_candidates, + FLAGS_part_to_show, op::String(FLAGS_model_folder), heatMapTypes, heatMapScaleMode, FLAGS_part_candidates, (float)FLAGS_render_threshold, FLAGS_number_people_max, FLAGS_maximize_positives, FLAGS_fps_max, - FLAGS_prototxt_path, FLAGS_caffemodel_path, (float)FLAGS_upsampling_ratio, enableGoogleLogging}; + op::String(FLAGS_prototxt_path), op::String(FLAGS_caffemodel_path), + (float)FLAGS_upsampling_ratio, enableGoogleLogging}; opWrapperT.configure(wrapperStructPose); // Face configuration (use op::WrapperStructFace{} to disable it) const op::WrapperStructFace wrapperStructFace{ @@ -310,11 +311,13 @@ void configureWrapper(op::WrapperT& opWrapperT) opWrapperT.configure(wrapperStructExtra); // Output (comment or use default argument to disable any output) const op::WrapperStructOutput wrapperStructOutput{ - FLAGS_cli_verbose, FLAGS_write_keypoint, op::stringToDataFormat(FLAGS_write_keypoint_format), - FLAGS_write_json, FLAGS_write_coco_json, FLAGS_write_coco_json_variants, FLAGS_write_coco_json_variant, - FLAGS_write_images, FLAGS_write_images_format, FLAGS_write_video, FLAGS_write_video_fps, - FLAGS_write_video_with_audio, FLAGS_write_heatmaps, FLAGS_write_heatmaps_format, FLAGS_write_video_3d, - FLAGS_write_video_adam, FLAGS_write_bvh, FLAGS_udp_host, FLAGS_udp_port}; + FLAGS_cli_verbose, op::String(FLAGS_write_keypoint), op::stringToDataFormat(FLAGS_write_keypoint_format), + op::String(FLAGS_write_json), op::String(FLAGS_write_coco_json), FLAGS_write_coco_json_variants, + FLAGS_write_coco_json_variant, op::String(FLAGS_write_images), op::String(FLAGS_write_images_format), + op::String(FLAGS_write_video), FLAGS_write_video_fps, FLAGS_write_video_with_audio, + op::String(FLAGS_write_heatmaps), op::String(FLAGS_write_heatmaps_format), op::String(FLAGS_write_video_3d), + op::String(FLAGS_write_video_adam), op::String(FLAGS_write_bvh), op::String(FLAGS_udp_host), + op::String(FLAGS_udp_port)}; opWrapperT.configure(wrapperStructOutput); // No GUI. Equivalent to: opWrapper.configure(op::WrapperStructGui{}); // Set to single-thread (for sequential processing and/or debugging and/or reducing latency) diff --git a/examples/tutorial_api_thread/1_thread_user_processing_function.cpp b/examples/tutorial_api_thread/1_thread_user_processing_function.cpp index ba1367b6..3fdefde4 100644 --- a/examples/tutorial_api_thread/1_thread_user_processing_function.cpp +++ b/examples/tutorial_api_thread/1_thread_user_processing_function.cpp @@ -70,18 +70,19 @@ int openPoseTutorialThread1() op::ConfigureLog::setPriorityThreshold((op::Priority)FLAGS_logging_level); // Step 2 - Read GFlags (user defined configuration) // cameraSize - const auto cameraSize = op::flagsToPoint(FLAGS_camera_resolution, "-1x-1"); + const auto cameraSize = op::flagsToPoint(op::String(FLAGS_camera_resolution), "-1x-1"); // outputSize - const auto outputSize = op::flagsToPoint(FLAGS_output_resolution, "-1x-1"); + const auto outputSize = op::flagsToPoint(op::String(FLAGS_output_resolution), "-1x-1"); // producerType op::ProducerType producerType; - std::string producerString; + op::String producerString; std::tie(producerType, producerString) = op::flagsToProducer( - FLAGS_image_dir, FLAGS_video, FLAGS_ip_camera, FLAGS_camera, FLAGS_flir_camera, FLAGS_flir_camera_index); + op::String(FLAGS_image_dir), op::String(FLAGS_video), op::String(FLAGS_ip_camera), FLAGS_camera, + FLAGS_flir_camera, FLAGS_flir_camera_index); const auto displayProducerFpsMode = (FLAGS_process_real_time ? op::ProducerFpsMode::OriginalFps : op::ProducerFpsMode::RetrievalFps); auto producerSharedPtr = createProducer( - producerType, producerString, cameraSize, FLAGS_camera_parameter_path, FLAGS_frame_undistort, + producerType, producerString.getStdString(), cameraSize, FLAGS_camera_parameter_path, FLAGS_frame_undistort, FLAGS_3d_views); producerSharedPtr->setProducerFpsMode(displayProducerFpsMode); op::opLog("", op::Priority::Low, __LINE__, __FUNCTION__, __FILE__); diff --git a/include/openpose/core/common.hpp b/include/openpose/core/common.hpp index 19a2dfed..6b30d99d 100644 --- a/include/openpose/core/common.hpp +++ b/include/openpose/core/common.hpp @@ -13,6 +13,7 @@ #include #include #include +#include #include #include // Datum at the end, otherwise circular dependency with array, point & rectangle diff --git a/include/openpose/core/headers.hpp b/include/openpose/core/headers.hpp index 8be24010..a8a63c38 100644 --- a/include/openpose/core/headers.hpp +++ b/include/openpose/core/headers.hpp @@ -19,6 +19,7 @@ #include #include #include +#include #include #include #include diff --git a/include/openpose/core/matrix.hpp b/include/openpose/core/matrix.hpp index 0a4f3724..fadf9a44 100644 --- a/include/openpose/core/matrix.hpp +++ b/include/openpose/core/matrix.hpp @@ -6,31 +6,31 @@ namespace op { - // Convert from Mat into cv::Mat. Usage example: + // Convert from Matrix into cv::Mat. Usage example: // #include // ... // cv::Mat opMat = OP2CVMAT(cv::Mat()); #define OP_OP2CVMAT(opMat) \ (*((cv::Mat*)((opMat).getCvMat()))) - // Convert from Mat into const cv::Mat. Usage example: + // Convert from Matrix into const cv::Mat. Usage example: // #include // ... // cv::Mat opMat = OP2CVCONSTMAT(cv::Mat()); #define OP_OP2CVCONSTMAT(opMat) \ (*((cv::Mat*)((opMat).getConstCvMat()))) - // Convert from cv::Mat into Mat. Usage example: + // Convert from cv::Mat into Matrix. Usage example: // #include // ... - // Mat opMat = CV2OPMAT(Mat()); + // Matrix opMat = CV2OPMAT(Matrix()); #define OP_CV2OPMAT(cvMat) \ (op::Matrix((void*)&(cvMat))) - // Convert from cv::Mat into const Mat. Usage example: + // Convert from cv::Mat into const Matrix. Usage example: // #include // ... - // Mat opMat = CV2OPCONSTMAT(Mat()); + // Matrix opMat = CV2OPCONSTMAT(Matrix()); #define OP_CV2OPCONSTMAT(cvMat) \ (op::Matrix((const void* const)&(cvMat))) @@ -90,7 +90,7 @@ namespace op } /** - * Mat: Bind of cv::Mat to avoid OpenCV as dependency in the headers. + * Matrix: Bind of cv::Mat to avoid OpenCV as dependency in the headers. */ class OP_API Matrix { @@ -179,8 +179,8 @@ namespace op private: // PIMPL idiom // http://www.cppsamples.com/common-tasks/pimpl.html - struct ImplMat; - std::shared_ptr spImpl; + struct ImplMatrix; + std::shared_ptr spImpl; }; } diff --git a/include/openpose/core/string.hpp b/include/openpose/core/string.hpp new file mode 100644 index 00000000..9bab6cfe --- /dev/null +++ b/include/openpose/core/string.hpp @@ -0,0 +1,41 @@ +#ifndef OPENPOSE_CORE_STRING_HPP +#define OPENPOSE_CORE_STRING_HPP + +#include // std::shared_ptr +#include +#include + +namespace op +{ + /** + * String: Basic container for std::string to avoid std::string in the WrapperStructXXX classes. Otherwise, + * cryptic runtime DLL errors could occur when exporting OpenPose to other projects using different STL DLLs. + */ + class OP_API String + { + public: + String(); + + /** + * It will force a copy of the char* of std::string to avoid DLL runtime errors. Example usages: + * std::string stdString = "This is a std::string"; + * String string(stdString.c_str()); + */ + String(const char* charPtr); + + /** + * It will force a copy of string + */ + explicit String(const std::string& string); + + const std::string& getStdString() const; + + private: + // PIMPL idiom + // http://www.cppsamples.com/common-tasks/pimpl.html + struct ImplString; + std::shared_ptr spImpl; + }; +} + +#endif // OPENPOSE_CORE_STRING_HPP diff --git a/include/openpose/utilities/flagsToOpenPose.hpp b/include/openpose/utilities/flagsToOpenPose.hpp index 5f992e31..079f6908 100644 --- a/include/openpose/utilities/flagsToOpenPose.hpp +++ b/include/openpose/utilities/flagsToOpenPose.hpp @@ -12,7 +12,7 @@ namespace op { OP_API PoseMode flagsToPoseMode(const int poseModeInt); - OP_API PoseModel flagsToPoseModel(const std::string& poseModeString); + OP_API PoseModel flagsToPoseModel(const String& poseModeString); OP_API ScaleMode flagsToScaleMode(const int keypointScaleMode); @@ -21,24 +21,24 @@ namespace op OP_API Detector flagsToDetector(const int detector); // Determine type of frame source - OP_API ProducerType flagsToProducerType(const std::string& imageDirectory, const std::string& videoPath, - const std::string& ipCameraPath, const int webcamIndex, - const bool flirCamera); + OP_API ProducerType flagsToProducerType( + const String& imageDirectory, const String& videoPath, const String& ipCameraPath, + const int webcamIndex, const bool flirCamera); - OP_API std::pair flagsToProducer( - const std::string& imageDirectory, const std::string& videoPath, const std::string& ipCameraPath = "", + OP_API std::pair flagsToProducer( + const String& imageDirectory, const String& videoPath, const String& ipCameraPath = String(""), const int webcamIndex = -1, const bool flirCamera = false, const int flirCameraIndex = -1); - OP_API std::vector flagsToHeatMaps(const bool heatMapsAddParts = false, - const bool heatMapsAddBkg = false, - const bool heatMapsAddPAFs = false); + OP_API std::vector flagsToHeatMaps( + const bool heatMapsAddParts = false, const bool heatMapsAddBkg = false, + const bool heatMapsAddPAFs = false); - OP_API RenderMode flagsToRenderMode(const int renderFlag, const bool gpuBuggy = false, - const int renderPoseFlag = -2); + OP_API RenderMode flagsToRenderMode( + const int renderFlag, const bool gpuBuggy = false, const int renderPoseFlag = -2); OP_API DisplayMode flagsToDisplayMode(const int display, const bool enabled3d); - OP_API Point flagsToPoint(const std::string& pointString, const std::string& pointExample = "1280x720"); + OP_API Point flagsToPoint(const String& pointString, const String& pointExample = String("1280x720")); } #endif // OPENPOSE_UTILITIES_FLAGS_TO_OPEN_POSE_HPP diff --git a/include/openpose/wrapper/wrapperAuxiliary.hpp b/include/openpose/wrapper/wrapperAuxiliary.hpp index 39547438..b6226036 100644 --- a/include/openpose/wrapper/wrapperAuxiliary.hpp +++ b/include/openpose/wrapper/wrapperAuxiliary.hpp @@ -99,8 +99,8 @@ namespace op // Create producer auto producerSharedPtr = createProducer( - wrapperStructInput.producerType, wrapperStructInput.producerString, - wrapperStructInput.cameraResolution, wrapperStructInput.cameraParameterPath, + wrapperStructInput.producerType, wrapperStructInput.producerString.getStdString(), + wrapperStructInput.cameraResolution, wrapperStructInput.cameraParameterPath.getStdString(), wrapperStructInput.undistortImage, wrapperStructInput.numberViews); // Editable arguments @@ -197,11 +197,11 @@ namespace op } // Proper format - const auto writeImagesCleaned = formatAsDirectory(wrapperStructOutput.writeImages); - const auto writeKeypointCleaned = formatAsDirectory(wrapperStructOutput.writeKeypoint); - const auto writeJsonCleaned = formatAsDirectory(wrapperStructOutput.writeJson); - const auto writeHeatMapsCleaned = formatAsDirectory(wrapperStructOutput.writeHeatMaps); - const auto modelFolder = formatAsDirectory(wrapperStructPose.modelFolder); + const auto writeImagesCleaned = formatAsDirectory(wrapperStructOutput.writeImages.getStdString()); + const auto writeKeypointCleaned = formatAsDirectory(wrapperStructOutput.writeKeypoint.getStdString()); + const auto writeJsonCleaned = formatAsDirectory(wrapperStructOutput.writeJson.getStdString()); + const auto writeHeatMapsCleaned = formatAsDirectory(wrapperStructOutput.writeHeatMaps.getStdString()); + const auto modelFolder = formatAsDirectory(wrapperStructPose.modelFolder.getStdString()); // Common parameters auto finalOutputSize = wrapperStructPose.outputSize; @@ -298,7 +298,7 @@ namespace op wrapperStructPose.poseModel, modelFolder, gpuId + gpuNumberStart, wrapperStructPose.heatMapTypes, wrapperStructPose.heatMapScaleMode, wrapperStructPose.addPartCandidates, wrapperStructPose.maximizePositives, - wrapperStructPose.protoTxtPath, wrapperStructPose.caffeModelPath, + wrapperStructPose.protoTxtPath.getStdString(), wrapperStructPose.caffeModelPath.getStdString(), wrapperStructPose.upsamplingRatio, wrapperStructPose.poseMode == PoseMode::Enabled, wrapperStructPose.enableGoogleLogging )); @@ -747,13 +747,13 @@ namespace op } opLog("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); // Write people pose/foot/face/hand/etc. data on disk (COCO validation JSON format) - if (!wrapperStructOutput.writeCocoJson.empty()) + if (!wrapperStructOutput.writeCocoJson.getStdString().empty()) { opLog("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); // If humanFormat: bigger size (& maybe slower to process), but easier for user to read it const auto humanFormat = true; const auto cocoJsonSaver = std::make_shared( - wrapperStructOutput.writeCocoJson, wrapperStructPose.poseModel, humanFormat, + wrapperStructOutput.writeCocoJson.getStdString(), wrapperStructPose.poseModel, humanFormat, wrapperStructOutput.writeCocoJsonVariants, (wrapperStructPose.poseModel != PoseModel::CAR_22 && wrapperStructPose.poseModel != PoseModel::CAR_12 @@ -767,14 +767,14 @@ namespace op if (!writeImagesCleaned.empty()) { opLog("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); - const auto imageSaver = std::make_shared(writeImagesCleaned, - wrapperStructOutput.writeImagesFormat); + const auto imageSaver = std::make_shared( + writeImagesCleaned, wrapperStructOutput.writeImagesFormat.getStdString()); outputWs.emplace_back(std::make_shared>(imageSaver)); } opLog("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); auto originalVideoFps = 0.; - if (!wrapperStructOutput.writeVideo.empty() || !wrapperStructOutput.writeVideo3D.empty() - || !wrapperStructOutput.writeBvh.empty()) + if (!wrapperStructOutput.writeVideo.getStdString().empty() || !wrapperStructOutput.writeVideo3D.getStdString().empty() + || !wrapperStructOutput.writeBvh.getStdString().empty()) { opLog("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); if (wrapperStructOutput.writeVideoFps <= 0 @@ -790,7 +790,7 @@ namespace op } opLog("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); // Write frames as *.avi video on hard disk - if (!wrapperStructOutput.writeVideo.empty()) + if (!wrapperStructOutput.writeVideo.getStdString().empty()) { opLog("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); // Sanity checks @@ -804,8 +804,8 @@ namespace op __LINE__, __FUNCTION__, __FILE__); // Create video saver worker const auto videoSaver = std::make_shared( - wrapperStructOutput.writeVideo, getCvFourcc('M','J','P','G'), originalVideoFps, - (wrapperStructOutput.writeVideoWithAudio ? wrapperStructInput.producerString : "")); + wrapperStructOutput.writeVideo.getStdString(), getCvFourcc('M','J','P','G'), originalVideoFps, + (wrapperStructOutput.writeVideoWithAudio ? wrapperStructInput.producerString.getStdString() : "")); outputWs.emplace_back(std::make_shared>(videoSaver)); } opLog("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); @@ -826,7 +826,7 @@ namespace op { opLog("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); const auto heatMapSaver = std::make_shared( - writeHeatMapsCleaned, wrapperStructOutput.writeHeatMapsFormat); + writeHeatMapsCleaned, wrapperStructOutput.writeHeatMapsFormat.getStdString()); outputWs.emplace_back(std::make_shared>(heatMapSaver)); } opLog("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); @@ -892,15 +892,15 @@ namespace op finalOutputSizeGui, wrapperStructGui.fullScreen, threadManager.getIsRunningSharedPtr(), spVideoSeek, poseExtractorNets, faceExtractorNets, handExtractorNets, renderers, wrapperStructPose.poseModel, wrapperStructGui.displayMode, - !wrapperStructOutput.writeVideo3D.empty() + !wrapperStructOutput.writeVideo3D.getStdString().empty() ); // WGui guiW = {std::make_shared>(gui)}; // Write 3D frames as *.avi video on hard disk - if (!wrapperStructOutput.writeVideo3D.empty()) + if (!wrapperStructOutput.writeVideo3D.getStdString().empty()) { const auto videoSaver = std::make_shared( - wrapperStructOutput.writeVideo3D, getCvFourcc('M','J','P','G'), originalVideoFps, ""); + wrapperStructOutput.writeVideo3D.getStdString(), getCvFourcc('M','J','P','G'), originalVideoFps, ""); videoSaver3DW = std::make_shared>(videoSaver); } } @@ -916,7 +916,7 @@ namespace op // WGui guiW = {std::make_shared>(gui)}; // Write 3D frames as *.avi video on hard disk - if (!wrapperStructOutput.writeVideo3D.empty()) + if (!wrapperStructOutput.writeVideo3D.getStdString().empty()) error("3D video can only be recorded if 3D render is enabled.", __LINE__, __FUNCTION__, __FILE__); } diff --git a/include/openpose/wrapper/wrapperStructInput.hpp b/include/openpose/wrapper/wrapperStructInput.hpp index 48d354a4..ff304877 100644 --- a/include/openpose/wrapper/wrapperStructInput.hpp +++ b/include/openpose/wrapper/wrapperStructInput.hpp @@ -24,7 +24,7 @@ namespace op * camera index for Webcam and FlirCamera, URL for IPCamera, etc.). * Default: "". */ - std::string producerString; + String producerString; /** * First image to process. @@ -75,7 +75,7 @@ namespace op * Directory path for the camera parameters (intrinsic and extrinsic parameters) or optionally XML file * full path (if only 1 view). */ - std::string cameraParameterPath; + String cameraParameterPath; /** * Whether to undistort the image given the camera parameters. @@ -97,12 +97,12 @@ namespace op * Since all the elements of the struct are public, they can also be manually filled. */ WrapperStructInput( - const ProducerType producerType = ProducerType::None, const std::string& producerString = "", + const ProducerType producerType = ProducerType::None, const String& producerString = "", const unsigned long long frameFirst = 0, const unsigned long long frameStep = 1, const unsigned long long frameLast = std::numeric_limits::max(), const bool realTimeProcessing = false, const bool frameFlip = false, const int frameRotate = 0, const bool framesRepeat = false, const Point& cameraResolution = Point{-1,-1}, - const std::string& cameraParameterPath = "models/cameraParameters/", + const String& cameraParameterPath = "models/cameraParameters/", const bool undistortImage = false, const int numberViews = -1); }; } diff --git a/include/openpose/wrapper/wrapperStructOutput.hpp b/include/openpose/wrapper/wrapperStructOutput.hpp index 9be48b0c..257c2bc7 100644 --- a/include/openpose/wrapper/wrapperStructOutput.hpp +++ b/include/openpose/wrapper/wrapperStructOutput.hpp @@ -25,7 +25,7 @@ namespace op * If it is empty (default), it is disabled. * Select format with writeKeypointFormat. */ - std::string writeKeypoint; + String writeKeypoint; /** * Data format to save Pose (x, y, score) locations. @@ -42,13 +42,13 @@ namespace op * - `part_candidates` field with body part candidates in (x, y, score) format (if enabled with * `--part_candidates`). */ - std::string writeJson; + String writeJson; /** * Pose (x, y, score) locations saving folder location in JSON COCO validation format. * If it is empty (default), it is disabled. */ - std::string writeCocoJson; + String writeCocoJson; /** * It selects the COCO variants for cocoJsonSaver. @@ -67,7 +67,7 @@ namespace op * Rendered image saving folder. * If it is empty (default), it is disabled. */ - std::string writeImages; + String writeImages; /** * Rendered image saving folder format. @@ -75,14 +75,14 @@ namespace op * E.g., png, jpg, etc. * If writeImages is empty (default), it makes no effect. */ - std::string writeImagesFormat; + String writeImagesFormat; /** * Rendered images saving video path. * Please, use *.avi format. * If it is empty (default), it is disabled. */ - std::string writeVideo; + String writeVideo; /** * Frame rate of the recorded video. @@ -103,44 +103,44 @@ namespace op * In order to save the heatmaps, WrapperStructPose.heatMapTypes must also be filled. * If it is empty (default), it is disabled. */ - std::string writeHeatMaps; + String writeHeatMaps; /** * Heat maps image saving format. * Analogous to writeImagesFormat. */ - std::string writeHeatMapsFormat; + String writeHeatMapsFormat; /** * Rendered 3D images saving video path. * Please, use *.avi format. * If it is empty (default), it is disabled. */ - std::string writeVideo3D; + String writeVideo3D; /** * Rendered Adam images saving video path. * Please, use *.avi format. * If it is empty (default), it is disabled. */ - std::string writeVideoAdam; + String writeVideoAdam; /** * Path to save a 3-D joint angle BVH file. * Please, use *.bvh format. * If it is empty (default), it is disabled. */ - std::string writeBvh; + String writeBvh; /** * Target server IP address for UDP client-server communication. */ - std::string udpHost; + String udpHost; /** * Target server IP port for UDP client-server communication. */ - std::string udpPort; + String udpPort; /** * Constructor of the struct. @@ -148,16 +148,16 @@ namespace op * Since all the elements of the struct are public, they can also be manually filled. */ WrapperStructOutput( - const double verbose = -1, const std::string& writeKeypoint = "", - const DataFormat writeKeypointFormat = DataFormat::Xml, const std::string& writeJson = "", - const std::string& writeCocoJson = "", const int writeCocoJsonVariants = 1, - const int writeCocoJsonVariant = 1, const std::string& writeImages = "", - const std::string& writeImagesFormat = "png", const std::string& writeVideo = "", + const double verbose = -1, const String& writeKeypoint = "", + const DataFormat writeKeypointFormat = DataFormat::Xml, const String& writeJson = "", + const String& writeCocoJson = "", const int writeCocoJsonVariants = 1, + const int writeCocoJsonVariant = 1, const String& writeImages = "", + const String& writeImagesFormat = "png", const String& writeVideo = "", const double writeVideoFps = -1., const bool writeVideoWithAudio = false, - const std::string& writeHeatMaps = "", const std::string& writeHeatMapsFormat = "png", - const std::string& writeVideo3D = "", const std::string& writeVideoAdam = "", - const std::string& writeBvh = "", const std::string& udpHost = "", - const std::string& udpPort = "8051"); + const String& writeHeatMaps = "", const String& writeHeatMapsFormat = "png", + const String& writeVideo3D = "", const String& writeVideoAdam = "", + const String& writeBvh = "", const String& udpHost = "", + const String& udpPort = "8051"); }; } diff --git a/include/openpose/wrapper/wrapperStructPose.hpp b/include/openpose/wrapper/wrapperStructPose.hpp index ab81b91e..4abdd5d3 100644 --- a/include/openpose/wrapper/wrapperStructPose.hpp +++ b/include/openpose/wrapper/wrapperStructPose.hpp @@ -118,7 +118,7 @@ namespace op /** * Folder where the pose Caffe models are located. */ - std::string modelFolder; + String modelFolder; /** * Whether and which heat maps to save on the Array Datum.heatmaps. @@ -180,14 +180,14 @@ namespace op * The combination modelFolder + protoTxtPath represents the whole path to the prototxt file. * If empty, it will use the default OpenPose ProtoTxt file. */ - std::string protoTxtPath; + String protoTxtPath; /** * Final path where the pose Caffe CaffeModel is located. * The combination modelFolder + caffeModelPath represents the whole path to the caffemodel file. * If empty, it will use the default OpenPose CaffeModel file. */ - std::string caffeModelPath; + String caffeModelPath; /** * The image upsampling scale. 8 is the stride of the network, so the ideal value to maximize the @@ -217,10 +217,10 @@ namespace op const RenderMode renderMode = RenderMode::Auto, const PoseModel poseModel = PoseModel::BODY_25, const bool blendOriginalFrame = true, const float alphaKeypoint = POSE_DEFAULT_ALPHA_KEYPOINT, const float alphaHeatMap = POSE_DEFAULT_ALPHA_HEAT_MAP, const int defaultPartToRender = 0, - const std::string& modelFolder = "models/", const std::vector& heatMapTypes = {}, + const String& modelFolder = "models/", const std::vector& heatMapTypes = {}, const ScaleMode heatMapScaleMode = ScaleMode::UnsignedChar, const bool addPartCandidates = false, const float renderThreshold = 0.05f, const int numberPeopleMax = -1, const bool maximizePositives = false, - const double fpsMax = -1., const std::string& protoTxtPath = "", const std::string& caffeModelPath = "", + const double fpsMax = -1., const String& protoTxtPath = "", const String& caffeModelPath = "", const float upsamplingRatio = 0.f, const bool enableGoogleLogging = true); }; } diff --git a/python/openpose/openpose_python.cpp b/python/openpose/openpose_python.cpp index 6836f753..ca823f09 100644 --- a/python/openpose/openpose_python.cpp +++ b/python/openpose/openpose_python.cpp @@ -27,9 +27,10 @@ void parse_gflags(const std::vector& argv) try { std::vector argv_vec; - for(auto& arg : argv) argv_vec.emplace_back((char*)arg.c_str()); + for (auto& arg : argv) + argv_vec.emplace_back((char*)arg.c_str()); char** cast = &argv_vec[0]; - int size = argv_vec.size(); + int size = (int)argv_vec.size(); gflags::ParseCommandLineFlags(&size, &cast, true); } catch (const std::exception& e) @@ -90,7 +91,8 @@ public: { try { - if(params.size()) init_int(params); + if (params.size()) + init_int(params); // logging_level checkBool( @@ -101,17 +103,17 @@ public: // Applying user defined configuration - GFlags to program variables // outputSize - const auto outputSize = flagsToPoint(FLAGS_output_resolution, "-1x-1"); + const auto outputSize = flagsToPoint(op::String(FLAGS_output_resolution), "-1x-1"); // netInputSize - const auto netInputSize = flagsToPoint(FLAGS_net_resolution, "-1x368"); + const auto netInputSize = flagsToPoint(op::String(FLAGS_net_resolution), "-1x368"); // faceNetInputSize - const auto faceNetInputSize = flagsToPoint(FLAGS_face_net_resolution, "368x368 (multiples of 16)"); + const auto faceNetInputSize = flagsToPoint(op::String(FLAGS_face_net_resolution), "368x368 (multiples of 16)"); // handNetInputSize - const auto handNetInputSize = flagsToPoint(FLAGS_hand_net_resolution, "368x368 (multiples of 16)"); + const auto handNetInputSize = flagsToPoint(op::String(FLAGS_hand_net_resolution), "368x368 (multiples of 16)"); // poseMode const auto poseMode = flagsToPoseMode(FLAGS_body); // poseModel - const auto poseModel = flagsToPoseModel(FLAGS_model_pose); + const auto poseModel = flagsToPoseModel(op::String(FLAGS_model_pose)); // JSON saving if (!FLAGS_write_keypoint.empty()) opLog("Flag `write_keypoint` is deprecated and will eventually be removed." @@ -131,13 +133,14 @@ public: const bool enableGoogleLogging = true; // Pose configuration (use WrapperStructPose{} for default and recommended configuration) - const WrapperStructPose wrapperStructPose{ + const op::WrapperStructPose wrapperStructPose{ poseMode, netInputSize, outputSize, keypointScaleMode, FLAGS_num_gpu, FLAGS_num_gpu_start, - FLAGS_scale_number, (float)FLAGS_scale_gap, flagsToRenderMode(FLAGS_render_pose, multipleView), + FLAGS_scale_number, (float)FLAGS_scale_gap, op::flagsToRenderMode(FLAGS_render_pose, multipleView), poseModel, !FLAGS_disable_blending, (float)FLAGS_alpha_pose, (float)FLAGS_alpha_heatmap, - FLAGS_part_to_show, FLAGS_model_folder, heatMapTypes, heatMapScaleMode, FLAGS_part_candidates, + FLAGS_part_to_show, op::String(FLAGS_model_folder), heatMapTypes, heatMapScaleMode, FLAGS_part_candidates, (float)FLAGS_render_threshold, FLAGS_number_people_max, FLAGS_maximize_positives, FLAGS_fps_max, - FLAGS_prototxt_path, FLAGS_caffemodel_path, (float)FLAGS_upsampling_ratio, enableGoogleLogging}; + op::String(FLAGS_prototxt_path), op::String(FLAGS_caffemodel_path), + (float)FLAGS_upsampling_ratio, enableGoogleLogging}; opWrapper->configure(wrapperStructPose); // Face configuration (use WrapperStructFace{} to disable it) const WrapperStructFace wrapperStructFace{ @@ -157,11 +160,13 @@ public: opWrapper->configure(wrapperStructExtra); // Output (comment or use default argument to disable any output) const WrapperStructOutput wrapperStructOutput{ - FLAGS_cli_verbose, FLAGS_write_keypoint, stringToDataFormat(FLAGS_write_keypoint_format), - FLAGS_write_json, FLAGS_write_coco_json, FLAGS_write_coco_json_variants, FLAGS_write_coco_json_variant, - FLAGS_write_images, FLAGS_write_images_format, FLAGS_write_video, FLAGS_write_video_fps, - FLAGS_write_video_with_audio, FLAGS_write_heatmaps, FLAGS_write_heatmaps_format, FLAGS_write_video_3d, - FLAGS_write_video_adam, FLAGS_write_bvh, FLAGS_udp_host, FLAGS_udp_port}; + FLAGS_cli_verbose, op::String(FLAGS_write_keypoint), op::stringToDataFormat(FLAGS_write_keypoint_format), + op::String(FLAGS_write_json), op::String(FLAGS_write_coco_json), FLAGS_write_coco_json_variants, + FLAGS_write_coco_json_variant, op::String(FLAGS_write_images), op::String(FLAGS_write_images_format), + op::String(FLAGS_write_video), FLAGS_write_video_fps, FLAGS_write_video_with_audio, + op::String(FLAGS_write_heatmaps), op::String(FLAGS_write_heatmaps_format), op::String(FLAGS_write_video_3d), + op::String(FLAGS_write_video_adam), op::String(FLAGS_write_bvh), op::String(FLAGS_udp_host), + op::String(FLAGS_udp_port)}; opWrapper->configure(wrapperStructOutput); // No GUI. Equivalent to: opWrapper.configure(WrapperStructGui{}); // Set to single-thread (for sequential processing and/or debugging and/or reducing latency) @@ -202,16 +207,17 @@ public: { try { - const auto cameraSize = flagsToPoint(FLAGS_camera_resolution, "-1x-1"); + const auto cameraSize = flagsToPoint(op::String(FLAGS_camera_resolution), "-1x-1"); ProducerType producerType; - std::string producerString; + op::String producerString; std::tie(producerType, producerString) = flagsToProducer( - FLAGS_image_dir, FLAGS_video, FLAGS_ip_camera, FLAGS_camera, FLAGS_flir_camera, FLAGS_flir_camera_index); + op::String(FLAGS_image_dir), op::String(FLAGS_video), op::String(FLAGS_ip_camera), FLAGS_camera, + FLAGS_flir_camera, FLAGS_flir_camera_index); // Producer (use default to disable any input) const WrapperStructInput wrapperStructInput{ producerType, producerString, FLAGS_frame_first, FLAGS_frame_step, FLAGS_frame_last, FLAGS_process_real_time, FLAGS_frame_flip, FLAGS_frame_rotate, FLAGS_frames_repeat, - cameraSize, FLAGS_camera_parameter_path, FLAGS_frame_undistort, FLAGS_3d_views}; + cameraSize, op::String(FLAGS_camera_parameter_path), FLAGS_frame_undistort, FLAGS_3d_views}; opWrapper->configure(wrapperStructInput); // GUI (comment or use default argument to disable any visual output) const WrapperStructGui wrapperStructGui{ @@ -381,6 +387,7 @@ template <> struct type_caster> { { try { + UNUSED(imp); // array b(src, true); array b = reinterpret_borrow(src); buffer_info info = b.request(); @@ -409,6 +416,7 @@ template <> struct type_caster> { // Cast op::Array to numpy static handle cast(const op::Array &m, return_value_policy, handle defval) { + UNUSED(defval); std::string format = format_descriptor::format(); return array(buffer_info( m.getPseudoConstPtr(),/* Pointer to buffer */ @@ -439,32 +447,36 @@ template <> struct type_caster { array b = reinterpret_borrow(src); buffer_info info = b.request(); - int ndims = info.ndim; + const int ndims = (int)info.ndim; decltype(CV_32F) dtype; size_t elemsize; - if (info.format == format_descriptor::format()) { - if (ndims == 3) { + if (info.format == format_descriptor::format()) + { + if (ndims == 3) dtype = CV_32FC3; - } else { + else dtype = CV_32FC1; - } elemsize = sizeof(float); - } else if (info.format == format_descriptor::format()) { - if (ndims == 3) { + } + else if (info.format == format_descriptor::format()) + { + if (ndims == 3) dtype = CV_64FC3; - } else { + else dtype = CV_64FC1; - } elemsize = sizeof(double); - } else if (info.format == format_descriptor::format()) { - if (ndims == 3) { + } + else if (info.format == format_descriptor::format()) + { + if (ndims == 3) dtype = CV_8UC3; - } else { + else dtype = CV_8UC1; - } elemsize = sizeof(unsigned char); - } else { + } + else + { throw std::logic_error("Unsupported type"); return false; } @@ -478,6 +490,7 @@ template <> struct type_caster { // Cast cv::Mat to numpy static handle cast(const cv::Mat &m, return_value_policy, handle defval) { + UNUSED(defval); std::string format = format_descriptor::format(); size_t elemsize = sizeof(unsigned char); int dim; diff --git a/src/openpose/core/CMakeLists.txt b/src/openpose/core/CMakeLists.txt index 92cfc26c..45053d09 100644 --- a/src/openpose/core/CMakeLists.txt +++ b/src/openpose/core/CMakeLists.txt @@ -15,6 +15,7 @@ set(SOURCES_OP_CORE rectangle.cpp renderer.cpp scaleAndSizeExtractor.cpp + string.cpp verbosePrinter.cpp) include(${CMAKE_SOURCE_DIR}/cmake/Utils.cmake) diff --git a/src/openpose/core/matrix.cpp b/src/openpose/core/matrix.cpp index 507d2632..8f04412a 100644 --- a/src/openpose/core/matrix.cpp +++ b/src/openpose/core/matrix.cpp @@ -4,18 +4,18 @@ namespace op { - struct Matrix::ImplMat + struct Matrix::ImplMatrix { cv::Mat mCvMat; }; Matrix::Matrix() : - spImpl{std::make_shared()} + spImpl{std::make_shared()} { } Matrix::Matrix(const void* cvMatPtr) : - spImpl{std::make_shared()} + spImpl{std::make_shared()} { try { @@ -28,7 +28,7 @@ namespace op } Matrix::Matrix(const int rows, const int cols, const int type, void* cvMatPtr) : - spImpl{std::make_shared()} + spImpl{std::make_shared()} { try { diff --git a/src/openpose/core/string.cpp b/src/openpose/core/string.cpp new file mode 100644 index 00000000..141525e1 --- /dev/null +++ b/src/openpose/core/string.cpp @@ -0,0 +1,47 @@ +#include +#include + +namespace op +{ + struct String::ImplString + { + std::string mString; + + ImplString() + { + } + + ImplString(const char* charPtr) : + mString{charPtr} + { + } + }; + + String::String() : + spImpl{std::make_shared()} + { + } + + String::String(const char* charPtr) : + spImpl{std::make_shared(charPtr)} + { + } + + String::String(const std::string& string) : + spImpl{std::make_shared(string.c_str())} + { + } + + const std::string& String::getStdString() const + { + try + { + return spImpl->mString; + } + catch (const std::exception& e) + { + error(e.what(), __LINE__, __FUNCTION__, __FILE__); + return spImpl->mString; + } + } +} diff --git a/src/openpose/producer/producer.cpp b/src/openpose/producer/producer.cpp index 14052ffc..ed81c8e7 100644 --- a/src/openpose/producer/producer.cpp +++ b/src/openpose/producer/producer.cpp @@ -408,10 +408,9 @@ namespace op } } - std::shared_ptr createProducer(const ProducerType producerType, const std::string& producerString, - const Point& cameraResolution, - const std::string& cameraParameterPath, const bool undistortImage, - const int numberViews) + std::shared_ptr createProducer( + const ProducerType producerType, const std::string& producerString, const Point& cameraResolution, + const std::string& cameraParameterPath, const bool undistortImage, const int numberViews) { try { diff --git a/src/openpose/unity/unityBinding.cpp b/src/openpose/unity/unityBinding.cpp index 99746967..b283bd56 100644 --- a/src/openpose/unity/unityBinding.cpp +++ b/src/openpose/unity/unityBinding.cpp @@ -9,7 +9,7 @@ namespace op #ifdef _WIN32 // Output callback register in Unity typedef void(__stdcall * OutputCallback) (void * ptrs, int ptrSize, int * sizes, int sizeSize, - uchar outputType); + unsigned char outputType); // Global output callback OutputCallback sUnityOutputCallback; #endif @@ -86,13 +86,14 @@ namespace op private: template - void outputValue(T ** ptrs, int ptrSize, int * sizes, int sizeSize, OutputType outputType) + void outputValue(T** ptrs, const int ptrSize, int* sizes, const int sizeSize, const OutputType outputType) { try { #ifdef _WIN32 if (sUnityOutputCallback) - sUnityOutputCallback(static_cast(ptrs), ptrSize, sizes, sizeSize, (uchar)outputType); + sUnityOutputCallback( + static_cast(ptrs), ptrSize, sizes, sizeSize, (unsigned char)outputType); #else UNUSED(ptrs); UNUSED(ptrSize); @@ -114,12 +115,12 @@ namespace op { auto& datum = datumsPtr->at(0); int sizes[] = { 1 }; - int sizeSize = 1; - unsigned long long *val[] = {&(datum->id), &(datum->subId), &(datum->subIdMax), &(datum->frameNumber)}; - int ptrSize = 4; + const int sizeSize = 1; + unsigned long long* val[] = {&(datum->id), &(datum->subId), &(datum->subIdMax), &(datum->frameNumber)}; + const int ptrSize = 4; outputValue(&val[0], ptrSize, &sizes[0], sizeSize, OutputType::DatumsInfo); - char const *a[] = { datum->name.c_str() }; + const char* a[] = { datum->name.c_str() }; outputValue(&a[0], 1, &sizes[0], sizeSize, OutputType::Name); } catch (const std::exception& e) @@ -136,9 +137,9 @@ namespace op if (!data.empty()) { auto sizeVector = data.getSize(); - int sizeSize = sizeVector.size(); - int * sizes = &sizeVector[0]; - float * val = data.getPtr(); + const int sizeSize = (int)sizeVector.size(); + int* sizes = &sizeVector[0]; + float* val = data.getPtr(); outputValue(&val, 1, sizes, sizeSize, OutputType::PoseKeypoints); } } @@ -156,9 +157,9 @@ namespace op if (!data.empty()) { auto sizeVector = data.getSize(); - int sizeSize = sizeVector.size(); - int * sizes = &sizeVector[0]; - long long * val = data.getPtr(); + const int sizeSize = (int)sizeVector.size(); + int* sizes = &sizeVector[0]; + long long* val = data.getPtr(); outputValue(&val, 1, sizes, sizeSize, OutputType::PoseIds); } } @@ -176,9 +177,9 @@ namespace op if (!data.empty()) { auto sizeVector = data.getSize(); - int sizeSize = sizeVector.size(); - int * sizes = &sizeVector[0]; - float * val = data.getPtr(); + const int sizeSize = (int)sizeVector.size(); + int* sizes = &sizeVector[0]; + float* val = data.getPtr(); outputValue(&val, 1, sizes, sizeSize, OutputType::PoseScores); } } @@ -196,9 +197,9 @@ namespace op if (!data.empty()) { auto sizeVector = data.getSize(); - int sizeSize = sizeVector.size(); - int * sizes = &sizeVector[0]; - float * val = data.getPtr(); + const int sizeSize = (int)sizeVector.size(); + int* sizes = &sizeVector[0]; + float* val = data.getPtr(); outputValue(&val, 1, sizes, sizeSize, OutputType::PoseHeatMaps); } } @@ -264,7 +265,7 @@ namespace op if (!data.empty()) { auto sizeVector = data.getSize(); - int sizeSize = sizeVector.size(); + int sizeSize = (int)sizeVector.size(); int * sizes = &sizeVector[0]; float * val = data.getPtr(); outputValue(&val, 1, sizes, sizeSize, OutputType::FaceKeypoints); @@ -284,7 +285,7 @@ namespace op if (!data.empty()) { auto sizeVector = data.getSize(); - int sizeSize = sizeVector.size(); + int sizeSize = (int)sizeVector.size(); int * sizes = &sizeVector[0]; float * val = data.getPtr(); outputValue(&val, 1, sizes, sizeSize, OutputType::FaceHeatMaps); @@ -317,8 +318,8 @@ namespace op valPtrs.push_back(vals); } int sizes[] = {2, 4}; - int sizeSize = 2; - outputValue(valPtrs.data(), valPtrs.size(), sizes, sizeSize, OutputType::HandRectangles); + const int sizeSize = 2; + outputValue(valPtrs.data(), (int)valPtrs.size(), sizes, sizeSize, OutputType::HandRectangles); } } catch (const std::exception& e) @@ -335,9 +336,9 @@ namespace op if (data.size() == 2 && !data[0].empty()) { auto sizeVector = data[0].getSize(); - int sizeSize = sizeVector.size(); - int * sizes = &sizeVector[0]; - float * ptrs[] = { data[0].getPtr(), data[1].getPtr() }; + const int sizeSize = (int)sizeVector.size(); + int* sizes = &sizeVector[0]; + float* ptrs[] = { data[0].getPtr(), data[1].getPtr() }; outputValue(ptrs, 2, sizes, sizeSize, OutputType::HandKeypoints); } } @@ -355,9 +356,9 @@ namespace op if (data.size() == 2 && !data[0].empty()) { auto sizeVector = data[0].getSize(); - int sizeSize = sizeVector.size(); - int * sizes = &sizeVector[0]; - float * ptrs[] = { data[0].getPtr(), data[1].getPtr() }; + const int sizeSize = (int)sizeVector.size(); + int* sizes = &sizeVector[0]; + float* ptrs[] = { data[0].getPtr(), data[1].getPtr() }; outputValue(ptrs, 2, sizes, sizeSize, OutputType::HandHeightMaps); } } @@ -374,9 +375,9 @@ namespace op auto& data = datumsPtr->at(0)->cvInputData; // cv::Mat if (!data.empty()) { - int sizeVector[] = { data.rows, data.cols, 3 }; - int sizeSize = 3; - auto valPtr = data.data; + int sizeVector[] = { data.rows(), data.cols(), 3 }; + const int sizeSize = 3; + auto valPtr = data.data(); outputValue(&valPtr, 1, sizeVector, sizeSize, OutputType::Image); } } @@ -529,17 +530,17 @@ namespace op // Configs OP_API void _OPConfigurePose( - uchar poseMode, + unsigned char poseMode, int netInputSizeX, int netInputSizeY, // Point int outputSizeX, int outputSizeY, // Point - uchar keypointScaleMode, // ScaleMode + unsigned char keypointScaleMode, // ScaleMode int gpuNumber, int gpuNumberStart, int scalesNumber, float scaleGap, - uchar renderMode, // RenderMode - uchar poseModel, // PoseModel + unsigned char renderMode, // RenderMode + unsigned char poseModel, // PoseModel bool blendOriginalFrame, float alphaKeypoint, float alphaHeatMap, int defaultPartToRender, char* modelFolder, bool heatMapAddParts, bool heatMapAddBkg, - bool heatMapAddPAFs, // HeatMapType // uchar heatmap_type, - uchar heatMapScaleMode, // ScaleMode + bool heatMapAddPAFs, // HeatMapType // unsigned char heatmap_type, + unsigned char heatMapScaleMode, // ScaleMode bool addPartCandidates, float renderThreshold, int numberPeopleMax, bool maximizePositives, double fpsMax, char* protoTxtPath, char* caffeModelPath, float upsamplingRatio) { @@ -563,9 +564,9 @@ namespace op } OP_API void _OPConfigureHand( - bool enable, uchar detector, int netInputSizeX, int netInputSizeY, // Point + bool enable, unsigned char detector, int netInputSizeX, int netInputSizeY, // Point int scalesNumber, float scaleRange, - uchar renderMode, // RenderMode + unsigned char renderMode, // RenderMode float alphaKeypoint, float alphaHeatMap, float renderThreshold) { try @@ -581,8 +582,8 @@ namespace op } OP_API void _OPConfigureFace( - bool enable, uchar detector, int netInputSizeX, int netInputSizeY, // Point - uchar renderMode, // RenderMode + bool enable, unsigned char detector, int netInputSizeX, int netInputSizeY, // Point + unsigned char renderMode, // RenderMode float alphaKeypoint, float alphaHeatMap, float renderThreshold) { try @@ -614,7 +615,7 @@ namespace op } OP_API void _OPConfigureInput( - uchar producerType, char* producerString, // ProducerType + unsigned char producerType, char* producerString, // ProducerType unsigned long long frameFirst, unsigned long long frameStep, unsigned long long frameLast, bool realTimeProcessing, bool frameFlip, int frameRotate, bool framesRepeat, int cameraResolutionX, int cameraResolutionY, // Point @@ -635,7 +636,7 @@ namespace op } OP_API void _OPConfigureOutput( - double verbose, char* writeKeypoint, uchar writeKeypointFormat, // DataFormat + double verbose, char* writeKeypoint, unsigned char writeKeypointFormat, // DataFormat char* writeJson, char* writeCocoJson, int writeCocoJsonVariants, int writeCocoJsonVariant, char* writeImages, char* writeImagesFormat, char* writeVideo, double writeVideoFps, bool writeVideoWithAudio, char* writeHeatMaps, char* writeHeatMapsFormat, char* writeVideo3D, char* writeVideoAdam, char* writeBvh, @@ -656,7 +657,7 @@ namespace op } OP_API void _OPConfigureGui( - ushort displayMode, // DisplayMode + unsigned short displayMode, // DisplayMode bool guiVerbose, bool fullScreen) { try @@ -671,7 +672,7 @@ namespace op } OP_API void _OPConfigureDebugging( - uchar loggingLevel, // Priority + unsigned char loggingLevel, // Priority bool disableMultiThread, unsigned long long profileSpeed) { diff --git a/src/openpose/utilities/flagsToOpenPose.cpp b/src/openpose/utilities/flagsToOpenPose.cpp index 839615b9..f7b8ee77 100644 --- a/src/openpose/utilities/flagsToOpenPose.cpp +++ b/src/openpose/utilities/flagsToOpenPose.cpp @@ -25,45 +25,46 @@ namespace op } } - PoseModel flagsToPoseModel(const std::string& poseModeString) + PoseModel flagsToPoseModel(const String& poseModeString) { try { + const std::string& poseModeStdString = poseModeString.getStdString(); opLog("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); // Body pose - if (poseModeString == "BODY_25") + if (poseModeStdString == "BODY_25") return PoseModel::BODY_25; - else if (poseModeString == "COCO") + else if (poseModeStdString == "COCO") return PoseModel::COCO_18; - else if (poseModeString == "MPI") + else if (poseModeStdString == "MPI") return PoseModel::MPI_15; - else if (poseModeString == "MPI_4_layers") + else if (poseModeStdString == "MPI_4_layers") return PoseModel::MPI_15_4; - else if (poseModeString == "BODY_19") + else if (poseModeStdString == "BODY_19") return PoseModel::BODY_19; - else if (poseModeString == "BODY_19E") + else if (poseModeStdString == "BODY_19E") return PoseModel::BODY_19E; - else if (poseModeString == "BODY_19N") + else if (poseModeStdString == "BODY_19N") return PoseModel::BODY_19N; - else if (poseModeString == "BODY_19_X2") + else if (poseModeStdString == "BODY_19_X2") return PoseModel::BODY_19_X2; - else if (poseModeString == "BODY_23") + else if (poseModeStdString == "BODY_23") return PoseModel::BODY_23; - else if (poseModeString == "BODY_25B") + else if (poseModeStdString == "BODY_25B") return PoseModel::BODY_25B; - else if (poseModeString == "BODY_25D") + else if (poseModeStdString == "BODY_25D") return PoseModel::BODY_25D; - else if (poseModeString == "BODY_25E") + else if (poseModeStdString == "BODY_25E") return PoseModel::BODY_25E; - else if (poseModeString == "BODY_135") + else if (poseModeStdString == "BODY_135") return PoseModel::BODY_135; // Car pose - else if (poseModeString == "CAR_12") + else if (poseModeStdString == "CAR_12") return PoseModel::CAR_12; - else if (poseModeString == "CAR_22") + else if (poseModeStdString == "CAR_22") return PoseModel::CAR_22; // else - error("String (`" + poseModeString + "`) does not correspond to any model (BODY_25, COCO, MPI," + error("String (`" + poseModeStdString + "`) does not correspond to any model (BODY_25, COCO, MPI," " MPI_4_layers).", __LINE__, __FUNCTION__, __FILE__); return PoseModel::BODY_25; } @@ -150,30 +151,33 @@ namespace op } } - ProducerType flagsToProducerType(const std::string& imageDirectory, const std::string& videoPath, - const std::string& ipCameraPath, const int webcamIndex, - const bool flirCamera) + ProducerType flagsToProducerType( + const String& imageDirectory, const String& videoPath, const String& ipCameraPath, + const int webcamIndex, const bool flirCamera) { try { opLog("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); + const std::string& imageDirectoryStd = imageDirectory.getStdString(); + const std::string& videoPathStd = videoPath.getStdString(); + const std::string& ipCameraPathStd = ipCameraPath.getStdString(); // Avoid duplicates (e.g., selecting at the time camera & video) - if (int(!imageDirectory.empty()) + int(!videoPath.empty()) + int(webcamIndex > 0) - + int(flirCamera) + int(!ipCameraPath.empty()) > 1) + if (int(!imageDirectoryStd.empty()) + int(!videoPathStd.empty()) + int(webcamIndex > 0) + + int(flirCamera) + int(!ipCameraPathStd.empty()) > 1) error("Selected simultaneously" - " image directory (seletected: " + (imageDirectory.empty() ? "no" : imageDirectory) + ")," - " video (seletected: " + (videoPath.empty() ? "no" : videoPath) + ")," + " image directory (seletected: " + (imageDirectoryStd.empty() ? "no" : imageDirectoryStd) + ")," + " video (seletected: " + (videoPathStd.empty() ? "no" : videoPathStd) + ")," " camera (selected: " + (webcamIndex > 0 ? std::to_string(webcamIndex) : "no") + ")," " flirCamera (selected: " + (flirCamera ? "yes" : "no") + "," - " and/or IP camera (selected: " + (ipCameraPath.empty() ? "no" : ipCameraPath) + ")." + " and/or IP camera (selected: " + (ipCameraPathStd.empty() ? "no" : ipCameraPathStd) + ")." " Please, select only one.", __LINE__, __FUNCTION__, __FILE__); // Get desired ProducerType - if (!imageDirectory.empty()) + if (!imageDirectoryStd.empty()) return ProducerType::ImageDirectory; - else if (!videoPath.empty()) + else if (!videoPathStd.empty()) return ProducerType::Video; - else if (!ipCameraPath.empty()) + else if (!ipCameraPathStd.empty()) return ProducerType::IPCamera; else if (flirCamera) return ProducerType::FlirCamera; @@ -187,14 +191,15 @@ namespace op } } - std::pair flagsToProducer( - const std::string& imageDirectory, const std::string& videoPath, const std::string& ipCameraPath, + std::pair flagsToProducer( + const String& imageDirectory, const String& videoPath, const String& ipCameraPath, const int webcamIndex, const bool flirCamera, const int flirCameraIndex) { try { opLog("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); - const auto type = flagsToProducerType(imageDirectory, videoPath, ipCameraPath, webcamIndex, flirCamera); + const auto type = flagsToProducerType( + imageDirectory, videoPath, ipCameraPath, webcamIndex, flirCamera); if (type == ProducerType::ImageDirectory) return std::make_pair(ProducerType::ImageDirectory, imageDirectory); @@ -204,10 +209,10 @@ namespace op return std::make_pair(ProducerType::IPCamera, ipCameraPath); // Flir camera else if (type == ProducerType::FlirCamera) - return std::make_pair(ProducerType::FlirCamera, std::to_string(flirCameraIndex)); + return std::make_pair(ProducerType::FlirCamera, String(std::to_string(flirCameraIndex))); // Webcam else if (type == ProducerType::Webcam) - return std::make_pair(ProducerType::Webcam, std::to_string(webcamIndex)); + return std::make_pair(ProducerType::Webcam, String(std::to_string(webcamIndex))); // else error("Undefined Producer selected.", __LINE__, __FUNCTION__, __FILE__); return std::make_pair(ProducerType::None, ""); @@ -306,15 +311,17 @@ namespace op } } - Point flagsToPoint(const std::string& pointString, const std::string& pointExample) + Point flagsToPoint(const String& pointString, const String& pointExample) { try { + const std::string& pointStringStd = pointString.getStdString(); + const std::string& pointExampleStd = pointExample.getStdString(); Point point; - const auto nRead = sscanf(pointString.c_str(), "%dx%d", &point.x, &point.y); + const auto nRead = sscanf(pointStringStd.c_str(), "%dx%d", &point.x, &point.y); checkEqual( - nRead, 2, "Invalid resolution format: `" + pointString + "`, it should be e.g., `" + pointExample - + "`.", __LINE__, __FUNCTION__, __FILE__); + nRead, 2, "Invalid resolution format: `" + pointStringStd + "`, it should be e.g., `" + + pointExampleStd + "`.", __LINE__, __FUNCTION__, __FILE__); return point; } catch (const std::exception& e) diff --git a/src/openpose/wrapper/wrapperAuxiliary.cpp b/src/openpose/wrapper/wrapperAuxiliary.cpp index 4d001773..7857ff00 100644 --- a/src/openpose/wrapper/wrapperAuxiliary.cpp +++ b/src/openpose/wrapper/wrapperAuxiliary.cpp @@ -24,22 +24,23 @@ namespace op if (wrapperStructPose.scaleGap <= 0.f && wrapperStructPose.scalesNumber > 1) error("The scale gap must be greater than 0 (it has no effect if the number of scales is 1).", __LINE__, __FUNCTION__, __FILE__); - if (!renderOutput && (!wrapperStructOutput.writeImages.empty() || !wrapperStructOutput.writeVideo.empty())) + if (!renderOutput && (!wrapperStructOutput.writeImages.getStdString().empty() + || !wrapperStructOutput.writeVideo.getStdString().empty())) { const auto message = "In order to save the rendered frames (`--write_images` or `--write_video`), you" " cannot disable `--render_pose`."; opLog(message, Priority::High); } - if (!wrapperStructOutput.writeHeatMaps.empty() && wrapperStructPose.heatMapTypes.empty()) + if (!wrapperStructOutput.writeHeatMaps.getStdString().empty() && wrapperStructPose.heatMapTypes.empty()) { const auto message = "In order to save the heatmaps (`--write_heatmaps`), you need to pick which heat" " maps you want to save: `--heatmaps_add_X` flags or fill the" " wrapperStructPose.heatMapTypes."; error(message, __LINE__, __FUNCTION__, __FILE__); } - if (!wrapperStructOutput.writeHeatMaps.empty() + if (!wrapperStructOutput.writeHeatMaps.getStdString().empty() && (wrapperStructPose.heatMapScaleMode != ScaleMode::UnsignedChar && - wrapperStructOutput.writeHeatMapsFormat != "float")) + wrapperStructOutput.writeHeatMapsFormat.getStdString() != "float")) { const auto message = "In order to save the heatmaps, you must either set" " wrapperStructPose.heatMapScaleMode to ScaleMode::UnsignedChar (i.e., range" @@ -55,12 +56,12 @@ namespace op " own output worker class before calling this function." }; const auto savingSomething = ( - !wrapperStructOutput.writeImages.empty() || !wrapperStructOutput.writeVideo.empty() - || !wrapperStructOutput.writeKeypoint.empty() || !wrapperStructOutput.writeJson.empty() - || !wrapperStructOutput.writeCocoJson.empty() || !wrapperStructOutput.writeHeatMaps.empty() + !wrapperStructOutput.writeImages.getStdString().empty() || !wrapperStructOutput.writeVideo.getStdString().empty() + || !wrapperStructOutput.writeKeypoint.getStdString().empty() || !wrapperStructOutput.writeJson.getStdString().empty() + || !wrapperStructOutput.writeCocoJson.getStdString().empty() || !wrapperStructOutput.writeHeatMaps.getStdString().empty() ); const auto savingCvOutput = ( - !wrapperStructOutput.writeImages.empty() || !wrapperStructOutput.writeVideo.empty() + !wrapperStructOutput.writeImages.getStdString().empty() || !wrapperStructOutput.writeVideo.getStdString().empty() ); const bool guiEnabled = (wrapperStructGui.displayMode != DisplayMode::NoDisplay); if (!guiEnabled && !savingCvOutput && renderOutput) @@ -101,7 +102,7 @@ namespace op opLog(message, Priority::High); } } - if (!wrapperStructOutput.writeVideo.empty() && producerSharedPtr == nullptr) + if (!wrapperStructOutput.writeVideo.getStdString().empty() && producerSharedPtr == nullptr) error("Writting video (`--write_video`) is only available if the OpenPose producer is used (i.e." " producerSharedPtr cannot be a nullptr). Otherwise, OpenPose would not know the frame rate" " of that output video nor whether all the images maintain the same resolution. You might" diff --git a/src/openpose/wrapper/wrapperStructInput.cpp b/src/openpose/wrapper/wrapperStructInput.cpp index c1a3a9a4..f64b6341 100644 --- a/src/openpose/wrapper/wrapperStructInput.cpp +++ b/src/openpose/wrapper/wrapperStructInput.cpp @@ -3,10 +3,10 @@ namespace op { WrapperStructInput::WrapperStructInput( - const ProducerType producerType_, const std::string& producerString_, const unsigned long long frameFirst_, + const ProducerType producerType_, const String& producerString_, const unsigned long long frameFirst_, const unsigned long long frameStep_, const unsigned long long frameLast_, const bool realTimeProcessing_, const bool frameFlip_, const int frameRotate_, const bool framesRepeat_, const Point& cameraResolution_, - const std::string& cameraParameterPath_, const bool undistortImage_, const int numberViews_) : + const String& cameraParameterPath_, const bool undistortImage_, const int numberViews_) : producerType{producerType_}, producerString{producerString_}, frameFirst{frameFirst_}, diff --git a/src/openpose/wrapper/wrapperStructOutput.cpp b/src/openpose/wrapper/wrapperStructOutput.cpp index e7d5b0ae..6a54479f 100644 --- a/src/openpose/wrapper/wrapperStructOutput.cpp +++ b/src/openpose/wrapper/wrapperStructOutput.cpp @@ -3,13 +3,13 @@ namespace op { WrapperStructOutput::WrapperStructOutput( - const double verbose_, const std::string& writeKeypoint_, const DataFormat writeKeypointFormat_, - const std::string& writeJson_, const std::string& writeCocoJson_, const int writeCocoJsonVariants_, - const int writeCocoJsonVariant_, const std::string& writeImages_, const std::string& writeImagesFormat_, - const std::string& writeVideo_, const double writeVideoFps_, const bool writeVideoWithAudio_, - const std::string& writeHeatMaps_, const std::string& writeHeatMapsFormat_, const std::string& writeVideo3D_, - const std::string& writeVideoAdam_, const std::string& writeBvh_, const std::string& udpHost_, - const std::string& udpPort_) : + const double verbose_, const String& writeKeypoint_, const DataFormat writeKeypointFormat_, + const String& writeJson_, const String& writeCocoJson_, const int writeCocoJsonVariants_, + const int writeCocoJsonVariant_, const String& writeImages_, const String& writeImagesFormat_, + const String& writeVideo_, const double writeVideoFps_, const bool writeVideoWithAudio_, + const String& writeHeatMaps_, const String& writeHeatMapsFormat_, const String& writeVideo3D_, + const String& writeVideoAdam_, const String& writeBvh_, const String& udpHost_, + const String& udpPort_) : verbose{verbose_}, writeKeypoint{writeKeypoint_}, writeKeypointFormat{writeKeypointFormat_}, @@ -32,7 +32,7 @@ namespace op { try { - if (!writeBvh.empty()) + if (!writeBvh.getStdString().empty()) error("BVH writing is experimental and not available yet (flag `--write_bvh`). Please, disable this" " flag and do not open a GitHub issue asking for it.", __LINE__, __FUNCTION__, __FILE__); } diff --git a/src/openpose/wrapper/wrapperStructPose.cpp b/src/openpose/wrapper/wrapperStructPose.cpp index ce17326f..65f829fc 100644 --- a/src/openpose/wrapper/wrapperStructPose.cpp +++ b/src/openpose/wrapper/wrapperStructPose.cpp @@ -7,10 +7,10 @@ namespace op const ScaleMode keypointScaleMode_, const int gpuNumber_, const int gpuNumberStart_, const int scalesNumber_, const float scaleGap_, const RenderMode renderMode_, const PoseModel poseModel_, const bool blendOriginalFrame_, const float alphaKeypoint_, const float alphaHeatMap_, - const int defaultPartToRender_, const std::string& modelFolder_, const std::vector& heatMapTypes_, + const int defaultPartToRender_, const String& modelFolder_, const std::vector& heatMapTypes_, const ScaleMode heatMapScaleMode_, const bool addPartCandidates_, const float renderThreshold_, const int numberPeopleMax_, const bool maximizePositives_, const double fpsMax_, - const std::string& protoTxtPath_, const std::string& caffeModelPath_, const float upsamplingRatio_, + const String& protoTxtPath_, const String& caffeModelPath_, const float upsamplingRatio_, const bool enableGoogleLogging_) : poseMode{poseMode_}, netInputSize{netInputSize_},