MarappPrashanth / sikuli-api

Automatically exported from code.google.com/p/sikuli-api
0 stars 0 forks source link

how to create a desktopscreenregion from a local file #82

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
as in your example you are creating imagetarget from a localfile or 
bufferedimage or a file from an URL. how to create a desktopscreenregion from a 
local file?
I tried to do the following, but i'm getting nullpointerexception while calling 
find method.

File f1 = new File("C:\\Test1.png");
Desktop.getDesktop().open(f1);

ScreenRegion s = new DesktopScreenRegion();

Target imageTarget = new ImageTarget(new File("C:\\Find.png"));

List<ScreenRegion> r1 = s.findAll(imageTarget);

also i wanted to know if there is anything like getminscore() where we can get 
the score for a match instead setting the score manually 
(imageTarget.setScore()) before finding. 

Original issue reported on code.google.com by roychoud...@gmail.com on 6 Jan 2014 at 5:59

GoogleCodeExporter commented 8 years ago
Exception in thread "main" java.lang.NullPointerException
    at org.sikuli.api.ImageTarget.getUnordredMatches(ImageTarget.java:112)
    at org.sikuli.api.DefaultTarget.doFindAll(DefaultTarget.java:93)
    at org.sikuli.api.DefaultScreenRegion.findAll(DefaultScreenRegion.java:54)
    at spaceship.ApplicationSpaceShip.main(ApplicationSpaceShip.java:48)

on the above line 48 is  List<ScreenRegion> r1 = s.findAll(imageTarget)
i'm guessing 
1. sikuli is not able to find the image in the background <should not be the 
case>
2. the background is not populated properly <can be>

Original comment by roychoud...@gmail.com on 6 Jan 2014 at 6:12

Attachments: