(image, opt=1)
| 3 | |
| 4 | |
| 5 | def process(image, opt=1): |
| 6 | # Detecting corners |
| 7 | gray = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY) |
| 8 | corners = cv2.goodFeaturesToTrack(gray, 35, 0.05, 10) |
| 9 | print(len(corners)) |
| 10 | for pt in corners: |
| 11 | print(pt) |
| 12 | b = np.random.random_integers(0, 256) |
| 13 | g = np.random.random_integers(0, 256) |
| 14 | r = np.random.random_integers(0, 256) |
| 15 | x = np.int32(pt[0][0]) |
| 16 | y = np.int32(pt[0][1]) |
| 17 | cv2.circle(image, (x, y), 5, (int(b), int(g), int(r)), 2) |
| 18 | # output |
| 19 | return image |
| 20 | |
| 21 | |
| 22 | src = cv2.imread("blox.jpg") |