← Back to team overview

sikuli-driver team mailing list archive

[Bug 944044] Re: sikuli-script Pattern.similar does not work with images

 

This will not be fixed in 10.2

It is indeed fixed in the latest source (branch develop) of X-1.0rc3
(but not yet available in the release version nor in the later build)

Since you seem to be Java capable you might fix it yourself.
Change and recompile Pattern.java and exchange Pattern.class in the jar file.

This is the relevant part from actual class Pattern:

public class Pattern {
   String imgURL = null;
   float similarity = 0.7f;
   BufferedImage image;

   int dx=0, dy=0;

   public Pattern(){ }
   public Pattern(Pattern p){
      imgURL = p.imgURL;
      similarity = p.similarity;
      image = p.image;
      dx = p.dx;
      dy = p.dy;
   }

   public Pattern(String imgURL_){
      imgURL = imgURL_;
   }
   
   public Pattern(BufferedImage image){
      this.image = image;
   }
   
   public Pattern(BufferedImage image, float similarity){
      this.image = image;
      this.similarity = similarity;
   }

   public Pattern similar(float similarity_){
      Pattern ret = new Pattern(this);
      ret.similarity = similarity_;
      return ret;
   }   

   public Pattern targetOffset(int dx_, int dy_){
      Pattern ret = new Pattern(this);
      ret.dx = dx_;
      ret.dy = dy_;
      return ret;
   }

-- 
You received this bug notification because you are a member of Sikuli
Drivers, which is subscribed to Sikuli.
https://bugs.launchpad.net/bugs/944044

Title:
  10.2: sikuli-script Pattern.similar does not work with images --- will
  be fixed in X-1.0rc3+

Status in Sikuli:
  Won't Fix

Bug description:
  If the Pattern is contructed with a BufferedImage instead of an URL
  the methods similar, targetOffset and exact does not work since the
  Pattern(Pattern p) contructor does not copy the image.

  Add:
  image = p.image;

  in the method.

  This is valid for the 0.10.2 version of the jar.

To manage notifications about this bug go to:
https://bugs.launchpad.net/sikuli/+bug/944044/+subscriptions


References