raspicam icon indicating copy to clipboard operation
raspicam copied to clipboard

raspicam_test works but raspicam_still_test get locked. Any idea

Open 40tude opened this issue 8 years ago • 8 comments

Bonjour, As explained in the title I'm able to compile and build the lib as well as raspicam_test and raspicam_still_test (open CV is not installed)

1 - raspicam_test works like a charm. It reports 14 FPS. I don't know if it is OK (I use a Raspberry Pi 3). Could you please confirm if 14FPS is OK or not. 2 - raspicam_still_test get stopped right after it output "Initializing". I'm just starting with raspicam and I have no idea of what may happen. I looked into the code. But since I don't yet have an IDE set up (with debugger etc) I'm not really able to "see" what is causing the issue. So far I can only comment one line at a time and see what happen... It will be a long night if I follow that path... So any advise/help will be appreciated.

Best regards, Philippe

PS : By the way, what is the purpose of the raspicam_still_test and what is exactly the "still mode" (if one exist). Sorry, this may be a silly question but again, I just plugged my camera tonight.

40tude avatar Jan 30 '17 23:01 40tude

Bonjour, Any answer, comment, feedback or advise? Best regards, Philippe

40tude avatar Feb 02 '17 22:02 40tude

Toc, toc... I was out last week Any answer, comment, feedback or advise? I still do not understand why raspicam_still_test is not working will raspicam_test seems to be working properly. Best regards, Philippe

40tude avatar Feb 11 '17 21:02 40tude

40tude,

I have had a similar problem, I had to reboot my pi can the _still test worked.

However, 14fps seems really slow.

I'm getting 33 fps on a stock RPI3, here is how I achieved such performance:

  1. Make sure you have class 10 sd-card & have rpi camera v2.1 hardare

  2. Download latest raspbian lite image

2)  apt-get update and upgrade
  1. rpi-update

  2. compile 3.2 version of open cv from source

I did these steps and ran the sample code (the one with opencv integrations) I got 33 fps on rpi3.

g00dnatur3 avatar Mar 10 '17 22:03 g00dnatur3

I guess the issue is the Callback=NULL and the mutex handling in takePicture in private_still_impl.cpp: as no callback is defined, the code does not know when an image is retrieved. The takePicture function however waits until the userdata-mutex is set, which should be done in the callback.

With raspicam_test I was able to get near 100 fps with fps=120, w=640 and h=480 on a RPi Zero.

HesselM avatar Apr 12 '17 12:04 HesselM

I have a similar problem: using raspicam_still_test if I call grab_retreive 4000 times with a one second delay between two calls, the application hangs after making around 3000 calls.

theSundayProgrammer avatar Apr 20 '17 10:04 theSundayProgrammer

After messing around with this library and others, I suspect the issue is not in the callback mentioned before, but might be in the configuration of the preview-channel. As I had trouble fixing the bug (and had some additional requirements for some experiments) I decided to build my own lib for which both still and video mode work. For video mode (when disabling opencv preview) I can reach ~120fps for w=640 and h=480 on a RPi Zero. The library is still work in progress and is not as mature and advanced as raspicam is.

ps. Sorry for the shameless advertisement of my own work, but i think the answer for this issue might lay in it.

HesselM avatar Apr 26 '17 12:04 HesselM

@HesselM no problem at all, thanks for your contribution! Do you think it's worth integrating your changes inside this repo, or would that require too much work? It looks like you've a good understanding of the MMAL library. Thank you for the reference on your Github repo btw, highly appreciated.

cedricve avatar Apr 26 '17 13:04 cedricve

@cedricve Direct integration might not be an option I think, as I adopted and merged ideas and code from several libraries and fitted that with my own needs/requirements. I did however had a second look at your code and i guess the missing configuration of the preview-port for the stills is the issue for the before mentioned problem.

From the source code of the Python PiCamera repository I found that the preview needs to be initialised to (at least) a nullsink as the GPU/image pipeline of the RPi uses it for AWB-control and computation of other settings. Configuration might be as simple as this (with of course proper memory management).

HesselM avatar Apr 27 '17 11:04 HesselM