Exemplo n.º 1
0
        private unsafe static void goodFeaturesToTrack(Gray <float>[,] integralDxx, Gray <float>[,] integralDxy, Gray <float>[,] integralDyy,
                                                       int winSize, float minEigValue, Gray <float>[,] strengthImg)
        {
            minEigValue = System.Math.Max(1E-3f, minEigValue);
            int normFactor = winSize * winSize * 255;

            int maxCol = integralDxx.Width() - winSize;
            int maxRow = integralDxx.Height() - winSize;

            for (int row = 0; row < maxRow; row++)
            {
                for (int col = 0; col < maxCol; col++)
                {
                    var Dxx = integralDxx.GetSum(col, row, winSize, winSize);
                    var Dxy = integralDxy.GetSum(col, row, winSize, winSize);
                    var Dyy = integralDyy.GetSum(col, row, winSize, winSize);

                    var eigenVal = calcMinEigenVal(Dxx, Dxy, Dyy);
                    eigenVal /= normFactor;

                    if (eigenVal > minEigValue)
                    {
                        strengthImg[winSize / 2 + row, winSize / 2 + col] = eigenVal;
                    }
                }
            }
        }
        private unsafe static void goodFeaturesToTrack(Gray<float>[,] integralDxx, Gray<float>[,] integralDxy, Gray<float>[,] integralDyy,
                                                       int winSize, float minEigValue, Gray<float>[,] strengthImg)
        {
            minEigValue = System.Math.Max(1E-3f, minEigValue);
            int normFactor = winSize * winSize * 255;

            int maxCol = integralDxx.Width() - winSize;
            int maxRow = integralDxx.Height() - winSize;

            for (int row = 0; row < maxRow; row++)
            {
                for (int col = 0; col < maxCol; col++)
                {
                    var Dxx = integralDxx.GetSum(col, row, winSize, winSize);
                    var Dxy = integralDxy.GetSum(col, row, winSize, winSize);
                    var Dyy = integralDyy.GetSum(col, row, winSize, winSize);

                    var eigenVal = calcMinEigenVal(Dxx, Dxy, Dyy);
                    eigenVal /= normFactor;

                    if (eigenVal > minEigValue)
                    {
                        strengthImg[winSize / 2 + row, winSize / 2 + col] = eigenVal;
                    }
                }
            }
        }