X
PrevPrev Go to previous topic
NextNext Go to next topic
Last Post 05 Jun 2008 12:24 PM by  anon
Regarding Image processing
 1 Replies
Sort:
You are not authorized to post a reply.
Author Messages

anon



New Member


Posts:
New Member


--
05 Jun 2008 12:24 PM
    Hi,I do have a tiff image of a soil.I need to write code which could get the image as input and it should say how much percent of soil is there,how much percent of water is there etc.I am a novice so any help would be appreciated.

    Deleted User



    New Member


    Posts:
    New Member


    --
    05 Jun 2008 12:24 PM
    Presuming you know which range of light intensities in your TIFF image represent soil and which represent water, the task in IDL requires just a few lines of code. Here is an example, where I assume that the image's values are 8-bit byte values in grayscale and water appears much darker than land. Let's assume that land values are never less than 60. image = read_tiff('/path/to/myimage.tif') nPixels = n_elements(image) ; Gets total number of pixels in the image ; WHERE returns both the number of soil pixels and their subscript locations in the array soilSubscripts = where(image ge 60, nSoilPixels) percentSoil = float(nSoilPixels) / nPixels ; the FLOAT conversion is required here percentWater = 1.0 - percentSoilBest of luck with this, James Jones
    You are not authorized to post a reply.