private void processImage(Image <FlowColor, float> prevIm, Image <FlowColor, float> currIm, List <PointF> oldPositions, out List <PointF> newPositions)
        {
            lkStorage.Process(prevIm, currIm);

            PointF[]           currFeatures;
            float[]            error;
            KLTFeatureStatus[] featureStatus;

            /*LKOpticalFlow<FlowColor>.EstimateFlow(lkStorage, oldPositions.ToArray(),
             *                                    out currFeatures, out featureStatus, out error,
             *                                    winSize);*/


            PyrLKOpticalFlow <FlowColor> .EstimateFlow(lkStorage, oldPositions.ToArray(),
                                                       out currFeatures, out featureStatus, out error,
                                                       winSize);

            newPositions = new List <PointF>();
            for (int i = 0; i < currFeatures.Length; i++)
            {
                if (featureStatus[i] == KLTFeatureStatus.Success)
                {
                    newPositions.Add(currFeatures[i]);
                }

                Console.WriteLine(featureStatus[i]);
            }
        }
예제 #2
0
        private void processImage(Gray <float>[,] prevIm, Gray <float>[,] currIm, List <PointF> oldPositions, out List <PointF> newPositions)
        {
            lkStorage.Process(prevIm, currIm);

            PointF[]           currFeatures;
            KLTFeatureStatus[] featureStatus;

            PyrLKOpticalFlow <Gray <float> > .EstimateFlow(lkStorage, oldPositions.ToArray(), out currFeatures, out featureStatus, winSize);

            newPositions = new List <PointF>();
            for (int i = 0; i < currFeatures.Length; i++)
            {
                if (featureStatus[i] == KLTFeatureStatus.Success)
                {
                    newPositions.Add(currFeatures[i]);
                }

                Console.WriteLine(featureStatus[i]);
            }
        }