[OpenCV] How to start the camera with gocv?



How to start the camera with gocv?

1. install OpenCV for gocv. [how to install]
2. run gocv code [github]

package
main
import ("gocv.io/x/gocv")
func main() {
    webcam, _ := gocv.VideoCaptureDevice(0)
    window := gocv.NewWindow("Hello")
    img := gocv.NewMat()
    for {
        webcam.Read(&img)
        window.IMShow(img)
        window.WaitKey(1)
    }
}

3. show camera



Comments

Popular posts from this blog

[OpenCV] What is gocv?

[OpenCV] Chapter01-05 Working with UI elements such as scrollbars in OpenCV window

[OpenCV] How to set up gocv