gocv
gocv copied to clipboard
How can I get all camera infos?
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
orenv.cmd
script before trying togo run
orgo build
? no