Mathematica Stack Exchange is a question and answer site for users of Mathematica. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

This question already has an answer here:

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

share|improve this question

marked as duplicate by Mr.Wizard Mar 16 '13 at 7:25

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

Please take a look at the rendered font and the character in your image. They are quite different – Dr. belisarius Jan 21 '13 at 16:17
@belisarius you have the eyes of a hawk... :) – cormullion Jan 21 '13 at 16:32
As a native speaker, I'd say "just look at them" :D – Silvia Jan 21 '13 at 18:45
@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. – Silvia Jan 21 '13 at 18:52
up vote 9 down vote accepted

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[""];
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...

share|improve this answer
Another option is like in the "Applications" section of ImageCorrelate (a la Waldo) – R. M. Jan 21 '13 at 19:15
Please add the loaders for char and ì1 for completeness :D – Dr. belisarius Jan 22 '13 at 1:38

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