![]() ![]() The area of that square will be 10.000 pixels. For example, let’s say that we have the contour of a square with dimensions \(100\times100 \) pixels. It is important to set an experimental number that will determine the contour area. We will create a for loop and we will iterate through all detected contours. To do that we can use the function cv2.contourArea(). So, we need to calculate the area of all contours and to sort them from largest to smallest. Once we extracted our contours we need to find out which one we want to process. On the other hand, a parameter cv2.CHAIN_APPROX_SIMPLE is used to compress the contours to save space. If we pass the parameter cv2.CHAIN_APPROX_NONE all contour points are stored. Using this argument we can specify how many contour points we want to store. The third argument is the contour approximation method.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |