public void CreateTrainingSetTest()
        {
            string mainDirectory = @"e:\data\photos\";
            int    newSize       = 80;

            ImagesProcessing.CreateTrainingSet(mainDirectory, newSize, true, 0, true);
        }
示例#2
0
        public String RecognizeFromOcto(int[] pixels, int size)
        {
            Logger.WriteMessage("Recognizing OCto");
            var imgFace = ImagesProcessing.DetectAndTrimFace(pixels, size, fixedFaceSize);

            if (imgFace == null)
            {
                return("No face detected on the image");
                //imgFace.Save(@"e:\data\phototest\trimed.jpg");
            }
            Logger.WriteMessage("Face detected");
            var equalized = ImagesProcessing.EqualizeHist(imgFace);

            Logger.WriteMessage("Face equalized");
            var folder = FileAccessUtil.GetFolder();

            Logger.WriteMessage("Folder obtained");
            var recognizer = ImagesProcessing.CreateRecognizerFromFotosInFolder(folder, "_" + fixedFaceSize, 0.001, 3000);

            Logger.WriteMessage("Recognizer created");
            String label = recognizer.Recognize(equalized);

            if (!String.IsNullOrEmpty(label))
            {
                return(label);
            }

            return("Could not recognize");
        }
示例#3
0
        public bool AddToOctoSet(int[] pixels, int size, String label)
        {
            string[] fileEntries = Directory.GetDirectories(OCTO_DIRECTORY);
            var      faceImg     = ImagesProcessing.DetectAndTrimFace(pixels, size, fixedFaceSize);

            if (faceImg == null)
            {
                return(false);
            }

            faceImg = ImagesProcessing.EqualizeHist(faceImg);
            var directoryNames = fileEntries.Select(x => x.Substring(x.LastIndexOf("\\") + 1));

            if (!directoryNames.Contains(label))
            {
                Directory.CreateDirectory(OCTO_DIRECTORY + "\\" + label);
            }

            faceImg.Save(OCTO_DIRECTORY + "\\" + label + "\\" + Guid.NewGuid().ToString() + "_" + fixedFaceSize + ".jpg");
            return(true);
        }
 public void CreateImageRecognizerTest()
 {
     ImagesProcessing.CreateRecognizerFromFotosInFolder(@"e:\data\photos\", "_100", 0.001, 500);
 }