Bitwise Right Shift Operator

Introduction

Given an image ( color / grayscaled ) & number of places to shift rightwards, it’ll compute resulting image by shifting each pixel intensity value P[x, y] by given number of places.

Assume we’ve a pixel intensity P[x, y] for grayscale image I, with value 10.

P[x, y] = 10

If we apply right shift operator on P[x, y] by 2 places, then

P[x, y] = 2

Well if we’re asked deal with color image, then each pixel P[x, y] will have three color components & each of them to be shifted rightwards.

Usage

// Main.java
import in.itzmeanjan.filterit.ImportExportImage;
import in.itzmeanjan.filterit.bitwise.BitwiseRightShift;

class Main{
    public static void main(String [] args){
        ImportExportImage.exportImage(
        new BitwiseRightShift().operate("cloud.jpg", 1),
        "bitwiseOpRightShiftedby1.jpg");
    }
}
# in.itzmeanjan.filterit.jar & Main.java are present in same directory
$ javac -cp ".:in.itzmeanjan.filterit.jar" Main.java
$ java -cp ".:in.itzmeanjan.filterit.jar" Main

Result

Source Shift by Sink
cloud 1 cloud
cloud 2 cloud
cloud 3 cloud
cloud 4 cloud

Thanking you, :blush: