I am trying to get a stream from MacBook High Sierra webcam, mac does not have /dev/video0
is there any way to access MacOS webcam ?
I am programming in golang and I am using golang.org/x/sys/unix
Asked
Active
Viewed 1,884 times
0

sam
- 335
- 2
- 5
- 19
-
Have a look at this question https://apple.stackexchange.com/questions/16908/mac-webcam-get-the-device – vishnu narayanan Mar 24 '18 at 05:57
-
I saw that question, so there is no equivalent to /dev/video0, so is there any other way to access MacOS webcam ? – sam Mar 24 '18 at 06:23
1 Answers
2
You can use OpenCV bindings and get frame from camera.
Have a look at godoc for go-opencv
A short example:
index := 0 // example
camera := opencv.NewCameraCapture(index)
if camera.GrabFrame() {
frame := camera.RetrieveFrame(1)
img := frame.ToImage()
}

Oleg Kovalov
- 734
- 11
- 33