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


C# Bgr.ToCvScalar方法代码示例

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


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

示例1: Draw

 /// <summary>
 /// Draws text on the provided image.
 /// </summary>
 /// <param name="image">Input image.</param>
 /// <param name="text">User text.</param>
 /// <param name="font">Font.</param>
 /// <param name="botomLeftPoint">Bottom-left point.</param>
 /// <param name="color">Text color.</param>
 /// <param name="opacity">Sets alpha channel where 0 is transparent and 255 is full opaque.</param>
 public static unsafe void Draw(this Bgr<byte>[,] image, string text, Font font, Point botomLeftPoint, Bgr<byte> color, byte opacity = Byte.MaxValue)
 {
     using(var img = image.Lock())
     {
         var iplImage = img.AsCvIplImage();
         CvCoreInvoke.cvPutText(&iplImage, text, botomLeftPoint, ref font, color.ToCvScalar());
     }
 }
开发者ID:tablesmit,项目名称:dot-imaging,代码行数:17,代码来源:Drawing.cs

示例2: Draw

        /// <summary>
        /// Draws rectangle.
        /// </summary>
        /// <param name="image">Input image.</param>
        /// <param name="rect">Rectangle.</param>
        /// <param name="color">Object's color.</param>
        /// <param name="thickness">Border thickness. If less than zero structure will be filled.</param>
        /// <param name="opacity">Sets alpha channel where 0 is transparent and 255 is full opaque.</param>
        public unsafe static void Draw(this Bgr<byte>[,] image, Rectangle rect, Bgr<byte> color, int thickness, byte opacity = Byte.MaxValue)
        {
            if (float.IsNaN(rect.X) || float.IsNaN(rect.Y))
                return;

            using(var img = image.Lock())
            {
                var iplImage = img.AsCvIplImage();
                CvCoreInvoke.cvRectangleR(&iplImage, rect, color.ToCvScalar(opacity), thickness, LineTypes.EightConnected, 0);
            }
        }
开发者ID:bestwpw,项目名称:dot-imaging,代码行数:19,代码来源:Drawing.cs

示例3: Draw

        /// <summary>
        /// Draws Box2D.
        /// </summary>
        /// <param name="image">Input image.</param>
        /// <param name="box">Box 2D.</param>
        /// <param name="color">Object's color.</param>
        /// <param name="thickness">Border thickness.</param>
        /// <param name="opacity">Sets alpha channel where 0 is transparent and 255 is full opaque.</param>
        public static unsafe void Draw(this Bgr<byte>[,] image, Box2D box, Bgr<byte> color, int thickness, byte opacity = Byte.MaxValue)
        {
            if (thickness < 1)
                throw new NotSupportedException("Only positive values are valid!");

            var vertices = box.GetVertices();

            using(var img = image.Lock())
            {
                var iplImage = img.AsOpenCvImage();

                for (int i = 0; i < vertices.Length; i++)
                {
                    int idx2 = (i + 1) % vertices.Length;

                    CvCoreInvoke.cvLine(&iplImage, vertices[i].Round(), vertices[idx2].Round(),
                                           color.ToCvScalar(opacity), thickness,
                                           LineTypes.EightConnected, 0);
                }
            }
        }
开发者ID:adhameed,项目名称:dot-imaging,代码行数:29,代码来源:Drawing.cs


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