gilestrolab / ethoscope

a platform from monitoring animal behaviour in real time from a raspberry pi
http://lab.gilest.ro/ethoscope/
GNU General Public License v3.0
17 stars 25 forks source link

ROI targets not detected under infrared lighting conditions #190

Closed augustinhebert closed 4 months ago

augustinhebert commented 5 months ago

Hi,

I am a veterinary student in Nantes, France, and currently working with ethoscopes for my vet thesis, within a team of vets/INRAE scientists (National Research Institute for Agriculture, Food and the Environment).

We struggle with light reflections on our glass tubes, despite the use of plastic panels that were supposed to diffuse the light. To try and prevent this, we decided to use an infrared pass filter (LEE FILTERS 87c) that blocks visible light, in front of our cameras, so that we record only the infrared lighting from the lightbox, whether it is dark or light conditions.

Our problem is that the black dots we use as targets (using the pdf provided by Q. Geissmann) seem to not be detected under these conditions (we had no problem tracking without the filter). The debug images show that we can quite easily distinguish the targets, but they seem to not be "sharp" enough. Our targets are made of paper and sticked on a polyethylene plate set between the lightbox and the tubes, that does a good job at creating an homogenous infrared backlighting.

I tried :

Capture d’écran de 2024-05-02 12-12-07 Capture d’écran de 2024-05-02 12-22-19 Capture d’écran de 2024-05-02 14-21-08 Capture d’écran de 2024-05-02 14-32-15

The tracking sometimes succeeds but the ROIs are then completely random, showing that the targets are not correctly detected.

Has someone already encountered this issue ?

I'm thinking of recording a video, then virtually adding black dots on the correct spots as a post-treatment, and reusing this edited video as the input for an offline tracking. Is that a possibility and if so, how would you do this ?

Would there be any other solution ?

Thank you in advance,

Augustin Hebert

ggilestro commented 4 months ago

Hi Augustin,

the easiest solution would be to make the targets more visible, either increasing illumination or using a paint/material that is more IR-reflective so that the camera could see the dots with greater contrast. Personally I don't have experience with this but I am positive there should be a straight forward solution. Perhaps cut to size some bicycle-reflective stickers? Alternatively, you could start the tracking without the filter and position the filter only at a second time?

augustinhebert commented 4 months ago

Hi @ggilestro, thank you very much for your answer !

I have tried to increase contrast using aluminium foil and it was not sufficient, but the reflective stickers seem like a great idea. i will try that next week and keep you updated.

I considered this other alternative but I was afraid that setting the filter after starting would slightly move the camera and potentially disturb tracking. But if I don't manage to start tracking with the filter on, I'll end up doing that (I thought about custom-making a plastic mount for the filter, that would fit on the part that holds the camera).

ggilestro commented 4 months ago

Please let me know if you make any progress. There may possibly be some software solutions too but they would require coding and testing and are therefore not immediate

augustinhebert commented 4 months ago

Hi @ggilestro, The solution that worked for me was indeed to start tracking without the filter on (in light conditions) and mounting the filter afterwards. I noticed I sometimes have an tracking error when mounting the filter (something about float division by zero), but this error is less frequent when i mount the filter quickly and spend less time messing around in the field of view of the camera. If I am quick and careful, the tracking continues fine under infrared only condition, without a spatial shift of the ROIs.

Thanks !