# What are the pros and cons of RANSAC versus Hough Transform?

A friend needs to find the pool balls in an image of a pool table. Would a Hough transform be a good idea? Why/why not? Would RANSAC be better?

The question comes from this study guide (http://www.cc.gatech.edu/~afb/classes/CS4495-Spring2015-OMS/), is not homework, and I am not currently taking this class.

What I know: RANSAC is least-squares plus a system with voting. We pick the least squares solution that has the least outliers. Hough transform is about finding parametric shapes. You can transform something into Hough space. For a circle you might want to know the radius. If you know more information about your circle (the pool ball) you'll not have as much space to search.

I think it makes sense to use Hough transforms in the case of finding pool balls so I am wondering how and why you'd even use RANSAC.

Edit: I think you could use RANSAC if you had another image to match to that you knew had pool balls in it. The images would be matched against each other, and the features that came out would be the pool balls. But again, it seems like RANSAC isn't a good idea because it could only fit one model to the whole image.

• 1. How were you planning to use RANSAC for this task? Edit the question to show your plan. 2. Put together a simulation and give it a try! Learning by doing is one of the best ways to learn.
– D.W.
Aug 3, 2016 at 15:58

## 1 Answer

The Hough transform would be a reasonable approach for this. Another reasonable approach would be to find connected regions of similar hue, and for each, test if it is approximately pool-ball-shaped.

RANSAC doesn't seem like a good tool for this purpose. RANSAC is commonly used to find, e.g., a line that approximately goes through a bunch of points (but possibly with a few outliers that might not fit the line). Here, the pool balls are spheres, not lines.

RANSAC is typically used for other tasks: e.g., for aligning two images. However, here image alignment probably isn't a good way to find pool balls on a pool table.