How to calibrate images in MAPIR camera control application
This page explains how and why we calibrate images used to measure the reflectance of materials such as vegetation in agricultural fields.
Our Sun emits a large amount of light spectrum that is reflected by objects on the Earth's surface. This reflected light can be captured using a camera at the wavelengths to which the camera sensor is sensitive. We offer sensors based on silicon sensitive to the visible and near-infrared spectrum around 400-1100nm. Using a bandpass filter that only allows a narrow spectrum of light to reach the sensor, we can capture how reflective an object is to that specific band of light.
For example, if a camera's filter selects a 25nm broadband with a peak wavelength of 650nm, it will only capture the reflected "red" 650nm light from the sun. So each pixel in the image is the percentage of reflected light that is allowed to pass through the "red" filter.
Depending on the image bitrate, the value of a pixel ranges from a minimum value to a maximum value. The higher the bit rate, the more information can be stored in the image. The sensor captures each image in RAW format, and either saves the RAW or converts it to a more common format (usually through compression). The Survey3 camera captures 12-bit RAW photos per RGB channel, then converts to 16-bit, which means pixel values range from 0 to 65,535. When the camera saves an 8-bit JPG, it compresses (removes) the pixels, leaving only the 0 to 255 range. Since we are capturing the reflectivity of light rather than trying to make a "pretty picture", we want to always use RAW format if possible. If you need JPG, you can easily convert RAW to TIFF to JPG using MAPIR Camera Control (MCC) (see below).
It's also important to make sure you adjust your camera settings (shutter speed, ISO, EV) to ensure no pixels are at their maximum pixel value. If the pixels are generally higher than the maximum value, information will be lost. You may notice that images from the Survey3 camera appear dark. This is normal because we set the default to prevent the pixels from maxing out. Remember, you are capturing the reflectance percentage, not making a "pretty picture".
This brings us to calibration. Just because we're capturing a certain percentage of reflectance in each pixel, how do we know it's correct? Then we need something to calibrate each pixel with a known reflectance value. To do this, we take pictures of our MAPIR camera reflectance calibration ground target pack prior to each survey, which contains 4 targets that have been measured in incremental wavelengths by a spectrometer (a calibrated laboratory instrument). The pixel values of the captured image of the target are then compared to the known reflectance value of the target. Using this information in MAPIR Camera Control (MCC) and MAPIR Cloud, we then convert pixel values into albedo values.
The Normalized Difference Vegetation Index (NDVI), the most common analysis, compares reflected red/orange and near-infrared (NIR) light to assess where plants are most "healthy". We hypothesize that given a sample area of a single crop, plants that reflect more NIR light will perform more photosynthesis and thus be healthier (and vice versa). If a plant area has a higher NDVI value, the plants there are likely to be healthier. No matter what index analysis you perform, you must also perform a physical inspection of the subject area to verify your results, a process often referred to as "ground truthing."
Before calibrating, you will need to move images that are not part of the main survey into a separate folder. If you have any extra images before the first survey waypoint or after the last waypoint, you will need to move them into this separate folder. If you have any images taken on the ground, including images with calibration targets in them, you will also need to put them into a separate folder. The images in the main folder should only contain images of your subject/survey area. This helps to improve the contrast of the resulting calibration image.
To start calibration, open MAPIR Camera Control (MCC) and click on the Calibration tab:
In order for the pixel data to be scaled the same, you need to load all cameras into the calibration window to be calibrated. For example, if you want to calibrate Survey3W_RGN with a Survey3W_NGB camera, you can select the camera model, lens and filter for both cameras as follows:
If you took an image of the MAPIR Camera Reflectance Calibration Ground Target Package prior to the survey (recommended), click the first browse button and select the QR target image. Then click the "Generate Calibration Values" button next to the browse button. When the software detects the QR target, the dialog box on the right will prompt you whether it was successful or not. Do this for each camera you are calibrating.
If no image can be used to detect the QR code, the program will automatically use the hardcoded values we provide, which were taken on a clear sunny day. There may be slight inaccuracies if using hardcoded values, so make sure to take some good images of the target shortly before surveying for best results.
After the software has obtained the necessary calibration values for each camera, click the browse button for each camera below the Generate Calibration Values button to select the input image directory for that camera. You're browsing a folder, not individual images, so you won't see images in the input folder browser. Calibration will calibrate all images in all input folders, so make sure there aren't any unwanted images in there. It is usually best to clean up the input folder by deleting all unnecessary photos or moving all photos to another folder, such as photos taken by the camera before and after the main survey. Then press the calibration button at the bottom of the window to calibrate. The program may freeze and become unresponsive while calibrating, this is normal.
A Calibrated_1 folder will automatically be created in the input folder of the calibrated images. If you wish to convert calibrated TIFF to JPG, please check the "Convert calibrated TIFF to JPG" box before pressing the calibrate button.
Each pixel in the image now represents the reflectance percentage of the captured area. They may be quite dark, but don't worry that's normal. Remember that you are capturing albedo information, not pretty pictures.
Once you calibrated each photo, you now need to upload the images to the software of your choice to generate an orthomosaic image.
Open MAPIR Camera Control (MCC) and click on the Viewer tab at the top. The viewer allows you to view images that are usually too dark to be seen in other photo viewers. You can view and transform individual images directly from the camera or from a stitched ortho-mosaic. Clicking the "Browse" button opens a TIFF image previously converted from RAW in MCC's "Processing" tab (you can also open a JPG in the viewer).
Here is an uncalibrated TIFF image taken with a Survey3W RGN camera over a winery (grapes):
In this RGN camera model, reflected red light is captured in the image's red channel, while reflected near-infrared (NIR) light is predominantly in the image's blue channel.
If you want to split the image into its RGB channels, here's the red channel (left/top) and the blue channel (right/bottom):
The white/gray rows are vines, which appear gray in the red channel and white in the blue channel. Pixel values range from black (no reflection) to white (full reflection). Plants reflect a lot of NIR light during photosynthesis, which is why the blue NIR channel shows plants as white and the ground as black. We haven't calibrated the image yet, so let's do that now:
Under the Calibrate tab in MCC, load the photos of our camera calibration plate set, also selecting the folder with the TIFF images on the grapes. Click the Generate Values button, then click Calibrate at the bottom:
Back in the Viewer tab, browse the calibration photo:
Note that the image is much less green overall, which is a consequence of the calibration. The other is that the index values are now properly calibrated, let's see that next.
Click the Calculate Index button to display the raster calculator. Let's choose the NDVI index for this tutorial. NIR light is primarily stored in the blue image channel, so change the Y dropdown to @Band3 (the blue channel). The X dropdown should be @Band1(Red Channel) to represent the red image channel:
Click the Apply button and the image in the viewer will become black and white. This is an NDVI index image, with black pixels representing low index values and white pixels representing high values. You can see the range of pixel values to the right of the legend area. For the NDVI index, a low (black) pixel value means that the pixel has more red light reflected than the NIR, and therefore is not photosynthetically healthy vegetation. A high (white) pixel value is the opposite, it has more NIR light than red light and is usually healthy vegetation.
As you can see, the pixels of the image range from -0.36 to 0.44. When using the NDVI formula, vegetation usually has an NDVI value between 0.2 and 0.9. Now let's add some color so we can better see the contrast between the ground and the plants, and the plants themselves.
Click the Configure LUT button to display the Color Mapping (LUT) window. Let's choose Lut: RrYyGg, Classes: 7 Colors and Clip: Background Grayscale. Click the "Apply" button:
Looking back at the main viewer screen, you can see that the index image is now colored according to your lut:
In the still open Color Mapping (LUT) window, you'll notice that there are editable values for the Min and Max pixel values. These values represent the range of pixel values over which to apply the color based on the selected clip. Here are the clipping options:
Solid Color: This option takes the color in the end lut and sets all pixels outside the min/max pixel range to the lut's min and max colors.
Transparent: This option makes all pixels outside the min/max range transparent (see-through). This is useful when overlaying images on top of each other, such as a composite image with an RGB image base layer and only the vegetation colored according to the lut.
Background Grayscale: This option sets the pixels within the min/max range with the color lut and pixels outside to the same grayscale of the indexed image.
Background Original: This option sets the min/max inside pixels to have the color lut, and sets those pixels outside the original image.
Going back to our example, let's change the min to 0, and the cropping to "Background Original" so we can see the lut color only NDVI indexed pixels from 0 to 0.44, and then display the original image among others:
You can then click the "Save" button to save this lut image.
Contact: Sam Lan
Phone: 13358250301
E-mail: sales@mputek.com
Whatsapp:+8613358250301
Add: 4th Floor,No.43,Section C,Software Park,Fuzhou,350003
We chat