private void relevantImage_click(object sender, RoutedEventArgs e) { var checkBox = sender as CheckBox; //HistogramBin histogramBinIntensity = new HistogramBin(); //histogramBinIntensity.initializeHistogramIntensityMethod(); System.Windows.Controls.Image checkBoxImage = checkBox.Content as System.Windows.Controls.Image; //Cntrl+alt+q (During debugging) if (checkBoxImage == null || checkBoxImage.Source == null) { throw new Exception("bug!!"); } string imagePath = checkBoxImage.Source.ToString(); Uri currentImagePath = new Uri(imagePath); //Add queryImage in relevantImageFilePath if (checkBox.IsChecked == true) { RelevantImage relevantImages = new RelevantImage(); relevantImages.imageID = imagePath; relevantImage.Add(relevantImages); } else { RelevantImage existingImage = relevantImage.FirstOrDefault(item => new Uri(item.imageID) == currentImagePath); relevantImage.Remove(existingImage); } }
//Retrieve RelevantImageDetails histogram from allImageHistogram RF method private void retireveRelevantImageHistogram(List <RelevantImage> relevantImages) { foreach (RelevantImage selectedImage in relevantImages) { selectedImage.ImageFound = false; } this.relevantImageHistogram.Clear(); if (relevantImages.Count > 0) { foreach (RFMethodImageDetails image in allImageDetails) { foreach (RelevantImage relevantImg in relevantImages) { if (relevantImg.ImageFound == false) { //compare filepath i.e. imageID if (new Uri(image.imageID) == new Uri(relevantImg.imageID)) { RelevantImage userChoice = new RelevantImage(); relevantImg.ImageFound = true; //Stroing the relevant image in an instance of RelevantImage class userChoice.ImageFound = true; userChoice.imageID = relevantImg.imageID; userChoice.GaussianValue = image.GaussianNormalizedWeight; //List<double> im = image.GaussianNormalizedWeight; relevantImageHistogram.Add(userChoice); //exit inner loop and goto next image in outter loop main histogram break; } } } } } }
//RF method click private void RFMethod_click(object sender, RoutedEventArgs e) { setPageIndex(0); this.RelevantImage.IsEnabled = true; //Compute the rf method standard deviation, average value and minchowsky distance and return the result //call compute RF method rfMethodResultFiles.Clear(); relevantImage.Clear(); if (selecteImageFilePath == null) { MessageBox.Show("Please select one Image before we proceed"); return; } RelevantImage queryImage = new RelevantImage(); queryImage.imageID = selecteImageFilePath; relevantImage.Add(queryImage); RfMethod computeDistanceRfMethod = new RfMethod(); computeDistanceRfMethod.setQueryImage(selecteImageFilePath); computeDistanceRfMethod.setMethodName("colorCodeIntensity"); computeDistanceRfMethod.setallImageHistogramRfMethod(rfMethodHistogram); List <ResultCBIR> sortedDistance = computeDistanceRfMethod.computeResultRFMethod(0);//rfMethodIterationCount colorCodeIntensityGaussianValue = computeDistanceRfMethod.getGaussianValueImageDetails(); //computeDistanceRfMethod.createFeatureMatrix(); rfMethodIterationCount++; ////Add sorted imageid in a list foreach (ResultCBIR fieldid in sortedDistance) { rfMethodResultFiles.Add(fieldid.imageid); } renderImage(rfMethodResultFiles); }