提交 8744f1a9 编写于 作者: G gineshidalgo99

Gui/FrameDisplayer: all visualization functions moved to same thread

上级 f4dd4739
......@@ -69,8 +69,9 @@ The pose estimation work is based on the C++ code from [the ECCV 2016 demo](http
3. [Output](#output)
1. [Output Format](#output-format)
2. [Reading Saved Results](#reading-saved-results)
4. [Send Us Your Feedback!](#send-us-your-feedback)
5. [Citation](#citation)
4. [OpenPose Benchmark](#openpose-benchmark)
5. [Send Us Your Feedback!](#send-us-your-feedback)
6. [Citation](#citation)
......@@ -202,8 +203,6 @@ Just comment on GibHub or make a pull request and we will answer as soon as poss
## Citation
Please cite the papers in your publications if it helps your research:
### Pose Estimation
@inproceedings{cao2017realtime,
author = {Zhe Cao and Tomas Simon and Shih-En Wei and Yaser Sheikh},
booktitle = {CVPR},
......
......@@ -21,6 +21,9 @@ namespace op
*/
FrameDisplayer(const cv::Size& windowedSize, const std::string& windowedName = "OpenPose Display", const bool fullScreen = false);
// Due to OpenCV visualization issues (all visualization functions must be in the same thread)
void initializationOnThread();
/**
* This function set the new FrameDisplayer::GuiDisplayMode (e.g. full screen).
* @param displayMode New FrameDisplayer::GuiDisplayMode state.
......
......@@ -18,6 +18,8 @@ namespace op
const std::shared_ptr<std::pair<std::atomic<bool>, std::atomic<int>>>& videoSeekSharedPtr = nullptr,
const std::vector<std::shared_ptr<PoseExtractor>>& poseExtractors = {}, const std::vector<std::shared_ptr<PoseRenderer>>& poseRenderers = {});
void initializationOnThread();
void update(const cv::Mat& cvOutputData = cv::Mat{});
private:
......
......@@ -41,6 +41,7 @@ namespace op
WGui<TDatums>::WGui(const std::shared_ptr<Gui>& gui) :
spGui{gui}
{
spGui->initializationOnThread();
}
template<typename TDatums>
......
......@@ -8,6 +8,10 @@ namespace op
mWindowedSize{windowedSize},
mWindowName{windowedName},
mGuiDisplayMode{(fullScreen ? GuiDisplayMode::FullScreen : GuiDisplayMode::Windowed)}
{
}
void FrameDisplayer::initializationOnThread()
{
try
{
......@@ -15,7 +19,8 @@ namespace op
const cv::Mat blackFrame{mWindowedSize.height, mWindowedSize.width, CV_32FC3, {0,0,0}};
FrameDisplayer::displayFrame(blackFrame);
cv::waitKey(100);
cv::waitKey(1); // This one will show most probably a white image (I guess the program does not have time to render in 1 msec)
// cv::waitKey(1000); // This one will show the desired black image
}
catch (const std::exception& e)
{
......
......@@ -160,6 +160,11 @@ namespace op
{
}
void Gui::initializationOnThread()
{
mFrameDisplayer.initializationOnThread();
}
void Gui::update(const cv::Mat& cvOutputData)
{
try
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册