View Full Version : getdib and then what????
November 4, 2003, 17:41:03
hi, I know I ask these stupid questions but my time frame to finish my demo project is extremly short and my knowledge is - well none.
I still wish to rotate the frame (in live video) by 90 degrees - now lets assume I called getdib method and got a handle - I wish to get the bitmap in that handle -(in order to rotate it in a c dll function) - how do I manipulate this handle and get the data,bitmap pixels???
please help me.
November 6, 2003, 09:32:13
To access the DIB that is provided by ICImagingControl.GetDIB in a C function, implement following code:
long WINAPI WorkOnDIB( HGLOBAL _hDib)
HGLOBAL hDib = GlobalLock( _hDib);
// Bitmapinfoheader contains the bitmap data like height, width etc.
LPBITMAPINFOHEADER pSrcBitmapInfoHeader = (LPBITMAPINFOHEADER)hDib;
//Retrive the pointer to the pixel data
BYTE *pSrcBitmapData= (BYTE*)hDib + sizeof(BITMAPINFOHEADER);
// Now do something with the bytes..
GlobalUnlock( _hDib );
With this code, you can process the image data of the DIB, but if you want to display the processed image in a Visual Basic's PictureBox, there is more work to do. You could pass a HDC of a Visual Basic's PictureBox to this function, create a BITMAPINFOHEADER and a new BYTE memory of width * height * bytesperpixel in this function, that has the 90° rotated size and blit the new rotaded data with WINAPI StretchDIBits() to the HDC.
Powered by vBulletin® Version 4.2.2 Copyright © 2014 vBulletin Solutions, Inc. All rights reserved.