Image captured from OpenCV pi camera is full black

130 Views Asked by At

The image that I captured was fully black. Using raspberrypi camera. (not a USB camera)

#include <opencv2/opencv.hpp>

int main()
{
    cv::VideoCapture cam(0);

    cv::Mat frame;

    cam.grab();
    cam.retrieve(frame);
    
    cv::imwrite("test.jpg",frame);
}

Tried creating a loop of cam.grab() thinking that the error might have been too minimal exposure. Still got a fully black image of 640x480.

I don't think this warning applies to what I am trying to do, but here it is

[ WARN:0] global ../modules/videoio/src/cap_gstreamer.cpp (501) isPipelinePlaying OpenCV | GStreamer warning: GStreamer: pipeline have not been created

I have tested my camera using libcamera-jpeg and it works perfectly.

0

There are 0 best solutions below