From: Fred Vrancken on 4 Aug 2010 05:11 Hello, I'm trying to automatically measure the cone angle of a fuel injector spray using the image toolbox commands in Matlab. After doing edge detection and other post-processing I have come up with a b&w picture like this http://i12.photobucket.com/albums/a234/fred_3202/bwFinal_FuelSpray.jpg I know need to automatically measure the approx. angle of the spray. What is the best way to do this ??? I was thinking about marking points where there is a transition of white to black and then plotting a line through those points. And repeat the process for the bottom half of the picture but I have no idea how to start writing the code for that or if it's even the correct way to do it. Some help would be greatly appreciated Thank u
From: Joseph on 4 Aug 2010 13:40 Fred, I think the answer depends on what angle you plan on measuring. In other words, you want to choose a method that will produce an angle value close to what you expect. It seems like fitting two straight lines to the image is a reasonable idea though. "Fred Vrancken" <fred_3202(a)hotmail.com> wrote in message <i3bar9$a94$1(a)fred.mathworks.com>... > Hello, > > I'm trying to automatically measure the cone angle of a fuel injector spray using the image toolbox commands in Matlab. > > After doing edge detection and other post-processing I have come up with a b&w picture like this http://i12.photobucket.com/albums/a234/fred_3202/bwFinal_FuelSpray.jpg > > I know need to automatically measure the approx. angle of the spray. > What is the best way to do this ??? > > I was thinking about marking points where there is a transition of white to black and then plotting a line through those points. And repeat the process for the bottom half of the picture but I have no idea how to start writing the code for that or if it's even the correct way to do it. > > Some help would be greatly appreciated > > Thank u
From: ImageAnalyst on 4 Aug 2010 14:12 Fred: I'd find the first and last bright pixel in each column using the find() function. Maybe something like (untested) for columnNumber = 1:size(imageArray, 2) topRows(columnNumber) = find(imageArray(:, columnNumber)>0, 1, 'first'); bottomRows(columnNumber) = find(imageArray(:, columnNumber)>0, 1, 'last'); end Maybe there's a way to do it all in one line - I don't know. Then pass in the first white row (topRows) for all the columns into polyfit to fit a line to the upper edge of your spray. Then do the same with the bottom rows of your spray to get a fitted line for the bottom edge of your spray. Once you know the equation of the lines for the top and bottom, you can calculate the angle and the vertical width of the spray as a function of distance (column). -ImageAnalyst
From: Nathan on 4 Aug 2010 15:42 On Aug 4, 2:11 am, "Fred Vrancken" <fred_3...(a)hotmail.com> wrote: > Hello, > > I'm trying to automatically measure the cone angle of a fuel injector spray using the image toolbox commands in Matlab. > > After doing edge detection and other post-processing I have come up with a b&w picture like thishttp://i12.photobucket.com/albums/a234/fred_3202/bwFinal_FuelSpray.jpg > > I know need to automatically measure the approx. angle of the spray. > What is the best way to do this ??? > > I was thinking about marking points where there is a transition of white to black and then plotting a line through those points. And repeat the process for the bottom half of the picture but I have no idea how to start writing the code for that or if it's even the correct way to do it. > > Some help would be greatly appreciated > > Thank u Well, what determines the angle? Take a look at a snapshot of our program. http://drop.io/sprayangle The yellow lines outline where one of our algorithms determines what the angle of the spray should be. What determines where your angle should lie? Should it always be outside of the spray? Should the lines that form the angle be partially within the spray? Our program uses one of two methods of finding the spray angle. One is as follows: Compute the spray angle based on an average spray angle between a starting point in the spray (expressed as a percentage of the total spray length) and an ending point in the spray. Another way is from a paper: Method from Siebers SAE 1999-01-0528 for spreading angle. See appendix A, equation 01. -Nathan
From: Fred Vrancken on 5 Aug 2010 12:45
ImageAnalyst <imageanalyst(a)mailinator.com> wrote in message <57891caa-653c-407a-bfb8-9a34fc2231d3(a)i28g2000yqa.googlegroups.com>... > Fred: > I'd find the first and last bright pixel in each column using the > find() function. Maybe something like (untested) > for columnNumber = 1:size(imageArray, 2) > topRows(columnNumber) = find(imageArray(:, columnNumber)>0, 1, > 'first'); > bottomRows(columnNumber) = find(imageArray(:, columnNumber)>0, 1, > 'last'); > end > Maybe there's a way to do it all in one line - I don't know. > > Then pass in the first white row (topRows) for all the columns into > polyfit to fit a line to the upper edge of your spray. Then do the > same with the bottom rows of your spray to get a fitted line for the > bottom edge of your spray. Once you know the equation of the lines > for the top and bottom, you can calculate the angle and the vertical > width of the spray as a function of distance (column). > -ImageAnalyst If I understand correctly (because i'm pretty new to matlab) the code must look like this : for columnNumber = 1:200(BWfinal, 2) topRows(columnNumber) = find(BWfinal(:, columnNumber)>0, 1, 'first'); bottomRows(columnNumber) = find(BWfinal(:, columnNumber)>0, 1, 'last'); end BWfinal = imagearray black & white so 0 and 1's 200 is the size = max number of columns in BWfinal However i'm not sure what the (BWfinal,2) is doing after the 1:200 statement |