I’m trying to determine how uniform the color is across the top of a mandarin (the mandarin is already segmented). I’m working with the CIELAB color space. I tried a statistical analysis using standard deviation, so the mandarin with the highest standard deviation in channel A and channel B would be the least uniform mandarin. This analysis didn’t work for me. I wanted to post on this forum and find out if anyone has done similar work.
Thank you very much for reading. I welcome any information.
image_read = cv2.imread(image_path)
image_rgb = cv2.cvtColor(image_read, cv2.COLOR_BGR2RGB)/255.0
image_lab = cv2.cvtColor(image_rgb.astype(np.float32), cv2.COLOR_RGB2Lab)
# Máscara para eliminar fondo
gray = cv2.cvtColor(image_rgb.astype(np.float32), cv2.COLOR_RGB2GRAY)
#Valores menores a mask. mask contiene los índices de los pixeles mayores a gray
mask = gray > 8/255
# Separar canales
L, A, B = cv2.split(image_lab)
# Filtrar con la máscara
L_mandarina = L[mask] #Va de 0 a 100
A_mandarina = A[mask] #Va de -128 a 127
B_mandarina = B[mask] #Va de -128 a 127
#Cálculo de la desviación estándar
std_a=np.std(A_mandarina)
std_b=np.std(B_mandarina)