To use Sikuli you need
- A base image on which the other image will be searched.
- The image which will be searched within the other image.
If image 1 is your local resource image, you can create a org.sikuli.Finder instance with the path to the image and the Region of this image which will be searched.
Example (java level):
finder = new Finder("path/to/image", new Region(0, 0, <imgwidth>, <imgheight>));
If image 1 is your stream, you have to make a BufferedImage out of it somehow (I do not know the best way to do this).
Then you can make a org.sikuli.ScreenImage from this BufferedImage with the help of an java.awt.Rectangle and an org.sikuli.Region.
finder = new Finder(new ScreenImage(new Rectangle(0,0,<imgwidth>,<imgheight>), bufferedImage), new Region(0,0,<imgwidth>,<imgheight>))
After you created the finder from image 1, you can search image 2 within this image.
Again, you have two possibilities.
If the second image is your local resource image, you can create an org.sikuli.Pattern object with the file location:
pattern = new Pattern("path/to/image.png");
Else, if this is your stream, you have to make a BufferedImage out of the stream somehow. You can then create a pattern from this image:
pattern = new Pattnern(bufferedImage);
As a last step, you can now run the finder to search for the pattern:
finder.find(pattern);
You can check if the finder found anything with:
finder.hasNext();
And you should be able to iterate all findings with:
for (Match m : finder):
//do something with the match
I hope I could help you although your question is already some weeks old.