General 2D hough transform

Version 1.2.0.0 (1.37 KB) by ja
Performs hough transform with any inputs
698 Downloads
Updated 24 Jul 2014

View License

Memory intensive but fast - contains no for loops. Best suited for non-binary inputs resulting in weighted results, but works just fine for binary images as well - though perhaps slower than needed since a multiplication is probably slower than an 'and' operation.
Two inputs required:
1) The input image to have the hough performed upon (IJ)
2) The kernel image (k). This can be any image - a line, circle, wrench... It doesn't matter as long as it is greyscale and positive. The output marks are with respect to the center of the kernel.
Probably works best for pixel values ranging between 0 and 1, but this isn't likely to be a big deal.

Assumes background is zero.

Best suited for sparse images - the fewer non-zero pixels the more this outperforms other Hough transform functions. So, anything you can set to zero is a good idea, but still works fine if you can't afford to (assuming you have the memory).

Cite As

ja (2026). General 2D hough transform (https://www.mathworks.com/matlabcentral/fileexchange/47120-general-2d-hough-transform), MATLAB Central File Exchange. Retrieved .

MATLAB Release Compatibility
Created with R2012a
Compatible with any release
Platform Compatibility
Windows macOS Linux
Version Published Release Notes
1.2.0.0

clarify description

1.1.0.0

Used a simple logic comparison instead of a division for finding repeats, as this is faster..

1.0.0.0