* **************************************************************************************************
*  电路板投影矫正
*Projective rectification of a circuit board
* **************************************************************************************************
* 关闭窗体
dev_close_window ()
*设置窗体更新为off
dev_update_window ('off')
*读取左右窗体图片
read_image (Image1, '/stereo/uncalib/board_l')
read_image (Image2, '/stereo/uncalib/board_r')
*计算像素的最大和最小值,按照最大值比例化各个像素
scale_image_max (Image1, Image1)
scale_image_max (Image2, Image2)
*获取图像指针
get_image_pointer1 (Image1, Pointer, Type, Width, Height)
ScaleImage := 0.4
*打开窗体
dev_open_window (0, 0, Width * ScaleImage, Height * ScaleImage, 'black', Window1)
*设置显示字体
set_display_font (Window1, 14, 'mono', 'true', 'false')
*显示图像1
dev_display (Image1)
*打开窗体
dev_open_window (0, Width * ScaleImage + 8, Width * ScaleImage, Height * ScaleImage, 'black', Window2)
*显示图像2
dev_display (Image2)
*聚焦窗体1
dev_set_window (Window1)
*显示信息
disp_message (Window1, 'Uncalibrated Stereo Image Pair', 'window', 12, 12, 'black', 'true')
* Compute Fundamental Matrix
* 用harris算子计算兴趣点也就是基础矩阵
points_harris (Image1, 3, 1, 0.2, 1e5, Row1, Col1)
points_harris (Image2, 3, 1, 0.2, 1e5, Row2, Col2)
*通过两个图像之间的对应的点对来自动计算两个图像之间的基本转换矩阵,
match_fundamental_matrix_ransac (Image1, Image2, Row1, Col1, Row2, Col2, 'ncc', 21, 0, 200, 20, 50, 0, 0.9, 'gold_standard', 0.3, 1, FMatrix, CovFMat, Error, Points1, Points2)
Row1 := subset(Row1,Points1)
Col1 := subset(Col1,Points1)
Row2 := subset(Row2,Points2)
Col2 := subset(Col2,Points2)
* 投影矫正开始
* Projective Rectification
* 执行立体投影矫正
gen_binocular_proj_rectification (Map1, Map2, FMatrix, [], Width, Height, Width, Height, 1, 'bilinear_map', CovFMatRect, H1, H2)
*投影图像
map_image (Image1, Map1, Image1)
map_image (Image2, Map2, Image2)
*投影变换
projective_trans_pixel (H1, Row1, Col1, Row1, Col1)
projective_trans_pixel (H2, Row2, Col2, Row2, Col2)
*
*
* Find the dominant plane in the images by computing the 2D homography.
* Then, the left image is transformed such that points lying in this dominant plane do coincide in both images.
* *通过两个图像之间的对应的点对来自动计算两个图像之间的基本投影变换
proj_match_points_ransac (Image1, Image2, Row1, Col1, Row2, Col2, 'ncc', 11, 0, 200, 100, 100, 0, 0.6, 'normalized_dlt', 2, 1, HomMat, Points1, Points2)
*投影变换图像
projective_trans_image (Image1, Image1, HomMat, 'bilinear', 'false', 'true')
* 1. image (cyan) and the 2. image (red) overlaid:
* Regions close to the dominant plane are gray, whereas regions distant to this plane are red or cyan.
  *右下角显示 'Press Run (F5) to continue' 这个信息
disp_continue_message (Window1, 'black', 'true')
stop ()
*把三个图像转换为一个三通道图像
compose3 (Image1, Image2, Image2, Image)
*湖区图像指针
get_image_pointer1 (Image, Pointer, Type, Width, Height)
*聚焦到窗体2
dev_set_window (Window2)
*关闭窗体
dev_close_window ()
*聚焦窗体1
dev_set_window (Window1)
*清楚窗体
dev_clear_window ()
ScaleImage := 0.4
*放大窗体
dev_set_window_extents (-1, -1, Width * ScaleImage, Height * ScaleImage)
dev_display (Image)
*显示信息
disp_message (Window1, 'Images rectified relative to the dominant plane', 'window', 12, 12, 'black', 'true')
* The difference between corresponding points, also called parallax, is reciprocal to the 3D distance
* from the space point the reference plane.
* 利用关联技术来计算矫正图像对之间的差别
binocular_disparity (Image1, Image2, Disparity, Score, 'ncc', 15, 15, 5, -5, 5, 1, 0.8, 'left_right_check', 'interpolation')
  *右下角显示 'Press Run (F5) to continue' 这个信息
disp_continue_message (Window1, 'black', 'true')
stop ()
dev_clear_window ()
dev_display (Disparity)
disp_message (Window1, 'Disparity map', 'window', 12, 12, 'black', 'true')
*
disp_continue_message (Window1, 'black', 'true')
stop ()
*清楚窗体
dev_clear_window ()
*阈值分割
threshold (Disparity, Region, 0.5, 3)
*生成一个圆
gen_circle (StructElem, 10, 10, 3)
*开运算:开运算的目的是先腐蚀后膨胀;目的是把细微连在一起的两块目标分开了,而闭运算则相反
opening (Region, StructElem, Region)
*设置显示颜色
dev_set_color ('slate blue')
*吓死你好i图像
dev_display (Image1)
*显示区域
dev_display (Region)
*显示信息
disp_message (Window1, 'Segmentation of components with large height', 'window', 12, 12, 'black', 'true')

Blob分析之Board_Segmentation_Uncalib的更多相关文章

  1. 常用机器视觉工具----图像分析工具(blob分析)

    http://blog.sina.com.cn/s/blog_67cc4eb70100ivnt.html Blob分析:Blob分析目的在于对图像中的2-D形状进行检测和分析,得到诸如目标位置.形状. ...

  2. opencv 在工业中的应用:blob分析

    在工业中经常要检测一副图像中物体的数量,位置,大小,面积等信息,这就要用到BLOB分析,我用OPENCV做了个BLOB分析的DEMO. (1)打开一幅图像 (2)进行参数设置,设定二值化阙值,并选择是 ...

  3. Blob分析--粘连颗粒检测 基于距离变换的分水岭区域分割 盆地与原连通域求交集

    文章转自微信公众号:机器视觉那些事 *******************************************************************公众号:机器视觉那些事儿*** ...

  4. Halcon 笔记2 Blob分析

    1. 数组操作 2. 可视化-更新窗口 (1)单步模式-总是:则可以自动显示图像: (2)单步模式-从不:需要调用显示函数才能显示图像. (3)单步模式-清空显示:将原图清除,再显示新图 3. 图像处 ...

  5. Halcon blob分析基本处理步骤

    Halcon,blob分析 应用场景,二值化后的灰度图像对比度清晰 基本处理流程 1 读取图片 read_image(变量名,'路径') //halcon字符串使用单引号'' 2 预处理 2.1 RO ...

  6. Caffe学习--Blob分析

    Caffe_blob 1.基本数据结构 Blob为模板类,可以理解为四维数组,n * c * h * w的结构,Layer内为blob输入data和diff,Layer间的blob为学习的参数.内部封 ...

  7. Blob分析之bottle.hdev

    * 分割读取啤酒瓶子上的数字* bottle.hdev: Segment and read numbers on a beer bottle* 第0步* Step 0: Preparations*定义 ...

  8. Blob分析之board _components.hdev

    *用立体方法分割板子组件的示例程序*Application program to illustrate the segmentation* of board _components.hdev  wit ...

  9. Blob分析之board.hdev

    * board.hdev: Detection of missing solder* 获取当前系统参数get_system ('clip_region', Information)*设置当前系统参数s ...

随机推荐

  1. 轻松让HTML5可以显示桌面通知Notification非常实用

    使用Notification的流程 1.检查浏览器是否支持Notification2.检查浏览器的通知权限3.如果权限不够则申请获取权限4.创建消息通知5.展示消息通知 Notification AP ...

  2. 3dTiles 数据规范详解[3] 内嵌在瓦片文件中的两大数据表

    转载请声明出处:全网@秋意正寒 零.本篇前言 说实话,我很纠结是先介绍瓦片的二进制数据文件结构,还是先介绍这两个重要的表.思前想后,我决定还是先介绍这两个数据表. 因为这两个表不先给读者灌输,那么介绍 ...

  3. 状压DP之吃奶酪

    题目 传送们 思路 1≤n≤15,妥妥的状压,数据这么小, 这道题的状压思路还是很好想的,我们定义f[i][s]代表以i为起点,吃掉状态为s的奶酪所需要跑的最短距离,那么显然,我们先枚举状态s,然后枚 ...

  4. Redis做为缓存的几个问题

    缓存理流程: 前台请求,后台先从缓存中取数据,取到直接返回结果,取不到时从数据库中取,数据库取到更新缓存,并返回结果,数据库也没取到,那直接返回空结果. 1.缓存雪崩 解决方案3:如果缓存数据库是分布 ...

  5. CSS(五)- 背景与边框 - 边框圆角与阴影基础用法

    扩展阅读 本文仅仅做border的基础使用,想要深入了解的话可以戳以下几个链接,觉得作者写的很好. CSS Backgrounds and Borders Module Level 3 CSS魔法堂: ...

  6. scala 数据结构(五):队列 Queue

    1 队列 Queue-基本介绍 队列的说明 1)队列是一个有序列表,在底层可以用数组或是链表来实现. 2)其输入和输出要遵循先入先出的原则.即:先存入队列的数据,要先取出.后存入的要后取出 3)在Sc ...

  7. Scala 基础(十一):Scala 函数式编程(三)高级(一)偏函数、作为参数的函数、匿名函数、高阶函数

    1 偏函数 1)在对符合某个条件,而不是所有情况进行逻辑操作时,使用偏函数是一个不错的选择 2)将包在大括号内的一组case语句封装为函数,我们称之为偏函数,它只对会作用于指定类型的参数或指定范围值的 ...

  8. 数据分析05 /pandas的高级操作

    数据分析05 /pandas的高级操作 目录 数据分析05 /pandas的高级操作 1. 替换操作 2. 映射操作 3. 运算工具 4. 映射索引 / 更改之前索引 5. 排序实现的随机抽样/打乱表 ...

  9. unity-热更-InjectFix(一)

    1 C#热更新预备知识 1.1 mono.cecil注入 使用Mono.Cecil实现IL代码注入 注入之后修改dll,新增mdb文件: 注意,待了解参数注释打开会报错: 1.2 InjectFix ...

  10. JVM详解之:java class文件的密码本

    目录 简介 一个简单的class ClassFile的二进制文件 class文件的密码本 magic version 常量池 描述符 access_flags this_class和super_cla ...