• 大小: 14.42MB
    文件类型: .zip
    金币: 1
    下载: 0 次
    发布日期: 2023-06-26
  • 语言: C#
  • 标签: C#  

资源简介

简单的做了一个C#开发巴斯勒SDK,主要就是单次取图,实时拍摄,参数设置,图像比例设置等

资源截图

代码片段和文件信息

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using Basler.Pylon;
using System.Diagnostics;
using System.Drawing.Imaging;

namespace WindowsFormsApplication1
{
    public partial class Form1 : Form
    {
        private Camera camera = null;
        private PixelDataConverter converter = new PixelDataConverter();
        private Stopwatch stopWatch = new Stopwatch();

        public Form1()
        {
            InitializeComponent();
        }

        private void Form1_Load(object sender EventArgs e)
        {
            UpdateDeviceList();
            button1.Enabled = true;
            button2.Enabled = false;
            button4.Enabled = false;
            button5.Enabled = false;
            button6.Enabled = false;
            button7.Enabled = false;
            pictureBox1.MouseWheel += new MouseEventHandler(pictureBox1_MouseWheel);
        }


        private void UpdateDeviceList()     //相机列表加载
        {
            try
            {
                // Ask the camera finder for a list of camera devices.
                List allCameras = CameraFinder.Enumerate();

                ListView.ListViewItemCollection items = deviceListView.Items;

                // Loop over all cameras found.
                foreach (ICameraInfo cameraInfo in allCameras)
                {
                    // Loop over all cameras in the list of cameras.
                    bool newitem = true;
                    foreach (ListViewItem item in items)
                    {
                        ICameraInfo tag = item.Tag as ICameraInfo;

                        // Is the camera found already in the list of cameras?
                        if (tag[CameraInfoKey.FullName] == cameraInfo[CameraInfoKey.FullName])
                        {
                            tag = cameraInfo;
                            newitem = false;
                            break;
                        }
                    }

                    // If the camera is not in the list add it to the list.
                    if (newitem)
                    {
                        // Create the item to display.
                        ListViewItem item = new ListViewItem(cameraInfo[CameraInfoKey.FriendlyName]);

                        // Create the tool tip text.
                        string toolTipText = ““;
                        foreach (KeyValuePair kvp in cameraInfo)
                        {
                            toolTipText += kvp.Key + “: “ + kvp.Value + “\n“;
                        }
                        item.ToolTipText = toolTipText;

                        // Store the camera info in the displayed item.
                        item.Tag = cameraInfo;

                     

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----
     目录           0  2019-01-04 12:20  巴斯勒sdk\
     目录           0  2019-01-04 12:20  巴斯勒sdk\WindowsFormsApplication1\
     目录           0  2019-01-10 10:06  巴斯勒sdk\WindowsFormsApplication1\WindowsFormsApplication1\
     文件        1316  2019-01-10 09:21  巴斯勒sdk\WindowsFormsApplication1\WindowsFormsApplication1.sln
     文件       44544  2019-01-10 16:36  巴斯勒sdk\WindowsFormsApplication1\WindowsFormsApplication1.v11.suo
     文件         187  2019-01-04 12:20  巴斯勒sdk\WindowsFormsApplication1\WindowsFormsApplication1\App.config
     目录           0  2019-01-10 09:21  巴斯勒sdk\WindowsFormsApplication1\WindowsFormsApplication1\bin\
     目录           0  2019-01-07 15:48  巴斯勒sdk\WindowsFormsApplication1\WindowsFormsApplication1\bin\Debug\
     目录           0  2019-01-04 15:53  巴斯勒sdk\WindowsFormsApplication1\WindowsFormsApplication1\bin\Debug\Assemblies\
     目录           0  2019-01-04 15:53  巴斯勒sdk\WindowsFormsApplication1\WindowsFormsApplication1\bin\Debug\Assemblies\Basler.Pylon\
     目录           0  2019-01-04 15:53  巴斯勒sdk\WindowsFormsApplication1\WindowsFormsApplication1\bin\Debug\Assemblies\Basler.Pylon\x64\
     文件      960968  2017-07-19 13:57  巴斯勒sdk\WindowsFormsApplication1\WindowsFormsApplication1\bin\Debug\Assemblies\Basler.Pylon\x64\Basler.Pylon.dll
     文件     2181852  2017-07-19 13:36  巴斯勒sdk\WindowsFormsApplication1\WindowsFormsApplication1\bin\Debug\Assemblies\Basler.Pylon\x64\Basler.Pylon.xml
     目录           0  2019-01-04 15:53  巴斯勒sdk\WindowsFormsApplication1\WindowsFormsApplication1\bin\Debug\Assemblies\Basler.Pylon\x86\
     文件      942024  2017-07-19 13:57  巴斯勒sdk\WindowsFormsApplication1\WindowsFormsApplication1\bin\Debug\Assemblies\Basler.Pylon\x86\Basler.Pylon.dll
     文件     2181852  2017-07-19 13:35  巴斯勒sdk\WindowsFormsApplication1\WindowsFormsApplication1\bin\Debug\Assemblies\Basler.Pylon\x86\Basler.Pylon.xml
     目录           0  2019-01-04 15:53  巴斯勒sdk\WindowsFormsApplication1\WindowsFormsApplication1\bin\Debug\Assemblies\PylonC.Net\
     文件       67016  2017-07-19 13:57  巴斯勒sdk\WindowsFormsApplication1\WindowsFormsApplication1\bin\Debug\Assemblies\PylonC.Net\PylonC.NET.dll
     文件      213233  2017-07-19 13:03  巴斯勒sdk\WindowsFormsApplication1\WindowsFormsApplication1\bin\Debug\Assemblies\PylonC.Net\PylonC.NET.xml
     文件      942024  2017-07-19 13:57  巴斯勒sdk\WindowsFormsApplication1\WindowsFormsApplication1\bin\Debug\Basler.Pylon.dll
     文件     2181852  2017-07-19 13:35  巴斯勒sdk\WindowsFormsApplication1\WindowsFormsApplication1\bin\Debug\Basler.Pylon.xml
     文件         180  2019-01-07 10:05  巴斯勒sdk\WindowsFormsApplication1\WindowsFormsApplication1\bin\Debug\PylonLiveViewControl.EnumerationComboBoxUserControl.resources
     文件         180  2019-01-07 10:05  巴斯勒sdk\WindowsFormsApplication1\WindowsFormsApplication1\bin\Debug\PylonLiveViewControl.FloatSliderUserControl.resources
     文件         180  2019-01-07 10:05  巴斯勒sdk\WindowsFormsApplication1\WindowsFormsApplication1\bin\Debug\PylonLiveViewControl.IntSliderUserControl.resources
     文件       22016  2019-01-09 17:35  巴斯勒sdk\WindowsFormsApplication1\WindowsFormsApplication1\bin\Debug\WindowsFormsApplication1.exe
     文件         187  2019-01-04 12:20  巴斯勒sdk\WindowsFormsApplication1\WindowsFormsApplication1\bin\Debug\WindowsFormsApplication1.exe.config
     文件       40448  2019-01-09 17:35  巴斯勒sdk\WindowsFormsApplication1\WindowsFormsApplication1\bin\Debug\WindowsFormsApplication1.pdb
     文件       22984  2019-01-10 09:17  巴斯勒sdk\WindowsFormsApplication1\WindowsFormsApplication1\bin\Debug\WindowsFormsApplication1.vshost.exe
     文件         187  2019-01-04 12:20  巴斯勒sdk\WindowsFormsApplication1\WindowsFormsApplication1\bin\Debug\WindowsFormsApplication1.vshost.exe.config
     文件         490  2018-04-12 07:35  巴斯勒sdk\WindowsFormsApplication1\WindowsFormsApplication1\bin\Debug\WindowsFormsApplication1.vshost.exe.manifest
     目录           0  2019-01-10 09:21  巴斯勒sdk\WindowsFormsApplication1\WindowsFormsApplication1\bin\Release\
............此处省略52个文件信息

评论

共有 条评论