public static PhotoSketchFeatureExtractor GetPhotoSketchFeatureExtractor(PointF[][] referenceShape) { var boundingBoxParams = Params.GetComponentBoundingBoxParams(); var blockParams = Params.GetComponentBlockParams(); var detector = ComponentAlignerFactory.FromReferenceShape(boundingBoxParams, referenceShape); return(PhotoSketchFeatureExtractorFactory.Default(detector, blockParams)); }
static void Main() { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); var featureBlockParams = Params.GetComponentBlockParams(); var boundingBoxParams = Params.GetComponentBoundingBoxParams(); var referenceShape = Params.GetReferenceShape(); var componentExtractor = ComponentAlignerFactory.FromReferenceShape(boundingBoxParams, referenceShape); var featureExtractor = PhotoSketchFeatureExtractorFactory.Default(componentExtractor, featureBlockParams); var form = new FormGalleryExtraction(featureExtractor); Application.Run(form); }
static void Main() { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); var featureBlockParams = Params.GetComponentBlockParams(); var boundingBoxParams = Params.GetComponentBoundingBoxParams(); var referenceShape = Params.GetReferenceShape(); var componentExtractor = ComponentAlignerFactory.FromReferenceShape(boundingBoxParams, referenceShape); var cbr = new PhotoSketchCBIR(PhotoSketchFeatureExtractorFactory.Default(componentExtractor, featureBlockParams)); var view = new FormDashboardCBIR(); var controller = new PresenterCBIR(view, cbr); Application.Run(view); }
// Compute the average image private static void GlobalAvgImage() { var photos = PhotoMetadataCsv.FromCSV(GALLERY_CSV).ToList(); var sketches = PhotoMetadataCsv.FromCSV(SKETCHS_CSV).ToList(); var boundingParams = Params.GetComponentBoundingBoxParams(); var alignerExtractor = ComponentAlignerFactory.FromReferenceShape(boundingParams, Params.GetReferenceShape()); // compute average images //var images = new List<Image<Gray, byte>>(); var photosComponents = new List <FaceComponentContainer>(); foreach (var photo in sketches) { try { var img = Normalization.Preprocessing.PreprocessImage(photo.AbsolutePath); //images.Add(img); var container = alignerExtractor.ExtractComponentsFromImage(img); photosComponents.Add(container); } catch (IndexOutOfRangeException e) { } catch (ArgumentException e) { } } var hair = photosComponents.Select(c => c.Hair).ToArray(); var eyes = photosComponents.Select(c => c.Eyes).ToArray(); var eyebrows = photosComponents.Select(c => c.Eyebrows).ToArray(); var nose = photosComponents.Select(c => c.Nose).ToArray(); var mouth = photosComponents.Select(c => c.Mouth).ToArray(); ImageViewer.Show(ImageUtils.CreateAvgImage(160, 80, hair)); ImageViewer.Show(ImageUtils.CreateAvgImage(144, 29, eyebrows)); ImageViewer.Show(ImageUtils.CreateAvgImage(144, 29, eyes)); ImageViewer.Show(ImageUtils.CreateAvgImage(96, 96, nose)); ImageViewer.Show(ImageUtils.CreateAvgImage(160, 80, mouth)); //ImageViewer.Show(ImageUtils.CreateAvgImage(200, 250, images)); }