Пример #1
0
 private void OnTrack(int pos)
 {
     using (IplImage tmp = image.Clone())
     {
         Cv.Threshold(image, tmp, pos, 255, ThresholdType.Binary);
         window.ShowImage(tmp);
     }
 }
Пример #2
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="pos"></param>
        private void OnTrack(int pos)
        {
            CvSeq     labels;
            Stopwatch watch = Stopwatch.StartNew();

            threshold = pos * pos;
            int classCount = Cv.SeqPartition(pointSeq, null, out labels, CmpFuncPtr);

            watch.Stop();
            Console.WriteLine("{0:D4} classes", classCount);
            Console.WriteLine("Partition time : {0} msec", watch.ElapsedMilliseconds);
            Cv.Zero(canvas);

            for (int i = 0; i < labels.Total; i++)
            {
                CvPoint  pt    = pointSeq.GetSeqElem(i).Value;
                CvScalar color = colors[labels.GetSeqElem <int>(i).Value];
                Cv.Circle(canvas, pt, 1, color, -1);
            }

            window.ShowImage(canvas);
        }