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"); }
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); }