# 2 - Generate NDVI
```{container} algorithm-id
**Algorithm ID**: `hedgetools:generatendvi`
```
This tool generates a vegetation raster using the Normalized Difference Vegetation Index (NDVI). It is computed from an infrared band and a red band.
The NDVI (Normalized Difference Vegetation Index) represents vegetation density and health, calculated from the red and infrared bands. Higher values indicate denser, healthier vegetation.
The binary mask or the sieved mask will be used to generate the tree cover layer in [Generate Tree Cover](./generate_tc.md).
The NDVI output can be used to generate additional binary masks with the [Raster Calculator](https://docs.qgis.org/3.40/en/docs/user_manual/processing_algs/gdal/rastermiscellaneous.html#raster-calculator)
## Parameters
| Label | Name | Type | Description |
|-------|------|------|-------------|
| Input Red raster | `RED` | [raster] | Red raster |
| Red band | `RED_BAND` | [raster band]
Default: 1 | Band of the Red raster to use in case of multiband. |
| Input Infrared raster | `INFRARED` | [raster] | Infrared raster |
| Infrared band | `INFRARED_BAND` | [raster band]
Default: 1 | Band of the Infrared raster to use in case of multiband. |
| Extent of the study area
Optional | `EXTENT` | [extent] | Input extent from a layer, canvas, or other source to clip the rasters. |
| NDVI value threshold (NDVI mask)
Optional | `THRESHOLD_MASK` | [numeric: double]
Default: 0.20 | Threshold to create the binary NDVI mask. Pixels above this value are considered vegetation. |
| Compute sieved NDVI mask | `SIEVE` | [boolean]
Default: True | If enabled, the NDVI mask is sieved to remove small holes. Recommended to reduce noise in vegetation layers. |
| Threshold sieve value (pixel number) | `THRESHOLD_SIEVE` | [numeric: integer]
Default: 100 | Minimum number of pixels for a feature to be kept in the sieved mask. |
| Handling of extent differences | `EXTENT_OPT` | [enumeration]
Default: 0 | Determines how the tool handles differing DSM and DTM extents: