关于mfc程序中图像显示的问题

findingsunduo 2007-12-25 10:12:36
我用摄像头获得了一帧图像的数据,存储在一个unsigned char*型的缓冲区中,请问如何才能将这帧图像显示到picture control控件上啊?我指的不是一个bmp文件,而是一块缓冲区中的图像数据。而且处理时不要存成文件。
请教大家了!请不吝赐教!在线等
...全文
86 8 打赏 收藏 转发到动态 举报
写回复
用AI写文章
8 条回复
切换为时间正序
请发表友善的回复…
发表回复
findingsunduo 2007-12-28
  • 打赏
  • 举报
回复
CreateBitmap返回值是true 可就是显示不出来
唉...有没有哪位编写过类似的啊
findingsunduo 2007-12-28
  • 打赏
  • 举报
回复
谢谢 我看看
michaelru 2007-12-27
  • 打赏
  • 举报
回复
Remarks
For a color bitmap, either the nPlanes or nBitcount parameter should be set to one. If both parameters are set to one, CreateBitmap creates a monochrome bitmap.

Although you cannot directly select a bitmap for a display device, you can select it as the current bitmap for a memory device context by using CDC::SelectObject and copying to any compatible device context by using the CDC::BitBlt function.

michaelru 2007-12-27
  • 打赏
  • 举报
回复
检查bitmap.CreateBitmap(320,240,1,24,display); 返回值是否成功
飞天舞 2007-12-26
  • 打赏
  • 举报
回复
创建内存位图,用CDC画到控件上!
michaelru 2007-12-26
  • 打赏
  • 举报
回复
CBitmap::CreateBitmap
michaelru 2007-12-26
  • 打赏
  • 举报
回复
BOOL CreateBitmap (
int nWidth,
int nHeight,
UINT nPlanes,
UINT nBitcount,
const void* lpBits );


Parameters
nWidth
Specifies the width, in pixels, of the bitmap.
nHeight
Specifies the height, in pixels, of the bitmap.
nPlanes
Specifies the number of color planes in the bitmap.
nBitcount
Specifies the number of color bits per display pixel.
lpBits
Points to a short-integer array that contains the initial bitmap bit values. If it is NULL, the new bitmap is left uninitialized.
Return Value
Nonzero if it is successful; otherwise, it is zero.

findingsunduo 2007-12-26
  • 打赏
  • 举报
回复
有没有示例的代码啊唉
谢谢大家了
我现在写了一个就是不行
bitmap.CreateBitmap(320,240,1,24,display);

CWnd* pWnd=GetDlgItem(IDC_REMOTEVIDEO);
pWnd->UpdateWindow();

CDC* pDC=pWnd->GetDC();
CDC bitmapDC;

bitmapDC.CreateCompatibleDC(pDC);
CBitmap* pOldBitmap = bitmapDC.SelectObject(&bitmap);
pDC->BitBlt(0,0,320,240,&bitmapDC,0,0,SRCCOPY);
bitmapDC.SelectObject(pOldBitmap);
bitmapDC.DeleteDC();
bitmap.DeleteObject();
问题出在哪了

2,586

社区成员

发帖
与我相关
我的任务
社区描述
VC/MFC 资源
社区管理员
  • 资源
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧