← Back to team overview

sikuli-driver team mailing list archive

[Question #675202]: hasnext() returns true, but unable to find the next match in the finder object

 

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

Hi, 

I am running the below code in Eclipse(Java) and I have added all the required sikuli jar files.

I am comparing two images and while doing that, hasnext() method returns true and is going inside the loop. But the line Match m = f1.next(); fails/returns null.

How is it possible for next() to return null when hasnext() actually returns true?

Please help me here to resolve this issue.

PS: I am new to sikuli



Pattern pa1 = new Pattern("/Users/sayyam.srikanth/Desktop/bigImage.PNG");
Pattern pa2 = new Pattern("/Users/sayyam.srikanth/Desktop/smallImage.PNG");
	
		  Finder f1=new Finder(pa1.getImage());
		    f1.find(pa2.getImage());
		    if(f1.hasNext()){

		        Match m=f1.next();		     
 		        System.out.println("Match found with "+(m.getScore() * 100) +"%");
		        f1.destroy(); 

		    }
		    else{

		        System.out.println("No Match Found");
		    }

-- 
You received this question notification because your team Sikuli Drivers
is an answer contact for Sikuli.