Search code examples
ciothardware

Does anyone know the amount of resources that a C program that handles 1080 x 1920 pixel images may require?


I am developing a project that consists of extracting text from images and then placing them in a .txt file and later converting that .txt into an mp3 that will be played by some speakers. My problem is that I do not know what type of microcontroller will be able to carry out all these tasks taking into account that I want it to be as economical as possible.


Solution

  • First thing, you should start with your calculator and punch in the numbers to see what you get.

    For example, a 1920 x 1080 pixel image with 1 bit per pixel is ~253KB of data.

    If you're handling large image files, a microcontroller isn't going to cut it. Most microcontrollers have less than 1MB of memory total, if that. The Raspberry Pi Pico for example has 264KB of memory, a fairly generous amount, and that can barely hold a bitmap image that size.

    You need a more robust processor. A Raspberry Pi has 2GB+ of memory and can handle images that scale at 24-bit color depth. 1920 x 1080 x 3 bytes per pixel is about 5.9MB of data. Totally manageable on a system with >32MB of memory.

    Remember, microcontrollers excel at performing simple tasks like driving a keyboard, servo motors, communicating with sensors and such, and are really bad at doing intensive processing. The Pico's CPU runs at 133MHz, that's it. There's only so much you can do with a few watts of power!

    You'll need a full CPU to do image processing, or even better, leverage the GPU elements on a system like the Pi to do that more efficiently, something no microcontroller is ever going to include.