简体   繁体   English

cv :: Mat或CvMat中的大数据*

[英]Large data in a cv::Mat or a CvMat*

Is CV_64F largest dimension/size of a single unit of data that can be stored in a Matrix ( cv::Mat or CvMat*) using OpenCV ? CV_64F是否可以使用OpenCV存储在Matrix( cv :: Mat或CvMat *)中的单个数据单元的最大尺寸/大小? Is there anything larger than that? 有没有更大的东西?

I want to store large sized data like a long double in a cv::Mat. 我想在cv :: Mat中存储大型数据,如long double Is there any way I can do it without using arrays? 有没有办法在不使用数组的情况下完成它?

As far as I can tell, you can do this sort of . 据我所知,你可以做这样的 You can use the Mat_ template class. 您可以使用Mat_模板类。 Below is a short example I wrote: 以下是我写的一个简短示例:

#include <opencv2/core/core.hpp>    
#include <iostream>

using namespace std;
using namespace cv;


int main(int argc, char* argv[])
{
    Mat_<long double> testing(Size(5, 5));

    // initialize matrix to ones
    for(int i = 0; i < testing.rows; i++)
    {
        for(int j = 0; j < testing.cols; j++)
        {
            testing.at<long double>(i, j) = 1;
        }
    }

    cout << "Element size in bytes is " << testing.elemSize() << "." << endl;

    return 0;
}

Now for the caveat... If you try to use many of the helper methods, ones , zeros , operator<< , and others), you will likely see this error: 现在请注意......如果您尝试使用许多辅助方法, oneszerosoperator<<和其他方法,您可能会看到此错误:

OpenCV Error: Unsupported format or combination of formats () in scalarToRawData

Hopefully that will be enough that you can use it for some things, but it won't be as clean as usual. 希望这足以让你可以将它用于某些事情,但它不会像往常一样干净。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM