Using !OCRScale=true

Hi everyone,

Just trying to figure out how to use !OCRScale=True with this OCRExtractRelative step.

Where do I put it in?

{
  "Command": "OCRExtractRelative",
  "Target": "documentproperties4_relative.png",
  "Value": "pagesize"
},

Anyone have any suggestions on how to use the !OCRScale=True parameter. I’ve been reading the online manual and it doesn’t seem clear where to use it.

I’m trying to get better number reading accuracy with desktop automation. I’m using engine 2.

Hi, use it like this:

  • store | true | !OCRScale
  • store | 2 | !OCREngine
  • OCRExtractRelative…

Important: Setting OCRscale=true does not always improve the OCR result. It is mainly important for small text and numbers. If the font has already normal size it does not help, but it also does not hurt. But if the font size is already huge (such as a headline), then setting OCRscale=true makes the OCR result actually worse.

If you still have problems with the OCR quality, you can post a few sample screenshots here. Maybe I see something on how to get better OCR quality. I use OCR screen scraping often.

Hey thanks for explaining that for me!

Yes I’m trying to just read width and height dimensions (only numbers) and then I parse them into two separate variables which I then use later in the workflow to set a page size in another application.

A friend of mine wrote two regex javascripts to parse the information, remove commas from 4 digit page sizes etc.

However I’m finding that sometimes the OCRExtract misses the decimal point - making the width 10 times larger. Or it struggles with 3’s and B’s.

Love to hear any additional tips on getting accuracy!

Hi, do you get the problem with engine2 or 1? I see the “missing comma in OCR” issue with engine1, but engine2 works fine. Here is my test input image:

comma ocr - very small area45

result (tested on the online ocr form):

Hmm, I’m having trouble getting any result at the moment. I’ve re-screenshotted the OCRExtractRelative step but I’m now getting:

Error in executeScript_Sandbox code: Cannot read property ‘0’ of null

My plugin updated recently, and it asked me to upgrade my macro’s which I said no - thinking it may have been a safe thing to do. But I can’t find a way to update them now. Could it be related to that?

So I’ve started to strip back the macro to just return the OCR text result and I’ve used a variable “pagesize” to try and return it with echo and csvsave etc. But it’s not returning any result. The OCR process says it finished OK, but I’m not getting any text returned.

  • [status]

Playing macro Open Acrobat mk3-1

  • [info]

Executing: | XDesktopAutomation | true | |

  • [info]

Executing: | store | true | !OCRScale |

  • [info]

Executing: | store | 2 | !OCREngine |

  • [info]

Executing: | XClickRelative | acobr1.png | #left |

  • [info]

Executing: | pause | 10000 | #left |

  • [info]

Executing: | XClickRelative | acrobatmenu_relative.png | #left |

  • [info]

Executing: | XType | ${KEY_DOWN} | |

  • [info]

Executing: | XType | ${KEY_ENTER} | |

  • [info]

Executing: | XType | ${KEY_ALT+KEY_D} | |

  • [info]

Executing: | XType | \Elysium\echobase_prinergy\U\UIVISION TEMP 1\PDF | |

  • [info]

Executing: | XType | ${KEY_ENTER} | |

  • [info]

Executing: | XType | ${KEY_TAB} | |

  • [info]

Executing: | XType | ${KEY_TAB} | |

  • [info]

Executing: | XType | ${KEY_TAB} | |

  • [info]

Executing: | XType | ${KEY_TAB} | |

  • [info]

Executing: | XType | ${KEY_DOWN} | |

  • [info]

Executing: | XType | ${KEY_ENTER} | |

  • [info]

Executing: | pause | 3900 | |

  • [info]

Executing: | XType | ${KEY_CTRL+KEY_D} | |

  • [info]

Executing: | pause | 3900 | |

  • [info]

Executing: | OCRExtractRelative | docco2.png | pagesize |

  • [info]

OCR (eng) started (698 byte)

  • [info]

OCR result received (0.9s)

  • [info]

Executing: | echo | ${pagesize} | |

  • [info]

Executing: | store | ${pagesize} | !csvline |

  • [info]

Executing: | csvSave | PDF_page_size.csv | |

  • [info]

Executing: | pause | 3900 | |

  • [info]

Executing: | XType | ${KEY_ESC} | |

  • [info]

Executing: | pause | 1500 | |

  • [info]

Executing: | XType | ${KEY_CTRL+KEY_Q} | |

  • [info]

Macro completed (Runtime 43.97s)

I’m running this on a virtual machine. Could that be the problem?

Strange. Just to clarify, this happens when you run the macro manually? If so, can you please record a screen video and post it here?