Example #1
0
        private void Complete_Auth_Click(object sender, RoutedEventArgs e)
        {
            if (String.IsNullOrEmpty(CodeText.Text))
            {
                MessageBox.Show("You must paste the verifier code into the textbox above.");
                return;
            }
            try
            {
                FlickrManager f = (FlickrManager)p.Manager;
                f.CompleteAuth(CodeText.Text);
                MessageBox.Show("User authenticated!");
                if (f.IsAuthenticated())
                {
                    List<Image> imgObjs = f.GetPhotos();
                    ImageColorData img = new ImageColorData();
                    foreach (Image imgObj in imgObjs)
                    {

                        Dictionary<String, List<System.Drawing.Color>> imgColor = img.getColorsInImage(imgObj.Img);
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
        public ImageDataStore StorePhotosAndImageData()
        {
            List <Image>    images          = new List <Image>();
            ImageDataStore  iODObj          = new ImageDataStore();
            ImageColorData  iCDObj          = new ImageColorData();
            PhotoCollection photocollection = Instance.PeopleGetPhotos();

            foreach (Photo p in photocollection)
            {
                if (p.LargeUrl != null)
                {
                    Image userImage = new Image(p.LargeUrl);
                    iCDObj.GetColorData(userImage);
                    images.Add(userImage);
                }
            }
            iODObj.Images          = images;
            iODObj.imgObjColorData = iCDObj;

            return(iODObj);
        }
Example #3
0
        private void Form1_Load(object sender, EventArgs e)
        {
            ImageColorData iCD = new ImageColorData();
            Bitmap img = new Bitmap("C:\\Users\\Administrator\\Desktop\\1.jpg");
            Dictionary<String, List<Color>> colorStructsOfImage = iCD.getColorsInImage(img);
            float avgBrightnessByColor = iCD.calcAverageBrightnessByColor("Violet");
            float percentageOfColor = iCD.percentageOfColorInImage("Yellow");
            label1.Text = iCD.percentageOfColorInImage("Violet").ToString();
            label2.Text = iCD.percentageOfColorInImage("Indigo").ToString();
            label3.Text = iCD.percentageOfColorInImage("Blue").ToString();
            label4.Text = iCD.percentageOfColorInImage("Green").ToString();
            label5.Text = iCD.percentageOfColorInImage("Yellow").ToString();
            label6.Text = iCD.percentageOfColorInImage("Orange").ToString();
            label7.Text = iCD.percentageOfColorInImage("Red").ToString();

            label17.Text = iCD.calcAverageBrightnessByColor("Violet").ToString();
            label18.Text = iCD.calcAverageBrightnessByColor("Indigo").ToString();
            label19.Text = iCD.calcAverageBrightnessByColor("Blue").ToString();
            label20.Text = iCD.calcAverageBrightnessByColor("Green").ToString();
            label21.Text = iCD.calcAverageBrightnessByColor("Yellow").ToString();
            label22.Text = iCD.calcAverageBrightnessByColor("Orange").ToString();
            label23.Text = iCD.calcAverageBrightnessByColor("Red").ToString();
        }