I wrote some MATLAB code to locate the angles and mean separation between lines.
close all
I = imread('testimage'testt.jpg');
I = rgb2gray(I);
I = I(2:end-1,:);
% Radon transform
R = radon(I,0:179);
imagesc(R); colormap gray(256); pause;
% Chop offRadon outtransform of rangesmoothed partsimage
chopRg = sizeradon(R,1) - sizeimgaussian(I,1);
chop = ceil(chop/2);
R = R(chop+1:end-chop,0:179);
imagesc(RRg); colormap gray(256); pause;
% GaussianTake smoothingit away
RgRf = imgaussian(R,2); - Rg;
imagesc(RgRf); colormap gray(256); pause;
% TakeChop itoff awayout of range parts
Rfchop = Rsize(Rf,1) - Rg;size(I,1);
chop = ceil(chop/2);
Rf = Rf(chop+1:end-chop,:);
imagesc(Rf); colormap gray(256); pause;
% Negative lines - threshold
Rf(Rf > 0) = 0;
imagesc(Rf); colormap gray(256); pause;
% Plot sum - peaks are angles
Rp = sum(abs(Rf));
plot(Rp);
% Get the peaks sep by at least 15 deg
[p,a] = findpeaks(Rp,'minpeakdistance',15,'sortstr','descend');
hold on;
scatter(a,p,'r*');
hold off;
pause;
% Iterate through peaks and find fequencies
for j = 1:numel(a)
% Get subsection of Radon transform around angle and transpose
vstart = max([a(j)-10,1]);
vend = min([a(j)+10,size(Rf,2)]);
Rsub = Rf(:,vstart:vend).';
imagesc(Rsub); colormap gray(256); pause;
RsubP = sum(abs(Rsub));
plot(RsubP); pause;
% Find peak correlation with a bit of smoothing
xp = xcorr(imgaussian(RsubP,2),imgaussian(RsubP,2));
plot(xp); pause;
[rp,rl] = findpeaks(xp,'sortstr','descend');
wave(j) = abs(rl(1) - rl(2));
disp(['Angle: ' num2str(a(j))]);
disp(['Wavelength: ' num2str(wave(j))]);
disp(['Strength: ' num2str(p(j))]);
pause;
end
Still have to work out how to get the frequencies by this method though.and
Angle: 73
Wavelength: 16
Strength: 12401.356
Angle: 92
Wavelength: 54
Strength: 9442.2545
Angle: 175
Wavelength: 33
Strength: 9030.1877