Home > Back-end >  VC circle detection, for advice.
VC circle detection, for advice.

Time:10-08

After the image edge detection, how to establish the coordinate parameters information center and radius? Think for a long time and the procedure can't together, pray god give directions!
Is under my Robert operator for edge detection, just don't know how to get the coordinate information,
Void MyDib: : Robert ()
{
LPBYTE p_data;//the original image data area pointer
Int wide, height, DibWidth;//the original long, wide
p_data=https://bbs.csdn.net/topics/this-> GetData (); A pointer to a data area//artwork
Wide=this - & gt; GetWidth ();//width of the original image data area
Height=this - & gt; GetHeight ().//get the original image data area highly
DibWidth=this - & gt; GetDibWidthBytes ();//artwork of bytes per line
int i,j;//loop variable
If (m_pBitmapInfoHeader - & gt; BiBitCount<9)//gray image
{
Int pixel [4];//Robert operator
LPBYTE temp=new BYTE/wide * height;//the new image buffer
Memset (temp, 255, wide * height);//set the initial value for the new image of 255
//due to the use of 2 * 2 templates, to prevent cross-border, so does not handle the bottom and the rightmost column of pixels
for(j=0; Jfor(i=0; i{
//generated Robert operator
Pixel [0]=p_data [j * wide + I];
Pixel [1]=p_data [j * wide + I + 1);
Pixel [2]=p_data [(j + 1) * wide + I];
Pixel [3]=p_data [(j + 1) * wide + I + 1);
//deal with the current pixel
[j * wide temp + I)=SQRT (int) ((pixel [0] - pixel [3]) * (pixel [0] - pixel [3]) + (pixel [1] - pixel [2]) * (pixel [1] - pixel [2]));
}
//copies the data in the buffer to the original image data area
Memcpy (p_data, temp, wide * height);
//delete buffer
The delete temp.
}
The else//24 color
{
Int pixel [4];//Robert operator
BYTE * p_temp=new BYTE [height * DibWidth];

for(j=0; Jfor(i=0; i{
//generated Robert operator
Pixel [0]=p_data [j * DibWidth + I];
Pixel [1]=p_data [j * DibWidth + I + 3);
Pixel [2]=p_data [(j + 1) * DibWidth + I];
Pixel [3]=p_data [(j + 1) * DibWidth + I + 3);
//deal with the current pixel
[j * p_temp DibWidth + I]=SQRT (int) ((pixel [0] - pixel [3]) * (pixel [0] - pixel [3]) + (pixel [1] - pixel [2]) * (pixel [1] - pixel [2]));
}
Memcpy (p_data, p_temp, height * DibWidth); The processed image is//copy
The delete [] p_temp;//delete temporarily allocate memory
}
}
  • Related