# how to measure angle and flame speed from Picture ..

9 views (last 30 days)
Ayuob Alwahaibi on 9 Oct 2019
Edited: Tushal Desai on 11 Oct 2019
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)

#### 1 Comment

darova on 9 Oct 2019
What have you tried? What about imline?

Stephan on 9 Oct 2019
Edited: Stephan on 9 Oct 2019
I used this documentation example to build this code:
% find lines
I1 = rgb2gray(I);
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°

Ayuob Alwahaibi on 9 Oct 2019
Edited: Tushal Desai on 11 Oct 2019
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 on 10 Oct 2019
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
I1 = I(:,:,3);
treshold = 0.82*max(max(I1));
I1(I1<treshold) = 0;
[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