Home All Groups Group Topic Archive Search About

how to draw irregular shape and calculate its surface?

Author
6 May 2010 9:39 PM
Uwe Conradi
Hello everybody,
I load first some image in the picturebox.
I would like to draw  (with pressed mouse) a line in the picturebox making
so an irregular shape and then to color this shape and finally to calculate
how many pixel are there. So I could compare different shapes.
How to make it?
Thanks for your ideas!
Uwe

Author
7 May 2010 5:55 AM
Cor Ligthert[MVP]
Have a look at the System.Drawing  probably 10.000 samples on Internet how
to draw a line in an image.

http://msdn.microsoft.com/en-us/library/system.drawing.aspx

Show quoteHide quote
"Uwe Conradi" <conr***@arcor.de> wrote in message
news:ODHoXSW7KHA.5112@TK2MSFTNGP02.phx.gbl...
> Hello everybody,
> I load first some image in the picturebox.
> I would like to draw  (with pressed mouse) a line in the picturebox making
> so an irregular shape and then to color this shape and finally to
> calculate how many pixel are there. So I could compare different shapes.
> How to make it?
> Thanks for your ideas!
> Uwe
Author
7 May 2010 4:17 PM
DickGrier
To calculate the surface area, the normal approach would be to break the
irregular shape into a large number of rectangles, each of small size (often
very small).  Calculate the area of each rectangle, then sum all of those
areas.

This is a standard technique, and while not exact -- such a calculation
never can be exact, unless you have a mathematical formula that describes
the surface, if the rectangles are sufficiently small, the error also will
be small.

Dick

--
Richard Grier, Consultant, Hard & Software 12962 West Louisiana Avenue
Lakewood, CO 80228 303-986-2179 (voice) Homepage: www.hardandsoftware.net
Author of Visual Basic Programmer's Guide to Serial Communications, 4th
Edition ISBN 1-890422-28-2 (391 pages) published July 2004, Revised July
2006.