raspberrypi / picamera2

New libcamera based python library
BSD 2-Clause "Simplified" License
897 stars 190 forks source link

Mismatching color channel order in Hailo detect example #1148

Open matusmisiak opened 3 weeks ago

matusmisiak commented 3 weeks ago

While running object detection example for Hailo (examples/hailo/detect.py) with the image of an orange, it detects it somewhat poorly, detecting only a vase sometimes:

20241030_19h56m55s_grim

When I changed the format in lores to BGR888 instead of RGB888, it detects an orange very nicely (which it wouldn't if the BGR format was incorrect, because the orange would be blue):

20241030_19h57m43s_grim

I can only conclude that hailo.run() or models themselves expect the image in the BGR888 format instead of RGB888. Is that correct?

Hardware : Raspberry Pi 5 8GB with Arducam IMX708 B0310

davidplowman commented 3 weeks ago

Yes, I think that's usually the case. Of course it could vary with the model, but I think pixels in R, G, B order in memory (which libcamera slightly strangely refers to as BGR888) is most common.