Inconsistent result from processFields

  • Last Post 12 April 2016
philhawthorn posted this 12 April 2016

Given the following excerpt from processImage result:

<line baseline="661" l="120" t="645" r="288" b="661">
<formatting lang="EnglishUnitedStates">
<charParams l="120" t="646" r="127" b="661">V</charParams>
<charParams l="128" t="648" r="136" b="661">o</charParams>
<charParams l="137" t="649" r="144" b="660">u</charParams>
<charParams l="145" t="648" r="153" b="661">c</charParams>
<charParams l="154" t="645" r="162" b="660">h</charParams>
<charParams l="163" t="648" r="171" b="660">e</charParams>
<charParams l="172" t="648" r="179" b="660">r</charParams>
<charParams l="183" t="650" r="186" b="660">:</charParams>
<charParams l="187" t="649" r="199" b="661"></charParams>
<charParams l="200" t="649" r="207" b="661">6</charParams>
<charParams l="209" t="650" r="217" b="661">4</charParams>
<charParams l="220" t="650" r="228" b="661">0</charParams>
<charParams l="230" t="650" r="238" b="661">9</charParams>
<charParams l="240" t="650" r="248" b="661">2</charParams>
<charParams l="250" t="650" r="258" b="660">7</charParams>
<charParams l="260" t="650" r="268" b="661" suspicious="1">1</charParams>
<charParams l="270" t="650" r="278" b="661">7</charParams>
<charParams l="280" t="650" r="288" b="661" suspicious="1">1</charParams>

and, the following processFields request:

<document xmlns="" xmlns:xsi="" xsi:schemaLocation="">
<page applyTo="0">
<text id="test" left="120" top="645" right="288" bottom="661"/>

Why do I then get the response (excerpt) as follows:

<value>icher: 640927171</value>
<line left="120" top="646" right="267" bottom="660">
<char left="120" top="650" right="123" bottom="662" suspicious="true">i</char>
<char left="124" top="650" right="132" bottom="662">c</char>
<char left="133" top="646" right="141" bottom="661" suspicious="true">h</char>
<char left="142" top="649" right="150" bottom="661">e</char>
<char left="151" top="648" right="158" bottom="660">r</char>
<char left="162" top="650" right="165" bottom="660" suspicious="true">:</char>
<char left="166" top="648" right="178" bottom="660"></char>
<char left="179" top="648" right="186" bottom="659">6</char>
<char left="188" top="648" right="196" bottom="658">4</char>
<char left="199" top="648" right="207" bottom="659">0</char>
<char left="209" top="648" right="217" bottom="659">9</char>
<char left="219" top="648" right="226" bottom="659">2</char>
<char left="229" top="648" right="237" bottom="658">7</char>
<char left="239" top="648" right="247" bottom="659">1</char>
<char left="249" top="648" right="257" bottom="658">7</char>
<char left="259" top="647" right="267" bottom="658">1</char>

It seems that the first place correctly recognises the text, but then the second processFields does not. What am I doing wrong?


Oksana Serdyuk posted this 12 April 2016

There are two points that you need to pay your attention:

  1. It is neccessary to specify the coordinates for the original image (not for the corrected image) in the processFields method.
  2. The region of the text field should be a little bit widely than the word itself. I would recommend to calculate the text field coordinates in the following way, for example:

    <text id="test" left="l-3" top="t-3" right="r+3" bottom="b+3"/>

    where l, t, r, b are the corresponding coordinates of the words from the original image (use exportFormat=xml, not xmlForCorrectedImage for processImage).

  • Liked by
  • philhawthorn