Image Analysis Problem (modifying a code)
4 ビュー (過去 30 日間)
古いコメントを表示
Does anyone have any idea how to modify this code so that you can measure the a sinusodial pattern based on a vertically taken image?
So I have this choas project where I am measuring and analysize the surface amplitude of cornstarch and water when it under goes Faraday weaves (ie. this <http://www.youtube.com/watch?v=LCk9-blM5Xg&feature=results_video&playnext=1&list=PL5064B097E1F88F1F>) . Early in the project someone created a way to measure the amplitude if we looked from the side using the threshold in the image that seperated the liquid surface from the air. To help in imagary here is a picture of the Faraday waves we measure for water: http://imageshack.us/photo/my-images/856/faradaywaves.jpg/
Now the cornstarch is very viscious and sticky so we had to actually measure it vertically (at an 89* angle) to get accurate picture of the waves. To help in imagary, here is the picture of the Faraday waves we measure for cornstarch: http://imageshack.us/f/683/cornstarch.jpg/ The problem as you can see is that for some reason, I cannot seem to use the threshold to measure the downward part of the curve I see in im as I do scans.
I would ask the orginal person who developed the code, but they have been sick for a month so I have been unable to get in touch with them.
Does anyone have any idea how to modify this code so that you can measure the a sinusodial pattern based on a vertically taken image? %%
ystart = 250;
thresh = 90;
pix2cm = 1;
mm = mmreader('CStarch1_10_100.000000_50.000000_4000_VID.avi');
im = read(mm,1);
imagesc(im)
for kk=1:mm.NumberOfFrames
im = read(mm,kk);
im = im(:,:,1);
xx = [0:size(im,2)-1]*pix2cm;
for ii=1:size(im,2)
dat = im(ystart:-1:1,ii);
a = find(dat < thresh, 1, 'first');
ht(ii, kk) = ystart - a;
end
offset(kk) = mean(ht(:,kk));
ht(:,kk) = (ht(:,kk) - offset(kk)) * pix2cm;
% [ft gof] = fit(xx', ht(:,kk), 'sin1', fitoptions('Method','NonLinearLeastSquares',...
% 'StartPoint',[1 0.05 1],'Upper', [20 1 Inf],'Lower', [0 0.02 0]));
%
ftt = abs(fftshift(fft(ht(:,kk))));
amppower(kk) = sum(ftt(365:367));
%
figure(1);
clf;
subplot(3,1,1);
imagesc(im);
subplot(3,1,2);
plot(xx, ht(:,kk), 'ok');
hold on;
% plot(ft);
subplot(3,1,3);
plot(linspace(-1,1,length(ftt)),abs(fftshift(fft(ht(:,kk)))));
axis([-0.1 0.1 0 inf]);
% pause;
drawnow;
% figure(2);
% clf;
% plot(datt(:,3), amppower(:), '-r');
% hold on;
% plot(datt(kk,3), amppower(kk), 'ob');
%
% wavelength(kk) = 2*pi/ft.b1;
% amplitude(kk) = ft.a1;
% phase(kk) = ft.c1;
end
hold off
fprintf('....done \n')
0 件のコメント
回答 (0 件)
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!