Whats wrong with my code? Please use MATLAB and can you answer the
questions too.
a) Nearest Neighbouring pixel
MATLAB function for Nearest Neighbouring Pixel where image and scale are considered as input.
Save the file name as rice_Scale.m
function rice_Scale(file, scale)
A=imread(file); %READ THE INPUT IMAGE
%OBTAIN THE INTERPOLATED POSITIONS
IR = ceil([1:(size(A,1)*scale)]./(scale));
IC = ceil([1:(size(A,2)*scale)]./(scale));
%ROW_WISE INTERPOLATION
B = A(:,IR);
%COLUMN-WISE INTERPOLATION
B = B(IC,:);
imshow(B)
end
b) Linear Interpolation (In x-direction first the y-direction)
MATLAB function for Linear Interpolation (In x-direction first and the y-direction) where image and scale are considered as input.
Save the file name as rice_Scale.m
function rice_Scale(file, scale)
a=imread(file); %import image"y.jpg"
[row col d] = size(a); %3 dimentional array
zr=scale*row;
zc=scale*col;
for i=1:zr
x=i/scale;
x1=floor(x);
x2=ceil(x);
if x1==0
x1=1;
end
xint=rem(x,1);
for j=1:zc
y=j/scale;
y1=floor(y);
y2=ceil(y);
if y1==0
y1=1;
end
yint=rem(y,1);
BL=a(x1,y1,:);
TL=a(x1,y2,:);
BR=a(x2,y1,:);
TR=a(x2,y2,:);
R1=BR*yint+BL*(1-yint);
R2=TR*yint+TL*(1-yint);
im_zoom(i,j,:)=R1*xint+R2*(1-xint);
end
end
imshow(im_zoom);
end
When images are scaled or resized, the values between pixels need to be guessed/interpolated in o...
The ACME Manufacturing Company has hired you to help automate their production assembly line. Cameras have been placed above a conveyer belt to enables parts on the belt to be photographed and analyzed. You are to augment the system that has been put in place by writing C code to detect the number of parts on the belt, and the positions of each object. The process by which you will do this is called Connected Component Labeling (CCL). These positions...