I am new to MATLAB so I am unfamiliar with many things. One of the tasks that was handed to me to complete was to change the size of the image using interp1(), I have previously asked the similar question and I am able to change my image size from 256×256 to 256×512. I have only succeeded in changing the image size for rows with the following codes:
data1 = imread('lighthouse_half.png'); %lighthouse_half
numcr = 512;[m,n,p] = size(data1);iwant = zeros(m,numcr,p);xi = linspace(1,n,numcr);for i = 1:m for j = 1:p T = interp1(1:n,double(data1(i,:,j)),xi); iwant(i,:,j) = T; endendiwant = uint8(iwant);imshow(iwant);
I have been trying to figure how to change both rows and columns so that I get the image size of 512×512, can someone please help?
Best Answer