Extract largest continuous pixel section
Posted: 2008-07-17T15:18:35-07:00
I have quite a few images that look similar to this one
I am trying to automatically extract the "9" from the image but its proving problematic. I tried..
1. converting the image to a txt file
2. using a C program to read the txt file and find the first black pixel
3. input the x and y values of the first black pixel to the floodfill command, using a different color for each segment
4. use a command I saw on here somewhere that showed you a count of the different pixel colors
5. floodfill all but the largest segment to white
however this seems like an EXTREMELY round-a-bout way of doing it and was wondering if someone could point me in a better direction.
EDIT: I am using C
I am trying to automatically extract the "9" from the image but its proving problematic. I tried..
1. converting the image to a txt file
2. using a C program to read the txt file and find the first black pixel
3. input the x and y values of the first black pixel to the floodfill command, using a different color for each segment
4. use a command I saw on here somewhere that showed you a count of the different pixel colors
5. floodfill all but the largest segment to white
however this seems like an EXTREMELY round-a-bout way of doing it and was wondering if someone could point me in a better direction.
EDIT: I am using C