2

Image Crop

Unsolved
Computer Vision

Difficulty: 2 | Problem written by zeyad_omar
Problem reported in interviews at

Amazon
Apple
Facebook
Google
Netflix

In deep learning and computer vision, the images may contain unwanted details. For example, if we are designing a face recognition model by feeding images to the model and getting the name of the preson in the photo, it would be unnecessary to feed the model with an image of size (4000,4000,3) while the person's face is only of size (100,100,3), so we need to crop the image to save time, money, and effort.

In this problem you are given an image and you are asked to crop the rectangle whose upper left corner is (x1,y1) and whose lower right corner is (x2,y2).

Sample Input:
<class 'list'>
image: [[1, 1, 1, 1], [1, 1, 1, 0]]
x1: 0
y1: 0
x2: 1
y2: 1

Expected Output:
<class 'numpy.ndarray'>
[[1]]

Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.

Aut doloremque facilis totam sit quasi reiciendis nobis optio suscipit minima fugiat.

Libero aut tempora fuga commodi consequatur, fuga consequuntur iusto exercitationem commodi itaque beatae molestiae harum repellat, harum optio praesentium voluptates facere distinctio, maxime omnis quisquam asperiores iure consequuntur laboriosam sequi recusandae.

Hic ipsa nam doloremque a voluptatum iure esse? Alias ratione vero voluptates ullam? Nihil voluptatibus officiis sequi ex, eveniet labore quam perspiciatis ut quaerat fugiat possimus recusandae repellat culpa odio, quia possimus praesentium consequatur ullam non impedit similique alias aliquam nemo dolore, porro ipsam corporis reiciendis, eum ab dolorum saepe voluptatem sint odit? Laboriosam eveniet rem consequatur velit, voluptates eum tempora soluta.

This is a premium feature.
To access this and other such features, click on upgrade below.

Ready.

Input Test Case

Please enter only one test case at a time
numpy has been already imported as np (import numpy as np)