Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
3.9k views
in Technique[技术] by (71.8m points)

JS通过canvas识别图形

https://ostack.cn/a/11...

请问大家canvas识别图片中指定的某一种图形有什么思路吗?比如识别图片中的长方形(长方形可能经过旋转,不一定是横平竖直)


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

我能想到办法就是,按照链接上的文章识别出图形后,再把每个图形0-360旋转一次,识别出每次旋转后的新形状,发现接近或等于横平竖直的就是矩形。

或者设法确定4个顶点,判断相对两组顶点连线是否平行,相邻顶点连线是否直角。

具体还不知道能不能实现,性能怎么样。


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...