I have two images:

enter image description here

enter image description here

I want to measure how straight/smooth the text borders are rendered.

First image is rendered perfectly straight, so it deserves a quality measure 1. On the other hand, the second image is rendered with a lot of varied curves (rough in a way) that is why it deserves a quality measure less than 1. How will I measure it using image processing or any Python function or any function written in other languages?

Clarification :

There are font styles that are rendered originally with straight strokes but there are also font styles that are rendered smoothly just like the cursive font styles. What I'm really after is to differentiate the text border surface roughness of the characters by giving it a quality measure.

I want to measure how straight/smooth the text borders are rendered in an image. Inversely, it can also be said that I want to measure how rough the text borders are rendered in an image.

  • 1
    $\begingroup$ I have the regret to tell you that the borders are not smooth, because of the many corners of sans-serif fonts. Are you after a measure of rugosity, tortuosity? $\endgroup$ – Laurent Duval Jun 10 at 16:14
  • 1
    $\begingroup$ @LaurentDuval - maybe the right term is rugosity (the roughness of the text borders) . Thanks for correcting. $\endgroup$ – alyssaeliyah Jun 11 at 12:22
  • $\begingroup$ by the way, I think the manuscript says "semper", not "lemper". $\endgroup$ – Marcus Müller Jun 13 at 18:25

I'd try a very "tinkery" approach here:

  1. Erode the image, so that the black area is shrunk by a fixed radius of pixels from its border (say, 5px).
  2. Dilate the resulting image by the same amount
  3. measure the amount of difference between original and processed image.

The idea is that something that is a locally convex border doesn't suffer through erosion (it's only shrunk) significantly, and that this erosion can be reverted by dilatation.

| improve this answer | |
  • 2
    $\begingroup$ Good, I think mathematical morphology has many tools for that, probably under vaguely shared denominations. Maybe evolutionary segmentation tools like snakes and level-sets could be useful, as regularity of contours are intrinseque. $\endgroup$ – Laurent Duval Jun 11 at 18:25
  • $\begingroup$ Thanks! By the way, what if the image contains a lot of dirt from the background and white speckles in the foreground? Will it still work? $\endgroup$ – alyssaeliyah Jun 14 at 1:23
  • $\begingroup$ Do I have to isolate the largest black component of the character image and do erosion and dilation? Or what if there are white speckles in the foreground character itself, does erosion + dilation and the difference between the original and resultant image, measures the text border roughness? $\endgroup$ – alyssaeliyah Jun 14 at 1:31
  • 1
    $\begingroup$ That would swap 1 and 2, and would probably work. $\endgroup$ – Marcus Müller Jun 14 at 7:26
  • 1
    $\begingroup$ Your design, your specific source images: you need to figure out this yourself. Sounds like a good problem for a bit of making tables, and trying out different things. $\endgroup$ – Marcus Müller Jun 14 at 8:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.