コード例 #1
0
ファイル: Path.cs プロジェクト: tdck/opencvdotnet
        /// <summary>
        /// Calculate the histogram for the region of interest and saves it under
        /// initialHistogram.
        /// </summary>
        private void UpdateHistogram()
        {
            // release the previous histogram if any.
            if (initialHistogram != null)
            {
                initialHistogram.Release();
            }

            // if there's no image, just return.
            if (image == null)
            {
                return;
            }

            // we use symmetric bins and entire range.
            int[]    bpBins   = { NumberOfBins, NumberOfBins, NumberOfBins };
            CVPair[] bpRanges = { new CVPair(0, 255), new CVPair(0, 255), new CVPair(0, 255) };

            // calculate histogram for region of interest and display it in panel.
            image.RegionOfInterest = originalImage.SelectionRect;
            this.initialHistogram  = image.CalcHistogram(bpBins, bpRanges);
            initHisto.ShowHistogram(image);
            image.ResetROI();

            ResetSegmentation();

            RefreshImages();
        }