Пример #1
0
        private void btExtraction_Click(object sender, EventArgs e)
        {
            watch = new Stopwatch();
            watch.Start();
            feature = new double[countFile, 6];
            int i = 0;
            int j = 0;

            foreach (var c in trainingData)
            {
                foreach (var fimage in c.Value)
                {
                    glcm = new GLCMFeatureExtraction(new Clahe(8, 8, 256, 10, new Bitmap(fimage)).Process(), Convert.ToInt32(numGrayLevel.Value));
                    //glcm = new GLCMFeatureExtraction(new Bitmap(fimage), Convert.ToInt32(numGrayLevel.Value));
                    glcm.extract();
                    feature[j, 0] = glcm.getContrast();
                    feature[j, 1] = glcm.getDissimilarity();
                    feature[j, 2] = glcm.getEnergy();
                    feature[j, 3] = glcm.getEntropy();
                    feature[j, 4] = glcm.getHomogenity();
                    feature[j, 5] = i;
                    j++;
                }
                Console.WriteLine("Extraction Class : " + i + ", Now Time : " + watch.Elapsed.TotalSeconds + " s");
                i++;
            }
            featureToTxt();
            watch.Stop();
            Console.WriteLine("Extraction Time : " + watch.Elapsed.TotalSeconds + " s");
            btTraining.Enabled   = true;
            btAccuration.Enabled = true;
        }
Пример #2
0
 private int testingDataImage(Image img)
 {
     glcm = new GLCMFeatureExtraction(new Clahe(8, 8, 256, 10, new Bitmap(img)).Process(), Convert.ToInt16(numGrayLevel.Value));
     //glcm = new GLCMFeatureExtraction(img, Convert.ToInt32(numGrayLevel.Value));
     double[] testGlcm = new double[5];
     glcm.extract();
     testGlcm[0] = glcm.getContrast();
     testGlcm[1] = glcm.getDissimilarity();
     testGlcm[2] = glcm.getEnergy();
     testGlcm[3] = glcm.getEntropy();
     testGlcm[4] = glcm.getHomogenity();
     return(lvq.testing(testGlcm, weightAkhir));
 }
Пример #3
0
        private void glcm(Image image)
        {
            progress.Maximum = 7;
            progress.Value   = 0;
            GLCMFeatureExtraction glcm = new GLCMFeatureExtraction(image, 10);

            progress.Value++;
            glcm.extract();
            progress.Value++;
            log("Contrast : " + glcm.getContrast());
            progress.Value++;
            log("Disimiliarity : " + glcm.getDissimilarity());
            progress.Value++;
            log("Energy : " + glcm.getEnergy());
            progress.Value++;
            log("Entropy : " + glcm.getEntropy());
            progress.Value++;
            log("Homogenity : " + glcm.getHomogenity());
            progress.Value++;
        }
Пример #4
0
        private void extractionTestingAccuration()
        {
            watch = new Stopwatch();
            watch.Start();
            int i       = 0;
            int correct = 0;

            foreach (var c in testingData)
            {
                foreach (var fimage in c.Value)
                {
                    bool corr = false;
                    var  featureAccuration = new double[5];
                    glcm = new GLCMFeatureExtraction(new Clahe(8, 8, 256, 10, new Bitmap(fimage)).Process(), Convert.ToInt32(numGrayLevel.Value));
                    //glcm = new GLCMFeatureExtraction(new Bitmap(fimage), Convert.ToInt32(numGrayLevel.Value));
                    glcm.extract();
                    featureAccuration[0] = glcm.getContrast();
                    featureAccuration[1] = glcm.getDissimilarity();
                    featureAccuration[2] = glcm.getEnergy();
                    featureAccuration[3] = glcm.getEntropy();
                    featureAccuration[4] = glcm.getHomogenity();
                    int r = lvq.testing(featureAccuration, weightAkhir);
                    if (r == i)
                    {
                        correct++;
                        corr = true;
                    }
                    Console.WriteLine("Accuration File : " + fimage + ", Acc = " + corr + ", result = Class-" + r + ", Now Time : " + watch.Elapsed.TotalSeconds + " s");
                }
                i++;
            }
            double accurate = ((double)correct / (double)countFileTesting) * 100;

            rcAccuration.Text = accurate + " %";
            rcAccuration.SelectionAlignment = HorizontalAlignment.Center;
            watch.Stop();
            Console.WriteLine("Time Elapsed : " + watch.Elapsed.TotalSeconds + " s");
        }