integral(img,isum,CV_32F); //calculating integral of the image.
for(int i=0;i<e2;i++)//e2 is columns
{
for(int j=0;j<=e1;j++)//e1 is rows
{
/*intensity = isum.at<Vec3f>(j,i);
m1v = intensity.val[0];
intensity = isum.at<Vec3f>((j+(p/2)),i);
m2v= intensity.val[0];*/
/*intensity = isum.at<Vec3f>((j+p),i);
m3v= intensity.val[0];*/
/*intensity = isum.at<Vec3f>(j,(i+p));
m4v= intensity.val[0];*/
intensity = isum.at<Vec3f>((j+(p/2)),i+p);
m5v= intensity.val[0];
/*intensity = isum.at<Vec3f>(j+p,i+p);
m6v= intensity.val[0];
//2*(m2v)+m6v+m4v-2*(m5v)-m1v-m3v;
featurev=2*(m5v)+m1v+m3v-2*(m2v)-m4v-m6v;
featurev/=(p*p);
cout<<k<<". featureV: "<<featurev<<endl;
k++;*/
}
}// p is patch size.
when I run this code it is causing an exception. I have tried interchanging the coordinates. I am finding the integral of an input image and accessing the pixels of isum. Please help me with the code. Thanks.
classic buffer overflow...
if you add an amount p to i, you'll either need to save a border of size p at the right end,
or do manual bounds checking :
same applies to j/rows