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
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.
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 Startff d8
and Stopsff d9
(which I find).
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