Image reconstruction with linear interpolation
Show older comments
I am attempting to reconstruct a down sampled gray scale 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)
Its supposed to work with any image but we first need to down sample the image and convert it to gray scale with the following:
image_bw=rgb2gray(image);
image_DS=downsample(image,3);
Answers (0)
Categories
Find more on Morphological Operations in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!