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


C# Image.And方法代码示例

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


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

示例1: GetIntersection

 public static Bitmap GetIntersection(Bitmap img1, Bitmap img2)
 {
     using (Image<Gray, byte> ip1 = new Image<Gray, byte>(img1))
     using (Image<Gray, byte> ip2 = new Image<Gray, byte>(img2))
     { return ip1.And(ip2).ToBitmap(); }
 }
开发者ID:spatial-computing,项目名称:strabo-learning-ocr-transformation,代码行数:6,代码来源:ImageUtils.cs

示例2: ThresholdColorizePupilFullImage

        private void ThresholdColorizePupilFullImage()
        {
            // Threshold (whole image)
            Image<Gray, byte> pupilImage = gray.ThresholdBinaryInv(new Gray(Settings.Instance.Processing.PupilThreshold), new Gray(255));

            // Convert thresholded to color and add
            Image<Bgr, byte> pupilThresholdImage = new Image<Bgr, byte>(width, height, new Bgr(Settings.Instance.Visualization.PupilThresholdColor));
            pupilThresholdImage = pupilThresholdImage.And(pupilImage.Convert<Bgr, byte>());
            processed = processed.Add(pupilThresholdImage);

            pupilThresholdImage.Dispose();
            pupilImage.Dispose();
        }
开发者ID:DeSciL,项目名称:Ogama,代码行数:13,代码来源:Visualization.cs

示例3: ThresholdColorizeGlintsFullImage

        private void ThresholdColorizeGlintsFullImage()
        {
            // Threshold (whole image)
            Image<Gray, byte> glintImage = gray.ThresholdBinary(new Gray(Settings.Instance.Processing.GlintThreshold), new Gray(255));

            // Convert thresholded to color and add
            // Negate the selected color (unary minus) otherwise yellow becomes blue, green = red etc. 
            Color c = Settings.Instance.Visualization.GlintThresholdColor;
            Color glintNegated = Color.FromArgb(c.A, 255 - c.R, 255 - c.G, 255 - c.B);

            Image<Bgr, byte> glintThresholdImage = new Image<Bgr, byte>(width, height, new Bgr(glintNegated));
            glintThresholdImage = glintThresholdImage.And(glintImage.Convert<Bgr, byte>());
            processed = processed.Sub(glintThresholdImage);

            glintThresholdImage.Dispose();
            glintImage.Dispose();
        }
开发者ID:DeSciL,项目名称:Ogama,代码行数:17,代码来源:Visualization.cs

示例4: FrameGrabber

        /// <summary>
        /// the main function in this class 
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        void FrameGrabber(object sender, EventArgs e)
        {
            sw.Start();
            newImage = grabber.QueryFrame();

            count++;
            if (newImage != null)
            {
                current_image = newImage.Convert<Gray, byte>();
                detector.Process(newImage, tempImage);

                tempImage = tempImage.ThresholdBinary(thresholdValue, MaxValue);
                tempImage = tempImage.Dilate(2);
                tempImage = tempImage.SmoothMedian(3);

                newImageG = current_image.ThresholdBinaryInv(new Gray(threshold), new Gray(255d));
                newImageG = newImageG.And(tempImage);
                newImageG = newImageG.Dilate(1);

                if (numberOfHands > 0)
                {
                    int tt = numberOfHands;
                    for (int i = 0; i < tt; i++)
                    {
                        if (x[i] != null)
                        {
                            try
                            {
                                x[i].StartTracking(elapsed_time);
                            }

                     
                            catch(Exception ex)
                            {
                                Console.WriteLine("lost traking : number  of hands {0} & list x {1}", numberOfHands, x.Count);
                                int id = x[i].id;
                                hand_centers[id] = x[i].new_center_pt;
                                hand_centers.Remove(id);
                                x.RemoveAt(id);
                                --numberOfHands;

                            }
                        }

                    }

                }


                if (numberOfHands < hand_detected)
                {
                    detected_hand = HandDetection(newImageG);
                    if (detected_hand.Any())// any elements in the list
                    {
                        foreach (Contour<Point> h in detected_hand)
                        {
                            if (numberOfHands < hand_detected)
                            {

                                y = new HandTracking(current_image.Width, current_image.Height, hand_centers[numberOfHands]);

                                y.ExtractFeatures(h);
                                y.id = numberOfHands;
                                x.Add(y);

                                numberOfHands++;

                            }
                            else
                                Console.WriteLine("there is already 2 hands");
                        }
                        detected_hand.Clear();

                    }
                }

                sw.Stop();
                elapsed_time = sw.Elapsed.TotalMilliseconds;
           
                sw.Reset();
                imageBoxSkin.Image = newImage;
                imageBoxFrameGrabber.Image = newImageG;




            }
        }
开发者ID:phylony,项目名称:handview,代码行数:93,代码来源:Form1.cs

示例5: combineMotionAndGradient

 private Image<Gray, float> combineMotionAndGradient(Image<Gray,float> gradient, Image<Gray,float> motion)
 {
     return gradient.And(motion);
 }
开发者ID:Charlesjean,项目名称:HandGestureRecog,代码行数:4,代码来源:Form1.cs

示例6: TransparencyFilter

        /// <summary>
        /// Simple helper function that will test to make sure that more than a certain percentage
        /// of the shred is non a transparent color.
        /// </summary>
        /// <param name="shred"></param>
        /// <returns></returns>
        public static bool TransparencyFilter(Bitmap shred)
        {
            Image<Bgr, Byte> image1 = new Image<Bgr, byte>(shred);

            Image<Bgr, byte> transparentImage = image1.And(new Bgr(Color.Transparent));
            long nonTransparent = transparentImage.CountNonzero().Sum();
            long totalPixels = transparentImage.Height * transparentImage.Width;
            double ratio = (double)nonTransparent / (double)totalPixels;
            return (ratio > MinTransparencyRatio);
        }
开发者ID:Algorithmix,项目名称:Papyrus,代码行数:16,代码来源:Preprocessing.cs

示例7: ExtractContourImage

        private static Image<Bgr, Byte> ExtractContourImage(Image<Bgr, Byte> image, Contour<Point> contour, out Image<Gray, Byte> mask)
        {
            mask = image.Convert<Gray, Byte>();
            mask.SetZero();
            mask.Draw(contour, new Gray(255), new Gray(0), 2, -1);

            return image.And(new Bgr(255, 255, 255), mask);
        }
开发者ID:LoyVanBeek,项目名称:SetVision,代码行数:8,代码来源:ContourAnalyzer.cs

示例8: ExtractContourImage

        private Image<Bgr, Byte> ExtractContourImage(Image<Bgr, Byte> source, Contour<Point> contour, out Image<Gray, Byte> mask)
        {
            mask = source.Convert<Gray, Byte>();
            mask.SetZero();
            //Contour<Point> shifted = ShiftContour(contour, -3,-3);
            mask.Draw(contour, new Gray(255), new Gray(0), 2, -1);

            return source.And(new Bgr(255, 255, 255), mask);
        }
开发者ID:LoyVanBeek,项目名称:SetVision,代码行数:9,代码来源:ContourNode.cs

示例9: button1_Click

        private void button1_Click(object sender, EventArgs e)
        {
            try
            {
                _image = GetImage(@"d:\raw\classified\3_9_0.jpg");

                var tmpImage = GetImage(@"d:\raw\classified\3_9_1.jpg");

                _image.And(tmpImage,null);

                _inputArray = _image;

                pictureBox1.Image = _image.ToBitmap();
            }
            catch (Exception ex)
            {

                throw;
            }

            //var _ocr = new Tesseract(@"D:\", "eng", OcrEngineMode.TesseractCubeCombined);
            //_ocr.SetVariable("tessedit_char_whitelist", "1234567890");

            ////var tmp = FilterPlate(img);

            //_ocr.Recognize(_image);

            //var result = _ocr.GetCharacters();
        }
开发者ID:Neths,项目名称:ReStudio,代码行数:29,代码来源:Form1.cs

示例10: TransparencyFilter

        /// <summary>
        /// Simple helper function that will test to make sure that more than a certain percentage
        /// of the shred is non a transparent color.
        /// </summary>
        /// <param name="shred"></param>
        /// <returns></returns>
        public static bool TransparencyFilter(Bitmap shred)
        {
            Image<Bgr,Byte> image1 = new Image<Bgr, byte>(shred);

            var MIN_TRANSPARENCY_RATIO = 0.6;
            var transparentImage = image1.And(new Bgr(Color.Transparent));
            var nonTransparent = transparentImage.CountNonzero().Sum();
            var totalPixels = transparentImage.Height*transparentImage.Width;
            var ratio = (double)(nonTransparent/totalPixels);
            return (ratio > MIN_TRANSPARENCY_RATIO);
        }
开发者ID:Algorithmix,项目名称:Picasso,代码行数:17,代码来源:Preprocessing.cs


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