我正在尝试访问我的cvMat
.
这是我的代码:
// Declare
int rank = 3;
CvMat* warp_matrix = cvCreateMat(rank,rank,CV_32FC1);
// Using
cvGetPerspectiveTransform(imgSrc,imgDst,warp_matrix);
for(int i=0; i<rank; i++)
{
for(int j=0; j<rank; j++)
{
std::cout << warp_matrix->data[i][j] << std::endl;
}
}
但我发现一个错误:
error: no match for 'operator[]' (operand types are 'CvMat::<anonymous union>' and 'int')
而且我不知道如何解决它-我尝试CV_MAT_ELEM()
这样:
std::cout << CV_MAT_ELEM(warp_matrix,double,i,j) << std::endl;
它仍然不起作用(捕获此错误):
error: request for member 'cols' in 'warp_matrix', which is of pointer type 'CvMat*' (maybe you meant to use '->' ?)
我不知道现在该怎么办。你能帮助我吗 ?