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,

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.

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?

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,

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!

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,

Upload your sample image

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.