/// <summary> /// Unmarshaller the response from the service to the response class. /// </summary> /// <param name="context"></param> /// <returns></returns> public override AmazonWebServiceResponse Unmarshall(JsonUnmarshallerContext context) { CreateCollectionResponse response = new CreateCollectionResponse(); context.Read(); int targetDepth = context.CurrentDepth; while (context.ReadAtDepth(targetDepth)) { if (context.TestExpression("CollectionArn", targetDepth)) { var unmarshaller = StringUnmarshaller.Instance; response.CollectionArn = unmarshaller.Unmarshall(context); continue; } if (context.TestExpression("FaceModelVersion", targetDepth)) { var unmarshaller = StringUnmarshaller.Instance; response.FaceModelVersion = unmarshaller.Unmarshall(context); continue; } if (context.TestExpression("StatusCode", targetDepth)) { var unmarshaller = IntUnmarshaller.Instance; response.StatusCode = unmarshaller.Unmarshall(context); continue; } } return(response); }
public static CreateCollectionResponse Unmarshall(UnmarshallerContext context) { CreateCollectionResponse createCollectionResponse = new CreateCollectionResponse(); createCollectionResponse.HttpResponse = context.HttpResponse; return(createCollectionResponse); }
public async Task Rekognize() { var newRegion = RegionEndpoint.GetBySystemName("us-east-1"); using (var rekClient = new AmazonRekognitionClient(newRegion)) { //Amazon.Rekognition.Model.DetectFacesRequest string collection_id = "test"; CreateCollectionRequest request = new CreateCollectionRequest() { CollectionId = collection_id }; CreateCollectionResponse response = await rekClient.CreateCollectionAsync(request); KinesisVideoStream VidStream = new KinesisVideoStream() { Arn = "arn:aws:kinesisvideo:us-east-1:229551089657:stream/myVideoStream/1525622803413" }; StreamProcessorInput SPInput = new StreamProcessorInput() { KinesisVideoStream = VidStream }; KinesisDataStream DataStream = new KinesisDataStream() { Arn = "arn:aws:kinesis:us-east-1:229551089657:stream/myDataStream" }; StreamProcessorOutput output = new StreamProcessorOutput() { KinesisDataStream = DataStream }; FaceSearchSettings faceSearchSettings = new FaceSearchSettings() { CollectionId = collection_id, FaceMatchThreshold = 10 }; StreamProcessorSettings spSettings = new StreamProcessorSettings() { FaceSearch = faceSearchSettings }; CreateStreamProcessorResponse final_resp = await rekClient.CreateStreamProcessorAsync(new CreateStreamProcessorRequest() { Input = SPInput, RoleArn = "arn:aws:iam::229551089657:role/RekRole2", Output = output, Settings = spSettings, Name = "CrazyDemo1" }); string why = final_resp.StreamProcessorArn; } }
private async Task <int> CreateCollection(AmazonRekognitionClient rekognitionClient, String collectionId) { CreateCollectionRequest createCollectionRequest = new CreateCollectionRequest() { CollectionId = collectionId }; CreateCollectionResponse createCollectionResponse = await rekognitionClient.CreateCollectionAsync(createCollectionRequest); return(createCollectionResponse.StatusCode); }
private string CreateCollection() { Console.WriteLine("Creating rekognition collection: {0}", CollectionName); CreateCollectionRequest request = new CreateCollectionRequest() { CollectionId = CollectionName }; CreateCollectionResponse response = Client.CreateCollection(request); Console.WriteLine("Collection created with ARN: {0}", response.CollectionArn); return(response.CollectionArn); }
public async Task GenerateNewCollectionAsync(string collectionId) { CreateCollectionResponse createCollectionResponse = await this._amazonRekognition.CreateCollectionAsync( new CreateCollectionRequest { CollectionId = collectionId } ); if (createCollectionResponse.HttpStatusCode != System.Net.HttpStatusCode.OK) { throw new Exception(createCollectionResponse.HttpStatusCode.ToString()); } }
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); }
// snippet-start:[Rekognition.dotnetv3.CreateCollectionExample] public static async Task Main() { var rekognitionClient = new AmazonRekognitionClient(); string collectionId = "MyCollection"; Console.WriteLine("Creating collection: " + collectionId); var createCollectionRequest = new CreateCollectionRequest { CollectionId = collectionId, }; CreateCollectionResponse createCollectionResponse = await rekognitionClient.CreateCollectionAsync(createCollectionRequest); Console.WriteLine($"CollectionArn : {createCollectionResponse.CollectionArn}"); Console.WriteLine($"Status code : {createCollectionResponse.StatusCode}"); }
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); }
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); } }
public async void CreateCol() { string accessKey = "AKIAST4HFDODRNXMOAPJ"; string secretKey = "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"; AmazonRekognitionClient rekognitionClient = new AmazonRekognitionClient(accessKey, secretKey, Amazon.RegionEndpoint.APSoutheast1); String collectionId = "faceCollection"; Console.WriteLine("Creating collection: " + collectionId); CreateCollectionRequest createCollectionRequest = new CreateCollectionRequest() { CollectionId = collectionId }; CreateCollectionResponse createCollectionResponse = await rekognitionClient.CreateCollectionAsync(createCollectionRequest); Console.WriteLine("CollectionArn : " + createCollectionResponse.CollectionArn); Console.WriteLine("Status code : " + createCollectionResponse.StatusCode); }