How does cv2.boundingRect() function of OpenCV work?

The cv2.boundingRect() function of OpenCV is used to draw an approximate rectangle around the binary image. This function is used mainly to highlight the region of interest after obtaining contours from an image. As per the documentation there are two types of bounding rectangles: Straight Bounding Rectangle Here a simple rectangle is drawn around the contour (ROI). As you … Read more

Ignore .pyc files in git repository

Put it in .gitignore. But from the gitignore(5) man page: So, either specify the full path to the appropriate *.pyc entry, or put it in a .gitignore file in any of the directories leading from the repository root (inclusive).

Meaning of list[-1] in Python

One of the neat features of Python lists is that you can index from the end of the list. You can do this by passing a negative number to []. It essentially treats len(array) as the 0th index. So, if you wanted the last element in array, you would call array[-1]. All your return c.most_common()[-1] statement does is call c.most_common and return the last … Read more