Can you explain how you parse the values to variables.
I created a template JSON file from one document and I created a transform (translate) rule in which I get the most at left Line and most Top Line, as well as the maxLeft value for a line and the maxTop value too.
Using those, I created the following interpolation:
const diffX = maxLeft - globalLeft
const diffY = maxTop - globalTop
and on a loop I calculate
const factorX = (docVars[key].left - globalLeftModel)/diffXModel
const calcLeft = diffX * factorX + globalLeft
const factorY = (docVars[key].top - globalTopModel)/diffYModel
const calcTop = diffY * factorY + globalTop
where docVars is a JSON template as
const docVars = {"restriccion_movilidad": {"left": 31 , "top": 45},
"blindaje": {"left": 415, "top": 45},
"potencia": {"left": 527, "top": 45},
"declaracion": {"left": 32, "top": 101},
"ie": {"left": 382, "top": 98, "elem": 0},
"fecha_import": {"left": 382, "top": 98, "elem": 1},
"puertas": {"left": 604, "top": 100},
"limitacion_a_la_propiedad": {"left": 32, "top": 180},
"fecha_matricula": {"left": 32, "top": 248},
"fecha_exp": {"left": 242, "top": 248},
"fecha_vencimiento": {"left": 480, "top": 248},
"organismo_transito": {"left": 31, "top": 321},
"id": {"left": 376, "top": 555},
"minLeft": 31,
"diffX": 596
}
So, docVars[key].left for the first element would be 31 for (key) restriccion_movilidad and so on.
diffXModelis the at most left value on the whole template, and diffXModel is the highest left value on the template - diffXModel
calcLeft and calcTop are the interpolated values for the image I am processing at a given times.
Then, I iterate to the Lines and see which values are close to those calcLeft and calcTop.
It works more or less, but it isn’t very precise.
Anyone has a better approach?