Пример #1
0
        public virtual IClassificationResult FinishEvaluation(bool clear)
        {
            IClassificationResult classificationResult = null;

            if (blobTracker != null)
            {
                TrackedGesture trackedGesture = blobTracker.TrackedBlobs;
                RecognitionMode = false;
                if (blobTracker.Trajectories.Count > 0)
                {
                    Console.WriteLine("Gesture trajectories to evaluate:" + blobTracker.Trajectories.Count);
                    List <IClassificationResult> oldResults = new List <IClassificationResult>();
                    // foreach (IClassify classifier in classifiers){
                    for (int i = 0; i < classifiers.Count; i++)
                    {
                        IClassify classifier = classifiers[i];
                        if (classifier != null)
                        {
                            classificationResult = classifier.Classify(blobTracker.FrameList, blobTracker.Trajectories);
                            if (classificationResult != null)
                            {
                                if (classificationResult.Probability > ProbabilityThreshold)
                                {
                                    break;
                                }
                                else
                                {
                                    oldResults.Add(classificationResult);
                                }
                            }
                        }
                    }

                    // no result was taken directly, so find the first one with the highest probability
                    if (oldResults != null && oldResults.Count > 0)
                    {
                        foreach (var result in oldResults)
                        {
                            if (classificationResult == null || result.Probability > classificationResult.Probability)
                            {
                                classificationResult = result;
                            }
                        }
                    }
                }
                if (clear)
                {
                    blobTracker.InitiateTracking();
                }
            }
            return(classificationResult);
        }
Пример #2
0
        private void method_5(IColorRamp icolorRamp_1, IClassBreaksRenderer iclassBreaksRenderer_1, int int_0,
                              ITable itable_0, string string_0, string string_1, esriDataNormalization esriDataNormalization_0)
        {
            try
            {
                esriGeometryType esriGeometryAny = esriGeometryType.esriGeometryAny;
                if (this.igeoFeatureLayer_0.FeatureClass != null)
                {
                    esriGeometryAny = this.igeoFeatureLayer_0.FeatureClass.ShapeType;
                }
                IClassify classify =
                    this.method_2((iclassBreaksRenderer_1 as IClassBreaksUIProperties).Method) as IClassify;
                if (classify != null)
                {
                    object          obj2;
                    object          obj3;
                    bool            flag;
                    ITableHistogram histogram = new BasicTableHistogramClass
                    {
                        Field     = string_0,
                        Table     = itable_0,
                        NormField = string_1
                    };
                    (histogram as IDataNormalization).NormalizationType = esriDataNormalization_0;
                    (histogram as IBasicHistogram).GetHistogram(out obj2, out obj3);
                    if (classify is IClassifyMinMax2)
                    {
                        double minimum = (histogram as IStatisticsResults).Minimum;
                        double maximum = (histogram as IStatisticsResults).Maximum;
                        (classify as IClassifyMinMax2).ClassifyMinMax(minimum, maximum, ref int_0);
                    }
                    else if (classify is IDeviationInterval)
                    {
                        (classify as IDeviationInterval).Mean        = (histogram as IStatisticsResults).Mean;
                        (classify as IDeviationInterval).StandardDev =
                            (histogram as IStatisticsResults).StandardDeviation;
                        (classify as IDeviationInterval).DeviationInterval = 0.5;
                        classify.Classify(ref int_0);
                    }
                    else
                    {
                        (classify as IClassifyGEN).Classify(obj2, obj3, ref int_0);
                    }
                    iclassBreaksRenderer_1.BreakCount = int_0;
                    this.bool_0 = false;
                    this.cboClassifyNum.SelectedIndex = int_0 - 1;
                    this.bool_0 = true;
                    double[] classBreaks = (double[])classify.ClassBreaks;
                    if (classBreaks.Length == 0)
                    {
                        icolorRamp_1.Size = 5;
                    }
                    else
                    {
                        icolorRamp_1.Size = classBreaks.Length;
                    }
                    icolorRamp_1.CreateRamp(out flag);
                    IEnumColors colors = icolorRamp_1.Colors;
                    ISymbol     sym    = null;
                    for (int i = 0; i < (classBreaks.Length - 1); i++)
                    {
                        IColor color = colors.Next();
                        switch (esriGeometryAny)
                        {
                        case esriGeometryType.esriGeometryLine:
                        case esriGeometryType.esriGeometryPolyline:
                        {
                            ILineSymbol symbol2 = new SimpleLineSymbolClass
                            {
                                Color = color
                            };
                            sym = symbol2 as ISymbol;
                            break;
                        }

                        case esriGeometryType.esriGeometryPolygon:
                        {
                            ISimpleFillSymbol symbol3 = new SimpleFillSymbolClass
                            {
                                Color = color,
                                Style = esriSimpleFillStyle.esriSFSSolid
                            };
                            sym = symbol3 as ISymbol;
                            break;
                        }

                        case esriGeometryType.esriGeometryPoint:
                        case esriGeometryType.esriGeometryMultipoint:
                        {
                            IMarkerSymbol symbol4 = new SimpleMarkerSymbolClass
                            {
                                Color = color
                            };
                            sym = symbol4 as ISymbol;
                            break;
                        }
                        }
                        iclassBreaksRenderer_1.set_Symbol(i, sym);
                        (iclassBreaksRenderer_1 as IClassBreaksUIProperties).set_LowBreak(i, classBreaks[i]);
                        iclassBreaksRenderer_1.set_Break(i, classBreaks[i + 1]);
                        string label = classBreaks[i].ToString() + " - " + classBreaks[i + 1].ToString();
                        iclassBreaksRenderer_1.set_Label(i, label);
                    }
                }
            }
            catch (Exception exception)
            {
                Logger.Current.Error("", exception, "");
            }
        }