函式說明
public
void
fitrectanglemeasure
(hwindow 視窗控制代碼, himage 影象,
outdouble 中心y座標,
outdouble 中心x座標)
操作步驟,首先繪製兩個矩形測量框;之後就可進行自動計算。
public
void
fitrectanglemeasure
(hwindow hwindow,
himage himage,
outdouble row,
outdouble col)
//測量寬度
int nhalfborder =
(int
)(math.
min(rtlen1s[0]
, rtlen2s[0]
)+ math.
min(rtlen1s[1]
, rtlen2s[1]
))/2
;//矩形測量控制代碼的建立
htuple hv_metrologyhandle =
null
, hv_metrologyrectangleindices =
null
; hoperatorset.
createmetrologymodel
(out hv_metrologyhandle)
; hoperatorset.
addmetrologyobjectrectangle2measure
(hv_metrologyhandle,
newhtuple
(rtrows)
,new
htuple
(rtcols)
,new
htuple
(rtangles)
,new
htuple
(rtlen1s)
,new
htuple
(rtlen2s)
, nhalfborder, nhalfborder /4,
1,10,
newhtuple()
,new
htuple()
,out hv_metrologyrectangleindices)
; hoperatorset.
setmetrologyobjectparam
(hv_metrologyhandle, hv_metrologyrectangleindices,
"num_instances",1
);hoperatorset.
setmetrologyobjectparam
(hv_metrologyhandle, hv_metrologyrectangleindices,
"min_score"
,0.1);
hoperatorset.
setmetrologyobjectparam
(hv_metrologyhandle, hv_metrologyrectangleindices,
"measure_transition"
,"uniform");
hoperatorset.
(himage, hv_metrologyhandle)
;//測量出的資訊
hobject ho_measurecontours;
//測量框
hobject ho_cross;
//測量出來的交界點
hoperatorset.
genemptyobj
(out ho_measurecontours)
; hoperatorset.
genemptyobj
(out ho_cross)
; ho_measurecontours.
dispose()
; ho_cross.
dispose()
; hoperatorset.
getmetrologyobjectmeasures
(out ho_measurecontours, hv_metrologyhandle,
"all"
,"all"
,out hv_row1,
out hv_column1)
; hoperatorset.
gencrosscontourxld
(out ho_cross, hv_row1, hv_column1,20,
0.785398);
hwindow.
dispobj
(ho_measurecontours)
;hoperatorset.
getmetrologyobjectresult
(hv_metrologyhandle,
"all"
,"all"
,"result_type"
,"all_param"
,out hv_rectangleparameter)
;//測量出來的矩形框
hobject ho_resultcontour;
hoperatorset.
genemptyobj
(out ho_resultcontour)
; ho_resultcontour.
dispose()
; hoperatorset.
getmetrologyobjectresultcontour
(out ho_resultcontour, hv_metrologyhandle,
"all"
,"all"
,1.5);
hwindow.
dispobj
(ho_resultcontour)
;//測量出矩形的資料
htuple hv_sequence, hv_rectanglerow, hv_rectanglecolumn, hv_rectanglephi, hv_rectanglelength1, hv_rectanglelength2;
hv_sequence = htuple.
tuplegensequence(0
,(newhtuple
(hv_rectangleparameter.
tuplelength()
))-1
,5);
hv_rectanglerow = hv_rectangleparameter.
tupleselect
(hv_sequence)
; hv_rectanglecolumn = hv_rectangleparameter.
tupleselect
(hv_sequence +1)
; hv_rectanglephi = hv_rectangleparameter.
tupleselect
(hv_sequence +2)
; hv_rectanglelength1 = hv_rectangleparameter.
tupleselect
(hv_sequence +3)
; hv_rectanglelength2 = hv_rectangleparameter.
tupleselect
(hv_sequence +4)
;if(hv_rectanglerow.
tuplelength()
== rtcount)
else
hoperatorset.
clearmetrologymodel
(hv_metrologyhandle)
;//釋放hobject
ho_measurecontours.
dispose()
; ho_cross.
dispose()
; ho_resultcontour.
dispose()
;}catch
}
ps
我的部落格不定時分享日常工作中覺得有價值的內容,包括c#、c++、halcon、運動控制等等內容,喜歡的點讚,關注我。
十字鍊錶及其C 實現
最近有個同學在用十字鍊錶做畢設,然後我手癢了就拿過來把他畢設拿過來 翻掉重寫。一方面以前也沒怎麼寫過十字鍊錶,另一方面好久不寫資料結構了隨便找個來練練手。至於他畢設的其他內容嘛應他本人要求結題前就不發了。圖大概一共有4中儲存方式 鄰接矩陣,鄰接表,邊集陣列,十字鍊錶。其實前三種資料結構都十分得好理解...
C 十字鍊錶實現教學計畫編制
問題描述 大學的每個專業都要制定教學計畫。假設任何專業都有固定的學習年限,每學年含兩學期,每學期的時間長度和學分上限值均相等。每個專業開設的課程都是確定的,而且課程在開設時間的安排必須滿足先修關係。每門課程有哪些先修課程是確定的,可以有任意多門,也可以沒有。每門課恰好佔乙個學期。試在這樣的前提下設計...
稀疏矩陣的十字鍊錶實現(C語言實現)
又要從頭學資料結構了。默默挨個實現一遍 實現的功能包括兩個矩陣的加減 相乘 還有轉置 有點繁瑣 湊合看吧 include include typedef int elemtype 稀疏矩陣的十字鍊錶儲存表示 typedef struct olnode olnode,olink typedef str...