halconpython联合开发网_C#与Halcon联合开发实例,并做了可移动的ROI库

本文介绍了一个使用C#与Halcon联合开发的ROI库实例,该库支持交互式的ROI对象管理和操作。ROIController类是关键,它响应鼠标输入,创建和更新ROI对象,同时提供了一个模型区域的计算功能。
摘要由CSDN通过智能技术生成

【实例简介】

【实例截图】

【核心代码】

using System;

using HalconDotNet;

using ViewROI;

using System.Collections;

namespace ViewROI

{

public delegate void FuncROIDelegate();

///

/// This class creates and manages ROI objects. It responds

/// to  mouse device inputs using the methods mouseDownAction and

/// mouseMoveAction. You don't have to know this class in detail when you

/// build your own C# project. But you must consider a few things if

/// you want to use interactive ROIs in your application: There is a

/// quite close connection between the ROIController and the HWndCtrl

/// class, which means that you must 'register' the ROIController

/// with the HWndCtrl, so the HWndCtrl knows it has to forward user input

/// (like mouse events) to the ROIController class.

/// The visualization and manipulation of the ROI objects is done

/// by the ROIController.

/// This class provides special support for the matching

/// applications by calculating a model region from the list of ROIs. For

/// this, ROIs are added and subtracted according to their sign.

///

public class ROIController

{

public delegate void UpdateEventHandler(int handle);

public event UpdateEventHandler ROI_Update;

///

/// Constant for setting the ROI mode: positive ROI sign.

///

public const int MODE_ROI_POS           = 21;

///

/// Constant for setting the ROI mode: negative ROI sign.

///

public const int MODE_ROI_NEG           = 22;

///

/// Constant for setting the ROI mode: no model region is computed as

/// the sum of all ROI objects.

///

public const int MODE_ROI_NONE          = 23;

/// Constant describing an update of the model region

public const int EVENT_UPDATE_ROI       = 50;

public const int EVENT_CHANGED_ROI_SIGN = 51;

/// Constant describing an update of the model region

public const int EVENT_MOVING_ROI       = 52;

public const int EVENT_DELETED_ACTROI   = 53;

public const int EVENT_DELETED_ALL_ROIS = 54;

public const int EVENT_ACTIVATED_ROI    = 55;

public const int EVENT_CREATED_ROI      = 56;

private ROI     roiMode;

private int     stateROI;

private double  currX, currY;

/// Index of the active ROI

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值