We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
in cmpimg, one sees:
cmpimg
func cmpImg(v1, v2 image.Image, delta float64) bool { img1, ok := v1.(*image.RGBA) if !ok { img1 = newRGBAFrom(v1) } img2, ok := v2.(*image.RGBA) if !ok { img2 = newRGBAFrom(v2) } if len(img1.Pix) != len(img2.Pix) { return false } max := delta * delta bnd := img1.Bounds() for x := bnd.Min.X; x < bnd.Max.X; x++ { for y := bnd.Min.Y; y < bnd.Max.Y; y++ { c1 := img1.RGBAAt(x, y) c2 := img2.RGBAAt(x, y) if !yiqEqApprox(c1, c2, max) { return false } } } return ok }
it may happen that v2 isn't a *image.RGBA. in that case, ok==false and we convert v2 into img2 going through the necessary steps.
v2
*image.RGBA
ok==false
img2
and if no pixel differed too much between img1 and img2, we return ok... which is still false.
img1
ok
false
The text was updated successfully, but these errors were encountered:
cmpimg: properly handle images of different types
88d330e
Fixes gonum#715.
ooops
Sorry, something went wrong.
30a9c6d
Fixes #715.
yeah... silly mistake, heh?
looking at the coverage of cmpimg.go, it would perhaps stand to reason to improve it a little bit. WDYT?
cmpimg.go
SGTM
sbinet
Successfully merging a pull request may close this issue.
in
cmpimg
, one sees:it may happen that
v2
isn't a*image.RGBA
.in that case,
ok==false
and we convertv2
intoimg2
going through the necessary steps.and if no pixel differed too much between
img1
andimg2
, we returnok
... which is stillfalse
.The text was updated successfully, but these errors were encountered: