如何在Imutils库中使用相关功能

发布于 2025-01-24 12:46:49 字数 323 浏览 4 评论 0原文

关于iMutils与OpenCV相关的库,我有以下问题:

  1. Contours.Sort_Contours()

    的函数是什么。
  2. (cnts,_)= Contours.sort_contours(cnts)在上述语句中,(CNTS,_)的含义是什么,尤其是' _'

注意:cnts是一个包含识别图像轮廓的变量 我的英语不是很好,对不起!谢谢大家的回答和帮助!

Regarding the imutils library related to OpenCV, I have the following questions:

  1. What is the function of contours.sort_contours()?

  2. (cnts, _) = contours.sort_contours(cnts) In the above statement, what is the meaning of (cnts, _), especially '_'

Note: cnts is a variable containing the contours of the recognized image
My English is not very good, sorry! Thank you all for your answers and help!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

一桥轻雨一伞开 2025-01-31 12:46:49

iMutils库是一个便利库编写,以使基本的图像处理任务更容易( https:/ /Github.com/pyimagesearch/imutils )。

这样的任务之一是在图像中对轮廓进行排序和标记。基于在此提供的文档,有一个单独的<代码> Contours.py 文件托管sort_contours()label_contour函数。 (您需要记住,这些功能只能在使用openCV找到轮廓后才使用)

现在回答您的问题:

1。 Contours.sort_contours()

  • 我会把您推荐给此处的示例代码。在第35行中,作者从文件 contours.py 以这种方式访问​​函数sort_contour()contours.sortsors.sort_contours()
  • 该功能接受两个参数:轮廓和排序布置(“ 左右”,“” 左右左右“,” -bottom “,” toyt-top-top “)
  • 该功能返回排序轮廓及其相应边界框的列表

2。理解(cnts,_)= Contours.Sort_Contours(CNTS)

  • 如前所述,该功能接受轮廓为输入cnts
  • 相同的变量cnts用于存储排序的轮廓。
  • 由于该函数返回双输出(排序轮廓及其边界框),因此分配了第二个变量_,该变量存储了边界框。 _在不需要进一步处理时大多使用变量。

The imutils library is a convenience library written to make basic image processing tasks easier (https://github.com/PyImageSearch/imutils).

One such task is sorting and labelling contours in images. Based on documentation provided here, there is a separate contours.py file hosting sort_contours() and label_contour functions. (You need to remember that these functions can be used only after finding contours using OpenCV)

Now to answer your questions:

1. What is the function of contours.sort_contours() ?

  • I will refer you to a sample code here. In line 35, the author accesses the function sort_contour() from the file contours.py in this way: contours.sort_contours().
  • The function accepts two parameters: the contours and the sorting arrangements ("left-to-right", "right-to-left", "top-to-bottom", "bottom-to-top")
  • The function returns a list of the sorted contours and its corresponding bounding boxes

2. Understanding (cnts, _) = contours.sort_contours(cnts)

  • As stated previously, the function accepts contours as input cnts.
  • The same variable cnts is used to store the sorted contours.
  • Since the function returns dual output (sorted contours and its bounding boxes), the second variable is assigned _, which stores the bounding boxes. _ is mostly used a variable when it will not be needed for further processing.
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文