OpenPose 1.0.0rc2 OpenPose: A Real-Time Multi-Person Key-Point Detection And Multi-Threading C++ Library

- Main Page
- Namespaces
- Classes
- Files

- File List
- File Members

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends 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
6 #include <openpose/core/common.hpp>
7 #include <openpose/filestream/enumClasses.hpp>
8
9 namespace op
10 {
11 OP_API std::string dataFormatToString(const DataFormat dataFormat);
12
13 OP_API DataFormat stringToDataFormat(const std::string& dataFormat);
14
15 // Save custom float format
16 // Example to read it in Python, assuming a (18 x 300 x 500) size Array
17 // x = np.fromfile(heatMapFullPath, dtype=np.float32)
18 // assert x[0] == 3 # First parameter saves the number of dimensions (18x300x500 = 3 dimensions)
19 // shape_x = x[1:1+int(x[0])]
20 // assert len(shape_x[0]) == 3 # Number of dimensions
21 // assert shape_x[0] == 18 # Size of the first dimension
22 // assert shape_x[1] == 300 # Size of the second dimension
23 // assert shape_x[2] == 500 # Size of the third dimension
24 // arrayData = x[1+int(round(x[0])):]
25 OP_API void saveFloatArray(const Array<float>& array, const std::string& fullFilePath);
26
27 // Save/load json, xml, yaml, yml
28 OP_API void saveData(const std::vector<cv::Mat>& cvMats, const std::vector<std::string>& cvMatNames,
29 const std::string& fileNameNoExtension, const DataFormat dataFormat);
30
31 OP_API void saveData(const cv::Mat& cvMat, const std::string cvMatName, const std::string& fileNameNoExtension,
32 const DataFormat dataFormat);
33
34 OP_API std::vector<cv::Mat> loadData(const std::vector<std::string>& cvMatNames,
35 const std::string& fileNameNoExtension, const DataFormat dataFormat);
36
37 OP_API cv::Mat loadData(const std::string& cvMatName, const std::string& fileNameNoExtension,
38 const DataFormat dataFormat);
39
40 // Json - Saving as *.json not available in OpenCV verions < 3.0, this function is a quick fix
41 OP_API void savePeopleJson(const Array<float>& keypoints,
42 const std::vector<std::vector<std::array<float,3>>>& candidates,
43 const std::string& keypointName, const std::string& fileName,
44 const bool humanReadable);
45
46 // It will save a bunch of Array<float> elements
47 OP_API void savePeopleJson(const std::vector<std::pair<Array<float>, std::string>>& keypointVector,
48 const std::vector<std::vector<std::array<float,3>>>& candidates,
49 const std::string& fileName, const bool humanReadable);
50
51 // Save/load image
52 OP_API void saveImage(const cv::Mat& cvMat, const std::string& fullFilePath,
53 const std::vector<int>& openCvCompressionParams
54 = {CV_IMWRITE_JPEG_QUALITY, 100, CV_IMWRITE_PNG_COMPRESSION, 9});
55
56 OP_API cv::Mat loadImage(const std::string& fullFilePath, const int openCvFlags = CV_LOAD_IMAGE_ANYDEPTH);
57
58 OP_API std::vector<std::array<Rectangle<float>, 2>> loadHandDetectorTxt(const std::string& txtFilePath);
59 }
60
61 #endif // OPENPOSE_FILESTREAM_FILE_STREAM_HPP
op::savePeopleJson
OP_API void savePeopleJson(const Array< float > &keypoints, const std::vector< std::vector< std::array< float, 3 >>> &candidates, const std::string &keypointName, const std::string &fileName, const bool humanReadable)
op::saveData
OP_API void saveData(const std::vector< cv::Mat > &cvMats, const std::vector< std::string > &cvMatNames, const std::string &fileNameNoExtension, const DataFormat dataFormat)
op::stringToDataFormat
OP_API DataFormat stringToDataFormat(const std::string &dataFormat)
cl::array
std::array< T, N > array
Definition: cl2.hpp:594
op::saveFloatArray
OP_API void saveFloatArray(const Array< float > &array, const std::string &fullFilePath)
op::DataFormat
DataFormat
Definition: enumClasses.hpp:6
common.hpp
op::loadImage
OP_API cv::Mat loadImage(const std::string &fullFilePath, const int openCvFlags=CV_LOAD_IMAGE_ANYDEPTH)
op::saveImage
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::dataFormatToString
OP_API std::string dataFormatToString(const DataFormat dataFormat)
op::loadData
OP_API std::vector< cv::Mat > loadData(const std::vector< std::string > &cvMatNames, const std::string &fileNameNoExtension, const DataFormat dataFormat)
enumClasses.hpp
op::loadHandDetectorTxt
OP_API std::vector< std::array< Rectangle< float >, 2 > > loadHandDetectorTxt(const std::string &txtFilePath)
cl::vector
std::vector< T, Alloc > vector
Definition: cl2.hpp:567
OP_API
#define OP_API
Definition: macros.hpp:19
cl::string
std::string string
Definition: cl2.hpp:574