Tell me more ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

I want to compute an area of certain object on a picture using Monte Carlo method. The picture shows some shape on white background. To do so I figured out that I'd get the coordinates of non-white points and then I'd launch the rest of the routine in e.g. Excel. My problem however is that I don't know about any application or software that performs what I want - i.e. getting coordinates of pixels of some specified colour. Can someone suggest some application or software which can do what I want?

share|improve this question
1  
Why use a Monte-Carlo method when identifying and counting all the pixels will be more accurate and almost surely faster and easier? In fact, merely opening the "picture"--if it's a standard image file--in a GIS will let you see an attribute table in which the pixel counts are already listed. The area is directly proportional to the pixel count. – whuber Jan 5 at 20:16
The only motivation to use MC method is that I have to show that I know how to use this method. – m.woj Jan 5 at 20:24
@whuber is right in that counting pixels is the way to go for raster area calculations. I've never heard of a MC approach to determine pixel area. Consider using QGIS's raster calculator to perform the necessary mask: spatialgalaxy.net/2012/01/25/using-the-qgis-raster-calculator – Aaron Jan 5 at 20:29
@Aaron & whuber I've installed QGIS and honestly don't have any idea what to do next (except I managed to make QGIS open my picture file). I'm completly new to this kind of software. Could you please provide more detailed instruction on how should I proceed? – m.woj Jan 5 at 22:12

1 Answer

How do you want to do this? For example you can do it with a GIS software like QGIS or R.

with a GIS software, one way of doing it is to transform the raster to a shape file (point geometry) and keeping the value field (cell value). After you can extract the coordinates of each point that corresponds to the center of each raster cell.

In R you can use the Raster package with the function xyFromCell .

share|improve this answer
Obtaining the coordinates is not necessary for finding the area of the desired pixels, which appears to be what the OP is asking. (The conversion to vector format is incredibly inefficient compared to a native raster solution, such as masking the grid with a random indicator grid.) – whuber Jan 6 at 16:45

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.