It is look trivial. I tried this
double d[2];
CvMat* cvdata;
cvdata->data.db = d;
when I using debugging mood it seems that only the first element assigned to cvdata.
any suggestions? and what about 2-Dimensional array?
thank you
I think you need to set these first:
matrix size, matrix type
Example in C++:
double d[2];
cv::Mat* cvdata = new cv::Mat(1, 2, CV_64F);
.
.
.
http://opencv.itseez.com/modules/core/doc/intro.html#fixed-pixel-types-limited-use-of-templates
http://opencv.itseez.com/modules/core/doc/basic_structures.html#mat-mat
You should not use a pointer to Mat, you can do it the following way:
int rows = ..;
int cols = ..;
cv::Mat cvdata(rows, cols, cv::DataType<double>::type);
when you copy cvdata or pass it as argument only a copy of the cv::Mat's header is created the internal data i copied. Opencv manages the pointers automatically.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.