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

Asked by Sahil Doshi

I am using SikuliAPI in Java.

Settings.AlwaysResize = 0.0;

Settings.ImageCallback = new ImageCallback(){
   public BufferedImage callback(Image img) {
    System.out.println("called");
    return ImageHelper.convertImageToGrayscale(img.get());
   }
  };

But callBack is not working.

can you help me with this?

Question information

Language:
English Edit question
Status:
Solved
For:
SikuliX Edit question
Assignee:
No assignee Edit question
Solved by:
RaiMan
Solved:
Last query:
Last reply:
Revision history for this message
RaiMan (raimund-hocke) said :
#1

I will check.

Revision history for this message
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()

Revision history for this message
RaiMan (raimund-hocke) said :
#3

another option is to play with the Tesseract options/settings

Revision history for this message
Sahil Doshi (sahil13) said :
#4

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

Revision history for this message
RaiMan (raimund-hocke) said :
#5

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

Revision history for this message
Sahil Doshi (sahil13) said :
#6

Thanks RaiMan, that solved my question.

Revision history for this message
Sahil Doshi (sahil13) said :
#7

How can I set Tesseract configs from TextRecognizer.setConfigs?

Revision history for this message
RaiMan (raimund-hocke) said :
#8

You have to dive into the Tesseract world.