Complete the code to resize the image to half its original size.
img = imread('peppers.png'); resized_img = imresize(img, [1]); imshow(resized_img);
Using 0.5 scales the image to half its size.
Complete the code to crop the image to a 100x100 pixel square starting at (50,50).
img = imread('peppers.png'); cropped_img = imcrop(img, [1]); imshow(cropped_img);
The rectangle is defined as [x y width height], so [50 50 100 100] crops a 100x100 square starting at (50,50).
Fix the error in the code to resize the image to 200x300 pixels.
img = imread('peppers.png'); resized_img = imresize(img, [1]); imshow(resized_img);
imresize expects size as [numrows numcols], so [200 300] means 200 rows (height) and 300 columns (width).
Fill both blanks to crop the image starting at (30,40) with width 150 and height 120.
img = imread('peppers.png'); cropped_img = imcrop(img, [[1] [2] 150 120]); imshow(cropped_img);
The crop rectangle starts at x=30 and y=40 with width 150 and height 120.
Fill all three blanks to resize the image to half size and then crop a 100x100 square starting at (20,30).
img = imread('peppers.png'); resized_img = imresize(img, [1]); cropped_img = imcrop(resized_img, [[2] [3] 100 100]); imshow(cropped_img);
First resize by 0.5 to reduce size by half, then crop starting at (20,30) with 100x100 pixels.
