Posts

Showing posts with the label Matrix

How To Create A Simple Hough Transform Matrix

A = [0 0 0 0 15; 0 0 0 15 0; 0 0 15 0 0; 0 15 0 0 0; 15 0 0 0 0]; [m,n] = size(A); rhoValues = zeros(m,n); thetaValues = zeros(m,n); diagonalDist = floor(sqrt(m^2 + n^2)); thetaMax = 90; rhoRange = -diagonalDist:diagonalDist; thetaRange = -thetaMax:thetaMax; %Matrix Hough houghMatrix = zeros(length(rhoRange), length(thetaRange)); for i = 1:m     for j = 1:n         if (A(i,j) ~= 0)             x = m - 1;             y = n - 1;             for theta = thetaRange                 rhoValues = round((x*cosd(theta)) + (y*sind(theta)));                 rhoIndex = rhoValues + diagonalDist + 1;                 thetaIndex = theta + thetaMax + 1;                 houghMatrix(rh...