ZM-VS1200用户使用手册.doc

Similar documents
致理技術學院

coverage2.ppt

<534B544C DACFCA8FDB160B3C6B5E B FB8D5BE5C2E706466>

色 位 於 直 角 座 標 系 的 原 點 上, 白 色 則 位 於 距 原 點 最 遠 的 頂 點 上, 以 黑 色 至 白 色 位 置 之 間 的 線 段 (Gray scale) 表 示 灰 階 值 的 變 化, 愈 接 近 黑 色 的 線 段 位 置, 灰 階 值 愈 小, 反 之 則 愈

119,,,,,, (, ), : (1),,,,,, (2),,,, (3),,,,,20,,,,,,,,

WinMDI 28

(Microsoft Word - \256g\275b\252\354\305\351\305\347.doc)

untitled

並 責 成 各 里 幹 事 下 里 服 勤 宣 導 病 媒 防 治 知 識, 協 助 各 家 戶 清 除 病 媒 孳 生 源 ( 積 水 容 器 ), 降 低 棲 群 密 度, 預 防 傳 染 病 之 發 生, 以 確 保 民 眾 身 體 健 康 及 居 家 生 活 品 質 訂 定 每 月 最 後

影視後製全攻略 Premiere Pro After Effects Encore 自序 Adobe Premiere Pro After Effects Encore 2008 Adobe CS Adobe CS5 Adobe CS4 Premiere Pro After Effect

// HDevelopTemplateWPF projects located under %HALCONEXAMPLES%\c# using System; using HalconDotNet; public partial class HDevelopExport public HTuple

接线端子--Connectors规格书.doc

untitled

MODEL COLOR LIST UZ125D2 YMW GRAY YNF RED YRG BLUE 30H WHITE

FZ1.s92

2

TX-NR3030_BAS_Cs_ indd

Microsoft PowerPoint - Lecture7II.ppt

TABLE OF CONTENTS.MACRO COMMAND...1.MACRO DESIGN...3.ALARM LIST...4.MACRO 1. HOLE PATTERN 1-1.LINE AT ANGLE GRID SQUARE BOLT

Microsoft Word - 3D手册2.doc

PowerPoint 演示文稿

晶体结构立体模型建构软件-Diamond的使用

PowerPoint プレゼンテーション


BHB530.BOOK

pair path pair path numeric sind cosd pair color beginfig(0) u := 2cm ; pair a ; draw ( 0u, 0u ) -- ( u, u ) ; draw ( u, 0u ) -- ( 0u, 1u ) ;

Preface This guide is intended to standardize the use of the WeChat brand and ensure the brand's integrity and consistency. The guide applies to all d

大漠 伪前端, 就职于淘宝

1912 Titanic Richardson echo-ranging 1, mm min 6.8mm min mm min

FIT1改1.FIT)

fi-4990c

技 巧 5: 避 免 除 以 0 的 運 算 在 做 除 的 運 算 時, 先 檢 查 除 數 的 數 值, 避 免 有 除 以 0 的 情 況 若 運 算 中 除 數 為 0,SAS 會 在 LOG 中 註 記 提 醒 並 將 運 算 結 果 設 定 為 遺 漏 值, 減 慢 程 式 的 執 行

余德浩诗词

DR2010.doc

3.1 num = 3 ch = 'C' 2

C 1

ebook70-14

epub 94-3

Text 文字输入功能 , 使用者可自行定义文字 高度, 旋转角度 , 行距 , 字间距离 和 倾斜角度。

bootstrap - 2

热设计网

LSTA126中文操作说明

四川省普通高等学校

C/C++语言 - 分支结构

ebook50-11


Captive Screws Styled knob series M3 thread size Smooth knob meets UL-1950 Designed for hand operation Spring ejected Wide variety of sizes, re

Microsoft Word - ch05note_1210.doc

区 域 活 动 进 入 中 班 我 们 区 域 的 设 置 和 活 动 材 料 都 有 所 变 化, 同 时 也 吸 引 孩 子 们 积 极 的 参 与 学 习 操 作 区 的 新 材 料 他 们 最 喜 欢, 孩 子 们 用 立 方 块 进 行 推 理 操 作 用 扑 克 牌 进 行 接 龙 游

mm-G6 60mm 12

17 Prelight Apply Color Paint Vertex Color Tool Prelight Apply Color Paint Vertex Color Tool 242 Apply Color, Prelight Maya Shading Smooth

Leica S S 2

Panaboard Overlayer help

北京市基本医疗保险政策解答

第 期 彭莉科等 基于计算机视觉的卷烟包装尺寸测量方法 引言 像 由图像采集卡 CCD相机 镜头和两组结构光源等 组成 图像处理系统用于分析获取的数字图像提取 计算机视觉是近几年兴起的高新技术它涉及 图像中的结构光信息生成烟包的点云数据并给出 人工智能 神经生物学 图像处理 模式识别等多个 烟包的尺

春 天 来 了, 万 物 复 苏, 小 草 绿 了 小 河 解 冻 了 柳 树 发 芽 了 桃 花 盛 开 了 春 天 给 大 自 然 带 来 了 盎 然 生 机 春 天 的 景 物 是 美 丽 的, 春 天 的 故 事 是 动 人 的, 我 们 有 取 之 不 尽 的 以 春 为 主 题 的 作

【主持人】:给大家介绍一下,这次的培训是我们画刊部的第三次培训,当然今天特别有幸请来著吊的摄影家李少白老师给我们讲课


5-1 nav css 5-2

( CIP) /. :, ( ) ISBN TP CIP ( 2005) : : : : * : : 174 ( A ) : : ( 023) : ( 023)

<4D F736F F D20A4E2B6D5BFEBC3D1C2B2B3F8BCBDA9F1A874B2CE2E646F63>

目 录 目 录 1. 安 装 和 快 速 入 门 附 件 1.1 随 机 附 件 附 件 信 息... 3 连 接 和 设 定 1.3 连 接 记 录 纸... 4 快 速 入 门 1.5 发 送 传 真 / 复 印 接 收 传 真

GF

Microsoft PowerPoint - ATF2015.ppt [相容模式]

010 X Watch out for traffic signals 011 X Bumpy road 012 O Tunnel ahead 013 X Bicycles prohibited 014 O Yield 015 O Single lane road, pass with extrem


#FT66/68CN(01~07)

2

000

A-1 HTML A-1-1 HTML 1 HTML JSP HTML HTML HTML JSP A HTML HTML HTML HTML HTML HTML HTML HTML.htm.html HTML Windows NotePad HTML IE [ / ] NotePad A-2


RUN_PC連載_8_.doc

JLX

目 录 Leica ICC50 HD 引 言 9 基 本 特 点 10 基 本 特 点 ( 续 ) 11 Leica ICC50 HD: 概 述 12 拆 箱 14 准 备 开 始! 使 用 之 前 的 准 备 工 作 16 开 始 设 置! 使 用 计 算 机 进 行 连 接 和 成 像 操 作

(2) Function 0BH: Function 0CH: (pixel, picture element) Function 0DH: Function 0FH: Function 13H:

4,, : Fig. 1 Research route of the topic,,,,,,,,,,, [4] π,,,, :,, ;,, Tab. 1 Key parameters of back frame header (SP1)/MW (SK1)/% (WP8)/MP

AD RJCK.fm

Microsoft Word - 改版式网页全文.doc

Ps22Pdf

untitled

SA-DK2-U3Rユーザーズマニュアル

校园之星

(Guangzhou) AIT Co, Ltd V 110V [ ]! 2

(Microsoft Word - Motion Program \270\305\264\272\276\363 \307\245\301\366 \271\327 \270\361\302\367.doc)

安 全 指 南 : 必 须 遵 守 所 有 的 警 告 事 项, 以 确 保 自 己 和 他 人 的 安 全 以 及 保 护 产 品 和 连 接 装 置 这 些 警 告 事 项 都 按 警 示 程 度 明 示 出 等 级 有 资 格 的 人 员 : YO-YO 只 能 进 行 与 手 册 有 关 的

Gerotor Motors Series Dimensions A,B C T L L G1/2 M G1/ A 4 C H4 E

扭 轉 生 命 旅 程 ~ 部 長 序 ~ 我 國 家 庭 暴 力 防 治 法 自 87 年 公 布 至 今, 近 15 年 推 動 家 庭 暴 力 防 治 工 作 的 歷 程 中, 除 了 建 置 社 政 警 政 教 育 司 法 醫 療 等 防 治 網 絡, 積 極 協 助 遭 受 暴 力 傷 害

2_dvdr3380_97_CT_21221b.indd

FILTRON 1. DC AC AC 220V 50HZ / / / / 4. 1) / DC AC FILTRON DC AC FILTRON DC 12V 12VDC D

Real-time Human Detection and Security System

User ID 150 Password - User ID 150 Password Mon- Cam-- Invalid Terminal Mode No User Terminal Mode No User Mon- Cam-- 2

科学计算的语言-FORTRAN95

大 綱 最 有 利 標 目 的 及 類 型 最 有 利 標 之 辦 理 方 式 準 用 最 有 利 標 取 最 有 利 標 精 神 最 有 利 標 之 類 型 及 其 相 關 規 定 適 用 最 有 利 標 準 用 最 有 利 標 及 取 最 有 利 標 精 神 作 業 程 序 及 實 務 分 析

第一章.FIT)

CL-68x00,00,00,00,00, CL-78x00,00,00,00,6000 Spindle 181mm mm Spindle bore 181mm is standard. 255,5 or 5mm is option. Chuck is optional. You ca

()

Microsoft Word - 澎湖田調報告-宏達組9804.doc

平 凡 足 迹 李 本 川 作 者 为 中 国 科 学 院 海 洋 研 究 所 研 究 员,1935 年 生, 山 东 荣 成 人 我 今 年 63 岁 了 大 前 年 丈 夫 和 儿 子 在 一 个 月 内 先 后 离 开 了 人 世, 女 儿 又 已 出 嫁, 现 在 是 孑 然 一 身 我 是

今天 年春季号 总 92 期

*

Transcription:

ZM-VS1200 Blob 3 ZM-VS1200 10 2

3

4

5

6

open_framegrabber( Template,1,1,0,0,0,0, default,1, default,-1, default, default, default,-1, -1,FGHandle)// Template while(1) 7

user_optical(in)// If(In)// grab_image(image,fghandle)// read_image(image. c:/templ ) // grab_image c:/templ c:/templ get_image_point1(image,point,type,width,height) // dev_close_window() dev_open_window(0,0, Width,Height, white,windowhandle) // dev_display(image) // rgb1_to_gray(image,grayimage) // rgb dev_set_color( red ) // dev_set_draw( margin ) // dev_set_line_width(1) // Row:=143 Column:=190 Phi:=0 Length1:=180 Length2:=10 gen_rectangle2(rectangle, Row,Column,Phi,Length1,Length2) // gen_measure_rectangle(rectangle,row, Column,Phi,Length1,Length2,Width,Height, nearest_nearest,measurehandle) gen_measure_pairs(grayimage,measurehandle,1,30, all, all,rowedgefirst,columnedgefirst, AmplitudeFirst,RowEdgeSecond,ColumnEdgeSecond,AmplitudeSecond,IntraDistance,Inter Distance)// Width:= IntraDistance set_tposition(windowhandle,2412) // write_string(windowhandle, Width: + Width) // wait_second(3) endif wait_second(0.01) endwhile us gen_measure_rectangle gen_measure_pairs 8

IntraDistance,InterDistance open_framegrabber( Template,1,1,0,0,0,0, default,1, default,-1, default, default, default, grab_image(image,fghandle) read_image(image, c:/temp1 ) -1,-1,FGHandle) get_image_pointer1(image,_,_,width,height) dev_colse_window() dev_open window(0,0,width,height, black,windowhandle) dev_display(image) rgb1_to_gray(image, Image) draw_rectangle2(windowhandle,row,column,phi,length1,length2) interpolation:= nearest_neighbor gen_measure_rectangle2(row,column,phi,length1,length2, Width,Height,Interpolation,MeasureHandle) Sigma:=2.5 Threshold:=10 Transition:= all Select:= all gen_measure_pairs(image,measurehandle,sigma,threshold, Transition, Selec,RowEdgeFirst, ColumnEdgeFirst,AmplitudeFirst,RowEdgeSecond,ColumnEdgeSecond, 9

AmplitudeSecond,IntraDistance,InterDistance) // // dev_set_draw( margin ) dev_set_color( red ) gen_rectangle2(rectangle, Row,Column,Phi,Length1,Length2) p_disp_dimensions(rowedgefirst,columnedgefirst,amplitudefirst,rowedgesecond,columned tuple_sum(intradistance,sum1) tuple_sum(interdistance,sum2) Sum:=Sum1+Sum2 gesecond, IntraDistance,InterDistance,Phi,Length2,WindowHandle) // set_tposition(windowhandle,row+20,column+20) dev_set_color( red ) write_string(windowhandle,sum$.3f ) close_measure(measurehandle) 1p_disp_dimension p_disp_edge_marker(rowedgefirst,columnedgefirst,phi,length, while,2,windowhandle) p_disp_edge_marker(rowedgesecond,columnedgesecond,phi,length, white,2, WindowHandle) Number:= RowEdgeFirst for i:=0 to Number-1 by 1 Text:=IntraDistance[i] p_disp_text_right_of_center(windowhandle,text$'.2f',rowedgefirst[i], ColumnEdgeFirst[i], endfor RowEdgeSecond[i],ColumnEdgeSecond[i], Phi, 2.0*Length) for i:=0 to Number-2 by 1 Text:=InterDistance[i] p_disp_text_left_of_center(windowhandle,text$'.2f',rowedgesecond[i], endfor ColumnEdgeSecod[i],RowEdgeFirst[i+1],ColumnEdgeFirst[i+1],Phi,2.0*Length) return() 2 p_disp_edge_marker NumRows:= Rows NumCols:= Cols Num:=min([NumRows,NumCols]) 10

for i:=0 to Num-1 by 1 Row:=Rows[i] Col:=Col[i] RowStart:= Row+Length*cos(Phi) RowEnd:= Row-Length*cos(Phi) ColStart:= Col+Length*sin(Phi) ColEnd:= Col-Length*sin(Phi) gen_contour_polygon_xld(marker, [RowStart,RowEnd], [ColStart,ColEnd]) dev_set_color(color) dev_set_line_width(linewidth) dev_display(marker) endfor return() 3 p_disp_text_left_of_center get_part(windowhandle,row1part,column1part,row2part,column2part) get_window_extents(windowhandle,rowwin,columnwin,widthwin,he ightwin) FactorRow := (1.0*((Row2Part-Row1Part)+1))/HeightWin FactorColumn: = (1.0*((Column2Part-Column1Part)+1))/WidthWin get_string_extents(windowhandle,text,ascent,descent,width,height) Width := Width*FactorColumn Height := Height*FactorRow RowCenter: = (RowFirst+RowSecond)/2.0 ColCenter := (ColFirst+ColSecond)/2.0 if (sin(phi)<0) endif Distance := -Distance RowPos: = RowCenter-Distance*cos(Phi)) ColPos ;= ColCenter-Distance*sin(Phi) RowText := RowPos-Height/2.0 ColText := ColPos-Width; set_tposition(windowhandle,rowtext,coltext); dev_set_color( black ) write_string(windowhandle,text) return() 4 p_disp_text_right_of_center get_part(windowhandle,row1part,column1part,row2part,column2part) get_window_extents(windowhandle,rowwin,columnwin,widthwin,heightwin) FactorRow : = 1.0*(Row2Part-Row1Part+1)/HeightWin 11

FactorColumn := 1.0*(Column2Part-Column1Part+1))/WidthWin get_string_extents(windowhandle,text,ascent,descent,width,height) Width := Width*FactorColumn Height := Height*FactorRow RowCenter = (RowFirst+RowSecond)/2.0 ColCenter := (ColFirst+ColSecond)/2.0 if (sin(phi)<0) Distance = -Distance; endfor RowPos: = RowCenter+Distance*cos(Phi) ColPos: = ColCenter+Distance*sin(Phi) RowText := RowPos-Height/2.0 ColText: = ColPos set_tposition(windowhandle,rowtext,coltext) write_string(windowhandle,text) return() 1cm 134.10+5.62+5.69 /2=139.751mm 13.975 1mm 12

13

open_framegrabber( Template,1,1,0,0,0,0, default,1, default,-1, default, default, default,-1, -1,FGHandle) grab_image(image,fghandle) read_image(image, c:/temp1 ) get_image_pointer(image,point,type,width,height) decompose3(image,imager,imageg,imageb,imagegray) rgb3_to_gray(imager,imageg,imageb,imagegray) //3 rgb dev_close_window() dev_open_window(0,0,width,height, white,windowhandle) dev_display(imagegray) dev_set_color( red ) dev_set_draw( margin ) dev_set_width(1) draw_rectangle2(windlehandle,row,column,phi, Length1, Length2) gen_rectangle2(rectangle,row,column,phi, Length1, Length2) gen_measure_rectangle2(row,column,phi,length1,length2,width,height, nearest_neighbor, MeasureHandle) measure_pairs(imagegray,measurehandle,1,30, all, all,rowedgefirst,columnedgefirst,amplit dev_set_color( blue ) Row1:=Row udefirst,rowedgesecond,columnedgesecond,amplitudesecond,intradistance, InterDistance) 14

Column1:=(ColumnEdgeFirst+ ColumnEdgeSecond)/2 Phi:=rad(-90) Length21:=40 Length22:=8 Leadlength:=[] for i:=1 to IntraDistance by 1 gen_rectangle2(rectangle,row1,column1[i-1],phi,length21,lenght22) gen_measure_rectangle2(row1,column1[i-1],phi,length21,lenght22,width,height, nearest_neighbor,measurehandle1) measuer_pos(measurehandle1,1,30, all, all,rowedge1,columnedge1,amplitude1,distance1) L:=sum(Distance1) // Set_tposition(WindowHandle,24+20*i,12) Write_string(Windowhandle,i+ leadlenght: Leadlength:=[Leadlength,L] Endfor +L) measure_pairs IntraDistance,InterDistance measuer_pos Distance1, L=sum(Distance1) Leadlength 15

open_framegrabber( Template,1,1,0,0,0,0, default,1, default,-1, default, default, default,-1, -1,FGHandle) grab_image(image,fghandle) read_image(image, c:/temp1 ) get_image_pointer1(image,pointer,type,width,height) dev_set_color( red ) dev_set_line_width(1) dev_set_draw( margin ) dev_close_window() dev_open_window(0,0,width,height, white,windowhandle) rgb1_to_gray(image,grayimage) threshold(grayimage,light,80,255) connection(light,connectedregions) select_shape(connectedregions,selectedreions, area, and,10,200) smallest_rectangle2(selectedregion,row,column,phi,length1,length2) area_center(selectedregions,area,row1,column1) dev_set_color( white ) dev_set_line_with(3) for i:=0 to Area -1 by 1 gen_rectangle2(rectangle,row[i],column[i],phi[i],length1[i],length2[i]) set_tposition(windowhandle,row1[i]+10,column[i]-10) write_string(windowhandle,area[i]) Endfer 16

threshold connection select_shape ConnectedRegions area_cente SelectedReions Area,Row1,Column1 17

init_hdevelop() open_framegrabber( Template,1,1,0,0,0,0, default,1, default,-1, default, default, default,-1, -1,FGHandle) grab_image(image,fghandle) read_image(image, c:/temp1 ) init_visualization(image,3, yellow,width,height,windowid)// edges_sub_pix(image,edges, lanser2,0.5,40,90)// dev_display(edges) stop() segment_contours_xld(edges,contoursplit, lines_circles,6,4,4)// sort_contours_xld(contourssplit,sortedcontours, upper_left, true, column )// dev_clear_windoe() dev_set_colored(12) dev_display(sortedcontours) stop() open_zoom_window(0,round(width/2),0,0,288,384,2,windowhandlezoom)// NumSegments:= SortedContours dev_display(image) NumCircles:=0 Numlines:=0 for i:=1 to NumSegments by 1 singlesegment:=sortedcontours[i] 18

endif get_contour_global_attrib_xld(singlesegment, cont_approx,attrib)// if(attrib=1)// Attrib=1 NumCircles:= NumCircles+1 fit_circle_contour_xld(singlesegment, atukey,-1,2,0,5,2,row,column,radius,startphi,endp hi,pointorder)// gen_ellipse_contour_xld(contellipse,row,coumn,0,radius,0,rad(360), positive,1.0)// dev_set_color( red ) dev_display(contellipse) set_tposition(windowhandlezoom,row-radius,column) write_string(windowhandlezoom, C +NumCircles) resulttest:= C +NumCircles+ :radius= +Radius else// Attrib=0 Numlines:=Numlines+1 fit_line_contour_xld(singlesegment,'tukey',-1,0,5,2,rowbegin,colbegin,rowend,colend,nr, Nc,Dist)// gen_contour_polygon_xld(line,[rowbegin,rowend],[colbegin,colend]) dev_set_color( yellow ) dev_display(line) distance_pp(rowbegin,colbegin,rowend,colend,length) set_tposition(windowhandlezoom,(rowbegin+rowend)/2-nr*10,(colbeigin+colend)/2) write_string(windowhandlezoom,'l' + NumLines) ResulText:= 'L' + NumLines + ': length = ' + Length set_tposition(windowhandlezoom,i*10,30) write_string(windowhandlezoom,resulttext) endfor stop() close_zoom_window(windowhandlezoom,width,height)// reset_hdevelop()// 1 close_zoom_window dev_set_window(windowhandlezoom) dev_close_window() dev_set_part(0,0,formerheight-1,formerwidth-1) return() 2 init_hdovelop dev_updata_window( off ) dev_updata_pc( off ) dev_updata_var( off ) return() 19

3 init_visualization get_image_pointer(image,pointer,type,width,height) dev_close_window() dev_open_window(0,0,width,height, light gray,windowid) dev_set_part(0,0,height-1,width-1) dev_set_line_width(linewidth) dev_set_draw(drawmode) dev_display(image) return() 3 open_zoom_window dev_open_window(rowpos,colpos,(colroi2-colroi1)*zoomfactor, (RowROI2-RowROI1)*ZoomFactor, 'black'windowhandlezoom) dev_set_part(round(rowroi1), round(colroi1), round(rowroi2), round(colroi2)) 4 reset_hdevelop dev_updata_window( on ) return() 20

edges_sub_pix (Image, Edges, lanser2, 0.5, 40, 90) segment_contours_xld (Edges, ContoursSplit, lines_circles, 6, 4, 4) sort_contours_xld (ContoursSplit, SortedContours, upper_left, true, column ) count_obj HDevelop select_obj HDevelop get_contour_global_attrib_xld distance_pp NumSegments := SortedContours for i := 1 to NumSegments by 1 SingleSegment := SortedContours[i] get_contour_global_attrib_xld (SingleSegment, cont_approx, Attrib) if (Attrib = 1) fit_circle_contour_xld (SingleSegment, atukey, -1, 2, 0, 5, 2, Row, Column, Radius, StartPhi, EndPhi, PointOrder) gen_ellipse_contour_xld (ContEllipse, Row, Column, 0, Radius, Radius, 0, rad(360), positive, 1.0) else fit_line_contour_xld (SingleSegment, tukey, -1, 0, 5, 2, RowBegin, ColBegin, RowEnd, ColEnd, Nr, Nc, Dist) gen_contour_polygon_xld (Line, [RowBegin,RowEnd], [ColBegin,ColEnd]) distance_pp (RowBegin, ColBegin, RowEnd, ColEnd, Length) 21

endif endfor 1 22

23

24

read_image (Image, clip ) gen_rectangle2 (ROI, 124, 181, 0.653, 129, 47) reduce_domain (Image, ROI, ImageReduced) create_shape_model (ImageReduced, 0, 0, rad(360), 0, no_pregeneration, use_polarity, 40, 10, ModelID) find_shape_model (Image, ModelID, 0, rad(360), 0.7, 13, 0.5, interpolation, 0, 0.9, Row, Column, Angle, Score) get_shape_model_contours (ModelContours, ModelID, 1) for i := 0 to Row -1 by 1 vector_angle_to_rigid (0, 0, 0, Row[i], Column[i], Angle[i], HomMat2D) affine_trans_contour_xld (ModelContours, ContoursAffinTrans, HomMat2D) endfor clear_shape_model (ModelID) Blob blob 25

1 count := 1 while (count<16) // 15 // read_image (moneyvalidating, 'rmb/'+count) // dev_display (moneyvalidating) stop () zoom_image_factor (moneyvalidating, ImageZoomed, 0.25, 0.25, 'constant') // 1/4 get_image_pointer1 (ImageZoomed, Pointer1, Type1, Width1, Height1) // gen_rectangle2 (Rectangle1, Width1/2, Height1/2, 0, Width1/2, Height1/2) // reduce_domain (ImageZoomed, Rectangle1, ImageReduced1) // create_template (ImageReduced1, 255, 4, 'sort', 'original', TemplateID1) // write_template (TemplateID1, '50can.shm') clear_template (TemplateID1) stop () dev_close_window () dev_open_window (0, 0, 512, 512, 'black', WindowHandle) // 50can.shm // * step: read model * step: apply matching read_template ('50can.shm', TemplateID) // read_image (Image1, 'd:/rmb/rmb1') dev_display (Image1) // stop () best_match (Image1, TemplateID, 30, 'true', Row, Column, Error) dev_set_color ('blue') dev_set_draw ('margin') dev_close_window () stop () get_image_pointer1 (moneyvalidating, Pointer2, Type2, Width2, Height2) dev_open_window (0, 0, Width2, Height2, 'black', WindowHandle1) dev_display (moneyvalidating) // 26

if (Column<350) // set_tposition (WindowHandle1, 65, 150) 65150 write_string (WindowHandle1, ' ') else endif if (Row<100) set_tposition (WindowHandle1, 40, 150) write_string (WindowHandle1, ' 10 ') else if (Row<190) endif else endif set_tposition (WindowHandle1, 40, 150) write_string (WindowHandle1, ' 20 ') if (Row<280) set_tposition (WindowHandle1, 40, 150) write_string (WindowHandle1, ' 50 ') else endif set_tposition (WindowHandle1, 40, 150) write_string (WindowHandle1, ' 100 ') set_tposition (WindowHandle1, 65, 150) write_string (WindowHandle1, ' ') if (Row<100) set_tposition (WindowHandle1, 40, 150) write_string (WindowHandle1, ' 10 ') else if (Row<190) endif stop () * **** else endif * step: destroy model * **** clear_template (TemplateID) count := count+1 endwhile set_tposition (WindowHandle1, 40, 150) write_string (WindowHandle1, ' 50 ') set_tposition (Window Handle1, 40, 150) write_string (WindowHandle1, ' 100 ') // // // 350 27

2 blob create_template write_template clear_template read_template best_match best_match Demosaick Bayer HALCON blob. HALCON. 28

dev_close_window () dev_open_window (0, 0, 640, 480, 'black', WindowHandle) read_image (Image, 'standard171') // decompose3 (Image, Red, Green, B) // 3 r,g,b trans_from_rgb (Red, Green, B, Hue, Saturation, Intensity, 'hsv') threshold (Saturation, HighSaturation, 100, 255) reduce_domain (Hue, HighSaturation, HueHighSaturation) threshold (HueHighSaturation, Blue, 150, 185) connection (Blue, ConnectedRegions) closing_circle (ConnectedRegions, Blue1, 25.5) //r,g,b hsv // 100 255 // // // connection (Blue1, ConnectedRegions) select_shape_std (ConnectedRegions, SelectedRegions, 'max_area', 0) // closing_circle (SelectedRegions, Blue2, 3.5) reduce_domain (Image, Blue2, ImageReduced) dev_display (HueHighSaturation) dev_display (ImageReduced) shape_trans (ImageReduced, ImageReduced1, 'rectangle2') // reduce_domain (Image, ImageReduced1, ImageReduced2) // fill_interlace (ImageReduced2, ImageFilled, 'odd') // threshold (ImageFilled, Region, 130, 176) // 29

connection (Region, ConnectedRegions1) closing_rectangle1 (ConnectedRegions1, RegionClosing, 25, 5000) select_shape (RegionClosing, SelectedRegions1, 'width', 'and', 10, 800) select_shape (SelectedRegions1, Letters1, 'height', 'and', 30, 800) sort_region (Letters1, SortedRegions, 'character', 'true', 'row') intersection (ConnectedRegions1, SortedRegions, RegionIntersection) // // // sort_region (RegionIntersection, SortedRegions1, 'character', 'true', 'row') area_center (SortedRegions, Area, Row, Column) // dev_display (ImageFilled) stop () for i := 2 to 7 by 1 gen_rectangle2 (Rectangle, Row[i], Column[i], 0, 24, 53) // reduce_domain (ImageFilled, Rectangle, ImageReduced3) create_shape_model (ImageReduced3, 'auto', -0.39, 0.79, 'auto', 'auto', 'use_polarity', 'auto', 'auto', ModelID) // write_shape_model (ModelID, 'chepai.shm') clear_shape_model (ModelID) read_shape_model ('chepai.shm', ModelID1) read_image (mobang, 'e:/07 / /carnum/beijing1') // find_scaled_shape_model (mobang, ModelID, -0.39, 0.78, 0.9, 1.1, 0.5, 1, 0.5, 'least_squares', 0, 0.9, Row1, Column1, Angle, Scale, Score) // dev_clear_window () dev_display (ImageFilled) if (Column1<80) set_tposition (WindowHandle, 100, 200) write_string (WindowHandle, '1') else if (Column1<180) set_tposition (WindowHandle, 150, 200) write_string (WindowHandle, '2') else if (Column1<300) else set_tposition (WindowHandle, 200, 200) write_string (WindowHandle, '8') if (Column1<440) set_tposition (WindowHandle, 250, 200) else write_string (WindowHandle, 'A') if (Column1<550) // set_tposition (WindowHandle, 300, 200) write_string (WindowHandle, 'E') 30

endfor endif stop () endif endif endif else 3 set_tposition (WindowHandle, 350, 200) write_string (WindowHandle, 'Q') endif 31

32 find_scaled_shape_model read_shape_model create_shape_model write_shape_model edges_sub_pix canny lanser2 lanser2 sobel Zero_crossing_sub_pix derivate_gauss laplace HALCON edges_color_sub_pix lines_gauss lines_facet Sigma zoom_image_factor HALCON lines_color

1 dev_set_line_width (2) dev_update_window ('off') TextHeight := 26 read_image (Image, 'gongjian') zoom_image_factor (Image, Image, 0.25, 0.25, 'weighted') get_image_pointer1 (Image, Pointer, Type, Width, Height) * * Compute the outer contour dev_open_window (0, 0, 512, 512, 'black', WindowHandle) edges_sub_pix (Image, Edges, 'canny', 0.8, 10, 30) // select_shape_xld (Edges, SelectedXLD, 'circularity', 'and', 0.8, 99999) for i := 0 to 3 by 1 fit_ellipse_contour_xld (SelectedXLD, 'fitzgibbon', -1, 0, 0, 200, 3, 2, Row3, Column2, Phi1, Radius11, Radius21, StartPhi1, EndPhi1, PointOrder2) // endfor gen_ellipse_contour_xld (ContEllipse1, Row3[2], Column2[2], 6.28, Radius11[2], Radius21[2], 0, 6.28, 'positive', 0.5) // 1 gen_ellipse_contour_xld (ContEllipse12, Row3[0], Column2[0], 6.28, Radius11[0], Radius21[0], 0, 6.28, 'positive', 0.5) // 2 dev_display (Image) dev_display (ContEllipse1) dev_display (ContEllipse12) stop () dev_set_color ('red') // set_tposition (WindowHandle, Row3[2], Column2[2]) write_string (WindowHandle, 'r11='+radius11[2]) set_tposition (WindowHandle, Row3[2]+20, Column2[2]) write_string (WindowHandle, 'r12='+radius21[2]) set_tposition (WindowHandle, Row3[0], Column2[0]-50) write_string (WindowHandle, 'r21='+radius11[0]) set_tposition (WindowHandle, Row3[2]+20, Column2[2]-50) write_string (WindowHandle, 'r22='+radius21[0]) 3 edges_sub_pix 33

Halcon halcon sin * Compute the sine from 0 to 3*PI and print to the graphical window dev_close_window () dev_open_window (0, 0, 512, 512, 'black', WindowID) dev_set_part (0, 0, 511, 511) dev_set_color ('red') for m := 0 to 255 by 5 endfor old_x := 0 old_y := 0 for x := 1 to 511 by 4 y := sin((x+m)/511.0*2*3.1416*3)*255 disp_line (WindowID, old_y+256, old_x, y+256, x) old_x := x old_y := y endfor dev_clear_window () sin 34

procedure p_disp_dimensions (: : RowEdgeFirst, ColumnEdgeFirst, RowEdgeSecond, ColumnEdgeSecond, IntraDistance, InterDistance, Phi, Length, WindowHandle: ) edges. * Display markers for the p_disp_edge_marker (RowEdgeFirst, ColumnEdgeFirst, Phi, Length, 'white', 2, WindowHandle) p_disp_edge_marker (RowEdgeSecond, ColumnEdgeSecond, Phi, Length, 'white', 2, WindowHandle) * Loop over all edge pairs. Number := RowEdgeFirst for i := 0 to Number-1 by 1 * * Display the IntraDistance between the edges. 35

Text := IntraDistance[i] p_disp_text_right_of_center (WindowHandle, Text$'.2f', RowEdgeFirst[i], ColumnEdgeFirst[i], RowEdgeSecond[i], ColumnEdgeSecond[i], Phi, 2.0*Length) endfor * * Loop to display the distance between the edge pairs. for i := 0 to Number-2 by 1 * * Display the InterDistance between the edge pairs. Text := InterDistance[i] p_disp_text_left_of_center (WindowHandle, Text$'.2f', RowEdgeSecond[i], ColumnEdgeSecond[i], RowEdgeFirst[i+1], ColumnEdgeFirst[i+1], Phi, 2.0*Length) end endfor return () procedure p_disp_edge_marker (: : Rows, Cols, Phi, Length, Color, LineWidth, WindowHandle: ) end * Determine the number of edges NumRows := Rows NumCols := Cols Num := min([numrows,numcols]) * * Loop over the edges for i := 0 to Num-1 by 1 * Row := Rows[i] Col := Cols[i] * Determine start and end point of the edge marker. RowStart := Row+Length*cos(Phi) RowEnd := Row-Length*cos(Phi) ColStart := Col+Length*sin(Phi) ColEnd := Col-Length*sin(Phi) * * Generate a contour that connects the start and end point. * gen_contour_polygon_xld (Marker, [RowStart,RowEnd], [ColStart,ColEnd]) * Display the contour with the specified style. endfor return () dev_set_color (Color) dev_set_line_width (LineWidth) dev_display (Marker) 36

procedure p_disp_text_right_of_center (: : WindowHandle, Text, RowFirst, ColFirst, RowSecond, ColSecond, Phi, Distance: ) end * Determine factors for the adaptation of the string extents that might be necessary * because of image zooming. get_part (WindowHandle, Row1Part, Column1Part, Row2Part, Column2Part) get_window_extents (WindowHandle, RowWin, ColumnWin, WidthWin, HeightWin) FactorRow := 1.*(Row2Part-Row1Part+1)/HeightWin FactorColumn := 1.*(Column2Part-Column1Part+1)/WidthWin * * Determine the extent of the string and its position. get_string_extents (WindowHandle, Text, Ascent, Descent, Width, Height) Width := Width*FactorColumn Height := Height*FactorRow RowCenter := (RowFirst+RowSecond)/2.0 ColCenter := (ColFirst+ColSecond)/2.0 if (sin(phi) < 0) Distance := -Distance endif RowPos := RowCenter+Distance*cos(Phi) ColPos := ColCenter+Distance*sin(Phi) RowText := RowPos-Height/2.0 ColText := ColPos * * Set the text position and color and display the text. set_tposition (WindowHandle, RowText, ColText) dev_set_color ('black') write_string (WindowHandle, Text) return () procedure p_disp_text_left_of_center (: : WindowHandle, Text, RowFirst, ColFirst, RowSecond, ColSecond, Phi, Distance: ) * Determine factors for the adaptation of the string extents that might be necessary * because of image zooming. get_part (WindowHandle, Row1Part, Column1Part, Row2Part, Column2Part) get_window_extents (WindowHandle, RowWin, ColumnWin, WidthWin, HeightWin) FactorRow := 1.*(Row2Part-Row1Part+1)/HeightWin FactorColumn := 1.*(Column2Part-Column1Part+1)/WidthWin * * Determine the extent of the string and its position. get_string_extents (WindowHandle, Text, Ascent, Descent, Width, Height) Width := Width*FactorColumn Height := Height*FactorRow RowCenter := (RowFirst+RowSecond)/2.0 37

end ColCenter := (ColFirst+ColSecond)/2.0 if (sin(phi) < 0) Distance := -Distance endif RowPos := RowCenter-Distance*cos(Phi) ColPos := ColCenter-Distance*sin(Phi) RowText := RowPos-Height/2.0 ColText := ColPos-Width * * Set the text position and color and display the text. set_tposition (WindowHandle, RowText, ColText) dev_set_color ('black') write_string (WindowHandle, Text) return () read_image (Image, 'Capture') get_image_pointer1 (Image, _, _, Width, Height) dev_close_window () dev_open_window (0, 0, Width, Height, 'black', WindowHandle) dev_display (Image) * rgb1_to_gray rgb1_to_gray (Image, Image) bin_threshold (Image, Dark) boundary (Dark, RegionBorder, 'inner_filled') dev_set_color ('red') dev_set_draw ('margin') dev_set_line_width (1) dev_clear_window () dev_display (RegionBorder) * the biggest circle smallest_circle (RegionBorder, Row3, Column3, Radius1) gen_circle (Circle2, Row3, Column3, Radius1) set_tposition (WindowHandle, Row3, Column3+Radius1-100) write_string (WindowHandle, 'R=') write_string (WindowHandle, Radius1$'.3f') stop () * big circle is ok * get the teeth distance gen_measure_arc (Row3, Column3, Radius1*0.97, 0, 6.28319, 5, Width, Height, 'bilinear', MeasureHandle) gen_circle (Circle, Row3, Column3, Radius1*0.97) Sigma := 2.5 38

Threshold := 10 Transition := 'negative' Select := 'all' measure_pairs (Image, MeasureHandle, Sigma, Threshold, Transition, Select, RowEdgeFirst, ColumnEdgeFirst, AmplitudeFirst, RowEdgeSecond, ColumnEdgeSecond, AmplitudeSecond, IntraDistance, InterDistance) NumCogs := RowEdgeFirst Crosses := [] for i := 0 to RowEdgeFirst -1 by 1 gen_cross_contour_xld (Cross, RowEdgeFirst[i], ColumnEdgeFirst[i], 10, atan2(rowedgefirst[i]-row3,columnedgefirst[i]-column3)) Crosses := [Crosses,Cross] gen_cross_contour_xld (Cross, RowEdgeSecond[i], ColumnEdgeSecond[i], 10, atan2(rowedgesecond[i]-row3,columnedgesecond[i]-column3)) endfor Crosses := [Crosses,Cross] if (InterDistance[0]<0.3*Radius1) D1 := (RowEdgeSecond[1]-RowEdgeFirst[0])*(RowEdgeSecond[1]-RowEdgeFirst[0])+(ColumnEdgeS econd[1]-columnedgefirst[0])*(columnedgesecond[1]-columnedgefirst[0]) tuple_sqrt (D1, D1) D2 := IntraDistance[2] else D1 := IntraDistance[0] D2 := (RowEdgeSecond[2]-RowEdgeFirst[1])*(RowEdgeSecond[2]-RowEdgeFirst[1])+(ColumnEdgeS econd[2]-columnedgefirst[1])*(columnedgesecond[2]-columnedgefirst[1]) tuple_sqrt (D2, D2) endif set_tposition (WindowHandle, Row3-Radius1, Column3) write_string (WindowHandle, 'D1=') write_string (WindowHandle, D1$'.3f') set_tposition (WindowHandle, Row3+Radius1-100, Column3) write_string (WindowHandle, 'D2=') write_string (WindowHandle, D2$'.3f') stop () * teeth distance is ok * outside circle R3 := 0 for i := 1 to 6 by 1 Phi := atan2(rowedgefirst[0]-row3,columnedgefirst[0]-column3) gen_measure_rectangle2 (Row3, Column3, Phi+0.5*i, Radius1, 5, Width, Height, 'nearest_neighbor', MeasureHandle) measure_pairs (Image, MeasureHandle, 2.5, 100, 'all', 'all', RowEdgeFirst, ColumnEdgeFirst, 39

AmplitudeFirst, RowEdgeSecond, ColumnEdgeSecond, AmplitudeSecond, IntraDistance, InterDistance) tuple_sum (IntraDistance, Sum1) tuple_sum (InterDistance, Sum2) Sum := Sum1+Sum2 if (Sum>1.85*Radius1) endif if (R3=0) R3 := Sum/2 else endif endfor dev_clear_window () dev_display (Image) R3 := (Sum/2+R3)/2 gen_circle (Circle, Row3, Column3, R3) set_tposition (WindowHandle, Row3, Column3+R3-100) write_string (WindowHandle, 'R=') write_string (WindowHandle, R3$'.3f') stop () * outside circle is ok * inside circle gen_circle (Circle1, Row3, Column3, 0.475*Radius1) reduce_domain (Image, Circle1, ImageReduced1) edges_sub_pix (ImageReduced1, Edges, 'lanser2', 0.5, 20, 40) segment_contours_xld (Edges, ContoursSplit, 'lines_circles', 5, 4, 3) Number1 := ContoursSplit for i := 1 to Number1 by 1 ObjectSelected := ContoursSplit[i] get_contour_global_attrib_xld (ObjectSelected, 'cont_approx', Attrib) if (Attrib > 0) fit_circle_contour_xld (ObjectSelected, 'ahuber', -1, 2, 0, 3, 2, Row, Column, Radius, StartPhi, EndPhi, PointOrder) gen_ellipse_contour_xld (ContEllipse, Row, Column, 0, Radius, Radius, 0, rad(360), 'positive', 1.0) endfor endif dev_display (ContEllipse) R4 := Radius+1 Row4 := Row Column4 := Column dev_clear_window () dev_display (Image) gen_circle (Circle2, Row4, Column4, R4) 40

set_tposition (WindowHandle, Row4, Column4+R4) write_string (WindowHandle, 'R=') write_string (WindowHandle, R4$'.3f') * inside circle is ok stop () * the distance of jing * dev_clear_window () * dev_display (Image) * set_tposition (WindowHandle, 200, 200) * write_string (WindowHandle, ' ') * draw_region (Region, WindowHandle) * reduce_domain (Image, Region, ImageReduced2) * area_center (Region, Area, Row6, Column6) * dev_clear_window () * dev_display (ImageReduced2) * edges_sub_pix (ImageReduced2, Edges, 'lanser2', 0.5, 20, 40) * segment_contours_xld (Edges, ContoursSplit, 'lines_circles', 5, 4, 3) * Number := ContoursSplit * Rf := [] * Rowf := [] * Columnf := [] * for i := 1 to Number by 1 * ObjectSelected := ContoursSplit[i] * get_contour_global_attrib_xld (ObjectSelected, 'cont_approx', Attrib) * if (Attrib > 0) * fit_circle_contour_xld (ObjectSelected, 'ahuber', -1, 2, 0, 3, 2, Row, Column, Radius, StartPhi, EndPhi, PointOrder) * gen_ellipse_contour_xld (ContEllipse, Row, Column, 0, Radius, Radius, 0, rad(360), 'positive', 1.0) * dev_clear_window () * dev_display (ImageReduced2) * dev_display (ContEllipse) * tuple_concat (Rf, Radius, Rf) * tuple_concat (Rowf, Row, Rowf) * tuple_conc at (Columnf, Column, Columnf) * endif * endfor * stop () dev_close_window () 41

42

43