You can select just the regions of the matrix that define your image, as follows:
img_cropped = img(300:450, 500:600);
In the example, you will select the image in the regions between 300 and 450 of the x axis, and the 500 to 600 in the y axis.
If you want to know the size of the matrix which define your image, you can use size()
Hope this will be useful!!