+1  A: 

I guess you need an edge detection algorithm. Try this or this.

Anton Gogolev
thanks a lot for refference Anton, lemme try those
Prashant
+4  A: 

Quick and dirty solution. Run the image pixel by pixel, if the color change, just paint the pixel red.

PS: Notice this may not work for a square, unless you do the same vertically and horizontally

Samuel Carrijo
This is most probably the fastest solution to this limited problem. There is no need to use any more powerful edge detector for this problem!
kigurai
A: 

What you are looking for is edge detection. You can find a number of resources for the general algorithm on Google:

http://www.google.com/search?q=edge+detection+.net

casperOne
beat me to it :)
David Hedlund
A: 

i can at least point you in the direction of some pretty neat edge detection filters: http://www.codeproject.com/KB/GDI-plus/edge_detection.aspx

i imagine it should suit you quite well

David Hedlund
A: 

Never had to do anything like this, but a powerful tool for complex image manipulation is:

http://www.imagemagick.org/script/index.php

Lots of documentation and examples -- and a .NET wrapper if you'd rather not call the executable.

Bryan Rowe
A: 

Interesting problem - I'm assuming the 'white circle' in your example is actually another image - meaning you aren't drawing the circle yourself?

If so, you might scan through all of the pixels to find a white pixel that has black on at least one side of it (either 4 directions or 8 including corners). If it is a match then swap it to red. If not then ignore it.

I doubt that is the best way to do it, but if it is only black and white, this might get you started.

Hugoware
+1  A: 
plinth
Canny Edge detector seems like overkill unless he's working with more complicated images.
emddudley
A: 

There is several approach for this.

The first one is: - you know that there is a circle, and you juste need to find where is the center and how is the radius. So you can use Hough transformation to find these, and them draw your circle in red. Read this topic or this one

The 2nd is to use edge detection. Here or here (here for more theoritical point of view)

ThibThib
A: 

Ultimately you want to edit the pixels of the image. That question has already been answered here by Marc Gravell.

Then, based on which option you choose, either LockBits or GetPixel/SetPixel, you will need to loop through and look at the per pixel color values. Keep looping until you hit a white pixel.

Once you do, check in all directions around it, if you find a black pixel, then color that white pixel red. This is of course the most simplistic answer, and there are ways to optimize it, but it will work.

For instance, if you wanted to limit the color changing to just the four directly adjacent pixels, you could, rather than also checking the diagonals.

Darien Ford
A: 

Edge detection? Image processing? OpenCV! There are C# wrappers for the lib. Not the "easy" solution but any exp you get with this lib is a good resume builder. If you company is doing image processing they are probably already using it.

JustSmith
+3  A: 
emddudley