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


C# Bgr.SetValue方法代码示例

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


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

示例1: Main

        static void Main(string[] args)
        {
            //select color
            Bgr<byte>[,] image = new Bgr<byte>[480, 640];
            Hsv<byte> color = UI.PickColor(Bgr<byte>.Red).ToHsv();

            //select mask
            Gray<byte>[,] mask = image.GetMask();
            if (mask.AsEnumerable().Sum(x => x.Intensity) == 0) //if the mask is empty
                mask.SetValue<Gray<byte>>(Byte.MaxValue);

            //increase saturation incrementally
            for (int s = 0; s <= Byte.MaxValue; s++)
            {
                color.S = (byte)s;
                image.SetValue<Bgr<byte>>(color.ToBgr(), mask);

                image.Show(scaleForm: true);
                ((double)s / Byte.MaxValue).Progress(message: "Changing saturation");

                Thread.Sleep(50);
            }

            //save last image
            string fileName = UI.SaveImage();
            if (fileName != null) image.Save(fileName);

            //close all
            UI.CloseAll();
        }
开发者ID:gitter-badger,项目名称:dot-imaging,代码行数:30,代码来源:Program.cs

示例2: Main

        static void Main(string[] args)
        {
            UI.OpenImage();

            Bgr<byte>[,] image = new Bgr<byte>[480, 640];
            Hsv<byte> color = UI.PickColor(Bgr<byte>.Red).ToHsv();

            for (int s = 0; s <= Byte.MaxValue; s++)
            {
                color.S = (byte)s;
                image.SetValue<Bgr<byte>>(color.ToBgr());

                image.Show(scaleForm: true);
                ((double)s / Byte.MaxValue).Progress(message: "Changing saturation");

                Thread.Sleep(50);
            }

            //save last image
            string fileName = UI.SaveImage();
            if (fileName != null) image.Save(fileName);

            //close all
            UI.CloseAll();
        }
开发者ID:bestwpw,项目名称:dot-imaging,代码行数:25,代码来源:Program.cs

示例3: populateCache

        static void populateCache(LazyMemoryCache<int, Bgr<byte>[,]> cache, int elementCount)
        {
            Console.WriteLine("Filling lazy cache (with constructors)...");
            //******************* adding elements *********************************************************
            for (int key = 0; key < elementCount; key++)
            {
                cache.AddOrUpdate(key, () =>
                {
                    //simulate getting image from a disc (slow operation)
                    var img = new Bgr<byte>[480, 640];
                    img.SetValue<Bgr<byte>>(new Bgr<byte>((byte)key, 0, 0));
                    Thread.Sleep(60);

                    return img;
                },
                    //we do not have destructor
                (img) => { });
            }
        }
开发者ID:MaloneLung,项目名称:accord-net-extensions,代码行数:19,代码来源:Program.cs


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