MATLAB Answers

How do we upsample a colour image by 0.25 and 0.5 without using imresize() function ???

11 views (last 30 days)
ejb the beast
ejb the beast on 31 May 2017
Answered: Samir Mitha on 25 Aug 2020
I wanted to upsample a colour (rgb)image by 0.25 and 0.5 without using imresize(). I tried doing it but the output is black & white. Is there any solution ???
This is my script :
%%Lena image Upsample
% Importing original Lena Colour Image
lena_q = imread('lena_quarter.tif');
% Display original Lena image
figure(4)
imshow(lena_q)
title('Original Lena Colour Image')
% Upsample the original Lena image by quarter
scale3=0.25;
lena_quarter=scale3;
lena_quarterup=lena_q(1:lena_quarter:height,1:lena_quarter:width);
figure(5)
imshow(lena_quarterup)
title('Upsizing Original image of the Lena by a quarter')
% Upsample the original Lena image by half
scale4=0.5;
lena_half=scale4;
lena_halfup=lena_q(1:lena_half:height,1:lena_half:width);
figure(6)
imshow(lena_halfup)
title('Upsizing Original image of the Lena by a half')
Thanks

Answers (2)


Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!