• 大小: 1.61MB
    文件类型: .rar
    金币: 2
    下载: 1 次
    发布日期: 2021-04-05
  • 语言: 其他
  • 标签: halcon  hikvision  

资源简介

用halcon控制海康威视相机进行采图并且将其采集到的图片转换为hobject格式供halcon分析

资源截图

代码片段和文件信息

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using HalconDotNet;
using MvCamCtrl.NET;
using System.Runtime.InteropServices;
using System.Threading;
using System.IO;

using System.Drawing.Imaging;
using System.Diagnostics;
using System.Collections.objectModel;

namespace Raw2Himage_CSharp
{

    public partial class Form1 : Form
    {
        MyCamera.MV_CC_DEVICE_INFO_LIST m_pDeviceList;
        private MyCamera m_pMyCamera;
        bool m_bGrabbing;
        HWindow m_Window;
        byte[] m_pDataForRed = new byte[20*1024*1024];
        byte[] m_pDataForGreen = new byte[20*1024*1024];
        byte[] m_pDataForBlue = new byte[20*1024*1024];
        uint g_nPayloadSize = 0;



        public Form1()
        {
            InitializeComponent();
            m_pDeviceList = new MyCamera.MV_CC_DEVICE_INFO_LIST();
            m_pMyCamera = new MyCamera();
            m_bGrabbing = false;
            m_Window = new HWindow();
            DisplayWindowsInitial();
            DeviceListAcq();
            AllocConsole();
        }
/********************************************************************************************/



        private void DisplayWindowsInitial()
        {
            // ch: 定义显示的起点和宽高 || en: Definition the width and height of the display window
            HTuple hWindowRow hWindowColumn hWindowWidth hWindowHeight;

            // ch: 设置显示窗口的起点和宽高 || en: Set the width and height of the display window
            hWindowRow = 0;
            hWindowColumn = 0;
            hWindowWidth = pictureBox1.Width;
            hWindowHeight = pictureBox1.Height;


            try
            {
                HTuple hWindowID = (HTuple)pictureBox1.Handle;
                m_Window.OpenWindow(hWindowRow hWindowColumn hWindowWidth hWindowHeight hWindowID “visible“ ““);
            }
            catch (System.Exception ex)
            {
                MessageBox.Show(ex.ToString());
                return;
            }

        }
        private void bnEnum_Click(object sender EventArgs e)
        {
            DeviceListAcq();
        }

        private void DeviceListAcq()
        {
            int nRet;
            // ch:创建设备列表 || en: Create device list
            System.GC.Collect();
            cbDeviceList.Items.Clear();
            nRet = MyCamera.MV_CC_EnumDevices_NET(MyCamera.MV_GIGE_DEVICE | MyCamera.MV_USB_DEVICE ref m_pDeviceList);
            if (MyCamera.MV_OK != nRet)
            {
                MessageBox.Show(“Enum Devices Fail“);
                return;
            }

            // ch:在窗体列表中显示设备名 || Display the device‘name on window‘s list
            for (int i = 0; i < m_pDeviceList.nDeviceNum; i++)
            {
                MyCamera.MV_CC_DEVICE_INFO device = (MyCamera.MV_CC_D

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

    ..A..H.     26624  2019-05-29 18:22  halcon 转换时间Raw2Himage_CSharp0\.vs\Raw2Himage_CSharp\v14\.suo

     文件         69  2019-04-15 19:47  halcon 转换时间Raw2Himage_CSharp0\app.config

     文件      32256  2019-05-29 17:37  halcon 转换时间Raw2Himage_CSharp0\bin\Debug\app.publish\Raw2Himage_CSharp.exe

     文件       5632  2019-05-29 17:37  halcon 转换时间Raw2Himage_CSharp0\bin\Debug\en-US\Raw2Himage_CSharp.resources.dll

     文件    1279544  2014-11-15 02:27  halcon 转换时间Raw2Himage_CSharp0\bin\Debug\halcondotnet.dll

     文件    4074746  2014-11-15 01:07  halcon 转换时间Raw2Himage_CSharp0\bin\Debug\halcondotnet.xml

     文件      46080  2019-01-26 09:43  halcon 转换时间Raw2Himage_CSharp0\bin\Debug\MvCameraControl.Net.dll

     文件       1668  2019-05-29 17:37  halcon 转换时间Raw2Himage_CSharp0\bin\Debug\Raw2Himage_CSharp.application

     文件      32256  2019-05-29 17:37  halcon 转换时间Raw2Himage_CSharp0\bin\Debug\Raw2Himage_CSharp.exe

     文件         69  2019-04-15 19:47  halcon 转换时间Raw2Himage_CSharp0\bin\Debug\Raw2Himage_CSharp.exe.config

     文件       6356  2019-05-29 17:37  halcon 转换时间Raw2Himage_CSharp0\bin\Debug\Raw2Himage_CSharp.exe.manifest

     文件      34304  2019-05-29 17:37  halcon 转换时间Raw2Himage_CSharp0\bin\Debug\Raw2Himage_CSharp.pdb

     文件       1668  2019-05-29 17:37  halcon 转换时间Raw2Himage_CSharp0\bin\Debug\Raw2Himage_CSharp.vshost.application

     文件      21680  2019-05-29 18:22  halcon 转换时间Raw2Himage_CSharp0\bin\Debug\Raw2Himage_CSharp.vshost.exe

     文件         69  2019-04-15 19:47  halcon 转换时间Raw2Himage_CSharp0\bin\Debug\Raw2Himage_CSharp.vshost.exe.config

     文件       6356  2019-05-29 17:37  halcon 转换时间Raw2Himage_CSharp0\bin\Debug\Raw2Himage_CSharp.vshost.exe.manifest

     文件      32256  2019-05-06 15:52  halcon 转换时间Raw2Himage_CSharp0\bin\x64\Debug\app.publish\Raw2Himage_CSharp.exe

     文件       5120  2019-05-06 15:52  halcon 转换时间Raw2Himage_CSharp0\bin\x64\Debug\en-US\Raw2Himage_CSharp.resources.dll

     文件    1440400  2017-12-02 17:26  halcon 转换时间Raw2Himage_CSharp0\bin\x64\Debug\halcondotnet.dll

     文件    4433597  2017-12-02 02:17  halcon 转换时间Raw2Himage_CSharp0\bin\x64\Debug\halcondotnet.xml

     文件      46080  2019-01-26 09:43  halcon 转换时间Raw2Himage_CSharp0\bin\x64\Debug\MvCameraControl.Net.dll

     文件       1670  2019-05-06 15:52  halcon 转换时间Raw2Himage_CSharp0\bin\x64\Debug\Raw2Himage_CSharp.application

     文件      32256  2019-05-06 15:52  halcon 转换时间Raw2Himage_CSharp0\bin\x64\Debug\Raw2Himage_CSharp.exe

     文件         69  2019-04-15 19:47  halcon 转换时间Raw2Himage_CSharp0\bin\x64\Debug\Raw2Himage_CSharp.exe.config

     文件       6361  2019-05-06 15:52  halcon 转换时间Raw2Himage_CSharp0\bin\x64\Debug\Raw2Himage_CSharp.exe.manifest

     文件      36352  2019-05-06 15:52  halcon 转换时间Raw2Himage_CSharp0\bin\x64\Debug\Raw2Himage_CSharp.pdb

     文件       1670  2019-05-06 15:52  halcon 转换时间Raw2Himage_CSharp0\bin\x64\Debug\Raw2Himage_CSharp.vshost.application

     文件      21656  2019-05-06 15:52  halcon 转换时间Raw2Himage_CSharp0\bin\x64\Debug\Raw2Himage_CSharp.vshost.exe

     文件         69  2019-04-15 19:47  halcon 转换时间Raw2Himage_CSharp0\bin\x64\Debug\Raw2Himage_CSharp.vshost.exe.config

     文件       6361  2019-05-06 15:52  halcon 转换时间Raw2Himage_CSharp0\bin\x64\Debug\Raw2Himage_CSharp.vshost.exe.manifest

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

评论

共有 条评论