0

I use the gmm to create a binary image from a grayscale image - effectively to segment particle regions with higher gray value than surroundings (Figure ai and bi). However, the particle region is assigned to 1 or 0 (True and Falsae for my purposes) depending on the order gmm components are found - see Figure aii and aii. gmm segmentation of particles to numpy masks

I think the gmm_model from which gmm_labels = gmm_model.predict(particle_img.reshape((particle_img.size,1)) are obtained needs to be ordered by the gmm_model.means_ somehow, but I am not sure how to do this.

Then to completion: segmented_img = gmm_labels.reshape(particle_img.shape[0],particle_img.shape[1])

Any help much appreciated.

0 Answers0