提交 b2084505 编写于 作者: G gineshidalgo99

Fixed faked pause

上级 28f605c8
......@@ -189,6 +189,7 @@ OpenPose Library - Release Notes
17. Flag `--write_json` includes 3-D keypoints.
18. Flag `--image_dir_stereo` added to allow `--image_dir` to load stereo images.
19. Flag `--camera_resolution` applicable to `--flir_camera`.
20. Throw error message if requested GPU IDs does not exist (e.g. asking for 2 GPUs starting in ID 1 if there is only 2 GPUs in total).
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.
......@@ -198,6 +199,7 @@ OpenPose Library - Release Notes
1. Slight speed up (~1%) for performing the non-maximum suppression stage only in the body part heatmaps channels, and not also in the PAF channels.
2. Fixed core-dumped in PoseRenderer with GUI when changed element to be rendered to something else than skeleton.
3. 3-D visualizer does not crash on exit anymore.
4. Fake pause ('m' key pressed) works again.
......
......@@ -89,13 +89,12 @@ namespace op
if (spVideoSeek != nullptr)
{
// Fake pause vs. normal mode
const auto increment = spVideoSeek->second + (spVideoSeek->first ? 1 : 0);
const auto increment = spVideoSeek->second - (spVideoSeek->first ? 1 : 0);
// Normal mode
if (increment != 0)
{
spProducer->set(CV_CAP_PROP_POS_FRAMES, spProducer->get(CV_CAP_PROP_POS_FRAMES) + increment);
spVideoSeek->second = 0;
}
// It must be always reset or bug in fake pause
spVideoSeek->second = 0;
}
auto nextFrameName = spProducer->getNextFrameName();
auto cvMats = spProducer->getFrames();
......
......@@ -31,7 +31,7 @@ namespace op
std::vector<std::shared_ptr<PoseExtractor>>& poseExtractors,
std::vector<std::shared_ptr<Renderer>>& renderers,
std::shared_ptr<std::atomic<bool>>& isRunningSharedPtr,
std::shared_ptr<std::pair<std::atomic<bool>, std::atomic<int>>>& spVideoSeek)
std::shared_ptr<std::pair<std::atomic<bool>, std::atomic<int>>>& videoSeekSharedPtr)
{
try
{
......@@ -63,20 +63,20 @@ namespace op
// Fake pause
else if (castedKey=='m')
{
if (spVideoSeek != nullptr)
spVideoSeek->first = !spVideoSeek->first;
if (videoSeekSharedPtr != nullptr)
videoSeekSharedPtr->first = !videoSeekSharedPtr->first;
}
// Seeking in video
else if (castedKey=='l' || castedKey=='k')
{
if (spVideoSeek != nullptr)
if (videoSeekSharedPtr != nullptr)
{
// Normal case, +-30 frames
if (!spVideoSeek->first)
spVideoSeek->second += 30 * (castedKey=='l' ? -2 : 1);
if (!videoSeekSharedPtr->first)
videoSeekSharedPtr->second += 30 * (castedKey=='l' ? -2 : 1);
// Frame by frame (if forced paused)
else
spVideoSeek->second += (castedKey=='l' ? -1 : 1);
videoSeekSharedPtr->second += (castedKey=='l' ? -1 : 1);
}
}
// Enable/disable blending
......@@ -136,17 +136,17 @@ namespace op
void handleUserInput(FrameDisplayer& frameDisplayer, std::vector<std::shared_ptr<PoseExtractor>>& poseExtractors,
std::vector<std::shared_ptr<Renderer>>& renderers,
std::shared_ptr<std::atomic<bool>>& isRunningSharedPtr,
std::shared_ptr<std::pair<std::atomic<bool>, std::atomic<int>>>& spVideoSeek)
std::shared_ptr<std::pair<std::atomic<bool>, std::atomic<int>>>& videoSeekSharedPtr)
{
try
{
// The handleUserInput must be always performed, even if no tDatum is detected
bool guiPaused = false;
handleWaitKey(guiPaused, frameDisplayer, poseExtractors, renderers, isRunningSharedPtr, spVideoSeek);
handleWaitKey(guiPaused, frameDisplayer, poseExtractors, renderers, isRunningSharedPtr, videoSeekSharedPtr);
while (guiPaused)
{
std::this_thread::sleep_for(std::chrono::milliseconds{1});
handleWaitKey(guiPaused, frameDisplayer, poseExtractors, renderers, isRunningSharedPtr, spVideoSeek);
handleWaitKey(guiPaused, frameDisplayer, poseExtractors, renderers, isRunningSharedPtr, videoSeekSharedPtr);
}
}
catch (const std::exception& e)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册