コード例 #1
0
ファイル: SaliencyMap.cs プロジェクト: YHZX2013/exchange_diff
 public SaliencyMap(LabTiledImage tiledImage)
 {
     if (tiledImage == null)
     {
         throw new ArgumentNullException("tiledImage");
     }
     this.TiledImage = tiledImage;
     this.Initialize();
     this.BuildNeighboringGraph();
     this.BoundaryAnalysis();
     this.InitScores();
     this.UpdateScores();
     this.NormalizeScores();
     this.CreateSaliencyMap();
 }
コード例 #2
0
        private static List <SalientObject> GroupSalientTiles(LabTiledImage saliencyMap, ref float threshold, int minimumGroupSize = 8)
        {
            if (threshold <= 0f || threshold > 1f)
            {
                CountStatistics countStatistics = saliencyMap.CreateStats((LabTile tile) => (double)tile.Saliency);
                threshold = (1f - (float)countStatistics.Average) * 0.6f;
            }
            SaliencyGrouper saliencyGrouper = new SaliencyGrouper(saliencyMap, threshold);
            List <RegionInfo <ArgbPixel, byte, LabTile> > list = saliencyGrouper.Process(minimumGroupSize);

            list.Sort((RegionInfo <ArgbPixel, byte, LabTile> first, RegionInfo <ArgbPixel, byte, LabTile> second) => second.TileCount.CompareTo(first.TileCount));
            return((from region in list
                    select new SalientObject
            {
                Region = region
            }).ToList <SalientObject>());
        }