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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!