0% found this document useful (0 votes)
3 views

image-processing -cglab

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views

image-processing -cglab

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 3

7.Write a Program to read a digital image.

Split and display image into 4


quadrants, up, down, right and left.
% originalImage = imread('cameraman.tif');
originalImage = imread('peppers.png');
[rows, ncolumns, numberOfColorChannels] = size(originalImage);
[Y,X]=ndgrid(1:rows,1:ncolumns);
Jf=ncolumns+1-Y;
Q1=(Y<X & X<Jf);
Q2=(Y<X & X>Jf);
Q3=(Y>X & X>Jf);
Q4=(Y>X & X<Jf);
flippedImage = flipud(originalImage);
% Mask out Q1 | Q3
% Mask the image using bsxfun() function to multiply the mask by each
channel individually.
mask = Q1 | Q3;
maskedImage1 = bsxfun(@times, flippedImage, cast(mask, 'like',
originalImage));
mask = Q2 | Q4;
maskedImage2 = bsxfun(@times, originalImage, cast(mask, 'like',
originalImage));
finalImage = maskedImage1 + maskedImage2;
imshow(finalImage);

You might also like