Page 1 of 1

$250 BOUNTY -- Take Photos with CSI camera and get it into Python Pillow Format

Posted: 2024-08-23 18:19
by kornpow
Development bounty: $250 payable in Bitcoin

I really need some help with something, which could have a large impact,and I have wasted too much time trying to figure it out already.

Goal: Using the buildroot image and Python, I want to be able to take photos using the CSI camera, and read them into a Python Pillow Image object.

If you can provide a buildroot build configuration and an example of doing this, I will pay you $250 in Bitcoin. I must be able to recreate your work for you to be paid.


More details:
- Ubuntu apparently cannot access the CSI camera, so we must use buildroot.
- I am currently able to read the CSI camera with buildroot, but the image format is YUV, which PIL doesnt support.
- I would prefer if you didn't just convert YUV to a more normal image format using Numpy, because I don't want Numpy to be a dependency.
- I have spent also a bunch of time trying to get OpenCV to run to handle this. I am not a huge fan of making OpenCV a dependency either.
- Using a V4L2 python library is acceptable, I ran into issues with VIDEO_CAPTURE vs VIDEO_CAPTURE_MMAP. Luckfox is doing something "funky" with the way that the image data is stored in memory, which is making it difficult to use these libraries off-the-shelf.


Hopefully this is an acceptable proposition to the forum! Thank you for all of your help!

Re: $250 BOUNTY -- Take Photos with CSI camera and get it into Python Pillow Format

Posted: 2024-08-24 2:59
by Crocodile
Currently, when using a CSI camera and correctly capturing images (images processed by the ISP), it is necessary to process them through rkisp. The rkisp calls provided by Rockchip are only available through an API interface; using the V4L2 interface directly cannot meet your needs. It is essential to rebuild the Python library to achieve this.

You can refer to the content in <Luckfox Pico SDK>/media/isp/release_camera_engine_rkaiq_rv1106_arm-rockchip830-linux-uclibcgnueabihf/rkisp_demo/demo or the source code of Opencv-mobile to implement a Python library by linking the C dynamic library (although it is more scientific to rebuild from the source code, Rockchip has not made this part of the code public, so the dynamic library is the only bridge for communicating with the ISP hardware).

Of course, if you only intend to capture RAW images (images not processed by the ISP) and convert YUV to RGB (supported by Pillow), the complexity will be much lower. You can quickly find various implementations of YUV to RGB conversion functions through a Google search.

Although our forum encourages individuals to discuss development issues together, we do not discourage offering bounties for solutions. If conditions permit, it is still recommended that you follow your own approach to development, and if you encounter any issues, we will provide suggestions to the best of our ability.

Re: $250 BOUNTY -- Take Photos with CSI camera and get it into Python Pillow Format

Posted: 2024-08-24 4:00
by kornpow
I appreciate your message Crocodile. I will take your advise and hopefully I figure it out before somebody else does.

But the bounty is ON, if someone can provide me with a fully working implementation with instructions, I will pay out. If they can save me 5 hours of headaches it will be worth it.

I will post here if I figure it out myself.