mirror of
https://github.com/gosticks/openpose.git
synced 2026-08-17 23:00:22 +00:00
Added flag
This commit is contained in:
@@ -28,6 +28,8 @@ DEFINE_int32(logging_level, 3, "The logging level. Inte
|
||||
// Producer
|
||||
DEFINE_int32(camera, 0, "The camera index for cv::VideoCapture. Integer in the range [0, 9].");
|
||||
DEFINE_string(camera_resolution, "1280x720", "Size of the camera frames to ask for.");
|
||||
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_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"
|
||||
@@ -95,7 +97,7 @@ op::ProducerType gflagsToProducerType(const std::string& imageDirectory, const s
|
||||
}
|
||||
|
||||
std::shared_ptr<op::Producer> gflagsToProducer(const std::string& imageDirectory, const std::string& videoPath, const int webcamIndex,
|
||||
const op::Point<int> webcamResolution)
|
||||
const op::Point<int> webcamResolution, const int webcamFps)
|
||||
{
|
||||
op::log("", op::Priority::Low, __LINE__, __FUNCTION__, __FILE__);
|
||||
const auto type = gflagsToProducerType(imageDirectory, videoPath, webcamIndex);
|
||||
@@ -105,7 +107,7 @@ std::shared_ptr<op::Producer> gflagsToProducer(const std::string& imageDirectory
|
||||
else if (type == op::ProducerType::Video)
|
||||
return std::make_shared<op::VideoReader>(videoPath);
|
||||
else if (type == op::ProducerType::Webcam)
|
||||
return std::make_shared<op::WebcamReader>(webcamIndex, webcamResolution);
|
||||
return std::make_shared<op::WebcamReader>(webcamIndex, webcamResolution, webcamFps);
|
||||
else
|
||||
{
|
||||
op::error("Undefined Producer selected.", __LINE__, __FUNCTION__, __FILE__);
|
||||
@@ -129,7 +131,7 @@ std::tuple<op::Point<int>, op::Point<int>, std::shared_ptr<op::Producer>> gflags
|
||||
__LINE__, __FUNCTION__, __FILE__);
|
||||
|
||||
// producerType
|
||||
const auto producerSharedPtr = gflagsToProducer(FLAGS_image_dir, FLAGS_video, FLAGS_camera, cameraFrameSize);
|
||||
const auto producerSharedPtr = gflagsToProducer(FLAGS_image_dir, FLAGS_video, FLAGS_camera, cameraFrameSize, FLAGS_camera_fps);
|
||||
const auto displayProducerFpsMode = (FLAGS_process_real_time ? op::ProducerFpsMode::OriginalFps : op::ProducerFpsMode::RetrievalFps);
|
||||
producerSharedPtr->setProducerFpsMode(displayProducerFpsMode);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user