def getPerspective(): e1 = cv2.getTickCount() image = cv2.imread("thread.jpg", cv2.IMREAD_COLOR) warp = perspective(image) cv2.imwrite('warp.jpg', warp) cv2.imshow("Frame", warp) e2 = cv2.getTickCount() t = (e2 - e1) / cv2.getTickFrequency() print t return warp
led_off(0) led_off(1) #Zeitmessung zwischen den beiden Bildern if n > 0: time_new = int(round(time.time() * 1000)) print 'time' ,(time_new-time_old) n = 0 else: time_old = int(round(time.time() * 1000)) n = 5 e1 = cv2.getTickCount() #Funktion perspective in seperatem File #warp = img1 warp = perspective(img1) #cv2.imwrite('warp.jpg',warp) e2 = cv2.getTickCount() dif = (e2-e1)/cv2.getTickFrequency() #print 'Zeit Prespektive:' ,dif #Canny-Filter #edges = cv2.Canny(warp,25,75,apertureSize = 3) edges = cv2.Canny(warp,25,100,apertureSize = 3) #Hough-Transformation minLineLength=150 lines = cv2.HoughLinesP(image=edges,rho=1,theta=np.pi/180, threshold=100,lines=np.array([]), minLineLength=minLineLength,maxLineGap=80) #Zeichnet Linien im Bild und berechnet den Winkel von diesen