Ejemplo n.º 1
0
        public double FindEquivilanceProbability(GroupDefinitionModel knownGDM, GroupDefinitionModel unknownGDM)
        {
            ProbabilityCalculator pC = new ProbabilityCalculator();
            int weightLimmit         = unknownGDM.GroupHeight * unknownGDM.GroupWidth;

            return
                ((
                     pC.CalculateDifferenceProbability(knownGDM.HorizontalVariance, unknownGDM.HorizontalVariance, unknownGDM.GroupWidth * (unknownGDM.GroupWidth - 1) * (unknownGDM.GroupWidth - 1)) + // fix the varience probabilities
                     pC.CalculateDifferenceProbability(knownGDM.VerticleVariance, unknownGDM.VerticleVariance, unknownGDM.GroupHeight * (unknownGDM.GroupHeight - 1) * (unknownGDM.GroupHeight - 1)) +
                     pC.CalculateDifferenceProbability(knownGDM.HorizontalDensity, unknownGDM.HorizontalDensity, unknownGDM.GroupWidth) +
                     pC.CalculateDifferenceProbability(knownGDM.VerticleDensity, unknownGDM.VerticleDensity, unknownGDM.GroupHeight) +
                     pC.CalculateDifferenceProbability(knownGDM.Weight, unknownGDM.Weight, weightLimmit)
                     ) / 5);
        }
Ejemplo n.º 2
0
        public GroupDefinitionModel CreateGroupDefinitionModel(Bitmap pixelGroupBitmap)
        {
            ImageInterpreter      imageInterpreter      = new ImageInterpreter();
            ProbabilityCalculator probabilityCalculator = new ProbabilityCalculator();

            double[] horizontalDensities = imageInterpreter.CalculateHorisontalDensities(pixelGroupBitmap);
            double[] verticleDensities   = imageInterpreter.CaculateVerticleDensities(pixelGroupBitmap);

            return(new GroupDefinitionModel
            {
                Weight = imageInterpreter.CalculateWeight(pixelGroupBitmap),
                HorizontalDensity = imageInterpreter.FindTotalDensity(horizontalDensities),
                VerticleDensity = imageInterpreter.FindTotalDensity(verticleDensities),
                HorizontalVariance = probabilityCalculator.CalculateVariance(horizontalDensities, imageInterpreter.FindTotalDensity(horizontalDensities)),
                VerticleVariance = probabilityCalculator.CalculateVariance(verticleDensities, imageInterpreter.FindTotalDensity(verticleDensities))
            });
        }