最近在嘗試Golden Template Inspection Example.vi時一直育到一個error:Invalid template descriptor

先說明這個VI是先用一張template圖片,然後設定分數,來搜尋資料夾中其他的圖片是否有符合template的地方,再作一些Bright和dark的處理,

關於這個error,在網路上可以找到說明:

http://digital.ni.com/public.nsf/allkb/F05924D50AD6472B86256F320075CDBF#InvalidTemplateDescriptor

Error Message -1074395247: Invalid template descriptor
When you create a pattern matching template in Vision Assistant or Vision Builder for Automated Inspection (VBAI), there is extra information saved in addition to the image itself. This includes overlay information, pattern matching template information, and calibration information. This information lets LabVIEW, Vision Assistant, or Vision Builder know how the template was learned. When you open that template in LabVIEW using the IMAQ ReadFile VI, this extra vision information is not transferred with the image. Likewise, if you try to create a template file using the IMAQ Write PNG File VI the extra vision information is not saved to file with the image, so Vision Assistant and Vision Builder do not recognize it as a valid pattern matching template.

In LabVIEW: To retain the extra vision information with the image, open and create your pattern matching template using the IMAQ Read Image And Vision Info VI and the IMAQ Write Image And Vision Info VI, respectively. These VIs can be found in three locations:
Vision and Motion»Vision Utilities»Overlay,
Vision and Motion»Vision Utilities»Calibration, 
Vision and Motion»Vision Utilities»Files.

When creating a Template in LabVIEW, the IMAQ Learn Pattern VI should be used before the IMAQ Write PNG File VI in order to create the extra vision information that must be saved on the PNG file. Refer to the Create Template example in the Related Links section.

前一段是在說明做為template的圖片必須要儲存依些資訊,如 overlay information, pattern matching template information

其中比較重要的是最後一段,是說明在建立template時,在使用IMAQ Write PNG File VI之前,要先經過IMAQ Learn Pattern VI ,這樣template才會記住相關的資訊,

我修改Pattern Matching Example.vi中的learning中的程式碼,來建立有含資訊的template圖片,如下圖:

template build 1.jpg  

這個建立好的template圖片在Golden Template Inspection Example.vi跑沒問題。

這個作法提供給大家參考。

文章標籤
創作者介紹
創作者 fishark 的頭像
fishark

魚的方舟 * 圖形語言的世界* - LabVIEW 工作室 & APP開發研究室 & Arduino整合開發 -

fishark 發表在 痞客邦 留言(0) 人氣()