智能终端定制开发 ad
MTK/瑞芯微/高通-Android,智能模块/智能终端方案商

深度定制各类智能终端和智能硬件产品,提供硬件选型咨询、参考设计、元器件推荐、驱动开发、行业模块集成、操作系统定制与算法集成等软硬件定制服务。
contact.aspx

Android核心板产品覆盖2G、3G、4G通讯,双核、四核、八核CPU,可选的平台有MTK6580、MTK6737、MTK6750等,Android版本有5.1 6.0 7.0等。
contact.aspx

可广泛应用于低端智能POS、安防监控、车载设备、低端智能机器人、智能家居、智能硬件、工业智能手持设备、低端智能对讲设备、低端警务或执法设备、智能穿戴、贩卖机、物流柜、智能门禁系统等行业和设备。
contact.aspx

可提供以太网转串口透传,WIFI转串口透传,蓝牙转串口透传,CAN总线模拟量控制输出模块等。
contact.aspx

带3G或4G通讯功能,运行android系统,有多个串口,可以外挂各种模块:条码扫描、RFID、指纹识别、身份证识别、磁条卡、ID卡、GPS/北斗模块等。
contact.aspx

具有4G通讯功能,多个RS232或RS485接口,以太网接口,USB接口,CAN接口,多个AD输入。基于Android系统智能平台,方便APP应用开发。器件严格选型,运行稳定,质量可靠。
contact.aspx

把avi转化成bitmap位图
[VC 编程] 2008-05-29

 

// WriteDIB - Writes a DIB to file
// Returns - TRUE on success
// szFile - Name of file to write to
// hDIB - Handle of the DIB
BOOL WriteDIB( CString strBmpDir, HANDLE hDIB,int iFrame)
{

 
    CString FileName;
    FileName.Format("Frame-%05d.bmp", iFrame);
 CString strtemp = strBmpDir;
 strtemp += "";
 strtemp += FileName;


 BITMAPFILEHEADER hdr;
 LPBITMAPINFOHEADER lpbi;
 
 if (!hDIB)
  return FALSE;
 
 CFile file;
 if( !file.Open( strtemp, CFile::modeWrite|CFile::modeCreate) )
  return FALSE;
 
 lpbi = (LPBITMAPINFOHEADER)hDIB;
 
 int nColors = 1 << lpbi->biBitCount;
 
 // Fill in the fields of the file header
 hdr.bfType = ((WORD) (M << 8) |B); // is always "BM"
 hdr.bfSize = GlobalSize (hDIB) + sizeof( hdr );
 hdr.bfReserved1 = 0;
 hdr.bfReserved2 = 0;
 hdr.bfOffBits = (DWORD) (sizeof( hdr ) + lpbi->biSize +
  nColors * sizeof(RGBQUAD));
 
 // Write the file header
 file.Write( &hdr, sizeof(hdr) );
 
 // Write the DIB header and the bits
 file.Write( lpbi, GlobalSize(hDIB) );
 
 return TRUE;
}

 

BOOL  CDlgSeter3::ExtractAVIFrames(CString szFileName, CString strBmpDir)
{

    AVIFileInit();

    PAVIFILE avi;
    int res=AVIFileOpen(&avi, szFileName, OF_READ, NULL);

    if (res!=AVIERR_OK)
    {
        //an error occures
        if (avi!=NULL)
            AVIFileRelease(avi);
       
        return FALSE;
    }

    AVIFILEINFO avi_info;
    AVIFileInfo(avi, &avi_info, sizeof(AVIFILEINFO));

    CString szFileInfo;
    szFileInfo.Format("Dimention: %dx%d\n"
                      "Length: %d frames\n"
                      "Max bytes per second: %d\n"
                      "Samples per second: %d\n"
                      "Streams: %d\n"
                      "File Type: %d", avi_info.dwWidth,
                            avi_info.dwHeight,
                            avi_info.dwLength,
                            avi_info.dwMaxBytesPerSec,
                            (DWORD) (avi_info.dwRate / avi_info.dwScale),
                            avi_info.dwStreams,
                            avi_info.szFileType);

    AfxMessageBox(szFileInfo, MB_ICONINFORMATION | MB_OK);

    PAVISTREAM pStream;
    res=AVIFileGetStream(avi, &pStream, streamtypeVIDEO /*video stream*/,
                                               0 /*first stream*/);

    if (res!=AVIERR_OK)
    {
        if (pStream!=NULL)
            AVIStreamRelease(pStream);

        AVIFileExit();
        return FALSE;
    }

    //do some task with the stream
    int iNumFrames;
    int iFirstFrame;

    iFirstFrame=AVIStreamStart(pStream);
    if (iFirstFrame==-1)
    {
        //Error getteing the frame inside the stream

        if (pStream!=NULL)
            AVIStreamRelease(pStream);

        AVIFileExit();
        return FALSE;
    }

    iNumFrames=AVIStreamLength(pStream);
    if (iNumFrames==-1)
    {
        //Error getteing the number of frames inside the stream
       
        if (pStream!=NULL)
            AVIStreamRelease(pStream);
       
        AVIFileExit();
        return FALSE;
    }

    //getting bitmap from frame
    BITMAPINFOHEADER bih;
    ZeroMemory(&bih, sizeof(BITMAPINFOHEADER));

    bih.biBitCount=24;    //24 bit per pixel
    bih.biClrImportant=0;
    bih.biClrUsed = 0;
    bih.biCompression = BI_RGB;
    bih.biPlanes = 1;
    bih.biSize = 40;
    bih.biXPelsPerMeter = 0;
    bih.biYPelsPerMeter = 0;
    //calculate total size of RGBQUAD scanlines (DWORD aligned)
    bih.biSizeImage = (((bih.biWidth * 3) + 3) & 0xFFFC) * bih.biHeight ;

    PGETFRAME pFrame;
    pFrame=AVIStreamGetFrameOpen(pStream,
           NULL/*(BITMAPINFOHEADER*) AVIGETFRAMEF_BESTDISPLAYFMT*/ /*&bih*/);
   
    //Get the first frame
    int index=0;
    for (int i=iFirstFrame; i    {
        index= i-iFirstFrame;

        BYTE* pDIB = (BYTE*) AVIStreamGetFrame(pFrame, index);
       
        //CreateFromPackedDIBPointer(pDIB, index,strBmpDir);

  WriteDIB(  strBmpDir,pDIB,i);
    }

    AVIStreamGetFrameClose(pFrame);

    //close the stream after finishing the task
    if (pStream!=NULL)
        AVIStreamRelease(pStream);

    AVIFileExit();

    return TRUE;
}

[VC 编程添加评论 | 评论/阅读(0/879)
评论
昵称
主页
内容
递交


Copyright @ 我的开发笔记     2008 - 2017         粤ICP备19155526号-1