...
The Lens Distortion Correction tool is a DevWare DevWareX plug-in. It is intended for use with the MT9V126, MT9V128, and ASX343AT System on Chip (SOC).
The Distortion Correction tool can be used to generate Distortion Correction configuration settings for wide angle lens sensor module. It provides:
...
- To start the Distortion Correction tool GUI window, follow the following steps are:
Run DevWareDevWareX, go to the main menu->Plug-ins-> Lens Distortion Correction Tools (Ver 2.0), DeWarp) Tools and the Lens Distortion Correction (DeWarp) Tools dialog is shown as follows:
Fig. 1 Distortion Correction DevWare DevWareX Plug-in
The tool can operate in one of two modes: MT9V126 SOC Hardware or Software Simulation. In MT9V126 SOC Hardware mode the process of correcting the lens distortion and adjusting the perspective of the image are done by the system hardware. In the Software Simulation mode, these processes are done by a simulation of the system hardware by DevWare. In order to operate in MT9V126 SOC Hardware an Aptina Imaging Demo camera has to be installed connected to your computer.
When selecting one of these modes, DevWare DevWareX will automatically switch the sensor to the output format which corresponds with your selected mode. For MT9V126 SOC Hardware DevWare DevWareX will set the sensor to output Dewarp+Overlay CCIR656 Interlaced image. For Software Simulation DevWare DevWareX will set the sensor to output 640x480 YCbCr/RGB Progressive image.
You can also change the sensor output mode directly by clicking the Control button in the DevWare DevWareX toolbar, which brings up the Sensor Control dialog. In there access Digital Video Output and make sure 640x480 YCbCr/RGB Progressive is selected if you want to apply Distortion Correction settings to Devware DevWareX software simulator, Or Dewarp+Overlay CCIR656 Interlaced if you want to apply the current Distortion Correction setting to sensor.
- In Software Simulation mode, the Distortion Correction output format can be specified via Format: in the Output Mode group. Three modes supported: NTSC, PAL and Progressive. In MT9V126 SOC Hardware the output format is determined by the sensor settings and it can be modified by the DevWare DevWareX sensor control pages.
- In Software Simulation mode the Distortion Correction effect can be seen more clearly by selecting Circle Overlay, ten circles with different image heights will be shown on the current frame sensor output, check Enable and you can see what will happen to those circles after Distortion Correction processing. Check Open picture-in-picture if you want to see both images before and after Distortion Correction at the same time. These options are available in Software Simulation mode only.
- The Distortion Correction Tool provides a default distortion correction setting for the Marshal wide angle lens. You can import a different setting by click Load Settings… or save the current settings for later use by click Save Settings…
- Use Save Data... to save only the Calibration Data. On the Timiing, you can use Write to INI file... to save all settings in a DevWareX INI file format.
You can find default settings which come with the tool in the folder
<installation-path>\Plugins\Default Lens Correction
You can apply the current Distortion Correction tool setting to either the software simulator or to the sensor by clicking the corresponding radio box at the bottom of Distortion Correction Tools, and then click on Apply button. If Software Simulation is selected, make sure Enable gets checked so that the new Distortion Correction setting can take effect in the Devware DevWareX display window.
Anchor | ||||
---|---|---|---|---|
|
...
Computer with two monitors with each monitor on a separate table are required, one is for displaying target images and the other is for Devware DevWareX operations. Two tables should be used in order to minimize the table vibration during image capturing. The vibration needs to be less than 1 pixel in the sensor.
Other hardware includes Demo2 system with fine adjustment for height control and SOC 360 or MI360 with a wide angle lens mount.
The key issues to consider are [1]:
The monitor must be normal to the optical bench (no tilt)
The camera must be parallel to the monitor
An accurate measurement of the optical center of the lens is very important; the Cross-Hair image target can be used for this purpose.
An accurate flat-fielding of the image, make sure the experiment setup is not touched during image capturing.
The illumination of the room can be controlled ( lights need to be turned off during data collections)
...
- Click on Load Crosshair Target button, the cross-hair target image will be displayed on one of the monitors, double click to maximize the image.
- Adjust lens focus; adjust camera height so that the image of the crosshairs shows up as straight lines at the center (co-ordinates [319,239]) of the Devware DevWareX display. If it is not possible to adjust the camera so that the straight –lines line up the center of the display, then the optical center of the lens is not at the center of the sensor. Record the values of the horizontal and vertical co-ordinates where the cross-hair lines are straight (from Devware) and enter them in the Horizontal and Vertical edit boxes respectively, click on Capture Crosshair Target button.
- Click on Load Flatfield Target button, double click to maximize the image.
- Adjust Devware DevWareX gains and exposure so that the average intensity in the image is around 200 digital counts and no part of the image is saturated. To check the average digital count, draw a graph through a column / row near the center of the image. Make sure aperture correction is disabled in Devware. Click on Capture Flatfield Target button.
- Click on Load Scene Target button, double click to maximize the image
- Click on Capture Scene Target button.
- Click on Calibrate Button to initiate the distortion measurements.
...
Anchor | ||||
---|---|---|---|---|
|
Anchor | ||||
---|---|---|---|---|
|
You may import lens calibration data from an outside text file which may have been saved earlier. The Distortion Correction tool comes with default settings for certain lenses, and the files can be found in the folder <installation-path>\Plugins\Default Lens Correction where <installation-path> is the directory you chose to install the DevSuite in.
The text file has the following format:
Coxccoyc
Xxxx xxxx (float point value)
rScene rSensor (in the unit of pixel numbers)
xxxxxxxx
xxxxxxxx
example:
coxc coyc
286 154
rScene rSensor
0 0
25 42
45 72
68 106
94 142
121 175
148 203
176 226
207 248
246 269
295 289
355 307
423 321
503 334
610 370
658 370
706 370
754 370
802 370
Loaded calibration data will be plotted in the distortion curve graph on Lens Calibration Tool page. See Figure 6.
Fig. 6 Import calibration data from a text file
Lens calibration data generated by the Lens Calibration Tool page will be exported to the Distortion Correction page automatically.
...
This tool is designed to help the user fine tune the Distortion Correction setting provided a lens distortion profile is already known. Three curves are plotted in the graph at the upper-left corner of the Distortion Correction page. The green one is the given lens distortion curve which is used as a reference for further fine tuning. Ten control points are exposed to the user: 40, 80,…,800 (radius in the Distortion Corrected image, in the unit of pixels). The user may either move the slider or enter a desired value in the edit box and then enter a space key, all those operations will cause the Desired Gain blue curve to change. Keep adjusting the blue curve until the Fitted Gain red curve matches your expectation.
The big red dot at coordinates (240,240) is an anchor point which the red curve should pass through.
Distortion Correction center horizontal (vertical) coordinate can be specified in Distortion Correction Center Horizontal (Vertical) edit box.
Perspective Correction can be enabled and disabled during Distortion Correction fine tuning process.
Two curve fitting options are available: manual and automatic, if the user selects Automatic, all the control points within Maximum Radius will participate Fitted Gain curve computation. You can decide how many control points are needed for Fitted Gain derivation by selecting Manual and enter a desired value in Maximum Radius edit box (recommend entering 800).
The user may move all the sliders up (down) by a scaling factor, for example if you enter 1.1, and then click on Scaling Factor button, all the new slider values will be 1.1 times of the current values.
Fig. 7 Distortion Correction Page
...
Keystone correction is a useful technology in scenarios where the camera can not be mounted directly in front of the ROI (region of interest) of the scene. This tool allows user to define the keystone effect by eight parameters: Actual Angle, Actual Distance, Actual FOV, Virtual Angle, Virtual Distance, Virtual FOV, Virtual Shift and Virtual Aspect.
On the Perspective Correction page, the keystone effect is illustrated in Actual and Virtual Camera Position graph; both actual camera position (blue) and virtual camera position (green) are adjustable by moving sliders or entering desired values in the edit boxes. X perspective gain and Y perspective curves are plotted on the right part of this page in blue. Polynomial fitting results are plotted as red dotted curves.
Fig. 8 Perspective Correction Page
Anchor | ||||
---|---|---|---|---|
|
...
Timing
The Advanced tool gives Timing page allows the user the option to export and import the Distortion Correction configuration in several formatsto change buffer utilization. It also has various import/export functions.
Import/Export Dewarp Settings is an option which is useful for capturing and restoring the mathematical model of the lens distortion and perspective correction.
Write to INI File allows exporting the configuration into a presets file which can then be used in order to program the sensor using DevWare DevWareX Presets.
To Flash Image produces a binary file which is compatible with the SPI flash tool requirement for the Distortion Correction data.
Fig. 9 Perspective Correction Timing Page
Known Issues / Workarounds
...