Operator Library: Base
The CastBitWidth operator changes the bit width by selecting the lower bits of the input. If the output bit width is greater than the input bit width, the value is kept, i.e. bits are added to the most significant bits. A sign extension is performed for signed value. If the output bit width is less than the input bit width, the most significant bits are discarded. The value changes to
,i.e. only the remaining bits are used. The output bit width is defined by .
For color values, each component is processed individually.
The CastBitWidth Operator Might Destroy Your Values | |
---|---|
Only discard bits, if you know you will not need them. The CastBitWidth operator might destroy your values. |
Input Bit Width | Input Value | Arithmetic | Output Bit Width | Output Value | Comment | ||
---|---|---|---|---|---|---|---|
Decimal | Binary | Decimal | Binary | ||||
5 | 10 | 01010 | unsigned | 4 | 10 | 1010 | value is kept |
5 | 10 | 01010 | unsigned | 3 | 2 | 010 | value is changed |
5 | 10 | 01010 | signed | 6 | 10 | 001010 | value is kept |
5 | -10 | 10110 | signed | 6 | -10 | 110110 | value is kept, sign extension |
5 | 10 | 01010 | signed | 4 | -6 | 1010 | value is changed |
5 | -10 | 10110 | signed | 4 | 6 | 0110 | value is changed |
Table 29. Examples
The range of the input bit width is:
|
|
The range of the input bit width is:
|
The use of operator CastBitWidth is shown in the following examples:
-
Figure 211, 'ShiftLeft Operator Added for 16Bit Output'
Tutorial - User ShiftLeft to change DMA bit width.
-
'Combine Image Data From Two Camera Sources - Building an Overlay Blend'
Tutorial - From equation to implementation. Explanation on how to implement the overlay blend.
-
Examples - A high speed and robust laser line detection algorithm. The algorithm determines center of gravity coordinates to obtain sub-pixel resolution results.
-
Example - Histogram thresholding
-
Examples - Shows the usage of operator Blob_Analysis_2D. The applet binarizes the input data and determines the blob analysis results. The results as well as the original image are output using two DMA channels.
-
Examples - The blob analysis operator is applied to an input camera image. The applet shows the usage of the blob data in the applet. In this case, the object with the maximum are is localized and the coordinates are used to cut out the object from the original image.
-
Examples - The applet shows an example for white balancing on RGB images.
-
Examples - The Kirsch filter is a good edge detection filter for non directional edges.
-
Examples - A Sobel filter in x-direction only.
-
Examples - A Sobel filter in all 4 directions.
-
Examples - A simple 3x3 box filter.
-
Examples - A Gauss filter using a 5x5 kernel.
-
Examples - An example of the use of two filters in parallel.
-
Examples - Downsampling by factor 3x3 without the use of operator SampleDn.
-
Examples - Shows how to vertically mirror an image. Note the mirroring of the parallel words and the pixel.
-
'High Dynamic Range and Low Dynamic Range Example Using Camera Response Function'
Examples - High Dynamic Range According to Debevec
-
'High Dynamic Range and Low Dynamic Range Example with a Weighted Linear Ansatz'
Examples - High Dynamic Range with Linear Ansatz
-
'2D Shading Correction / Flat Field Correction'
Examples - The example shows the implementation of a 2D shading correction. Correction values are stored in frame grabber RAM. The applet performs a high precision offset and gain correction.
-
'2D Shading Correction / Flat Field Correction Using Operator RamLUT'
Examples - The example shows the implementation of a 2D shading correction. Correction values are stored in the operator RamLUT. The applet performs a high precision offset and gain correction.
-
'1D Shading Correction Using Block RAM'
Examples - The example shows an 1D shading correction. The correction values are stored in block RAM memory.
-
'1D Shading Correction Using Frame Grabber RAM'
Examples - The example shows an 1D shading correction. The correction values are stored in Frame Grabber RAM.