private void RFRelevantImage_click(object sender, RoutedEventArgs e) { setPageIndex(0); rfMethodResultFiles.Clear(); if (relevantImage.Count == 0) { MessageBox.Show("Please select few relevant images before we proceed"); return; } else { RfMethod Rf = new RfMethod(); Rf.setMethodName("RF"); Rf.setQueryImage(selecteImageFilePath); List <ResultCBIR> sortedDistance = Rf.computeNewFeatureMatrix(relevantImage, colorCodeIntensityGaussianValue); foreach (ResultCBIR fieldid in sortedDistance) { rfMethodResultFiles.Add(fieldid.imageid); } renderImage(rfMethodResultFiles); } }
//Compute the pixel value and add it in histogram bin private void computePixelValue(List <string> files) { foreach (string filepath in files) { HistogramBin histogramBinIntensity = new HistogramBin(); histogramBinIntensity.initializeHistogramIntensityMethod(); histogramBinIntensity.initializehistogramColorCodeMethod(); histogramBinIntensity.setImageId(filepath); Bitmap b = new Bitmap(filepath, true); int width = b.Width; int height = b.Height; int totalPixel = height * width; histogramBinIntensity.setNumberOfPixelImage(totalPixel); for (int i = 0; i < width; i++) { for (int j = 0; j < height; j++) { Color pixel = b.GetPixel(i, j); byte red = pixel.R; byte green = pixel.G; byte blue = pixel.B; //Colorcode method int colorCode = (blue & (192)) >> 6 | (green & (192)) >> 4 | (red & (192)) >> 2; histogramBinIntensity.addElementHistogramColorCodeMethod(colorCode); //Intensity method double I = 0.299 * red + 0.587 * green + 0.114 * blue; histogramBinIntensity.addIntensityToBin(I); } } allimageDetailIntensityMethod.Add(histogramBinIntensity); } //call rf method and initialize histogram for RF method RfMethod callRfMethod = new RfMethod(); rfMethodHistogram = callRfMethod.createHistogramRfMethod(allimageDetailIntensityMethod); }
//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); }
//Call RF method and pass histogram public void createRFMethodDetails() { RfMethod rfMethodCall = new RfMethod(); rfMethodCall.createHistogramRfMethod(allimageDetailIntensityMethod); }