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)