简体   繁体   English

使用PILLOW(PIL)检测简单的几何形状

[英]Detect simple geometric shapes using PILLOW(PIL)

I have this project were I need Python to detect simple geometric shapes inside an image. 我有这个项目,我需要Python来检测图像中的简单几何形状。 Only using Pillow, for example: 仅使用枕头,例如:

在此输入图像描述

After searching the internet, I still don't know how to achieve this. 在搜索互联网后,我仍然不知道如何实现这一目标。 Thanks in advance for any help 在此先感谢您的帮助

Get edges first. 首先获得边缘。

Magnitude = sqrt(dx2+dy2)

Threshold and convert to 0,1 magnitude image. 阈值并转换为0,1幅度图像。 Follow lines and look for corners, following perimeters of shapes. 沿着线条寻找角落,沿着形状的周长。

Or write more complex corner detection algorithms as found in OpenCV . 或者编写OpenCV更复杂的角点检测算法。

Shape is based in number of corners found. 形状基于找到的角数。 (Looks like GTKbai !) (看起来像GTKbai !)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM