UnitCam quality and compression settings missing for Arduino and Core2



  • Unfortunately I didn't find any possibility to change the resolution of the UnitCam (in the official example for the Core2). I need RGB instead of Jpeg encoding, as stated in the docs.

    I would like to adapt the esp_camera.h from older camera libraries but it is completely different to the current example, though the hardware seems to be the same.

    Hopefully someone can help..



  • Also I can't find out the default resolution of the camera :/

    I just found the device control register list for the ov2640. But I have to figure out how to write to the registers via Core2/ESP32

    0_1667169748991_ecc89c74-87c1-43b9-a04d-802becf19061-grafik.png
    0_1667168805826_68f6083f-56cc-41ac-9ae0-5ab50f112030-grafik.png

    The older esp_camera.h is getting camera addresses and configs from sensor.h (OV2640 is on 0x26 there)



  • Hello @swiminthesky

    I've extended the Cam2Core example to show how to send commands to the camera. You can find it here.

    The API allows to change many settings, including resolution and quality. However I don't think it includes a way to switch the encoding. JPEG seems to be hardcoded into the camera firmware.

    Thanks
    Felix



  • Thanks lot @felmue, I really appreciate.

    I had guessed the output format can also simply be changed by writing to the ov2640 register. At least it says it on the main page, that the other settings would be available.

    Anyways, I am fine with working with jpg, but unfortunately I cannot reproduce the jpeg yet in an RGBA8 texture with the given resolution from the provided buffer (~8000 bytes). The photo taken is just white/grey.

    0_1667220298210_8224550e-e22d-41b3-90ed-9e59588730eb-grafik.png

    0_1667220428253_0cf88125-bb78-4c0a-9827-97a54f63315b-grafik.png

    I am just sending the uint8_t buffer over Serial
    for (uint32_t i = 0; i<frame.size; i++) { Serial.write( frame.buf[i] ); }, and read the bytes to a texture, while filtering for Jpeg Start ff d8 and Stops ff d9 (which I find).
    0_1667220924758_ee39c219-d6c9-44ee-8297-692ab61868f1-grafik.png

    The length / size of the buffer ~1000-3000 for the 160x140 resolution, seems suspiciously low though, compared to the relatively good image shown on the Core2 display. Hm.. I assume the buffer has to be uncompressed based on compression settings found in the Jpeg header bytes..

    -- Got it working by decompressing jpeg