← Back to team overview

sikuli-driver team mailing list archive

[Question #242405]: Get the BufferedImage reference when calling Region.findAll()

 

New question #242405 on Sikuli:
https://answers.launchpad.net/sikuli/+question/242405

Hi Ray !

First of all, let me say you that Sikuli is a beautiful work and a very usable library. I played with some years ago and enjoyed it. Now I decided to base a bot project on it and my choice was obvious... ;)

I have one question :

I have to extract all matches founds in a specified regions and then work again to extract larger images from the specified matches coordinates on the screen.

The problem is that my screen is very dynamic and that's why for performance I'm looking for the minimum pattern size.
But when I call Region.findAll(), I get match regions relatives to the full screen.
I didn't found a way to get the source bufferedImage. I have to be sure to work on the same image used to search because after that I extract my datas from the matches. Here is my piece of code :

		try {
			image = Screen.getPrimaryScreen().capture().getImage();
			matchs = searchArea.findAll(lookingFor);
		} catch (FindFailed e) {
			return;
		}

		while (matchs.hasNext() && (cards.size() < 52)) {
			Match m = matchs.next();
			BufferedImage card = image.getSubimage(m.getX(), m.getY(),
					extractW, extractH);

			CardsElector elector = new CardsElector(card);
			elector.start();
		}

I extract subImages from the screen BufferedImage, relative to the "matching" Regions. But in my case, if there is a screen change between the screenCature and the findAll, I exctract bad datas.

Could you tell me please how to do what I explained ( )  ?

Thanks for your help !

Best regards,
David

-- 
You received this question notification because you are a member of
Sikuli Drivers, which is an answer contact for Sikuli.