如何显示摄像头摄取的图像 本帖最后由 xianshuixx 于 2010-08-30 15:58:52 编辑 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 你确定你的摄像头采集到的图片是编码为bmp格式的吗? 哦,好的。。因为如果我新建一个文档,肯定有一个激活的view,那么,用getactiveframe和getactiveview就一定有结果,而且能够正常显示,所以我认为问题一定出在前面,而不是摄像头的配置方面请看: CWinApp* pWinApp = AfxGetApp(); POSITION FirstDocTemplatePos = pWinApp->GetFirstDocTemplatePosition(); CDocTemplate* pNextDocTemplate = pWinApp->GetNextDocTemplate(FirstDocTemplatePos); ActivateFrame(); CDocument* pNewDoc = pNextDocTemplate->CreateNewDocument(); CCreateContext pContext; pContext.m_pNewViewClass = RUNTIME_CLASS(CMyView); pContext.m_pCurrentDoc = pNewDoc; pContext.m_pNewDocTemplate = pNextDocTemplate; pContext.m_pLastView = NULL; pContext.m_pCurrentFrame = NULL;// (CFrameWnd *)AfxGetMainWnd(); CWnd* pView = CreateView(&pContext); SetActiveView((CView*) pView); CDC *pDC = pView->GetDC(); //得到VIEW的DC //同时将原始数据进行上下翻转 ConvertBayer2Rgb(CAM_m_pImageBuffer,CAM_m_pRawBuffer,CAM_Width,CAM_Height,CAM_ConvertType,CAM_m_pLutR,CAM_m_pLutG,CAM_m_pLutB,true,CAM_Layout); // 摄像头的操作必须 BYTE *p = NULL, * q = NULL; SetStretchBltMode(pDC->GetSafeHdc(),COLORONCOLOR); //在视图客户区显示图像 StretchDIBits(pDC->GetSafeHdc(), 0, 0, CAM_Width, CAM_Height, 0, 0, CAM_Width, CAM_Height, CAM_m_pImageBuffer, //图像缓冲区 CAM_m_pBmpInfo, //BMP图像描述信息 DIB_RGB_COLORS, SRCCOPY ); pView->ReleaseDC(pDC); 关于数字图像处理中直方图均衡化一些疑问 超级强悍的恶意软件 怎么让菜单一直高亮显示不变灰? postthreadmessage 问题 ●求这样一个加密算法 不知道哪位知道 问一个类型定义的问题,请指教 XP的拖拽问题,奇怪中!!! 如何在程序运行时获得该程序的可执行文件的路径?请指教 dshow 回调播视频问题 UDP广播程序可以将信息发送给一台主机上不同端口的客户端吗 给一CWnd发消息,该CWnd没有处理,结果又抛出来形成消息死循环 谁能提供些SQLDMO的参考资料?
POSITION FirstDocTemplatePos = pWinApp->GetFirstDocTemplatePosition();
CDocTemplate* pNextDocTemplate = pWinApp->GetNextDocTemplate(FirstDocTemplatePos); ActivateFrame(); CDocument* pNewDoc = pNextDocTemplate->CreateNewDocument();
CCreateContext pContext;
pContext.m_pNewViewClass = RUNTIME_CLASS(CMyView);
pContext.m_pCurrentDoc = pNewDoc;
pContext.m_pNewDocTemplate = pNextDocTemplate;
pContext.m_pLastView = NULL;
pContext.m_pCurrentFrame = NULL;// (CFrameWnd *)AfxGetMainWnd();
CWnd* pView = CreateView(&pContext);
SetActiveView((CView*) pView);
CDC *pDC = pView->GetDC(); //得到VIEW的DC
//同时将原始数据进行上下翻转
ConvertBayer2Rgb(CAM_m_pImageBuffer,CAM_m_pRawBuffer,CAM_Width,CAM_Height,CAM_ConvertType,CAM_m_pLutR,CAM_m_pLutG,CAM_m_pLutB,true,CAM_Layout); // 摄像头的操作必须
BYTE *p = NULL, * q = NULL;
SetStretchBltMode(pDC->GetSafeHdc(),COLORONCOLOR);
//在视图客户区显示图像
StretchDIBits(pDC->GetSafeHdc(),
0,
0,
CAM_Width,
CAM_Height,
0,
0,
CAM_Width,
CAM_Height,
CAM_m_pImageBuffer, //图像缓冲区
CAM_m_pBmpInfo, //BMP图像描述信息
DIB_RGB_COLORS,
SRCCOPY
);
pView->ReleaseDC(pDC);