Please go line by line and tell me what each lines means.

Business, Finance, Economics, Accounting, Operations Management, Computer Science, Electrical Engineering, Mechanical Engineering, Civil Engineering, Chemical Engineering, Algebra, Precalculus, Statistics and Probabilty, Advanced Math, Physics, Chemistry, Biology, Nursing, Psychology, Certifications, Tests, Prep, and more.
Post Reply
answerhappygod
Site Admin
Posts: 899604
Joined: Mon Aug 02, 2021 8:13 am

Please go line by line and tell me what each lines means.

Post by answerhappygod »

Please go line by line and tell me what each lines means.
Please Go Line By Line And Tell Me What Each Lines Means 1
Please Go Line By Line And Tell Me What Each Lines Means 1 (61.79 KiB) Viewed 24 times
File Edit Format Run Options Window Help 1 import cv2 2 import numpy as np 3 lines list = [] 4 # Read image 5 image = cv2.imread('pic2.png') 6 7 # Convert image to grayscale 8 gray = cv2.cvtColor (image, cv2.COLOR_BGR2GRAY) = 10 # Use canny edge detection 11 edges cv2.Canny (gray,50, 150, apertureSize=3) 12 13 # Apply HoughLinesP method to 14 # to directly obtain line end points 15 lines = cv2.HoughLines 16 edges, # Input edge image 17 1, # Distance resolution in pixels 18 np.pi/180, # Angle resolution in radians 19 threshold=100, # Min number of votes for valid line 20 minLineLength=5, # Min allowed length of line 21 maxLineGap=10 # Max allowed gap between line for joining them 22 ) 23 24 # Iterate over points 25 for points in lines: 26 # Extracted points nested in the list 27 xl, yl,x2, y2=points[0] 28 # Draw the lines joing the points 29 # On the original image 30 cv2.line (image, (x1, yl), (x2, y2), (0,255,0),2) 31 # Maintain a simples lookup list for points 32 lines_list.append([ (x1, yl), (x2,y2)]) 33 34 # Save the result image 35 cv2.imwrite('detectedLines.png', image) 36
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!
Post Reply