public KMeansClusterFactory(ClusterDataSourceSettings settings, IClusterMergeStrategy mergeStrategy, IntSize size) { this.settings = settings; this.mergeStrategy = mergeStrategy; this.algorithm = new KMeans(this.settings.ClusterCount, settings.DepthRange, size); this.value = new ClusterCollection(); }
public IClusterDataSource CreateClusterDataSource(ClusterDataSourceSettings clusterDataSourceSettings) { var size = new IntSize(this.Adapter.DepthStreamWidth, this.Adapter.DepthStreamHeight); var clusterFactory = new KMeansClusterFactory(clusterDataSourceSettings, size); var filter = new ImageFrameDepthPointFilter(this.Adapter, size, clusterDataSourceSettings.MinimumDepthThreshold, clusterDataSourceSettings.MaximumDepthThreshold, clusterDataSourceSettings.LowerBorder); return new SDKClusterDataSource(this.Adapter, clusterFactory, filter); }
public IList<ClusterPrototype> CreateClusters(int numberOfClusters, IntSize areaSize) { Contract.Requires(numberOfClusters >= 0); Contract.Requires(areaSize.Width > 0 && areaSize.Height > 0); var result = new List<ClusterPrototype>(); float sliceWidth = areaSize.Width / numberOfClusters; float sliceHeight = areaSize.Height / numberOfClusters; for (int index = 0; index < numberOfClusters; index++) { int minX = (int)((index) * sliceWidth); int maxX = (int)((index + 1) * sliceWidth); int minY = (int)((index) * sliceHeight); int maxY = (int)((index + 1) * sliceHeight); result.Add(this.CreateClusterWithin(minX, maxX, minY, maxY)); } return result; }
public KMeansClusterFactory(ClusterDataSourceSettings settings, IntSize size) : this(settings, new DefaultMergeStrategy(settings), size) { }
public KMeans(int numberOfClusters, Range zRange, IntSize size) { this.size = size; this.zRange = zRange; this.clusters = clusterFactory.CreateClusters(numberOfClusters, size); }