Hi,
I am currently trying to write and application in c# that can read images and process it, finding things such as boarders of a circle within the image, the area and diameter of the circle and the colours of pixels within the circle. However because i'm new to c# im finding all aspects difficult. Any hints anyone?
Loading
avoPosted Feb 29, 2008, 9:51 AM
I dont think I explained the problem clearly enough.
Although originally I said that I wanted to find the edges of a circle, it is actually a lesion (skin cancer area). I have to find the edges of the skin cancer in the image and the colour of the cancer. I think that the code you sent works for any shape which has colours in the center that are not the same colour of the edge. An example of the cancer image is provided in the link below.
http://www.raft.ac.uk/images/research/research_melonoma.jpg
CutchPosted Feb 13, 2008, 4:50 PM
You could try using this
This will get you the left side point:
int
x = 0; int y = 0; Bitmap bmp = new Bitmap("C:/Circle.jpg");Point top; Point bottom;Point left; Point right;
Color background = bmp.GetPixel(0, 0);
while
(x != bmp.Width) {while (y != bmp.Height){if
(bmp.GetPixel(x, y) != background){left = new Point(x,y); }
y += 1;} y = 0; x += 1;}
You could use this in a while loop to find the first black pixel on the left of the circe, once the left is found do another up and down scan to find the one on the right, then a left and right scan to find the ones on the top then bottem.
Then you could average the x1 and x2, then the y1, and y2 to find the center point and get a colour value.
Example:
center = new Point((x1+x2)/2,(y1+y2)/2);
colour = bmp.GetPixel(center.X,center.Y);
Then to find borders you could get the radius and use pythagrean theorm x2 + y2 = r2 to find all the points on the curvature of the circle.