Mimas Hough Transform
From MMVLWiki
MMHoughTransform is a tool for producing and using hough transforms. As background:
The Hough Transform is a method invented and patented by PVC Hough back in the mists of time. It was originally used to locate particle trails in particle physics experiments. It is essentially a method for mapping measurements to a histogram space, so as to highlight features in the data. It also enables statistical properties to be accumulated.
The MM Hough Transform tool in Mimas is a misnomer . It is really a histogram tool. The transform is really used in user programs to fill the histogram.
Create a mm hough transform using a command such as:
mm_hough_transform ht = new mm_hough_transform ();
This creates an image which has a double value for each pixel. Initialise it to the size you want:
ht.init(500,500);
Now, the object is to fill this image (2d array) with transformed results from some measurement system. For example, imaging that we are measuring lines and we can measure the gradient (which has a value -inf to inf) and the intercept which has value 0-500. We could map the gradient to the x axis of the hough using:
x = arctan( gradient ) 90 / 180 * 500
and the y axis could be the intercept directly. These functions are really the transform part of the hough transform.
Make an entry into the Hough Transform like this:
ht.addGaussPoint( x, y );
This adds a blurry point to the hough image. It will be added to any values already in the image. If you want to add a whole line of points, use
ht.addGaussLine( ... );
The blurriness of each point should be related to the size of the errors present in the measurement of the line gradient and intercept. Really it represents the probability of having measured values values of gradient and intercept.
Typically you make many entries into the hough transform like this. Then you look for the maximum values (peaks) in the image and this tells you the robust measure gradients and intercepts for your data.
If you want to view your hough, because it is just an image, do this:
ht.scale( 0,255 ); ht.display();
There should be a routine in hough_transform to find the peaks in your hough but i haven't put it in yet !!
That is really almost all there is to hough transforms. They are just fancy images, used for collating measurements.
If you want particularly fast hough transforms (meaning that you want to put a lot of entries in ) then you have to firstly initalise a temp array :
ht.initFastGauss( sigma, precision ); //sigma and precision determine the size of the blobs added to the hough for each //point
and then use
ht.addGaussPointFast(...);
to add the points.
We use Hough Transforms in mimas as representations of features (eg cgh, pgh). This is because we can transform lines and corners , treating them as measurements and then create a Hough Transform which is essentially shows what has probably been measured given the input images. This means we can then compare Houghs using standard statistical methods such as the Bhattacharyya distance metric.