Cody

Problem 44958. Crop an Image

A grayscale image is represented as a matrix in MATLAB. Each matrix element represents a pixel in the image. The element values represent intensities of the pixel at that location.

Given an input image matrix I, return a cropped image matrix Icrop using the following additional inputs:

  • Rmin - Lowest row number to retain
  • Cmin - Lowest column number to retain
  • Rpix - Number of pixels along rows to retain
  • Cpix - Number of pixels along columns to retain

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 should be

[6 7 8]

Solution Stats

37.31% Correct | 62.69% Incorrect
Last solution submitted on Oct 20, 2019

Problem Recent Solvers23

Suggested Problems

More from this Author7