public Mat EqualizeHistogram(Mat mat)
        {
            Mat output = new Mat();

            Imgproc.EqualizeHist(mat, output);
            return(output);
        }
示例#2
0
        /// <summary>
        /// Equalizes the histogram of an image and thresholds the result.
        /// </summary>
        /// <param name="src"> Image to eq & thresh </param>
        /// <param name="thresh"> thresh level </param>
        /// <param name="max"> max value to use </param>
        /// <returns> binary image (high pixels are in range) </returns>
        private Mat GetWhiteFromHistogramEq(Mat src, byte thresh, byte max)
        {
            Mat gray = new Mat(src.Size(), src.Type());

            Imgproc.CvtColor(src, gray, Imgproc.ColorBgr2gray);
            Imgproc.EqualizeHist(gray, gray);
            Imgproc.Threshold(gray, gray, thresh, max, Imgproc.ThreshBinary);
            return(gray);
        }