The following table lists the so-called STATE variables implemented in the ApBase library, DevWare, and related software. STATE variables control the operation of the software, mainly the image processing. STATE variables can be set by commands or Python statements in initialization files, and by various APIs supported by the software such as the ApBase API, the DevWare COM interface, and the DevWare plug-in interface. The data type of a variable is either integer or string. (Non-integer numbers are string-valued for the purposes of the APIs.) Most variables have a corresponding control on the DevWare user interface (UI).
The ini file command to set a STATE variable is STATE= variable [(0 | 1)], value. The value is interpreted as an integer or a string according to the name of the variable.
"[(0 | 1)]" is the optional parameter for those STATE variables that on duplicated per-context; see below under "per-Context variables".
The Python functions to get and set STATE variables are apbase.getstate( variable ), and apbase.setstate( variable , value ). The return value from getstate() will be an integer or a string according to the specific variable. The data type of the value passed to setstate() must be int or str according to the variable.
It is possible to set a variable with a name of your choosing. The software will store the value, which can be retrieved later. This is useful with software extensions such as DevWare plug-ins and user-defined toolbars. For example, parameter values used by a plug-in could be set in ini files like native DevWare settings. The STATE= ini command will always create a string-valued variable if the variable is not yet defined. The Python setstate() function can create either a integer-valued or string-valued variable depending on the data type of the value parameter.
Note on per-Context variables; some ColorPipe variables are duplicated per-context - those are noted by "Duplicated per-context." in their description.
Their value can optionally be set per-context only via an INI file version; the format is STATE = variable (0 | 1), value.
For Python functions and through ApBase, the STATE value is set per the sensor's currently active context.
STATE Variable Name, Description | Value |
---|---|
Display Zoom Percent | 3 to 1600 (default = 100) |
Reset Image Fifo Reset the image FIFOs on the demo board. | 0 or 1 |
Filter Note that the value(s) presented on the Data Interpretation page change depending on the output format in use. For example, Bayer as compared to YCBCR as compared to SuperCell - all will have a different list of possible Filter choices. The method of determining the state value is to use DevWare to set the output format that you're using, and then go to the "Data Interpretation" dialog in the "Control" dialog. For example, if your output format is Bayer, selecting a Filter state of "Bayer Grayscale" would be 3. Note; the set of Filters can be set via the "CFA Pattern" STATE command, listed below. | 0 to n |
Subimage Which subimage to display if there are more than one. 0 means main image, 1 means post-view image, 2 means thumbnail image. | 0, 1 or 2 |
Current Subimage Returns subimage is being displayed if there are more than one. 0 means main image, 1 means post-view image, 2 means thumbnail image. | 0, 1 or 2 |
Subimage Merge Whether to inset the subimage in the main image. | 0 or 1 |
X Offset | 0 or 1 |
Y Offset | 0 or 1 |
Auto Offset | 0 or 1 |
Gb-B Swap | 0 or 1 |
Byte Swap | 0 or 1 |
True Black Enable Enable black level (a.k.a. pedestal) subtraction from raw Bayer data. Corresponds to Subtract True Black controls on the Data Interpretation page. | 0 , 1 , or 2 (automatic) |
True Black Level Black level, as a fraction of the True Black Scale. Normally loaded automatically from sensor registers. Corresponds to True Black value on the Data Interpretation page. | Integer |
True Black Scale | Integer |
Active True Black Black level scaled to the decompressed image depth. | Integer |
ALTM Enable Duplicated per-context. | 0 or 1 |
ALTM Min Percent Duplicated per-context. | double float |
ALTM Peak Percent Duplicated per-context. | double float |
ALTM Sharp S Duplicated per-context. | double float |
ALTM Lo Gamma Duplicated per-context. | double float |
ALTM Hi Gamma Duplicated per-context. | double float |
ALTM Min Factor Duplicated per-context. | double float |
ALTM Dark Floor Duplicated per-context. | Integer |
ALTM Smooth Level Duplicated per-context. | double float |
BitDepth Decomp The decompressed image depth. | Integer |
Compress Image data compression, usually of mono or Bayer data. 0 means no compression, 1 means MIPI compression with simple predictor, 2 means a-Law, 3 means companding, 4 means MIPI compression with advanced predictor, 5 means MIPI packing. | 0 to 5 |
Companding Bits_in [in_knee_point_1 in_knee_point_2 in_knee_point_n] Bits_out [out_knee_point_1 out_knee_point_2 out_knee_point_n]
Issuing the STATE command with no data will reset/disable the custom companding table. Example: STATE = Companding, 12 [2048 3040 4000] 20 [2048 65536 1048576] | string |
Deinterlace Mode | 0, 1, 2 or 3 |
Descramble Mode Descramble imager data from AR1011, AR1411. | 0 or 1 |
Special Pixel Mode Remove special pixels from image for AR1011, AR1411. | 0 or 1 |
Trigger Width Set the trigger width for AR1011, AR1411. | Integer |
Active Area Crop Crop dark rows and columns on AR1011, AR1411. | 0 or 1 |
AI Repack Arrange image data in to grid of images for array imagers. | 0 or 1 |
Auto Luma Range | 0 or 1 |
Luma Lo | 0 to 255 |
Luma Hi | 0 to 255 |
Dynamic Range LSB | Integer |
Dynamic Range MSB The most significant bit of the input data to use when limiting the dynamic range used in the image processing. | Integer |
Unswizzle Mode | 0, 1, 2 or 3 |
Orientation Re-orient the output image. 0 means do nothing, 1 means horizontal mirror, 2 means vertical flip, 3 means rotate 180°. | 0, 1, 2 or 3 |
Output Channel | 0, 1, 2 or 3 |
Output BwColor | 0 or 1 |
Color Correction Duplicated per-context. | 0 or 1 |
Gamma Correction Duplicated per-context. | 1 to 125 (default = 45) |
Black Correct Duplicated per-context. | 0 to 20 |
Gamma Table Reset Reset the custom gamma table. | 1 |
Gamma Table Select Select the custom gamma table or the gamma table generated from Gamma Correction and Black Correct settings. Setting this to 1 selects the custom table, so Gamma Correction and Black Correct have no effect. | 0 or 1 |
Gamma Table Add or change an entry in the custom gamma table. The parameters are two integers, the input value and output value. | Input output |
Contrast | 20 to 40 (default = 25) |
Saturation Duplicated per-context. | 0 to 20 |
Aperture Enable Duplicated per-context. | 0 or 1 |
Aperture Duplicated per-context. | -4 to 16 |
All HW Gain | String (read-only) |
All Global Gain | String (read-only) |
Software Gain | 1000 to 100000 (default = 1000) |
Minimum Global Gain Limit analog gain. Gain * 1000. Corresponds to Analog Gain control on Exposure page. | Default = 1000 |
Show Min Gain As 1 | 0 or 1 |
Gain Table Reset Reset the custom gain table. | 1 |
Gain Table Select Select the custom gain table tuning registers defined by the "Gain Table" STATE setting. Setting this to 1 selects the custom table. | 0 or 1 |
Gain Table | "gain" = double float |
Master Clock | Integer |
Detect Master Clock | 1 |
Pixel Clock Polarity | 0 (falling) or 1 (rising) |
Pixel Clock Get and Set the Pixel Out clock, in Hz. | Integer |
Input Clock Get and Set the Input clock, in Hz. Corresponds to the XMCLK value in the baseboard (Demo2X or Demo3) value in Sensor Control / Diagnostics. | Integer |
Die Temperature Get the temperature value; only applies to sensors that have that feature. | String (read-only) |
Auto Exposure | 0 or 1 |
Auto Exposure Target | 1 to 100 (default = 50) |
Auto Exposure Stability | 0 to 40 (default = 5) |
Auto Exposure Speed | Default = 30 |
Auto Exposure Minimum FPS | 0 to 30 |
Auto Exposure Flicker Filter | 0, 50 or 60 |
Auto Exposure Soft Limit | Integer (default = 33) |
Auto Exposure Soft Gain Limit | 10 to 100 (default = 40) |
Auto Exposure Software Gain Limit | 10 to 150 (default = 100) |
Auto Exposure Gain Limit | integer |
Auto Exposure Minimum Gain | integer |
Auto Exposure Minimum Global Gain | integer (usually default = 10, meaning 1.0X gain) |
Auto Exposure Global Gain Limit Set the maximum global hardware gain that the AE will use * 10. Non-HDR modes. | integer |
Auto Exposure Gain Limit HDR Set the maximum per-channel hardware gain that AE will use * 10. HDR modes. | integer |
Auto Exposure Minimum Gain HDR Set the minimum per-channel hardware gain that AE will use * 10. HDR modes. | integer |
Auto Exposure Minimum Global Gain HDR Set the minimum global hardware gain that the AE will use * 10. HDR modes. | integer |
Auto Exposure Global Gain Limit HDR Set the maximum global hardware gain that the AE will use * 10. HDR modes. | integer |
Auto Exposure Post HDR Gain Limit Set the the post-HDR gain limit variable that the AE will use * 10. HDR modes. | integer |
Auto Exposure Freeze Gains | 0 or 1 |
Auto Exposure Fade Saturation | 0 or 1 |
Auto Exposure Fade Aperture | 0 or 1 |
Auto Exposure Fade Target | 0 or 1 |
Auto Exposure Image Y Read-only. Calculated exposure from embedded histogram. | integer |
HDR AE Mode Rule for HDR autoexposure. | 0, 1, 2, 3, or 4 |
HDR Gamma Correction Duplicated per-context. | 1 to 125 (default = 45) |
HDR Contrast Duplicated per-context. | 20 to 40 (default = 25) |
HDR Black Correct Duplicated per-context. | 0 to 20 |
HDR AE Scene Brightness Coeff A Coeff for controlling HDR scene brightness. | float (default to 1.0) |
HDR AE Histogram Y Read-only. Calculated luma from embedded histogram. | float |
Num Exposures HDR Manually set the number of interleaved exposures. This is calculated automatically when an supported sensor is detected. Otherwise the STATE variable can be used to set this parameter. | integer |
Linearize HDR When the sensor outputs multiple exposures for HDR separately, combine them into a single linear image. | 0 or 1 |
MEC Mode 9 = Weighted Channel Combination with Color Channel Check | Mode |
MEC Clip 1 MEC Clip 2 MEC Clip 3 MEC Clip 4 Top of range for given exposure (1 thru 4). | integer |
MEC T1_S3 | integer |
MEC Linebuffer use line buffer (data from previous row) to get other color pixels. | 0 or 1 |
MEC SC Color Th2 MEC SC Color Th3 MEC SC Color Th4 Smooth Combination region Th threshold. | integer |
Lens Correction Enable | 0 or 1 |
Lens Correction Falloff | 1 to 100 (default = 100) |
Lens Correction Coeff Prec | 7 to 16 (default = 16) |
Lens Correction Center X | Pixel coordinate |
Lens Center Overlay | 0 or 1 |
Lens Center Red X | Pixel coordinates |
Lens Sim Sensor | mi_sensor_types (midlib.h) A-2010SOCJ = 16 |
Lens Sim Sensor Rev | Integer |
Lens Sim Enable Pwq | 0 or 1 |
Lens Sim Enable Poly | 0 or 1 |
Noise Removal | 0, 1, 2, 4, or combination |
Noise Removal Level | Integer (default = 25) |
Defect Enable | 0 or 1 |
Defect Max | Integer (default = 1000) |
Defect Auto Defect Correction | 0 |
Optical Black The software can do black level adjustment if black row and/or black column readout is enabled on the sensor. 1 enables global black level calculation and subtraction. 2 enables column-wise black level correction (based on black rows). 4 enables row-wise black level correction (based on black columns). | 0, 1, 2, 4 or combination |
Optical Black Level Rect If Optical Black is 1 then use this rectangle to calculate the black level. | Four integers defining a rectangle; x1, y1, x2, y2 |
Optical Black 1 Row Start Optical Black 1 Row End Optical Black 2 Row Start Optical Black 2 Row End Optical Black 1 Column Start Optical Black 1 Column End Optical Black 2 Column Start Optical Black 2 Column End Identify the optical black rows and black columns in the image, for use by the optical black correction algorithms. Two sets of black rows can be defined (usually at the top and bottom of the image), and two sets of black columns can be defined (usually at the left and right of the image). This only applies if the black rows or black columns readout is enabled on the sensor. | integer |
Update Sensor FPS | 1 |
Allow Update Sensor FPS | 0 or 1 |
Allow FAR Access For the mobile ISP products (MT9F311, AP1301, AP1302), it is required to only allow addresses that return an ACK when accessed (known-good addresses). Use a value >1 will add that address to the known-good address list. | 0 = allow known addresses |
sRGB Color Standard | 0 or 1 |
White Balance Duplicated per-context. | 0, 1, 2, or 3 |
WB Speed | Integer |
WB Adjust Gains | 0 or 1 |
WB Apply Gains to CCM | 0 or 1 |
WB Current Duplicated per-context. | 9 floating-point values |
Relative Red Gain | 500 to 5000 |
Relative Blue Gain | 500 to 5000 |
WB Manual Position Duplicated per-context. | 0 to 100 |
WB Manual RedGreen Duplicated per-context. | 1 to 200 (default = 100) |
WB Manual BlueGreen Duplicated per-context. | 1 to 200 (default = 100) |
WB Custom Duplicated per-context. | Matrix (default = |
AWB Incandescent | Matrix |
AWB Middle Color correction matrix corresponding to intermediate illumination. Specify all nine values in row major order in floating point. | Matrix |
AWB Sun | Matrix |
AWB Incandescent Gain | Two floating point values |
AWB Middle Gain Color correction red/green and blue/green gain values corresponding to intermediate illumination. Specify two values in floating point. | Two floating point values |
AWB Sun Gain | Two floating point values |
AWB Incandescent Temp Temperature value for the left (incandescent) illumination CCM. Note: no range checking is performed between the 3 AWB Temp states. | Temperature in K |
AWB Middle Temp Temperature value for the intermediate illumination CCM. Note: no range checking is performed between the 3 AWB Temp states. | Temperature in K |
AWB Sun Temp Temperature value for the right (sun) illumination CCM. Note: no range checking is performed between the 3 AWB Temp states. | Temperature in K |
CFA Pattern Note: once set, the list of individual filters available for the given pattern can be seen in DevWareX's "Data Interpretation" dialog and can be selected via the "Filter" STATE command. | 0 to 10 |
CFA Labels Returns the currently active channel names. Based on CFA and Bayer patterns. See "Filter" and "CFA Pattern" for additional information. | string (read only). |
Monochrome | 0 or 1 |
Pure Raw JPEG | 0 or 1 |
Still Mode | 0, 1 or 4 |
Still Hold | 0 or 1 |
Num Capture Frames | 1 or more |
Still Capture Average | 0 or 1 |
Still Capture Timeout | Integer |
Delay before snap | Integer |
Still Global Reset | 0 or 1 |
Still FileName Increment or Capture FileName Increment Set whether to have the integer added to the end of the file name incremented each time a Still or Capture operation is performed. | 0 or 1 |
Still File or Capture File A string representing the path and base-name of the file to store a Still or Capture image. It is assumed the path is valid. | string |
Still Saved Files Returns a list of filenames from the last grab. | string (read-only) |
Flash Lamp | 0, 1 or 2 |
WB Custom Xenon | Matrix |
WB Xenon Red Gain | 500 to 5000 |
WB Custom Led | Matrix |
WB Led Red Gain | 500 to 5000 |
Mechanical Shutter Same | 0 or 1 |
Mechanical Shutter Time | microseconds |
Mechanical Shutter Delay | microseconds |
Save RAW | 0 or 1 |
Save RAW TIFF | 0 or 1 |
Save ITX | 0 or 1 |
Save CCR | 0 or 1 |
Save DXR | 0 or 1 |
Save RAW JPEG | 0 or 1 |
Save RAW PNG | 0 or 1 |
Save HEX | 0 or 1 |
Save 24bpp BMP | 0 or 1 |
Save BMP Info | 0 or 1 |
Save 48bpp COLOR TIFF | 0 or 1 |
ICC Profile | 0 or 1 |
Save PNG | 0 or 1 |
Save JPEG | 0 or 1 |
JPEG Quality (1-100) | 0 to 100 |
Save SS Save the status structure from the end of the image data (ICP-HD, AP1300, etc) in a separate file. | 0 or 1 |
Save Selection Rectangle | 0 or 1 |
Save TXT | 0 or 1 |
VidCap Format | 0, 1, or 2 |
VidCap Play FPS | fps * 1000 |
VidCap Auto Play FPS | 0 or 1 |
VidCap Packed Save RAW video as packed or not packed. | 0 or 1 |
VidCap Quality Set the compression rate for WMV recording. | 0 to 100 |
Video Screen Capture | 0 or 1 |
VidCap File | filename |
VidCap Filename Increment | 0 or 1 |
RAM Capture | 0 or 1 |
RAM Capture MB | Integer |
RAM Capture Cycle | 0 = flush and continue |
Sensor Orientation The orientation of the sensor image. 0 means upright, 1 means horizontally mirrored, 2 means vertically flipped, 3 means rotated 180°. | 0, 1, 2 or 3 |
Pixel Clock Polarity | 0 or 1 |
Sensor Power | 0 or 1 |
Sensor Reset | 0 or 1 |
Sensor Shutdown | 0 or 1 |
SHiP Speed | 100, 400, or 1000 |
Direct VAR Access | 0 or 1 |
RX Type | 0 to 4 |
RX Lanes Calls the midlib function setMode() MI_RX_LANES. Sets the number of data lanes between the sensor and the main board. | Integer |
RX BitDepth Calls the midlib function setMode() MI_RX_BIT_DEPTH. Sets the serial bit depth between the sensor and the main board. | Integer |
RX Mode Calls the midlib function setMode() MI_RX_MODE. Sets the HiSPI mode. | 0 to 3 |
RX Class Calls the midlib function setMode() MI_RX_CLASS. Sets the CCP class. | Integer |
RX Sync Code Calls the midlib function setMode() MI_RX_SYNC_CODE. Sets the HiSPI sync codes. | Integer |
RX Embedded Data Calls the midlib function setMode() MI_RX_EMBEDDED_DATA. Sets whether embedded data will be sent over the serial link. | 0 or 1 |
RX Virtual Channel Calls the midlib function setMode() MI_RX_VIRTUAL_CHANNEL. Sets the MIPI virtual channel. | Integer |
RX MSB First Calls the midlib function setMode() MI_RX_MSB_FIRST. Sets the bit order for HiSPI transmission. | 0 or 1 |
RX CCIR656 Calls the midlib function setMode() MI_RX_CCIR656. Sets whether the main board should interpret CCIR656 sync codes. | 0 or 1 |
Interlaced Image Calls the midlib function setMode() MI_RX_INTERLACED. Set whether the image from the sensor is interlaced. | 0 or 1 |
HW Red Gain | Floating-point value |
HW Green1 Gain | Floating-point value |
HW Green2 Gain | Floating-point value |
HW Blue Gain | Floating-point value |
HW Gain | Floating-point value |
HW Global Gain Not really a software variable, this sets the global gain register on the sensor, for those sensors with a separate gain that affects all color channels, given a floating point gain value. | Floating-point value |
HW Exposure Time | Floating-point value |
HW Exposure Index If there is an exposure table already defined by STATE= Exposure Table commands, then STATE= Exposure Index writes the register values in the table associated with the given index (the index is the first number in each table entry), or the closest index to the given index. If no exposure table is define or active then the command does nothing. | Integer |
Exposure Table STATE= Exposure Table, index; reg0 data0; reg1 data1; .... | Integer |
Exposure Table Select Select whether to use the built-in logic for converting exposure register values or use the user-defined exposure table. Table 0 is no table, tables 1 ... 8 are user-defined. | Integer |
Exposure Table Reset Reset the exposure table to empty. Table 0 is no table, tables 1 ... 8 are user-defined. | Integer |
All Exposure Index Returns a list of all indexes in the table. | String (read-only) |
Calculate Focus | 0 or 1 |
Calculate Focus Overlay | 0 or 1 |
Focus | Integer |
Noise Image Type Which image data to use in the noise measurement. 0 means raw data, treated as Bayer, 1 means raw data treated as monochrome, 2 means processed RGB data, 3 means both raw and RGB data. | 0 to 3 |
Noise Frames How many frames to include in the noise measurement. | Integer |
Noise Defects Number of worst rows or worst columns to consider in the deviation of worst rows/columns and noise of worst rows/columns reports. | Integer |
Delay Noise Measurement How many frames to skip before beginning noise measurement. | Integer |
Begin Noise Measurement Set to 1 to trigger noise measurement. Delay Noise Measurement frames will be skipped, then Noise Frames frames will be used to generate the noise measurement. This variable returns back to 0 automatically when the noise measurement is completed. | 0 or 1 |
Noise Measurement Results After the noise measurement is completed, this is the results as a table of ASCII data. | String (read-only) |
Noise Results JSON d = ap_GetStateStr(apbasedev, b'Noise Results JSON') | String (read-only) |
Copy to Clipboard When set, the next frame will be copied to the clipboard. Automatically returns to 0. | 0 or 1 |
Send to Viewer | 0 or 1 |
Product Variant Also, if the string matches a known "CFA Pattern", that Color Filter Array will be enabled. Note: only use the string value in quotes - the numbers listed after the string are supplied as a cross-reference to their associated "CFA Pattern" STATE command values. | String |
VisNIR Control the plug-in via from INI file presets, which in turn can be assigned to shortcut keys. | "invoke" = invoke pipeline "live" = show live images "rgb" = show processed RGB images "nir" = shows processed NIR images |
RGBIR Denoise You can increase the frame rate substantially by turning off the IR noise filtering. There is some image quality loss, but you can judge the trade-off. | 0 or 1 |
RGBIR Linearized HDR Perform IR subtraction when 1. When 0 and subimage is PostView ("Current Subimage" == 1). Default is 0. | 0 or 1 |
RGBIR CCN Matrix generated by SensorTune. | N/A |
RGBIR Denoise When 1, perform the Denoise function. When 0, do not. Default 0. | 0 or 1 |
RGBIR Sat Pixel Threshold Pixel saturation threshold. Default 85. | 0 to 100 |
User Text Top Left | string |
Hide Top Data Rows Show/Hide Embedded Data display on the image. | 0 or 1 |
Hide Bottom Data Rows Show/Hide Embedded Stats display on the image. | 0 or 1 |
DLO Noise Filter Set the state of the noise filter. | 0 = off 1 = linear formula 2 = quadratic formula |
DLO Noise Filter Threshold Set the threshold value; default is 132 | Integer |
DLO Noise Filter S1 Set Filter S1; default is 4 | Integer |
DLO Noise Filter S2 Set Filter S1; default is 132 | Integer |
PDAF Defocus Get the current Defocus number; the lens position relative to in-focus. Zero = in-focus. This signed integer, when added to the current lens actuator value, represents the in-focus lens position. It is normalized by divided by the Phase Difference Coefficient. | Integer |
PDAF Defocus Dev Get the current Defocus deviation; low number indicates little deviation. This signed integer represents the range of the defocus value. It is normalized by divided by the Phase Difference Coefficient. | Integer |
PDAF Phase Diff Ofs Get/set this tuning parameter offset to bring the defocus value to zero when the image is in-focus. double pdOfs = atof(GetStateStr("PDAF Phase Diff Ofs")); | Integer |
PDAF Phase Diff Coef Get/set this tuning parameter offset defocus value which indicates the lens actuator movement needed in actuator 'steps'. double pdCoef = atof(GetStateStr("PDAF Phase Diff Coef")); | Integer |
PDAF LPeak GPeak Ratio Get/set this tuning parameter for setting this ratio. double pd = atof(GetStateStr("PDAF LPeak GPeak Ratio")); Default is 1.08. | Floating-point value |
PDAF LPeak LMin Ratio Get/set this tuning parameter for setting this ratio. double pdCoef = atof(GetStateStr("PDAF LPeak LMin Ratio")); Default is 1.02. | Floating-point value |
0 Comments