You are now following this question
- You will see updates in your followed content feed.
- You may receive emails, depending on your communication preferences.
how can i find the distance from the peak of one wave to another wave in a image?
1 view (last 30 days)
Show older comments
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 Comments
Accepted Answer
darova
on 19 Feb 2020
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 Comments
darova
on 19 Feb 2020
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
on 19 Feb 2020
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
on 20 Feb 2020
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
on 21 Feb 2020
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
on 22 Feb 2020
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
on 22 Feb 2020
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
on 24 Feb 2020
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
on 24 Feb 2020
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
More Answers (1)
basha Shaik
on 25 Feb 2020
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 Comments
basha Shaik
on 25 Feb 2020
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
on 25 Feb 2020
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
on 25 Feb 2020
i tried but the output it not detecting 2, 8 ,13. i attached the below output image
basha Shaik
on 25 Feb 2020
darova
on 25 Feb 2020
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)
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!An Error Occurred
Unable to complete the action because of changes made to the page. Reload the page to see its updated state.
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- 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)
Asia Pacific
- Australia (English)
- India (English)
- New Zealand (English)
- 中国
- 日本Japanese (日本語)
- 한국Korean (한국어)