I have installed Ubuntu 19.10 64-bit on my Raspberry Pi4 with 1GB RAM. I know Raspbian would be the better choice, but I have to use Ubuntu for some other reasons. Moreover, I know that Ubuntu Mate comes with things like raspi-config
, but it's not supported for Raspberry Pi 4.
I have installed OpenCV4 and tested it with loading and showing an image. Works fine!
I then wanted to configure my Raspberry Pi camera with sudo raspi-config
, but not command was found, so I tried it via: sudo apt-get install raspi-config
. This results in "Unable to locate package raspi-config". Same for raspistill
, because there is no /opt/vc
directory with these commands.
I read through the internet. Next I tried to include start_x=1
and gpu_mem=128
inside my /boot/firmware/config.txt
. After a reboot, I can see now a video0
device under /dev
. So far so good.
- I also tried to load the video driver with
sudo modprobe bcm2835-v4l2
. - Moreover I've tried to install video packages like
libraspberrypi-bin or -dev
but no package could be located.
I've written a little text script:
#include <opencv2/highgui.hpp>
#include <opencv2/core/types_c.h>
#include <opencv2/videoio.hpp>
using namespace cv;
int main(int argc, char** argv){
VideoCapture cap;
cap.open(0);
Mat frame;
for(;;){
cap.read(frame);
if (frame.empty()){
std::cerr << "Error";}
imshow("Live", frame);
}
return 0;
}
This results in the following warning and errors:
[ WARN:0] global /opt/opencv/modules/videoio/src/cap_gstreamer.cpp (1758) handleMessage OpenCV | GStreamer warning: Embedded video playback halted; module v4l2src0 reported: Failed to allocate required memory.
[ WARN:0] global /opt/opencv/modules/videoio/src/cap_gstreamer.cpp (888) open OpenCV | GStreamer warning: unable to start pipeline
[ WARN:0] global /opt/opencv/modules/videoio/src/cap_gstreamer.cpp (480) isPipelinePlaying OpenCV | GStreamer warning: GStreamer: pipeline have not been created
Errorterminate called after throwing an instance of 'cv::Exception'
what(): OpenCV(4.3.0-dev) /opt/opencv/modules/highgui/src/window.cpp:376: error: (-215:Assertion failed) size.width>0 && size.height>0 in function 'imshow'
Aborted (core dumped)
I think the problem might be still installing the camera correctly because in my opinion this error occurs because of an empty frame.
Does Ubuntu 19.10 just not support the RPI4 Camera Module?
Thank for helping!