How to create a bitmap from raw data?

Hi,

I'm capturing image data from a firewire camera.  Each frame is
640 x 480 with 8-bits per pixel. I then create an RGB version of
the image by creating a buffer that is 640x480 * 3 and copying
each of the bytes three times, producing the RGB image.

Question:
How do I create a bitmap from the RGB image buffer so that I
can display the image with functions like BitBlt() or StretchBlt()?


Thanks for any suggestions.
RickL



0
nospam2504 (11)
1/31/2006 2:19:09 AM
vc.mfc 33608 articles. 0 followers. Follow

3 Replies
1603 Views

Similar Articles

[PageSpeed] 1

How are you converting from  640 x 480 with 8-bits per pixel
to 640 x 480 with 24-bits per pixel? For 8 bpp bitmaps, the value could
be an index into a palette table, from where you retreive the RGB color
value.

You should create a DIB section preferably. Remember each scanline is
padded to DWORD boundary when you do it, so width of each scanline should
be multiple of 4. Use CreateDIBSection(...)

Once you create the DIB, you can select into a memory DC and then bitblt or
stretchblt as you like.

-- 
Vipin Aravind

"RickL" <nospam@san.rr.com> wrote in message 
news:xOzDf.3020$Jg.1829@tornado.socal.rr.com...
> Hi,
>
> I'm capturing image data from a firewire camera.  Each frame is
> 640 x 480 with 8-bits per pixel. I then create an RGB version of
> the image by creating a buffer that is 640x480 * 3 and copying
> each of the bytes three times, producing the RGB image.
>
> Question:
> How do I create a bitmap from the RGB image buffer so that I
> can display the image with functions like BitBlt() or StretchBlt()?
>
>
> Thanks for any suggestions.
> RickL
>
>
> 


0
vipin (696)
1/31/2006 3:41:33 AM
The algorithm you define is meaningless.  It merely produces random shades of gray which
may or may not have any relationship to the colors.  

When you get an 8-bit paletted image, you MUST have a conversion table; otherwise the data
is meaningless anyway.  8-bit images are table lookup values to 24-bit color.   There are
some "standard" lookup tables, e.g., the "default Windows palette" and "the default IE
palette" among others.  But without knowing the decoding of the 8-bit values (I presume
you are referring to color images), then the 8-bit values are largely unintelligible.  You
would need to use this lookup table to convert them to 24-bit color images; replicating
the 8-bit value three times doesn't really do anything but produce a random shade of gray.

If you knew what your palette was, you could just use the image directly as an 8-bit
image, by setting the palette to the DC.  Or you could use the 8-bit values to index the
256 entries in the palette and derive the color information from that.

Presumably your camera documentation describes the default palette that is used.
					joe

On Tue, 31 Jan 2006 02:19:09 GMT, "RickL" <nospam@san.rr.com> wrote:

>Hi,
>
>I'm capturing image data from a firewire camera.  Each frame is
>640 x 480 with 8-bits per pixel. I then create an RGB version of
>the image by creating a buffer that is 640x480 * 3 and copying
>each of the bytes three times, producing the RGB image.
>
>Question:
>How do I create a bitmap from the RGB image buffer so that I
>can display the image with functions like BitBlt() or StretchBlt()?
>
>
>Thanks for any suggestions.
>RickL
>
>
Joseph M. Newcomer [MVP]
email: newcomer@flounder.com
Web: http://www.flounder.com
MVP Tips: http://www.flounder.com/mvp_tips.htm
0
newcomer (15975)
1/31/2006 4:09:01 AM
In article <xOzDf.3020$Jg.1829@tornado.socal.rr.com>, nospam@san.rr.com 
says...
> Hi,
> 
> I'm capturing image data from a firewire camera.  Each frame is
> 640 x 480 with 8-bits per pixel. I then create an RGB version of
> the image by creating a buffer that is 640x480 * 3 and copying
> each of the bytes three times, producing the RGB image.
> 
> Question:
> How do I create a bitmap from the RGB image buffer so that I
> can display the image with functions like BitBlt() or StretchBlt()?

Creating a DIBSection, then copy your buffer data to it, converting 
formats as appropriate.  Load your DIBSection into a CDC, and you are 
away.

- Gerry Quinn
 
0
gerryq (90)
2/1/2006 12:22:09 PM
Reply:

Similar Artilces:

saving data from outlook
i need to reinstall my system and know how to back up all the outlook folders and emails but how do i back up all the message rules and email acounts ?? thanks in advance Chris Take a look here, it may help: http://www.slipstick.com/config/backup.htm --� Milly Staples [MVP - Outlook] Post all replies to the group to keep the discussion intact. Due to the (insert latest virus name here) virus, all mail sent to my personal account will be deleted without reading. After searching google.groups.com and finding no answer, chris asked: | i need to reinstall my system and know how to back ...

A bug in GUI of creating query with more outer joins between two tables
Hello, in GUI of Access 2007 (12.0.6423.1000) SP2 MSO (12.0.6521.5000) is generally very simple to make a select query between two tables joined with two or more outer joins (of the same kind normally). But you should be careful. If you build first join clicking on a field of the first table, drag then the connection to the field of the second table and choose the right outer join, then you have to make the next outer join between the same two tables on the same way. If you begin but with the second table first and although you choose the same type of outer join (the arrow...

Synchronize HQ data from SO
I curretly have 2 stores that usually receive inventory update from HQ. However during the last few weeks I had to data entry from each RMS clients (SO). Now I want to update inventory data at HQ using worksheet. But it seems not possible, although sales data show correctly. Is there any way ? -- Many Thanks In an HQ environment all new items must be entered from HQ and sent to stores. Did you create new items at store level ? You may want to create those items in HQ and send to store. Mihir Shah Diviasoft, Inc. www.diviasoft.com "cosamo" <cosamo@discussions.microsoft.c...

Entering Data to make a list?
Is there a way that when I enter something into A1 &B1 it will fill down on a List? Like if I type apples in A1 & $12 in B1 on a certain sheet it will copy Apples and $12 , then if I type Pears & $5 it will copy to the next blank cell and so on -- Thanks in advance for your help....Bob Vance .. .. .. .. Bob I'm assuming you have this list on another sheet. This little macro will do the following: When you enter something in B1 of the first sheet, it will copy A1:B1 to the bottom of the list in Columns A & B of the second sheet. It will then clear (erase) the conte...

how to avoid closing dialog if data validation fails
I would like to validate data entered in a dialog when the OK button is clicked. If there are problems with the data I would like to avoid closing the dialog and keep it open. Can anyone suggest how this is done? Thanks for any suggestions. Ian If you dont want to close your dialog in OnOk, do not call the base class OnOK. -- Ajay Kalra [MVP - VC++] ajaykalra@yahoo.com "ian" <ib252@n0spam.com> wrote in message news:F1nnb.26812$He4.1099447@wagner.videotron.net... | I would like to validate data entered in a dialog when the OK button is | clicked. If there are problem...

Out of Memory error when attempting Data Merge in Word
Version: v.X Operating System: Mac OS X 10.4 (Tiger) Processor: intel I have set up a spreadsheet in Excel to keep track of high school band booster money (seventy members), and am trying to data merge the file into word to create individual account statements. There are five worksheets in the Excel file but I'm trying to merge just the first worksheet whose totals are linked to the rest of the sheets. When attempting the Data Merge, I am getting error messages that tell me that "Word was unable to open the data source" followed by "there is not enough memory or disk space ...

Push data to safe senders list to Outlook possible?
Is it possible to push a safe domain list to everyone's Outlook Junk Email safe senders list from Exchange (or any other method)? We are on Exchange 2003, all clients are Outlook 2003. Thanks. On Mon, 13 Feb 2006 13:10:29 -0800, "David" <David@discussions.microsoft.com> wrote: >Is it possible to push a safe domain list to everyone's Outlook Junk Email >safe senders list from Exchange (or any other method)? We are on Exchange >2003, all clients are Outlook 2003. >Thanks. Outlook11.adm in a GPO will allow you to set the default directory clients use...

easiest way to create gridlines in an Access 2003 report
Does anyone know an easy way to create gridlines in an Access 2003 report so that it resembles a spreadsheet, other than manually drawing vertical and horizontal lines? You can use the Line method of the report in its Page event. Use a loop to repeat at whatever grid size you want. Measurements are in twips, where 1440 twips = 1 inch This is how the Line method works: Me.Line (Me.ScaleTop, Me.ScaleLeft)-(Me.ScaleTop, Me.ScaleHeight), vbRed -- Allen Browne - Microsoft MVP. Perth, Western Australia Tips for Access users - http://allenbrowne.com/tips.html Reply to group, rathe...

Create Formula
I need to create a formula where I add a set number of Networkdays to a start date. Example: Start Date = 1/2/07 Number of Networkdays = 21 End Date = Is calculated If Start = 1/2/07 and 21 Networkdays are added, what is the retured end date???? I can only find example of Networkdays where I would be providing the Start and End Dates, and it will calculate the Networkdays. I can't find example where End Date is calculated based on the number of networkdays from start date. Can anyone help with a valid formula for this? Thanks!! ...

Data Lables, series and Scatterplots
Is there any way to get excel scatterplots to recognize a third column (or row) as a series for a scatterplot? FOr example I have data as: Sequence Long Lat 1 49.12 28.05 2 49.17 28.34 3 49.5 28.48 4 49.17 28.36 I would like to plot Long(itude) as X axis and Lat(itude) as Y on scatterplot (which I can do). But I would also like to identify the sequence number fopr each point. I thought I could do that by getting the Sequence numbers to represent a series, but can't sseem to get that in a scatterplot. Is there any other chart...

Sorting column data
How do I sort the data in the columns, I want to make the appear in alphabetical order? Alan I recommend Excel help. Search for: Sort a range. -- Steve "alan.holmes" <alan.holmes27@somewhere.net> wrote in message news:3S9sk.133571$Mn3.46670@newsfe30.ams2... > How do I sort the data in the columns, I want to make the appear in > alphabetical order? > > Alan > > "alan.holmes" <alan.holmes27@somewhere.net> wrote in message news:3S9sk.133571$Mn3.46670@newsfe30.ams2... > How do I sort the data in the columns, I want to make the appe...

Using SUMIF to add data between a range of dates
Hi, I am developing a cashflow spreadsheet, and need to add a range of values (in column B) based on the criteria that they are relating to a set week, ie in column B has the amount to be paid, and column C has the date the amount is due. I need to find out the total amount due between 2 dates. Does anyone know how I can do this? Hi With start date in B20 and end date in B21 try this: =SUMIF(C2:C5,">=" &B20,B2:B5)-SUMIF(C2:C5,"<="&B21,B2:B5) Regards, Per "Jaspa" <Jaspa@discussions.microsoft.com> skrev i meddelelsen news...

Re: 'Scrolling' bitmaps
"Giovanni Dicanio" <giovanniDOTdicanio@REMOVEMEgmail.com> ha scritto nel messaggio news:... > I did this kind of things using DirectDraw. A final note: if I recall correctly, the DX7 SDK also offers examples of mixing DirectDraw and MFC. (However, I think that doing some web search will give interesting results for that.) Giovanni ...

Creating Mailbox but not an AD account
Is it possible to create just an Exchange Mailbox and not an account on AD. We have a situation where mobile staff don't login to the domain but just access Email using Webmail. We are using Windows Server 2003 and Exchange Server 2003. Not possible that I am aware of since a mailbox is considered a property of the AD user account. "David Harris" <DavidHarris@discussions.microsoft.com> wrote in message news:535545F3-F7B7-428E-9796-88323A0E8734@microsoft.com... > Is it possible to create just an Exchange Mailbox and not an account on > AD. > We have a situat...

Refreshing query data via vba button
I have a wookbook which has 5 worksheets that contains sql query's that are bulling data from an access 2003 db, instead of me right clicking on each worksheet to refresh the data, is there any vba code that i can import that will enable the user to refresh the worksheet via a single button, been racking my brain, could someone help me please.............!!!!!!!!!!!!!!!!! -- RzaXL ThisWorkbook.RefreshAll MIke F "rzaxl" <rzaxl@discussions.microsoft.com> wrote in message news:5A2F6E4B-5A45-4AA2-8F4E-CEA3AFE0C1F5@microsoft.com... >I have a wookbook which...

Excel 2007: Return rownumber when text data on 3 columns match exa
Using: Excel 2007 I want to document Windows Group Policy settings side by side on a single sheet. To accomplish this task I want to return the row number of the current sheet where the data of the row that has an exact match. The data I want to lookup is in three colums. Example: Column B | Column C | Column D ------------------------------------------------------------------------------------------- Policy | Control Panel | Load a specific visual style Policy | Desktop | Do not add shares Policy | Desktop | Hide Network Location...

Lookup data in the list
Hi All, I have a list as shown bellow, I want to pick up the date correcponding to the value on cell A1 and the value in B2 or B3. So it is some thing like this =Vlookup(a2,a:b[b2+1] or[b+2] {this is just a vierd example} ColumnA ColumnB ID Name 1 12082A IN-tuition 2 Ms. Gayle 3 Gayle Theresa 4 Sofiane 5 12082B tuition 6 Ms. Gayle 7 12298A Language Institute 8 Senouci Bereksi 9 AOUL 10 Bereksi Kindly Help ASAP, As I am Stuck in my assignment. Hi, Manish. The better way, of course, is to have the ID in col A, the company name in B, the individual name in C a...

Big trouble matching with data on excel!
Hi, I'm required to present some info at my work, using two excel files. This is the task: File 1, has ID numbers in column A, and column B is blank. File 2, has ID numbers in column C and column D has the date the person joined the company File 1 es a select grop of people (about 2500), whereas File 2 is the general database (about 30thou) They're asking me to match the data, in order to end up with the coresponding date they joined the company in column B on File 1 (obtained from column D on file 2), how to do it? taking in account that File 1 is outdated and ...

How to let field sales people use our data base (without ASP/Scripting) ??
We have a data base we want our field sales people people to use daily. We have all our queries and forms and reports done in Access. We do not want to have to re-do it all in ASP or some other Scripting Language. We think we need something like Citrix and Terminal Server... but they are expensive... right? What are the alternatives available to very small businesses? Thanks for any help. Mel "Mel" <MyEmailList@gmail.com> wrote in message news:1180126800.016508.53210@q69g2000hsb.googlegroups.com... > We have a data base we want our field sales people people to use ...

clearing data
hi guys, i'm new to MBS great plains... i needed help in clearing all the data in the financial, sales and purchasing module (includes all transactions, vendors, customers and etc....) in great plains without deleting the set-up (includes chart of accounts and all) for the 3 modules. i would really appreciate it if you guys can give me the procudures on how to do it... -- iandale You could use File >> Maintenance >> Clear Data. Clear data from things that say "transaction" and "history". Keep away from things that say "setup" or "o...

Exporting Extender Data
Does anyone know which table holds the extender data? I tried searching customersource for some sort of extender table structure, but I couldn't find anything. I want to be able to export this data using crystal reports, but I just need to know how to connect to it. Try Techknowledge #899573 "ConnollyandCo" wrote: > Does anyone know which table holds the extender data? I tried searching > customersource for some sort of extender table structure, but I couldn't find > anything. I want to be able to export this data using crystal reports, but I > just n...

How to Extract Data from a CSV file???
I need help on how to write a VB command that will allow me to extract data from a specified column in a CSV file. I have written a command in VB to extract all data from the CSV file and paste it on an excel worksheet. This method is working fine but because the file is too big, it takes a long time for me to extract everything. I only need the data from one column so if anyone out there can help me with this, I would be extremely grateful... Cheers ------------------------------------------------ ~~ Message posted from http://www.ExcelTip.com/ ~~View and post usenet messages directly fro...

How do I create charts having non absolute reference values?
Not sure what you're asking. If you want to change an axis so it doesn't begin at zero, double click on it and enter your own scaling parameters. If that's not it, try using TWO sentences to explain what you need. - Jon ------- Jon Peltier, Microsoft Excel MVP Peltier Technical Services Tutorials and Custom Solutions http://PeltierTech.com/ _______ "rvboxel" <rvboxel@discussions.microsoft.com> wrote in message news:97BB5A7C-5AD5-4D84-83A1-02E8B96D2FAE@microsoft.com... > ...

Link variable data from one worksheet to another worksheet?
I am trying to link variable data from one worksheet (my source worksheet) to several other worksheets. For example, my source worksheet has two variables or columns: 'Team' and 'Bye Week'. The first entry under the 'team' column reads 'NE'. Let's say for this example that the first entry under the 'Bye Week' column is the number '10'. Given this, I want every entry under the 'Team' column in other worksheets that read 'NE', to read the number '10' under the 'Bye Week' column. Let's also say tha...

How can save a stationery created using a Publisher design set to.
How can save a stationery created using a Publisher design set to be used as my Outlook stationery? What version Publisher? Select all, right-click, click save as a picture. In older versions, select all, copy and paste to a Paint program. -- Mary Sauer MS MVP http://office.microsoft.com/ http://msauer.mvps.org/ news://msnews.microsoft.com "Mike" <Mike@discussions.microsoft.com> wrote in message news:DCADC78B-C5A3-406E-820D-53910CBB5BDF@microsoft.com... > How can save a stationery created using a Publisher design set to be used as > my Outlook stationery? ...