• 大小: 3.56MB
    文件类型: .rar
    金币: 2
    下载: 1 次
    发布日期: 2023-11-20
  • 语言: 其他
  • 标签: HIKVISION  

资源简介

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\n“  “The Pointer of pstMVDevInfoList is NULL!“);
        return false;
    }
    if (pstMVDevInfo->nTlayerType == MV_GIGE_DEVICE)
    {
        printf(“%s %x\n“  “nCurrentIp:“  pstMVDevInfo->SpecialInfo.stGigEInfo.nCurrentIp);                   //当前IP
        printf(“%s %s\n\n“  “chUserDefinedName:“  pstMVDevInfo->SpecialInfo.stGigEInfo.chUserDefinedName);     //用户定义名
    }
    else if (pstMVDevInfo->nTlayerType == MV_USB_DEVICE)
    {
        printf(“UserDefinedName:%s\n\n“ pstMVDevInfo->SpecialInfo.stUsb3VInfo.chUserDefinedName);
    }
    else
    {
        printf(“Not support.\n“);
    }
    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]\n“ nRet);
        return -1;
    }
    unsigned int nIndex = 0;
    if (stDeviceList.nDeviceNum > 0)
    {
        for (int i = 0; i < stDeviceList.nDeviceNum; i++)
        {
            printf(“[device %d]:\n“ i);
            MV_CC_DEVICE_INFO* pDeviceInfo = stDeviceList.pDeviceInfo[i];
            if (NULL == pDeviceInfo)
            {
                break;
            }
            PrintDeviceInfo(pDeviceInfo);
        }
    }
    else
    {
        printf(“Find No GIGE Devices!\n“);
        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]\n“ nRet);
        return -1;
    }

    // 3.打开设备
    nRet = MV_CC_OpenDevice(handle);
    if (MV_OK != nRet)
    {
        printf(“MV_CC_OpenDevice fail! nRet [%x]\n“ 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]\n“ 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例程\build-LB_Grab-Desktop_Qt_5_3_MinGW_32bit-Debug\001.bmp

     文件     481280  2019-02-19 20:26  QT例程\build-LB_Grab-Desktop_Qt_5_3_MinGW_32bit-Debug\debug\avutil-54.dll

     文件      35328  2019-02-19 20:26  QT例程\build-LB_Grab-Desktop_Qt_5_3_MinGW_32bit-Debug\debug\CLAllSerial_MD_VC120_v3_0.dll

     文件     113664  2019-02-19 20:26  QT例程\build-LB_Grab-Desktop_Qt_5_3_MinGW_32bit-Debug\debug\CLProtocol_MD_VC120_v3_0.dll

     文件     106496  2019-02-19 20:26  QT例程\build-LB_Grab-Desktop_Qt_5_3_MinGW_32bit-Debug\debug\CLSerCOM.dll

     文件      82432  2019-02-19 20:26  QT例程\build-LB_Grab-Desktop_Qt_5_3_MinGW_32bit-Debug\debug\GCbase_MD_VC120_v3_0.dll

     文件     782848  2019-02-19 20:26  QT例程\build-LB_Grab-Desktop_Qt_5_3_MinGW_32bit-Debug\debug\GenApi_MD_VC120_v3_0.dll

     文件      75776  2019-02-19 20:26  QT例程\build-LB_Grab-Desktop_Qt_5_3_MinGW_32bit-Debug\debug\GenCP_MD_VC120_v3_0.dll

     文件    1393664  2019-02-19 20:26  QT例程\build-LB_Grab-Desktop_Qt_5_3_MinGW_32bit-Debug\debug\ImageProcess.dll

     文件      59505  2019-02-19 20:26  QT例程\build-LB_Grab-Desktop_Qt_5_3_MinGW_32bit-Debug\debug\LB_Grab.exe

     文件     117262  2019-02-19 20:26  QT例程\build-LB_Grab-Desktop_Qt_5_3_MinGW_32bit-Debug\debug\libgcc_s_dw2-1.dll

     文件     970766  2019-02-19 20:26  QT例程\build-LB_Grab-Desktop_Qt_5_3_MinGW_32bit-Debug\debug\libstdc++-6.dll

     文件      48640  2019-02-19 20:26  QT例程\build-LB_Grab-Desktop_Qt_5_3_MinGW_32bit-Debug\debug\libwinpthread-1.dll

     文件     195584  2019-02-19 20:26  QT例程\build-LB_Grab-Desktop_Qt_5_3_MinGW_32bit-Debug\debug\log4cpp_MD_VC120_v3_0.dll

     文件      41472  2019-02-19 20:26  QT例程\build-LB_Grab-Desktop_Qt_5_3_MinGW_32bit-Debug\debug\Log_MD_VC120_v3_0.dll

     文件      33792  2019-02-19 20:26  QT例程\build-LB_Grab-Desktop_Qt_5_3_MinGW_32bit-Debug\debug\MathParser_MD_VC120_v3_0.dll

     文件        524  2019-02-19 20:26  QT例程\build-LB_Grab-Desktop_Qt_5_3_MinGW_32bit-Debug\debug\Microsoft.VC90.CRT.manifest

     文件        532  2019-02-19 20:26  QT例程\build-LB_Grab-Desktop_Qt_5_3_MinGW_32bit-Debug\debug\Microsoft.VC90.DebugCRT.manifest

     文件     224768  2019-02-19 20:26  QT例程\build-LB_Grab-Desktop_Qt_5_3_MinGW_32bit-Debug\debug\msvcm90.dll

     文件     455328  2019-02-19 20:26  QT例程\build-LB_Grab-Desktop_Qt_5_3_MinGW_32bit-Debug\debug\msvcp120.dll

     文件     568832  2019-02-19 20:26  QT例程\build-LB_Grab-Desktop_Qt_5_3_MinGW_32bit-Debug\debug\msvcp90.dll

     文件     970912  2019-02-19 20:26  QT例程\build-LB_Grab-Desktop_Qt_5_3_MinGW_32bit-Debug\debug\msvcr120.dll

     文件     653136  2019-02-19 20:26  QT例程\build-LB_Grab-Desktop_Qt_5_3_MinGW_32bit-Debug\debug\msvcr90.dll

     文件     282112  2019-02-19 20:26  QT例程\build-LB_Grab-Desktop_Qt_5_3_MinGW_32bit-Debug\debug\MvCameraControl.dll

     文件      23895  2019-02-19 20:26  QT例程\build-LB_Grab-Desktop_Qt_5_3_MinGW_32bit-Debug\debug\MvCameraControl.exp

     文件     223232  2019-02-19 20:26  QT例程\build-LB_Grab-Desktop_Qt_5_3_MinGW_32bit-Debug\debug\MVGigEVisionSDK.dll

     文件      83968  2019-02-19 20:26  QT例程\build-LB_Grab-Desktop_Qt_5_3_MinGW_32bit-Debug\debug\MvRender.dll

     文件      69632  2019-02-19 20:26  QT例程\build-LB_Grab-Desktop_Qt_5_3_MinGW_32bit-Debug\debug\MvSdkExport.dll

     文件        622  2019-02-19 20:26  QT例程\build-LB_Grab-Desktop_Qt_5_3_MinGW_32bit-Debug\debug\MvSdkLog\CamCtrl_00.log

     文件       3384  2019-02-19 20:26  QT例程\build-LB_Grab-Desktop_Qt_5_3_MinGW_32bit-Debug\debug\MvSdkLog\GigE_00.log

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

评论

共有 条评论