Hello,
I need some help using improfile multiplie times in one image.
Sample image is here:
http://i1223.photobucket.com/albums/dd501/vinatec/matlab_example.png
What you see is some grayscale image of a filament on a dark background.
I did manage to
a) get the skeleton/backbone (binary of original with bwmorph thinning/skeletonize)
b) fit a spap2 spline to it (blue line)
c) do the derivation of the spline to
d) get tangential vectors along the contour (red arrows)
e) get the orthogonal vectors on the tangents (green arrows)
f) and plot lines (yellow) indicating the range improfile uses to determine the intensity values along that line
However I have trouble to use these extracted profiles. Imagine I want to extract the profiles and basically fit a gaussian to them, so I can determine the FWHM of the original grayscale filament orthogonal to its contour/backbone.
Right now I use:
[xline{i}, yline{i}, grayvalue{i}]= improfile(SUM, [(x(i)-dy(i)*sf) (x(i)+dy(i)*sf)], [(y(i)+dx(i)*sf) (y(i)-dx(i)*sf)], 50,'bicubic');
So I have some points P along the contour with coords x/y and the derrivative dx/dy to get the the direction of the orthogonal vector. I introduced some scaling factor sf to actually seperate start and end point from each other (as improfile needs exact start and end points and not only a direction (correct?)).
Problem is now (I think so):
every line to extract the profiles has a different length (as I have some abitrary angles and I guess not all start end points fall in the normal rasterization), improfile does some equally spacing of the points where to extract the intensity (correct?), so I never end up with values which are comparable or usable in terms of 1px (1 spacing unit) corresponds to lets say 50nm.
I can't manage/don't find a way to force improfile to use "normal" spacing between the points along the line. The length of the line could differ from line to line (I don't care much how long an individual extraction path is) if the spacing is equal.
But vice versa, is it possible to fix the length of the extracting lines so I end up with all profiles being the same length, knowing how many points on the lines are etc. ? (if that is even the better idea..?)
Thought about some euclidian distance, and a routine to "round" the start end points to the next possible value with that given length.. (I guess that would still give some error / if I want to use that fixed length, as it can't be realized in a rastered image with all abitrary angles I need to use)
Maybe someone has some input.
Thanks for your time to read this.
Cheers,
vin
I need some help using improfile multiplie times in one image.
Sample image is here:
http://i1223.photobucket.com/albums/dd501/vinatec/matlab_example.png
What you see is some grayscale image of a filament on a dark background.
I did manage to
a) get the skeleton/backbone (binary of original with bwmorph thinning/skeletonize)
b) fit a spap2 spline to it (blue line)
c) do the derivation of the spline to
d) get tangential vectors along the contour (red arrows)
e) get the orthogonal vectors on the tangents (green arrows)
f) and plot lines (yellow) indicating the range improfile uses to determine the intensity values along that line
However I have trouble to use these extracted profiles. Imagine I want to extract the profiles and basically fit a gaussian to them, so I can determine the FWHM of the original grayscale filament orthogonal to its contour/backbone.
Right now I use:
[xline{i}, yline{i}, grayvalue{i}]= improfile(SUM, [(x(i)-dy(i)*sf) (x(i)+dy(i)*sf)], [(y(i)+dx(i)*sf) (y(i)-dx(i)*sf)], 50,'bicubic');
So I have some points P along the contour with coords x/y and the derrivative dx/dy to get the the direction of the orthogonal vector. I introduced some scaling factor sf to actually seperate start and end point from each other (as improfile needs exact start and end points and not only a direction (correct?)).
Problem is now (I think so):
every line to extract the profiles has a different length (as I have some abitrary angles and I guess not all start end points fall in the normal rasterization), improfile does some equally spacing of the points where to extract the intensity (correct?), so I never end up with values which are comparable or usable in terms of 1px (1 spacing unit) corresponds to lets say 50nm.
I can't manage/don't find a way to force improfile to use "normal" spacing between the points along the line. The length of the line could differ from line to line (I don't care much how long an individual extraction path is) if the spacing is equal.
But vice versa, is it possible to fix the length of the extracting lines so I end up with all profiles being the same length, knowing how many points on the lines are etc. ? (if that is even the better idea..?)
Thought about some euclidian distance, and a routine to "round" the start end points to the next possible value with that given length.. (I guess that would still give some error / if I want to use that fixed length, as it can't be realized in a rastered image with all abitrary angles I need to use)
Maybe someone has some input.
Thanks for your time to read this.
Cheers,
vin