예제 #1
0
        public ActionResult CadastrarCollection(string nome)
        {
            try
            {
                var Collection = nome;

                var rekognitionClient = new AmazonRekognitionClient("AKIAIBLZ7KFAN6XG3NNA", "2nukFOTDN0zv/y2tzeCiLrAHM5TwbFgvEqqZA9zn", RegionEndpoint.USWest2);


                var response = rekognitionClient.CreateCollection(new CreateCollectionRequest
                {
                    CollectionId = Collection
                });

                string collectionArn = response.CollectionArn;
                int    statusCode    = response.StatusCode;
            }
            catch (Exception ex)
            {
                return(Json(new { erro = ex.Message }));
            }


            return(Json(new { sucesso = "Collection criada com Sucesso!" }));
        }
예제 #2
0
        public void RekognitionCreateCollection()
        {
            #region to-create-a-collection-1481833313674

            var client   = new AmazonRekognitionClient();
            var response = client.CreateCollection(new CreateCollectionRequest
            {
                CollectionId = "myphotos"
            });

            string collectionArn = response.CollectionArn;
            int    statusCode    = response.StatusCode;

            #endregion
        }
예제 #3
0
        public static string Create(string _collectionId)
        {
            if (GetFaceCollectionList().Contains(_collectionId))
            {
                return("");
            }

            string collectionId  = _collectionId;
            string collectionArn = "";

            try
            {
                using (rekognitionClient = new AmazonRekognitionClient(collectionRegion))
                {
                    CreatingCollection();
                }

                void CreatingCollection()
                {
                    Console.WriteLine("Creating collection: " + collectionId);

                    CreateCollectionRequest createCollectionRequest = new CreateCollectionRequest()
                    {
                        CollectionId = collectionId
                    };

                    CreateCollectionResponse createCollectionResponse = rekognitionClient.CreateCollection(createCollectionRequest);

                    collectionArn = createCollectionResponse.CollectionArn;

                    Console.WriteLine("Status code : " + createCollectionResponse.StatusCode);
                }
            }
            catch (AmazonRekognitionException e)
            {
                Console.WriteLine("AmazonRekognitionException: " + e);
                collectionArn = "error";
            }
            catch (Exception e)
            {
                Console.WriteLine("Error: " + e);
                collectionArn = "error";
            }

            return(collectionArn);
        }
예제 #4
0
    public static void Example()
    {
        AmazonRekognitionClient rekognitionClient = new AmazonRekognitionClient();

        String collectionId = "MyCollection";

        Console.WriteLine("Creating collection: " + collectionId);

        CreateCollectionRequest createCollectionRequest = new CreateCollectionRequest()
        {
            CollectionId = collectionId
        };

        CreateCollectionResponse createCollectionResponse = rekognitionClient.CreateCollection(createCollectionRequest);

        Console.WriteLine("CollectionArn : " + createCollectionResponse.CollectionArn);
        Console.WriteLine("Status code : " + createCollectionResponse.StatusCode);
    }
예제 #5
0
        public bool AddCollection(string collectionId)
        {
            try
            {
                AmazonRekognitionClient rekognitionClient = AmazonClient.GetInstance();

                CreateCollectionRequest createCollectionRequest = new CreateCollectionRequest()
                {
                    CollectionId = collectionId
                };

                CreateCollectionResponse createCollectionResponse = rekognitionClient.CreateCollection(createCollectionRequest);
                return(true);
            }
            catch (Exception ex)
            {
                return(false);
            }
        }