Damdoshi / LibLapin

Multimedia library for rookies and prototyping
http://hangedbunnystudio.com
Other
36 stars 9 forks source link

Compilation error on the camera module: V4L2 missing #22

Open Sigmanificient opened 3 months ago

Sigmanificient commented 3 months ago

Hi, i am trying to build the liblapin but the compilation is failling on the camera.

I've setup the required dependencies listed in the README:

including also libudev (with libudev-zero replacement) which seems to be required but not mentioned. To bootstrap the compilation process, I had to patch the Makefile a bit, removing the incorrect echo absolute path, and the -Werror cflag.

The file src/camera/new_camera.cpp fails to compile, with the following error:

src/camera/new_camera.cpp: In function 't_bunny_camera* bunny_new_camera(int)':
src/camera/new_camera.cpp:18:42: error: 'CAP_V4L2' is not a member of 'cv'
   18 |       cam = new cv::VideoCapture(id, cv::CAP_V4L2);
      |                                          ^~~~~~~~

The V4L2 module may not be enabled by default on opencv, which is the soure of the problem.

However, I noticed that opencv is bound only to the camera directory, so i tried a build, after removing it. Although it did succeed, a better way to toggle the feature could be nice. This would allow a clean build of the library to be used, without the camera support.

It would be possible to add check function to detect whether the camera module is available, so that software using it can fallback or exit properly.