#Region Base #AutoIt3Wrapper_UseX64=y #include "autoit_opencv_com-4.5.4\udf\opencv_udf_utils.au3" _OpenCV_Open_And_Register(_OpenCV_FindDLL("opencv_world4*", Default, "opencv-4.5.4"), _OpenCV_FindDLL("autoit_opencv_com4*", Default, "autoit_opencv_com-4.5.4")) #EndRegion Base #include Local $cv = _OpenCV_get() Local $src = $cv.imread("CheckConture.png") Local $gr = $cv.cvtColor($src, $CV_COLOR_BGR2GRAY) Local $canny = $cv.Canny($gr, 10, 250) Local $iterations Local $kernel = ObjCreate("OpenCV.cv.Mat") Local $closed = $cv.morphologyEx($canny, $CV_MORPH_CLOSE, $kernel) Local $contours = ObjCreate("OpenCV.VectorOfMat") Local $apd = ObjCreate("OpenCV.VectorOfMat") $contours = $cv.findContours($closed, $CV_RETR_EXTERNAL, $CV_CHAIN_APPROX_SIMPLE) ConsoleWrite("Find " & Ubound($contours) & " contours" & @CRLF) For $i = 0 To UBound($contours) - 1 $sm = $cv.arcLength($contours[$i], True) ConsoleWrite($sm & @CRLF) ;Not worked ;$apd = $cv.approxPolyDP($contours[$i], 0.02*$sm, True) ;Worked $apd.push_back($contours[$i]) $cv.drawContours($src, $apd, $i, _OpenCV_RGB(0,255,0), 4) Next $cv.imshow("closed", $closed) $cv.imshow("result", $src) $cv.waitKey() $cv.destroyAllWindows()