Cluster img

From Eigenvector Research Documentation Wiki
Revision as of 13:43, 29 September 2009 by imported>Scott (New page: ===Purpose=== Perform automatic clustering of image using sample distances. ===Synopsis=== :[clas,basis,info,h] = cluster_img(x,nclusters,options) :clas = cluster_img(x,basis,options) ...)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Purpose

Perform automatic clustering of image using sample distances.

Synopsis

[clas,basis,info,h] = cluster_img(x,nclusters,options)
clas = cluster_img(x,basis,options)

Description

Automatically identifies unique pixels in a given image and classifies all other pixels as to which of the unique pixels they are closest to. Pixels are chosen using the DISTSLCT algorithm, the selected samples are normalized to unit length and the remaining pixels are projected onto that basis to determine distances. Although significantly faster, this algorithm returns slightly different results than knn clustering.

Inputs

  • [clas,basis,info,h] = cluster_img(x,nclusters,options)
    The data to cluster (x), the total number of clusters to form
    (nclusters), and an optional (options) structure (see below), or
  • [clas,basis,info,h] = cluster_img(x,max_fract,options)
    The data to cluster (x), the maximum fraction of samples allowed in
    a cluster (max_fract), and an optional (options) structure (see
    below), or
  • clas = cluster_img(x,basis,options)
    A "prediction" call given the data to cluster (x), a previously
    calculated basis set returned by cluster_img (basis), and an
    optional (options) structure.


Optional Inputs

  • second = optional second input is this.

Outputs

Outputs are a vector of integer classes for each sample in x clas, the corresponding normalized basis spectra basis, information on the targets and correlation info, and the handle h of a figure if created. The output info is a structure containing the following fields:

  • corr = the correlation of each pixel to each target.
  • targets = the indices of the pixels used as targets.


Options

options = a structure array with the following fields:

  • plots: [ {'none'} | 'final' ] governs plotting of results, and
  • plots: [ 'none' |{'final'}] governs plotting of results.
  • algorithm: [ 'distslct' |{'kmeans'}] algorithm for determining classes distslct is based solely on most unique samples; kmeans adjusts class target to mean of class (iterative).
  • minarea: { 1 } minimum area (in %) that a class must account for to be retained as a unique class.
  • preprocessing: { [] } preprocessing structure (see PREPROCESS).
  • pca: [ {'no'} | 'yes' ] When 'yes', A PCA model is calculated from the data and the scores are used to perform clustering. The output basis is in terms of the original variables.
  • ncomp: [ 1 ] Number of PCs (components) to retain from the PCA model. Only used if options.pca is 'yes'.

See Also

cluster, distslct, knn