提交 f6ade54c 编写于 作者: G gineshidalgo99

Flag camera_fps defines write_video FPS

上级 fc9f605e
......@@ -137,7 +137,7 @@ Each flag is divided into flag name, default value, and description.
2. Producer
- DEFINE_int32(camera, -1, "The camera index for cv::VideoCapture. Integer in the range [0, 9]. Select a negative number (by default), to auto-detect and open the first available camera.");
- DEFINE_string(camera_resolution, "-1x-1", "Set the camera resolution (either `--camera` or `--flir_camera`). `-1x-1` will use the default 1280x720 for `--camera`, or the maximum flir camera resolution available for `--flir_camera`");
- DEFINE_double(camera_fps, 30.0, "Frame rate for the webcam (only used when saving video from webcam). Set this value to the minimum value between the OpenPose displayed speed and the webcam real frame rate.");
- DEFINE_double(camera_fps, 30.0, "Frame rate for the webcam/flir_camera (also used when saving video). Set this value to the minimum value between the OpenPose displayed speed and the webcam real frame rate.");
- DEFINE_string(video, "", "Use a video file instead of the camera. Use `examples/media/video.avi` for our default example video.");
- DEFINE_string(image_dir, "", "Process a directory of images. Use `examples/media/` for our default example folder with 20 images. Read all standard formats (jpg, png, bmp, etc.).");
- DEFINE_bool(flir_camera, false, "Whether to use FLIR (Point-Grey) stereo camera.");
......
......@@ -136,7 +136,7 @@ build\x64\Release\OpenPoseDemo.exe --flir_camera --3d --number_people_max 1 --fa
# Ubuntu (same flags for Windows version)
# Saving video
# Note: saving in PNG rather than JPG will improve image quality, but slow down FPS (depending on hard disk writing speed and camera number)
./build/examples/openpose/openpose.bin --flir_camera --num_gpu 0 --write_video output_folder_path/video.avi
./build/examples/openpose/openpose.bin --flir_camera --num_gpu 0 --write_video output_folder_path/video.avi --camera_fps 5
# Saving images
# Note: saving in PNG rather than JPG will improve image quality, but slow down FPS (depending on hard disk writing speed and camera number)
./build/examples/openpose/openpose.bin --flir_camera --num_gpu 0 --write_images output_folder_path/ --write_images_format jpg
......
......@@ -195,6 +195,7 @@ OpenPose Library - Release Notes
23. OpenPose small GUI shows the frame number w.r.t. the original producer, rather than the frame id. E.g., if video is started at frame 30, OpenPose will display 30 rather than 0 in the first frame.
24. OpenPose GUI: 'l' and 'k' functionality swapped.
25. 3-D reconstruction module: Added flag `--3d_min_views` to select minimum number of cameras required for 3-D reconstruction.
26. Flag `--camera_fps` also applies to recorded video (`--write_video`).
2. Functions or parameters renamed:
1. Flag `no_display` renamed as `display`, able to select between `NoDisplay`, `Display2D`, `Display3D`, and `DisplayAll`.
2. 3-D reconstruction demo is now inside the OpenPose demo binary.
......
......@@ -48,8 +48,9 @@ DEFINE_int32(camera, -1, "The camera index for cv
DEFINE_string(camera_resolution, "-1x-1", "Set the camera resolution (either `--camera` or `--flir_camera`). `-1x-1` will use the"
" default 1280x720 for `--camera`, or the maximum flir camera resolution available for"
" `--flir_camera`");
DEFINE_double(camera_fps, 30.0, "Frame rate for the webcam (only used when saving video from webcam). Set this value to the"
" minimum value between the OpenPose displayed speed and the webcam real frame rate.");
DEFINE_double(camera_fps, 30.0, "Frame rate for the webcam/flir_camera (also used when saving video). Set this"
" value to the minimum value between the OpenPose displayed speed and the webcam real"
" frame rate.");
DEFINE_string(video, "", "Use a video file instead of the camera. Use `examples/media/video.avi` for our default"
" example video.");
DEFINE_string(image_dir, "", "Process a directory of images. Use `examples/media/` for our default example folder with 20"
......@@ -301,7 +302,8 @@ int openPoseDemo()
op::stringToDataFormat(FLAGS_write_keypoint_format),
writeJson, FLAGS_write_coco_json,
FLAGS_write_images, FLAGS_write_images_format, FLAGS_write_video,
FLAGS_write_heatmaps, FLAGS_write_heatmaps_format};
FLAGS_camera_fps, FLAGS_write_heatmaps,
FLAGS_write_heatmaps_format};
// Configure wrapper
opWrapper.configure(wrapperStructPose, wrapperStructFace, wrapperStructHand, wrapperStructInput,
wrapperStructOutput);
......
......@@ -57,8 +57,9 @@ DEFINE_int32(camera, -1, "The camera index for cv
DEFINE_string(camera_resolution, "-1x-1", "Set the camera resolution (either `--camera` or `--flir_camera`). `-1x-1` will use the"
" default 1280x720 for `--camera`, or the maximum flir camera resolution available for"
" `--flir_camera`");
DEFINE_double(camera_fps, 30.0, "Frame rate for the webcam (only used when saving video from webcam). Set this value to the"
" minimum value between the OpenPose displayed speed and the webcam real frame rate.");
DEFINE_double(camera_fps, 30.0, "Frame rate for the webcam/flir_camera (also used when saving video). Set this"
" value to the minimum value between the OpenPose displayed speed and the webcam real"
" frame rate.");
DEFINE_string(video, "", "Use a video file instead of the camera. Use `examples/media/video.avi` for our default"
" example video.");
DEFINE_string(image_dir, "", "Process a directory of images. Use `examples/media/` for our default example folder with 20"
......@@ -302,7 +303,8 @@ int openPoseTutorialWrapper4()
op::stringToDataFormat(FLAGS_write_keypoint_format),
writeJson, FLAGS_write_coco_json,
FLAGS_write_images, FLAGS_write_images_format, FLAGS_write_video,
FLAGS_write_heatmaps, FLAGS_write_heatmaps_format};
FLAGS_camera_fps, FLAGS_write_heatmaps,
FLAGS_write_heatmaps_format};
// Custom post-processing
auto userPostProcessing = std::make_shared<op::UserPostProcessing>(/* Your class arguments here */);
......
......@@ -34,8 +34,9 @@ DEFINE_int32(camera, -1, "The camera index for cv
DEFINE_string(camera_resolution, "-1x-1", "Set the camera resolution (either `--camera` or `--flir_camera`). `-1x-1` will use the"
" default 1280x720 for `--camera`, or the maximum flir camera resolution available for"
" `--flir_camera`");
DEFINE_double(camera_fps, 30.0, "Frame rate for the webcam (only used when saving video from webcam). Set this value to the"
" minimum value between the OpenPose displayed speed and the webcam real frame rate.");
DEFINE_double(camera_fps, 30.0, "Frame rate for the webcam/flir_camera (also used when saving video). Set this"
" value to the minimum value between the OpenPose displayed speed and the webcam real"
" frame rate.");
DEFINE_string(video, "", "Use a video file instead of the camera. Use `examples/media/video.avi` for our default"
" example video.");
DEFINE_string(image_dir, "", "Process a directory of images. Use `examples/media/` for our default example folder with 20"
......
......@@ -35,8 +35,9 @@ DEFINE_int32(camera, -1, "The camera index for cv
DEFINE_string(camera_resolution, "-1x-1", "Set the camera resolution (either `--camera` or `--flir_camera`). `-1x-1` will use the"
" default 1280x720 for `--camera`, or the maximum flir camera resolution available for"
" `--flir_camera`");
DEFINE_double(camera_fps, 30.0, "Frame rate for the webcam (only used when saving video from webcam). Set this value to the"
" minimum value between the OpenPose displayed speed and the webcam real frame rate.");
DEFINE_double(camera_fps, 30.0, "Frame rate for the webcam/flir_camera (also used when saving video). Set this"
" value to the minimum value between the OpenPose displayed speed and the webcam real"
" frame rate.");
DEFINE_string(video, "", "Use a video file instead of the camera. Use `examples/media/video.avi` for our default"
" example video.");
DEFINE_string(image_dir, "", "Process a directory of images. Use `examples/media/` for our default example folder with 20"
......
......@@ -47,8 +47,9 @@ DEFINE_int32(camera, -1, "The camera index for cv
DEFINE_string(camera_resolution, "-1x-1", "Set the camera resolution (either `--camera` or `--flir_camera`). `-1x-1` will use the"
" default 1280x720 for `--camera`, or the maximum flir camera resolution available for"
" `--flir_camera`");
DEFINE_double(camera_fps, 30.0, "Frame rate for the webcam (only used when saving video from webcam). Set this value to the"
" minimum value between the OpenPose displayed speed and the webcam real frame rate.");
DEFINE_double(camera_fps, 30.0, "Frame rate for the webcam/flir_camera (also used when saving video). Set this"
" value to the minimum value between the OpenPose displayed speed and the webcam real"
" frame rate.");
DEFINE_string(video, "", "Use a video file instead of the camera. Use `examples/media/video.avi` for our default"
" example video.");
DEFINE_string(image_dir, "", "Process a directory of images. Use `examples/media/` for our default example folder with 20"
......@@ -379,7 +380,8 @@ int openPoseTutorialWrapper1()
op::stringToDataFormat(FLAGS_write_keypoint_format),
writeJson, FLAGS_write_coco_json,
FLAGS_write_images, FLAGS_write_images_format, FLAGS_write_video,
FLAGS_write_heatmaps, FLAGS_write_heatmaps_format};
FLAGS_camera_fps, FLAGS_write_heatmaps,
FLAGS_write_heatmaps_format};
// Configure wrapper
opWrapper.configure(wrapperStructPose, wrapperStructFace, wrapperStructHand, wrapperStructInput,
wrapperStructOutput);
......
......@@ -43,6 +43,9 @@ DEFINE_int32(profile_speed, 1000, "If PROFILER_ENABLED was
" runtime statistics at this frame number.");
// Producer
DEFINE_string(image_dir, "examples/media/", "Process a directory of images. Read all standard formats (jpg, png, bmp, etc.).");
DEFINE_double(camera_fps, 30.0, "Frame rate for the webcam/flir_camera (also used when saving video). Set this"
" value to the minimum value between the OpenPose displayed speed and the webcam real"
" frame rate.");
// OpenPose
DEFINE_string(model_folder, "models/", "Folder path (absolute or relative) where the models (pose, face, ...) are located.");
DEFINE_string(output_resolution, "-1x-1", "The image resolution (display and output). Use \"-1x-1\" to force the program to use the"
......@@ -465,7 +468,8 @@ int openPoseTutorialWrapper2()
op::stringToDataFormat(FLAGS_write_keypoint_format),
writeJson, FLAGS_write_coco_json,
FLAGS_write_images, FLAGS_write_images_format, FLAGS_write_video,
FLAGS_write_heatmaps, FLAGS_write_heatmaps_format};
FLAGS_camera_fps, FLAGS_write_heatmaps,
FLAGS_write_heatmaps_format};
// Configure wrapper
opWrapper.configure(wrapperStructPose, wrapperStructFace, wrapperStructHand, op::WrapperStructInput{},
wrapperStructOutput);
......
......@@ -43,6 +43,9 @@ DEFINE_int32(profile_speed, 1000, "If PROFILER_ENABLED was
" runtime statistics at this frame number.");
// Producer
DEFINE_string(image_dir, "examples/media/", "Process a directory of images. Read all standard formats (jpg, png, bmp, etc.).");
DEFINE_double(camera_fps, 30.0, "Frame rate for the webcam/flir_camera (also used when saving video). Set this"
" value to the minimum value between the OpenPose displayed speed and the webcam real"
" frame rate.");
// OpenPose
DEFINE_string(model_folder, "models/", "Folder path (absolute or relative) where the models (pose, face, ...) are located.");
DEFINE_string(output_resolution, "-1x-1", "The image resolution (display and output). Use \"-1x-1\" to force the program to use the"
......@@ -406,7 +409,8 @@ int openPoseTutorialWrapper3()
op::stringToDataFormat(FLAGS_write_keypoint_format),
writeJson, FLAGS_write_coco_json,
FLAGS_write_images, FLAGS_write_images_format, FLAGS_write_video,
FLAGS_write_heatmaps, FLAGS_write_heatmaps_format};
FLAGS_camera_fps, FLAGS_write_heatmaps,
FLAGS_write_heatmaps_format};
// Configure wrapper
op::log("Configuring OpenPose wrapper.", op::Priority::Low, __LINE__, __FUNCTION__, __FILE__);
opWrapper.configure(wrapperStructPose, wrapperStructFace, wrapperStructHand, op::WrapperStructInput{},
......
......@@ -867,8 +867,9 @@ namespace op
if (finalOutputSize.x <= 0 || finalOutputSize.y <= 0)
error("Video can only be recorded if outputSize is fixed (e.g. video, webcam, IP camera),"
"but not for a image directory.", __LINE__, __FUNCTION__, __FILE__);
const auto originalVideoFps = (wrapperStructInput.producerSharedPtr->get(CV_CAP_PROP_FPS) > 0.
? wrapperStructInput.producerSharedPtr->get(CV_CAP_PROP_FPS) : 30.);
const auto originalVideoFps = (wrapperStructOutput.writeVideoFps > 0 ?
wrapperStructOutput.writeVideoFps
: wrapperStructInput.producerSharedPtr->get(CV_CAP_PROP_FPS));
const auto videoSaver = std::make_shared<VideoSaver>(
wrapperStructOutput.writeVideo, CV_FOURCC('M','J','P','G'), originalVideoFps, finalOutputSize
);
......
......@@ -20,14 +20,14 @@ namespace op
* @param userOutputWsEmpty
* @param threadManagerMode
*/
OP_API void wrapperConfigureSecurityChecks(const WrapperStructPose& wrapperStructPose,
const WrapperStructFace& wrapperStructFace,
const WrapperStructHand& wrapperStructHand,
const WrapperStructInput& wrapperStructInput,
const WrapperStructOutput& wrapperStructOutput,
const bool renderOutput,
const bool userOutputWsEmpty,
const ThreadManagerMode threadManagerMode);
OP_API void wrapperConfigureSecurityChecks(const WrapperStructPose& wrapperStructPose,
const WrapperStructFace& wrapperStructFace,
const WrapperStructHand& wrapperStructHand,
const WrapperStructInput& wrapperStructInput,
const WrapperStructOutput& wrapperStructOutput,
const bool renderOutput,
const bool userOutputWsEmpty,
const ThreadManagerMode threadManagerMode);
}
#endif // OPENPOSE_WRAPPER_WRAPPER_AUXILIARY_HPP
......@@ -100,6 +100,11 @@ namespace op
*/
std::string writeHeatMapsFormat;
/**
* Frame rate of the recorded video.
*/
double writeVideoFps;
/**
* Constructor of the struct.
* It has the recommended and default values we recommend for each element of the struct.
......@@ -110,8 +115,8 @@ namespace op
const DataFormat writeKeypointFormat = DataFormat::Xml,
const std::string& writeJson = "", const std::string& writeCocoJson = "",
const std::string& writeImages = "", const std::string& writeImagesFormat = "",
const std::string& writeVideo = "", const std::string& writeHeatMaps = "",
const std::string& writeHeatMapsFormat = "");
const std::string& writeVideo = "", const double writeVideoFps = 30.,
const std::string& writeHeatMaps = "", const std::string& writeHeatMapsFormat = "");
};
}
......
......@@ -28,9 +28,9 @@ namespace op
{
// Security checks
if (cvSize.x <= 0 || cvSize.y <= 0)
error("Desired frame size to save frames is <= 0.", __LINE__, __FUNCTION__, __FILE__);
error("Desired frame size to save the video is <= 0.", __LINE__, __FUNCTION__, __FILE__);
if (fps <= 0.)
error("Desired fps to save frames is <= 0.", __LINE__, __FUNCTION__, __FILE__);
error("Desired fps (frame rate) to save the video is <= 0.", __LINE__, __FUNCTION__, __FILE__);
// Open video-writter
mVideoWriter = openVideo(mVideoSaverPath, mCvFourcc, mFps, mCvSize, mNumberImages);
// Check it was successfully opened
......
......@@ -123,6 +123,9 @@ namespace op
+ std::to_string(wrapperStructPose.outputSize.x) + "x"
+ std::to_string(wrapperStructPose.outputSize.y) + ").",
__LINE__, __FUNCTION__, __FILE__);
if (wrapperStructOutput.writeVideoFps <= 0 && wrapperStructInput.producerSharedPtr->get(CV_CAP_PROP_FPS) > 0)
error("Set `--camera_fps` for this producer, as its frame rate is unknown.",
__LINE__, __FUNCTION__, __FILE__);
// Net input resolution cannot be reshaped for Caffe OpenCL and MKL versions, only for CUDA version
#if defined USE_MKL || defined CPU_ONLY
// If image_dir and netInputSize == -1 --> error
......
......@@ -7,7 +7,7 @@ namespace op
const DataFormat writeKeypointFormat_, const std::string& writeJson_,
const std::string& writeCocoJson_, const std::string& writeImages_,
const std::string& writeImagesFormat_, const std::string& writeVideo_,
const std::string& writeHeatMaps_,
const double writeVideoFps_, const std::string& writeHeatMaps_,
const std::string& writeHeatMapsFormat_) :
displayMode{displayMode_},
guiVerbose{guiVerbose_},
......@@ -20,7 +20,8 @@ namespace op
writeImagesFormat{writeImagesFormat_},
writeVideo{writeVideo_},
writeHeatMaps{writeHeatMaps_},
writeHeatMapsFormat{writeHeatMapsFormat_}
writeHeatMapsFormat{writeHeatMapsFormat_},
writeVideoFps{writeVideoFps_}
{
}
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册