HIKVISION工业相机的SDK二次开发的QT


HIKVISION的gigE工业相机的二次开发,QT例程,win32环境。控制台输出。
资源截图
代码片段和文件信息
#include 
#include 
#include 
#include 
#include“MvCameraControl.h“

#define MAX_IMAGE_DATA_SIZE   (10*1280*2560)

bool PrintDeviceInfo(MV_CC_DEVICE_INFO* pstMVDevInfo)
{
    if (NULL == pstMVDevInfo)
    {
        printf(“%s
“  “The Pointer of pstMVDevInfoList is NULL!“);
        return false;
    }
    if (pstMVDevInfo->nTlayerType == MV_GIGE_DEVICE)
    {
        printf(“%s %x
“  “nCurrentIp:“  pstMVDevInfo->SpecialInfo.stGigEInfo.nCurrentIp);                   //当前IP
        printf(“%s %s

“  “chUserDefinedName:“  pstMVDevInfo->SpecialInfo.stGigEInfo.chUserDefinedName);     //用户定义名
    }
    else if (pstMVDevInfo->nTlayerType == MV_USB_DEVICE)
    {
        printf(“UserDefinedName:%s

“ pstMVDevInfo->SpecialInfo.stUsb3VInfo.chUserDefinedName);
    }
    else
    {
        printf(“Not support.
“);
    }
    return true;
}

int main()
{
    int nRet = MV_OK;

    void* handle = NULL;

    MV_CC_DEVICE_INFO_LIST stDeviceList;
    memset(&stDeviceList 0 sizeof(MV_CC_DEVICE_INFO_LIST));

    // 1. 枚举设备
    nRet = MV_CC_EnumDevices(MV_GIGE_DEVICE | MV_USB_DEVICE &stDeviceList);
    if (MV_OK != nRet)
    {
        printf(“MV_CC_EnumDevices fail! nRet [%x]
“ nRet);
        return -1;
    }
    unsigned int nIndex = 0;
    if (stDeviceList.nDeviceNum > 0)
    {
        for (int i = 0; i < stDeviceList.nDeviceNum; i++)
        {
            printf(“[device %d]:
“ i);
            MV_CC_DEVICE_INFO* pDeviceInfo = stDeviceList.pDeviceInfo[i];
            if (NULL == pDeviceInfo)
            {
                break;
            }
            PrintDeviceInfo(pDeviceInfo);
        }
    }
    else
    {
        printf(“Find No GIGE Devices!
“);
        return -1;
    }

    scanf(“%d“ &nIndex);

    // 2. 选择设备并创建句柄
    nRet = MV_CC_CreateHandle(&handle stDeviceList.pDeviceInfo[nIndex]);
    if (MV_OK != nRet)
    {
        printf(“MV_CC_CreateHandle fail! nRet [%x]
“ nRet);
        return -1;
    }

    // 3.打开设备
    nRet = MV_CC_OpenDevice(handle);
    if (MV_OK != nRet)
    {
        printf(“MV_CC_OpenDevice fail! nRet [%x]
“ nRet);
        return -1;
    }
    MV_CC_SetPixelFormat(handle PixelType_Gvsp_Mono8);

    // 4.开始抓图
    nRet = MV_CC_StartGrabbing(handle);
    if (MV_OK != nRet)
    {
        printf(“MV_CC_StartGrabbing fail! nRet [%x]
“ nRet);
        return -1;
    }

    // 5.获取10张图
    MV_frame_OUT_INFO stImageInfo = {0};
    int nLength = sizeof(MV_frame_OUT_INFO);
    memset(&stImageInfo 0 sizeof(MV_frame_OUT_INFO));
    unsigned char * pData = (unsigned char *)malloc(sizeof(unsigned char) * MAX_IMAGE_DATA_SIZE);
    unsigned int nDataSize = MAX_IMAGE_DATA_SIZE;

    unsigned int nImageNum = 10;

    unsigned char* pImage = (unsigned char*)malloc(MAX_IMAGE_DATA_SIZE);
    while(nImageNum)
    {
        nRet = MV_CC_GetOneframe(handle pData nDataSize &stImageInfo

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----

     文件          0  2019-02-19 20:26  QT例程uild-LB_Grab-Desktop_Qt_5_3_MinGW_32bit-Debug01.bmp

     文件     481280  2019-02-19 20:26  QT例程uild-LB_Grab-Desktop_Qt_5_3_MinGW_32bit-Debugdebugavutil-54.dll

     文件      35328  2019-02-19 20:26  QT例程uild-LB_Grab-Desktop_Qt_5_3_MinGW_32bit-DebugdebugCLAllSerial_MD_VC120_v3_0.dll

     文件     113664  2019-02-19 20:26  QT例程uild-LB_Grab-Desktop_Qt_5_3_MinGW_32bit-DebugdebugCLProtocol_MD_VC120_v3_0.dll

     文件     106496  2019-02-19 20:26  QT例程uild-LB_Grab-Desktop_Qt_5_3_MinGW_32bit-DebugdebugCLSerCOM.dll

     文件      82432  2019-02-19 20:26  QT例程uild-LB_Grab-Desktop_Qt_5_3_MinGW_32bit-DebugdebugGCbase_MD_VC120_v3_0.dll

     文件     782848  2019-02-19 20:26  QT例程uild-LB_Grab-Desktop_Qt_5_3_MinGW_32bit-DebugdebugGenApi_MD_VC120_v3_0.dll

     文件      75776  2019-02-19 20:26  QT例程uild-LB_Grab-Desktop_Qt_5_3_MinGW_32bit-DebugdebugGenCP_MD_VC120_v3_0.dll

     文件    1393664  2019-02-19 20:26  QT例程uild-LB_Grab-Desktop_Qt_5_3_MinGW_32bit-DebugdebugImageProcess.dll

     文件      59505  2019-02-19 20:26  QT例程uild-LB_Grab-Desktop_Qt_5_3_MinGW_32bit-DebugdebugLB_Grab.exe

     文件     117262  2019-02-19 20:26  QT例程uild-LB_Grab-Desktop_Qt_5_3_MinGW_32bit-Debugdebuglibgcc_s_dw2-1.dll

     文件     970766  2019-02-19 20:26  QT例程uild-LB_Grab-Desktop_Qt_5_3_MinGW_32bit-Debugdebuglibstdc++-6.dll

     文件      48640  2019-02-19 20:26  QT例程uild-LB_Grab-Desktop_Qt_5_3_MinGW_32bit-Debugdebuglibwinpthread-1.dll

     文件     195584  2019-02-19 20:26  QT例程uild-LB_Grab-Desktop_Qt_5_3_MinGW_32bit-Debugdebuglog4cpp_MD_VC120_v3_0.dll

     文件      41472  2019-02-19 20:26  QT例程uild-LB_Grab-Desktop_Qt_5_3_MinGW_32bit-DebugdebugLog_MD_VC120_v3_0.dll

     文件      33792  2019-02-19 20:26  QT例程uild-LB_Grab-Desktop_Qt_5_3_MinGW_32bit-DebugdebugMathParser_MD_VC120_v3_0.dll

     文件        524  2019-02-19 20:26  QT例程uild-LB_Grab-Desktop_Qt_5_3_MinGW_32bit-DebugdebugMicrosoft.VC90.CRT.manifest

     文件        532  2019-02-19 20:26  QT例程uild-LB_Grab-Desktop_Qt_5_3_MinGW_32bit-DebugdebugMicrosoft.VC90.DebugCRT.manifest

     文件     224768  2019-02-19 20:26  QT例程uild-LB_Grab-Desktop_Qt_5_3_MinGW_32bit-Debugdebugmsvcm90.dll

     文件     455328  2019-02-19 20:26  QT例程uild-LB_Grab-Desktop_Qt_5_3_MinGW_32bit-Debugdebugmsvcp120.dll

     文件     568832  2019-02-19 20:26  QT例程uild-LB_Grab-Desktop_Qt_5_3_MinGW_32bit-Debugdebugmsvcp90.dll

     文件     970912  2019-02-19 20:26  QT例程uild-LB_Grab-Desktop_Qt_5_3_MinGW_32bit-Debugdebugmsvcr120.dll

     文件     653136  2019-02-19 20:26  QT例程uild-LB_Grab-Desktop_Qt_5_3_MinGW_32bit-Debugdebugmsvcr90.dll

     文件     282112  2019-02-19 20:26  QT例程uild-LB_Grab-Desktop_Qt_5_3_MinGW_32bit-DebugdebugMvCameraControl.dll

     文件      23895  2019-02-19 20:26  QT例程uild-LB_Grab-Desktop_Qt_5_3_MinGW_32bit-DebugdebugMvCameraControl.exp

     文件     223232  2019-02-19 20:26  QT例程uild-LB_Grab-Desktop_Qt_5_3_MinGW_32bit-DebugdebugMVGigEVisionSDK.dll

     文件      83968  2019-02-19 20:26  QT例程uild-LB_Grab-Desktop_Qt_5_3_MinGW_32bit-DebugdebugMvRender.dll

     文件      69632  2019-02-19 20:26  QT例程uild-LB_Grab-Desktop_Qt_5_3_MinGW_32bit-DebugdebugMvSdkExport.dll

     文件        622  2019-02-19 20:26  QT例程uild-LB_Grab-Desktop_Qt_5_3_MinGW_32bit-DebugdebugMvSdkLogCamCtrl_00.log

     文件       3384  2019-02-19 20:26  QT例程uild-LB_Grab-Desktop_Qt_5_3_MinGW_32bit-DebugdebugMvSdkLogGigE_00.log

............此处省略36个文件信息

版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容, 请发送邮件举报,一经查实,本站将立刻删除。

发表评论

评论列表(条)