From d9c6a724e97141db9cbaa66226e0410a5535ae28 Mon Sep 17 00:00:00 2001 From: Nick White Date: Thu, 23 Jul 2020 15:01:41 +0100 Subject: Add Set and NewImage functions to implement image/draw.Image interface Now the integralimg can be created directly from an image using image/draw.Draw. --- integralimg_test.go | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'integralimg_test.go') diff --git a/integralimg_test.go b/integralimg_test.go index 3bc8dd6..df97caa 100644 --- a/integralimg_test.go +++ b/integralimg_test.go @@ -23,10 +23,9 @@ func TestFromPNG(t *testing.T) { t.Fatalf("Could not decode image: %v\n", err) } b := img.Bounds() - gray := image.NewGray(image.Rect(0, 0, b.Dx(), b.Dy())) - draw.Draw(gray, b, img, b.Min, draw.Src) - integral := ToIntegralImg(gray) + integral := NewImage(image.Rect(0, 0, b.Dx(), b.Dy())) + draw.Draw(integral, b, img, b.Min, draw.Src) if !imgsequal(img, integral) { t.Errorf("Read png image differs to integral\n") -- cgit v1.2.1-24-ge1ad