Question

In: Computer Science

Using MATLAB (a) Write a computer program capable of zooming and shrinking an image by pixel...

Using MATLAB (a) Write a computer program capable of zooming and shrinking an image by pixel replication. Assume that the desired zoom/shrink factors are integers.

Solutions

Expert Solution

`Hey,

Note: Brother if you have any queries related the answer please do comment. I would be very happy to resolve all your queries.

clc
clear all
close all
format long
name=input('Enter image name: ','s');
A=imread(name);
disp('Input Image ==> cameraman.tif');
f=input('Enter the shrinking factor of the image: ');
s=size(A);
s1=s/f;
k=1;
l=1;
for i=1:s1
for j=1:s1
B(i,j)=A(k,l);
l=l+f;
end
l=1;
k=k+f;
end
figure,imshow(A)
title('Original Image');
figure,imshow(B)
title('Shrinked Version');
% Zooming
  
f1=input('Enter the factor by which the image is to be Zoomed: ');
s2=s*f1;
k=1;
l=1;
for i=1:f1:s2
for j=1:f1:s2
C(i,j)= A(k,l);
l=l+1;
end
l=1;
k=k+1;
end
for (i=1:f1:s2)
for (j=2:f1:s2-1)
C(i,j)= [C(i,j-1)+ C(i, j+1)]*0.5;
end
end
for j=1:f1:s2
for i=2:f1:s2-1
C(i,j)=[C(i-1,j)+C(i+1,j)]*0.5;
end
end
for (i=2:f1:s2-1)
for (j=2:f1:s2-1)
C(i,j)= [C(i,j-1)+ C(i, j+1)]*0.5;
end
end
figure,imshow(C)
title('Zoomed Image')

Kindly revert for any queries

Thanks.


Related Solutions

Write a program that is capable of detecting the color brown in an image taken by...
Write a program that is capable of detecting the color brown in an image taken by a webcam using OpenCV python code.
1- Write a Matlab program to perform image resizing, image rotation to 90 degrees, conversion to...
1- Write a Matlab program to perform image resizing, image rotation to 90 degrees, conversion to binary and gray scale, Image segmentation and extraction, draw and find the region of interest with a circle, Plot bounding box, Region extraction and histogram. 2- Write a MATLAB program to Design a GUI calculator which is as shown in below figure 1. Add tool bar options to the GUI calculator and Highlight specific codes written in program and signify the steps followed.
(Using Matlab) and "while" function 1.   Write a program that prompts the User for if they...
(Using Matlab) and "while" function 1.   Write a program that prompts the User for if they would like to enter a real number. If yes, prompt the User for the real number. Continue to do this until the User enters “no” to the first question. After the User enters “no”, display the average of all the numbers entered. (Using Matlab) and "while" function 2.   Write a program that prompts the User for if they would like to enter a real...
Using Matlab 1. Create a color image of size 200 × 200. The image should have...
Using Matlab 1. Create a color image of size 200 × 200. The image should have a blue background. 2. Create 100 yellow regions within the image that have a variable size. More specifically, their width should be an odd number and vary between 3 and 7 and their height should also be an odd number and vary between 3 and 7. For example, you may get rectangular regions of size 3 × 3, 3 × 5, 5 × 3,...
Develop a general computer program using MATLAB for the analysis of plane (2D) frames. You can...
Develop a general computer program using MATLAB for the analysis of plane (2D) frames. You can use Chapter 6 as a reference. The program should be able to: a. Analyze a frame subjected to different load types, such as joint load, member load, and support displacement; b. Analyze frames with different boundary conditions: pin, roller, and fixed support; c. Generate the results including joint displacements, member axial, shear and moment forces, and reactions
MATLAB: Write as a script in the editor window of matlab. Quadratic roots. Write a program,...
MATLAB: Write as a script in the editor window of matlab. Quadratic roots. Write a program, quadroots.m, for finding the roots of the second- order polynomial ax2 + bx + c. Use the quadratic equation. The inputs are the coefficients a,b, and c and the outputs are z1 and z2. The program should produce (exactly) the following output in the Command window when run with (a, b, c) = (1, 2, −3):
Please use MATLAB. Write a program to plot the piecewise function using IF statements and a...
Please use MATLAB. Write a program to plot the piecewise function using IF statements and a FOR loop in MatLab. Use x as the input vector. Plot from -20<=x<=20, increment of 1.   y =   4 x + 10 ,             ? ≥ 9,                   y =      5? + 5,                   0 ≤ ? < 9,                    y =     ?2 + 6? + 8, ? < 0 Plot each segment of the fn with different shaped points and a different color, for...
Write a MATLAB code for importing an image and then being able to find all the...
Write a MATLAB code for importing an image and then being able to find all the coordinates that would draw that image on a plot column by column and row by row with a continuous line.
MATLAB code: using Laplacian mask enhance for image "ngc6543.jpg".
MATLAB code: using Laplacian mask enhance for image "ngc6543.jpg".
Draw a Koch Snowflake fractal image using MATLAB programming. I'm pretty new to MATLAB and im...
Draw a Koch Snowflake fractal image using MATLAB programming. I'm pretty new to MATLAB and im not too familar with how all the plotting and drawing functions work.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT