[1.0.1] Use buffered image object instead of a file path --- will be available with version 1.1.0

Asked by Bogdan T.

Hello,

I'm using the Sikuli Java API.
Because I have several small pattern images and which are used multiple times in a program run, I need to load the images from memory, instead of accessing the disk several times. The images are small in size, totaling max 1MB.

I have tried with
    Pattern.setImage(BufferedImage img)
after initializing the Pattern with a null reference. But when I run the program, it throws find failed exception: Image null cannot be found on disk.
Is there a way to encapsulate the image object in the pattern object?
I don't want the Pattern to read the image from disk every time.

Thank you!
Bogdan T.

Question information

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

Sorry, but this does not work yet with version 1.0.1

The image concept is completely revised in version 1.1.0 (first beta next week):
- image cache (so images already loaded will taken from memory)
- images loadable from jars (and the internet, which is already possible now, but optimized)
- all image file handling is done on the Java level (always cv::Mat given down to native level OpenCV)

BTW: to load an image from filesystem takes less than 50 msec (small images even take less than 20 msec). So I think you can live with the problem till version 1.1 ;-)

Though it might be possible to solve this for you with a combination of Java and Sikuli functions already now, I recommend to wait.

Revision history for this message
Bogdan T. (bobbicg) said :
#2

Hi RaiMan,
Thanks for the fast reply. Ok, considering the performance mentioned by you I can live with that until further versions.
Have a nice day!

Can you help with this problem?

Provide an answer of your own, or ask Bogdan T. for more information if necessary.

To post a message you must log in.