0% found this document useful (0 votes)
3 views1 page

Lab 4

The MATLAB program demonstrates spatial resolution through various sampling levels of an image. It reads a color image, converts it to grayscale, and then generates progressively smaller sampled images by reducing the resolution. The program displays the original and sampled images in a subplot format, illustrating the effects of different sampling rates.

Uploaded by

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

Lab 4

The MATLAB program demonstrates spatial resolution through various sampling levels of an image. It reads a color image, converts it to grayscale, and then generates progressively smaller sampled images by reducing the resolution. The program displays the original and sampled images in a subplot format, illustrating the effects of different sampling rates.

Uploaded by

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

% MATLAB program on Spatial Resolution (Sampling Levels)

close all;
clear all;
clc

pkg load image


I=imread('Maulik.png');%Read image information
subplot(231);
I1=rgb2gray(I);%Convert Color image to Grayscale image
imshow(I1)
title('Original image 512*512'); %Output this image
I2 = imresize(I1,0.5); % for Resizing this function can also be used
%I2=I1(1:2:end,1:2:end); %The row and column directions are sampled from the
first bit,
%Sample every other bit to generate a new matrix
subplot(232);
imshow(I2)
title('Sample image (256*256)');

I3=I1(1:4:end,1:4:end);
subplot(233)
imshow(I3)
title('Sample image (128*128)');

I4=I1(1:8:end,1:8:end);
subplot(234);
imshow(I4)
title('Sample image (64*64)');

I5=I1(1:16:end,1:16:end);
subplot(235);
imshow(I5)
title('Sample image (32*32)');

I6=I1(1:32:end,1:32:end);
subplot(236);
imshow(I6)
title('Sample image (16*16)');

You might also like