We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Hello,
I'm very interested by your package but nothing works for me...
Here is a sample code:
package main import ( "log" "strings" "github.com/blackjack/webcam" ) func main() { cam, err := webcam.Open("/dev/video0") if err != nil { panic(err.Error()) } defer cam.Close() // Set the camera's resolution formats := cam.GetSupportedFormats() var format webcam.PixelFormat var width, height uint32 for pf, f := range formats { f = strings.ToLower(f) log.Println("possible format", f) if strings.Contains(f, "jpeg") { format = pf } } sizes := cam.GetSupportedFrameSizes(format) for _, size := range sizes { log.Println("possible size:", size) if size.MaxWidth == 0 || size.MaxHeight == 0 { continue } width = size.MaxWidth height = size.MaxHeight } log.Println("Set resolution to: ", width, height, "and pixel format to: ", formats[format], format) cam.SetImageFormat(format, width, height) cam.SetFramerate(10) cam.SetBufferCount(1) err = cam.WaitForFrame(10) if err != nil { panic(err.Error()) } frame, _, err := cam.GetFrame() if err != nil { log.Println(err.Error()) } else { log.Println(len(frame)) } }
Whatever I try:
2022/05/18 14:00:43 possible format yuyv 4:2:2 2022/05/18 14:00:43 possible format motion-jpeg 2022/05/18 14:00:43 possible size: {1280 1280 0 720 720 0} 2022/05/18 14:00:43 possible size: {160 160 0 120 120 0} 2022/05/18 14:00:43 possible size: {176 176 0 144 144 0} 2022/05/18 14:00:43 possible size: {320 320 0 240 240 0} 2022/05/18 14:00:43 possible size: {352 352 0 288 288 0} 2022/05/18 14:00:43 possible size: {640 640 0 480 480 0} 2022/05/18 14:00:43 Set resolution to: 640 480 and pixel format to: Motion-JPEG 1196444237 2022/05/18 14:00:43 invalid argument
Note that the error is raised on the GetFrame() call. I also try to not wait for the frame and to use ReadFrame but I've always got this error.
GetFrame()
ReadFrame
Can you tell me what I'm doing wrong ?
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Hello,
I'm very interested by your package but nothing works for me...
Here is a sample code:
Whatever I try:
Note that the error is raised on the
GetFrame()
call. I also try to not wait for the frame and to useReadFrame
but I've always got this error.Can you tell me what I'm doing wrong ?
The text was updated successfully, but these errors were encountered: