@@ -39,11 +39,39 @@ Alternatively, you can download this repository and install manually.
3939import pclines as pcl
4040```
4141
42- 2 . Accumulation of observations
43- The observations are 2D weighted coordinates enclosed by a known bounding box.
42+ 2 . Data and observations
43+ The observations are 2D weighted coordinates enclosed by a known bounding box. As an example we extract edge points from an image.
4444
45- * TBD*
45+ ``` python
46+ image = imread(" doc/test.png" , as_gray = True )
47+ edges = sobel(image)
48+ r,c = np.nonzero(edges > 0.5 )
49+ x = np.array([c,r]," i" ).T
50+ weights = edges[r,c]
51+ ```
52+ ![ ] ( doc/image.png ) ![ ] ( doc/edges.png )
53+
54+ 3 . Accumulation in PCLines space
55+
56+ ``` python
57+ h,w = image.shape[:2 ]
58+ bbox= (0 ,0 ,w,h) # Bounding box of observations
59+ d = 1024 # Accumulator resolution
60+ P = PCLines(bbox, d) # Create new accumulator
61+ P.insert(x, weights) # Insert observations
62+ p, w = P.find_peaks(min_dist = 10 , prominence = 1.3 , t = 0.1 ) # Find local maxima
63+ ```
64+
65+ ![ ] ( doc/accumulator.png )
66+
67+ 4 . Detected lines
68+
69+ ``` python
70+ h = P.inverse(p) # (a,b,c) parameters of lines
71+ X,Y = utils.line_segments_from_homogeneous(h, bbox) # Convert to line segments for plotting
72+ ```
4673
74+ ![ ] ( doc/lines.png )
4775
4876
4977# Contribute
0 commit comments