Quantcast
Channel: OpenCV Q&A Forum - RSS feed
Viewing all articles
Browse latest Browse all 2088

TypeError: integer argument expected, got float line 35

$
0
0
import cv2 import numpy as np img = cv2.imread('Bluelinegap50blur.jpg') gray = cv2.cvtColor(img,cv2.COLOR_BGR2GRAY) edges = cv2.Canny(img, 50, 200) # find lines rho = 1 theta = np.pi / 180 threshold = 10 min_line_length = 0 max_line_gap = 10 line_image = np.copy(edges) * 0 lines = cv2.HoughLinesP(edges, rho, theta, threshold, np.array([]), min_line_length, max_line_gap) # draw found lines img_dst = cv2.cvtColor(gray,cv2.COLOR_GRAY2RGB) for line in lines[0]: cv2.line(img_dst, (line[0], line[1]), (line[2], line[3]), (0,255,0), 2) # find corners gray = np.float32(gray) dst = cv2.cornerHarris(gray, 15, 5, 0.04) # non-maximum suppression via dilation kernel = np.ones((10,10)) max_dst = cv2.dilate(dst, kernel) dst = dst * (dst == max_dst) # sort points by strength, find their positions and take 5 highest ones sortIdx = np.argsort(dst.flatten())[::-1][:5] # draw them w = img.shape[1] for idx in sortIdx: cv2.circle(img_dst,(idx % w, idx / w) , 3, (0,0,255), -1)

Viewing all articles
Browse latest Browse all 2088

Trending Articles