I've read a few posts about Mat element access and had some trials but all failed. Could someone give me a hint?
Mat vect(1,3, CV_32FC1);
typedef Vec<float,1> Vec1f; //**
// access ele. at (1,1)
vect.at<Vec1f>( Point(1,1 )) = 5; // I used 1 channel so I defined a new element type as a workaround
I adapted the code from this post opencv multi channel element access
And, I though thet line //** can be declared like:
typedef Vec<float> Vec1f;
according to line 582 in core.hpp: Vec(_Tp v0); //!< 1-element vector constructor
However, it also doesn't work
I applied the same method for 2D matrix then it is fine:
Mat warp_mat(2,3, CV_32FC1);
typedef Vec<float,1> Vec1f;
warp_mat.at<Vec1f>( Point(0,0 )) = 1;
warp_mat.at<Vec1f>( Point(1,0 )) = 2;
warp_mat.at<Vec1f>( Point(2,0 )) = 5;
warp_mat.at<Vec1f>( Point(0,1 )) = 4;
warp_mat.at<Vec1f>( Point(1,1 )) = 5;
warp_mat.at<Vec1f>( Point(2,1 )) = 0;
it works OK!