当前位置: 首页>>代码示例>>C#>>正文


C# SortedSet.Overlaps方法代码示例

本文整理汇总了C#中SortedSet.Overlaps方法的典型用法代码示例。如果您正苦于以下问题:C# SortedSet.Overlaps方法的具体用法?C# SortedSet.Overlaps怎么用?C# SortedSet.Overlaps使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在SortedSet的用法示例。


在下文中一共展示了SortedSet.Overlaps方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: SetupFeatureParams


//.........这里部分代码省略.........
            double[] colorToCNSaliency = new double[swatches.lab.Count()];
            double avgE = 0;
            for (int i = 0; i < swatches.lab.Count(); i++)
            {
                CIELAB s = swatches.lab[i];
                double sal = colorNames.Saliency(s);
                minE = Math.Min(minE, sal);
                maxE = Math.Max(maxE, sal);
                avgE += sal;
                colorToCNSaliency[i] = sal;
            }
            avgE /= swatches.lab.Count();
            avgE = (avgE - minE) / (maxE - minE);

            //find the avg and max color name distance between swatches
            double maxN = Double.NegativeInfinity;
            double avgN = 0;
            for (int i = 0; i < scount; i++)
            {
                for (int j = i + 1; j < scount; j++)
                {
                    double val = 1 - colorNames.CosineDistance(swatches.lab[i], swatches.lab[j]);
                    avgN += val;
                    maxN = Math.Max(maxN, val);
                }
            }
            avgN /= ((scount - 1) * scount / 2);

            //cache the distance between image colors and swatches
            Dictionary<Tuple<int, int>, double> imageSwatchDist = new Dictionary<Tuple<int, int>, double>();
            int[,] binAssignments = new int[image.Width, image.Height];
            int[] swatchIdxToBin = new int[swatches.colors.Count()];

            if (included.Overlaps(options.NameCovFeatures))
            {
                for (int i = 0; i < image.Width; i++)
                {
                    for (int j = 0; j < image.Height; j++)
                    {
                        CIELAB c = imageLAB[i, j];
                        for (int s = 0; s < swatches.lab.Count(); s++)
                        {
                            int a = colorNames.GetBin(imageLAB[i, j]);
                            int b = colorNames.GetBin(swatches.lab[s]);

                            binAssignments[i, j] = a;
                            swatchIdxToBin[s] = b;

                            GetCNDist(a, b);

                        }
                    }
                }
            }

            //segment to total saliency
            Segmentation seg = LoadSegAssignments(key, image.Width, image.Height, imageLAB);
            double[] segmentToSaliency = new double[seg.numSegments];
            double[] segmentToSD = new double[seg.numSegments];

            for (int i = 0; i < image.Width; i++)
            {
                for (int j = 0; j < image.Height; j++)
                {
                    int id = seg.assignments[i, j];
                    segmentToSaliency[id] += mapData[i, j];
开发者ID:dritchie,项目名称:SceneColorMaterial,代码行数:67,代码来源:PaletteExtractor.cs

示例2: LoadRepository

 void LoadRepository(ChunkRepository cr)
 {
     Log.WriteLine ("Database.LoadRepository()");
     SortedSet<byte[]> pendingData = new SortedSet<byte[]> (ByteSequenceComparer.Shared);
     var e = cr.Ldata.EnumerateKeys ();
     while (e.MoveNext ())
         pendingData.Add (e.Current);
     while (pendingData.Count != 0)
         foreach (var nchunk in new SortedSet<byte[]>(pendingData, ByteSequenceComparer.Shared)) {
             //Log.WriteLine ("Testing object");
             byte[][] deps = cr.LdataDependencies.Get (nchunk);
             if (deps == null)
                 throw new InvalidDataException ();
             Log.WriteLine ("dependency count = {0}", deps.Length);
             if (pendingData.Overlaps (deps)) {
                 Log.WriteLine ("Found an unloaded dependency, skipping...");
                 continue;
             }
             Log.WriteLine ("All the dependencies are loaded, proceeding...");
             LoadChunk (nchunk, cr);
             pendingData.Remove (nchunk);
         }
 }
开发者ID:vebin,项目名称:BD2,代码行数:23,代码来源:Database.cs


注:本文中的SortedSet.Overlaps方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。