コード例 #1
0
        private void button1_Click(object sender, EventArgs e)
        {
            var        filter = new AnimalFilter();
            var        confd  = new ConfidenceCheck();
            List <Tag> tags   = animalImageTagger.GetTagsForImage(textBox1.Text);

            foreach (Tag tag in tags)
            {
                //checking each picutre
                filter.checkAnimal(tag.name, tag.confidence);
                if (confd.result(tag.confidence) == true)
                {
                    if (tag.name == "dog")
                    {
                        checkBox1.Checked = true;
                    }
                    else if (tag.name == "cat")
                    {
                        checkBox2.Checked = true;
                    }
                    else if (tag.name == "bird")
                    {
                        checkBox3.Checked = true;
                    }
                }
                pictureBox1.Image = Image.FromFile(@"" + textBox1.Text);
            }
        }
コード例 #2
0
        private void search_button_Click(object sender, EventArgs e)
        {// Begins identification on button click.
            //Creates new image tagger object and inputs user path through the GetTags method
            ImageTagger animalImageTagger = new ImageTagger();
            List <Tag>  tags = animalImageTagger.GetTagsForImage(textBoxText);

            //creates new tag filter and then runs the tag list through it
            TagFilter  filter       = new TagFilter();
            List <Tag> filteredTags = filter.Filter(tags);

            foreach (Tag tag in tags)
            {
                if (tag.name == "cat")
                {
                    checkBox2.Checked = true;
                }
                if (tag.name == "dog")
                {
                    checkBox1.Checked = true;
                }
                if (tag.name == "bird")
                {
                    checkBox3.Checked = true;
                }
            }
        }
コード例 #3
0
        private void button1_Click(object sender, EventArgs e)
        {
            AnimalIdentifier_Base.TagReader find = new AnimalIdentifier_Base.TagReader();
            ImageTagger item = new ImageTagger();
            List <Tag>  tags = item.GetTagsForImage(Grab_Path.Text);

            foreach (Tag tag in tags)
            {
                find.Polymorphic(find.check_Dog, tag);
                find.Polymorphic(find.check_Cat, tag);
                find.Polymorphic(find.check_Bird, tag);
            }

            Found_dog.Checked = find.check_Dog.Is_found;

            //if (find.check_Dog.Is_found == true)
            //    Found_dog.Checked = true;
            //if (find.check_Cat.Is_found == true)
            //    Found_cat.Checked = true;
            //if (find.check_Bird.Is_found == true)
            //    Found_bird.Checked = true;

            //if (Found_dog.Checked == Found_cat.Checked && Found_dog.Checked == true)
            //{
            //    if (Found_dog == Found_bird)
            //        View_output.Text = "A Bird, A cat and A dog are in this picture";
            //    else
            //        View_output.Text = "A dog and a cat are in this picture";
            //}
            //else if (Found_bird.Checked == Found_cat.Checked && Found_cat.Checked == true)
            //    View_output.Text = "A bird and a cat are in this picture";
            //else if (Found_dog.Checked == Found_bird.Checked && Found_bird.Checked == true)
            //    View_output.Text = "A bird and a dog are in this picture";
            //else if (Found_dog.Checked)
            //    View_output.Text = "A dog is in this picture";
            //else if (Found_cat.Checked)
            //    View_output.Text = "A cat is in this picture";
            //else if (Found_bird.Checked)
            //    View_output.Text = "A bird is in this picture";
            //else
            //    View_output.Text = "This picture contains no animals";
        }