Support Website Contact Support Blog

Soil and plant masking w/ Pix4Dfields

Besides the generation of standard vegetation indices, the use of the index calculator allows us to generate a custom index that adapts better to their specific crop scouting or crop protection needs. Some of you asked about soil masking; we are working on this. Currently, the following workaround can be used:

  1. Go to the Index Generator tool
  2. Click on “Create Custom Index”
  3. Add the following formulas:

soil masked map (nir-red)/(nir+red) + 0/max(0; (nir-red)/(nir+red) - 0.4)

vegetation masked map (nir-red)/(nir+red) + 0/min(0; (nir-red)/(nir+red) - 0.4)

Note: The formulas are using a division by zero to cause transparency on some pixels and mask vegetation or soil respectively.

  1. Preview

  2. Apply

Figure 1: NDVI soil masked map

Figure 2: NDVI vegetation masked map

Data credits: datasets generated by Pinpoint Aerial Solutions with a Micasense RedEdge

Note: In the example above we substract 0.4, since we are assuming the plants have NDVI value more than 0.4, so all the pixels below 0.4 are masked. This value can be modified depending on your applications

Is it possible to edit the algorithm to display the reflectance between a certain threshold? For example if i wanted to display values between 0.8 and 0.9.

1 Like

Hi Jeremiah, We are coming up with that featuire very soon :slight_smile:

Is it possible to do this in Pix4D Mapper or is this exclusive to fields?

Hello Steve.
I tried with Fields and it works perfectly. I wanted to do it with Mapper, but it didn’t recognize the Min and Max functions (or I got it wrong …).
A solution available for Mapper?

Hi all, We do not have the min, max functions in Mapper. You can try using QGIS/ArcGIS on any raster calculator that has the min, max functions. I had also answered here: Pix4D indicies formula (kent index), you can have a look.

In this formula you wrote:

(nir-red)/(nir+red) + 0/min(0; (nir-red)/(nir+red) - 0.4) - NDVI

You used all this formula and then made it minus the NDVI? Is this correct? I am having a sintax error when copying the formula. If I erase only the “NDVI” ot Works as a formula, but does not work as a mask right. Any ideas?

1 Like

Hey,

You should not minus the NDVI. I am modifying the text, so it is not confusing. Thanks so much for the feedback.

Regards,

Is there a way to edit this formula to show only a specified range of vegetation? Ie.: from 0.7 to 0.9
And is there a way for doing that with the soil range also?

Gustavo, You can get the index from 0.7 to 1. Here we substract 0.4, since we are assuming the plants have NDVI value more than 0.4, so all the pixels below 0.4 are masked. If you use 0.7, the pixel value (NDVI) below 0.7 will be masked. But there is no way to change the max value. We are brining a feature very soon where you will be able to chnage the max, min values (range) of any index. 0.4 is the threshold value here and you could chnage it to any value according to your application.

The reason I am asking you that is because I would like to remove/mask some trees that are scattered acrross a crop field, and I realized they have a signature that ranges from 0.8 to 1.

In this next uptade to come, will we be able to customize the range of vegetation on the zonation maps also? This would also be a way to eliminate this scattered trees, and would also allow us to specify weed infestation signatures inside a crop.

So you will need to use this: (nir-red)/(nir+red) + 0/min(0; (nir-red)/(nir+red) - 0.8). That will mask all the vegetation NDVI ranging from 0.8 to 1.

The range of max, min in zonation maps will not be there yet. However, I will pass on the request to our team. Could you also make a feature request here: https://community.pix4d.com/c/pix4dfields/Pix4DfieldsFR/81?

great, but how about if the vegetation that i wanted to mask was only between 0,8 to 0,9?

You will not be able to do it with this formula but as I said, this feature is coming very soon. For now, you can try it in QGIS. You will be able to chnage the max, min values of the map.