gocv icon indicating copy to clipboard operation
gocv copied to clipboard

How can I get all camera infos?

Open wocan23 opened this issue 1 year ago • 0 comments

All examples use code below.

import (
	"fmt"
	"gocv.io/x/gocv"
)

func main() {
	webcam, err := gocv.VideoCaptureDevice(0)
	if err != nil {
		fmt.Print(err)
		return
	}
	window := gocv.NewWindow("Hello")
	img := gocv.NewMat()
	for {
		if ok := webcam.Read(&img); !ok {
			fmt.Printf(err)
			return
		}
		if img.Empty() {
			fmt.Printf("Empty")
			return
		}
		window.IMShow(img)
		key := window.WaitKey(1)
		if key == 27 {
			return
		}
	}
}

DeviceId is 0, but I want to show all carmera and select one to show. How can I do?

Description

Steps to Reproduce

Your Environment

  • Operating System and version: windows 10
  • OpenCV version used: 4.7.0
  • How did you install OpenCV? yes
  • GoCV version used: 0.32.1
  • Go version: 1.20.4
  • Did you run the env.sh or env.cmd script before trying to go run or go build? no

wocan23 avatar Jun 08 '23 15:06 wocan23