halcon-contour_point_num_xld返回XLD轮廓中点的数目_XLD

halcon-contour_point_num_xld返回XLD轮廓中点的数目_XLD_02



在HDevelop中

dev_close_window ()
read_image (Image, 'D:/bb/tu/6.jpg')
rgb1_to_gray (Image, GrayImage)

edges_sub_pix (GrayImage, Edges, 'canny', 1, 5, 10)
select_shape_xld (Edges, SelectedXLD, 'area', 'and', 5500, 5600)

contour_point_num_xld (SelectedXLD, Length)
*返回一个XLD轮廓(contour)中点的数目

get_image_size (GrayImage, Width, Height)

dev_open_window(10,10,Width, Height,'black',WindowHandle1)
dev_display(SelectedXLD)


halcon-contour_point_num_xld返回XLD轮廓中点的数目_XLD_03


 halcon-contour_point_num_xld返回XLD轮廓中点的数目_XLD_04



在QtCreator中

HObject  ho_Image, ho_GrayImage, ho_Edges, ho_SelectedXLD;
HTuple hv_Length, hv_Width, hv_Height, hv_WindowHandle1;
ReadImage(&ho_Image, "D:/bb/tu/6.jpg");
Rgb1ToGray(ho_Image, &ho_GrayImage);

EdgesSubPix(ho_GrayImage, &ho_Edges, "canny", 1, 5, 10);
SelectShapeXld(ho_Edges, &ho_SelectedXLD, "area", "and", 5500, 5600);

ContourPointNumXld(ho_SelectedXLD, &hv_Length);
//返回一个XLD轮廓(contour)中点的数目

GetImageSize(ho_GrayImage, &hv_Width, &hv_Height);

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());