Halcon中已知一条直线计算它的垂线与延长线
生成垂线gen_image_const (Image, 'byte', 1000, 1000)********************生成一条直线************************Row1:=100Col1:=500Row2:=500Col2:=100gen_region_line (Line, Row1, Col1, Row2, Col2)*计算该直线的...
·
-
生成垂线
gen_image_const (Image, 'byte', 1000, 1000)
********************生成一条直线************************
Row1:=100
Col1:=500
Row2:=500
Col2:=100
gen_region_line (Line, Row1, Col1, Row2, Col2)
*计算该直线的角度
line_orientation (Row1, Col1, Row2, Col2,Phi)
*计算该直线的中点
RowM:=(Row1+Row2)/2
ColM:=(Col1+Col2)/2
*********************生成垂线*************************
*垂线长度
LineLength:=200(不精确)
*起点
RowStart := RowM-cos(Phi)*LineLength
ColStart := ColM-sin(Phi)*LineLength
*终点
RowEnd := RowM+cos(Phi)*LineLength
ColEnd := ColM+sin(Phi)*LineLength
gen_region_line (Line1, RowStart, ColStart, RowEnd, ColEnd)
-
生成延长线
gen_image_const (Image, 'byte', 1000, 1000)
********************生成一条直线************************
Row1:=100
Col1:=500
Row2:=500
Col2:=100
gen_region_line (Line, Row1, Col1, Row2, Col2)
*获取该直线的位置信息
line_position (Row1, Col1, Row2, Col2, RowCenter, ColCenter, Length, Phi)
*********************生成延长线***********************
*延长线长度(不精确)
LineLength:=200
*起点
RowStart := RowCenter-cos(Phi+1.5708)*LineLength
ColStart := ColCenter-sin(Phi+1.5708)*LineLength
*终点
RowEnd := RowCenter-cos(Phi-1.5708)*LineLength
ColEnd := ColCenter-sin(Phi-1.5708)*LineLength
gen_region_line (Line2, RowStart, ColStart, RowEnd, ColEnd)
DAMO开发者矩阵,由阿里巴巴达摩院和中国互联网协会联合发起,致力于探讨最前沿的技术趋势与应用成果,搭建高质量的交流与分享平台,推动技术创新与产业应用链接,围绕“人工智能与新型计算”构建开放共享的开发者生态。
更多推荐


所有评论(0)