使用OpenCV和Visual C ++查找轮廓的中心 [英] Finding the center of a contour using opencv and visual c++

查看:70
本文介绍了使用OpenCV和Visual C ++查找轮廓的中心的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想不做太多计算就找到轮廓的中心.在opencv中有内置的功能吗?

I want to find the center of a contour without doing so much calculations. Is there a built in function for that in opencv?

推荐答案

,获取对于质心",请获取 moments()轮廓,然后:

for the 'center of mass' get the moments() of the contour, then:

   cx = m.m10 / m.m00;   cy = m.m01 / m.m00;

这篇关于使用OpenCV和Visual C ++查找轮廓的中心的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆