WatershedArts / Footfall

Application that allows you to monitor the traffic in and out of your building, using the RPi Camera and openFrameworks
Other
332 stars 131 forks source link

Noisy camera input #101

Open wassgha opened 6 years ago

wassgha commented 6 years ago

Hello,

I've noticed a lot of false positives in my data and after investigating it, it turns out the background subtraction algorithm isn't working as it's supposed to. The problem is, it's the input image that has noise (just the feed from the camera) which causes background subtraction to fail. However, when using raspistill to preview the camera, the noise (flicker of light/dark as seen on the video) does not exist at all! I am not sure if this has anything to do with the library that is used to access the camera or with footfall itself. Another thing to note is that the colors are "reversed(?)" where reds show up as blue. Although this might not affect detection, it might be related to the flicker issue.

Is there any parameter I could tweak to make this noise go away?

I have managed to eliminate the false detections by increasing the MOG threshold, but I'd still want the problem to go away from the root (since the input image).

Note: Especially on the camera to the right, it seems like the camera is "re-focusing" (blur) although I'm quite sure the raspberry pi camera doesn't have any autofocus features

ezgif com-video-to-gif 6

wassgha commented 6 years ago

@DHaylock ?

DHaylock commented 6 years ago

Hi @wassgha

I have never seen a camera behave like this before. It could be trying to white balance the image?

You could try setting white balance to manual

Try just running the raspi-vid command and change the white settings

Otherwise, in the config.json file make the history variable larger. It should smooth out the image.

David

wassgha commented 6 years ago

Hello! Thank you very much for the reply! Unfortunately I tried both suggestions but no luck. Here's what raspistill shows

ezgif com-video-to-gif 9

which is definitely noisy, but still different from the effect I get in the preview window of Footfall (which seems like some kind of re-focusing)

ezgif com-video-to-gif 10

It might just be the sensor...

randomly123 commented 6 years ago

Never experienced what you have experienced man. Might just be the RaspiCam.

wassgha commented 6 years ago

Update on this: Just bought another raspicam (v2.0 this time), still the same problem. Also, to add more details, the colors are not correct on the picture (the blue bench you see there is actually red not blue).

prisikarm commented 5 years ago

I discovered that this is due to "blur" function. is blur is set to zero, everything is ok, but there will be other problems when blur is zero...

It also could be due to the automatic exposure of the camera. Just add piCamera.setExposureMode((MMAL_PARAM_EXPOSUREMODE_T)7); after piCamera.setFlips(_cameraConfig.bFlipH,_cameraConfig.bFlipV); in CameraManager.cpp file. It will change the expouse mode to "snow', that is not using the autoexposure