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.
Main.java
in another project, where we're using filterIt.
// 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");
}
}
- Compilation & running
# 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
Source | Shift by | Sink |
---|---|---|
1 | ||
2 | ||
3 | ||
4 |
Thanking you, 😊