halcon-edges_image计算边缘
在HDevelop中
dev_close_window () read_image (Image, 'D:/bb/tu/1.jpg') rgb1_to_gray (Image, GrayImage) edges_image (GrayImage, ImaAmp, ImaDir, 'canny', 1, 'nms', 20, 40) *计算边缘 *参数1:输入图像 *参数2:输出图像 *参数3:图像边缘方向 *参数4:边缘算子 * 'canny' * 'deriche1' * 'deriche1_int4' * 'deriche2' * 'deriche2_int4' * 'lanser1' * 'lanser2', 'mshen', 'shen', 'sobel_fast' *参数5:迭代次数,小的值导致强平滑,但是更少的细节(canny算子相反) *参数6:非最大抑制(设置为none,表示不需要使用该值) *参数7:低阈值(如果不需要阈值设置,则为负值) *参数8:高阈值(如果不需要阈值设置,则为负值),高阈值一般是低阈值的1.5-2倍 get_image_size (GrayImage, Width, Height) dev_open_window(10,10,Width, Height,'black',WindowHandle) dev_display(ImaAmp) dev_open_window(10,10,Width, Height,'black',WindowHandle1) dev_display(GrayImage)
在QtCreator中
HObject ho_Image, ho_GrayImage, ho_ImaAmp, ho_ImaDir;
HTuple hv_Width, hv_Height, hv_WindowHandle;
HTuple hv_WindowHandle1;
ReadImage(&ho_Image, "D:/bb/tu/1.jpg"); Rgb1ToGray(ho_Image, &ho_GrayImage); EdgesImage(ho_GrayImage, &ho_ImaAmp, &ho_ImaDir, "canny", 1, "nms", 20, 40); //计算边缘 //参数1:输入图像 //参数2:输出图像 //参数3:图像边缘方向 //参数4:边缘算子 // 'canny' // 'deriche1' // 'deriche1_int4' // 'deriche2' // 'deriche2_int4' // 'lanser1' // 'lanser2', 'mshen', 'shen', 'sobel_fast' //参数5:迭代次数,小的值导致强平滑,但是更少的细节(canny算子相反) //参数6:非最大抑制(设置为none,表示不需要使用该值) //参数7:低阈值(如果不需要阈值设置,则为负值) //参数8:高阈值(如果不需要阈值设置,则为负值),高阈值一般是低阈值的1.5-2倍 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_ImaAmp, 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_GrayImage, HDevWindowStack::GetActive());
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 震惊!C++程序真的从main开始吗?99%的程序员都答错了
· 别再用vector<bool>了!Google高级工程师:这可能是STL最大的设计失误
· 【硬核科普】Trae如何「偷看」你的代码?零基础破解AI编程运行原理
· 单元测试从入门到精通
· 上周热点回顾(3.3-3.9)
2019-03-12 matplotlib-2D绘图库-面向对象