The code in the video is the small part of a some project. I do not want to explain the whole project which is about image processing. I just try to show the some part of algorithm which can give you an idea about image processing.The algorithm is created to process each pixel on the sample image. Then, as user wish, the desired part of the image can be altered or removed. I mean the user can change the color of the desired part or can delete. Like popular image processing software which is called photoshop ( ps ).
As it is seen using java and the algorithm, pixel processing is so easy. Lets talk about the code. To get the information about the pixels getRGB() function is so useful. getRBG() function gives the 32 bit data information about the any pixel on the image. To search the image it is used basic x-y coordinate system in java. Therefore as it is known, the coordinate system is a little bit different than math. I mean ( 0,0 ) point is on the top-left corner.
Actually, in 32 bit information have 4 different information which are about color and the opacity of the image. Each information is 8 bit. 4*8=32. In other words, there are 4 data which are 8 bit on the each pixel. The first 8 bit is about the opacity. Second 8 bit is about the red color of the pixel. Third one is the green and fourth one is the blue.
By the way, RGB means Red Green Blue, all colors in the nature combines of these three colors.
If you can get information of all pixels about the image then it is so easy to manipulate it. You can do whatever you want with image basicly.
There are some points you have to care about. for example Ä±f your image is jpg file, then you can loose some data. But If you use png file then you never loose any data,so If you do not interested in the difference between the jpg file and png file then use png.
Lets see some example.Below the image there are different circles with different colors,algorithm process the image and removes all pixels which are not black.
And after proccessing...
Below the code, there are explanation how each 8 bit datas can be taken from the 32 bit information. Just read the comments..