ArduCam 108MP crashes when saving high-res image with reshape ValueError on Windows/Linux

Hi, I’ve got the Arducam 108MP Motorized Focus USB 3.0 Camera Module and I’m testing it on both Windows and Ubuntu 20.04. I followed the Quick Start Guide, cloned the demo repo with git clone -b Arducam108MPDemo https://github.com/ArduCAM/ArducamUVCPythonDemo.git, and ran python arducam_demo.py -W 1280 -H 720 --ccm --tuning-file arducam_108mp.json -F. The live preview seems to work, but as soon as I press a to save the high-res image the app crashes with ValueError: cannot reshape array of size 1843200 into shape (9000, 12000). The traceback points to line 112 of arducam_demo.py. It actually worked once and then somehow quit working. Any idea what’s going on?

Thanks for the details. Before we dig into the code, can you confirm the camera is plugged directly into a USB 3.0 port on the PC and not through a USB 2.0 hub? Also, just to be clear about the hardware: do you have the Arducam 108MP USB3.0 Evaluation Kit or the Arducam 108MP Motorized Focus USB 3.0 Camera Module? The demo handles them differently.

Yes, it’s plugged into a USB 3.0 port on the PC. I’ve also reproduced this on two different machines now — one Windows and one Ubuntu 20.04 — and I tried a couple of other machines as well. I googled around for the reshape error but didn’t find anything specific to this camera.

Okay, that helps. Looking at the repo, there’s a hardcoded value at line 109 of arducam_demo.py that’s currently set to 2. That value is correct for the Evaluation Kit, but the Motorized Focus module needs it set to 5. With 2 the resolution handling is mismatched, so the buffer (size 1843200) can’t be reshaped into 9000x12000, which is why it throws at line 112 when you try to save. Try changing line 109 from 2 to 5, then run python arducam_demo.py -W 1280 -H 720 --ccm --tuning-file arducam_108mp.json -F again and press a to save the full-res image.

I already tried changing that 2 to 5 in line 109. It didn’t fix the crash for me. Also, the Wiki doesn’t distinguish between the Evaluation Kit and the Motorised Focus module, so I’m honestly not sure which demo/code I should be using. The only git option I could find is that ArducamUVCPythonDemo link.

Understood. To sum up where we are: the Motorized Focus module requires 5 while the Evaluation Kit uses 2, and that difference isn’t made clear anywhere — the Wiki and the Arducam108MPDemo branch don’t separate the two products, which is exactly the confusion you’re hitting. If changing line 109 to 5 still crashes, please share the exact error after the edit, plus your lsusb output on Linux (or the USB tree on Windows) so we can verify the camera is enumerating on a USB 3.0 controller. I’ve also flagged this as a documentation gap so the naming and demo instructions can be clarified for these two modules.