I have a image of fuel spray and i want to find the angle of the fuel spray. One of the research papers I was reading tells me that I can find the angle using the area at half length of the spray and I've been trying to find the area at half length for a couple of weeks right now.
The code below shows what I tried. I've also tried other methods such as trimming out all the non zero elements and just calculating the angle from the end of the spray. Since that is giving me an inaccurate answer, I'm here looking for help.
img_subt_binary= imbinarize(img_subt);
BW2= BiggestImageOnly(img_subt_binary);% Clear out all white areas that have less than 175 pixels.
% figure(2),imshow(BW2),
% title('Filtered Binary Image')
% [pixelCount, grayLevels] = imhist(BW2);
% figure(3)
% bar(grayLevels, pixelCount);
[the_length,the_width]=size(BW2)
%% Spray Angle
half_length=the_length/2;
for j=1:half_length
j=j+1;
[LL(j),WW(j)]= size(BW2);
final_width=max(WW);
end
angle= atan(final_width/half_length)
I'm expecting the spray angle to be around 20 degrees.
To get a better estimation of the change in width (spray angle) you might want to fit a line across the entire image
[h w] = size(BW2);
margin = ceil(h/10); % ignore top/bottom parts
row_width = sum(BW2(margin:end-margin,:), 2); % number of white pixel in each row
x = 1:numel(row_width);
pp = polyfit(x, row_width.', 1); % fit a line
% see the line
figure;
plot(row_width);
hold all;
plot(x, x*pp(1) + pp(2));
% get the angle (in degrees)
angle = atan(pp(1)) * 180 / pi
The estimated angle is
7.1081
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.