GIDForums  

Go Back   GIDForums > Computer Programming Forums > C++ Forum
User Name
Password
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

 
 
Thread Tools Search this Thread Rate Thread
  #51  
Old 29-Jun-2009, 01:08
vk10 vk10 is offline
New Member
 
Join Date: Jun 2009
Posts: 7
vk10 is on a distinguished road
Arrow

Re: How to get the pixels' value of a bmp image? (Pelles C)


Hi Dave...

I have a few concern.

1)For the 24bit bitmap, the databuff is of 3-arrays while it is a double array for the 8-bit. why it so?

2)

Quote:

num_bytes_in_table =
> fheader.offset - sizeof(fheader) - sizeof(iheader);
.
.
.
i < num_bytes_in_table / 4


IN the loop, why was the color table iterated till 256.

Quote:

Since the number of bits per pixel is equal to 8, there is a color table.


In 24-bit bitmap, will there not be a color table.

Pls resolve my doubt, Dave

Cheers
  #52  
Old 29-Jun-2009, 08:53
davekw7x davekw7x is offline
Outstanding Member
 
Join Date: Feb 2004
Location: Left Coast, USA
Posts: 5,217
davekw7x is a splendid one to beholddavekw7x is a splendid one to beholddavekw7x is a splendid one to beholddavekw7x is a splendid one to beholddavekw7x is a splendid one to beholddavekw7x is a splendid one to beholddavekw7x is a splendid one to behold

Re: How to get the pixels' value of a bmp image? (Pelles C)


Quote:
Originally Posted by vk10
1)For the 24bit bitmap, the databuff is of 3-arrays while it is a double array for the 8-bit. why it so?
Are you referring to this from post number 38 in this thread?
Quote:
Originally Posted by davekw7x
Actually, I made them doubles so that I could conveniently round the value:
CPP / C++ / C Code:
    grayvalue = (g + b + r)/3.0 + 0.5;
As I tried to indicate, If g and b and r are chars, then the value of the sum (g + b + r) can be larger than 255, and making them doubles eliminates the possibility that overflow result in the wrong value of the average.

If g, b, r and grayvalue are all unsigned chars, then the same result could be obtained with
CPP / C++ / C Code:
    grayvalue = ((int)b + (int)g + (int)r)/3.0 + 0.5;

or some such thing.


Quote:
Originally Posted by vk10
IN the loop, why was the color table iterated till 256.
As I noted in post 49, the color table in the file may have as many as 1024 bytes for the pixel intensity values (256 integer values, the way that I used it.).

Quote:
Originally Posted by vk10
In 24-bit bitmap, will there not be a color table.
Yes, that's why the routine for processing the 24-bit color bitmap is different from the routine that processes the eight-bit one. So what's the question?

Regards,

Dave
 
 

Recent GIDBlogProgramming ebook direct download available by crystalattice

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

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

All times are GMT -6. The time now is 07:41.


vBulletin, Copyright © 2000 - 2009, Jelsoft Enterprises Ltd.