# Decoding Bitmap

Hey guys! I have to read a monochrome bmp image from sd card, convert it to binary array and write that array to a text file on sd card. Any idea how to do this?

I have to read a monochrome bmp image from sd card

In what format? Binary data or ASCII data?

convert it to binary array

All data in memory is binary. There is no need to do this step, except for using an array.

and write that array to a text file on sd card.

For what purpose? An image file converted to text is just about useless. Kind of like creating a jpeg file for a song.

PaulS:
Kind of like creating a jpeg file for a song.

You mean a picture DOESN'T paint a thousand words?

TB Honest, I hate that song anyhow.

PaulS:
For what purpose? An image file converted to text is just about useless. Kind of like creating a jpeg file for a song.

For solving a maze whose top view is stored in bmp format

For solving a maze whose top view is stored in bmp format

What is going to solve the maze? Why is a text representation of a bitmap more useful than the binary representation?

PaulS:
What is going to solve the maze? Why is a text representation of a bitmap more useful than the binary representation?

Arduino has to know where the walls are and will calculate the shortest path via breadth-first algorithm.

Arduino has to know where the walls are

Which it can get from the binary data just as easily as it can get from the ASCII data it created from the binary data.

PaulS:
Which it can get from the binary data just as easily as it can get from the ASCII data it created from the binary data.

Okay, how do I save it in ASCII data?

why do you crosspost?

Okay, how do I save it in ASCII data?

That's up to you. You are going to read the bitmap file. For each pixel, you are going to decide if it represents an edge between a wall and an opening, a part of the wall, or a part of the opening.

You are going to then decide whether you want to save the wall edges, the wall area, or the open area.

You are then going to decide how you save that information.

robtillaart:
why do you crosspost?

Perhaps you would be kind to the rest of us and merge the Threads?

...R

NAVEEDAKHTER01:
Okay, how do I save it in ASCII data?

But why go though the step of conversion to ASCII, text etc...
when you could examine the raw data.
Computers don't need data in human form to work with it
and usually are more efficient processing data in forms that are
inconvenient to humans (like binary).

Maybe if you explained more of what you are really wanting/need to do
we could be of more help.

--- bill

Robin2:
Perhaps you would be kind to the rest of us and merge the Threads?

...R

Ah, you believe we still have the ability to merge threads? muahahaha

• Moderator

(We do have the ability to merge, but in extreme cases like this, pruning is the simpler option. The OP also gets a formal warning; that's a new thing, and I wanted to try it out)

AWOL:
(We do have the ability to merge ...

Not from one part of the forum to another.

Screen shots and everything.

Oh. Great.

Pruning's simpler anyway.

Oh. Great.

Yes, because cross-posting is very often between different parts of the forum, in a vain attempt to get maximum exposure to their incredibly-important question.

Pruning’s simpler anyway.

I might have to do that in future.

I wholeheartedly recommend it.

Gees guys, after unpteen posts we got educated about everything but how to decode bitmap.
I am putting in a request to block useless OT posts.

Here - try this for a start

http://www.fileformat.info/format/bmp/egff.htm#MICBMP-DMYID.2

From my experience - there was / is something about "filling in the boundaries" which I found confusing and not sure if it still an issue.

I am about to do same with raw video file - need to identify an "new" object in subsequent frames.
Keep in touch , PM preferred for reasons stated above.
Cheers Vaclav

Well, the OP (NAVEEDAKHTER01) posted identical questions at 2:57, 2:58, 2:59, 3:00 and 3:01 am. S/he replied to a couple of queries at 3:04, 3:14, and 3:33 am. Then, nothing. So although it looked really urgent initially, apparently not.

Anyway, this isn't a programming question, it's a project guidance question, so I will deal with it appropriately.