Hey everyone, I’m trying to get my Arducam 3MP SPI camera (the Mega one) working with YUV output mode. I’ve set the resolution to 96×96 and I’m expecting YUV420 data, but the numbers just don’t add up.
Here’s my math: for YUV420 at 96×96, it should be 96 × 96 × 3 / 2 = 13,824 bytes (12 bits per pixel, or 1.5 bytes per pixel). But the camera keeps giving me 18,432 bytes per frame. That’s way off.
I noticed that 96 × 96 × 2 = 18,432, which works out to exactly 2 bytes per pixel. That feels like YUV 4:2:2 or YUYV, not YUV420. The problem is I can’t find any proper documentation for this camera that confirms what pixel format it actually outputs in YUV mode. Has anyone else run into this?
You’re on the right track with that observation. The Arducam Mega camera (3MP SPI) does indeed output YUV422, not YUV420. This isn’t clearly stated in most of the documentation, so the confusion is understandable.
YUV422 uses 16 bits per pixel — that’s 2 bytes per pixel. So the correct formula for the expected frame size is simply: width × height × 2. For your 96×96 setup, that’s 96 × 96 × 2 = 18,432 bytes, which matches exactly what you’re seeing.
Ah, that makes sense now. So I should just treat the incoming data as YUV422 and stop trying to decode it as YUV420. The 18,432 bytes is actually correct — I was just using the wrong pixel format assumption.
Exactly. Just switch your decoder or processing pipeline to handle YUV422 (sometimes called YUYV depending on the library), and the 18,432-byte frames should decode properly. No need to change anything on the camera side — it’s working as intended, just not in the format you initially expected.