我用摄像头获得了一帧图像的数据,存储在一个unsigned char*型的缓冲区中,请问如何才能将这帧图像显示到picture control控件上啊?我指的不是一个bmp文件,而是一块缓冲区中的图像数据。而且处理时不要存成文件。
请教大家了!请不吝赐教!在线等

解决方案 »

  1.   

    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.
      

  2.   

    创建内存位图,用CDC画到控件上!
      

  3.   

    有没有示例的代码啊唉
    谢谢大家了
    我现在写了一个就是不行
             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();
    问题出在哪了
      

  4.   

    检查bitmap.CreateBitmap(320,240,1,24,display); 返回值是否成功
      

  5.   

    Res
    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.
      

  6.   

    CreateBitmap返回值是true 可就是显示不出来
    唉...有没有哪位编写过类似的啊