Пример #1
0
        public void CreateProcFun(ThresholdMode mode)
        {
            double thres  = PData.ThresholdV;
            double areaup = PData.UPAreaLimit;
            double areadw = PData.DWAreaLimit;
            double cHnum  = PData.ChipHNum;
            double cWnum  = PData.ChipWNum;

            Register_ProcMethod();
            Clustering cluster = new Clustering();

            ClusterImg   = cluster.Segment(ClustMethod.KMean);
            ClusterData  = cluster.DataClustering(ClustMethod.KMean);
            Sortcontours = FnSortcontours();

            DoThreshold = FnThreshold(mode);
            ErodeRect   = FnMorp(morpOp.Erode, kernal.Rect);
            DilateRect  = FnMorp(morpOp.Dilate, kernal.Rect);
            ErodeVerti  = FnMorp(morpOp.Erode, kernal.Vertical);
            DilateVerti = FnMorp(morpOp.Dilate, kernal.Vertical);
            ErodeHori   = FnMorp(morpOp.Erode, kernal.Horizontal);
            DilateHori  = FnMorp(morpOp.Dilate, kernal.Horizontal);

            CloseRect    = FnMorp(morpOp.Close, kernal.Rect);
            OpenRect     = FnMorp(morpOp.Open, kernal.Rect);
            TempMatch_Sq = FnTemplateMatch(TempMatchType.Sq);
            TempMatch_Ce = FnTemplateMatch(TempMatchType.Coeff);

            FindContour  = FnFindContour(areaup, areadw);
            ApplyBox     = FnApplyBox(PData.UPBoxLimit, PData.DWBoxLimit);
            SumAreaPoint = FnSumAreaPoint(( int )PData.ChipHSize, ( int )PData.ChipWSize, OriginImg);
        }
 public tPS5000ADirection(
     Channel channel,
     ThresholdDirection direction,
     ThresholdMode mode)
 {
     this.channel   = channel;
     this.direction = direction;
     this.mode      = mode;
 }
Пример #3
0
 public VirtualButtonAnalogHoriz(
     VirtualAnalog analog,
     float threshold,
     ThresholdMode thresholdMode)
 {
     Analog        = analog;
     Threshold     = threshold;
     ThresholdMode = thresholdMode;
 }
Пример #4
0
 public VirtualButtonHardAxisTrigger(
     VirtualHardAxis axis,
     int threshold,
     ThresholdMode thresholdMode)
 {
     Axis          = axis;
     Threshold     = threshold;
     ThresholdMode = thresholdMode;
 }
Пример #5
0
 public VirtualButtonAxisTrigger(
     VirtualAxis axis,
     float threshold,
     ThresholdMode thresholdMode)
 {
     Axis          = axis;
     Threshold     = threshold;
     ThresholdMode = thresholdMode;
 }
        public void CreateProcFun(ThresholdMode mode)
        {
            double thres  = PData.ThresholdV;
            double areaup = PData.UPAreaLimit;
            double areadw = PData.DWAreaLimit;
            double cHnum  = PData.ChipHNum;
            double cWnum  = PData.ChipWNum;

            SumAreaPoint    = FnSumAreaPoint(( int )PData.ChipHSize, ( int )PData.ChipWSize, OriginImg);
            FindPassContour = FnFindPassContour(thres, areaup, areadw, mode);
            ApplyBox        = FnApplyBox(PData.UPBoxLimit, PData.DWBoxLimit);
        }
 public TriggerChannelProperties(
     short thresholdMajor,
     short thresholdMinor,
     ushort hysteresis,
     Channel channel,
     ThresholdMode thresholdMode)
 {
     this.ThresholdMajor = thresholdMajor;
     this.ThresholdMinor = thresholdMinor;
     this.Hysteresis     = hysteresis;
     this.Channel        = channel;
     this.ThresholdMode  = thresholdMode;
 }
Пример #8
0
        void CreateFuncofProc()
        {
            double        thres  = Core.PData.ThresholdV;
            double        areaup = Core.PData.UPAreaLimit;
            double        areadw = Core.PData.DWAreaLimit;
            double        cHnum  = Core.PData.ChipHNum;
            double        cWnum  = Core.PData.ChipWNum;
            ThresholdMode mode   = ckbThresMode.IsChecked.Value ? ThresholdMode.Auto : ThresholdMode.Manual;

            Core.SumAreaPoint    = ImgPFunc.FnSumAreaPoint((int)Core.PData.ChipWSize, ( int )Core.PData.ChipHSize, Core.OriginImg);
            Core.FindPassContour = ImgPFunc.FnFindPassContour(thres, areaup, areadw, mode);
            Core.ApplyBox        = ImgPFunc.FnApplyBox(Core.PData.UPBoxLimit, Core.PData.DWBoxLimit);
        }
Пример #9
0
 public TriggerChannelProperties(
     short thresholdMajor,
     ushort hysteresisMajor,
     short thresholdMinor,
     ushort hysteresisMinor,
     ChannelType channel,
     ThresholdMode thresholdMode)
 {
     ThresholdMajor  = thresholdMajor;
     HysteresisMajor = hysteresisMajor;
     ThresholdMinor  = thresholdMinor;
     HysteresisMinor = hysteresisMinor;
     Channel         = channel;
     ThresholdMode   = thresholdMode;
 }
 public TriggerChannelProperties(
     Int16 thresholdMajor,
     UInt16 hysteresisMajor,
     Int16 thresholdMinor,
     UInt16 hysteresisMinor,
     Channel channel,
     ThresholdMode thresholdMode)
 {
     this.ThresholdMajor  = thresholdMajor;
     this.HysteresisMajor = hysteresisMajor;
     this.ThresholdMinor  = thresholdMinor;
     this.HysteresisMinor = hysteresisMinor;
     this.Channel         = channel;
     this.ThresholdMode   = thresholdMode;
 }
Пример #11
0
 /// <summary>
 /// Set thresholdMode parameter at runtime. [public use]
 /// </summary>
 /// <param name="o">New parameter</param>
 public void SetVideoThresholdMode(ThresholdMode o)
 {
     if (HasNativeHandle())
     {
         ARUWP.aruwpSetVideoThresholdMode((int)o);
         thresholdMode = (ThresholdMode)ARUWP.aruwpGetVideoThresholdMode();
         if (thresholdMode != o)
         {
             Debug.Log(TAG + ": Unable to set video threshold mode to " + o);
         }
     }
     else
     {
         Debug.Log(TAG + ": SetVideoThresholdMode() unsupported status");
     }
 }
 public void setVideoThresholdMode(ThresholdMode o)
 {
     if (state == State.DETECTION_RUNNING)
     {
         ARUWP.aruwpSetVideoThresholdMode((int)o);
         thresholdMode = (ThresholdMode)ARUWP.aruwpGetVideoThresholdMode();
         if (thresholdMode != o)
         {
             Debug.Log(TAG + ": Unable to set video threshold mode to " + o);
         }
     }
     else
     {
         thresholdMode = o;
     }
 }
Пример #13
0
        public static Func <Image <Gray, byte>, VectorOfVectorOfPoint> FnFindPassContour(double threshold, double areaUP, double areaDW, ThresholdMode mode)
        {
            var findpasscntr = new Func <Image <Gray, byte>, VectorOfVectorOfPoint>((Image <Gray, byte> imgori) => {
                var thresedimg = mode == ThresholdMode.Auto ? imgori.ThresholdAdaptive(new Gray(255), AdaptiveThresholdType.MeanC, ThresholdType.Binary, 17, new Gray(2))
                                                            : imgori.ThresholdBinary(new Gray(threshold), new Gray(255));
                thresedimg.Save(@"D:\03JobPro\2017\01_LG\Data\2017_03_Test3_SampleData\3차테스트 이미지\노프레임\Selected\thresed.bmp");

                VectorOfVectorOfPoint contours     = new VectorOfVectorOfPoint();
                VectorOfVectorOfPoint passcontours = new VectorOfVectorOfPoint();
                CvInvoke.FindContours(thresedimg, contours, null, RetrType.List, ChainApproxMethod.ChainApproxNone);

                for (int i = 0; i < contours.Size; i++)
                {
                    double areaSize = CvInvoke.ContourArea(contours[i], false);  //  Find the area of contour
                    if (areaSize >= areaDW && areaSize <= areaUP)
                    {
                        passcontours.Push(contours[i]);
                    }
                }
                return(passcontours);
            });

            return(findpasscntr);
        }
Пример #14
0
 public TriggerChannelProperties(
     short thresholdMajor,
     ushort hysteresisMajor,
     short thresholdMinor,
     ushort hysteresisMinor,
     Channel channel,
     ThresholdMode thresholdMode)
 {
     this.ThresholdMajor = thresholdMajor;
     this.HysteresisMajor = hysteresisMajor;
     this.ThresholdMinor = thresholdMinor;
     this.HysteresisMinor = hysteresisMinor;
     this.Channel = channel;
     this.ThresholdMode = thresholdMode;
 }
Пример #15
0
        public static Func <Image <Gray, byte>, int, Image <Gray, byte> > FnThreshold(ThresholdMode mode)
        {
            var thres = new Func <Image <Gray, byte>, int, Image <Gray, byte> >((imgori, threshold) =>
            {
                var thresedimg = mode == ThresholdMode.Auto ? imgori.ThresholdAdaptive(new Gray(255), AdaptiveThresholdType.MeanC, ThresholdType.Binary, 177, new Gray(2))
                                                            : imgori.ThresholdBinary(new Gray(threshold), new Gray(255));
                //var temptemp = imgori.ThresholdAdaptive(new Gray(255),AdaptiveThresholdType.MeanC,ThresholdType.Binary,157,new Gray(2));
                return(thresedimg);
            });

            return(thres);
        }
 public ThresholdDirection(Channel source, TriggerDirection direction, ThresholdMode mode)
 {
     Source    = source;
     Direction = direction;
     Mode      = mode;
 }
        void CreateFuncofProc()
        {
            ThresholdMode mode = ckbThresMode.IsChecked.Value ? ThresholdMode.Auto : ThresholdMode.Manual;

            Core.CreateProcFun(mode);
        }
Пример #18
0
        public static Func <Image <Gray, byte>, VectorOfVectorOfPoint> FnFindPassContour(double threshold, double areaUP, double areaDW, ThresholdMode mode)
        {
            var findpasscntr = fun((Image <Gray, byte> imgori) => {
                var thresedimg = mode == ThresholdMode.Auto ? imgori.ThresholdAdaptive(new Gray(255), AdaptiveThresholdType.MeanC, ThresholdType.Binary, 17, new Gray(2))
                                                            : imgori.ThresholdBinary(new Gray(threshold), new Gray(255));
                thresedimg.Save(TestFileSavePath.ThresName);
                VectorOfVectorOfPoint contours     = new VectorOfVectorOfPoint();
                VectorOfVectorOfPoint passcontours = new VectorOfVectorOfPoint();
                CvInvoke.FindContours(thresedimg, contours, null, RetrType.List, ChainApproxMethod.ChainApproxNone);

                for (int i = 0; i < contours.Size; i++)
                {
                    double areaSize = CvInvoke.ContourArea(contours[i], false);  //  Find the area of contour
                    if (areaSize >= areaDW && areaSize <= areaUP)
                    {
                        passcontours.Push(contours[i]);
                    }
                }
                return(passcontours);
            });

            return(findpasscntr);
        }