[request] Java: Pattern class should retain image on Pattern constructor with an awt.BufferedImage

Bug #897895 reported by Kurz
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
SikuliX
Fix Released
Critical
RaiMan

Bug Description

The class org.sikuli.script.Pattern does not copy the image for the constructor which takes Pattern as the parameter.

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

Should also include image = p.image

The consequence is that when you do the following:

p = new Pattern( bufferedImage );
x = p.similarity( 0.9f ) or x = p.exact()

x no longer contains the image. Therefore it is not currently possible to change the similarity when using a Pattern based on an image.

Another great thing would be to have a constructor which takes BufferedImage and similarity.

Tags: fkt-pattern
Revision history for this message
Kurz (kurzweil4) wrote :

Created a pull request for these changes on Github.

Revision history for this message
RaiMan (raimund-hocke) wrote :

Thanks. The developers will have a look at it.

summary: - Pattern class does not copy image on Pattern constructor
+ [request] Java: Pattern class should retain image on Pattern constructor
+ with an awt.BufferedImage
RaiMan (raimund-hocke)
Changed in sikuli:
status: New → Fix Committed
assignee: nobody → RaiMan (raimund-hocke)
milestone: none → x1.0
RaiMan (raimund-hocke)
tags: added: fkt-pattern
RaiMan (raimund-hocke)
Changed in sikuli:
importance: Undecided → Critical
RaiMan (raimund-hocke)
Changed in sikuli:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.