Ask Your Question
0

2D line fitting using RANSAC

asked 2014-10-31 14:23:43 -0600

kusan gravatar image

updated 2014-10-31 14:25:15 -0600

I have a very simple Mat object which is a binary image. All the pixels are 0 except a few which are 1(some of which are inliers and some are outliers). I want to fit a line on these 1 pixels using RANSAC. Is there any built in method to do that or I have to write one?

I am using OpenCV v2.4.8 on Fedora 20 GNU/Linux.

edit retag flag offensive close merge delete

Comments

Hi. Are you using C++, java, python... ?

Doombot gravatar imageDoombot ( 2014-10-31 14:28:15 -0600 )edit

FYI, here are the different classifiers available in OpenCV http://docs.opencv.org/trunk/modules/ml/doc/ml.html

I know that the function findHomography is able to use RANSAC to find the a good fit between two sets of points, but I personnaly don't know if you can use it as a standalone without ripping it form the source code of findHomography/other relevant source code.

Luckily someone knowledgeable will answer!

Doombot gravatar imageDoombot ( 2014-10-31 14:32:53 -0600 )edit

Thank you Doombot :) btw, I am using C++

kusan gravatar imagekusan ( 2014-11-14 01:30:59 -0600 )edit

2 answers

Sort by ยป oldest newest most voted
2

answered 2014-10-31 16:06:34 -0600

edit flag offensive delete link more

Comments

FooBar, I have considered HoughLines. Unfortunately it was not giving me what I wanted. Later I attacked my original problem in a different approach which does not require either Hough fitting or RANSAC. But I plan to write a RANSAC line fitting function later in my free time.

kusan gravatar imagekusan ( 2014-11-14 01:35:28 -0600 )edit
1

answered 2014-12-06 17:31:42 -0600

basheer gravatar image

According to this SO answer, the OpenCV FitLine function already does this.

edit flag offensive delete link more

Question Tools

Stats

Asked: 2014-10-31 14:23:43 -0600

Seen: 12,882 times

Last updated: Dec 06 '14