Ravi Shankar
Ravi Shankar

Reputation: 377

Plotting Hough Transform MATLAB

I was trying to plot hough transform using hough(edge_detected_image). Then Im using the following commands:

imshow(h,[],'XData',theta,'YData',rho,'InitialMagnification','fit');
 axis on
 axis normal
 hold on

But Im getting the plot as:this

while i need something like this

How can this be achieved? Are there any settings to be done?

Upvotes: 3

Views: 196

Answers (1)

rayryeng
rayryeng

Reputation: 104464

You need to change the colour map. In addition, you may want to rescale the data so that it conforms within an acceptable range. Use imadjust on the output accumulator matrix prior to showing it. You will need to change the values of the accumulator matrix so that it's normalized. Simply dividing by the maximum value of h should work.

The colour map used in your figure is the hot colour map, so therefore:

imshow(imadjust(h / max(h(:))),'XData',theta,'YData',rho,'InitialMagnification','fit');
axis on; axis normal; hold on
colormap(gca,hot);

Upvotes: 6

Related Questions