W
wzisme
Unregistered / Unconfirmed
GUEST, unregistred user!
我用vfw方式通过usb摄像头preview时为什么窗口那么迟钝!
为什么微软的directshow就没有这个问题呢?
源程序如下:
m_hCapWnd:=0;
try
m_hCapWnd:=capCreateCaptureWindow('',WS_CHILD or WS_VISIBLE or WS_EX_CLIENTEDGE or WS_EX_DLGMODALFRAME,0,0,previewform.panel1.width,previewform.panel1.Height,previewform.panel1.handle,0);
if m_hCapWnd=0 then
exit;
if(capDriverConnect(m_hCapWnd,0)) then
begin
capPreviewRate(m_hCapWnd,26);
//设置帧率为26
capPreview(m_hCapWnd,True);
// preview方式显示
dwSize:=capGetVideoFormatSize(m_hCapWnd);
capGetVideoFormat(m_hCapWnd,@setBmp, dwSize);
setBmp.bmiHeader.biWidth:=320;
setBmp.bmiHeader.biHeight:=240;
capSetVideoFormat(m_hCapWnd,@setBmp,dwSize);
capSetCallbackOnFrame(m_hCapWnd,@myProc);
result:=true;
end;
except
showmessage('连接摄像头失败!');
end;
为什么微软的directshow就没有这个问题呢?
源程序如下:
m_hCapWnd:=0;
try
m_hCapWnd:=capCreateCaptureWindow('',WS_CHILD or WS_VISIBLE or WS_EX_CLIENTEDGE or WS_EX_DLGMODALFRAME,0,0,previewform.panel1.width,previewform.panel1.Height,previewform.panel1.handle,0);
if m_hCapWnd=0 then
exit;
if(capDriverConnect(m_hCapWnd,0)) then
begin
capPreviewRate(m_hCapWnd,26);
//设置帧率为26
capPreview(m_hCapWnd,True);
// preview方式显示
dwSize:=capGetVideoFormatSize(m_hCapWnd);
capGetVideoFormat(m_hCapWnd,@setBmp, dwSize);
setBmp.bmiHeader.biWidth:=320;
setBmp.bmiHeader.biHeight:=240;
capSetVideoFormat(m_hCapWnd,@setBmp,dwSize);
capSetCallbackOnFrame(m_hCapWnd,@myProc);
result:=true;
end;
except
showmessage('连接摄像头失败!');
end;