micropython-camera-driver icon indicating copy to clipboard operation
micropython-camera-driver copied to clipboard

jpg images have missing data at the bottom (because of maximum file size)

Open lorenz-g opened this issue 5 years ago • 6 comments

Hello, thanks again for porting the esp32 cam driver to micropython. It works really well.

I have noticed that for framesize 5, the maximum size of the pictures is 9600 bytes. However I sometimes get pictures that are larger and are cut at the bottom. The same is for framesize 3 with 5280 bytes. (see the two sample pictures below).

Could you point me to the direction where you can set the maximum size for jpg images? I will also try to figure it out myself and will update back here.

I am using the micropython_b7883ce_esp32_idf4.x_ble_camera.bin firmware with the esp32 ai thinker camera module.

As a hack, I have set the camera quality to 20 and it works, but I guess it is preferable to just have a bigger buffer for the images.

46_47_3_2020-12-30T13-58-10_copy 46_10_5_2020-12-30T13-57-34_copy

lorenz-g avatar Dec 30 '20 15:12 lorenz-g

RAM is limited and that's the problem. I could set a bigger buffer, but then you'll get "out of memory" errors on the application. If you want to try, you can modify the line:

mp_task_heap_size = 2 * 1024 * 1024; 

from the file main.c. Keep me updated, if you get better results. I'll try to test some.

lemariva avatar Jan 03 '21 21:01 lemariva

Hi, thanks for the hint with the RAM. I will try it out.

But it might be sth different, because with framesize 11, I get can get pictures that are fine and are 60kB large. And it also happens sometimes from framesize 1 where the pictures is only 2kB (see the two images below).

As a cross check I will also take similar pictures with the standard c code and check it it has a similar behaviour.

12_3039_1_2000-1-1T0-50-39 11_143_11_2020-12-13T11-43-43

lorenz-g avatar Jan 04 '21 08:01 lorenz-g

I've updated the firmware, could you check that again?

lemariva avatar Jan 08 '22 18:01 lemariva

@lorenz-g can you check the latest driver? I think that could be a problem with the HEAP/SPIRAM. Now MicroPython works better with that and shares the PSRAM with other IDF components.

lemariva avatar Feb 02 '22 10:02 lemariva

Hi Mauro, I will check it with the latest driver but might need a week or two. Sorry.

lorenz-g avatar Feb 02 '22 11:02 lorenz-g

No problem! Note the new parameter fb_location. If you are using the ESP32_CAM you can set it to camera.PSRAM.

lemariva avatar Feb 02 '22 11:02 lemariva