MATLAB Answers

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

21 ビュー (過去 30 日間)
ejb the beast
ejb the beast 2017 年 5 月 31 日
回答済み: Samir Mitha 2020 年 8 月 25 日
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

回答 (2 件)

Walter Roberson
Walter Roberson 2017 年 5 月 31 日
lena_quarterup = lena_q(1:lena_quarter:height, 1:lena_quarter:width, :);

Samir Mitha
Samir Mitha 2020 年 8 月 25 日
You may want to try using the Gridded Interpolant function

Community Treasure Hunt

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

Start Hunting!

Translated by