gocv
gocv copied to clipboard
videocaptureproperties syntax help
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
orenv.cmd
script before trying togo run
orgo build
? NO