python怎么编写对称图案_如何使用opencvpython识别图像的形状是对称的还是不对称的?...

本文探讨了如何使用OpenCV-Python库来分析图像并判断其是否具有对称性。通过找到图像的感兴趣区域中心和直径,代码示例展示了如何识别图像的对称特性。虽然视觉上可以明显区分某些图像的对称性,但自动化这一过程对于图像特征提取具有重要意义。
摘要由CSDN通过智能技术生成

我正在研究图像特征的提取,在这个过程中,我试图确定某个图像是否对称。我使用opecv-python开发这项工作。在

下面的代码用于标识感兴趣区域的中心和直径。你怎么知道这个图像是否对称?在import cv2

import numpy as np

import matplotlib.pyplot as plt

from matplotlib.offsetbox import AnchoredText

IMG = '015'

thresh = cv2.imread(IMD+'.png',0)

_, contours,hierarchy = cv2.findContours(thresh,2,1)

print (len(contours))

cnt = contours

for i in range (len(cnt)):

(x,y),radius = cv2.minEnclosingCircle(cnt[i])

center = (int(x),int(y))

radius = int(radius)

cv2.circle(thresh,center,radius,(0,255,0),2)

print ('Circle: ' + str(i) + ' - Center: ' + str(center) + ' - Radius: ' + str(radius))

plt.text(x-21, y+15, '+', fontsize=25, color = 'red')

plt.text(10, -10, '

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值