gocv icon indicating copy to clipboard operation
gocv copied to clipboard

videocaptureproperties syntax help

Open longwm opened this issue 1 year ago • 0 comments

Description

I am using a Rasberry PI HQ camera but the resolution is to high for the stream to open as it states Failed to allocate required memory. error below.

I am trying to set the videocaptureproperties; width, height and FPS to reduce the resolution but for the life of me I cant' get the syntax correct, call me a noob or a knob either or but some help with an example would be most helpful to understand how to apply it into my project.

I also wondered instead of calling the webcam and device (0) would it not be better to call the video camera directly from the API V4L2?

type VideoCaptureProperties int

const (

// VideoCaptureFrameWidth is width of the frames in the video stream.
VideoCaptureFrameWidth VideoCaptureProperties = 3

// VideoCaptureFrameHeight controls height of frames in the video stream.
VideoCaptureFrameHeight VideoCaptureProperties = 4

// VideoCaptureFPS controls capture frame rate.
VideoCaptureFPS VideoCaptureProperties = 5

)

Or do I use this?

An example of the code calling the camera and then setting the parameters would be most helpful, Thank you.

CURRENT ERROR

o run ./cmd/facedetect/main.go 0 data/haarcascade_frontalface_default.xml [ WARN:[email protected]] global /home/katelynn/opencv/modules/videoio/src/cap_gstreamer.cpp (2401) handleMessage OpenCV | GStreamer warning: Embedded video playback halted; module v4l2src0 reported: Failed to allocate required memory. [ WARN:[email protected]] global /home/katelynn/opencv/modules/videoio/src/cap_gstreamer.cpp (1356) open OpenCV | GStreamer warning: unable to start pipeline [ WARN:[email protected]] global /home/katelynn/opencv/modules/videoio/src/cap_gstreamer.cpp (862) isPipelinePlaying OpenCV | GStreamer warning: GStreamer: pipeline have not been created Start reading device: 0 Device closed: 0

Steps to Reproduce

Your Environment

  • Operating System and version:
  • OpenCV version used: 4.60
  • How did you install OpenCV? Install from source. working perfectly
  • GoCV version used: Latest
  • Go version: 1.19.3
  • Did you run the env.sh or env.cmd script before trying to go run or go build? NO

longwm avatar Nov 15 '22 20:11 longwm