2
$\begingroup$

I have this picture 1) enter image description here

Result must be like that 2) enter image description here . But I can achieve it only if have good numbers with picture like that 3) enter image description here

With first image I have result: 4) enter image description here I can't recognize numbers with that picture.

**

Images: 1)(input) -> 4)(output), 3)(input) -> 2)(output).

**

Image 1) and 3) is pictures for input, 4) and 2) are arrays with real number. Each array has 3 elements.

Please help.

My main code:

 fnRecognizeRiskData[]:=Block[
{im=Import["C:\\Users\\deo\\Documents\\GDIPlus_Image2.jpg"],binBorders,binMain,background,lengImage,rgRec={},resEnd={},space=,pretext=,row,split},
Print@im;
im=DeleteSmallComponents[im,50];
binBorders=Binarize@im;
background=ColorReplace[Binarize[im,1],Black->White];
binMain=ImageDifference[binBorders,Binarize[im,.9]];
Print@binMain;
binBorders=ImageDifference[binBorders,binMain];
Print@binBorders;
binBorders=RemoveBackground[binBorders];
(*Print@binBorders;*)
binBorders=ImageCompose[background,binBorders];
lengImage=Last@ImageDimensions[tt]/2;
rgRec=ImageCrop@ImageTake[binBorders,#]&/@{lengImage,-lengImage};
PrependTo[rgRec,ImageCrop@ImageCompose[background,RemoveBackground[binMain]]];
rgRec=ImageResize[#,50]&/@rgRec;
Print@rgRec;

(*>block*)](*===========================================*)

enter image description here

$\endgroup$

closed as unclear what you're asking by m_goldberg, kirma, Bill Watts, Yves Klett, MarcoB Jan 29 at 6:37

Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

  • $\begingroup$ From your examples, I can not perceive how your desired output is supposed to relate to your input images. The numbers shown as output are not found in the input images? Please clarify your question. $\endgroup$ – m_goldberg Jan 20 at 14:48
  • $\begingroup$ First image(input) relates to forth image(output). Second image(output) relates to third image(input). First number from array(output) relates to grey rectangle in the middle(input) , second number from array(output) relates to white rectangle with number above(input). Third number from array(output) relates to white rectangle with number below(input). $\endgroup$ – D. Denis Jan 20 at 15:20
  • $\begingroup$ Please explain what is wanted more carefully. As already noted the desired outputs show numbers that are not in the inputs, and vice versa. Stating clearly what are the characteristics that determine which values to retain, and in what order, would clarify matters. $\endgroup$ – Daniel Lichtblau Jan 20 at 15:54
  • $\begingroup$ You want to extract the numbers that are black on a white or gray background. Is that correct? $\endgroup$ – Rohit Namjoshi Jan 20 at 16:00
  • $\begingroup$ I want extract 1 number with gray background, black numbers and 2 numbers with white background, black numbers. There's should be 3 elements in array. I don't need numbers with black background, white numbers. My aim is when I have this array I'll want to recognize them in the function TextRecognize[], so I don't need rubbish like in picture #4, element 2ed. Ps Sorry for my English. $\endgroup$ – D. Denis Jan 20 at 18:45

Browse other questions tagged or ask your own question.