当前位置: 首页 > news >正文

2.2.5 C#中显示控件BDPictureBox 的实现----ROI交互续2

2.2.5 C#中显示控件BDPictureBox 的实现----ROI交互续2

1 ROI数组作用说明

变量:m_ROIs[5]
ROI 使用效果图
ROIs效果图

ROI数组说明
ROIs数组图片

2 ROI显示逻辑图

ROI 交互主要是在设定状态下, runmode下只要普通显示即可
ROI显示逻辑

3 主要ROI显示函数函数

  1. 判断当前鼠标是否获取KeyPoint
  2. 鼠标move时,拖放ROI的姿态和大小
  3. 显示更新ROI
3.1 get_interactive_key_draw_point

获取当前ROI 关键点选中信息

/// <summary>
/// get_interactive_key_draw_point
/// </summary>
/// <param name="x"></param>
/// <param name="y"></param>
/// <returns></returns>
private int get_interactive_key_draw_point(int x, int y)
{int point_index = 0;try{if (m_raw_mat != null && !m_raw_mat.IsDisposed){switch (m_ROIs[m_ROI_index].m_nType){case 0:// Rect1point_index = get_interactive_rect1_key_draw_point(ref m_ROIs[m_ROI_index], x, y);break;case 1:// Rect2point_index = get_interactive_rect2_key_draw_point(ref m_ROIs[m_ROI_index], x, y);break;case 2:// Circlepoint_index = get_interactive_circle_key_draw_point(ref m_ROIs[m_ROI_index], x, y);break;case 3:// Ellipspoint_index = get_interactive_ellips_key_draw_point(ref m_ROIs[m_ROI_index], x, y);break;case 4:// arcpoint_index = get_interactive_arc_key_draw_point(ref m_ROIs[m_ROI_index], x, y);break;case 5:// polypoint_index = get_interactive_poly_key_draw_point(ref m_ROIs[m_ROI_index], x, y);break;case 6://  point_index = get_interactive_point_key_draw_point(ref m_ROIs[m_ROI_index], x, y);break;case 7://  break;default:break;}}}catch (Exception ex){label_img_info.Text = ex.Message;point_index = -1;}return point_index;
}
3.2 drag_interactive_ROI

拖放当前ROI ,并且更新ROI

/// <summary>
/// drag_interactive_ROI
/// 更新drag之后的 ROI
/// </summary>
/// <param name="x_dist">distx in  ccs</param>
/// <param name="y_dist">disty in  ccs</param>
private void drag_interactive_ROI(float x_dist, float y_dist)
{List<float> temp_data = new List<float>();//step 0:  clear overlay// clear_ROIs(Black, 2);// step1: 重新计算rect1 try{if (m_raw_mat != null && !m_raw_mat.IsDisposed){switch (m_ROIs[m_ROI_index].m_nType){case 0:// Rect1drag_interactive_rect1(ref m_ROIs[m_ROI_index], x_dist, y_dist);break;case 1:// Rect2drag_interactive_rect2(ref m_ROIs[m_ROI_index], x_dist, y_dist);break;case 2:// Circledrag_interactive_circle(ref m_ROIs[m_ROI_index], x_dist, y_dist);break;case 3:// Ellipsdrag_interactive_ellipse(ref m_ROIs[m_ROI_index], x_dist, y_dist);break;case 4:// arcdrag_interactive_arc(ref m_ROIs[m_ROI_index], x_dist, y_dist);break;case 5:// polydrag_interactive_poly(ref m_ROIs[m_ROI_index], x_dist, y_dist);break;case 6:// drag_interactive_point(ref m_ROIs[m_ROI_index], x_dist, y_dist);break;case 7://  break;default:break;}}}catch (Exception ex){label_img_info.Text = "Drag InterActive ROI:" + ex.Message; }
}
3.3 显示更新ROI
 /// <summary>
/// Disp_InterActive_ROIs_quickflush_without_Update_Image
/// remark: drag  ROI 时使用,这是不需要更新 局部图片,只要更新 overlay 
/// </summary>
/// <param name="m_roi_s"></param>
/// <param name="colortype"></param>
/// <param name="thick"></param>
public void Disp_InterActive_ROIs_without_Update_Image(ROI[] m_roi_s, Scalar colortype, int thick)
{if (m_roi_s == null) return;ROI[] m_quick_rois = new ROI[5];ROI[] m_temp_rois = new ROI[5];Scalar linecolor = new Scalar(0, 0, 0);try{// lock (mutex_display){if (BD_OperateSet.MatisNotNull(m_extract_zoom_overlay)){m_ROIs = m_roi_s; DispManager.get_DispCTX().update_display_hom2d(ref hom2d_quick );m_quick_rois = BD_OperateSet.Affine_ROIs(m_roi_s, hom2d_quick);// step 0: disp ROIfor (int i = 0; i < m_quick_rois.Length; i++){if (i > 0) linecolor = MaskColor_Roi;else linecolor = colortype;if (m_quick_rois[0].m_fDatas.Count > 0){if (m_quick_rois[i].m_fDatas != null){//  b_overlay_zero = false;if (m_quick_rois[i].m_fDatas.Count > 0){switch (m_quick_rois[i].m_nType){case 0:// Rect0 if (m_ROI_index == i) disp_interactive_rect1_points_quickflush(m_quick_rois[i], linecolor, thick);else BD_OperateSet.Disp_Rect1(ref m_extract_zoom_overlay, m_quick_rois[i], linecolor, thick);break;case 1:// Rect2if (m_ROI_index == i) disp_interactive_rect2_points_quickflush(m_quick_rois[i], linecolor, thick);else BD_OperateSet.Disp_Rect2(ref m_extract_zoom_overlay, m_quick_rois[i], linecolor, thick);break;case 2:// Circleif (m_ROI_index == i) disp_interactive_circle_points_quickflush(m_quick_rois[i], linecolor, thick);else BD_OperateSet.Disp_Circle(ref m_extract_zoom_overlay, m_quick_rois[i], linecolor, thick);break;case 3:// Ellipsif (m_ROI_index == i) disp_interactive_ellips_points_quickflush(m_quick_rois[i], linecolor, thick);else BD_OperateSet.Disp_Ellipse(ref m_extract_zoom_overlay, m_quick_rois[i], linecolor, thick);break;case 4:// ARCif (m_ROI_index == i) disp_interactive_arc_points_quickflush(m_quick_rois[i], linecolor, thick);else BD_OperateSet.Disp_Arc(ref m_extract_zoom_overlay, m_quick_rois[i], linecolor, thick);break;case 5:// Polyif (m_ROI_index == i) disp_interactive_poly_points_quickflush(m_quick_rois[i], linecolor, thick);else BD_OperateSet.Disp_Polygen(ref m_extract_zoom_overlay, m_quick_rois[i], linecolor, thick);break;case 6:// if (m_ROI_index == i) disp_interactive_point_quickflush(m_quick_rois[m_ROI_index], linecolor, thick);else BD_OperateSet.Disp_Point(ref m_extract_zoom_overlay, m_quick_rois[m_ROI_index], linecolor, thick);break;case 7://  break;case 8://  break;default:break;}}}}}// step 1: disp masksupdate_Overlay_toDisplay(); pB_Display.Invalidate();// pB_Display.Update();}}}catch (Exception ex){label_img_info.Text = "Disp InterActive ROIs:" + ex.Message;     }
}

相关文章:

  • Golang中defer和return顺序
  • LabVIEW幅频特性测试系统
  • 前端工程化08-新的包管理工具pnpm
  • python系列30:各种爬虫技术总结
  • MySQL增删改查
  • Java Nio核心概念理解
  • 关于 Mybatis 的开启二级缓存返回对象不一致问题
  • 嵌入式PCB制图面试题及参考答案(2万字长文)
  • 【融合ChatGPT等AI模型】Python-GEE遥感云大数据分析、管理与可视化及多领域案例应用
  • 【2024德国签证】去德国读博士需要申请什么签证?
  • Spire.PDF for .NET【文档操作】演示:以特定的缩放比例/百分比打开 PDF 文件
  • 力扣习题--哈沙德数
  • Redis Stream Redisson Stream
  • Cube-Studio:开源大模型全链路一站式中台
  • 千益畅行,旅游卡,如何赚钱?
  • [deviceone开发]-do_Webview的基本示例
  • 【跃迁之路】【735天】程序员高效学习方法论探索系列(实验阶段492-2019.2.25)...
  • Consul Config 使用Git做版本控制的实现
  • export和import的用法总结
  • HashMap ConcurrentHashMap
  • Java到底能干嘛?
  • Java反射-动态类加载和重新加载
  • MySQL的数据类型
  • 订阅Forge Viewer所有的事件
  • 基于webpack 的 vue 多页架构
  • 技术攻略】php设计模式(一):简介及创建型模式
  • 爬虫进阶 -- 神级程序员:让你的爬虫就像人类的用户行为!
  • 前端临床手札——文件上传
  • 前端每日实战:70# 视频演示如何用纯 CSS 创作一只徘徊的果冻怪兽
  • d²y/dx²; 偏导数问题 请问f1 f2是什么意思
  • Nginx惊现漏洞 百万网站面临“拖库”风险
  • #Linux(make工具和makefile文件以及makefile语法)
  • #考研#计算机文化知识1(局域网及网络互联)
  • $NOIp2018$劝退记
  • (0)Nginx 功能特性
  • (1)Nginx简介和安装教程
  • (3)(3.2) MAVLink2数据包签名(安全)
  • (八)Docker网络跨主机通讯vxlan和vlan
  • (循环依赖问题)学习spring的第九天
  • **登录+JWT+异常处理+拦截器+ThreadLocal-开发思想与代码实现**
  • ..thread“main“ com.fasterxml.jackson.databind.JsonMappingException: Jackson version is too old 2.3.1
  • .apk 成为历史!
  • .mat 文件的加载与创建 矩阵变图像? ∈ Matlab 使用笔记
  • .Net IE10 _doPostBack 未定义
  • .net 开发怎么实现前后端分离_前后端分离:分离式开发和一体式发布
  • .NET 中使用 TaskCompletionSource 作为线程同步互斥或异步操作的事件
  • .Net+SQL Server企业应用性能优化笔记4——精确查找瓶颈
  • .net6使用Sejil可视化日志
  • :=
  • [ vulhub漏洞复现篇 ] Django SQL注入漏洞复现 CVE-2021-35042
  • [20190416]完善shared latch测试脚本2.txt
  • [AIGC] HashMap的扩容与缩容:动态调整容量以提高性能
  • [Android Pro] listView和GridView的item设置的高度和宽度不起作用
  • [C++]C++基础知识概述
  • [CareerCup] 13.1 Print Last K Lines 打印最后K行