问题描述
您好,
我正在使用ICameraCaptureDeviceNative界面来填充直接X 2D纹理和摄像机的内容。 使用以下参数创建纹理,并通过调用ICameraCaptureDeviceNative :: SetDevice(...)初始化相机:
I am using the ICameraCaptureDeviceNative interface to fill a Direct X 2D texture with the contents of the video camera. The texture is created with the following parameters and the camera is initialized with a call to ICameraCaptureDeviceNative::SetDevice(...):
m_d3dDevice->CreateTexture2D(&CD3D11_TEXTURE2D_DESC(
DXGI_FORMAT_B8G8R8A8_UNORM,
1280, // Width
720, // Height
1, // MipLevels
1, // ArraySize
D3D11_BIND_SHADER_RESOURCE | D3D11_BIND_RENDER_TARGET),
nullptr,
&m_texture)
);
...
m_camera->SetDevice(m_d3dDevice.Get(), m_d3dContext.Get());
当调用方法 ICameraCaptureDeviceNative :: GetPreviewBufferTexture 时,要使用摄像机的内容填充纹理,会抛出以下异常:
When the method ICameraCaptureDeviceNative::GetPreviewBufferTexture is invoked, to fill the texture with the video camera's contents, the following exception is thrown:
相机预览设置为与纹理相同的宽度,高度和格式。 是否还需要一些其他初始化代码才能生效?
The camera preview is set to the same width, height and format as the texture. Is there some other initialization code that is needed for this to work?
谢谢
推荐答案
你解决了这个问题吗?
这篇关于GetPreviewBufferTexture抛出异常的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!