Curvature of a pencil stroke
I'm trying to evaluate the curvature of an image of a pencil stroke based on the image's pixels and their shade of gray. I'm trying to get the curvature of the line at every point of the stroke. The part I'm not sure is the calculation of the curvature itself considering the noise.
Here is how I'd process ;
- Image treatment. Higher the contrast and drop the pixels under a threshold of gray. I want to keep a scatterplot of the stroke and discard the white in the image.
- Calculate the position of a pixel on the line. I'd use the diffusion space (R. R. Coifman and S. Lafon) to evaluate the distance between pixels, thus their position of the line.
- Calculation of the curvature at each pixels. Here is the part I'm not so confident in. Most expression of the curvature of a line I've seen don't consider the noise (here the thickness of the stroke). I'd use an approximation based upon the curvature of a function according to it's derivative. I'd evaluate the derivative based on an average of the points far enough on the diffusion space.
- Now I have for each pixel the distance on the diffusion space and their curvature. I could average that, but ideally there shouldn't be too much noise.
So really, I'm not so sure how to go here. I know I can obtain something meaningful in the way I described, but the result will be highly dependant on the scale of the evaluation of the curvature. Having bias in the result is not so bad, because I'm more interested in comparing the curvature at differents points.
I would think about fitting circle segments. Essentially getting the curvature is the same as finding the best fitting circle and taking 1/radius of that circle.
Fitting a circle to noisy data is similar problem to fitting a straight line through noisy data, you just have one more variable.
Another possibility might be using a Hough transform http://en.wikipedia.org/wiki/Hough_transform which has been used to find circular features.