transforms: Fix the logic which getting a size of image

This commit is contained in:
Dong-hee Na 2018-08-19 16:28:14 +09:00
parent 9435cae35d
commit d41c941ded

View File

@ -11,7 +11,7 @@ import (
// Rgb2Gray function converts RGB to a gray scale array. // Rgb2Gray function converts RGB to a gray scale array.
func Rgb2Gray(colorImg image.Image) [][]float64 { func Rgb2Gray(colorImg image.Image) [][]float64 {
bounds := colorImg.Bounds() bounds := colorImg.Bounds()
w, h := bounds.Max.X, bounds.Max.Y w, h := bounds.Max.X-bounds.Min.X, bounds.Max.Y-bounds.Min.Y
pixels := make([][]float64, h) pixels := make([][]float64, h)
for i := range pixels { for i := range pixels {