コード例 #1
0
        public string CreateStreamProcessor()
        {
            //Setup input parameters
            KinesisVideoStream kinesisVideoStream = new KinesisVideoStream()
            {
                Arn = kinesisVideoStreamArn,
            };

            StreamProcessorInput streamProcessorInput = new StreamProcessorInput()
            {
                KinesisVideoStream = kinesisVideoStream,
            };

            KinesisDataStream kinesisDataStream = new KinesisDataStream()
            {
                Arn = kinesisDataStreamArn,
            };

            StreamProcessorOutput streamProcessorOutput = new StreamProcessorOutput()
            {
                KinesisDataStream = kinesisDataStream,
            };

            FaceSearchSettings faceSearchSettings = new FaceSearchSettings()
            {
                CollectionId       = collectionId,
                FaceMatchThreshold = matchThreshold,
            };

            StreamProcessorSettings streamProcessorSettings = new StreamProcessorSettings()
            {
                FaceSearch = faceSearchSettings,
            };

            //Create the stream processor
            CreateStreamProcessorResponse createStreamProcessorResponse = rekognitionClient.CreateStreamProcessor(
                new CreateStreamProcessorRequest()
            {
                Input    = streamProcessorInput,
                Output   = streamProcessorOutput,
                Settings = streamProcessorSettings,
                RoleArn  = roleArn,
                Name     = streamProcessorName,
            });

            //Display result
            Console.WriteLine("Stream Processor " + streamProcessorName + " created.");
            Console.WriteLine("StreamProcessorArn - " + createStreamProcessorResponse.StreamProcessorArn);

            return(createStreamProcessorResponse.StreamProcessorArn);
        }
コード例 #2
0
        public static bool CreateStreamProcessor(String streamProcessorName, String VideoStreamArn, String DataStreamArn)
        {
            bool isSuccess = false;

            // Setup input parameters
            KinesisVideoStream kinesisVideoStream = new KinesisVideoStream()
            {
                Arn = VideoStreamArn,
            };

            StreamProcessorInput streamProcessorInput = new StreamProcessorInput()
            {
                KinesisVideoStream = kinesisVideoStream,
            };

            KinesisDataStream kinesisDataStream = new KinesisDataStream()
            {
                Arn = DataStreamArn,
            };

            StreamProcessorOutput streamProcessorOutput = new StreamProcessorOutput()
            {
                KinesisDataStream = kinesisDataStream,
            };

            FaceSearchSettings faceSearchSettings = new FaceSearchSettings()
            {
                CollectionId       = collectionId,
                FaceMatchThreshold = matchThreshold,
            };

            StreamProcessorSettings streamProcessorSettings = new StreamProcessorSettings()
            {
                FaceSearch = faceSearchSettings,
            };

            try
            {
                AmazonRekognitionClient rekognitionClient;
                using (rekognitionClient = new AmazonRekognitionClient(MyAWSConfigs.KinesisRegion))
                {
                    // Create the stream processor
                    CreateStreamProcessorResponse createStreamProcessorResponse = rekognitionClient.CreateStreamProcessor(
                        new CreateStreamProcessorRequest()
                    {
                        Input    = streamProcessorInput,
                        Output   = streamProcessorOutput,
                        Settings = streamProcessorSettings,
                        RoleArn  = roleArn,
                        Name     = streamProcessorName,
                    });

                    // Display result
                    Console.WriteLine("Stream Processor " + streamProcessorName + " created.");
                    Console.WriteLine("StreamProcessorArn - " + createStreamProcessorResponse.StreamProcessorArn);

                    isSuccess = createStreamProcessorResponse.HttpStatusCode == System.Net.HttpStatusCode.OK ? true : false;
                }
            }
            catch (AmazonRekognitionException e)
            {
                Console.WriteLine("AmazonRekognitionException: " + e);
            }
            catch (Exception e)
            {
                Console.WriteLine("Error: " + e);
            }

            return(isSuccess);
        }