Skip to content

Commit 251a18c

Browse files
committed
Doc update
1 parent d7c7159 commit 251a18c

File tree

6 files changed

+31
-3
lines changed

6 files changed

+31
-3
lines changed

README.md

Lines changed: 31 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,11 +39,39 @@ Alternatively, you can download this repository and install manually.
3939
import 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

doc/accumulator.png

93.1 KB
Loading

doc/edges.png

35.9 KB
Loading

doc/image.png

30 KB
Loading

doc/lines.png

62.5 KB
Loading

doc/test.png

17.9 KB
Loading

0 commit comments

Comments
 (0)