Hi Guys,
I am trying to write a code to measure the cone angle of some spray images. I have attached the original image '2006.jpg', that's what I have to start with. I also attached how a possible final picture could look like '2006i.jpg'. Note: I don't need the final image, I am just interested in the correct angle.
I know there are different approaches how to calculate the angle since the spray varies in thickness. Basically, I am happy for any method as long as the method is consistent to compare my angle between different liquids.
Here's what I have tried so far: I cropped the picture to the edges of the window and converted the coloured image into black&white. Whit the edge-function using the Sobel-filter I got the contours of the spray
_ clear, clc, close all Image = imread(['2006.jpg']); [a1 a2 a3]=size(Image); x0=215; %if picture higher than increase number 215
y0=255; %if picture to the left than increase number 255
r=170; %170
for i=1:a1 for j=1:a2 if (i-x0)^2+(j-y0)^2>=r^2 Image(i,j,:)=255; end end end Image2=imadjust(rgb2gray(Image)); figure(1); imshow(Image2) hold on BW = im2bw(Image2); figure(2); imshow(BW) BW1 = edge(BW,'sobel'); figure(3); imshow(BW1); size(BW1)_
Here an idea of how my solution could look like:
I guess my next step would be to scan through the picture to find the pixel, which form the spray contours using the find() command and then plot to lines to represent the interpolation of the spray edges using the "interp() command(?). With the intersection of the two lines the angle can be calculated. Sounds easy, but I don't know how that could look like.
Any ideas? Many thanks in advance!
Best Answer