Complete the code to read an image file named 'image.jpg'.
img = imread([1]);The imread function requires the filename as a string, so it must be enclosed in single quotes.
Complete the code to convert the image to grayscale.
gray_img = [1](img);im2bw which converts to binary, not grayscale.imread again instead of conversion.The function rgb2gray converts a color image to grayscale.
Fix the error in the code to detect edges using the Canny method.
edges = edge(gray_img, '[1]');
The edge function uses the method name as a string. For Canny edges, use 'canny'.
Fill both blanks to display the original and edge images side by side.
subplot(1, 2, [1]); imshow([2]);
The first subplot shows the original image at position 1.
Fill all three blanks to display the edge image in the second subplot with a title.
subplot(1, 2, [1]); imshow([2]); title('[3]');
The second subplot index is 2, showing the edge image with the title 'Detected Edges'.
