8 Replies - 834 Views - Last Post: 31 January 2013 - 09:38 AM Rate Topic: -----

#1 g_niro  Icon User is offline

  • New D.I.C Head

Reputation: -2
  • View blog
  • Posts: 44
  • Joined: 26-January 11

How to use R-tree for line segments (using opencv)

Posted 26 January 2013 - 12:47 PM

I have huge number of 2D line segments having varying in length and oriented in different direction.
My idea is to find near by line segments for a given line segment using r-tree data structure. I found opencv library also contains R-tree but I really do not know how to use this r-tree functions.
If i say about my data; i have end point coordinates of each line segment and also I gave a unique number for each line.

Currently, I am using opencv2.1.0 and I want to use r-tree structures via opencv2.1.0.

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 want efficient way that's why i am looking for r-tree.

This post has been edited by g_niro: 26 January 2013 - 12:48 PM


Is This A Good Question/Topic? 0
  • +

Replies To: How to use R-tree for line segments (using opencv)

#2 tlhIn`toq  Icon User is offline

  • Please show what you have already tried when asking a question.
  • member icon

Reputation: 5316
  • View blog
  • Posts: 11,360
  • Joined: 02-June 10

Re: How to use R-tree for line segments (using opencv)

Posted 26 January 2013 - 12:56 PM

The documentation is way over my head...
But it is documented.
http://docs.opencv.o...ndom_trees.html

Have you tried the samples and examples? Or have you just thrown it into your code and tried to figure it out by playing with it?

There were numerous other examples when I Googled "OpenCV r-tree".
But the usage and math were all out of my area of experience so I have no idea if its the right tool for the job.
Was This Post Helpful? 1
  • +
  • -

#3 g_niro  Icon User is offline

  • New D.I.C Head

Reputation: -2
  • View blog
  • Posts: 44
  • Joined: 26-January 11

Re: How to use R-tree for line segments (using opencv)

Posted 26 January 2013 - 01:18 PM

View PosttlhIn`toq, on 26 January 2013 - 07:56 PM, said:

The documentation is way over my head...
But it is documented.
http://docs.opencv.o...ndom_trees.html

Have you tried the samples and examples? Or have you just thrown it into your code and tried to figure it out by playing with it?

There were numerous other examples when I Googled "OpenCV r-tree".
But the usage and math were all out of my area of experience so I have no idea if its the right tool for the job.


thanks for the reply. but what i confused is it says something about training data. but i dont have something like that. but i heard r-tree can be used many other applications. for me, i want to filter out few line segments from the whole list (with respect to distance threshold).
if i give another example; if i have huge points, then if i want certain number of points which are closely located to a given point, then i can use kd-tree. for that 3d distances are used to find relevant points. but i can not use kd-tree as it is designed for point data. I got to know for the line segments, similar thing can be done using r-tree.
so, looking for that case...

This post has been edited by g_niro: 26 January 2013 - 01:24 PM

Was This Post Helpful? 0
  • +
  • -

#4 tlhIn`toq  Icon User is offline

  • Please show what you have already tried when asking a question.
  • member icon

Reputation: 5316
  • View blog
  • Posts: 11,360
  • Joined: 02-June 10

Re: How to use R-tree for line segments (using opencv)

Posted 26 January 2013 - 01:23 PM

And the point to quoting my post with no additional comments or questions was.... ?
Was This Post Helpful? 0
  • +
  • -

#5 g_niro  Icon User is offline

  • New D.I.C Head

Reputation: -2
  • View blog
  • Posts: 44
  • Joined: 26-January 11

Re: How to use R-tree for line segments (using opencv)

Posted 26 January 2013 - 01:43 PM

Sorry, i think i made a mistake when replying.. so again replying with more explanation.thanks

thanks for the reply. but what i confused is it says something about training data. but i dont have something like that. but i heard r-tree can be used many other applications. for me, i want to filter out few line segments from the whole list (with respect to distance threshold).
if i give another example; if i have huge points, then if i want certain number of points which are closely located to a given point, then i can use kd-tree. for that 3d distances are used to find relevant points. but i can not use kd-tree here for line segments as it is designed for point data. I got to know for the line segments, similar thing can be done using r-tree.
when i search the opencv documents for r-tree though it give lots of information i can not figure out how can i apply them for my case.
for my case, for each line segments i have line number and end points. also i can make another list containing my desired line segments. then i can defined a distance threshold to identify nearby lines for my desired lines... concerning those inputs i cannot figure out how or which function suite for me.

@#2 tlhIn`toq: sorry, i wanted to reply. but by mistake i press quoted. sorry for that.
Was This Post Helpful? 0
  • +
  • -

#6 tlhIn`toq  Icon User is offline

  • Please show what you have already tried when asking a question.
  • member icon

Reputation: 5316
  • View blog
  • Posts: 11,360
  • Joined: 02-June 10

Re: How to use R-tree for line segments (using opencv)

Posted 26 January 2013 - 02:22 PM

View PosttlhIn`toq, on 26 January 2013 - 01:56 PM, said:

The documentation is way over my head...


View Postg_niro, on 26 January 2013 - 02:43 PM, said:

it says something about training data. but i dont have something like that.

i can not figure out how can i apply them for my case.

i cannot figure out how or which function suite for me.


Then I would have to guess its not the right tool for you. It might or might not be the right tool for the job. But even if it is you're not making any more sense out of the documentation than I am.

So you either need to
  • start beating on code with this... First using it the way it is meant to be used so you can understand its full funcationality and potential, *THEN* decide if it is right for this situation. The worst that can happen is you learn something new.
    -or-
  • look for another approach.

Was This Post Helpful? 0
  • +
  • -

#7 g_niro  Icon User is offline

  • New D.I.C Head

Reputation: -2
  • View blog
  • Posts: 44
  • Joined: 26-January 11

Re: How to use R-tree for line segments (using opencv)

Posted 26 January 2013 - 03:33 PM

yes, that is true. but from another forum, others suggest me to use R-tree. thats why i know r-tree. as opencv2.1.0 is in my machine i want to try opencv. may be there are some other libraries which gives exact functionality what i need. or may be, i do not know the exact way to use this opencv for this purpose. Do you know, is there any specific forum or people to help relevant to use of opencv? thanks again for the comments.
Was This Post Helpful? 0
  • +
  • -

#8 #define  Icon User is offline

  • Duke of Err
  • member icon

Reputation: 1276
  • View blog
  • Posts: 4,398
  • Joined: 19-February 09

Re: How to use R-tree for line segments (using opencv)

Posted 26 January 2013 - 06:28 PM

Usually in machine learning training data is data (with responses) that you have developed yourself. So you could take some of your own data and produce responses (outputs) for it.


Example : random forest (tree) learning

Which is from stackoverflow OpenCV - Random Forest Example

This post has been edited by #define: 26 January 2013 - 06:52 PM

Was This Post Helpful? 2
  • +
  • -

#9 tlhIn`toq  Icon User is offline

  • Please show what you have already tried when asking a question.
  • member icon

Reputation: 5316
  • View blog
  • Posts: 11,360
  • Joined: 02-June 10

Re: How to use R-tree for line segments (using opencv)

Posted 31 January 2013 - 09:38 AM

View Postg_niro, on 26 January 2013 - 04:33 PM, said:

yes, that is true. but from another forum, others suggest me to use R-tree. thats why i know r-tree.


If someone suggested it is a good tool for the job, then maybe you should ask that person how to use it. The obviously already know or they wouldn't have made the suggestion.

In other words... If Bob tells me to do something, I don't ask Mark what he meant. I go back to Bob for clarification.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1