• 大小: 0.47M
    文件类型: .rar
    金币: 1
    下载: 0 次
    发布日期: 2024-04-28
  • 语言: C#
  • 标签: C#  Halcon  控件  

资源简介

可以通过鼠标滚轮对halcon窗口进行滑动放大

资源截图

代码片段和文件信息

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 HalconDotNet;


namespace image_processing

{
    public partial class Form1 : Form
    {
        private int current_beginRow current_beginCol current_endRow current_endCol;
        private HalconWindow wch = new HalconWindow();
        string path;//存储图片路径
        HImage hImage = new HImage();
        Hobject image gray_image threshold_image bin_image;//原图、灰度图、二值图
        public Form1()
        {
            InitializeComponent();
        }
        /**************************************************************************/
        /**********************加载图片********************************************/
        /**************************************************************************/
        private void button2_Click(object sender EventArgs e)
        {
            try
            {
                OpenFileDialog file = new OpenFileDialog();
                //file.Filter = “|*.bmp;*.png;*.jpg“;
                file.Filter = “BMP文件(*.bmp)|*bmp|PNG文件(*.png)|*png|JPG文件(*.jpg)|*jpg|所有文件(*.*)|*.*||“;
                if (file.ShowDialog() == DialogResult.OK)
                {
                    path = file.FileName;
                    HOperatorSet.ReadImage(out image path);
                    wch.DispImageFit(image hWindowControl1);                   
                }
            }
            catch (Exception)
            {
                throw;
            }
        }


        /**************************************************************************/
        /**********************清空窗口********************************************/
        /**************************************************************************/
        private void btnClearWindow_Click(object sender EventArgs e)
        {
            hWindowControl1.HalconWindow.ClearWindow();
            image = null;
        }

        /**************************************************************************/
        /**********************鼠标滚轮/按钮 缩放图片大小**************************/
        /**************************************************************************/
        private void hWindowControl1_HMouseWheel(object sender HMouseEventArgs e)
        {
            HTuple mode = e.Delta;
            int button_state;
            double mouse_post_row mouse_pose_col;

            hWindowControl1.HalconWindow.GetMpositionSubPix(out mouse_post_row out mouse_pose_col out button_state);
            wch.DispImageZoom(image hWindowControl1 mode mouse_post_row mouse_pose_col);
        }
        private void btnZoomIn_Click(object sender EventArgs e)
        {
            HTuple mode = 1;
            double mouse_post_row mouse_pose_col;   
            hWindowControl1 .HalconWind

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

    ..A..H.     70144  2019-02-15 09:03  image_processing\mouse_move\.vs\image_processing\v14\.suo

     文件       1009  2019-02-15 08:27  image_processing\mouse_move\image_processing.sln

     文件        189  2019-02-12 10:36  image_processing\mouse_move\mouse_move\App.config

     文件    1279544  2014-11-15 02:27  image_processing\mouse_move\mouse_move\bin\Debug\halcondotnet.dll

     文件    4074746  2014-11-15 01:07  image_processing\mouse_move\mouse_move\bin\Debug\halcondotnet.xml

     文件      15360  2019-02-15 08:28  image_processing\mouse_move\mouse_move\bin\Debug\mouse_move.exe

     文件        189  2019-02-12 10:36  image_processing\mouse_move\mouse_move\bin\Debug\mouse_move.exe.config

     文件      30208  2019-02-15 08:28  image_processing\mouse_move\mouse_move\bin\Debug\mouse_move.pdb

     文件      22688  2019-02-15 08:58  image_processing\mouse_move\mouse_move\bin\Debug\mouse_move.vshost.exe

     文件        189  2019-02-12 10:36  image_processing\mouse_move\mouse_move\bin\Debug\mouse_move.vshost.exe.config

     文件        490  2018-04-12 07:35  image_processing\mouse_move\mouse_move\bin\Debug\mouse_move.vshost.exe.manifest

     文件       6568  2019-02-15 08:28  image_processing\mouse_move\mouse_move\Form1.cs

     文件      10956  2019-02-15 08:28  image_processing\mouse_move\mouse_move\Form1.Designer.cs

     文件       5817  2019-02-15 08:24  image_processing\mouse_move\mouse_move\Form1.resx

     文件       5035  2019-02-15 08:28  image_processing\mouse_move\mouse_move\HalconWindow.cs

     文件       4256  2019-02-13 10:23  image_processing\mouse_move\mouse_move\image_processing.csproj

     文件      26560  2019-02-14 11:42  image_processing\mouse_move\mouse_move\obj\Debug\DesignTimeResolveAssemblyReferences.cache

     文件       7363  2019-02-15 08:39  image_processing\mouse_move\mouse_move\obj\Debug\DesignTimeResolveAssemblyReferencesInput.cache

     文件       1531  2019-02-15 08:58  image_processing\mouse_move\mouse_move\obj\Debug\image_processing.csproj.FileListAbsolute.txt

     文件        976  2019-02-15 08:28  image_processing\mouse_move\mouse_move\obj\Debug\image_processing.csproj.GenerateResource.Cache

     文件        180  2019-02-15 08:28  image_processing\mouse_move\mouse_move\obj\Debug\image_processing.Form1.resources

     文件       2114  2019-02-15 08:24  image_processing\mouse_move\mouse_move\obj\Debug\mouse_move.csproj.FileListAbsolute.txt

     文件        976  2019-02-15 08:24  image_processing\mouse_move\mouse_move\obj\Debug\mouse_move.csproj.GenerateResource.Cache

     文件      17358  2019-02-13 09:21  image_processing\mouse_move\mouse_move\obj\Debug\mouse_move.csprojResolveAssemblyReference.cache

     文件      15360  2019-02-15 08:28  image_processing\mouse_move\mouse_move\obj\Debug\mouse_move.exe

     文件        180  2019-02-15 08:24  image_processing\mouse_move\mouse_move\obj\Debug\mouse_move.Form1.resources

     文件      30208  2019-02-15 08:28  image_processing\mouse_move\mouse_move\obj\Debug\mouse_move.pdb

     文件        180  2019-02-13 10:23  image_processing\mouse_move\mouse_move\obj\Debug\mouse_move.Properties.Resources.resources

     文件          0  2019-02-12 10:36  image_processing\mouse_move\mouse_move\obj\Debug\TemporaryGeneratedFile_036C0B5B-1481-4323-8D20-8F5ADCB23D92.cs

     文件          0  2019-02-12 10:36  image_processing\mouse_move\mouse_move\obj\Debug\TemporaryGeneratedFile_5937a670-0e60-4077-877b-f7221da3dda1.cs

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

评论

共有 条评论