Line scanning openCV
below is a very simple code segment, but I am not able to understand why it is cribbing, can you please tell me what the error means:
CvSize iSize;
iSize= cvGetSize(I1)开发者_高级运维;
CvLineIterator *iter ;
CvPoint p1,p2;
long *arrH = new long[iSize.height + 1];
long *arrV = new long [iSize.width + 1];
for( int i=0; i<=iSize.height;i++)
{
p1.y = i; p2.y=i;
p1.x = 0; p2.x=iSize.width;
arrH[i] =0;
int l = cvInitLineIterator(I1,p1,p2,iter,4,0);
for( int j=0;j<l;j++)
{
arrH[i]+=iter.ptr;
CV_NEXT_LINE_POINT(iter);
}
fprintf(f1,"%d \n",arrH[i]);
}
Errors of the form: left of '.ptr' must have class/struct/union how do I tackle them ?
I think this:
CvLineIterator *iter ;
Should be:
CvLineIterator iter ;
And this:
cvInitLineIterator(I1,p1,p2,iter,4,0);
Should be:
cvInitLineIterator(I1,p1,p2,&iter,4,0);
精彩评论