← Back to team overview

sikuli-driver team mailing list archive

Re: [Question #663991]: get count of similar images

 

Question #663991 on Sikuli changed:
https://answers.launchpad.net/sikuli/+question/663991

    Status: Needs information => Open

Maniraj gave more information on the question:
Hai,


public static boolean findInWholePage(WebDriver driver,String imageName,ExtentTest etest) throws IOException, FindFailed, InterruptedException
  {
    String expectedimg = "imagepath" // path of image. 
    URL file_url = new URL(expectedimg);
    String uniqueID = UUID.randomUUID().toString();
    String actualimage = uniqueID+imageName;
    BufferedImage regionsetimage = screenCapture(driver,actualimage); // using selenium I am taking whole page screenshot and storing as buffered image.
    Finder window = new Finder(regionsetimage);
    Pattern testImage = new Pattern(file_url); 
    window.find(testImage.similar((float) 0.99));  //.exact()
    Match found = null;
    if (window.hasNext())
    {
      found = window.next();
      //System.out.println(imageName + " Image found");
      etest.log(LogStatus.PASS,"Expected: "+ expected + "Actual" + actual);
      return true;
    }
    else
    {
      System.out.println(imageName + " Image Not found");
      etest.log(LogStatus.FAIL,"Expected: "+ expected + "Actual" + actual);
      return false;
    }
  }


In this inside my region (that means whole page Screenshot taken in runtime), I have more than 1 similar images. In this scenario can I get count of all that similar images ?

... would be easier to understand if you post some snippet of code.

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