Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/csharp-4.0/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 4.0 使用Expression.编码器和网络摄像头的黑色预览屏幕_C# 4.0_Webcam_Expression Encoder Sdk - Fatal编程技术网

C# 4.0 使用Expression.编码器和网络摄像头的黑色预览屏幕

C# 4.0 使用Expression.编码器和网络摄像头的黑色预览屏幕,c#-4.0,webcam,expression-encoder-sdk,C# 4.0,Webcam,Expression Encoder Sdk,我使用Expression.Encoder编写了一些带有Logitech网络摄像头的C#代码接口。代码很容易设置,在我的机器和我的测试人员的机器上运行得很好。不幸的是,在野外,相机的预览屏幕显示为黑屏。我已经确认,摄像头在罗技的应用程序和微软的Expression应用程序中都显示了一个提要。已安装Windows Media Player和DirectX 11。问题似乎在于预览窗口的创建中有人没有工作 // create the camera feed with just a video cur

我使用Expression.Encoder编写了一些带有Logitech网络摄像头的C#代码接口。代码很容易设置,在我的机器和我的测试人员的机器上运行得很好。不幸的是,在野外,相机的预览屏幕显示为黑屏。我已经确认,摄像头在罗技的应用程序和微软的Expression应用程序中都显示了一个提要。已安装Windows Media Player和DirectX 11。问题似乎在于预览窗口的创建中有人没有工作

// create the camera feed with just a video
currentJob = new LiveJob();
currentDeviceSource = currentJob.AddDeviceSource(currentVideoDevice, null);

System.Drawing.Size size = new System.Drawing.Size(250, 275);
currentDeviceSource.PickBestVideoFormat(size, (long)15);

SourceProperties sp = currentDeviceSource.SourcePropertiesSnapshot();
pnlCameraPreview.Size = new System.Drawing.Size(sp.Size.Width, sp.Size.Height);

currentJob.OutputFormat.VideoProfile.Size = new System.Drawing.Size(sp.Size.Width, sp.Size.Height);

// attach to the preview panel
currentDeviceSource.PreviewWindow = new PreviewWindow(new HandleRef(pnlCameraPreview, hwndPreviewPanel));
currentJob.ActivateSource(currentDeviceSource);


讨论中的面板(pnlCameraPreview)是wpf内部托管的windows窗体面板。任何关于为什么这不起作用的想法都将不胜感激

我们在生产中使用这种方法。它一直在工作,但当没有安装本机视频卡驱动程序时,问题可以在新的盒子上重现。也许问题的根源在于在面板上绘制视频。顺便说一句,虽然问题与代码类似的张贴一个是观察到Skype和编码器的预览显示网络摄像头图片的权利

预览面板开始显示图片,在安装所有适配器的驱动程序后,代码开始正常工作