-
Book Overview & Buying
-
Table Of Contents
Visual Media Processing Using MATLAB Beginner's Guide
By :
We will again work using my_image.bmp. Let's see if we can write a script that whitens a 30 x 40 rectangular area on the top-left corner of the image and blackens a 40 x 50 rectangular area at the bottom-right corner of the image. We can manage to do so, if we follow these steps:
First, you should open Editor and select New Script. This can also be achieved by using the Ctrl + N shortcut keystroke.
Now, write the first part of the code, which will open the image:
img = imread('my_image.bmp');Then you should alter the values of the elements contained in the top-left rectangle to 255. Let's keep the original image so that we can compare it to the final result. This will be achieved using the following line of code:
img_final = img; img_final(1:30,1:40) = 255;
Now, you should assign black values (equal to 0) to the elements contained in the bottom-right rectangle. In order to define the indices of the pixels you want to alter, you must use the...
Change the font size
Change margin width
Change background colour