public FaceFeatures(ComponentFeature hair, ComponentFeature eyebrows, ComponentFeature eyes, ComponentFeature nose, ComponentFeature mouth, double[] shape) : this() { Hair = hair; Eyebrows = eyebrows; Eyes = eyes; Nose = nose; Mouth = mouth; Shape = shape ?? throw new ArgumentNullException(nameof(shape)); }
private FaceFeatures ExtractFaceFeatures(FaceComponentContainer faceComponents, Dictionary <FaceComponent, MLBPFeatureExtractor> featureExtractors) { var features = new ComponentFeature[featureExtractors.Count]; Task.WaitAll( Task.Run(() => features[0] = ExtractComponentFeature(faceComponents.Hair, featureExtractors[FaceComponent.HAIR])), Task.Run(() => features[1] = ExtractComponentFeature(faceComponents.Eyebrows, featureExtractors[FaceComponent.EYEBROWS])), Task.Run(() => features[2] = ExtractComponentFeature(faceComponents.Eyes, featureExtractors[FaceComponent.EYES])), Task.Run(() => features[3] = ExtractComponentFeature(faceComponents.Nose, featureExtractors[FaceComponent.NOSE])), Task.Run(() => features[4] = ExtractComponentFeature(faceComponents.Mouth, featureExtractors[FaceComponent.MOUTH])) ); return(new FaceFeatures(features[0], features[1], features[2], features[3], features[4], faceComponents.Shape)); }