I'm working on the extraction of image characteristics, in which I'm trying to identify if a certain image is symmetric or not. I am using opecv - python for the development of this work.
The code below is used to identify the center and the diameter of the region of interest. How could you know if this image is symmetrical or not?
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, 'Centro: '+str(center), fontsize=11, color = 'red')
plt.text(340, -10, 'Diametro: '+str((radius*2)/100)+'mm', fontsize=11, color = 'red')
plt.Circle((10, -10), 7.2, color='blue')
plt.imshow(thresh, cmap='gray')
#plt.savefig(IMG+'-diam.png')
plt.show()
In the case, I am wanting to classify if the spot I am analyzing is symmetric or not, the image below, visually it is noted that it is not symmetrical, while the first image of the above plot is symmetrical.


