Пример #1
0
        static void gaborThread(Object obj)
        {
            String s = (String)obj;

            Console.WriteLine(s);
            float[] v = imageMatcher.ExtractGaborVector(s);
            foreach (float i in v)
            {
                Console.Write("{0} ", i);
            }
            Console.Write(s + "end");
        }
Пример #2
0
        static void testGabor()
        {
            Console.WriteLine("testGabor begin");

            ImageMatcher im = new ImageMatcher();
            string       s  = @"E:\pic_skindetect\img_lib\20081839149581.jpg";

            float[] v = im.ExtractGaborVector(s);
            foreach (float i in v)
            {
                Console.Write("{0} ", i);
            }

            Console.WriteLine();
            Console.WriteLine("testGabor end");
        }
Пример #3
0
        static void testClothSearch2()
        {
            Console.WriteLine("begin");
            ImageMatcher im = new ImageMatcher();

            String selectedPath = @"E:\pic_skindetect\img_lib";

            string[] jpgFiles = Directory.GetFiles(selectedPath, "*.jpg");
            string[] gifFiles = Directory.GetFiles(selectedPath, "*.gif");
            string[] pngFiles = Directory.GetFiles(selectedPath, "*.png");
            string[] bmpFiles = Directory.GetFiles(selectedPath, "*.bmp");
            int      nFiles   = jpgFiles.Length + gifFiles.Length + pngFiles.Length + bmpFiles.Length;

            if (nFiles == 0)
            {
                return;
            }

            List <String> picNames = new List <string>(nFiles);

            picNames.AddRange(jpgFiles);
            picNames.AddRange(gifFiles);
            picNames.AddRange(pngFiles);
            picNames.AddRange(bmpFiles);

            Console.WriteLine("begin extract");
            List <float[]> tcs = new List <float[]>();
            List <float[]> ccs = new List <float[]>();
            List <string>  fns = new List <string>();

            foreach (String picName in picNames)
            {
                //ccs.Add(im.ExtractCooccurrenceVector(picName));
                tcs.Add(im.ExtractGaborVector(picName));
                fns.Add(picName);
            }

            Console.WriteLine("begin calculate color md");
            StreamWriter sw    = File.CreateText(@"E:\projects\ClothSearch\codes\trunk\data\testCooccurrence.txt");
            List <float> ccsMd = new List <float>();

            for (int i = 0; i < ccs.Count; ++i)
            {
                for (int j = i + 1; j < ccs.Count; ++j)
                {
                    ccsMd.Add(calcManhattanDistance(ccs[i], ccs[j]));
                }
            }
            ccsMd.Sort();
            foreach (float md in ccsMd)
            {
                sw.WriteLine(md);
            }
            sw.Close();

            /*
             * Console.WriteLine("begin calculate texture md");
             * sw = File.CreateText(@"E:\projects\ClothSearch\codes\trunk\data\testGabor.txt");
             * List<float> tcsMd = new List<float>();
             * for (int i = 0; i < tcs.Count; ++i)
             * {
             *  for (int j = i+1; j < tcs.Count; ++j)
             *  {
             *      tcsMd.Add(calcManhattanDistance(tcs[i], tcs[j]));
             *  }
             *
             *
             * }
             * tcsMd.Sort();
             * foreach (float md in tcsMd)
             * {
             *  sw.WriteLine(md);
             * }
             *
             * sw.Close();*/
        }