New SDK drawing frame to a picturebox->Image VC++ .net
Posted: Tue Nov 16, 2010 10:26 am
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!
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!