November 2018
Beginner to intermediate
348 pages
8h 32m
English
By this point, I hope you have already read the previous chapter and have GoCV installed. If you haven't, then read the GoCV section in the previous chapter to get started.
To read from the webcam, we simply add the following lines to the main file. You may recognize them as snippets from the previous chapter:
// open webcam webcam, err := gocv.VideoCaptureDevice(0) if err != nil { log.Fatal(err) } defer webcam.Close() // prepare image matrix img := gocv.NewMat() defer img.Close() if ok := webcam.Read(&img); !ok { log.Fatal("Failed to read image") }
The confusing bit of course, is how to pass img, which is of the gocv.Mat type, to MachineBox. There exists a Check method on the MachineBox client that takes io.Reader ...
Read now
Unlock full access