Regarding the imutils library related to OpenCV, I have the following questions:
- What is the function of - contours.sort_contours()?
- (cnts, _) = contours.sort_contours(cnts)In the above statement, what is the meaning of- (cnts, _), especially- '_'
Note: cnts is a variable containing the contours of the recognized image
My English is not very good, sorry! Thank you all for your answers and help!
 
                        
The
imutilslibrary is a convenience library written to make basic image processing tasks easier (https://github.com/PyImageSearch/imutils).One such task is sorting and labelling contours in images. Based on documentation provided here, there is a separate
contours.pyfile hostingsort_contours()andlabel_contourfunctions. (You need to remember that these functions can be used only after finding contours usingOpenCV)Now to answer your questions:
1. What is the function of
contours.sort_contours()?sort_contour()from the filecontours.pyin this way:contours.sort_contours().2. Understanding
(cnts, _) = contours.sort_contours(cnts)cnts.cntsis used to store the sorted contours._, which stores the bounding boxes._is mostly used a variable when it will not be needed for further processing.