I was trying to extract all the stems from a plant image using Frangi filter. I wanted to make use of the property that each stem has more vessel like characteristics than a leaf. Using this paper as reference.
My input image is this
And this is my matlab code snippet
options=struct('FrangiScaleRange', [1 3], 'FrangiScaleRatio', 1, 'FrangiBetaOne', 0.5,...
'FrangiBetaTwo', 2, 'verbose',true,'BlackWhite',true);
[outIm,whatScale,Direction] = FrangiFilter2D(double(rgb2gray(img2)), options);
outIm = uint8(outIm/max(outIm(:))*256);
This is the output
I am aware that there could be other ways to accomplish this task but i am just curious to know, why this approach is not working.
In terms of Frangi-filter, both your stems and leafs are vessel-like as discussed already, so you cannot simply use the filter output to distinguish between them.
What you can however, is: (i) choose better scales ( roughly fitted to the scale of a structure you are trying to detect) and (ii) try different parameters.
I had a try, given scales 5 10 20 30
and Frangi parameters beta=0.5
and c=100
[Frangi et al.: Multiscale vessel enhancement filtering, MICCAI 1998]
this is what I got:
Scales in logical units of the original image https://i.sstatic.net/s6wuE.jpg, which was converted to gray-8bpp in Photoshop.
What you can observe is the following. Leafs give response at higher scales than stems. Maybe that could be a clue.
EDIT:
I had a look at the https://i.sstatic.net/eZwxg.png. The "edge detector"-effect on bright leafs is due to fact that the Frangi's theory fits insufficiently to two dimensions:
and in contrary