Search code examples
image-manipulationemboss

Image Manipulation: Convert embossed letters to normal letters


I'm searching for a way to convert embossed letters e.g. like in the picture of the credit card below to normal ones like you see them in a book. I don't need specific code here, just ideas which image manipulation steps could lead to the desired result.

Credit Card


Solution

  • One thing you do know is that it's a Credit Card number -- this will help validate the result at the end. You could use this to fine tune the image processing -- feedback the result and use optimization techniques (like hill-climbing or genetic algorithms) to change the parameters of the image processing.

    For example, do the image processing with a parameter set (p1, p2, p3, p4) -- then try OCR and you get 6 numeric digits. Then alter the parameter set -- say this time you get 8 numeric digits -- use hill climbing to keep altering the set.

    For image processing

    1. Probably want to start by cropping to number regions if you know them.
    2. Clear pixels that aren't in the embossed color range to take out as much information as possible (the tolerance of this is one of the parameters in the parameter set I described) -- probably do this by setting it to black because the part of the numbers that's easy to see is light
    3. Target the light color of the emboss -- try to extract it, then invert because OCR finds Black on White
    4. Connect close sections
    5. OCR and feed results into parameter choices in step 2, 3, 4 (and maybe 1 if you are doing automatic segmentation)