BitShift
Shifts the intensities of an image by a given number of bits.
Access to parameter description
Each intensity of the input image I is shifted as shown in the example from the following figure.

Figure 1. Shifting a 16-bit integer value by 2 bits
To summarize:
See also
Access to parameter description
Each intensity of the input image I is shifted as shown in the example from the following figure.

Figure 1. Shifting a 16-bit integer value by 2 bits
To summarize:
- i bits right <B>shifting</B> O(n,m)=I(n,m)/2i
- i bits left <B>shifting</B> O(n,m)=I(n,m)×2i
See also
Function Syntax
This function returns outputImage.
// Function prototype
std::shared_ptr< iolink::ImageView > bitShift( std::shared_ptr< iolink::ImageView > inputImage, int32_t bitNumber, BitShift::ShiftDirection shiftDirection, std::shared_ptr< iolink::ImageView > outputImage = NULL );
Class Syntax
Parameters
Parameter Name | Description | Type | Supported Values | Default Value | |||||
---|---|---|---|---|---|---|---|---|---|
![]() |
inputImage |
The input image. | Image | Binary, Label, Grayscale or Multispectral | nullptr | ||||
![]() |
bitNumber |
The number of bits to shift. | Int32 | >=0 | 1 | ||||
![]() |
shiftDirection |
The shifting direction.
|
Enumeration | LEFT | |||||
![]() |
outputImage |
The output image, size and type are forced to the same values as the input. | Image | nullptr |
Object Examples
auto foam = readVipImage( std::string( IMAGEDEVDATA_IMAGES_FOLDER ) + "foam.vip" ); BitShift bitShiftAlgo; bitShiftAlgo.setInputImage( foam ); bitShiftAlgo.setBitNumber( 1 ); bitShiftAlgo.setShiftDirection( BitShift::ShiftDirection::LEFT ); bitShiftAlgo.execute(); std::cout << "outputImage:" << bitShiftAlgo.outputImage()->toString();
Function Examples
auto foam = readVipImage( std::string( IMAGEDEVDATA_IMAGES_FOLDER ) + "foam.vip" ); auto result = bitShift( foam, 1, BitShift::ShiftDirection::LEFT ); std::cout << "outputImage:" << result->toString();