Practice - 5 Tasks
Answer the questions below
1fill in blank
easyComplete the code to read an image file named 'photo.jpg'.
MATLAB
img = [1]('photo.jpg');
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'imshow' instead of 'imread' to load the image.
Using 'imwrite' which saves images, not reads them.
✗ Incorrect
The imread function reads an image file into MATLAB.
2fill in blank
mediumComplete the code to display the image stored in variable 'img'.
MATLAB
[1](img);Attempts:
3 left
💡 Hint
Common Mistakes
Using 'imread' which reads images but does not display them.
Using 'image' which can display but is less common for images.
✗ Incorrect
The imshow function displays an image stored in a variable.
3fill in blank
hardFix the error in the code to read and display 'picture.png'.
MATLAB
img = imread('picture.png'); [1](img);
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'imwrite' which saves images instead of displaying.
Using 'imread' again instead of displaying.
✗ Incorrect
After reading the image with imread, use imshow to display it.
4fill in blank
hardFill both blanks to read 'img.jpg' and display it with a title 'My Image'.
MATLAB
img = [1]('img.jpg'); [2](img); title('My Image');
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'imwrite' instead of 'imread' to load the image.
Using 'image' instead of 'imshow' to display.
✗ Incorrect
Use imread to load the image and imshow to display it.
5fill in blank
hardFill all three blanks to read 'photo.tif', display it, and add axis labels.
MATLAB
img = [1]('photo.tif'); [2](img); xlabel('[3]');
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'imwrite' instead of 'imread' to load the image.
Using 'image' instead of 'imshow' to display.
Forgetting to put the axis label as a string.
✗ Incorrect
Use imread to read, imshow to display, and xlabel to label the x-axis.
