A grayscale image is represented as a matrix in MATLAB. Each matrix element represents a pixel in the image. An element value represents the intensity of the pixel at that location.
Create a cropped image matrix Icrop using inputs given in the following order:
For example, if your image was:
I = [1 2 3 4 5 6 7 8]
And you called crop_image with inputs
Icrop = crop_image(I, 2, 2, 1, 3)
The output Icrop should be
[6 7 8]