LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

BMP from Memory right away to picture control

Hello,

i included a camera sdk (canon powershot a620) in my projekt. After a
picture is captured i get a pointer to the memory where the picture is
stored. (prVoid *pVFData). I dont want to save this picture and then reload
it to a picture control, i want to display it right away from memory. How
can i do this? Most of the CVI functions need a bmpID, but as I mentioned
before, i only got a pointer to the picture array. Any ideas?

Thanks

Norbert


0 Kudos
Message 1 of 6
(3,689 Views)
Hi Norbert,

there is a function in LabWindows/CVI called "NewBitmap".

int NewBitmap (int bytesPerRow, int pixelDepth, int width, int height, int colorTable[ ], unsigned char bits[ ], unsigned char mask[ ], int *bitmapID);

With knowlege of your aquired data you could use this function to create a bitmapID, there is no need to save your picture first.

You can pass that BitmapID to any function that accepts a bitmap, for example "CanvasDrawBitmap" to display it.

regards,

Nikolai
0 Kudos
Message 2 of 6
(3,643 Views)
Thanks Nikolai,

yes, i tried this function before, but my problem is that i don't have
detailed knowledge about the aquired data. The picture data comes from a
canon powershot a620 (using Canon SDK) in a compressed format.

prResponse prSTDCALL A620ViewFinderFunction (prHandle CameraHandle,
prContext Context, prUInt32 Size, prVoid *pVFData)


Saving this data array (pVFData) in a file and load it as a jpg bitmap works
fine, but the data array contains less bytes then the picture so i do not
know the bits of the picture. But the CVI function to create a new bitmap
seems not to work. I tryed also the Windows SDK function
CreateBitmapIndirect but that didn't work either :o(

Any other ideas ?


Norbert



"nikolair" <x@no.email> schrieb im Newsbeitrag
news:1163695215233-442175@exchange.ni.com...
> Hi Norbert, there is a function in LabWindows/CVI called "NewBitmap".int
> NewBitmap (int bytesPerRow, int pixelDepth, int width, int
> height, int colorTable[ ], unsigned char bits[ ], unsigned char mask[ ],
> int
> *bitmapID); With knowlege of your aquired data you could use this function
> to create a bitmapID, there is no need to save your picture first.You can
> pass that BitmapID to any function that accepts a bitmap, for example
> "CanvasDrawBitmap" to display it.regards,Nikolai


0 Kudos
Message 3 of 6
(3,624 Views)
can you tell me how you can store the image from your buffer to file bmp ? i have problem to do this, i acquir image from fingerprint scanner and the result is a pointer to the adress memory that contain the image scaned. thank youSmiley Wink
0 Kudos
Message 4 of 6
(3,574 Views)
Hello Biometric75,

i get the pointer in a canon sdk function as follow:

prResponse prSTDCALL A620ViewFinderFunction (prHandle CameraHandle,
prContext Context, prUInt32 Size, prVoid *pVFData)

in the next line i call my function:
VIEWER_SetNewBMP(Size, pVFData);

and here is my function to save the bmp (as a jpg file)

void VIEWER_SetNewBMP(prUInt32 Size, prVoid *pVFData)
{
int error = 0;
int bytes = 0;
int fileHandle;

fileHandle = OpenFile("new.jpg",VAL_READ_WRITE,VAL_TRUNCATE,VAL_BINARY);
bytes = WriteFile (fileHandle,pVFData, Size);
CloseFile(fileHandle);
}

And here i read the bmp from the previously saved file:
error = GetBitmapFromFile ("new.jpg", &bmpID);

Hope that helps....

Norbert



"Biometric75" <x@no.email> schrieb im Newsbeitrag
news:1164723016737-446527@exchange.ni.com...
> can you tell me how you can store the image from your buffer to file bmp ?
> i have problem to do this, i acquir image from fingerprint scanner and the
> result is&nbsp;a pointer to the adress memory that contain the image
> scaned. thank youSmiley Wink


0 Kudos
Message 5 of 6
(3,561 Views)
think's Nobert ,
have you any idea for displaying
directly the buffer in a control without reload it after saving?

Biometric75 Smiley Happy

0 Kudos
Message 6 of 6
(3,541 Views)