import numpy as np import cv2 img = cv2.imread('opencv-logo.png') imgray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY) ret, thresh = cv2.threshold(imgray, 127, 255, 0) contours, hierarchy = cv2.findContours(thresh, cv2.RETR_TREE, cv2.CHAIN_APPROX_NONE) print("Number of contours = "+str(len(contours))) print(contours[0]) cv2.drawContours(img, contours, 4, (0, 255, 0), 3) #we can change the parameter -1(draw all contours) to 0to8 because the total contours is 9. cv2.imshow('Image', img) cv2.imshow('Image GRAY', imgray) cv2.waitKey(0) cv2.destroyAllWindows()
Popular Posts
-
import numpy as np import cv2 img = cv2.imread( 'messi5.jpg' ) img2 = cv2.imread( 'opencv-logo.png' ) print (...
-
It is very easy to use sqllite in android.i have made a small project to use sqlite.. and try to explain it.. so that you can easily use sql...
-
In ASP.NET Core, in-memory caching is a technique used to store data within the application's memory. This cached data is readil...
Jun 25, 2020
Find and draw contours (openCV)
Subscribe to:
Post Comments (Atom)

No comments:
Post a Comment