MATLAB: How to substract an image

imageimage analysisimage processingImage Processing Toolbox

rgbImage = imread(fullFileName);
I want to only get the top 20% of the image. How can I do it?
For example, for this image
I only want to get
Thanks!

Best Answer

This is simple matrix indexing:
croppedimage = rgbimage(1:round(size(rgbimage, 1)*0.2), :, :)
Alternatively, use imcrop