bitmap reverse coordinates

R

Ron Dahl

Thanks Robby and Bob Powell for excellent answers on yesterday's question
about reversing coordinates in gdi+

I guess this is a new question.

My first step is that my bitmap is an aerial photograph of an agricultural
field. I use the .getpixel method to search for a certain color, then I
make a polygon around that color (weeds, high yield areas, etc.)
My bitmap is 440x 440.

I would like the getpixel method to use the reversed coordinates, so that if
I found a color in the lower left it might return point(10,10) instead of
point(10,430).

Then I use some math functions to get slopes, degrees of curvature, etc. I
wanted to reverse the y coordinates before the math functions, so the
results look more intuitive.

From there, I bring the bitmap into a graphics object and draw on it, again
using the reversed y coordinates.

I hope this question makes sense and thanks in advance for any help.
Ron Dahl
 
R

Robby

The Bitmap.GetPixel method takes the X and Y coordinate of the pixel and
returns the colour. Once you have your match use the TransformPoints method
of the Graphics object to transform them. Then you can run your math
procedures on them and get intuitive results.

--Robby
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top