提交 26ad9f73 编写于 作者: G gineshidalgo99

Fixed crash when no saving & empty keypoints

上级 7ec26cbd
...@@ -2,11 +2,11 @@ OpenPose ...@@ -2,11 +2,11 @@ OpenPose
==================================== ====================================
## Latest News ## Latest News
- Apr 2017: Body released! - Apr 2017: **Body** released!
- May 2017: Windows version released! - May 2017: **Windows** version released!
- Jun 2017: Face released! - Jun 2017: **Face** released!
- Jul 2017: Hands released! - Jul 2017: **Hands** released!
- Jul 2017: Windows: New non-installation-required [portable demo](doc/installation.md#installation---demo) and [easier library installation](doc/installation.md#installation---library)! - Jul 2017: **Windows**, New [**portable demo**](doc/installation.md#installation---demo) **and** [**easier library installation**](doc/installation.md#installation---library)!
- Check all the [release notes](doc/release_notes.md). - Check all the [release notes](doc/release_notes.md).
- Interested in an internship on CMU as OpenPose programmer? See [this link](https://docs.google.com/document/d/14SygG39NjIRZfx08clewTdFMGwVdtRu2acyCi3TYcHs/edit?usp=sharing) for details. - Interested in an internship on CMU as OpenPose programmer? See [this link](https://docs.google.com/document/d/14SygG39NjIRZfx08clewTdFMGwVdtRu2acyCi3TYcHs/edit?usp=sharing) for details.
......
...@@ -76,14 +76,16 @@ namespace op ...@@ -76,14 +76,16 @@ namespace op
{ {
try try
{ {
// Security checks
if (format == DataFormat::Json && CV_MAJOR_VERSION < 3) if (format == DataFormat::Json && CV_MAJOR_VERSION < 3)
error(errorMessage, __LINE__, __FUNCTION__, __FILE__); error(errorMessage, __LINE__, __FUNCTION__, __FILE__);
if (cvMats.size() != cvMatNames.size()) if (cvMats.size() != cvMatNames.size())
error("cvMats.size() != cvMatNames.size()", __LINE__, __FUNCTION__, __FILE__); error("cvMats.size() != cvMatNames.size()", __LINE__, __FUNCTION__, __FILE__);
// Save cv::Mat data
cv::FileStorage fileStorage{getFullName(fileNameNoExtension, format), cv::FileStorage::WRITE}; cv::FileStorage fileStorage{getFullName(fileNameNoExtension, format), cv::FileStorage::WRITE};
for (auto i = 0 ; i < cvMats.size() ; i++) for (auto i = 0 ; i < cvMats.size() ; i++)
fileStorage << cvMatNames[i] << cvMats[i]; fileStorage << cvMatNames[i] << (cvMats[i].empty() ? cv::Mat{} : cvMats[i]);
// Release file
fileStorage.release(); fileStorage.release();
} }
catch (const std::exception& e) catch (const std::exception& e)
......
...@@ -8,6 +8,8 @@ ...@@ -8,6 +8,8 @@
namespace op namespace op
{ {
const std::string OPEN_POSE_TEXT{"OpenPose 1.0.1"};
inline void showGuiHelp() inline void showGuiHelp()
{ {
try try
...@@ -17,7 +19,7 @@ namespace op ...@@ -17,7 +19,7 @@ namespace op
if (!helpCvMat.empty()) if (!helpCvMat.empty())
{ {
const auto fullScreen = false; const auto fullScreen = false;
FrameDisplayer frameDisplayer{Point<int>{helpCvMat.cols, helpCvMat.rows}, "OpenPose - GUI Help", fullScreen}; FrameDisplayer frameDisplayer{Point<int>{helpCvMat.cols, helpCvMat.rows}, OPEN_POSE_TEXT + " - GUI Help", fullScreen};
frameDisplayer.displayFrame(helpCvMat, 33); frameDisplayer.displayFrame(helpCvMat, 33);
} }
} }
...@@ -152,7 +154,7 @@ namespace op ...@@ -152,7 +154,7 @@ namespace op
Gui::Gui(const bool fullScreen, const Point<int>& outputSize, const std::shared_ptr<std::atomic<bool>>& isRunningSharedPtr, Gui::Gui(const bool fullScreen, const Point<int>& outputSize, const std::shared_ptr<std::atomic<bool>>& isRunningSharedPtr,
const std::shared_ptr<std::pair<std::atomic<bool>, std::atomic<int>>>& videoSeekSharedPtr, const std::shared_ptr<std::pair<std::atomic<bool>, std::atomic<int>>>& videoSeekSharedPtr,
const std::vector<std::shared_ptr<PoseExtractor>>& poseExtractors, const std::vector<std::shared_ptr<PoseRenderer>>& poseRenderers) : const std::vector<std::shared_ptr<PoseExtractor>>& poseExtractors, const std::vector<std::shared_ptr<PoseRenderer>>& poseRenderers) :
mFrameDisplayer{outputSize, "OpenPose - GUI", fullScreen}, mFrameDisplayer{outputSize, OPEN_POSE_TEXT, fullScreen},
mPoseExtractors{poseExtractors}, mPoseExtractors{poseExtractors},
mPoseRenderers{poseRenderers}, mPoseRenderers{poseRenderers},
spIsRunning{isRunningSharedPtr}, spIsRunning{isRunningSharedPtr},
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册