Hi,
I have write a class to manage images and to verify value of pixel on a Mat image, in a test with if and else.
This is a part of the code that I've write, the specific procedure that creates problems:
bool cubo::verifica_punti(Mat& I, double TC[4][4], double fc[2],double KC[5], double cc[2],double alpha){
for (int i=0;i<8;i++){
double PN[2] = { V[i].x/V[i].z, V[i].y/V[i].z};
double r2 = pow(PN[0],2.0) + pow(PN[1],2.0);
double dx[2]={((2*KC[2]*PN[0]*PN[1])+(KC[3]*(r2+2*pow(PN[0],2.0)))),(KC[2]*(r2+2*pow(PN[1],2.0))+2*KC[3]*PN[0]*PN[1])};
double xd[2]={((1+KC[0]*r2+KC[1]*pow(r2,2.0)+KC[4]*pow(r2,3.0))*PN[0]+dx[0]),((1+KC[0]*r2+KC[1]*pow(r2,2.0)+KC[4]*pow(r2,3.0))*PN[1]+dx[1])};
int xp = ceil(fc[0]*(xd[0]+alpha*xd[1])+cc[0]);
int yp = ceil(fc[1]*xd[1]+cc[1]);
if ((yp>720||yp<0))
{
return false;
}
else if ((xp>1280||xp<0)){
return false;
}
else
{
Scalar pix = I.at<uchar>(yp,xp);
if (pix.val[0]==0)
{
return false;
}
else
return true;
}
}
};
This is a method of my class CUBO.
When program run, I receive this error and program crash:
http://imageshack.com/i/10r512j[
^]
can someone help me??