# How can I find a particular character in an image that has many similar Chinese characters? [duplicate]

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?

-

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

Please take a look at the rendered font and the character in your image. They are quite different i.stack.imgur.com/Duen5.png – Dr. belisarius Jan 21 '13 at 16:17
@belisarius you have the eyes of a hawk... :) – cormullion Jan 21 '13 at 16:32
– cormullion Jan 21 '13 at 16:39
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

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]


Edit

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 =
PixelValuePositions[
ImageFilter[Boole[# == charData] &, i2, (width - 1)/2], 1]


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

Then I can display the results like this:

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


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

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

-
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