ReadImage(&ho_Image, "D:/bb/tu/1.jpg");
Rgb1ToGray(ho_Image, &ho_GrayImage);
EdgesSubPix(ho_GrayImage, &ho_Edges, "canny", 1, 5, 10);
//亚像素边缘
SelectShapeXld(ho_Edges, &ho_SelectedXLD, (HTuple("contlength").Append("area")),
"and", (HTuple(108).Append(700)), (HTuple(109).Append(800)));
SelectShapeXld(ho_Edges, &ho_SelectedXLD1, (HTuple("contlength").Append("area")),
"and", (HTuple(83).Append(376)), (HTuple(84).Append(377)));
Union2ClosedContoursXld(ho_SelectedXLD, ho_SelectedXLD, &ho_ContoursUnion);
//封闭轮廓
//参数1和参数2就一个轮廓时,轮廓端点直接连线封闭
//参数3:输出轮廓
Union2ClosedContoursXld(ho_SelectedXLD, ho_SelectedXLD1, &ho_ContoursUnion1);
//参数1和参数2是两个轮廓时,就近封闭
//get_contour_xld
GetImageSize(ho_GrayImage, &hv_Width, &hv_Height);
SetWindowAttr("background_color","black");
OpenWindow(10,10,hv_Width,hv_Height,0,"visible","",&hv_WindowHandle);
HDevWindowStack::Push(hv_WindowHandle);
if (HDevWindowStack::IsOpen())
DispObj(ho_ContoursUnion, HDevWindowStack::GetActive());
SetWindowAttr("background_color","black");
OpenWindow(10,10,hv_Width,hv_Height,0,"visible","",&hv_WindowHandle1);
HDevWindowStack::Push(hv_WindowHandle1);
if (HDevWindowStack::IsOpen())
DispObj(ho_SelectedXLD, HDevWindowStack::GetActive());
SetWindowAttr("background_color","black");
OpenWindow(10,10,hv_Width,hv_Height,0,"visible","",&hv_WindowHandle2);
HDevWindowStack::Push(hv_WindowHandle2);
if (HDevWindowStack::IsOpen())
DispObj(ho_SelectedXLD, HDevWindowStack::GetActive());
if (HDevWindowStack::IsOpen())
DispObj(ho_SelectedXLD1, HDevWindowStack::GetActive());
SetWindowAttr("background_color","black");
OpenWindow(10,10,hv_Width,hv_Height,0,"visible","",&hv_WindowHandle3);
HDevWindowStack::Push(hv_WindowHandle3);
if (HDevWindowStack::IsOpen())
DispObj(ho_ContoursUnion1, HDevWindowStack::GetActive());