|
Posted by PJ Halls on October 3, 2005, 8:41 am
Please log in for more thread options
paul wrote:
>
> i need to count pixels/ calc area of a virtual polygon (simple 4 sides
> defined in float s) over a raster black n white image image. probably
> looking to get data such as number of partial pixels, ect......can someone
> point me to a library for use in my app?
You do not need a library for this, expcept possibly to read the
raster's descriptor. Get yourself a copy of 'GIS Basics', by Steve
Wise, published by Taylor & Francis in 2002: it contains descriptions of
the computations involved - and more besides [maybe that's the 'library'
you need!]. This is something you can calculate without access to the
raster iteself!
The raster descriptor will generally give you the coordinates of one or
more corners, the number of cells in each axis and the size of each
cell. From the boundary of your polygon, you can determine whether it
intersects a cell boundary or divides a cell: you only need to do this
for the lower left corner. The rest is simple: from the length of the
sides of the polygon you can determine whether this is an integral
number of cells (divide by cell size!), the position will tell you how
divided cells operate, and the rest is simple maths.
Peter
-----------------------------------------------------------------------
|