chain codes
- From: "cindy" <olivemckenzie2003@xxxxxxxxx>
- Date: 7 Feb 2007 09:58:09 -0800
I would like to known if any one can describe to me how to read the
chain code of two circles side by side in a image and how do I would
know when one image has finished and another image has begun. using C+
+ code. I have tried the typical neighbourhood code and it does not
seem to work.
for(int h=1; h<ROWS-1;h++)
{
for(int w=1; w<COLS-1;w++)
{
int value=Array[h][w];
if (val<255)
cout<<h<<" " <<w<<endl;
getchar();
if(Array[h][w]<255)
{
Shape_Array[h][w] = value;
}
else
if (Array[h][w+1] < 255 && Shape_Array[h][w+1] == 255)
{
Shape_Array[h][w+1] = value;
w++;
}
else if (Array[h][w-1] < 255 && Shape_Array[h][w-1] == 255)
{
Shape_Array[h][w-1] = value;
w--;
}
else
if (Array[h+1][w-1] < 255 && Shape_Array[h+1][w-1] == 255)
{
Shape_Array[h+1][w-1] = value;
h++;
w--;
}
else if (Array[h+1][w] < 255 && Shape_Array[h+1][w] == 255)
{
Shape_Array[h+1][w] = value;
h++;
}
else if (Array[h+1][w+1] < 255 && Shape_Array[h+1][w+1] == 255)
{
Shape_Array[h+1][w+1] = value;
h++;
w++;
}
else if (Array[h-1][w-1] < 255 && Shape_Array[h-1][w-1] == 255)
{
Shape_Array[h-1][w-1] = value;
h--;
w--;
}
else if (Array[h-1][w] < 255 && Shape_Array[h-1][w] == 255)
{
Shape_Array[h-1][w] = value;
h--;
}
else if (Array[h-1][w+1] < 255 && Shape_Array[h-1][w+1] == 255)
{
Shape_Array[h-1][w+1] = value;
h--;
w++;
}
}
}
.
- Follow-Ups:
- Re: chain codes
- From: ImageAnalyst
- Re: chain codes
- Prev by Date: chain codes
- Next by Date: chain codes
- Previous by thread: Re: chain codes
- Next by thread: Re: chain codes
- Index(es):
Relevant Pages
|