コード例 #1
0
        private void writeDCDInfo(CLDHandler cldHandler, FileSystemWriter fsw)
        {
            foreach (KeyValuePair<string, Bitmap> image in images)
            {
                cldHandler.calcDescriptorInfo(image.Value);
                // write to file
                string[] pathParts = image.Key.Split('\\');
                string imageNameAndExt = pathParts[pathParts.Length - 1];
                string imageName = imageNameAndExt.Split('.').ElementAt(0);
                List<int[]> rgbList = cldHandler.RGBValues;

                Quantizer q=null;

                if (Reduce16PositionsCheck.Checked)
                {
                    rgbList = cldHandler.getReduce64To16Cells(rgbList);
                }

                if (hsl_15_rb.Checked)
                {
                    q = getQuantizer("HSV_QUANTIZER");
                    q.process_cld(Quantizer.BINS.BINS_15, rgbList);
                }
                else if (hsl_27_rb.Checked)
                {
                    q = getQuantizer("HSV_QUANTIZER");
                    q.process_cld(Quantizer.BINS.BINS_27, rgbList);
                }
                else if (hsl_48_rb.Checked)
                {
                    q = getQuantizer("HSV_QUANTIZER");
                    q.process_cld(Quantizer.BINS.BINS_48, rgbList);
                }
                else if (rgb_27_rb.Checked)
                {
                    q = getQuantizer("COLOUR_27_QUANTIZER");
                    q.process_cld(Quantizer.BINS.BINS_27, rgbList);
                }
                else if (rgb_64_rb.Checked)
                {
                    q = getQuantizer("COLOUR_27_QUANTIZER");
                    q.process_cld(Quantizer.BINS.BINS_64, rgbList);
                }
                else if (lab_x_rb.Checked)
                {
                    q = getQuantizer("RGB_HISTOGRAM_QUANTIZER");
                }

                fsw.writeFile(imageName, q.getList(Quantizer.FEATURE_VECTOR.POSITION));

            }
            // close the connection
            fsw.closeFile();

            MessageBox.Show("CLD DONE!");
        }
コード例 #2
0
        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!");
        }