Problem 2. The following problem arises in image processing and compression. You
ID: 3682114 • Letter: P
Question
Problem 2. The following problem arises in image processing and compression. You are given a black and white digitized picture P in the form a of a two dimensional n n matrix P. For 1 S i,j S n, Pfi, j] is 0 if the pixel on row i and column j is black and 1 if it is white. We want to decompose the picture into a minimum number of monochromatic rectangles, which means that each rectangle is either all white or all black. The decomposition must be performed in the following hierarchical manner. Starting with the full image as the starting rectangle, we can split it into two rectangles either bv a vertical line or a horizontal line that cuts through the entire rectangle. After this, we can split each of these rectangles again either by a vertical or horizontal line that cuts through the entire rectangles, and so on. The process stops when a rectangle is either all white or all black. An example of such a decomposition is shown in Fig. 2(c). The question is where to place these cuts so that the final number of rectangles is minimizedExplanation / Answer
% To acquare the image
I=imread('location of the image');
%to convert the image from rgb to gray
a=rgb2gray(I)
imshow(a);
%to see the pixels in the image
impixelregion(a);
%to get the compressed image
b=a(:,:;200:400);
imshow(b)
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.