halcon-polar_trans_image_ext将图像中的圆弧变换为极坐标-->圆环拉成直线
作者:互联网
在HDevelop中
表盘.jpg
dev_update_off() read_image(Image,'D:/bb/tu/表盘.jpg') dev_open_window(0,0,610,610,'black',WindowHandle) disp_obj (Image, WindowHandle) ******获取表盘中心坐标、获取表盘图像******** draw_circle (WindowHandle, Row, Column, Radius) gen_circle (Circle, Row, Column, Radius) reduce_domain (Image, Circle, ImageReduced) ****************************************** polar_trans_image_ext (ImageReduced, PolarTransImage, Row, Column, 0, 6.28319, 0, Radius, 610, 610, 'nearest_neighbor') *将图像中的圆弧变换为极坐标-->圆环拉成直线 *参数1:输入图像 *参数2:输出图像 *参数3:圆弧中心的行坐标-y *参数4:圆弧中心的列坐标-x *参数5:起始弧度,默认值:0.0;【0弧度对应表盘的3点,顺时针为正】 *参数6:结束弧度 *参数7:极坐标开始的极长,一般是0 *参数8:极坐标结束的极长,一般是圆半径r *参数9:图片宽 *参数10:图片高 *参数11:插值,值列表:'bilinear', 'nearest_neighbor' dev_open_window(0,0,610,610,'black',WindowHandle1) disp_obj (PolarTransImage, WindowHandle1)
在QtCreator中
HObject ho_Image, ho_Circle, ho_ImageReduced; HObject ho_PolarTransImage; HTuple hv_WindowHandle, hv_Row, hv_Column, hv_Radius; HTuple hv_WindowHandle1;
ReadImage(&ho_Image, //'D:/bb/tu/表盘.jpg' "D:/bb/tu/\350\241\250\347\233\230.jpg"); SetWindowAttr("background_color","black"); OpenWindow(0,0,610,610,0,"visible","",&hv_WindowHandle); HDevWindowStack::Push(hv_WindowHandle); DispObj(ho_Image, hv_WindowHandle); //*****获取表盘中心坐标、获取表盘图像******** DrawCircle(hv_WindowHandle, &hv_Row, &hv_Column, &hv_Radius); GenCircle(&ho_Circle, hv_Row, hv_Column, hv_Radius); ReduceDomain(ho_Image, ho_Circle, &ho_ImageReduced); //***************************************** PolarTransImageExt(ho_ImageReduced, &ho_PolarTransImage, hv_Row, hv_Column, 0, 6.28319, 0, hv_Radius, 610, 610, "nearest_neighbor"); //将图像中的圆弧变换为极坐标-->圆环拉成直线 //参数1:输入图像 //参数2:输出图像 //参数3:圆弧中心的行坐标-y //参数4:圆弧中心的列坐标-x //参数5:起始弧度,默认值:0.0;【0弧度对应表盘的3点,顺时针为正】 //参数6:结束弧度 //参数7:极坐标开始的极长,一般是0 //参数8:极坐标结束的极长,一般是圆半径r //参数9:图片宽 //参数10:图片高 //参数11:插值,值列表:'bilinear', 'nearest_neighbor' SetWindowAttr("background_color","black"); OpenWindow(0,0,610,610,0,"visible","",&hv_WindowHandle1); HDevWindowStack::Push(hv_WindowHandle1); DispObj(ho_PolarTransImage, hv_WindowHandle1);
标签:polar,表盘,image,hv,halcon,参数,ho,610,WindowHandle 来源: https://www.cnblogs.com/liming19680104/p/15943261.html