Hello Muhammad,
I am afraid I did not read you first post careful enough, sorry! OK, here comes another try:
Let img
be your original image, then I construct and apply a sort of an "edge mask":
img1 = ColorQuantize[img, 15];
edgeMask = ColorNegate@Dilation[EdgeDetect[img1], 2];
img2 = ImageMultiply[img1, edgeMask]
which gives:
Having done this preparation we can convince ourself that MorphologicalComponents
does the trick:
(mc = MorphologicalComponents[img2]) // Colorize
This results in more than 1000 components, which are represented in their own part of the image (using automated crop).
Since the font size is fixed, one can have a rough idea about the expected size of those images which contain letters:
{min, max} = MinMax[mc]
(* Out: {0, 1029} *)
levelImages = ParallelTable[{n, i = Function[{level}, ImageCrop@Image@Map[If[# == level, 0, 1] &, mc, {2}]][n],
ImageDimensions[i]}, {n, min, max}];
letterCandidats = Select[levelImages, With[{xdim = #[[3, 1]], ydim = #[[3, 2]]}, (40 < xdim < 70) && (40 < ydim < 70)] &];
{#1, #2, TextRecognize[#2, "SegmentationMode" -> 6]} & @@@ letterCandidats
The result then looks like:
Maybe this might be a way for an approach . Regards -- Henrik