NVIDIA Tegra
NVIDIA DRIVE OS 5.1 Linux SDK

Developer Guide
5.1.9.0 Release


 
Image Capture Calibrate (nvmimg_cc)
 
Command Switches
Script File
Script File Commands
I2C Device Commands
Comments
Example
Example of a Command
The NvMedia Capture Calibration sample demonstrates how to bring up or validate the camera sensor. It also demonstrates how to capture sensor data to raw files for camera calibration.
The sample application parses a script file containing I2C commands and sends them to the designated sensor(s). The sensor name must be specified in a command line switch.
Warning:
This sample program is meant to perform hardware bring-up of serializer/deserializer and sensor modules. Do not use it in production environments. It is not intended for performance on multiple cameras, stress testing, or testing of the start/stop of applications.
The sample application requires the user to provide command line input and a script file. The script file contains two sets of information:
Configuration parameters for programming the camera module (sensor, serializer), aggregator) using the I2C bus
CSI capture configurations used to program the Tegra CSI and Video Input (VI) modules
The CSI packets from the aggregator reach Video Input (VI) module and are saved to memory. The frames are displayed using Display Controller (DC) or saved to a file.
This diagram illustrates the process:
C:\sw\swdocs\mobile\tegra\images\nvmedia_nvmimgcc_overview.jpg
Command Switches
Note:
The nvmimg_cc application must be run with the root user to let it access the I2C bus and to program the camera module.
The command’s syntax is.
./nvmimg_cc -wrregs <script_filename> [switches]
Where <script_filename> is the name of the script file used by the application.
This table describes the application’s command line switches:
Switch
Description
Default Setting
--aggregate <n>
Creates an aggregated image from the captured frame of the size: (W×<n>)×H.
1
-b <n>
Number of buffers to use for the buffer pool.
Default: 3
Maximum: 600
-c <name>
Specifies the parameter set name.
N/A
-cf <filename>
Specifies the configuration file. Co-locate the file with nvmimg_cc.
N/A
--crystalF <frequency>
A crystal frequency, in megahertz, to be used for calculations.
24
-d <id>
Enables the display. If provided, uses the display with the specified ID.
If the option switch is omitted, disable display. If the option switch is used specified but <id> is omitted, use the first available display.
-f <file_prefix>
Saves each captured frame to a file. Each file starts with the specified prefix, concatenated with any calibration parameters and the frame index.
Frames are not saved to files.
-h
Print command line optionsswitches.
See also ‑sensor <name> ‑h.
N/A
--miniburst <n>
Saves <n> frames after each wait period. Valid when used with the -wait optionswitch.
1
-n <frames>
Number of frames to capture.
Unlimited
--nvraw
Saves frames in nvraw format. Valid for raw capture and when frames are saved using the -f optionswitch.
Frames are not saved in nvraw format.
-p <x:y:w:h>
Specifies the window position rectangle.
No positioning.
--pwr_ctrl-off
Disables power control.
N/A
-rdregs <filename>
Dumps the registers from the sensor to the specified file.
Registers are not saved to a file.
-s <frames>
Number of frames to skip after capture starts and before putting images onto the display or save queue.
0
-sensor <name>
Specifies the sensor name for sensor calibration. Valid names are are ar0231 ar0231 or  and ov10640.
N/A
‑sensor <name> ‑h
Displays calbration commands for a specified sensor.
-sensor ar0231 -h
-v <level>
Logging level. The value may be:
0 = Errors
1 = Warnings
2 = Info (including sensor calibration setting)
3 = Debug
If the option switch is omitted, 0. If the option switch is used specified but <level> is omitted, 3.
-w <id>
Uses the window with the specified ID for display.
0
--wait <n>
Waits for n frames before capturing the next frame(s).
Captures every frame.
-wrregs <filename>
Filename of the register script to write to the sensor.
N/A
-z <depth>
Specifies the depth for display.
0
Script File
A script file contains the following components:
Configuration parameters
I2C commands to program the camera sensor, deserializer and serializer
Additional commands used by the application
Script File Commands
The following sections describe the script file commands.
Required Script File Commands
This table describes script file commands that must be specified in the script file.
Parameter
Description
Valid Values and Examples
; Interface: <type>
Required. Capture interface.
"csi-a", "csi-b", "csi-c", "csi-d", "csi-e", "csi-f", “csi-g”, “csi-h” "csi-ab", "csi-cd", "csi-ef", "csi-gh", "trio-a", "trio-b", "trio-c", "trio-d", "trio-e", "trio-f", "trio-g", "trio-h", "trio-ab", "trio-cd", "trio-ef", "trio-gh"
; Input Format: <format>
Required. Input frame format.
422p, raw12, raw2x11, raw3x12, raw16log
; CSI Lanes: <n>
Required. Number of CSI lanes to use.
 
; Surface Format: <format>
Optional. CSI surface format.
yv16, rgb, raw8, raw10, raw12
; Resolution: <w>x<h>
Required. Input frame resolution.
Width, an ‘x’, and height.
Example: 640x480
; Pixel Order: <order>
Optional. Bayer pixel color order.
GRBG, GBRG, RGGB, BGGR (default)
; I2C Device: <n>
Required. I2C device to be used for configuring CSI device.
Example:0
; Sensor Address: <address>
Required. 8-bit device address of the sensor.
0x20: AR0231
; Deserializer Address: <address>
Optional. 8-bit address of the aggregator device.
0x52
Optional Script File Commands
This table describes commands that may be specified in the script file to define I2C command parameters.
Parameter
Description
Valid Values and Examples
; Delay <time><unit>
Optional. Delays the execution of the next line in the script by the provided time and unit.
Use ms for milliseconds, and us for microseconds.
; Delay 10us
; I2C <number>
Optional. Opens a new I2C handle with the specified device number. Subsequent I2C commands use this handle. If this command is used again, it closes the existing handle and opens a handle for the new I2C device.
; I2C 0
; Wait for frame <n>
 
; End frame <n> registers
Optional. Contain I2C commands to be sent to the device at a specified frame number.
; Wait for frame 4
60 30e6 02
; End Frame 4 registers
; Begin preset registers
 
; End preset registers
Optional. Contain I2C commands to be written before capture settings have been configured on the Tegra side.
; Begin preset registers
xx xxxx xx
yy yyyy yy
; End preset registers
# <comment>
Optional. Any line that begins with a ‘#’ is considered a comment.
Example:
# Revised
I2C Device Commands
I2C device commands are used in the “Wait for frame / end frame” and “Begin preset registers / End preset registers” commands, described above.
Each I2C command has this format:
<device> <register> <value>
Where:
<device> is the address of the device.
<register> is the address of the register to write to.
<value> is the value that will be written to the register.
<device> and <value> must be one-byte numbers in hexadecimal format. <register> may be either a one or two-byte number in hexadecimal format.
For example:
60 3013 01
Comments
A comment begins with a pound sign (a ‘#’). A comment may appear on a line of its own, or at the end of any script file configuration option.
Example
This is an example configuration for the NVIDIA DRIVE™ AGX Platform:
; Interface: csi-ab
; Input Format: raw12
; Resolution: 1280x1084
; CSI Lanes: 4
; I2C Device: 2
; Sensor Address: 0x60
; Max96712 Address: 0x90
Example of a Command
This example illustrates an nvimg_cc command and its output.
To capture RAW12 frames
This example shows how to capture RAW12 frames from the sensor AR0231 and display them on the screen on the CSI port AB. It is intended to be run on an NVIDIA DRIVE™ AGX Xavier platform, for which the board name is ddpx-a.
Run:
./nvmimg_cc -wrregs ddpx-a/dvp_m_ar0231_rccb_raw12_1920x1236_ab_ta.script -d 0 -w 1
The log looks like this:
root@tegra-ubuntu:/home/nvidia/drive-t186ref-linux/samples/nvmedia/img_cc# ./nvmimg_cc -wrregs ddpx-a/dvp_m_ar0231_rccb_raw12_1920x1236_ab_ta.script -d 0 -w 1
Used display - Display Info - Enabled:1 displayId:0 type:B306 size:1920x1080 refresh:60.000000 type:HDMI
Capturing Frames...
q
root@tegra-ubuntu:/home/nvidia/drive-t186ref-linux/samples/nvmedia/img_cc#