Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Anchor
_Toc365034198
_Toc365034198
Introduction


The ApBase library includes a software color processing pipeline. The color pipe is used in DevWare and other Aptina applications, and is available to 3rd party applications through the ApBase function ap_ColorPipe(). This document lists the processing stages, and how to configure and control them.


Anchor
_Toc365034199
_Toc365034199
Table of Contents


Block Diagram
Block Descriptions
DevWare Plug-in GrabFrame() Hook
Insert JPEG Header
Descramble
Deinterlace
YCbCr Column-wise Stereo Separation
Array Image Repacking
Bayer Decompression
DevWare Plug-in RawImageData() Hook
Multiple Exposure Combining
DevWare Plug-in LinearImageData() Hook
Normalize Bayer

Adaptive Local Tone Mapping
Clean JPEG

Optical Black
Auto-Exposure
Software Gain
Noise Removal
Lens Correction
Defect Correction
Local Green Balance
Noise Measurement
DevWare Plug-in ImageData() Hook
Auto-White Balance
Convert to RGB-48
Demosaic
Aperture Correction
Color Correction Matrix
Gamma Correction
Convert Original Pixel Type to RGB
ColorPipe Filter Plug-in
Digital Video Stabilization

Software Binning
Stereo Merge
Select Color Channel
Reorient
Noise Measurement
DevWare Plug-in ImageData() Hook
Auto-Focus
Calculate Focus Number
Embed Watch Data
Embed Overlays


Anchor
_Toc365034200
_Toc365034200
Block Diagram

The diagram below shows the image data path and each processing stage. The locations of DevWare plug-in hooks are also shown.




 


Anchor
_Toc365034201
_Toc365034201
Block Descriptions

Below are descriptions of the blocks and which STATE variables control each one. See also the State Variables document.


Anchor
_Toc365034202
_Toc365034202
DevWare Plug-in GrabFrame() Hook

Remarks
A DevWare plug-in implementing the GrabFrame() hook can process the image here.


Anchor
_Toc365034203
_Toc365034203
Insert JPEG Header

Remarks
If this is JPEG data and there is no header, the header is added here. In ApBase, this is done in the ap_GrabFrame() call.


Anchor
_Toc365034204
_Toc365034204
Descramble

Remarks
For AR1011, AR1411 or similar sensors, raw data, rearrange the pixels into the proper order and interpolate over special pixels.
STATE Variables


Descramble Mode

Enable this block.

Special Pixel Mode

Enable interpolating over special pixels.


Anchor
_Toc365034205
_Toc365034205
Deinterlace

Remarks
Interleave the scan lines of a two-field interlaced image. Only relevant to SOC or ISP output.
STATE Variables


Deinterlace Mode

Enable and select the row order.


Anchor
_Toc365034206
_Toc365034206
YCbCr Column-wise Stereo Separation

Remarks
For YCbCr column-wise stereo images (alternate pixels left, right), separate the stereo images.
STATE Variables


Stereo Colwise

Enable and select the image order.


Anchor
_Toc365034207
_Toc365034207
Array Image Repacking

Remarks
For data from and array imager, arrange the data into a grid of images.
STATE Variables


AI Repack

Enable.


Anchor
_Toc365034208
_Toc365034208
Bayer Decompression

Remarks
Decompress or linearize (e.g. decompand companded) imager data if needed.
STATE Variables


Compress

Select the compression type, SMIA DPCM, SMIA packing, a-Law, companding.

BitDepth Decomp

Pixel bit depth after decompression.


Anchor
RawImageData
RawImageData
DevWare Plug-in RawImageData() Hook

Remarks
A DevWare plug-in implementing the RawImageData() hook can process the image here. The image format can't be changed.

Anchor
MEC
MEC
Multiple Exposure Combining

Remarks
If the image consists of multiple separate exposures, then this block can combine the exposures into a single, linear HDR image.
STATE Variables

Linearize HDR

Enable combining multiple exposures.

Num Exposures HDR

Number of exposures, 1 ... 4

Ratio T1_T2The intended exposure ratio between T1 and T2, as an integer. Usually a power of 2.
Ratio T2_T3The intended exposure ratio between T2 and T3, as an integer. Usually a power of 2.
Ratio T3_T4The intended exposure ratio between T3 and T4, as an integer. Usually a power of 2.
Actual Ratio T1_T2The actual exposure ratio between T1 and T2, as a floating point string.
Actual Ratio T2_T3The actual exposure ratio between T2 and T3, as a floating point string.
Actual Ratio T3_T4The actual exposure ratio between T3 and T4, as a floating point string.

Anchor
LinearImageData
LinearImageData
DevWare Plug-in LinearImageData() Hook

Remarks
A DevWare plug-in implementing the LinearImageData() hook can process the image here. If there was no multiple exposure combining, then this data is the same as the RawImageData() hook. The image format can't be changed.

Anchor
Normalize
Normalize
Normalize Bayer

Remarks
Subtract black pedestal and rescale pixel data to 0…4095. (If raw data is less then 12 bits, then scale up to 12 bits. If raw data is more than 12 bits, then just use 12 of the bits and discard the rest, usually the 12 MSBs.) For all subsequent blocks, Bayer data is 12 bits with no pedestal.
STATE Variables

True Black Level

Data pedestal, proportional to True Black Scale (not to the image pixel depth).

True Black Scale

Indicates the scale of True Black Level. For example 1024 indicates 10-bit black level value.

Dynamic Range MSBIndicate the MSB of the raw data. Set to 31 for default processing.

Anchor
ALTM
ALTM
Adaptive Local Tone Mapping

Remarks
Use a sophisticated algorithm to reduce a deep HDR image (up to 20 bits per pixel) to 12 bits while preserving color bringing out dark areas. Subtract black pedestal. Pixel data range after this block is always 0…4095. For all subsequent blocks, Bayer data is 12 bits with no pedestal.
STATE Variables

ALTM Enable

Enable ALTM processing.


Anchor
_Toc365034211
_Toc365034211
Clean JPEG

Remarks
Remove CCP sync codes from JPEG data.
STATE Variables

Strip FSP

Enable.


Anchor
_Toc365034212
_Toc365034212
Optical Black

Remarks
Analyze dark rows and dark columns and correct the image rows and columns.
STATE Variables

Optical Black

Optical black processing options.

Optical Black Row Filter

Enable low-pass filtering in the vertical direction.

Optical Black 1 Row Start
Optical Black 1 Row End
Optical Black 2 Row Start
Optical Black 2 Row End

Define optical black rows in the image.

Optical Black 1 Column Start
Optical Black 1 Column End
Optical Black 2 Column Start
Optical Black 2 Column End

Define optical black columns in the image.


Anchor
_Toc365034213
_Toc365034213
Auto-Exposure

Remarks
Analyze image brightness and adjust sensor exposure and gain. (No change to the image.)
STATE Variables

Auto Exposure

Enable AE.

Auto Exposure Target

Target image brightness, percentage.

Auto Exposure Stability

Allowed deviation from target.

Auto Exposure Speed

Convergence speed

Auto Exposure Minimum FPS

Exposure limit

Auto Exposure Flicker Filter

Whether to limit exposure time to multiples of a flicker frequency.

Auto Exposure Soft Limit

Keep exposure below this limit unless gain exceeds soft limit.

Auto Exposure Soft Gain Limit

Keep gain below this limit if possible.

Auto Exposure Gain Limit

Maximum gain.

Auto Exposure Global Gain Limit

Maximum global gain, for sensors with global gain.

Auto Exposure Software Gain Limit

Maximum software gain.

Auto Exposure Freeze Gains

If set, don't adjust gain.

Auto Exposure Fade Saturation

If set, reduce saturation in low light.

Auto Exposure Fade Aperture

If set, reduce sharpening in low light.

Auto Exposure Fade Target

If set, reduce target level in low light.


Anchor
_Toc365034214
_Toc365034214
Software Gain

Remarks
Multiply all pixels by a gain value.
STATE Variables

Software Gain

Gain value ×1000.


Anchor
_Toc365034215
_Toc365034215
Noise Removal

Remarks
Run the various noise removal algorithms. Each algorithm can be enabled independently. The algorithms run in this order: Temporal, High/Low, Flat Region Filter, Adapting Average-Near, Clarity+.
STATE Variables

Noise Removal

Select which algorithm(s) to use.

Noise Removal Level

Aggressiveness of the noise removal.

Noise Removal Depth

Depth for temporal algorithm.


Anchor
_Toc365034216
_Toc365034216
Lens Correction

Remarks
Apply position-dependent gain to correct lens shading. This block can also do calibration. Calibrating lens correction hardware should be done with the LensCalib tool or lenscal.dll library.
STATE Variables

Lens Correction Enable

Apply lens correction.

Lens Correction Falloff

Allowed shading falloff for calibration.

Lens Correction Lens Radius

Radius in pixels of the area to calibrate.

Detect Lens Shading Req.

Do a software LC calibration.

Lens Curve Red
Lens Curve Green1
Lens Curve Green2
Lens Curve Blue

Lens shading curvatures from the calibration.


Anchor
_Toc365034217
_Toc365034217
Defect Correction

Remarks
Correct single-pixel defects.
STATE Variables

Defect Enable

Enable correction.

Defect Max

Size of defect buffer.

Defect Auto Defect Correction

Enable periodic recalibration.

Defect Detect Dirty

Trigger a new defect detection.

Defect Count

Number of defects detected.


Anchor
_Toc365034218
_Toc365034218
Local Green Balance

Remarks
Correct localized imbalances between Gr and Gb signals in Bayer images.
STATE Variables

Green Balance Enable

Enable green correction.

Green Balance Apos
Green Balance Bpos
Green Balance Aneg
Green Balance Bneg

Parameters for the algorithm.


Anchor
_Toc365034219
_Toc365034219
Noise Measurement

Remarks
The Bayer noise measurement happens here. (No change to the image.)
STATE Variables

Noise Image Type

Raw or RGB.

Noise Frames

Number of frames to analyze.

Begin Noise Measurement

Trigger noise measurements to begin.

Noise Measurement Results

Text of the results.


Anchor
_Toc365034220
_Toc365034220
DevWare Plug-in ImageData() Hook

Remarks
A DevWare plug-in implementing the ImageData() callback can process data here.

Anchor
_Toc365034221
_Toc365034221
Auto-White Balance

Remarks
Analyze the image and adjust the color correction matrix and possibly red and blue gains. (No change to the image.) Use the SensorTune tool to generate the AWB parameters.
STATE Variables

White Balance

Enable auto or manual white balance.

WB Speed

Convergence speed.

WB Adjust Gains

Whether to adjust gains on the device.

WB Manual Position

Adjustment position, 0 to 100

WB Manual RedGreen

Red gain applied to CCM

WB Manual BlueGreen

Blue gain applied to CCM

WB Interpolate Saturation

Apply saturation to CCM

WB Normalize Matrix

Normalize CCM

Relative Red Gain

Current red gain relative to green.

Relative Blue Gain

Current blue gain relative to green.


Anchor
_Toc365034222
_Toc365034222
Convert to RGB-48

Remarks
Conversion of the image to deep RGB is here if needed. The image is only saved to a file, not displayed, and no further processing is done to deep RGB images.

Anchor
_Toc365034223
_Toc365034223
Demosaic

Remarks
For Bayer data, run the selected demosaic algorithm (followed by aperture correction, color correction and gamma correction).
A Filter Plug-in can substitute its processing for the Demosaic, Aperture Correction, CCM and Gamma Correction stages (the Bayer to RGB conversion).

A 5x5 non-linear matrix is used for conversion.
STATE Variables

Filter

Select the demosaic algorithm.


Anchor
_Toc365034224
_Toc365034224
Aperture Correction

Remarks
Sharpening for Bayer images.
STATE Variables

Aperture Enable

Enable aperture correction.

Aperture

Degree of sharpening.


Anchor
_Toc365034225
_Toc365034225
Color Correction Matrix

Remarks
Multiply the interpolated RGB values by a 3x3 matrix. This mainly corrects for crosstalk.
STATE Variables

Color Correction

Apply the CCM.


Anchor
_Toc365034226
_Toc365034226
Gamma Correction

Remarks
Gamma table lookup on RGB data.
STATE Variables

Gamma Correction

The exponent of the correction curve to generate a gamma table.

Black Correct

Flatten the bottom of the curve of the generated gamma table.

Contrast

'S' curve applied to gamma curve.

Gamma Table ResetReset custom gamma table.
Gamma TableAdd or change an entry in the custom gamma table.
Gamma Table SelectSelect the custom gamma table or the generated table.


Anchor
_Toc365034227
_Toc365034227
Convert Original Pixel Type to RGB

Remarks
For non-Bayer data (YCbCr, JPEG, etc.), convert the pixels to RGB.
STATE Variables

Filter

Select the subroutine to convert the image from the camera pixel format to RGB.


Anchor
FilterPlugIn
FilterPlugIn
ColorPipe Filter Plug-in

Remarks
A DLL implementing the colorpipe Filter plug-in API can take over conversion of the raw data to RGB-32. This can be used for custom Demosaic, or other type of processing.
STATE Variables

Filter

Select the subroutine to convert the image from the camera pixel format to RGB. Plug-in filters will be among the choices.

Anchor
_Toc365034228
_Toc365034228
Digital Video Stabilization

Remarks
Perform the host-side portion of the digital video stabilization algorithm (shift the image). This relies on the hardware ISP to provide the shift amount.
STATE Variables

DVS Split Screen

Split screen demo.


Anchor
_Toc365034229
_Toc365034229
Software Binning

Remarks
Reduce the image size by an integer factor.
STATE Variables

Bin XBin Y

Bin factors.


Anchor
_Toc365034230
_Toc365034230
Stereo Merge

Remarks
Merge left and right images of a stereo pair into a single image.
STATE Variables

Stereo Merge

Merging mode.

Stereo Shift X Stereo Shift Y

Alignment correction.


Anchor
_Toc365034231
_Toc365034231
Select Color Channel

Remarks
Zero out all but one color channel. For diagnostics.
STATE Variables

Output Channel

Select a single color channel.

Output BwColor

Show in grayscale or color.


Anchor
_Toc365034232
_Toc365034232
Reorient

Remarks
Horizontally mirror and/or vertically flip the image. This can be used to correct an image file that was not captured in the upright orientation. On a live sensor you would normally set the sensor's flip and mirror controls.
STATE Variables

Orientation

Enable flip and/or mirror.


Anchor
_Toc365034233
_Toc365034233
Noise Measurement

Remarks
The RGB domain noise measurement is performed here. (No change to the image.)
STATE Variables

Noise Image Type

Raw or RGB..

Noise Frames

Number of frames to analyze.

Begin Noise Measurement

Trigger noise measurements to begin.

Noise Measurement Results

Text of the results.


Anchor
_Toc365034234
_Toc365034234
DevWare Plug-in ImageData() Hook

Remarks
DevWare plug-ins that implement the ImageData() hook can process the RGB image here.

Anchor
_Toc365034235
_Toc365034235
Auto-Focus

Remarks
Analyze image sharpness and adjust lens position. (No change to image.)
STATE Variables

Auto Focus

Enable automatic refocus trigger.

Auto Focus Window Size

Size of AF window as a percent of the whole image.

Focuser Position

Current position.


Anchor
_Toc365034236
_Toc365034236
Calculate Focus Number

Remarks
Calculate a focus metric that can be used for manual focus adjustment. Optionally highlight edges in the image.
STATE Variables

Calculate Focus

Enable focus metric calculation.

Focus

Current focus metric value.


Anchor
_Toc365034237
_Toc365034237
Embed Watch Data

Remarks
Embed the text of the Watch window data (register values being monitored) into the image.


Anchor
_Toc365034238
_Toc365034238
Embed Overlays

Remarks
Several kinds of overlay indicators or text can be enabled. The text or graphics are embedded in the image data.
STATE Variables

Exclusion Overlay

Exclusion window for AP0101 and similar.

AWB Zones Enabled

AWB zone overlay for many SOCs.

WB Zone Overlay

Software AWB zone overlay for old software algorithm.

Auto Exposure Overlay

AE zone overlay for many SOCs.

AE350 Zones

AE zone overlay for MT9V022 and similar.

Array Imager Color Overlay

Color-code array imager focal planes.

Show Defects

Defect overlay for MT9M111.

Lens Correction Overlay

Show knee points for old SOCs with piecewise quadradic lens correction blocks.

Lens Center Overlay

Show lens correction center.

Auto Focus Overlay

Auto-focus window for many SOCs.

MAE Overlay

Motion Auto Exposure overlay for MT9T111 and similar.

CRA Overlay

Bullseye overlay.