HALCON数组的增加 删除操作 二

注意,记录删除的数组的 开始索引和结束索引


*加载图片
read_image(Image1, './tup1/hei1.bmp')
get_image_size (Image1, Width, Height)
dev_close_window ()
dev_open_window_fit_size (0, 0, Width, Height, -1, -1, WindowHandle)
dev_display (Image1)


********************************************************************
RowS1:=[]
ColS1:=[]
num_s:=[]

draw_nurbs(ContOutA, 3600, 'true', 'true', 'true', 'true', 3, RowsA, ColsA, Weights)
gen_contour_nurbs_xld(Contour2,  RowsA, ColsA, 'auto', 'auto', 3, 1, 5)
RowS1:=[RowS1,RowsA]
ColS1:=[ColS1,ColsA]
tuple_length (RowsA, Length)
num_s:=[num_s,Length]


draw_nurbs(ContOutB, 3600, 'true', 'true', 'true', 'true', 3, RowsB, ColsB, Weights)
RowS1:=[RowS1,RowsB]
ColS1:=[ColS1,ColsB]
tuple_length (RowsB, LengthB)
num_s:=[num_s,LengthB]

gen_contour_nurbs_xld(Contour2,  RowsA, ColsA, 'auto', 'auto', 3, 1, 5)

******************************************************************************
** 删除刚才画的那个轨迹,也就是最后一次画的轨迹
tuple_length (num_s, Length2)
** 要删除的 轨迹段的轨迹点个数
aaaa:=num_s[Length2-1]
** 轨迹索引数组 删除
tuple_remove (num_s, Length2-1, num_s)
tuple_length (num_s, Length3)

** 轨迹点数组 删除
tuple_length (RowS1, Length4)
AAAAAAA_ROW:=RowS1[0:(Length4-aaaa-1)]
AAAAAAA_COL:=ColS1[0:(Length4-aaaa-1)]

RowS1:=AAAAAAA_ROW
ColS1:=AAAAAAA_COL
dev_clear_window ()
dev_display (Image1)
gen_contour_nurbs_xld(Contour2,  RowS1, ColS1, 'auto', 'auto', 3, 1, 5)

**************************************************************************************
draw_nurbs(ContOutC, 3600, 'true', 'true', 'true', 'true', 3, RowsC, ColsC, Weights)
RowS1:=[RowS1,RowsC]
ColS1:=[ColS1,ColsC]

*打印对应的点
dev_clear_window()
dev_display(Image1)
** 首尾会闭合,中间的都会闭合
** 如果没有这个,就会首尾不闭合,但是中间的都会闭合
RowS1:=[RowS1,RowS1[0]]
ColS1:=[ColS1,ColS1[0]]
gen_contour_nurbs_xld(Contour2, RowS1, ColS1, 'auto', 'auto', 3, 1, 5)
get_contour_xld (Contour2, Row, Col)
hv_MRow := Row
hv_MColumn :=Col
write_tuple(RowS1, 'RowS1.tup')
write_tuple(ColS1, 'RowS1.tup')


stop ()
stop ()
stop ()
*****************************************************************




*加载图片
read_image(Image1, './tup1/hei2_GrayImage_zheng.bmp')
get_image_size (Image1, Width, Height)
dev_close_window ()
dev_open_window_fit_size (0, 0, Width, Height, -1, -1, WindowHandle)
dev_display (Image1)

read_tuple('./tup1/x_hei2.tup',RowS)
read_tuple('./tup1/y_hei2.tup',ColumnS)
tuple_length(RowS, Length1)
* stop()
* gen_empty_obj(CrossS)
* for I:= 0 to Length1-2 by 1
*     gen_cross_contour_xld(Cross1, RowS[I], ColumnS[I], 10, 0.785398) 
*     gen_nurbs_interp (RowS[I], ColumnS[I], [], 3, CtrlRows, CtrlCols, Knots)
    *draw_nurbs(ContOut, 3600, 'true', 'true', 'true', 'true', 3, Rows, Cols, Weights)
*     concat_obj(CrossS, Cross1, CrossS)
*     disp_message(3600, I, 'image', RowS[I], ColumnS[I], 'black', 'true')
* endfor
stop ()
RowS1:=[]
ColS1:=[]
num_s:=[]


draw_nurbs(ContOutA, 3600, 'true', 'true', 'true', 'true', 3, RowsA, ColsA, Weights)
* gen_nurbs_interp (RowS, ColumnS, [], 3, CtrlRows, CtrlCols, Knots)


RowS1:=[RowS1,RowsA]
ColS1:=[ColS1,ColsA]
tuple_length (RowsA, LengthA)
num_s:=[num_s,LengthA]

draw_nurbs(ContOutB, 3600, 'true', 'true', 'true', 'true', 3, RowsB, ColsB, Weights)

RowS1:=[RowS1,RowsB]
ColS1:=[ColS1,ColsB]



tuple_length (RowS1, Length1)
tuple_length (RowsB, LengthB)
num_s:=[num_s,LengthB]


draw_nurbs(ContOutC, 3600, 'true', 'true', 'true', 'true', 3, RowsC, ColsC, Weights)

RowS1:=[RowS1,RowsC]
ColS1:=[ColS1,ColsC]

tuple_length (RowsC, LengthC)
num_s:=[num_s,LengthC]


tuple_length (num_s, Length_num)

stop ()
dev_clear_window ()
dev_display (Image1)

asd:=0
for I := 0 to Length_num-1 by 1
   aa:= num_s[I]
   *Pose[Index2 * 7:Index2 * 7 + 6]
   rs:=RowS1[asd:asd+aa-1]
   cs:=ColS1[asd:asd+aa-1]
   gen_contour_nurbs_xld(Contour1, rs, cs, 'auto', 'auto', 3, 1, 5)
   asd:=asd+aa
endfor

for Index := 0 to Length_num-1 by 1
    tuple_remove (Index, Index, Reduced)
endfor


** 保留其中一段
* RowS1:=RowS1[0:(Length1-LengthB-1)]
* ColS1:=ColS1[0:(Length1-LengthB-1)]

stop ()
*打印对应的点
dev_clear_window()
dev_display(Image1)
** 首尾不会闭合,中间的都会闭合
RowS1:=[RowS1,RowS1[0]]
ColS1:=[RowS1,ColS1[0]]
gen_contour_nurbs_xld(Contour2, RowS1, ColS1, 'auto', 'auto', 3, 1, 5)
get_contour_xld (Contour2, Row, Col)

write_tuple(RowS1, 'RowS1.tup')
write_tuple(ColS1, 'RowS1.tup')






评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值