Bonjour,
en faite je travaille sur une vidéo infrarouge et je dois faire du traking.
La sur cette image j'ai appliqué Sobel+seuillage.
Ce que je cherche à faire c'est la boite englobante en violet.
le problème c'est que j'arrive à récupérer le pixel blanc(0 en binaire)
voila le code:

CvPoint* getImageBounds(IplImage* im)
{

cout << "start-----------------------" << endl;

CvPoint points[4];

int h = im->height;
int w = im->width;

bool continu = true;
for(int j=0;j<h && continu;j++)
{
for(int i=0;i<w;i++)
{
if(cvGet2D(im, i, j).val[0]==1)

{
cerr << "point1 = " << points[0].x <<" point1 = "<< points[0].y <<endl;
points[0] = cvPoint(i,j);
continu = false;
break;
}
}
}

cout << "start" << endl;
continu = true;
for(int i=0;i<w && continu;i++)
{
for(int j=h-1;j>=0;j--)
{
if(cvGet2D(im, j, i).val[0]==1)

{
points[1] = cvPoint(i,j);
// x2=i;
// y2=j;
cerr << "point2 = " << points[1].x <<" point2 = "<< points[1].y <<endl;
continu = false;

break;
}
}
}
cout << "start" << endl;
continu = true;
///
for(int i=w-1;i>=0 && continu;i--)
{
for(int j=0;j<h;j++)
{
cout << "start" << endl;
if(cvGet2D(im, j, i).val[0]==1)
{
points[2] = cvPoint(i,j);
// x3=i;
// y3=j;


cerr << "point3 = " << points[2].x <<" point3 = "<< points[2].y <<endl;
continu = false;
break;
}
}
}

continu = true;
///
for(int j=h-1;j>=0 && continu;j--)
{
for(int i=w-1;i>=0;i--)
{

if(cvGet2D(im, j, i).val[0]==1)
{
points[3] = cvPoint(i,j);

// x4=i;
// y4=j;
cerr << "point4 = " << points[3].x <<" point4 = "<< points[3].y <<endl;
continu = false;
break;
}
}

}

CvPoint res[4];

res[0]= cvPoint(points[1].x,points[0].y);//System.out.println(" :-: "+res[0]);
cerr << "res = " << res[0].x <<" res = "<< res[0].y <<endl;
res[1]= cvPoint(points[2].x+4,points[0].y);//System.out.println(" :-: "+res[1]);
res[2]= cvPoint(points[1].x,points[3].y+4);//System.out.println(" :-: "+res[2]);
cerr << "res = " << res[2].x <<" res = "<< res[2].y <<endl;
res[3]= cvPoint(points[2].x+4,points[3].y+4);
cvRectangle(im,res[0] ,res[3],CV_RGB(255,255,0), 3, 8, 0);
return res;

}

Aidez moi svp je bloque