Bonjour,
voici un bout de mon code ... et lorsque je le lance : il plante ... je pense avoir un probleme d'allocation de memoire mais je comprend pas trop ou

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
 
void ActiveContour::getEdgeMap(float * output)
{
 
    output = (float*)malloc(this->image->getXLarg()*this->image->getYLarg());
   	float value = 0.0, gx = 0.0, gy = 0.0;
	for(int x=0;x<this->image->getXLarg();++x)
    	for(int y=0;y<this->image->getYLarg();++y)
    	{
              gx = - 0.5*image->getPixel(x-1,y) + 0.5*image->getPixel(x+1,y);
              gy = 0.5*image->getPixel(x,y+1) - 0.5*image->getPixel(x,y-1);
              output[this->image->getXLarg()*y + x] = float(sqrt(gx*gx + gy*gy));
    	}
 
}
merci de votre aide