Bitwise Left Shift Operator

Introduction

Say we’re asked to find out left shifted bit string of a given bit string B, what do we do ?

B = 10101011

Shift B by 2 places leftward

B = B « 2 = 1010101100

We already know this, for a 8-bit image, we can have 256 different color levels & for a color image we’ll just keep three color components ( R, G & B ) each of them will be 8-bit lengthy.

With 8-bits max unsigned integer that can be represented is 256 i.e. all pixel intensity values lie in [0, 255] range.

But if we’ve one pixel intensity 255 ( in binary 11111111 ) and asked to shift it by 1 place leftward, obtained value ( 510 ) will definitely be not in valid pixel intensity range. So we need to put pixel intensity value back into range, by using either of following two mechanisms

So what we gonna do for an image is like below

Result

Source Shift By Clipped Sink
nature 1 true left_shifted
nature 1 false left_shifted
nature 2 true left_shifted
nature 2 false left_shifted
nature 3 true left_shifted
nature 3 false left_shifted
nature 4 true left_shifted
nature 4 false left_shifted

Thanking you