rmsalinas / raspicam

Official raspicam from AVA Research Group. Controlling the raspberry pi camera in C++. Moved from Sourceforge to here
52 stars 18 forks source link

3 fixes for simpletest_raspicam.cpp on raspbian #11

Open marcmerlin opened 3 years ago

marcmerlin commented 3 years ago

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

1) sleep is not found, I had to add

include

2) 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

3) 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

marcmerlin commented 3 years ago

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?