views:

224

answers:

2

I need put one bitmap image to my directshow filter. Then user can use this bitmap image and do not care where is it.

First, I import this bitmap file into resource bundle, and get one IDB_BITMAP1.

Then, I need to read this IDB_BITMAP1 using opencv cvLoadImage or some windows image API to load this image into buffer.

So question is how to do this ?

Or is that possible ?

Thanks

A: 

I don't know OpenCV, but the Win32 APIs LoadImage() can load from resources as well. E.g.:

LoadImage(hInstance, 
          MAKEINTRESOURCE(IDB_BITMAP1),
          IMAGE_BITMAP,
          /*...*/);
Georg Fritzsche
yeah, I guess so.
Forrest
+1  A: 

I never tried it myself, but I believe you can use Loadbitmap and GetBitmapBits to do this:

HBITMAP hBitmap = LoadBitmap(hInstance,MAKEINTRESOURCE(IDB_BITMAP1));
GetBitmapBits(hBitmap, size, pBits);
Dani van der Meer