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

Matlab Programming. Please help. Thanks http://carmaux.cs.gsu.edu/~mweeks/csc463

ID: 3925429 • Letter: M

Question

Matlab Programming. Please help. Thanks

http://carmaux.cs.gsu.edu/~mweeks/csc4630/PICT0009.JPG

Use MATLAB to read the image, show it as a figure, then have the user select 2 points, crop the image, and show it as another figure.

First, read the image and display it. You will need to define "filename" as a string of the filename.
x = imread(filename);
imshow(x);
Now have the user (you) select 2 points.
title('Select 2 points');
[a, b] = ginput(2);

Now, you will need to "clean up" variables "a" and "b". Inspect the values, and make sure they are integers within the boundaries of "x", changing them as needed. Then make a cropped image:
y = x(r1:r2, c1:c2);
figure();
imshow(y);
title('cropped version');

Once you have this working, crop it so that the lower-right corner is showing, about 1/4 of the original size.

Explanation / Answer

A = imread('http://carmaux.cs.gsu.edu/~mweeks/csc4630/PICT0009.JPG');

imshow(A);

title('Select 2 points');
[a, b] = ginput(2);

clearvars a b

s=whos('myvar');
[s.bytes]

D = imcrop(A,[0,0 ,a/4,b/4]);

figure()

title("cropped version");

imshow(D);