Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

In matlab is there a general code that inputs a .jpg image and then 4 images in

ID: 3858570 • Letter: I

Question

In matlab is there a general code that inputs a .jpg image and then

4 images in a row using the finction above

o the left symmetric image which flips the left half of an image to the right o the right symmetric image which flips the right half of an image to the left o the average symmetric image which averages the left and right halves of an image The input should be img and the output should be lefImg rigImg, avgimg. Apply this function to a picture of you and display the output in a 1x4 subplot along with the original image. The output should look like

Explanation / Answer

img = imread('myimg');

sz = size(img);
lefImg = img;
rigImg = img;
avgImg = img;

for i=1:sz(2)/2
    for j= 1:sz(1)
        lefImg(j,sz(2)-i+1) = img(j,i);
        rigImg(j,i) = img(j,sz(2)-i+1);
        avgImg(j,sz(2)-i+1) = avgImg(j,i) = (Img(j,sz(2)-i+1) + Img(j,i))/2;
    end
end

figure;
subplot(1,4,1);
imshow(img);
subplot(1,4,2);
imshow(lefImg);
subplot(1,4,3);
imshow(rigImg);
subplot(1,4,4);
imshow(avgImg);

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote