コード例 #1
0
        /// <summary>
        /// Calculates LBP from 2D array
        /// Enter array, radius and neighbours.
        /// </summary>
        public static void PipelineLBP(double[,] image, Parameters param,
                                       out double[,] result, out int[] histogram)
        {
            // Create instance of LBPApplication and set input variables
            LBPApplication LBPapp = new LBPApplication
            {
                Image = image,
                Param = param,
                MRE   = false // Don't use MRELBP methods
            };

            // Result image size
            LBPapp.d     = LBPapp.Param.Radius;
            LBPapp.xSize = image.GetLength(0) - 2 * LBPapp.d;
            LBPapp.ySize = image.GetLength(1) - 2 * LBPapp.d;

            // Calculate mapping and LBP image
            LBPapp.GetMapping();
            LBPapp.CalculateImage();

            // Calculate histogram
            LBPapp.GetHistogram();

            // output variables
            result    = LBPapp.LBPISMapped; // Mapping
            histogram = LBPapp.histS;
        }
コード例 #2
0
        /// <summary>
        /// Calculates MRELBP from 2D array
        /// Enter array and parameters class including small and large radius, neighbours and kernel weights.
        /// Weights are for center pixels (w_c), small (w_r[0]) and large (w_r[1]) radius.
        /// </summary>
        public static void PipelineMRELBP(double[,] image, Parameters param,
                                          out double[,] LBPIL, out double[,] LBPIS, out double[,] LBPIR, out int[] histL, out int[] histS, out int[] histR, out int[] histCenter)
        {
            // Create instance of LBPApplication and set input variables
            LBPApplication MRELBPapp = new LBPApplication
            {
                Image = image,
                Param = param,
                d     = param.LargeRadius + (param.W_r[0] - 1) / 2,
                MRE   = true // Median robust extended LBP
            };

            // Calculate mapping
            MRELBPapp.GetMapping();

            // Result image size
            MRELBPapp.xSize = image.GetLength(0) - 2 * MRELBPapp.d;
            MRELBPapp.ySize = image.GetLength(1) - 2 * MRELBPapp.d;

            // Scale image
            MRELBPapp.Scaling();

            // Median filtering using given weights
            MRELBPapp.FilterImage();

            // Calculate LBP image
            MRELBPapp.CalculateImage();

            // Calculate histogram
            MRELBPapp.GetHistogram();

            // output variables
            //LBPIL = MRELBPapp.LBPILMapped; // Mapping
            //LBPIS = MRELBPapp.LBPISMapped;
            //LBPIR = MRELBPapp.LBPIRMapped;
            LBPIL = MRELBPapp.LBPIL; // No mapping
            LBPIS = MRELBPapp.LBPIS;
            LBPIR = MRELBPapp.LBPIR;


            histL      = MRELBPapp.histL;
            histS      = MRELBPapp.histS;
            histR      = MRELBPapp.histR;
            histCenter = MRELBPapp.histCenter;
        }