41、Halcon 报错:Index out of range

创建一个空的Region区域时,假若用的是GenEmptyObj,则用AreaCenter算面积时会报错Index out of range,解决办法:

GenEmptyObj用专门创建Region的算子GenEmptyRegion

 

Dim Reg As HObject = Nothing

HOperatorSet.GenEmptyObj(Reg)

'HOperatorSet.GenEmptyRegion(Reg)

Dim Area1 As Double

Dim X1 As Double

Dim Y1 As Double

HOperatorSet.AreaCenter(Reg, Area1, Y1, X1)

posted @ 2022-05-31 23:50  ihh2021  阅读(654)  评论(0编辑  收藏  举报