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


C# Image.Clone方法代码示例

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


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

示例1: LatestImageAvailable

        private void LatestImageAvailable(object state, Image<Bgr, byte> image)
        {
            m_PreviousTableUsage = m_TableUsage;
            m_DebugImage = image.Clone();
            if (m_Previousimage != null)
            {
                // Use an exponential-moving average concept to smooth data
                double tableBusyProb = ImageProcessing.TableBusyProbability(image, m_Previousimage, m_DebugImage);
                m_SEMA = (m_SEMA * (1f - RATE)) + (tableBusyProb * RATE);

                if (m_SEMA > 0.5) m_TableUsage = TableUsage.Busy;
                else m_TableUsage = TableUsage.Free;
            }
            m_Previousimage = image.Clone();

            if (m_TableUsage == TableUsage.Busy && m_PreviousTableUsage != TableUsage.Busy) TableNowBusy(this, null);
            if (m_TableUsage == TableUsage.Free && m_PreviousTableUsage != TableUsage.Free) TableNowFree(this, null);
        }
开发者ID:rba100,项目名称:foosnet,代码行数:18,代码来源:TableWatcher.cs

示例2: Transform

        internal static Image Transform(Image source, RotationType rotationType, FlippingType flippingType)
        {
            Image target;

            switch (rotationType)
            {
                case RotationType.None:
                    {
                        byte[] targetPixels = source.Pixels;
                        byte[] sourcePixels = new byte[targetPixels.Length];

                        Array.Copy(targetPixels, sourcePixels, targetPixels.Length);

                        target = new Image(source.Width, source.Height, sourcePixels);
                    }
                    break;
                case RotationType.Rotate90:
                    {
                        target = Rotate90(source);
                    }
                    break;
                case RotationType.Rotate180:
                    {
                        target = Rotate180(source);
                    }
                    break;
                case RotationType.Rotate270:
                    {
                        target = Rotate270(source);
                    }
                    break;
                default:
                    {
                        target = source.Clone();
                    }
                    break;
            }

            switch (flippingType)
            {
                case FlippingType.Vertical:
                    FlipX(target);
                    break;
                case FlippingType.Horizontal:
                    FlipY(target);
                    break;
            }

            return target;
        }
开发者ID:ChillyFlashER,项目名称:Nine.Imaging,代码行数:50,代码来源:ImageBaseOperations.cs

示例3: ProcessImage

        public Image<Bgr, byte> ProcessImage(Image<Bgr, byte> img)
        {
            _current = img.Clone();

            if(_background != null)
            {
                var grayScale = img.Convert<Bgr, byte>();
                var sub = grayScale - _background;
                return sub.Convert<Bgr, byte>();
            }
            else
            {
                return _current;
            }
        }
开发者ID:HumanRemote,项目名称:HumanRemote,代码行数:15,代码来源:MotionDetectorProcessor.cs

示例4: Process

        public Image<Gray, byte> Process(Image<Gray, byte> src)
        {
            var dst = src.Clone();

            Connectivity.Connect8 = this.Connect8;
            var cl = src.connectLevel(1, 8, 0);
            foreach (var dm in cl.Domains) {
                if (dm.Area < Threshold) {
                    foreach (var p in dm.Points) {
                        dst[p] = new Gray(0);
                    }
                }
            }

            return dst;
        }
开发者ID:pakerliu,项目名称:sharp-context,代码行数:16,代码来源:ThresholdConnect.cs

示例5: FindBallLocationInFrame

        /// <summary>
        /// Find ball location in frame in defined area
        /// </summary>
        /// <param name="image">Image to detect ball</param>
        /// <param name="timeStamp">Time Stamp of an image</param>
        /// <param name="detectionArea">Area to search ball in. If Selected:
        /// area will be defined based on last stored location and maximum possible speed.
        /// [Default is Full to search in all frame]
        /// </param>
        /// <returns>[True] if ball location found, [False] otherwise</returns>
        public override bool FindBallLocationInFrame(Image<Gray, byte> image, DateTime timeStamp, eDetectionArea detectionArea = eDetectionArea.Full)
        {
            using (image = image.Clone())
            {
                int additionalOffsetX = 0;
                int additionalOffsetY = 0;

                if (detectionArea.Equals(eDetectionArea.Selected))
                {
                    TimeSpan deltaT = timeStamp - ImagingData.LastKnownBallLocation.Timestamp;
                    double searchRadius = MAX_BALL_SPEED * deltaT.TotalSeconds;

                    int maxX = (Convert.ToInt32(ImagingData.LastKnownBallLocation.X + searchRadius) > image.Width) ?
                        image.Width : Convert.ToInt32(ImagingData.LastKnownBallLocation.X + searchRadius);
                    int maxY = (Convert.ToInt32(ImagingData.LastKnownBallLocation.Y + searchRadius) > image.Height) ?
                        image.Height : Convert.ToInt32(ImagingData.LastKnownBallLocation.Y + searchRadius);
                    additionalOffsetX = (Convert.ToInt32(ImagingData.LastKnownBallLocation.X - searchRadius) < 0) ?
                        0 : Convert.ToInt32(ImagingData.LastKnownBallLocation.X - searchRadius);
                    additionalOffsetY = (Convert.ToInt32(ImagingData.LastKnownBallLocation.Y - searchRadius) < 0) ?
                        0 : Convert.ToInt32(ImagingData.LastKnownBallLocation.Y - searchRadius);

                    List<System.Drawing.PointF> croppingPoints = new List<System.Drawing.PointF>()
                    {
                        new System.Drawing.PointF(maxX, maxY),
                        new System.Drawing.PointF(maxX, additionalOffsetY),
                        new System.Drawing.PointF(additionalOffsetX, maxY),
                        new System.Drawing.PointF(additionalOffsetX, additionalOffsetY)
                    };
                    
                    image = Crop(image, croppingPoints);
                    ComputerVisionMonitors[eComputerVisionMonitor.MonitorB].ShowFrame(image);
                }

                CircleF[] pos = DetectCircles(image, ImagingData.BallRadius, ImagingData.BallRadiusError * 2, ImagingData.BallRadius * 5);
                if (pos.Length > 0)
                {
                    double xLocation = pos[0].Center.X + additionalOffsetX;
                    double yLocation = pos[0].Center.Y + additionalOffsetY;
                    UpdateCoordinates(xLocation, yLocation, timeStamp, Brushes.Red);
                    return true;
                }
                Log.Print(String.Format("Ball not found in {0} area", detectionArea.ToString()), eCategory.Debug, LogTag.IMAGE);
                ImagingData.BallCoords = new BallCoordinates(timeStamp);
                return false;
            }
        }
开发者ID:djjosse,项目名称:Foosbot,代码行数:56,代码来源:BallTracker.cs

示例6: Process

 public Image<Gray, byte> Process(Image<Gray, byte> src)
 {
     if (shouldInvert(src)) return src.Not();
     else return src.Clone();
 }
开发者ID:pakerliu,项目名称:sharp-context,代码行数:5,代码来源:AutoInvert.cs


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