LEARN PYTHON PROGRAMMING CRASH COURSE FOR BIGINNERS COOKBOOK: 40 Example Programs, Modules and Packages, Python Decorators, Python 3 With Web Scraping, Clean Code by Sathish Janani

LEARN PYTHON PROGRAMMING CRASH COURSE FOR BIGINNERS COOKBOOK: 40 Example Programs, Modules and Packages, Python Decorators, Python 3 With Web Scraping, Clean Code by Sathish Janani

Author:Sathish, Janani [Sathish, Janani]
Language: eng
Format: epub
Published: 2021-09-09T16:00:00+00:00


Let's imagine that we just had a single blue rectangle as our image. Then what we can do is that the top left corner of this image as zero zero, and then we can make the x axis go along horizontally and on the vertical axis. We can call that Y. So basically now the first two coordinates in that tuple of four are going to be your starting X and you're starting Y, whereas zero zero is measured from the top left corner of the image. The next two are W and H for width and height. And those are also coordinates. So you would pick the additional two coordinates of with height. And essentially from these four items, the starting X and Y. And then the width and height coordinates of the actual pixels themselves. Then you can end up creating a rectangle and crop out that image. So let's see this in practice. Now by jumping back to the notebook. So off of this, we will say. Zero, comma zero. So we'll start at the very top corner. And then we can say one hundred one hundred for these starting coordinates of that with in height to be one hundred one hundred. So when we run that, we basically get the top left corner of that Mach picture. If we scroll back up, that's essentially this corner up here in the top left. So the Mac image isn't really a useful demonstration of cropping. So we have another image for you.



Download



Copyright Disclaimer:
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.