python-3.x - 从列表中删除 cv2.KeyPoint 对象
问题描述
我正在尝试检测图像中的某些圆圈。我确实设法检测到所有圈子,但是当我尝试删除其中一些时,它失败了。
# Detect blobs
keypoints = detector.detect(image) # creates list with elements of the class cv2.KeyPoint
print(len(keypoints)) # prints 263
for key in keypoints:
if key.size > 50:
keypoints.remove(key)
print(len(keypoints)) # prints 131
只有大约 20 个小于 50 的圆圈(我打印了每个圆圈的大小),所以我无法删除一半想要的元素。
我不知道为什么它不起作用,很想为你提供帮助
谢谢!
解决方案
推荐阅读
- python - 为什么隐藏对 dash_html_components.Label 不起作用?
- pandas - Groupby 两列的总和并在熊猫中创建新的数据框
- slurm - 无法在 debian 9 中安装 slurm seff (stretch)
- python-3.7 - 无法通过 pipenv 安装 ccxt.pro - pipenv 需要 #egg 片段来控制版本控制依赖项
- visual-studio-code - Visual Studio Code - 使 Intellisense 完成其他文件中的关键字
- spring-boot - Spring Boot Web 客户端 XML
- javascript - 在 Rails 6 上未定义 Instantclick
- nginx - 使用 kubernetes 秘密使 nginx 可配置?
- forms - Sysmfony 4.4 - TimeType 选项中带有“约束”的测试表单生成 UndefinedOptionsException
- java - Api 21 上的工具栏项目 MaterialButton 中的颜色错误