Question

I am trying to implement HMM in opencv. First i create arrays of double, and copy them to Mat variables,

Mat INIT = Mat(0,3,CV_64F,trans).clone();

Then i am trying to access the individual pixel/position values from the matrix as:

cout << INIT.at<double>(r,c) << " ";//Where r and c are row and column values.

I am getting error like:

 OpenCV Error: Assertion failed (dims <= 2 && data && (unsigned)i0 < (unsigned)si
ze.p[0] && (unsigned)(i1*DataType<_Tp>::channels) < (unsigned)(size.p[1]*channel
s()) && ((((sizeof(size_t)<<28)|0x8442211) >> ((DataType<_Tp>::depth) & ((1 << 3
) - 1))*4) & 15) == elemSize1()) in unknown function, file c:\opencv2.4.4\includ
e\opencv2\core\mat.hpp, line 537

I searched over the forums and couldnot find anything wrong with the code. Any ideas? Thanks alot in advance.

Was it helpful?

Solution

Declare the Matrix INIT as :-

Mat INIT=Mat(1,3,CV_64FC1,trans).clone();

Now access the individual pixel/position values from the matrix as:

cout << INIT.at<double>(r,c) << " ";
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top