how to measure angle and flame speed from Picture ..

24 次查看(过去 30 天)
i would like to measure:
1) the angle (Θ)of the tip of the flame from the picture.
2) the flame speed from the following equation:
SL= V * sin(Θ) , knowing that V= 130 m/s, and the Θ is what im looking for in number (1)
i need help ASAP, please help!!!!!!

采纳的回答

Stephan
Stephan 2019-10-9
编辑:Stephan 2019-10-9
I used this documentation example to build this code:
% find lines
I = imread("5t.JPG");
I1 = rgb2gray(I);
I1 = imbinarize(I1,'adaptive','ForegroundPolarity','bright');
BW = edge(I1,'Sobel');
[H,theta,rho] = hough(BW);
P = houghpeaks(H,5,'threshold',ceil(0.3*max(H(:))));
lines = houghlines(BW,theta,rho,P,'FillGap',5,'MinLength',100);
% Angle from lines objects
angle_between_lines = abs(lines(1).theta) + abs(lines(2).theta);
fprintf('Angle between lines from Lines objects: %.2f°\n',angle_between_lines);
% calculate angle by the endpoints of the lines for more accurate results
angle_calc = atand((abs(lines(1).point1(1) - lines(1).point2(1))) /...
(abs(lines(1).point1(2) - lines(1).point2(2)))) +...
atand((abs(lines(2).point1(1) - lines(2).point2(1))) /...
(abs(lines(2).point1(2) - lines(2).point2(2))));
fprintf('Angle between lines calculated from endpoints: %.2f°',angle_calc);
% show results
figure(1)
imshow(I)
hold on
for k = 1:length(lines)
xy = [lines(k).point1; lines(k).point2];
plot(xy(:,1),xy(:,2),'LineWidth',2,'Color','green');
end
hold off
ends in:
and result:
Angle between lines from Lines objects: 67.00°
Angle between lines calculated from endpoints: 67.14°

更多回答(2 个)

Ayuob Alwahaibi
Ayuob Alwahaibi 2019-10-9
编辑:Tushal Desai 2019-10-11
Thanks Stephan, but the code works for only the picture i attached. i tried the code with other picture, but i keep getting error "Error in SL2 (line 10)
angle_between_lines = abs(lines(1).theta) + abs(lines(2).theta);"
here are some other pictures, can you please modify the code in a way that can work with any of the pictures below: ltr

Stephan
Stephan 2019-10-10
Usually i would not open a new answer - but this question is weird, because i can not comment it for some technical reason. However this improved version of the code works for al the pictures you attached:
% find lines
I = imread("5t.JPG");
I1 = I(:,:,3);
treshold = 0.82*max(max(I1));
I1(I1<treshold) = 0;
I1 = imbinarize(I1,'adaptive','ForegroundPolarity','bright');
[H,theta,rho] = hough(I1);
NHoodsize = (2*round(size(H)/10,0))+1;
P = houghpeaks(H,2,'threshold',ceil(0.5*max(H(:))),'NHoodSize',NHoodsize);
lines = houghlines(I1,theta,rho,P,'FillGap',5,'MinLength',10);
% Angle from lines objects
angle_between_lines = abs(lines(1).theta) + abs(lines(2).theta);
fprintf('Angle between lines from Lines objects: %.2f°\n',angle_between_lines);
% calculate angle by the endpoints of the lines for more accurate results
angle_calc = atand((abs(lines(1).point1(1) - lines(1).point2(1))) /...
(abs(lines(1).point1(2) - lines(1).point2(2)))) +...
atand((abs(lines(2).point1(1) - lines(2).point2(1))) /...
(abs(lines(2).point1(2) - lines(2).point2(2))));
fprintf('Angle between lines calculated from endpoints: %.2f°',angle_calc);
% show results
figure(1)
imshow(I)
hold on
for k = 1:length(lines)
xy = [lines(k).point1; lines(k).point2];
plot(xy(:,1),xy(:,2),'LineWidth',2,'Color','green');
end
hold off

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by