raspicam
raspicam copied to clipboard
3 fixes for simpletest_raspicam.cpp on raspbian
Hi,
I just checked out the latest version on raspbian/rPi4. The included example works fine, but when I tried to compile the sample code given on http://www.uco.es/investiga/grupos/ava/node/40
-
sleep is not found, I had to add #include <unistd.h>
-
build is missing -L/opt/vc/lib/. I had to build with g++ simpletest_raspicam.cpp -o simpletest_raspicam -I/usr/local/include -L/opt/vc/lib/ -lraspicam -lmmal -lmmal_core -lmmal_util
-
runtime warning
root@rPi4b:~/raspicam/example# ./simpletest_raspicam
Opening Camera...
Sleeping for 3 secs
/root/raspicam/src/private/private_impl.cpp:179 :Private_Impl::retrieve type is not RASPICAM_FORMAT_IGNORE as it should be
Image saved at raspicam_image.ppm
not sure what the fix should be, but the ppm file works, so that's the important part
I did try to add Camera.setEncoding ( raspicam::RASPICAM_ENCODING_RGB ); but I get
simpletest_raspicam.cpp:22:12: error: ‘class raspicam::RaspiCam’ has no member named ‘setEncoding’; did you mean ‘setMetering’?
Camera.setEncoding ( raspicam::RASPICAM_ENCODING_RGB );`
I guess the example on http://www.uco.es/investiga/grupos/ava/node/40 is probably against an old more restricted API?