Settings.ImageCallback not working --- only works with exists/wait/find

Asked by Sahil Doshi on 2019-04-01

I am using SikuliAPI in Java.

Settings.AlwaysResize = 0.0;

Settings.ImageCallback = new ImageCallback(){
   public BufferedImage callback(Image img) {
    return ImageHelper.convertImageToGrayscale(img.get());

But callBack is not working.

can you help me with this?

Question information

English Edit question
Sikuli Edit question
No assignee Edit question
Solved by:
Last query:
Last reply:
RaiMan (raimund-hocke) said : #1

I will check.

Best RaiMan (raimund-hocke) said : #2

the ImageCallback is not implemented for the text/OCR functions.

It only works with exists/wait/find/findAll and there only for the given images to search for.

In your case you want to manipulate the base image (capture of the region), that is given to OCR.

You have to implement your own solution

//pseudo code
image = region.capture()
newImage = convert(image)
text = newImage.text()

RaiMan (raimund-hocke) said : #3

another option is to play with the Tesseract options/settings

Sahil Doshi (sahil13) said : #4

on which image "Settings.ImageCallback" is called one which provided in wait or one which is captured?

RaiMan (raimund-hocke) said : #5

--- one which provided in wait
... as mentioned above:
... and there only for the given images to search for.

Sahil Doshi (sahil13) said : #6

Thanks RaiMan, that solved my question.

Sahil Doshi (sahil13) said : #7

How can I set Tesseract configs from TextRecognizer.setConfigs?

RaiMan (raimund-hocke) said : #8

You have to dive into the Tesseract world.