OpenPose  1.0.0rc2
OpenPose: A Real-Time Multi-Person Key-Point Detection And Multi-Threading C++ Library
 All Classes Namespaces Files Functions Variables Enumerations Enumerator Macros
fileStream.hpp
Go to the documentation of this file.
1 #ifndef OPENPOSE_FILESTREAM_FILE_STREAM_HPP
2 #define OPENPOSE_FILESTREAM_FILE_STREAM_HPP
3 
4 #include <opencv2/core/core.hpp> // cv::Mat
5 #include <opencv2/highgui/highgui.hpp> // CV_LOAD_IMAGE_ANYDEPTH, CV_IMWRITE_PNG_COMPRESSION
8 
9 namespace op
10 {
11  OP_API DataFormat stringToDataFormat(const std::string& dataFormat);
12 
13  // Save/load json, xml, yaml, yml
14  OP_API void saveData(const std::vector<cv::Mat>& cvMats, const std::vector<std::string>& cvMatNames, const std::string& fileNameNoExtension, const DataFormat format);
15 
16  OP_API void saveData(const cv::Mat& cvMat, const std::string cvMatName, const std::string& fileNameNoExtension, const DataFormat format);
17 
18  OP_API std::vector<cv::Mat> loadData(const std::vector<std::string>& cvMatNames, const std::string& fileNameNoExtension, const DataFormat format);
19 
20  OP_API cv::Mat loadData(const std::string& cvMatName, const std::string& fileNameNoExtension, const DataFormat format);
21 
22  // Json - Saving as *.json not available in OpenCV verions < 3.0, this function is a quick fix
23  OP_API void saveKeypointsJson(const Array<float>& keypoints, const std::string& keypointName, const std::string& fileName, const bool humanReadable);
24 
25  // It will save a bunch of Array<float> elements
26  OP_API void saveKeypointsJson(const std::vector<std::pair<Array<float>, std::string>>& keypointVector, const std::string& fileName, const bool humanReadable);
27 
28  // Save/load image
29  OP_API void saveImage(const cv::Mat& cvMat, const std::string& fullFilePath, const std::vector<int>& openCvCompressionParams = {CV_IMWRITE_JPEG_QUALITY, 100, CV_IMWRITE_PNG_COMPRESSION, 9});
30 
31  OP_API cv::Mat loadImage(const std::string& fullFilePath, const int openCvFlags = CV_LOAD_IMAGE_ANYDEPTH);
32 
33  OP_API std::vector<std::array<Rectangle<float>, 2>> loadHandDetectorTxt(const std::string& txtFilePath);
34 }
35 
36 #endif // OPENPOSE_FILESTREAM_FILE_STREAM_HPP
OP_API DataFormat stringToDataFormat(const std::string &dataFormat)
DataFormat
Definition: enumClasses.hpp:6
OP_API void saveKeypointsJson(const Array< float > &keypoints, const std::string &keypointName, const std::string &fileName, const bool humanReadable)
OP_API void saveData(const std::vector< cv::Mat > &cvMats, const std::vector< std::string > &cvMatNames, const std::string &fileNameNoExtension, const DataFormat format)
OP_API cv::Mat loadImage(const std::string &fullFilePath, const int openCvFlags=CV_LOAD_IMAGE_ANYDEPTH)
OP_API void saveImage(const cv::Mat &cvMat, const std::string &fullFilePath, const std::vector< int > &openCvCompressionParams={CV_IMWRITE_JPEG_QUALITY, 100, CV_IMWRITE_PNG_COMPRESSION, 9})
OP_API std::vector< std::array< Rectangle< float >, 2 > > loadHandDetectorTxt(const std::string &txtFilePath)
OP_API std::vector< cv::Mat > loadData(const std::vector< std::string > &cvMatNames, const std::string &fileNameNoExtension, const DataFormat format)
#define OP_API
Definition: macros.hpp:5