mahotas
mahotas copied to clipboard
different shape has the same Zernike moments value
as picture shows the i have two different shapes (one is part of the other), but it's strange that i got the same Zernike moments for them when i only use same parameter of center of mass and radius (see the green circle) . I don't know the Zernike foundamentals, so is this reasonable or an issue?
please ignore the green circle and red contour, that's drawed only try to make this question clear. the two original images only have the white object.
Thanks for the report. Could you post some code and the images where you see this issue?
I mean the original images so I can run the example locally without the red and green contours.
!pip install mahotas import mahotas import numpy as np from google.colab.patches import cv2_imshow # this is for google colaborator env, you can use cv2.imshow() instead
thresh = None img = cv2.imread('your_path/11.png',cv2.IMREAD_GRAYSCALE) ret,thresh = cv2.threshold(img,127,255,cv2.THRESH_BINARY) img,contours,hierarchy = cv2.findContours(thresh.copy(), 1, 2)
cnt = sorted(contours, key = cv2.contourArea, reverse = True)[0] (x,y),radius = cv2.minEnclosingCircle(cnt) center = (int(x),int(y)) radius = int(radius) print (center, radius)
z_im = mahotas.features.zernike_moments(thresh, radius, cm=center) print (z_im)
and original pic is as following:
@luispedro did you got the same result for those two images? Thanks a lot!