I have an idea WHAT to do, but I do not know HOW


Hello together.

I have this image of human hair and I want to count and measure them - individually. Thus, I would need to

  • set a threshold (or make it binary) => done
  • maybe fill the holes to simplify analysis => I am struggling
  • detect and measure the hair => struggling, too.

I got the hint to use ridge detection, but either my image is not suited or the user is too stupid.
Can a newbie get some help, please. Thanks a lot.

Just to be sure: the result should be number of hair fibres (= particles) and length + width (= diameter) of each individually hair fibre - independent of the overlaps.

I am very sure that this is feasible and not too complicated. But if you do not know how, it is quite difficult.

Thanks a lot,


Good day Cartsen,

interesting image …

I am very sure that this is feasible and not too complicated. But if you do not know how, it is quite difficult.
(Emphases by HG)

A bit contradictory – no?
(At least I don’t know as well!)

This kind of detail
will pose problems but it won’t be the only one …

Good luck


One approach to separate the hairs having different orientation is orientation filtering, however I’m not sure it will work good enough for the measurements.


length + width (= diameter)

“= diameter” refers to width only, I guess.

Length appears difficult because most of the hairs extend beyond the image borders.

I’ve rotated your image 21.3 degrees clockwise and projected it onto the y-axis. Here is what I get:

The maximum from 383 to 466 gives an estimate of 83 pixels for the hair width.

However, I’m not sure how this analysis generalizes to the other hairs, i.e. if one would get similar clear maximum ranges.



1 Like

Hello Herbie.

Thanks for the reply. Yeah, contradictory :slight_smile:
These two on the bottom would not be a lager issue. I could ignore them or sometimes discard them manually.

If the hair fibres extend to the borders, no problem. This is just a small part of a larger image with more samples that do not touch the borders.




here is another example:

Rotation of 37 degrees counter-clockwise and projection onto the y-axis

gives a width estimate of about 82 pixels.

A rectangular horizontal selection at the measured vertical hair position with width 82 followed by a projection onto the x-axis gives

from which the length can be estimated as 943 pixels.

All hair angles present in the image can be determined from the Fourier Power Spectrum of the image.




Hi Carsten,

Ridge Detection is supposed to be able to identify and measure individual hairs, even if they overlap – see for example this thread.

But, as Herbie points out, to get real length numbers, you’ll need a larger field of view, because you need to see both ends. (EDIT – from your response above it’s clear that you do have a larger field, so that’s good!)

The DiameterJ/OrientationJ plugins can get you the population distribution of diameter and orientation, but I don’t think it can resolve the overlapping hairs.

Hope this helps.



thanks for chiming in!

Concerning global orientation, this is what I get with my custom approch which is probably the best you can get:

Please note the applied highpass with a cutoff at 10% of the Nyquist frequency.
(The peak at zero, i.e. for horizontal structures, is caused by the lower image border.)




Hello Theresa.

Thanks for your input, too. So, you (and Herbie) think that trying on the small scale is not a good idea? OK, so I will take larger pictures and try RD again. Maybe it does not really work as there are no free ends of my rods/hairs/fibres/…

Thanks for your more detailed description, Herbie, but I do not think that this will really help me.



Good day Carsten!

So, you (and Herbie) think that trying on the small scale is not a good idea?

This is not perfectly true and I didn’t say so.
In any case it is not an opinion but it is for logical reasons that you’ll get problems with determining the lengths of most hairs if you stay with the present ímage size. However, increasing the image size may lead to difficulties regarding other aspects of the hair analyses, e.g. if one follows my suggestion, the number of hair orientations will increase …

I do not think that this will really help me.

Thank you for telling me that my efforts won’t help you.
Let me note that the problem you’re confronted with is not trivial and can’t be solved by simple means. No doubt, my approach is involved and needs some time to be implemented. If you are not willing to invest time and considerable effort, you won’t get satisfying results or you have to find someone who solves the task for you.

I’ve outlined a concept for a solution of your problem, at least as it appears from the provided sample image, and now it’s your turn to decide what to do.

Good luck



Hi Herbie.

I did not want to sound rude and I hope I communicated that I appreciate(d) your efforts! I am just German and my English is not on the level of a British diplomat :slight_smile: Just be sure: Thanks again - even if this might not help me or I am not capable to use it.

And: no, I did not say, that you said that (“small scale”). I just wanted to summarise for me. Thanks for the clarification of your statement.

I was hoping that this problem is trivial. But apparently, it isn’t. Who would have thought that.

Have a nice week,