![]() |
|
#11
|
|||
|
|||
Re: How to get the pixels' value of a bmp image?(Pelles C)Quote:
Another mental error on my part. Actually that was another thread that kind of died. This thread had something to do with encryption, but we never got far enough into the bitmap part to worry about the encryption part. I think I need to take a break. Oh, well... Regards, Dave |
|||
|
#12
|
|||
|
|||
Re: How to get the pixels' value of a bmp image?(Pelles C)Quote:
Another oops in the descriptiion. ASCII 'B' is 0x42; ASCII 'M' is 0x4d. The first two bytes in the file are 'B', 'M'---a big-endian 'B', 'M'. SInce I read the whole header with one operation, the bytes are stored in the buffer in the same order as they occur in the file. So 'B' is in address zero of the buffer and 'M' is in address 1 With a little-endian machine, when you fetch a 16-bit integer from location zero, it places the first byte in the lower eight bits of the integer and the second byte in the upper eight bits of the integer. And that's why the value is shown as 0x4d42. Regards, Dave |
|
#13
|
|||
|
|||
Re: How to get the pixels' value of a bmp image?(Pelles C)Quote:
The ordering of the bytes (for say, an int) has always been confusing to me too. But I press on... Quote:
We all aprecionado... I'll continue into this over the next few days-weeks. Interesting stuff to see. I had always wondered how image files were put together. Now I'm seeeing it... Thanks for the assignments, (like I need more temptation to avoid work stuff) ++Howard; |
|
#14
|
|||
|
|||
Re: How to get the pixels' value of a bmp image?(Pelles C)thank you very very much, dave
I want to send a pdf file to you to let you see what I really wanna do actually... could you give me a private message of your email or so on? Thank you very much again, Regards Sound |
|
#15
|
|||
|
|||
Re: How to get the pixels' value of a bmp image?(Pelles C)Quote:
How about just telling us? Think of it as good training for the day when you are someone's boss (maybe mine) and you want to create a Program Specification of a small program in a text file. If we can't figure it out, we'll ask again. Regards, Dave |
|
#16
|
|||
|
|||
Re: How to get the pixels' value of a bmp image?(Pelles C)dear dave
actually, i would like to do something like this: www. ibiblio. org / e-notes/ Chaos/ baker.htm |
|
#17
|
|||
|
|||
Re: How to get the pixels' value of a bmp image?(Pelles C)dear dave
actually, i would like to do something like this: www. ibiblio. org / e-notes/ Chaos/ baker.htm and www. sciencedirect .com/science?_ob=ArticleURL&_udi=B6TJ4-4FGX7X7-2&_user=13304&_coverDate=10%2F31%2F2005&_rdoc=1&_f mt=&_orig=search&_sort=d&view=c&_acct=C000001598&_ version=1&_urlVersion=0&_userid=13304&md5=86381792 a0d50c3b993233e365085ed8 and www. springerlink. com/content/t0638763n4207m7j/fulltext.pdf and www. informatica. si/PDF/31-1/22_Ahmed-An%20Efficient%20Chaos-Based%20Feedback...pdf Regards..>< |
|
#18
|
|||
|
|||
Re: How to get the pixels' value of a bmp image?(Pelles C)Quote:
Assuming that your output will be an 8-bit gray-scale bitmap, here's a game plan: Step 1. Determine the size of the bitmap by reading the height and width values from the header. Allocate an array[height][width] of unsigned chars. This is your input matrix. (Alternatively, you could have declared a fixed array whose dimensions are as large as the largest bitmap that your program will have to deal with.) Step 2. Read in the bitmap pixel values, convert to 8-bit gray-scale values if necessary, and store them in your input matrix. Step 3. Do whatever you want to with the element values in the matrix. Maybe a formal transformation consisting of a sequence of multiplications by other matrices. Maybe an ad-hoc nested-loop routine that swaps values among matrix elements, or, maybe, copies elements of the input matrix to different positions of another matrix that you will use for writing an output bit map file. Step 4. Write out the bitmap file. Now, if it's not an eight-bit gray-scale, then you have a number of choices. Maybe the simplest would be to declare a struct of pixel values. The struct elements will represent Red, Green, and Blue values for a pixel. Then your input matrix is an array[height][width] of the pixel structs. Matrix manipulation is performed on this array. The principle is the same, you simply make your data structure consistent with your problem. The point is: get the pixel data into a 2-D array that you can work on to do the required transformations. Regards, Dave |
|
#19
|
|||
|
|||
Re: How to get the pixels' value of a bmp image? (Pelles C)Dear ALL,
after several days... I still cannot pass all the pixels' values into an 2D array correctly (8/16/24-bit color)... can anyone help me more about this... very upset at this moment..>< Regards |
|
#20
|
|||
|
|||
Re: How to get the pixels' value of a bmp image? (Pelles C)Quote:
Am I missing something? I can't find a single line of code that you have posted. Since we have absolutely no way of knowing what you have tried, how could you reasonably expect anyone to be able to help??? 1. Show your code. If you can trim it down to a small subset that shows your specific problems, that would be a Good Thing. 2. Tell us what exactly happened when you tried to compile and/or execute the code. (Be specific.) 3. Tell us what exactly you don't understand. (Be specific.) Regards, Dave |
Recent GIDBlog
Programming ebook direct download available by crystalattice
| Thread Tools | Search this Thread |
| Rate This Thread | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Question about locking surfaces to directly access pixels, SDL. | george89 | C++ Forum | 0 | 18-Jun-2006 22:16 |
| Pixels | dan_ielle20 | C++ Forum | 0 | 23-Mar-2005 09:54 |
| Checking source codes of image, audio and video files | onauc | C Programming Language | 5 | 26-Feb-2005 22:47 |
Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The