package yi.iu.processor.clc;

import yi.util.config.*;

/**
 * Construct Orientation Consistent Line Cluster.
 */
public class CLC_Spatial extends CLC_Clustering
{

  public CLC_Spatial() {
    Configuration.configParameters(this);
  }

  public String[] getParameterNames() {
    return super.getParameterNames(null);
  }

  /**
   * Clustering the lines using their orientation information.  A histogram of
   * the orientation of the lines are constructed and histogram shape analysis
   * is used to cluster the lines to different group having similar orientation.
   * A further perspective information based filtering is performed to make the
   * lines in a cluster either parallel to each other or converging to a point.
   * @param lines
   * @param rgb
   * @param width
   * @param height
   * @return
   */
  public LineClusterSets getClusters(LineClusterSet lines, int[] rgb, int width, int height) {

    // vertical position based clustering
    CLC_VerticalPosition vertial_clustering = new CLC_VerticalPosition();
    LineClusterSets line_clusters = vertial_clustering.getClusters(lines, rgb, width, height);

    // horizontal position based clustering
    CLC_HorizontalPosition horizontal_clustering = new CLC_HorizontalPosition();
    line_clusters = horizontal_clustering.getClusters(line_clusters, rgb, width, height);

    // return the final results
    return line_clusters;
  }

}