PrevPrev Go to previous topic
NextNext Go to next topic
Last Post 25 Jul 2020 10:30 AM by amez 365
ENVI Task BinaryAutomaticThresholdRaster
�5 Replies
Sort:
You are not authorized to post a reply.
Author Messages

Raymond Hunt



New Member


Posts:4
New Member


--
19 Mar 2019 01:05 PM
    Hi,
    I am trying to write an ENVI API script to separate vegetation from the background for both color and color-infrared digital photos. The ENVI command, Binary Raster by Automatic Threshold, works pretty well. For the ENVIBinaryAutomaticThresholdTask, the documentation states the output is a binary raster file that for a mask. However, in an ENVI API script, I get the error message that the mask raster must only have one band. Sometimes the layer manager shows the output file with a single band, other times in the data manager, it has three bands. I assume the three bands are for each of the three input bands. So do I need to use band math with relational operators or is there a setting that I am missing?

    Mari Minari



    Veteran Member


    Posts:2313
    Veteran Member


    --
    20 Mar 2019 09:55 AM
    When I run this example, I get 4 output bands which corresponds to each of the input bands:
    http://www.harrisgeospati...sholdRasterTask.html

    If you replace your file with the sample dataset, do you get an error with this code? Is there additional code that is causing this message?

    Raymond Hunt



    New Member


    Posts:4
    New Member


    --
    20 Mar 2019 02:35 PM
    Sorry, I did not try the code on the sample dataset, because I already overwrote the program file with new code. To solve the problem, I took a single band and used the task, BinaryGTThresholdRaster. However, the new code is not portable, and will create problems when I change data sets.

    Now I am trying to figure out how to use the pixel state for band statistics. In the help file:

    > maskedData = maskedRaster.GetData(BAND=0, PIXEL_STATE=pixelState)
    >pos = WHERE(pixelState EQ 0, count)
    >IF (count NE N_Elements(maskedData)) THEN $
    > maskedData = maskedData[pos]

    I get that I only want pixels with the state = 0, but the example makes no sense to me. I assume the 2nd statement counts the number of pixels with state = 0, but how would the count not being equal to N_elements help to identify which pixels to exclude?

    Thanks

    Raymond Hunt



    New Member


    Posts:4
    New Member


    --
    21 Mar 2019 08:45 AM
    Please ignore post on 20 March 2019

    amez 365



    New Member


    Posts:2
    New Member


    --
    25 Jul 2020 10:29 AM
    hi

    amez 365



    New Member


    Posts:2
    New Member


    --
    25 Jul 2020 10:30 AM
    Infrastructure Engineer

    https://www.fieldengineer.com/skills/what-is-an-infrastructure-engineer
    You are not authorized to post a reply.