【发布时间】:2011-02-21 06:39:50
【问题描述】:
通常我们在opencv窗口中显示网络摄像头或视频运动:
CvCapture* capture = cvCreateCameraCapture(0);
cvNamedWindow( "title", CV_WINDOW_AUTOSIZE );
cvMoveWindow("title",x,y);
while(1)
{
frame = cvQueryFrame( capture );
if( !frame )
{
break;
}
cvShowImage( "title", frame );
char c = cvWaitKey(33);
if( c == 27 )
{
break;
}
}
我尝试使用pictureBox,它成功地以windows形式显示图像:
pictureBox1->Image = gcnew System::Drawing::Bitmap( image->width,image->height,image->widthStep,System::Drawing::Imaging::PixelFormat::Undefined, ( System::IntPtr ) image-> imageData);
但是当我尝试从视频中显示捕获的图像时它不起作用,这是源代码:
CvCapture* capture = cvCreateCameraCapture(0);
while(1)
{
frame = cvQueryFrame( capture );
if( !frame )
{
break;
}
pictureBox1->Image = gcnew System::Drawing::Bitmap( frame->width,frame->height,frame->widthStep,System::Drawing::Imaging::PixelFormat::Undefined, ( System::IntPtr ) frame-> imageData);
char c = cvWaitKey(33);
if( c == 27 )
{
break;
}
}
有没有办法使用 windows 窗体而不是 opencv windows 来显示视频或网络摄像头?
还是我的代码有问题? 谢谢你的帮助.. :)
【问题讨论】:
标签: c++ forms video opencv webcam