Halcon 建立模板重新定義中心

2021-09-28 22:27:47 字數 2168 閱讀 1963

*讀取

read_image (image1, 'j:/2019/模板匹配/吸嘴模板匹配/1.bmp')

*顯示

dev_display (image1)

set_display_font (3600, 16, 'mono', 'true', 'false')

disp_message (3600, '請畫出建模區域', 'image', 20, 20, 'red', 'false')

*設定邊框大小

dev_set_line_width (2)

*設定顏色

dev_set_color ('red')

*設定顯示邊框

dev_set_draw ('margin')

*畫矩形

draw_rectangle2 (3600, row, column, phi, length1, length2)

*獲取矩形

gen_rectangle2 (rectangle, row, column, phi, length1, length2)

*生成儲存

gen_rectangle2 (rectangle1, row, column, phi, row/2, column/2)

*矩形區域中心點

area_center (rectangle, area, row1, column1)

*矩形中心點

gen_cross_contour_xld (cross, row1, column1, 76, phi)

*變數裝中心點

rvariate:=row1

xvariate:=column1

*縮小區域

reduce_domain (image1, rectangle, imagereduced)

*矩形2倍

reduce_domain (image1, rectangle1, imagereduced1)

*擷取crop_domain (imagereduced1, imagepart)

*清空視窗

dev_clear_window ()

*顯示dev_display (image1)

*儲存擷取

write_image (imagepart, 'tiff', 0, 'j:/2019/模板匹配/吸嘴模板匹配/1')

*顯示縮小區域

dev_display (imagereduced)

*設定字型

set_display_font (3600, 16, 'mono', 'true', 'false')

*顯示disp_message (3600,'請畫出建模區域' , 'window', -1, -1, 'black', 'false')

*建立模板

create_shape_model (imagereduced, 'auto', rad(-180), rad(180), 'auto', 'auto', 'use_polarity', 'auto', 'auto', modelid)

*清空視窗

dev_clear_window ()

dev_display (imagereduced)

set_display_font (3600, 16, 'mono', 'true', 'false')

disp_message (3600, '請畫出模板中心點', 'image', 20, 20, 'red', 'false')

*重新定模板中心點

draw_point(3600,newrow,newcol)

*設定形狀模型的原點(參考點)。

set_shape_model_origin(modelid,newrow-rvariate,newcol-column1)

*設定創模超時間 3000mm=3s

set_shape_model_param (modelid, 'timeout', 3000)

*獲取模板控制代碼

get_shape_model_contours (modelcontours, modelid, 1)

*儲存模板

write_shape_model (modelid, 'j:/2019/模板匹配/吸嘴模板匹配/吸嘴模板匹配建模.shm')

*釋放模板的記憶體

clear_shape_model (modelid)

es建立模板

建立模板 注 1.讀取templatefilepath目錄下所有.json結尾的檔案 2.模板名為檔名稱 3.模板內容為檔案內容 param templatefilepath 模板檔案路徑 public static void createestemplate string templatefile...

LXC之三 建立模板

所謂的模板就是乙個原型,依據該原型可以建立一系列類似的lxc 虛擬機器,如果使用 lxc 1.0.0.3 自帶的模板,那麼該原型只提供最基本的配置,如果想使用 vim,對不起,沒有,如果想使用 gcc,抱歉,依然沒有,如果想使用 mysql 更是沒有。這裡所說的模板製作,只是乙個比較簡單的最基礎的製...

Django框架學習 5建立模板

如何向請求者返回乙個漂亮的頁面呢?肯定需要用到html css,如果想要更炫的效果還要加入js,這麼一堆欄位串全都寫到檢視中,作為httpresponse 的引數就太麻煩了。在django中,將前端的內容定義在模板中,然後再把模板交給檢視呼叫,各種漂亮 炫酷的效果就出現了。在templates目錄中...