实例介绍
NI MAX LabVIEW 视觉图像标定训练教程。详细标定过程。
石鑫华视觉网htto/ shixinhua. com 目录 Calibration training标定训练 Point distance calibration点距标定 Point coordinates calibration点坐标标定 34 Distortion model(Grid°畸变模式(栅格) 1着音 46 Camera mode( Grid)相机模式(栅格) Microplanes(Grd微型平面(栅格)… 石鑫华视觉网htto/ shixinhua. com Calibration Training 标定训练 在图像处理中,标定是一个非常重要的过程。一般如果不对图像进行标定,而且图像的 畸变不会影响到测量时,可以直接使用标定当量进行标定。而如果图像畸变比较厉害,则需 要使用图像标定。 NI Vision中有专门的图像标定接口,即 Calibration Training Interface Calibration Training标定训练,可以点 mage Calibration图像标定主体选项卡中的NeW Calibration.新建标定按钮或者是ε dit Calibration编辑标定(编辑标定仅限已经选择∫标定文 件后)进入,也可以点击系统开始菜单中的开始>所有程序> National Instruments>vision> Calibration training,如下图所示,从而进入标定训练接冂 Image Calibration Setup Main Calibration Dat tep Name mage Calibration 1 Calibration file path New Calibration dit calibration □ irEview Carried imare Interpolation Type Replace value Zero Order OK Canc 图1图像标定主体选项卡中的标定训练入口 石鑫华视觉网htto/ shixinhua. com National instr NIO Trace 原 NI License Manager NI MAX 盛 NI Registration Wizard E NI Update Service t NI Vision Assistant 2012 SP1 N弃户体验改善计划(32位) 分布式系统管理器2012 Dat LabⅥEW2012 NI-P2P NI-Ro vision : n Calibration Training shi a Ccor cia sification Training OCR Training wa Particle Classification Training 年 Template Editor B: Texture Training i White Balancing Utility Documentation Text Based Examples Vision assistant 2012 5P1 I Vision Builder Al 2012 返回 索程序和之件 图2 NI Calibration Training标定训练在开始中的位置 №标定训练接口,以及图2中看到的其它的如颜色分类训练、OCR训练、粒子分类训 练、模板编辑、纹理训练等,都是N视觉中的一些小程序,专门用于帮助开发人员忺速 作各种分类器文件、OCR宇符集、标定文件等专用文件的些小程序。理论上,可以将应用 桿序复制出来,并且安装好视觉运行时与公共瓷源包后,可以在其它电脑上单独运行的。不 过本站长还没有试验过,各位看观如果有兴趣,倒是可以去试一下是不是可以。当然了,这 样的程序,理论上也可以自己通过 /ision+LabⅦEW进行绵辑。不过N既然已经弄好」,又 何必再去麻烦再弄一个呢?呵呵。下面进入标定训练接口看一下其用法。 4 石鑫华视觉网htto/ shixinhua. com H NI Cal bration Training Intertace -Untitled 1 Hle Help Step 1-5rlert Calibration Type Calibration use cases Flat objects This page lists common cal bration use cases. Yau can also learn Point Distance Calibration Directly ConvErts pi el -ordinates to real-world coordinates based on Hiuh1-SpHHiI InL(HH: liHI a krown dstance A high-speed inspection may introduce directional cistortion alone one Point coordinates calibration imacc axis, For cxamplc in linc scan applications, magcs may b- CutLets Ldlmlerc dr yle uis ur Liu strether f the arnuisitinn rata is trn fast based on known distand acquisition rate is too s ow. Use a Point Distance calibration to pecify different scaling for the x and y axes to correct the directional betveen at least four poirts distortion. You can ther compute a lens distortion mocel to correct Distortion Model(Grld] d stortion in the image. Corrccta lcng distor bior or sensor misalignment hased nn one nr Pick and Place(two Dimensional) Applications more calibration grid images A typical two dimensional pick and lace application involves the Camera Model (Grid) following characteristics Maces e er: ara? ster; aid i lEns dis r jon idse: I:n at'zast au must manipula:e objects which are scattered in a tray or five cal bration crid images other centaine You must translate the position of objects in the image to the actuator coordinate system. Curved objects I he camera may not be perpendicular to the cbject container. Corrects dstorHian nr a wnrkirg Use a Point Coordinates calibration -o correct perspective arror, Lhen ust paller rI Inld chiny ur =ruLer tleLhuu lu iuenlily LI are that is rot fat based on one and orientation of objects in the container. If the Point Coordinates ::::: or more Calibration grid images calibration does not orcvide the desired level of orecision, ycu cal mod fy the calibration to compute a lens distortion model. <s Previous Next>> PCB InSpec P只晒0 图3 NI Calibration Training Interface标定训练接口 标定训练在VBA系列的教程中,有一部分介绍,详情点击: http:/shixinhua.com/imganalyse/201207/32.html,vbai中调用的标定训练接口也是这个标定 训练,因此他们的功能上是一样的。只不过当时本人使用的标定程序是VBA2009的,所以 略有不同。从视觉助于或 NI Vision builder for a中调用标定训练接口时,与直接从程序菜单 中启动略有不同,因为标定训练是有程序接口,所以可以传递参数进入训练程序,因此从视 觉助手、ⅤBAⅠ中调用时,图像是直接传递给了标定训练接口的。而从程序菜单中启动时, 是没有原始图像的,因此在标定程序中会有菜单项,如Fie文件、Help帮助两个项目,其它 内容都致 File He New calibration Ctrl+N Open Calibration. Ctrl+o ave Calibration Ctrl+s Save cal动;As, Exit Ctrl+Q 图4标定训练Fe文件菜单 标定训练的Fe文件菜单比较简单,里面有 New calibration新标定、 Open Calibration 打开标定、 Save calibration保存标定、 Save Calibration as另存为标定、Exit退出等几个软件 中常用的打开保存操作,你懂的,不解释。 File Help Online help Patents About 5 石鑫华视觉网htto/ shixinhua. com 图5标定训练Help帮助菜单 标定训练的帮助菜单同样非常简单,有 Online help在线帮助(仍然只是本地一个CHM 英语帮助文档,N的这些小程序也都是有帮助文档的)、 Patents专利、 About关」等儿个觉 的菜单。你依然懂的,不解释。 Calibration use cases This page lists common calibration use cases. You can also learn about each type of calibration High-Speed Inspection a high-speed inspection may introduce directional distortion along one image axis. For example, in line-scan applications, images may be stretched if the acquisition rate is too fast or compressed if the acquisition rate is too slow. Use a Point Distance calibration to specify different scaling for the x and Y axes to correct the directional distortion. You can then compute a lens distortion model to correct other distortion in the image Pick and Place(Two-Dimensional) Applications a typical two-dimensional pick and place application involves the following characteristi You must manipulate objects which are scattered in a tray or other container You must translate the pasition of objects in the image to the actuator coordinate system The camera may not be perpen dicular to the object container. se a Point Coordinates calibration to correct perspective errot.s then use pattern matching or another method to identify the positi and orientation of objects in the container. If the Point Coordinates calibration does not provide the desire level cf recision modify the calibration to utm a te 2 ler, sd sr ort n modey' you can PCB Inspection 图6 Calibration use cases标定使用案例 在标定训练向导的初始界面左边,有个标定使用案例说明。里面列举了许多可以使用 标定方法的案例。各位看观如果有兴趣,可以自己了解一下 石鑫华视觉网htto/ shixinhua. com Step 1- Select Ca libration Type Flat Obiects Point distance calibration Directy converts pixel coordinates to real-world coordinates based on a known distance Point coordinates calibration Corrects camera angle distortion based on known distances between at least four points Distortion Model (grid) EE: Corrects lens distor tion or sensor :: :i:: misalignment based on one or Camera Model (grid) ::: Models camera parameters and 3: lens dis tortion based on at least five calibration grid images Microplanes(Grid) ;…∷: Corrects distortion for a working :::: :: plane that is not flat based on one iii: or more calibration grid images 日 Pr Next shuinhuaco 图7标定训练向导 在标定训练初始界面的右边,则是标定向导。在本版本的标定训练 Calibration Training 中,可以看到标定针对两大部分,一部分为 Flat Objects平面目标,主要分为 Point distance Calibration点距标定、 Point coordinates calibration点坐标标定、 Distortion Model( Grid畸变模 式(栅格)、 Camera mode(Gid)相杋模式(栅格)等四类;另一部分为 Curved object5弯 曲目标,只有 Microplanes(Grid微型平面(棚格)。下面我们针对每种标定模式具体学习 Point distance calibration点距标定 首先在图7的向导 Select Calibration Type中选择第一个 Point distance calibration点距标 定。 Point distance calibration点距标定,简要提示信息说基于·个已知的距离直接转换像素 坐标到世界坐标(现实坐标、真实坐标)。点击Next,进入下一步 石鑫华视觉网htto/ shixinhua. com H NI Cal bration Training Intertace -Untitled 1 Hle Help -Step ]-5plert Tmage source select an mage that contains at least 2 Doints separated by a distance wh ch you can accurately refine in real-word units ck on an mage to select o deselect it. SteAL desferAl Acquire New Image I Inad Tmage from Fils AP只函0 图8标定向导第二步 Select Image Source选择图像源 在图8所小的标定冋导第二步中,要求选择图像源。这个与视觉助手中的浏览图像类似 左边一大块是图像浏览器。底下有ZooM控制按钮。右边则是图像源控制区域。从图81 可以看到,因为没有图像所以有·个黄底的感叹号提示信息,要求你采集幅图像 Acquire an Image g NI Cal bration Training Interface -Untitled 1 Fie Help shikinhua.0m时su sele=t an mage that -ontains at least 2 oints separated by a distance whch you can accurately efine in real-word units 112 dick on an image to select or deselectit Acquire NeN Image Load Image from Fi < Previous Next>> P Help 图9选择图像源后 8 石鑫华视觉网htto/ shixinhua. com 图9中的图像源为采集的一张直尺的图像。本列不使用N|自带的例子图像,因为那些 图像是有标定信息的。当然如果想试也可以使用。另外一个原因,是因为例子使用的是标定 板,这个相对比较难找或者是需要去购买,而直尺则随处可见。因此木教程以直尺直接作为 标定图像源。使用直尺做标定时,只能标定视野比较大的环境。如果视野比较小,如几毫米 那么有可能标定会有定的误差,那时就需要使用精密的标定板了。 加载∫图像后(使用 Load Image from file按钮进行加载),右边的所有控件都变为使能。 Select a选择所冇按钮,可以选择左边图像浏览器中的所冇图像, Deselect a则不选择任何 张图像, Delete按钮为删除选择的图像。要想进入下一步,必须要选择一张图像以上。如 果不选择图像,则会有错误提示: Select at least1 Image,并且点击Next按钮是无效的 F NI Cal bration Training Interface -Untitled 1 Fie Help +Step 2-select Image Source select an mage that contains at least 2 points separated by a distance whch you can accurately refine in real-word units 112 tick on an mage to select o deselect Select A Deselect all[ Delete Acquir= NcN Imagc Load Image from Fis Selecta least i Idge d Previous Next>3 PPR函0 图10不选择图像时错误 选择好图像,然后点击Next按钮,进步下一步。 【实例截图】
【核心代码】
标签:
小贴士
感谢您为本站写下的评论,您的评论对其它用户来说具有重要的参考价值,所以请认真填写。
- 类似“顶”、“沙发”之类没有营养的文字,对勤劳贡献的楼主来说是令人沮丧的反馈信息。
- 相信您也不想看到一排文字/表情墙,所以请不要反馈意义不大的重复字符,也请尽量不要纯表情的回复。
- 提问之前请再仔细看一遍楼主的说明,或许是您遗漏了。
- 请勿到处挖坑绊人、招贴广告。既占空间让人厌烦,又没人会搭理,于人于己都无利。
关于好例子网
本站旨在为广大IT学习爱好者提供一个非营利性互相学习交流分享平台。本站所有资源都可以被免费获取学习研究。本站资源来自网友分享,对搜索内容的合法性不具有预见性、识别性、控制性,仅供学习研究,请务必在下载后24小时内给予删除,不得用于其他任何用途,否则后果自负。基于互联网的特殊性,平台无法对用户传输的作品、信息、内容的权属或合法性、安全性、合规性、真实性、科学性、完整权、有效性等进行实质审查;无论平台是否已进行审查,用户均应自行承担因其传输的作品、信息、内容而可能或已经产生的侵权或权属纠纷等法律责任。本站所有资源不代表本站的观点或立场,基于网友分享,根据中国法律《信息网络传播权保护条例》第二十二与二十三条之规定,若资源存在侵权或相关问题请联系本站客服人员,点此联系我们。关于更多版权及免责申明参见 版权及免责申明
网友评论
我要评论