mirror of
https://github.com/opencv/opencv.git
synced 2025-01-18 14:13:15 +08:00
change the parameter to CvMat
and CvMatND
```cpp cvWriteMat_Base64(::cv::FileStorage & fs, ::cv::String const & name, ::cv::Mat const & mat) ``` becomes: ```cpp CV_EXPORTS void cvWriteMat_Base64(::CvFileStorage* fs, const char* name, const ::CvMat* mat); CV_EXPORTS void cvWriteMatND_Base64(::CvFileStorage* fs, const char* name, const ::CvMatND* mat); ```
This commit is contained in:
parent
9faa2a7fd0
commit
29921d055d
@ -89,6 +89,8 @@ the extension of the opened file, ".xml" for XML files and ".yml" or ".yaml" for
|
|||||||
*/
|
*/
|
||||||
typedef struct CvFileStorage CvFileStorage;
|
typedef struct CvFileStorage CvFileStorage;
|
||||||
typedef struct CvFileNode CvFileNode;
|
typedef struct CvFileNode CvFileNode;
|
||||||
|
typedef struct CvMat CvMat;
|
||||||
|
typedef struct CvMatND CvMatND;
|
||||||
|
|
||||||
//! @} core_c
|
//! @} core_c
|
||||||
|
|
||||||
@ -1239,9 +1241,11 @@ inline String::String(const FileNode& fn): cstr_(0), len_(0) { read(fn, *this, *
|
|||||||
//! @endcond
|
//! @endcond
|
||||||
|
|
||||||
|
|
||||||
CV_EXPORTS void cvWriteRawData_Base64(::cv::FileStorage & fs, const void* _data, int len, const char* dt);
|
CV_EXPORTS void cvWriteRawData_Base64(FileStorage & fs, const void* _data, int len, const char* dt);
|
||||||
|
|
||||||
CV_EXPORTS void cvWriteMat_Base64(::cv::FileStorage & fs, ::cv::String const & name, ::cv::Mat const & mat);
|
CV_EXPORTS void cvWriteMat_Base64(::CvFileStorage* fs, const char* name, const ::CvMat* mat);
|
||||||
|
|
||||||
|
CV_EXPORTS void cvWriteMatND_Base64(::CvFileStorage* fs, const char* name, const ::CvMatND* mat);
|
||||||
|
|
||||||
} // cv
|
} // cv
|
||||||
|
|
||||||
|
@ -320,7 +320,7 @@ namespace base64
|
|||||||
/* sample */
|
/* sample */
|
||||||
|
|
||||||
void cvWriteRawData_Base64(::cv::FileStorage & fs, const void* _data, int len, const char* dt);
|
void cvWriteRawData_Base64(::cv::FileStorage & fs, const void* _data, int len, const char* dt);
|
||||||
void cvWriteMat_Base64(::cv::FileStorage & fs, ::cv::String const & name, ::cv::Mat const & mat);
|
void cvWriteMat_Base64(CvFileStorage * fs, const char * name, ::cv::Mat const & mat);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -6960,7 +6960,7 @@ void base64::cvWriteRawData_Base64(cv::FileStorage & fs, const void* _data, int
|
|||||||
cvEndWriteStruct(*fs);
|
cvEndWriteStruct(*fs);
|
||||||
}
|
}
|
||||||
|
|
||||||
void base64::cvWriteMat_Base64(cv::FileStorage & fs, cv::String const & name, cv::Mat const & mat)
|
void base64::cvWriteMat_Base64(CvFileStorage * fs, const char * name, cv::Mat const & mat)
|
||||||
{
|
{
|
||||||
char dt[4];
|
char dt[4];
|
||||||
::icvEncodeFormat(CV_MAT_TYPE(mat.type()), dt);
|
::icvEncodeFormat(CV_MAT_TYPE(mat.type()), dt);
|
||||||
@ -6968,23 +6968,23 @@ void base64::cvWriteMat_Base64(cv::FileStorage & fs, cv::String const & name, cv
|
|||||||
{ /* [1]output other attr */
|
{ /* [1]output other attr */
|
||||||
|
|
||||||
if (mat.dims <= 2) {
|
if (mat.dims <= 2) {
|
||||||
cvStartWriteStruct(*fs, name.c_str(), CV_NODE_MAP, CV_TYPE_NAME_MAT);
|
cvStartWriteStruct(fs, name, CV_NODE_MAP, CV_TYPE_NAME_MAT);
|
||||||
|
|
||||||
cvWriteInt(*fs, "rows", mat.rows );
|
cvWriteInt(fs, "rows", mat.rows );
|
||||||
cvWriteInt(*fs, "cols", mat.cols );
|
cvWriteInt(fs, "cols", mat.cols );
|
||||||
} else {
|
} else {
|
||||||
cvStartWriteStruct(*fs, name.c_str(), CV_NODE_MAP, CV_TYPE_NAME_MATND);
|
cvStartWriteStruct(fs, name, CV_NODE_MAP, CV_TYPE_NAME_MATND);
|
||||||
|
|
||||||
cvStartWriteStruct(*fs, "sizes", CV_NODE_SEQ | CV_NODE_FLOW);
|
cvStartWriteStruct(fs, "sizes", CV_NODE_SEQ | CV_NODE_FLOW);
|
||||||
cvWriteRawData(*fs, mat.size.p, mat.dims, "i");
|
cvWriteRawData(fs, mat.size.p, mat.dims, "i");
|
||||||
cvEndWriteStruct(*fs);
|
cvEndWriteStruct(fs);
|
||||||
}
|
}
|
||||||
cvWriteString(*fs, "dt", ::icvEncodeFormat(CV_MAT_TYPE(mat.type()), dt ), 0 );
|
cvWriteString(fs, "dt", ::icvEncodeFormat(CV_MAT_TYPE(mat.type()), dt ), 0 );
|
||||||
}
|
}
|
||||||
|
|
||||||
cvStartWriteStruct(*fs, "data", CV_NODE_SEQ, "binary");
|
cvStartWriteStruct(fs, "data", CV_NODE_SEQ, "binary");
|
||||||
{ /* [2]deal with matrix's data */
|
{ /* [2]deal with matrix's data */
|
||||||
Base64ContextEmitter emitter(*fs);
|
Base64ContextEmitter emitter(fs);
|
||||||
|
|
||||||
{ /* [2][1]define base64 header */
|
{ /* [2][1]define base64 header */
|
||||||
/* total byte size */
|
/* total byte size */
|
||||||
@ -7002,10 +7002,10 @@ void base64::cvWriteMat_Base64(cv::FileStorage & fs, cv::String const & name, cv
|
|||||||
emitter.write(convertor);
|
emitter.write(convertor);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
cvEndWriteStruct(*fs);
|
cvEndWriteStruct(fs);
|
||||||
|
|
||||||
{ /* [3]output end */
|
{ /* [3]output end */
|
||||||
cvEndWriteStruct(*fs);
|
cvEndWriteStruct(fs);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -7020,9 +7020,16 @@ namespace cv
|
|||||||
::base64::cvWriteRawData_Base64(fs, _data, len, dt);
|
::base64::cvWriteRawData_Base64(fs, _data, len, dt);
|
||||||
}
|
}
|
||||||
|
|
||||||
void cvWriteMat_Base64(::cv::FileStorage & fs, ::cv::String const & name, ::cv::Mat const & mat)
|
void cvWriteMat_Base64(::CvFileStorage* fs, const char* name, const ::CvMat* mat)
|
||||||
{
|
{
|
||||||
::base64::cvWriteMat_Base64(fs, name, mat);
|
::cv::Mat holder = ::cv::cvarrToMat(mat);
|
||||||
|
::base64::cvWriteMat_Base64(fs, name, holder);
|
||||||
|
}
|
||||||
|
|
||||||
|
void cvWriteMatND_Base64(::CvFileStorage* fs, const char* name, const ::CvMatND* mat)
|
||||||
|
{
|
||||||
|
::cv::Mat holder = ::cv::cvarrToMat(mat);
|
||||||
|
::base64::cvWriteMat_Base64(fs, name, holder);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -610,9 +610,12 @@ TEST(Core_InputOutput, filestorage_yml_base64)
|
|||||||
|
|
||||||
{ /* write */
|
{ /* write */
|
||||||
cv::FileStorage fs("test.yml", cv::FileStorage::WRITE);
|
cv::FileStorage fs("test.yml", cv::FileStorage::WRITE);
|
||||||
cv::cvWriteMat_Base64(fs, "normal_2d_mat", _2d_out);
|
CvMat holder = _2d_out;
|
||||||
cv::cvWriteMat_Base64(fs, "normal_nd_mat", _nd_out);
|
cv::cvWriteMat_Base64(*fs, "normal_2d_mat", &holder);
|
||||||
cv::cvWriteMat_Base64(fs, "empty_2d_mat", _em_out);
|
CvMatND holder_nd = _nd_out;
|
||||||
|
cv::cvWriteMatND_Base64(*fs, "normal_nd_mat", &holder_nd);
|
||||||
|
holder = _em_out;
|
||||||
|
cv::cvWriteMat_Base64(*fs, "empty_2d_mat", &holder);
|
||||||
fs.release();
|
fs.release();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -672,9 +675,12 @@ TEST(Core_InputOutput, filestorage_xml_base64)
|
|||||||
|
|
||||||
{ /* write */
|
{ /* write */
|
||||||
cv::FileStorage fs("test.xml", cv::FileStorage::WRITE);
|
cv::FileStorage fs("test.xml", cv::FileStorage::WRITE);
|
||||||
cv::cvWriteMat_Base64(fs, "normal_2d_mat", _2d_out);
|
CvMat holder = _2d_out;
|
||||||
cv::cvWriteMat_Base64(fs, "normal_nd_mat", _nd_out);
|
cv::cvWriteMat_Base64(*fs, "normal_2d_mat", &holder);
|
||||||
cv::cvWriteMat_Base64(fs, "empty_2d_mat", _em_out);
|
CvMatND holder_nd = _nd_out;
|
||||||
|
cv::cvWriteMatND_Base64(*fs, "normal_nd_mat", &holder_nd);
|
||||||
|
holder = _em_out;
|
||||||
|
cv::cvWriteMat_Base64(*fs, "empty_2d_mat", &holder);
|
||||||
fs.release();
|
fs.release();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user