- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Dear all,
I need to read several bitmap (*.bmp) files into a 3-D array to work on the pixel values.
I found a solution using Quickwin & LOADIMAGE & GETPIXEL. However this is very time consuming, so reading 500 files takes very long.
I tried to use other options, e.g. using GETIMAGE which reads the screen image into a buffer. However, I wasn't able to interprete the buffer format, and I also found that the buffer format differs on Windows98 and Windows 2000.
Then I tried the subroutine "BitmapGet" which is part of the QUICKWIN samples. I was able to read data which was created using "BitmapPut", but not when the screen was created using LOADIMAGE.
Does anybody know a better solution for this task? If necessary, I can provide the test program I'm working with.
Best regards, Reiner
I need to read several bitmap (*.bmp) files into a 3-D array to work on the pixel values.
I found a solution using Quickwin & LOADIMAGE & GETPIXEL. However this is very time consuming, so reading 500 files takes very long.
I tried to use other options, e.g. using GETIMAGE which reads the screen image into a buffer. However, I wasn't able to interprete the buffer format, and I also found that the buffer format differs on Windows98 and Windows 2000.
Then I tried the subroutine "BitmapGet" which is part of the QUICKWIN samples. I was able to read data which was created using "BitmapPut", but not when the screen was created using LOADIMAGE.
Does anybody know a better solution for this task? If necessary, I can provide the test program I'm working with.
Best regards, Reiner
Link Copied
4 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Reiner
I do not have any solution to your problem, but could I know the way you are using BitmapGet and BitmapPut to make the buffer? My e-mail is in_vision@cablerocket.com.
Thanks in advance
OPiedrahita
I do not have any solution to your problem, but could I know the way you are using BitmapGet and BitmapPut to make the buffer? My e-mail is in_vision@cablerocket.com.
Thanks in advance
OPiedrahita
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I think you'd be better off using a little Windows API than coping with GetImage/BitmapGet. Maybe API wouldn't be even necessary -- you should be able to parse the .bmp file yourself without involving any GUI operations.
The .bmp file consists of BITMAPFILEHEADER structure followed by BITMAPINFOHEADER structure. Then comes an array of bitmap data. You can find detailed specification of the format on . There are few tricky issues involved:
First, contents of the bitmap data depend on color depth. The easiest one is 24-bit bitmap -- the contents is simply an array of {R,G,B} triplets. For other formats, carefully check the documentation.
Second, if you want to put the data in a matrix you have to be careful with upside-down order, column-major vs. row-major order and especially padding used to align rows to 4-byte boundary.
If you want more general solution, you could use the following APIs:
;
;
There's a Fortran sample for storing the bitmap here. I think it's worth a look. Sorry, I can't provide any sample code myself.
HTH
Jugoslav
The .bmp file consists of BITMAPFILEHEADER structure followed by BITMAPINFOHEADER structure. Then comes an array of bitmap data. You can find detailed specification of the format on . There are few tricky issues involved:
First, contents of the bitmap data depend on color depth. The easiest one is 24-bit bitmap -- the contents is simply an array of {R,G,B} triplets. For other formats, carefully check the documentation.
Second, if you want to put the data in a matrix you have to be careful with upside-down order, column-major vs. row-major order and especially padding used to align rows to 4-byte boundary.
If you want more general solution, you could use the following APIs:
hBmp = LoadImage(...LR_LOADFROMFILE) to load the bitmap;hMemDC = CreateCompatibleDC to create a DC (canvas) in memory to put bitmap to;i = SelectObject(hMemDC, hBmp) to associate the bitmap with the DC;
i = GetObject(hBmp, SIZEOF(cBmp), LOC(cBmp)) to get info about the bitmap (size, depth etc);
i = GetDIBits(...) to get an array of bitmap dataThere's a Fortran sample for storing the bitmap here. I think it's worth a look. Sorry, I can't provide any sample code myself.
HTH
Jugoslav
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I receive the information.
Thank you very much for the help.
OPiedrahita
Thank you very much for the help.
OPiedrahita
Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page