I am having a difficult time setting up video with the new SDK, I was used to calling the DrawFrame command on the old SDK. I am trying to send the frame to a picturebox in vc++ .net (not that familiar with MFC)
I am trying two different was with no success:
char imageBuffer[640*480];
frame->Rasterize(640,480,640,8,imageBuffer);
System::IO::MemoryStream^ ms = gcnew System::IO::MemoryStream((int)imageBuffer);
System::Drawing::Bitmap::Image^ returnImage=System::Drawing::Image::FromStream(ms);
this->pictureBox1->Image=returnImage;
AND
CBitmap bitmap;
CameraLibrary::Bitmap * scratchpad = new CameraLibrary::Bitmap(680, 480, 1, CameraLibrary::Bitmap::EightBit,0);
frame->Rasterize(scratchpad);
bitmap.CreateBitmap(640,480,1,1,((const void*)scratchpad->Bitmap::GetBits()));
System::Drawing::Bitmap^ IMAGE=System::Drawing::Bitmap::FromHbitmap(System::IntPtr(bitmap));
pictureBox1->Image =dynamic_cast(IMAGE);
ANY HELP IS GREATLY APPRECIATED!
New SDK drawing frame to a picturebox->Image VC++ .net
-
- Posts: 19
- Joined: Mon Jun 07, 2010 7:40 am
Re: New SDK drawing frame to a picturebox->Image VC++ .net
answered via email
-
- Posts: 22
- Joined: Tue Aug 14, 2007 7:26 am
Re: New SDK drawing frame to a picturebox->Image VC++ .net
I too would be interested in this function. Please share with the rest of us.
Thanks,
Mike
Thanks,
Mike
Re: New SDK drawing frame to a picturebox->Image VC++ .net
If you leave the final parameter zero, the Bitmap will allocate the buffer itself--so what you're doing is correct. If you wanted to allocate the memory for the bitmap, you could pass a pointer to that memory in that parameter, but the easiest way is to let the Bitmap take care of it for you.