HOME/Articles/

Golang golang-hello video (snippet)

Article Outline

Go programming example 'golang-hello video'

golang-hello video

Golang beginners example: golang-hello video

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)
        if window.WaitKey(1) >= 0 {
            break
        }
    }
}