954,518 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

find the X-Y coordinate of the white pixels of the grayscale image using c#

Hi!

I have a grayscale image in my pictureBox. I want to box up the white pixels in the image using the rectangle. Can anyone teach me how to write the code. Thanks in advance ..

Best regards,

learningthings
Newbie Poster
5 posts since Jul 2009
Reputation Points: 10
Solved Threads: 0
 

What do you mean by I want to box up the white pixels in the image using the rectangle. ?
Coordinates start in the upper left corner with (0,0).
Y coordinates increase by moving down.
X coordinates increase by moving left.

ddanbe
Senior Poster
3,829 posts since Oct 2008
Reputation Points: 2,070
Solved Threads: 661
 

Do you mean you want to draw a rectangle around area that have all-white pixels? This will work OK if the areas are in fact only rectangular but I highly suspect you will find jagged edges with white pixels. How should that be handled?

sknake
Industrious Poster
4,954 posts since Feb 2009
Reputation Points: 1,764
Solved Threads: 735
 
What do you mean by I want to box up the white pixels in the image using the rectangle. ? Coordinates start in the upper left corner with (0,0). Y coordinates increase by moving down. X coordinates increase by moving left.

Thanks for the reply and apologize for my poor English language :)

Box up mean indicate with rectangles where the white pixels of the image are.

I have a gray-scale image in the pictureBox and I want to draw a rectangle on the white pixels of the image. Now my problem is i don't know how to get the X-Y coordinate and size of the white pixels of the image for drawing the rectangle on them. As i m a beginer in programming, could you guide me how can i write it in c#. Thanks in advance.

best regards,

learningthings
Newbie Poster
5 posts since Jul 2009
Reputation Points: 10
Solved Threads: 0
 

Check out this thread:
http://www.daniweb.com/forums/thread215149.html

It does basically the same thing but uses a screen shot instead of a bitmap file. You can just change that section of the code out then it shows you how to find a pixel. After you have a working version of that code then post it up here and we'll go from there!

sknake
Industrious Poster
4,954 posts since Feb 2009
Reputation Points: 1,764
Solved Threads: 735
 
Do you mean you want to draw a rectangle around area that have all-white pixels? This will work OK if the areas are in fact only rectangular but I highly suspect you will find jagged edges with white pixels. How should that be handled?

Yes, I want to draw rectangles around area that have all-white pixels of the image. The white pixels will be within the rectangle. How can i write it in c#. Thanks a lot for the reply.

Best Regard,

learningthings
Newbie Poster
5 posts since Jul 2009
Reputation Points: 10
Solved Threads: 0
 

Upload your sample image

sknake
Industrious Poster
4,954 posts since Feb 2009
Reputation Points: 1,764
Solved Threads: 735
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You
View similar articles that have also been tagged: