コード例 #1
0
ファイル: Program.cs プロジェクト: dmarkachev/CSE803Project
        private static double GetColorBinDistance(byte[] pixelArray, byte[] thresholdedPixelArray, int stride, double[] targetHistogram, WriteableBitmap tempBitmap, Color color)
        {
            var boundingBox = BitmapColorer.GetBoundingBoxOfColor(tempBitmap, color);

            var croppedPixelArray       = pixelArray.CropPixelArray((int)boundingBox.X, (int)boundingBox.Y, (int)boundingBox.Width, (int)boundingBox.Height, stride);
            var croppedThresholdedArray = thresholdedPixelArray.CropPixelArray((int)boundingBox.X, (int)boundingBox.Y, (int)boundingBox.Width, (int)boundingBox.Height, stride);
            var colorBins = ColorClassifier.GetColorBinsWithinBlob(croppedPixelArray, croppedThresholdedArray, true);
            var distance  = ColorClassifier.CalculateBinDistance(colorBins, targetHistogram);

            return(distance);
        }