Question
Image linear interpolation with Matlab. I am attempting to reconstruct a down sampled grayscale image using interp1. I have this code but I am confused
Image linear interpolation with Matlab.
I am attempting to reconstruct a down sampled grayscale image using interp1. I have this code but I am confused to why it is not working. I am getting an error on line 4. Basically, what do I need to put in place of the image name in line 4?
[r_L,col_L]=size(image); %generalize so it works for any image r3i = 1:(1/3):r_L; % locations between the row indices are created c3i = 1:(1/3):col_L; %-- locations between the column indices are created
%Error occurs here xxrowi=interp1(1:1:r_L,image,r3i);%interpolation on image width xxlinear=interp1(1:1:col_L,xxrowi',c3i); %transposing allows one to interpolate on a length xxlinear=xxlinear'; %retransposing image vector show_img(xxlinear)
It can work with any image but first we need to change it to grayscale and downsample by a factor of 3.
image_bw=rgb2gray(image);
image_DS=downsample(image,3);
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started