• 大小: 488KB
    文件类型: .rar
    金币: 1
    下载: 0 次
    发布日期: 2021-05-15
  • 语言: C#
  • 标签: HIKVISION  

资源简介

HIKVISION工业相机通过Halcon二次开发的VC和C#实例及说明

资源截图

代码片段和文件信息

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();
        }
/********************************************************************************************/



        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_DEVICE_INFO)Marshal.PtrToStructure

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

     文件        120  2018-12-20 09:23  Halcon的VC和C#实例及说明\Halcon\C#\Raw2Himage_CSharp\app.config

     文件      26475  2018-12-20 09:23  Halcon的VC和C#实例及说明\Halcon\C#\Raw2Himage_CSharp\Form1.cs

     文件      11399  2018-12-20 09:23  Halcon的VC和C#实例及说明\Halcon\C#\Raw2Himage_CSharp\Form1.Designer.cs

     文件       7736  2018-12-20 09:23  Halcon的VC和C#实例及说明\Halcon\C#\Raw2Himage_CSharp\Form1.en-US.resx

     文件      20109  2018-12-20 09:23  Halcon的VC和C#实例及说明\Halcon\C#\Raw2Himage_CSharp\Form1.resx

     文件        509  2018-12-20 09:23  Halcon的VC和C#实例及说明\Halcon\C#\Raw2Himage_CSharp\Program.cs

     文件       1498  2018-12-20 09:23  Halcon的VC和C#实例及说明\Halcon\C#\Raw2Himage_CSharp\Properties\app.manifest

     文件       1464  2018-12-20 09:23  Halcon的VC和C#实例及说明\Halcon\C#\Raw2Himage_CSharp\Properties\AssemblyInfo.cs

     文件       2863  2018-12-20 09:23  Halcon的VC和C#实例及说明\Halcon\C#\Raw2Himage_CSharp\Properties\Resources.Designer.cs

     文件       5612  2018-12-20 09:23  Halcon的VC和C#实例及说明\Halcon\C#\Raw2Himage_CSharp\Properties\Resources.resx

     文件       1102  2018-12-20 09:23  Halcon的VC和C#实例及说明\Halcon\C#\Raw2Himage_CSharp\Properties\Settings.Designer.cs

     文件        249  2018-12-20 09:23  Halcon的VC和C#实例及说明\Halcon\C#\Raw2Himage_CSharp\Properties\Settings.settings

     文件       8409  2018-12-20 09:23  Halcon的VC和C#实例及说明\Halcon\C#\Raw2Himage_CSharp\Raw2Himage_CSharp.csproj

     文件       1649  2018-12-20 09:23  Halcon的VC和C#实例及说明\Halcon\C#\Samples_Halcon.sln

     文件       1770  2018-12-20 09:24  Halcon的VC和C#实例及说明\Halcon\VC\HalconGrabImage\HalconGrabImage.cpp

     文件        499  2018-12-20 09:24  Halcon的VC和C#实例及说明\Halcon\VC\HalconGrabImage\HalconGrabImage.h

     文件      10277  2018-12-20 09:24  Halcon的VC和C#实例及说明\Halcon\VC\HalconGrabImage\HalconGrabImage.rc

     文件      31323  2018-12-20 09:24  Halcon的VC和C#实例及说明\Halcon\VC\HalconGrabImage\HalconGrabImageDlg.cpp

     文件       4548  2018-12-20 09:24  Halcon的VC和C#实例及说明\Halcon\VC\HalconGrabImage\HalconGrabImageDlg.h

     文件      11040  2018-12-20 09:24  Halcon的VC和C#实例及说明\Halcon\VC\HalconGrabImage\HalconGrabImage_10.vcproj

     文件      11051  2018-12-20 09:24  Halcon的VC和C#实例及说明\Halcon\VC\HalconGrabImage\HalconGrabImage_11-13.vcproj

     文件      67777  2018-12-20 09:24  Halcon的VC和C#实例及说明\Halcon\VC\HalconGrabImage\res\HalconGrabImage.ico

     文件        371  2018-12-20 09:24  Halcon的VC和C#实例及说明\Halcon\VC\HalconGrabImage\res\HalconGrabImage.rc2

     文件       1561  2018-12-20 09:24  Halcon的VC和C#实例及说明\Halcon\VC\HalconGrabImage\resource.h

     文件        148  2018-12-20 09:24  Halcon的VC和C#实例及说明\Halcon\VC\HalconGrabImage\stdafx.cpp

     文件       1854  2018-12-20 09:24  Halcon的VC和C#实例及说明\Halcon\VC\HalconGrabImage\stdafx.h

     文件       1030  2018-12-20 09:24  Halcon的VC和C#实例及说明\Halcon\VC\HalconGrabImage\targetver.h

     文件       9521  2018-12-20 09:24  Halcon的VC和C#实例及说明\Halcon\VC\Raw2Himage_C\ConvertPixel.cpp

     文件       4698  2018-12-20 09:24  Halcon的VC和C#实例及说明\Halcon\VC\Raw2Himage_C\ConvertPixel.h

     文件       9528  2018-12-20 09:24  Halcon的VC和C#实例及说明\Halcon\VC\Raw2Himage_C\MyCamera.cpp

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

评论

共有 条评论