コード例 #1
0
        public static List <ObjectCharacteristics> GetCharacteristics(RegistryKey key)
        {
            List <ObjectCharacteristics> list = new List <ObjectCharacteristics>();

            using (RegistryKey searchCriteria = key.OpenSubKey("SearchCriteria"))
            {
                if (null != searchCriteria)
                {
                    foreach (string objectID in searchCriteria.GetSubKeyNames())
                    {
                        ObjectCharacteristics obj = new ObjectCharacteristics();

                        using (RegistryKey optionKey = searchCriteria.OpenSubKey(objectID))
                        {
                            obj.ID = Guid.Parse(objectID);
                            string objType = (string)optionKey.GetValue("ImageObjectType");
                            obj.ObjectType        = (ImageObjectType)Enum.Parse(typeof(ImageObjectType), objType);
                            obj.Confidence        = (int)optionKey.GetValue("Confidence");
                            obj.MinPercentOverlap = (int)optionKey.GetValue("Overlap");
                            obj.TimeFrame         = (int)optionKey.GetValue("TimeFrame");
                            obj.MinimumXSize      = (int)optionKey.GetValue("MinimumXSize");
                            obj.MinimumYSize      = (int)optionKey.GetValue("MinimumYSize");
                        }

                        list.Add(obj);
                    }
                }
            }

            return(list);
        }
コード例 #2
0
        public ObjectDefinitionDialog(ObjectCharacteristics src)
        {
            InitializeComponent();

            if (null != src)
            {
                int index = ObjectCombo.FindString(src.ObjectType);
                ObjectCombo.SelectedIndex = index;
                ConfidenceNumeric.Value   = src.Confidence;
                overlapNumeric.Value      = src.MinPercentOverlap;
                minWidthNumeric.Value     = src.MinimumXSize;
                minHeightNumeric.Value    = src.MinimumYSize;
                historyNumeric.Value      = src.TimeFrame;
            }
        }
コード例 #3
0
ファイル: FrameAnalyzer.cs プロジェクト: kummerr/On-Guard
        public static bool MatchesSpecialTag(ObjectCharacteristics objChar, string label)
        {
            bool result = false;

            switch (objChar.ObjectType)
            {
            case "* Any Vehicle":
                result = IsVehicle(label);
                break;

            case "* Any Mammal":
                result = IsMammal(label);
                break;
            }


            return(result);
        }
コード例 #4
0
        // Editing ObjectCharacteristics
        private void ObjectsListView_ItemActivate(object sender, EventArgs e)
        {
            ListViewItem          item    = ObjectsListView.SelectedItems[0];
            ObjectCharacteristics objChar = (ObjectCharacteristics)item.Tag;

            using (ObjectDefinitionDialog dlg = new ObjectDefinitionDialog(objChar))
            {
                DialogResult result = dlg.ShowDialog();
                if (result == DialogResult.OK)
                {
                    objChar.ObjectType        = dlg.ObjectType;
                    objChar.Confidence        = dlg.Confidence;
                    objChar.MinPercentOverlap = dlg.Overlap;
                    objChar.MinimumXSize      = dlg.MinX;
                    objChar.MinimumYSize      = dlg.MinY;
                    objChar.TimeFrame         = dlg.History;
                }
            }
        }
コード例 #5
0
        private void AddButton_Click(object sender, EventArgs e)
        {
            using (ObjectDefinitionDialog dlg = new ObjectDefinitionDialog())
            {
                DialogResult result = dlg.ShowDialog();
                if (result == DialogResult.OK)
                {
                    ListViewItem item = new ListViewItem(new string[] { dlg.ObjectType, dlg.Confidence.ToString(), dlg.Overlap.ToString(), dlg.MinX.ToString(), dlg.MinY.ToString(), dlg.History.ToString() });
                    item = ObjectsListView.Items.Add(item);
                    ObjectCharacteristics objChar = new ObjectCharacteristics();
                    objChar.ObjectType        = dlg.ObjectType;
                    objChar.Confidence        = dlg.Confidence;
                    objChar.MinPercentOverlap = dlg.Overlap;
                    objChar.MinimumXSize      = dlg.MinX;
                    objChar.MinimumYSize      = dlg.MinY;
                    objChar.TimeFrame         = dlg.History;

                    item.Tag = objChar;
                }
            }
        }
コード例 #6
0
        private bool SaveAreaData()
        {
            bool result = true;

            if (string.IsNullOrEmpty(aoiNameText.Text))
            {
                MessageBox.Show("You must provide a name for this area!");
                result = false;
            }
            else
            {
                if (Area.SearchCriteria != null)
                {
                    Area.SearchCriteria.Clear();
                }

                Area.AOIName = aoiNameText.Text;

                if (doorButton.Checked)
                {
                    Area.AOIType = AOIType.Door;
                }
                else if (garageButton.Checked)
                {
                    Area.AOIType = AOIType.GarageDoor;
                }
                else if (drivewayButton.Checked)
                {
                    Area.AOIType = AOIType.Driveway;
                }
                else if (peopleWalkingButton.Checked)
                {
                    Area.AOIType = AOIType.PeopleWalking;
                }
                else if (ignoreButton.Checked)
                {
                    Area.AOIType = AOIType.IgnoreObjects;
                }

                if (anyActivityButton.Checked)
                {
                    Area.MovementType = MovementType.AnyActivity;
                }
                else if (arrivingButton.Checked)
                {
                    Area.MovementType = MovementType.Arrival;
                }
                else if (departingButton.Checked)
                {
                    Area.MovementType = MovementType.Departure;
                }

                if (peopleCheck.Checked)
                {
                    ObjectCharacteristics c = new ObjectCharacteristics()
                    {
                        ObjectType        = ImageObjectType.People,
                        Confidence        = (int)peopleConfidenceNumeric.Value,
                        MinPercentOverlap = (int)peopleMinimumOverlap.Value,
                        TimeFrame         = (int)peopleFramesNumeric.Value,
                        MinimumXSize      = (int)peopleMinXNumeric.Value,
                        MinimumYSize      = (int)peopleMinYNumeric.Value,
                    };
                    Area.SearchCriteria.Add(c);
                }

                if (carsCheck.Checked)
                {
                    ObjectCharacteristics c = new ObjectCharacteristics
                    {
                        ObjectType        = ImageObjectType.Cars,
                        Confidence        = (int)carsConfidenceNumeric.Value,
                        MinPercentOverlap = (int)carsOverlapNumeric.Value,
                        TimeFrame         = (int)carsFramesNumeric.Value,
                        MinimumXSize      = (int)carsMinXNumeric.Value,
                        MinimumYSize      = (int)carsMinYNumeric.Value,
                    };
                    Area.SearchCriteria.Add(c);
                }

                if (truckCheck.Checked)
                {
                    ObjectCharacteristics c = new ObjectCharacteristics
                    {
                        ObjectType        = ImageObjectType.Trucks,
                        Confidence        = (int)trucksConfidenceNumeric.Value,
                        MinPercentOverlap = (int)trucksOverlapNumeric.Value,
                        TimeFrame         = (int)trucksFramesNumeric.Value,
                        MinimumXSize      = (int)trucksMinXNumeric.Value,
                        MinimumYSize      = (int)trucksMinYNumeric.Value,
                    };
                    Area.SearchCriteria.Add(c);
                }

                if (motorcycleCheck.Checked)
                {
                    ObjectCharacteristics c = new ObjectCharacteristics
                    {
                        ObjectType        = ImageObjectType.Motorcycles,
                        Confidence        = (int)motorcyclesConfidenceNumeric.Value,
                        MinPercentOverlap = (int)motorcyclesOverlapNumeric.Value,
                        TimeFrame         = (int)motorcyclesFramesNumeric.Value,
                        MinimumXSize      = (int)motorcyclesMinXNumeric.Value,
                        MinimumYSize      = (int)motorcyclesMinYNumeric.Value,
                    };
                    Area.SearchCriteria.Add(c);
                }

                if (bikeCheck.Checked)
                {
                    ObjectCharacteristics c = new ObjectCharacteristics
                    {
                        ObjectType        = ImageObjectType.Bikes,
                        Confidence        = (int)bikesConfidenceNumeric.Value,
                        MinPercentOverlap = (int)bikesOverlapNumeric.Value,
                        TimeFrame         = (int)bikesFramesNumeric.Value,
                        MinimumXSize      = (int)bikesMinXNumeric.Value,
                        MinimumYSize      = (int)bikesMinYNumeric.Value,
                    };
                    Area.SearchCriteria.Add(c);
                }

                if (bearsCheck.Checked)
                {
                    ObjectCharacteristics c = new ObjectCharacteristics
                    {
                        ObjectType        = ImageObjectType.Bears,
                        Confidence        = (int)bearsConfidenceNumeric.Value,
                        MinPercentOverlap = (int)bearsOverlapNumeric.Value,
                        TimeFrame         = (int)bearsFramesNumeric.Value,
                        MinimumXSize      = (int)bearsMinXNumeric.Value,
                        MinimumYSize      = (int)bearsMinYNumeric.Value,
                    };
                    Area.SearchCriteria.Add(c);
                }

                if (animalsCheck.Checked)
                {
                    ObjectCharacteristics c = new ObjectCharacteristics
                    {
                        ObjectType        = ImageObjectType.Animals,
                        Confidence        = (int)animalsConfidenceNumeric.Value,
                        MinPercentOverlap = (int)animalsOverlapNumeric.Value,
                        TimeFrame         = (int)animalsFramesNumeric.Value,
                        MinimumXSize      = (int)animalsMinXNumeric.Value,
                        MinimumYSize      = (int)animalsMinYNumeric.Value,
                    };
                    Area.SearchCriteria.Add(c);
                }

                _rectangle               = new Rectangle((int)xNumeric.Value, (int)yNumeric.Value, (int)widthNumeric.Value, (int)heighNumeric.Value);
                Area.AreaRect            = _rectangle;
                Area.OriginalXResolution = BitmapResolution.XResolution;
                Area.OriginalYResolution = BitmapResolution.YResolution;
            }

            return(result);
        }