September 25th, 2003, 07:14 AM
Converting Digital Images to Binary Codes
There are several steps that are involved in this process:
1) I took a digital photo of a car plate number.
2) I store it into the computer, setting my own matrix size (of pixels) and grayscaling it.
Now comes the part that I haven't been able to figure out yet. How do I convert the pixels (or the bytes in the pixels) into the coresponding binary codes? I'm supposed to come up with a program (C/C++) to do the conversion but I don't know what I'm supposed to work on here! I've heard something vague about 'hex codes'? How do I 'disect' the individual pixels to code them? I'm also at a loss about whats the best type (bmp, jpeg, etc.) to use...
I really can't seem to find the specific answers from the web, so I hope a kind soul out there can give me a few pointers to work with? Thanks a lot!!!
September 25th, 2003, 10:10 AM
First, you need to understand that all data is just a bunch of bits that only have meaning in the context of the programmer and user. Second, you need to understand what image compression does for (and against) you. A bmp file is uncompressed meaning that each pixel is represented in the file (which is only an image file because you decide it is). A jpeg file has had a compression algorithm (which, BTW, causes a loss of data!) run on it and is completely incomprehensible without the appropriate decompression algorithm (might as well be a random collection of bits otherwise). (A gif file, BTW, uses a different form of compression.) If you work with a compressed file, you must first decompress it before you can work with the bits. Most libraries (to my knowledge C and C++ lack any standard libraries for working with images, though Java has several) will allow you to access each pixel of the image. Using those library functions you can retrieve the bits that code for each pixel in various formats. As for retrieving it in 'binary' format, what other kind of format do you think the data is stored in? It is all binary, even the ASCII data is binary, it is just a series of bits that we all agree on are in a certain format. There are lots of books and web pages that are devoted to image data, I am sure you are just picking poor words in your attempts to search.