private void dcdBtn_Click(object sender, EventArgs e) { String folderPath = inputFileTxt.Text; // Read images images = fsr.readFiles(folderPath); DCDHandler dcdHandler = (DCDHandler)descFactory.getDescriptorHandler(DescHandlerFactory.Descriptor.DCD); if (outDirTxt.Text == null || outDirTxt.Text.Length == 0) { DialogResult outDirNotSetWarning = MessageBox.Show("Output Directory is not set. Results will be written to input directory. Continue?", "Warning", MessageBoxButtons.YesNo); if (outDirNotSetWarning == DialogResult.Yes) { FileSystemWriter fsw = new FileSystemWriter(inputFileTxt.Text + "\\ExistanceResult.txt"); FileSystemWriter fsw2 = new FileSystemWriter(inputFileTxt.Text + "\\PropotionResult.txt"); writeDCDInfo(dcdHandler, fsw, fsw2); } else { return; } } else { FileSystemWriter fsw = new FileSystemWriter(outDirTxt.Text + "\\ExistanceResult.txt"); FileSystemWriter fsw2 = new FileSystemWriter(outDirTxt.Text + "\\PropotionResult.txt"); writeDCDInfo(dcdHandler, fsw, fsw2); } }
private void dcdBtn_Click(object sender, EventArgs e) { String fileName = inputFileTxt.Text; DCDHandler dcdHandler = (DCDHandler)descFactory.getDescriptorHandler(DescHandlerFactory.Descriptor.DCD); dcdHandler.calcDescriptorInfo(fileName); DCDResult dcdForm = new DCDResult(); dcdForm.setDCDInfo(fileName, dcdHandler.DominantRGB); dcdForm.Show(); }
private void writeDCDInfo(DCDHandler dcdHandler, FileSystemWriter fsw, FileSystemWriter fsw2) { foreach (KeyValuePair<string, Bitmap> image in images) { dcdHandler.calcDescriptorInfo(image.Value); // write to file string[] pathParts = image.Key.Split('\\'); string imageNameAndExt = pathParts[pathParts.Length - 1]; string imageName=""; string[] imageNameParts = imageNameAndExt.Split('.'); // To handle file names with '.' for (int i = 0; i < imageNameParts.Length - 1;i++ ) { imageName += imageNameParts[i]; if (i < imageNameParts.Length - 2) { imageName += "."; } } List<int[]> rgbpList = dcdHandler.DominantRGB; Quantizer q = null; if (hsl_15_rb.Checked) { q = getQuantizer("HSV_QUANTIZER"); q.process_dcd(Quantizer.BINS.BINS_15, rgbpList); }else if(hsl_27_rb.Checked){ q = getQuantizer("HSV_QUANTIZER"); q.process_dcd(Quantizer.BINS.BINS_27, rgbpList); } else if (hsl_48_rb.Checked) { q = getQuantizer("HSV_QUANTIZER"); q.process_dcd(Quantizer.BINS.BINS_48, rgbpList); } else if (rgb_27_rb.Checked) { q = getQuantizer("COLOUR_27_QUANTIZER"); q.process_dcd(Quantizer.BINS.BINS_27, rgbpList); } else if (rgb_64_rb.Checked) { q = getQuantizer("COLOUR_27_QUANTIZER"); q.process_dcd(Quantizer.BINS.BINS_64, rgbpList); } else if (lab_x_rb.Checked) { q = getQuantizer("RGB_HISTOGRAM_QUANTIZER"); } fsw.writeFile(imageName, q.getList(Quantizer.FEATURE_VECTOR.EXISTENCE)); // write propotion fsw2.writeFile(imageName, q.getList(Quantizer.FEATURE_VECTOR.PROPORTION)); } // close the connection fsw.closeFile(); fsw2.closeFile(); MessageBox.Show("DCD DONE!"); }
private void writeDCDInfo(DCDHandler dcdHandler, FileSystemWriter fsw, FileSystemWriter fsw2) { foreach (KeyValuePair <string, Bitmap> image in images) { dcdHandler.calcDescriptorInfo(image.Value); // write to file string[] pathParts = image.Key.Split('\\'); string imageNameAndExt = pathParts[pathParts.Length - 1]; string imageName = ""; string[] imageNameParts = imageNameAndExt.Split('.'); // To handle file names with '.' for (int i = 0; i < imageNameParts.Length - 1; i++) { imageName += imageNameParts[i]; if (i < imageNameParts.Length - 2) { imageName += "."; } } List <int[]> rgbpList = dcdHandler.DominantRGB; Quantizer q = null; if (hsl_15_rb.Checked) { q = getQuantizer("HSV_QUANTIZER"); q.process_dcd(Quantizer.BINS.BINS_15, rgbpList); } else if (hsl_27_rb.Checked) { q = getQuantizer("HSV_QUANTIZER"); q.process_dcd(Quantizer.BINS.BINS_27, rgbpList); } else if (hsl_48_rb.Checked) { q = getQuantizer("HSV_QUANTIZER"); q.process_dcd(Quantizer.BINS.BINS_48, rgbpList); } else if (rgb_27_rb.Checked) { q = getQuantizer("COLOUR_27_QUANTIZER"); q.process_dcd(Quantizer.BINS.BINS_27, rgbpList); } else if (rgb_64_rb.Checked) { q = getQuantizer("COLOUR_27_QUANTIZER"); q.process_dcd(Quantizer.BINS.BINS_64, rgbpList); } else if (lab_x_rb.Checked) { q = getQuantizer("RGB_HISTOGRAM_QUANTIZER"); } fsw.writeFile(imageName, q.getList(Quantizer.FEATURE_VECTOR.EXISTENCE)); // write propotion fsw2.writeFile(imageName, q.getList(Quantizer.FEATURE_VECTOR.PROPORTION)); } // close the connection fsw.closeFile(); fsw2.closeFile(); MessageBox.Show("DCD DONE!"); }