儿女传奇之闹婚记,海上牧云记下载,武夷山列车时刻表
hough圆检测和hough线检测的原理近似,对于圆来说,在参数坐标系中表示为c:(x,y,r)。
函数:
imgproc.houghcircles(mat image, mat circles, int method, double dp, double mindist, double param1, double param2, int minradius, int maxradius)
参数说明:
image:源图像
circles:检测到的圆的输出矢量(x,y,r)
method:使用的检测方法,目前只有一种imgproc.hough_gradient
dp:检测圆心的累加器图像与源图像之间的比值倒数
mindist:检测到的圆的圆心之间的最小距离
param1:method设置的检测方法对应参数,针对hough_gradient,表示边缘检测算子的高阈值(低阈值是高阈值的一半),默认值100
param2:method设置的检测方法对应参数,针对hough_gradient,表示累加器的阈值。值越小,检测到的无关的圆
minradius:圆半径的最小半径,默认为0
maxradius:圆半径的最大半径,默认为0(若minradius和maxradius都默认为0,则houghcircles函数会自动计算半径)
示例代码:
public static void main(string[] args) { system.loadlibrary(core.native_library_name); mat src = imgcodecs.imread("f:\\websbook_com_1589226.jpg"); mat dst = src.clone(); imgproc.cvtcolor(src, dst, imgproc.color_bgr2gray); mat circles = new mat(); imgproc.houghcircles(dst, circles, imgproc.hough_gradient, 1, 100, 440, 50, 0, 345); // imgproc.houghcircles(dst, circles, imgproc.hough_gradient, 1, 100, // 440, 50, 0, 0); for (int i = 0; i < circles.cols(); i++) { double[] vcircle = circles.get(0, i); point center = new point(vcircle[0], vcircle[1]); int radius = (int) math.round(vcircle[2]); // circle center imgproc.circle(src, center, 3, new scalar(0, 255, 0), -1, 8, 0); // circle outline imgproc.circle(src, center, radius, new scalar(0, 0, 255), 3, 8, 0); } imgcodecs.imwrite("f:\\dst2.jpg", src); }
源图像:
输出图像:
以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持移动技术网。
如对本文有疑问,请在下面进行留言讨论,广大热心网友会与你互动!! 点击进行留言回复
浅析我对 String、StringBuilder、StringBuffer 的理解
使用IDEA搭建SSM框架的详细教程(spring + springMVC +MyBatis)
Springboot整合freemarker 404问题解决方案
引入mybatis-plus报 Invalid bound statement错误问题的解决方法
网友评论