OpenCV:findContours():轮廓如何排序? [英] OpenCV: findContours(): how contours are ordered?

查看:2316
本文介绍了OpenCV:findContours():轮廓如何排序?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我们要根据某个阈值查找给定图像的轮廓时,可以使用

When we want to find the contours of a given image according to a certain threshold, we use the function cv2.findContours() which returns among other things, the list of contours (a Pythonic list of arrays representing contours of the picture).

这里是使用该功能的方法:

contours, hierarchy = cv2.findContours(thresh,cv2.RETR_TREE,cv2.CHAIN_APPROX_SIMPLE)

我的问题:

OpenCV用于订购国家/地区的订单是什么?

What is the order that OpenCV uses toorder the countours ?

我的意思是说该轮廓位于位置0 上,另一个位于位置1 上,依此类推?

I mean on which criterion it says this contour is in position 0, the other in position 1 and so on ?

我需要这些信息,因为我想知道我的程序正在处理哪个轮廓,以及为什么要赋予该轮廓或该位置.

I need this information because I want to know which contour I am dealing with in my program and why it is given this or that position.

希望您不会结束我的问题,我只是一个初学者.

Hope you won't close my question, I am just a beginner.

推荐答案

我不完全理解这个问题,但根据我的理解,轮廓位置基于图像的x和y像素坐标,这就是返回的矢量列表包含.因此可以肯定的标准是它们在图像上的位置. (请将此作为评论)

I do not fully understand the question but from my understanding the Contour positions are based on the x and y pixel coordinates of the image which is what the returned vector list contain. So surely the criterion is they're position on the image. (Please consider this as a comment)

这篇关于OpenCV:findContours():轮廓如何排序?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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