public static IList <string> AnalyzeImage(WriteableBitmap imageToAnalyze)
        {
            IList <string> recognizedObjects = new List <string>();

            //get the color palletes
            Dictionary <Color, ColorInformation> imagePalette = PaletteAnalyzer.GetColorPallete(imageToAnalyze);

            //see what it matches with
            List <ObjectSignatureData> signatures = ObjectMemoryService.GetSignatures();

            foreach (ObjectSignatureData signature in signatures)
            {
                float colors  = signature.ObjectColors.Count;
                float matches = 0.0f;

                foreach (ObjectColorData colorData in signature.ObjectColors)
                {
                    if (imagePalette.ContainsKey(colorData.ObjectColor))
                    {
                        matches++;
                    }
                }

                if ((matches / colors) > AgreementCutoffPercent)
                {
                    recognizedObjects.Add(signature.ObjectName);
                }
            }

            return(recognizedObjects);
        }
Esempio n. 2
0
        private void PopulateLearnedItemsList()
        {
            List <ObjectSignatureData> learnedObjects = ObjectMemoryService.GetSignatures();

            this.LearnedObjectsList.Items.Clear();
            foreach (ObjectSignatureData objectSignatureData in learnedObjects)
            {
                this.LearnedObjectsList.Items.Add(objectSignatureData.ObjectName);
            }
        }