我有一个 c-Api opencv 项目,我想更改为 c++ (mat) 看到这个原始代码:
current_cost = 0;
basePtr = (unsigned char*)tmp1->imageData;
for( int j=0; j<tmp1->height; basePtr += tmp1->widthStep, j++ )
{
iterator = basePtr;
for( int i=0; i<tmp1->width; iterator++, i++ )
if( *iterator == 255 )
current_cost++;
}
basePtr = (unsigned char*)tmp2->imageData;
for( int j=0; j < tmp2->height; basePtr += tmp2->widthStep, j++ )
{
iterator = basePtr;
for( int i=0; i<tmp2->width; iterator++, i++ )
if( *iterator == 0 )
current_cost++;
}
if( current_cost < cost )
return true;
else return false;
运行这个项目后,看到这个错误
main.cpp:63:35: error: base operand of ‘->’ has non-pointer type ‘cv::Mat’
basePtr = (unsigned char*)tmp1->imageData;
查看使用的每一行的错误 '->' 。请帮我 ...