how can i find the distance from the peak of one wave to another wave in a image?
1 次查看(过去 30 天)
显示 更早的评论
basha Shaik
2020-2-19
i need to find the distance of the wave. i refer to some questions & answers from that i get to know can solve canny's edge detection method.
but i don't know how to process it. can anyone help me...?
4 个评论
采纳的回答
darova
2020-2-19
I suggest next algorithm
- imcrop region of interest (since it's always at the same position
- imbinarize image
- maybe clear a bit with bwareaopen
- find pixels you are interested in
- use findpeaks
17 个评论
darova
2020-2-19
I tried to define distance in 00001.jpg image
Can you tell the difference between D1 and D2? Don't how to identify them
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/272645/image.png)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/272646/image.png)
00003.jpg image
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/272647/image.png)
basha Shaik
2020-2-19
it is just the wave before the breakup of the liquid sheet. i need to find the wave peak. in that d1 is occurs before the breakup. but d2 is already breakup into liquid droplets.
darova
2020-2-20
I wrote a script
Some explanations:
- Experiment with number of removing pixels
I2 = bwareaopen(I1,2e2); % remove small objects
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/272793/image.png)
- Experiment with reducing of number of points
ii = 1:5:length(x); % reduce number of points
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/272794/image.png)
- Experiment with peakheight
[~,locs] = findpeaks(abs(kk),'MINPEAKDISTANCE',3,...
'MINPEAKHEIGHT', 0.05);
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/272795/image.png)
- Experiment with angle of liquid breakup
If angle is small - consider/measure 2d peak
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/272796/image.png)
If angle is big - consider/measure 1th peak
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/272797/image.png)
if atan2d(dy(end),dx(end)) > 110 % angle of breakup
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/272798/image.png)
Feel free to ask question. Let me know if something doesn't work
basha Shaik
2020-2-21
thank you very much. but what the pixel length of that wave distance...? i didn't understand that. and this code can generate for all the images at once....?
basha Shaik
2020-2-22
thank you. but i got some error while run the script.
Error using chckxy (line 30)
The first two inputs must have at least two elements.
Error in spline (line 72)
[x,y,sizey,endslopes] = chckxy(x,y);
Error in main>write_length (line 39)
x2 = spline(t1,x1,t2);
Error in main (line 4)
write_length(STR);
darova
2020-2-22
Show your image. Remove it or replace from folder and change your main code as
function main
for i = 1:3
STR = sprintf('%05d.jpg',i);
if exist(STR,'file')
write_length(STR);
end
pause(1)
end
end
darova
2020-2-24
Here is what got
I only commented these lines because of
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/273418/image.jpeg)
% set(gca,'clim',[-1 1]/3)
% colormap default
See .zip file
darova
2020-2-24
In case of other error try this:
function main
for i = 0:1
try
STR = sprintf('%05d.jpg',i);
write_length(STR);
pause(1)
catch ME
if ~exist(STR,'file')
disp(['File ' STR ' Does not exist'])
else
disp(ME.identifier)
disp(['File ' STR ' was not processed'])
end
end
end
end
更多回答(1 个)
basha Shaik
2020-2-25
sorry for making you trouble and thank you for helping me.
here, i attached the output i got but i didn't understand exactly, here i explain in brief
i need to solve 13000 images at once and need to save the value of wave length in .dat file or any numerical value format.
can u help me with the code for solving this problem.
do u solve the all the images at once....?
7 个评论
basha Shaik
2020-2-25
thank u very much.
2.jpg
3.jpg 15.9798035376983
4.jpg MATLAB:badsubscript
5.jpg 17.3668315184042
6.jpg
7.jpg 19.6975375353927
8.jpg
9.jpg 34.2065668340247
11.jpg
12.jpg 49.2911737269352
13.jpg 34.8050889623858
this the dat data. but it not showing for some images.
darova
2020-2-25
Experiment with this line
>> STR = sprintf('%05d.jpg',15)
STR =
00015.jpg
>> STR = sprintf('%05d.jpg',8)
STR =
00008.jpg
>> STR = sprintf('%01d.jpg',8)
STR =
8.jpg
basha Shaik
2020-2-25
i tried but the output it not detecting 2, 8 ,13. i attached the below output image
basha Shaik
2020-2-25
darova
2020-2-25
I changed angle of breakup for 2.jpg
if atan2d(dy(end),dx(end)) > 130 % angle of breakup
Result
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/273652/image.jpeg)
I think 11.jpg is defective. I don't see here a wave. Can you see?
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/273653/image.jpeg)
8.jpg is problem. I don't how to measure a wave length. Sorry
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/273654/image.jpeg)
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!发生错误
由于页面发生更改,无法完成操作。请重新加载页面以查看其更新后的状态。
您也可以从以下列表中选择网站:
如何获得最佳网站性能
选择中国网站(中文或英文)以获得最佳网站性能。其他 MathWorks 国家/地区网站并未针对您所在位置的访问进行优化。
美洲
- América Latina (Español)
- Canada (English)
- United States (English)
欧洲
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)
亚太
- Australia (English)
- India (English)
- New Zealand (English)
- 中国
- 日本Japanese (日本語)
- 한국Korean (한국어)