예제 #1
0
파일: ImageAnalyzer.cs 프로젝트: skdent/psi
        /// <summary>
        /// Initializes a new instance of the <see cref="ImageAnalyzer"/> class.
        /// </summary>
        /// <param name="pipeline">The pipeline to add the component to.</param>
        /// <param name="configuration">The image analyzer configuration.</param>
        public ImageAnalyzer(Pipeline pipeline, ImageAnalyzerConfiguration configuration = null)
        {
            this.configuration = configuration ?? new ImageAnalyzerConfiguration();
            this.Out           = pipeline.CreateEmitter <ImageAnalysis>(this, nameof(this.Out));
            this.In            = pipeline.CreateAsyncReceiver <Shared <Image> >(this, this.ReceiveAsync, nameof(this.In));

            this.computerVisionClient = this.CreateClient();
        }
예제 #2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="ImageAnalyzer"/> class.
        /// </summary>
        /// <param name="pipeline">The Psi pipeline.</param>
        /// <param name="configuration">The image analyzer configuration.</param>
        public ImageAnalyzer(Pipeline pipeline, ImageAnalyzerConfiguration configuration = null)
        {
            this.configuration = configuration ?? new ImageAnalyzerConfiguration();
            this.Out           = pipeline.CreateEmitter <AnalysisResult>(this, nameof(this.Out));
            this.In            = pipeline.CreateAsyncReceiver <Shared <Image> >(this, this.ReceiveAsync, nameof(this.In));

            this.Description = pipeline.CreateEmitter <Description>(this, nameof(this.Description));
            this.Tags        = pipeline.CreateEmitter <Tag[]>(this, nameof(this.Tags));
            this.Adult       = pipeline.CreateEmitter <Adult>(this, nameof(this.Adult));
            this.Categories  = pipeline.CreateEmitter <Category[]>(this, nameof(this.Categories));
            this.Color       = pipeline.CreateEmitter <Color>(this, nameof(this.Color));
            this.Faces       = pipeline.CreateEmitter <Face[]>(this, nameof(this.Faces));
            this.ImageType   = pipeline.CreateEmitter <ImageType>(this, nameof(this.ImageType));

            this.visionServiceClient = this.CreateVisionServiceClient();
        }