![]() Notice how we have extracted three rows ( y = 3) and two columns ( x = 2). Doing so can be accomplished using the following code: > I Now, let’s suppose I want to extract the “pixels” starting at x = 0, y = 0 and ending at x = 2, y = 3. Let’s start by initializing a NumPy list with values ranging from : > import numpy as npĪrray([ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,Īnd let’s now reshape this 1D list into a 2D matrix, pretending that it is an image: > I = I.reshape((5, 5)) We can accomplish image cropping by using NumPy array slicing. We commonly refer to this process as selecting our Region of Interest, or more simply, our ROI. When we crop an image, we want to remove the outer parts of the image we are not interested in.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |