The Chinese characters "竟" and "竞" are very similar in their appearance. I am trying to find "竟" in the following picture.

I tried use TextRecognize but it didn't work. Can you tell me any other way?

enter image description here enter image description here

  • 3
    $\begingroup$ Please take a look at the rendered font and the character in your image. They are quite different i.stack.imgur.com/Duen5.png $\endgroup$ – Dr. belisarius Jan 21 '13 at 16:17
  • $\begingroup$ @belisarius you have the eyes of a hawk... :) $\endgroup$ – cormullion Jan 21 '13 at 16:32
  • 2
    $\begingroup$ See also mathematica.stackexchange.com/questions/1911/… $\endgroup$ – cormullion Jan 21 '13 at 16:39
  • 1
    $\begingroup$ As a native speaker, I'd say "just look at them" :D $\endgroup$ – Silvia Jan 21 '13 at 18:45
  • $\begingroup$ @belisarius It probably because some CJK fonts are bitmap when used with small fontsize, but automatically turn to outline type when the fontsize is big enough. If I remember correctly, bitmap fonts will be easier to recognize for small size complex glyphs. $\endgroup$ – Silvia Jan 21 '13 at 18:52

If you've got the image in i1, and the character in char, then this might work:

{charBig, imageBig} = ImageResize[#, Scaled[5]] & /@ {char, i1};
ImageAlign[imageBig, charBig, Background -> Gray]



However, I don't think this is the right way to do it. Instead, I made two binarized images.

i1 = Import["http://i.stack.imgur.com/GR1Ml.jpg"];
i2 = Binarize@i1;
char =  ImageTrim[i2, {{464, 111}, {473, 120}}]; 
     (* since question didn't provide a suitable character to look for *)
width = First[ImageDimensions[char]];
charData = ImageData[char];

then used ImageFilter to find the location(s) of the character:

foundLocations = 
   ImageFilter[Boole[# == charData] &, i2, (width - 1)/2], 1]

{{256, 170}, {469, 116}}

Then I can display the results like this:

    HighlightImage[i2, foundLocations, 
        Method -> {"DiskMarkers", width}],
    {i2, 0.5}]

which isn't brilliant, but I can't get translucent markers with HighlightImage yet.

found chars

Of course, if the big image doesn't contain the little one, none of this would work...

| improve this answer | |
  • 2
    $\begingroup$ Another option is like in the "Applications" section of ImageCorrelate (a la Waldo) $\endgroup$ – rm -rf Jan 21 '13 at 19:15
  • $\begingroup$ Please add the loaders for char and ì1 for completeness :D $\endgroup$ – Dr. belisarius Jan 22 '13 at 1:38

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