gocv icon indicating copy to clipboard operation
gocv copied to clipboard

Detect blurry images

Open acim opened this issue 1 year ago • 0 comments

Description

I am trying to detect blurry images according to this Python example

func main() {
	img := gocv.IMRead("dog.webp", gocv.IMReadColor)
	defer img.Close()

	gray := gocv.NewMat()
	defer gray.Close()

	gocv.CvtColor(img, &gray, gocv.ColorBGRToGray)

	blur := gocv.NewMat()
	defer blur.Close()

	gocv.Laplacian(gray, &blur, gocv.MatTypeCV64F, 1, 1, 0, gocv.BorderDefault)

	meanStdDev := gocv.NewMat()
	defer meanStdDev.Close()

	stdDev := gocv.NewMat()
	defer stdDev.Close()

	gocv.MeanStdDev(blur, &meanStdDev, &stdDev)
}

How can I get variance out of meanStdDev or stdDev? I know this code is pretty much ugly. :D

Your Environment

  • Operating System and version: Linux Mint 20.3 Una
  • OpenCV version used: 4.6.0
  • How did you install OpenCV? By instructions from this repository.
  • GoCV version used: 0.31.0
  • Go version: 1.19.3
  • Did you run the env.sh or env.cmd script before trying to go run or go build? No, my build works.

acim avatar Nov 25 '22 16:11 acim