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


C# NikseBitmap.GetPixel方法代码示例

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


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

示例1: ManagedBitmap

 public ManagedBitmap(NikseBitmap nbmp)
 {
     Width = nbmp.Width;
     Height = nbmp.Height;
     _colors = new Color[Width * Height];
     for (int y = 0; y < Height; y++)
     {
         for (int x = 0; x < Width; x++)
         {
             this.SetPixel(x, y, nbmp.GetPixel(x, y));
         }
     }
 }
开发者ID:IlgnerBri,项目名称:subtitleedit,代码行数:13,代码来源:ManagedBitmap.cs

示例2: IsBitmapsAlike

        internal static unsafe int IsBitmapsAlike(NikseBitmap bmp1, ManagedBitmap bmp2)
        {
            int different = 0;
            int maxDiff = bmp1.Width * bmp1.Height / 5;

            for (int x = 1; x < bmp1.Width; x++)
            {
                for (int y = 1; y < bmp1.Height; y++)
                {
                    if (!IsColorClose(bmp1.GetPixel(x, y), bmp2.GetPixel(x, y), 20))
                        different++;
                }
                if (different > maxDiff)
                    return different + 10;
            }
            return different;
        }
开发者ID:radinamatic,项目名称:subtitleedit,代码行数:17,代码来源:NikseBitmapImageSplitter.cs

示例3: IsCursiveVerticalLineTransparent

        private static bool IsCursiveVerticalLineTransparent(NikseBitmap bmp, int size, int y, int x, List<Point> cursivePoints)
        {
            bool cursiveOk = true;
            int newY = y;
            int newX = x;
            while (cursiveOk && newY < bmp.Height - 1)
            {
                Color c0 = bmp.GetPixel(newX, newY);
                if (c0.A == 0 || IsColorClose(c0, Color.Black, 280))
                {
                    newY++;
                }
                else
                {
                    byte[] c1 = bmp.GetPixelColors(newX - 1, newY - 1);
                    byte[] c2 = bmp.GetPixelColors(newX - 1, newY);
                    if ((c1[0] == 0 || IsColorClose(c1[0], c1[1], c1[2], c1[3], Color.Black, 280)) && // still dark color...
                        (c2[0] == 0 || IsColorClose(c2[0], c2[1], c2[2], c2[3], Color.Black, 280)))
                    {
                        cursivePoints.Add(new Point(newX, newY));
                        if (newX > 1)
                            newX--;
                        else
                            cursiveOk = false;

                        newY++;
                    }
                    else
                    {
                        cursiveOk = false;
                    }
                }

                if (newX < x - size)
                    cursiveOk = false;
            }
            return cursiveOk;
        }
开发者ID:radinamatic,项目名称:subtitleedit,代码行数:38,代码来源:NikseBitmapImageSplitter.cs

示例4: SplitVerticalTransparentOrBlack

        public static List<ImageSplitterItem> SplitVerticalTransparentOrBlack(NikseBitmap bmp)
        {
            int startY = 0;
            int size = 0;
            var parts = new List<ImageSplitterItem>();
            for (int y = 0; y < bmp.Height; y++)
            {
                bool allTransparent = true;
                for (int x = 0; x < bmp.Width; x++)
                {
                    Color c = bmp.GetPixel(x, y);
                    if (c.A > 20 && c.R + c.G + c.B > 20)
                    {
                        allTransparent = false;
                        break;
                    }
                }
                if (allTransparent)
                {
                    if (size > 2 && size <= 15)
                    {
                        size++; // at least 15 pixels, like top of 'i' or top of 'È'
                    }
                    else
                    {
                        if (size > 8)
                        {
                            NikseBitmap part = bmp.CopyRectangle(new Rectangle(0, startY, bmp.Width, size + 1));
                            //                            part.Save("c:\\line_0_to_width.bmp");
                            parts.Add(new ImageSplitterItem(0, startY, part));
                            //                            bmp.Save("c:\\original.bmp");
                        }
                        size = 0;
                        startY = y;
                    }
                }
                else
                {
                    size++;
                }

            }
            if (size > 2)
            {
                if (size == bmp.Height)
                    parts.Add(new ImageSplitterItem(0, startY, bmp));
                else
                    parts.Add(new ImageSplitterItem(0, startY, bmp.CopyRectangle(new Rectangle(0, startY, bmp.Width, size + 1))));
            }
            return parts;
        }
开发者ID:radinamatic,项目名称:subtitleedit,代码行数:51,代码来源:NikseBitmapImageSplitter.cs

示例5: NOcrFindExpandedMatch

        private static NOcrChar NOcrFindExpandedMatch(NikseBitmap nbmp, ImageSplitterItem targetItem, int topMargin, List<NOcrChar> nOcrChars)
        {
            //            var nbmp = new NikseBitmap(parentBitmap);
            int w = targetItem.NikseBitmap.Width;
            int index = 0;
            foreach (NOcrChar oc in nOcrChars)
            {
                    if (oc.ExpandCount > 1 && oc.Width > w && targetItem.X + oc.Width < nbmp.Width)
                    {
                        bool ok = true;
                        index = 0;
                        while (index < oc.LinesForeground.Count && ok)
                        {
                            NOcrPoint op = oc.LinesForeground[index];
                            foreach (Point point in op.GetPoints(oc.Width, oc.Height))
                            {
                                Point p = new Point(point.X + targetItem.X, point.Y + targetItem.Y);
                                if (p.X >= 0 && p.Y >= 0 && p.X < nbmp.Width && p.Y < nbmp.Height)
                                {
                                    Color c = nbmp.GetPixel(p.X, p.Y);
                                    if (c.A > 150 && c.R + c.G + c.B > NocrMinColor)
                                    {
                                    }
                                    else
                                    {
                                        ok = false;
                                        break;
                                    }
                                }
                            }
                            index++;
                        }
                        index = 0;
                        while (index < oc.LinesBackground.Count && ok)
                        {
                            NOcrPoint op = oc.LinesBackground[index];
                            foreach (Point point in op.GetPoints(oc.Width, oc.Height))
                            {
                                Point p = new Point(point.X + targetItem.X, point.Y + targetItem.Y);
                                if (p.X >= 0 && p.Y >= 0 && p.X < nbmp.Width && p.Y < nbmp.Height)
                                {
                                    Color c = nbmp.GetPixel(p.X, p.Y);
                                    if (c.A > 150 && c.R + c.G + c.B > NocrMinColor)
                                    {
                                        ok = false;
                                        break;
                                    }
                                }
                            }
                            index++;
                        }
                        if (ok)
                            return oc;

                        ok = true;
                        index = 0;
                        while (index < oc.LinesForeground.Count && ok)
                        {
                            NOcrPoint op = oc.LinesForeground[index];
                            foreach (Point point in op.ScaledGetPoints(oc, oc.Width, oc.Height - 1))
                            {
                                Point p = new Point(point.X + targetItem.X, point.Y + targetItem.Y);
                                if (p.X >= 0 && p.Y >= 0 && p.X < nbmp.Width && p.Y < nbmp.Height)
                                {
                                    Color c = nbmp.GetPixel(p.X, p.Y);
                                    if (c.A > 150 && c.R + c.G + c.B > NocrMinColor)
                                    {
                                    }
                                    else
                                    {
                                        ok = false;
                                        break;
                                    }
                                }
                            }
                            index++;
                        }
                        index = 0;
                        while (index < oc.LinesBackground.Count && ok)
                        {
                            NOcrPoint op = oc.LinesBackground[index];
                            foreach (Point point in op.ScaledGetPoints(oc, oc.Width, oc.Height - 1))
                            {
                                Point p = new Point(point.X + targetItem.X, point.Y + targetItem.Y);
                                if (p.X >= 0 && p.Y >= 0 && p.X < nbmp.Width && p.Y < nbmp.Height)
                                {
                                    Color c = nbmp.GetPixel(p.X, p.Y);
                                    if (c.A > 150 && c.R + c.G + c.B > NocrMinColor)
                                    {
                                        ok = false;
                                        break;
                                    }
                                }
                            }
                            index++;
                        }
                        if (ok)
                            return oc;
                }
            }
//.........这里部分代码省略.........
开发者ID:Tarhan,项目名称:subtitleedit,代码行数:101,代码来源:VobSubOcr.cs

示例6: CalculateNumberOfForegroundColors

 private static unsafe int CalculateNumberOfForegroundColors(NikseBitmap nikseBitmap)
 {
     int count = 0;
     for (int y = 0; y < nikseBitmap.Height; y++)
     {
         for (int x = 0; x < nikseBitmap.Width; x++)
         {
             Color c = nikseBitmap.GetPixel(x, y);
             if (c.A > 100 && c.R + c.G + c.B > 200)
                 count++;
         }
     }
     return count;
 }
开发者ID:Tarhan,项目名称:subtitleedit,代码行数:14,代码来源:VobSubOcr.cs

示例7: RemoveBlackBarRight

 private static void RemoveBlackBarRight(NikseBitmap bmp)
 {
     int xRemoveBlackBar = bmp.Width-1;
     for (int yRemoveBlackBar = 0; yRemoveBlackBar < bmp.Height; yRemoveBlackBar++)
     {
         Color c = bmp.GetPixel(xRemoveBlackBar, yRemoveBlackBar);
         if (c.A == 0 || IsColorClose(c, Color.Black, 280))
         {
             if (bmp.GetPixel(xRemoveBlackBar - 1, yRemoveBlackBar).A == 0)
                 bmp.SetPixel(xRemoveBlackBar, yRemoveBlackBar, Color.Transparent);
         }
     }
 }
开发者ID:Tarhan,项目名称:subtitleedit,代码行数:13,代码来源:NikseBitmapImageSplitter.cs

示例8: IsVerticalLineTransparent

 private static bool IsVerticalLineTransparent(NikseBitmap bmp, ref int y, int x)
 {
     bool allTransparent = true;
     for (y = 0; y < bmp.Height - 1; y++)
     {
         Color c = bmp.GetPixel(x, y);
         if (c.A == 0 || IsColorClose(c, Color.Black, 280)) // still dark color...
         {
         }
         else
         {
             allTransparent = false;
             break;
         }
     }
     return allTransparent;
 }
开发者ID:Tarhan,项目名称:subtitleedit,代码行数:17,代码来源:NikseBitmapImageSplitter.cs

示例9: IsMatchPointBackGround

        private static bool IsMatchPointBackGround(NOcrPoint op, bool loose, NikseBitmap nbmp, NOcrChar nOcrChar)
        {
            foreach (Point point in op.ScaledGetPoints(nOcrChar, nbmp.Width, nbmp.Height))
            {
                if (point.X >= 0 && point.Y >= 0 && point.X < nbmp.Width && point.Y < nbmp.Height)
                {
                    Color c = nbmp.GetPixel(point.X, point.Y);
                    if (c.A > 150 && c.R + 100 + c.G + c.B > VobSubOcr.NocrMinColor)
                    {
                        return false;
                    }

                    if (nbmp.Width > 10 && point.X + 1 < nbmp.Width)
                    {
                        c = nbmp.GetPixel(point.X + 1, point.Y);
                        if (c.A > 150 && c.R + 100 + c.G + c.B > VobSubOcr.NocrMinColor)
                        {
                            return false;
                        }
                    }

                    if (loose)
                    {
                        if (nbmp.Width > 10 && point.X >= 1)
                        {
                            c = nbmp.GetPixel(point.X - 1, point.Y);
                            if (c.A > 150 && c.R + 100 + c.G + c.B > VobSubOcr.NocrMinColor)
                            {
                                return false;
                            }
                        }

                        if (nbmp.Height > 10 && point.Y + 1 < nbmp.Height)
                        {
                            c = nbmp.GetPixel(point.X, point.Y + 1);
                            if (c.A > 150 && c.R + 100 + c.G + c.B > VobSubOcr.NocrMinColor)
                            {
                                return false;
                            }
                        }

                        if (nbmp.Height > 10 && point.Y >= 1)
                        {
                            c = nbmp.GetPixel(point.X, point.Y - 1);
                            if (c.A > 150 && c.R + 100 + c.G + c.B > VobSubOcr.NocrMinColor)
                            {
                                return false;
                            }
                        }
                    }

                }
            }
            return true;
        }
开发者ID:athikan,项目名称:subtitleedit,代码行数:55,代码来源:VobSubOcrNOcrCharacter.cs

示例10: IsMatch

 private bool IsMatch()
 {
     NikseBitmap nbmp = new NikseBitmap(pictureBoxCharacter.Image as Bitmap);
     foreach (NOcrPoint op in _nocrChar.LinesForeground)
     {
         foreach (Point point in op.ScaledGetPoints(_nocrChar, nbmp.Width, nbmp.Height))
         {
             if (point.X >= 0 && point.Y >= 0 && point.X < nbmp.Width && point.Y < nbmp.Height)
             {
                 Color c = nbmp.GetPixel(point.X, point.Y);
                 if (c.A > 150 && c.R + 100 + c.G + c.B > VobSubOcr.NocrMinColor)
                 {
                 }
                 else
                 {
                     return false;
                 }
             }
         }
     }
     foreach (NOcrPoint op in _nocrChar.LinesBackground)
     {
         foreach (Point point in op.GetPoints())
         {
             if (point.X >= 0 && point.Y >= 0 && point.X < nbmp.Width && point.Y < nbmp.Height)
             {
                 Color c = nbmp.GetPixel(point.X, point.Y);
                 if (c.A > 150 && c.R + 100 + c.G + c.B > VobSubOcr.NocrMinColor)
                 {
                     return false;
                 }
             }
         }
     }
     return true;
 }
开发者ID:athikan,项目名称:subtitleedit,代码行数:36,代码来源:VobSubOcrNOcrCharacter.cs

示例11: ManagedBitmap

 /// <summary>
 /// Initializes a new instance of the <see cref="ManagedBitmap"/> class.
 /// </summary>
 /// <param name="oldBitmap">
 /// The old bitmap.
 /// </param>
 public ManagedBitmap(Bitmap oldBitmap)
 {
     NikseBitmap nbmp = new NikseBitmap(oldBitmap);
     this.Width = nbmp.Width;
     this.Height = nbmp.Height;
     this._colors = new Color[this.Width * this.Height];
     for (int y = 0; y < this.Height; y++)
     {
         for (int x = 0; x < this.Width; x++)
         {
             this.SetPixel(x, y, nbmp.GetPixel(x, y));
         }
     }
 }
开发者ID:KatyaMarincheva,项目名称:SubtitleEditOriginal,代码行数:20,代码来源:ManagedBitmap.cs


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