I am using opencv2.1.0 and I want to use r-tree structures via opencv. My idea is to find near by line segments for a given line segment (all are in 2d) using r-tree. I really do not know how to use this r-tree functions and i have end point coordinate of each line segment. if anyone knows how to use r-tree in opencv2.1.0 for 2D line segments, please show me the way and give some examples. to make clear i am inserting a picture also. dark line is the given line, dash line is other lines. so i want all dash lines which are closer to the dark line. and I have many occasions like this. so i want efficient way that's why i am looking for r-tree.
Asked
Active
Viewed 397 times
0

templatetypedef
- 362,284
- 104
- 897
- 1,065

niro
- 947
- 3
- 13
- 30
-
**What have you tried?** – Has QUIT--Anony-Mousse Jan 18 '13 at 07:59
-
@Anony-Mousse: I am on the zero level. Not any experience to use this. – niro Jan 21 '13 at 15:56
-
Then better start trying out things. – Has QUIT--Anony-Mousse Jan 21 '13 at 22:29
1 Answers
1
My two cents:
You may need to figure out how to build R-tree on a set of segments. As far as I know, usually R-Tree is used to index spatial points and query processing such as finding nearest neighbors are based on minimum bounding region (MBR) and certain pruning techniques.
How do you define "near by" segments? how do you define distance between two line segments?
This may be useful: http://geomalgorithms.com/a07-_distance.html

taocp
- 23,276
- 10
- 49
- 62
-
your answer is dead on: rtree require these predicates in order to compare the objects it stores and group them by proximity. – didierc Jan 17 '13 at 16:22
-
1The R-tree was originally designed for spatial objects. And it definitely can manage such objects, as each leaf page is such an object in the parent page. So no, the R-tree is not just for points. – Has QUIT--Anony-Mousse Jan 18 '13 at 08:00