Due to the definition of the hough-Transformation, the vale for r(roh,theta)=r(-roh,theta+180)
. You can flip the data you get for -90:0 horizontally and you will get the data for 90:180.
The following code uses the example from the documentation and completes the data to full 360 degree:
%example code
RGB = imread('gantrycrane.png');
% Convert to intensity.
I = rgb2gray(RGB);
% Extract edges.
BW = edge(I,'canny');
[H,T,R] = hough(BW,'RhoResolution',0.5,'Theta',-90:0.5:89.5);
% Display the original image.
subplot(3,1,1);
imshow(RGB);
title('Gantrycrane Image');
% Display the Hough matrix.
subplot(4,1,2);
imshow(imadjust(mat2gray(H)),'XData',T,'YData',R,...
'InitialMagnification','fit');
title('Hough Transform of Gantrycrane Image');
xlabel('\theta'), ylabel('\rho');
axis on, axis normal, hold on;
colormap(hot);
%Modifications begin
subplot(3,1,3);
%append another 180 degree to the axis
T2=[T T+180];
%append flipped data
H2=[H,H(end:-1:1,:)];
%plot the same way.
imshow(imadjust(mat2gray(H2)),'XData',T2,'YData',R,...
'InitialMagnification','fit');
title('Hough Transform of Gantrycrane Image');
xlabel('\theta'), ylabel('\rho');
axis on, axis normal, hold on;
colormap(hot);
BW
by 90 degrees if that's an issue (rot90
,imrotate
, 'BW'`, etc) – bla