FM Structured Light with Quadratic Method
Same as last post www.flickr.com/photos/kylemcdonald/4309938058 but using an alternative method for FFT frequency estimation, described here www.dspguru.com/dsp/howtos/how-to-interpolate-fft-peak
Unfortunately it's still really wavy (see bottom right). I didn't expect that recovering a single frequency would be so difficult. Maybe another technique, like autocorrelation, should be used instead in cases where non-transparent materials are being scanned?
paddedAmplitude = [zeros(1, w); amplitude; zeros(1, w)];
[maxVal, maxInd] = max(paddedAmplitude);
ph = size(paddedAmplitude, 1);
pw = size(paddedAmplitude, 2);
y1 = paddedAmplitude(maxInd - 1 + ph * ((1:pw) - 1));
y2 = maxVal;
y3 = paddedAmplitude(maxInd + 1 + ph * ((1:pw) - 1));
binOffset = (y3 - y1) ./ (2 * (2 * y2 - y1 - y3));
subplot(2, 2, 4);
plot(maxInd + binOffset - 1);
axis square;
axis tight;
xlabel('Position');
ylabel('Quadratic Method Center');
FM Structured Light with Quadratic Method
Same as last post www.flickr.com/photos/kylemcdonald/4309938058 but using an alternative method for FFT frequency estimation, described here www.dspguru.com/dsp/howtos/how-to-interpolate-fft-peak
Unfortunately it's still really wavy (see bottom right). I didn't expect that recovering a single frequency would be so difficult. Maybe another technique, like autocorrelation, should be used instead in cases where non-transparent materials are being scanned?
paddedAmplitude = [zeros(1, w); amplitude; zeros(1, w)];
[maxVal, maxInd] = max(paddedAmplitude);
ph = size(paddedAmplitude, 1);
pw = size(paddedAmplitude, 2);
y1 = paddedAmplitude(maxInd - 1 + ph * ((1:pw) - 1));
y2 = maxVal;
y3 = paddedAmplitude(maxInd + 1 + ph * ((1:pw) - 1));
binOffset = (y3 - y1) ./ (2 * (2 * y2 - y1 - y3));
subplot(2, 2, 4);
plot(maxInd + binOffset - 1);
axis square;
axis tight;
xlabel('Position');
ylabel('Quadratic Method Center');