Trying to loop through all pixels in a bmp with arduino

Hello. I am trying to compare two different images with my Arduino. I have found some code that is really good and I am pretty sure it is only possible to do exactly this way with .net framework but the idea is very good and I am trying to figure out how I can do this with Arduino. Here is a link to the code.

Hope someone has some tips and hope you enjoy the article thanks.

Well, since the code in the article stores the entire image in memory, one must ask if your Arduino has enough memory for your image data?

Thanks for the tip the image is from an esp32 it is small enough I think 100 kb or something.

I don't see where .net framework has any bearing on the logic of the sample program. Just follow it and write similar code for the Arduino.

I do not understand

Bitmap bmp = new Bitmap("SomeImage");

// Lock the bitmap's bits.
Rectangle rect = new Rectangle(0, 0, bmp.Width, bmp.Height);
BitmapData bmpData = bmp.LockBits(rect, ImageLockMode.ReadWrite, PixelFormat.Format24bppRgb);

// Get the address of the first line.
IntPtr ptr = bmpData.Scan0;

// Declare an array to hold the bytes of the bitmap.
int bytes = bmpData.Stride * bmp.Height

I don't know how to replace lock bmp.lockbits or stride
The Bitmap class with all of these comes from .Net framework. Does anyone know similar classes?

Use Google to discover what lockbits means in c#. First return told me you can ignore it for an Arduino. You can do similar searches when you find a phrase you don't understand.

This article shows me how to take a byte array from a jpg and turn it into a hex string. This is the answer to my question. Sorry to ask people to do my work for me. That should do I hope. Hope it helps someone one day.

Isn't a bitmap image just a huge array of bytes?

Ya but i think there are extra bytes scattered throughout it jpg I think is plain pixel data.

That's about as far from the truth as it is possible to be.

I'd suggest you to at least quickly check the BMP and JPEG formats...

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.