如何排序从顶部到底部的轮廓:opencv的,Android的

编程入门 行业动态 更新时间:2024-10-25 14:34:06
本文介绍了如何排序从顶部到底部的轮廓:opencv的,Android的的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我已经发现了轮廓,但问题是该findcontours()返回轮廓以随机顺序像在轮廓(0)它显示从页面的中间部分sontour。我怎么可以垂直对它们进行排序?从上到下,然后从左向右?下面给出我水平连接的组件连接着各个MCQ与他们的选择,然后应用findcontours(图像),现在我想他们,他们应该按顺序检索的进行排序

I have found the contour but the problem is that the findcontours() returns contours in random order like at contour(0) it shows some sontour from middle of the page. How can I sort them vertically? From top to bottom and then left to right? Given the image below I connected the components horizontally and connected every MCQ with their choices and then applied findcontours() and Now I want to sort them in an order that they should be retrieved sequentially

推荐答案

您具备的功能 boundingRect :有了,你可以找到的点周围的矩形边框的左上点。然后,你可以定义一个排序功能,基于这点对于每个轮廓的位置定购轮廓。

You have the function boundingRect: With that you can find the topleft point of a bounding rectangle around the points. Then you can define a sorting function that orders the contours based on the location of this point for each contour.

更多推荐

如何排序从顶部到底部的轮廓:opencv的,Android的

本文发布于:2023-05-26 20:20:45,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/265230.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:轮廓   opencv   Android

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!