# Post Processing Script

## Introduction <a href="#introduction" id="introduction"></a>

When using a reflectance panel, raw images should first be run through a Radiometric Corrections Workflow.

Click below to view the GitHub page for this tool.&#x20;

{% embed url="<https://github.com/SenteraLLC/py-radiometric-corrections>" %}

## Download Options

There are two options to setup and perform these corrections.

1. Running the stand alone ImageryCorrector.exe in the command prompt
2. Installing the scripts and libraries in python, then running commands in the environment you have created.

### Stand Alone Executable Setup Instructions&#x20;

{% stepper %}
{% step %}

#### Download .exe file&#x20;

ImageryCorrector.exe can be downloaded from the most recent tagged release on GitHub.

Click on the link below, and scroll down to assets. Then click [ImageryCorrector.zip](https://github.com/SenteraLLC/py-radiometric-corrections/releases/download/v1.8.5/ImageryCorrector.zip) to download.

{% embed url="<https://github.com/SenteraLLC/py-radiometric-corrections/releases/tag/v1.8.5>" %}
{% endstep %}

{% step %}

#### Unzip File

Extract the file from the downloaded zipped folder.

You're now ready to navigate to and run the .exe file in the command prompt.
{% endstep %}
{% endstepper %}

### Python Installation Instructions&#x20;

{% stepper %}
{% step %}

#### Download miniconda for python 3.7

Choose the correct option for your computer.

{% embed url="<https://docs.conda.io/projects/miniconda/en/latest/>" %}

{% endstep %}

{% step %}

#### Open Anaconda Prompt (miniconda3)

<figure><img src="/files/b1RrohAVbp3bjSPOLHbl" alt=""><figcaption></figcaption></figure>

{% endstep %}

{% step %}

#### Clone py-radiometric-corrections

```
git clone https://github.com/SenteraLLC/py-radiometric-corrections.git
```

<figure><img src="/files/DZXIgCGeUwDPpvW5aWI4" alt=""><figcaption></figcaption></figure>

{% endstep %}

{% step %}

#### Navigate to py-radiometric-corrections/

```
cd py-radiometric-corrections/
```

<figure><img src="/files/VpivvEflV1kbA9pF39fB" alt=""><figcaption></figcaption></figure>

{% endstep %}

{% step %}

#### Run The Following Commands <a href="#run-the-following-commands" id="run-the-following-commands"></a>

This creates an imgcorrect-venv environment that all scripts should be run in and installs the analyticstest library for the scripts to reference. If no errors appear, the imgcorrect library should be installed correctly.

```
conda env create -f environment.yml
```

<figure><img src="/files/Jc8iMbqnSNc7bNjUUKO9" alt=""><figcaption></figcaption></figure>

```
conda activate imgcorrect-venv
```

<figure><img src="/files/MXbrCKME1juy7Pj8ZRxl" alt=""><figcaption></figcaption></figure>

```
pip install .
```

{% hint style="info" %}
you may need to add --user at the end of the install command.
{% endhint %}

<figure><img src="/files/lOZi2G70OO62RbrDR7gP" alt=""><figcaption></figcaption></figure>

Installation Complete.&#x20;
{% endstep %}
{% endstepper %}

***

## How To Use

### Stand Alone Executable Usage&#x20;

{% stepper %}
{% step %}

#### Open Command Prompt and navigate to location of ImageryCorrector.exe

```
cd C:\Users\Mbohman\Downloads\ImageryCorrector
```

<figure><img src="/files/ZjwQQPjSip2KQfwFk1mW" alt=""><figcaption></figcaption></figure>
{% endstep %}

{% step %}

#### Get Required Arguments&#x20;

<pre><code><strong> ImageryCorrector.exe -h
</strong></code></pre>

<figure><img src="/files/VMyDMw9AFv5Ut3qziL1C" alt=""><figcaption></figcaption></figure>
{% endstep %}

{% step %}

#### Run Corrections

```
 ImageryCorrector.exe "input_path" --output_path "output_path"
```

{% endstep %}
{% endstepper %}

### Python Usage

{% stepper %}
{% step %}

#### Open Anaconda Prompt and navigate to py-radiometric-corrections/.

```
cd py-radiometric-corrections/ 
```

<figure><img src="/files/0Osk41CnSJBzNSCHPf4F" alt=""><figcaption></figcaption></figure>
{% endstep %}

{% step %}

#### Activate Environment

```
 conda activate imgcorrect-venv 
```

<figure><img src="/files/xAuEBJvtKZBjsYkEbmvc" alt=""><figcaption></figcaption></figure>
{% endstep %}

{% step %}

#### Get Required Arguments

```
 python scripts\correct_images.py -h  
```

<figure><img src="/files/Ob6uYBNyjUNHw3IzB8S9" alt=""><figcaption></figcaption></figure>
{% endstep %}

{% step %}

#### Run Corrections

```
 python scripts\correct_images.py "input_path" --output_path "output_path" 
```

<figure><img src="/files/DJXeS9D8jLokEuUQqs3t" alt=""><figcaption></figcaption></figure>

{% hint style="info" %}
Use local data folders when running the proceesing scripts.
{% endhint %}
{% endstep %}
{% endstepper %}

***

## Arguments <a href="#arguments" id="arguments"></a>

**input\_path**

Path to image files taken from supported sensors. Choose the session folder of your images. This will cause the script to correct the images in each subfolders for all 5 multispectral band and ignore the rgb folder.

**--calibration\_id "CALIBRATION\_ID", -c CALIBRATION\_ID**

Identifier in the name of the image that denotes it is from the calibration set. If not specified, defaults to "CAL".

**--output\_path OUTPUT\_PATH, -o OUTPUT\_PATH**

Path to output folder at which the corrected images will be stored. If not supplied, corrected images will be placed into the input directory.

**--no\_ils\_correct, -i**

If selected, Incident Light Sensor correction will not be applied to the images.

**--no\_reflectance\_correct, -r**

If selected, reflectance correction will not be applied to the images.

**--delete\_original, -d**

Overwrite original 12-bit images with the corrected versions. If selected, corrected images are renamed to their original names. If not, an extension is added.

**--exiftool\_path EXIFTOOL\_PATH, -e EXIFTOOL\_PATH**

Path to ExifTool executable. ExifTool is required for the conversion; if not passed, the script will use a bundled ExifTool executable.

**--uint16\_output, -u**

If selected, scale of output values will be adjusted to 0-65535 and dtype will be changed to uint16.

### Arugment Usage

```
[-h] [--calibration_id CALIBRATION_ID] [--output_path OUTPUT_PATH] [--no_ils_correct] [-no_reflectance_correct] [--delete_original] [--exiftool_path EXIFTOOL_PATH] [--uint16_output] [--version] input_path 
```

The correction is done in 3 steps:

1. Autoexposure correction.
2. Incident Light Sensor correction.
3. Reflectance correction.

#### **Autoexposure Correction**

Sensors simulate longer exposures and wider apertures for subjects with lower upwelling radiance. These scripts correct by dividing pixel values by `EXIF ISOSpeedRatings` \* `EXIF ExposureTime`

#### **Incident Light Sensor (ILS) Correction**

Downwelling radiance may change over the course of a flight as clouds pass overhead. These scripts correct by dividing pixel values by a rolling average of Incident Light Sensor readings (Camera:SunSensor) on images taken within 3 seconds of the corrected image. Correcting for ILS will standardize the DN (digital number) of your images based on the differences in incident light.

#### **Reflectance Correction**

Sensors measure upwelling radiance, not reflectance. Radiance is dependent on unpredictable environmental conditions, and without a reference point with known reflectance, it is impossible to calculate. By beginning a flight with a photo of a panel with known reflectance, that panel's upwelling radiance can be used to standardize measurements.

These scripts correct by multiplying pixel values by slope coefficient (calculated based on known calibration panel reflectance values).

***


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://support.senterasensors.com/home/sentera-calibrated-reflectance-panel/sentera-calibrated-reflectance-panel/calibration-imagery-post-processing/post-processing-script.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
