Last active
December 20, 2015 06:19
-
-
Save dbuscombe-usgs/6085362 to your computer and use it in GitHub Desktop.
Auto classify images part 2. Compile a list of images, and carry out a cluster analysis
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
imlist=[] | |
for infile in glob.glob( os.path.join(path, '*.jpg') ): | |
imlist.append(infile) | |
imlist=np.sort(imlist) | |
features = np.zeros([len(imlist),512]) | |
for i,f in enumerate(imlist): | |
im = np.array(Image.open(f)) | |
h, edges = np.histogramdd(im.reshape(-1,3),8,normed=True, range=[(0,255),(0,255),(0,255)]) | |
features[i] = h.flatten() | |
import hcluster | |
tree = hcluster(features) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment