public void AnnotateImage(string url) { var features = new List <Feature>(); features.Add(new Feature() { maxResults = 50, type = Enumerators.FeatureType.OBJECT_LOCALIZATION.ToString() }); _gcVision.Annotate(new List <AnnotateRequest>() { new AnnotateRequest() { image = new Image() { source = new ImageSource() { imageUri = url, gcsImageUri = string.Empty }, content = string.Empty }, context = new ImageContext() { languageHints = new string[] { "english" }, }, features = features } }); }
public void AnnotateImage(string imageUri = "", string content = "", string gcsImageUri = "") { var features = new List <Feature>(); features.Add(new Feature() { maxResults = 50, type = Enumerators.FeatureType.DOCUMENT_TEXT_DETECTION.ToString() }); _gcVision.Annotate(new List <AnnotateRequest>() { new AnnotateRequest() { image = new Image() { source = new ImageSource() { imageUri = imageUri, gcsImageUri = gcsImageUri }, content = content }, context = new ImageContext() { languageHints = new string[] { "english" }, }, features = features } }); }
public void AnnotateImage(string imageData, List <Enumerators.FeatureType> featureTypes) { //flag showing if annotation process has ended. annotationCompleted = false; var features = new List <Feature>(); foreach (var feat in featureTypes) { features.Add(new Feature() { maxResults = 50, type = feat.ToString() }); } _gcVision.Annotate(new List <AnnotateRequest>() { new AnnotateRequest() { image = new FrostweepGames.Plugins.GoogleCloud.Vision.Image() { source = new ImageSource() { imageUri = string.Empty, gcsImageUri = string.Empty }, content = imageData }, context = new ImageContext() { languageHints = new string[] { "english" }, }, features = features } }); }
private void AnnotateButtonOnClickHandler() { if (_isWaitingForResponse) { return; } if (string.IsNullOrEmpty(_selectedImageData) && string.IsNullOrEmpty(_imageUrlInputField.text)) { return; } _currentVisionResponse = null; _isWaitingForResponse = true; //include all features int length = Enum.GetNames(typeof(Enumerators.FeatureType)).Length; var features = new List <Feature>(); for (int i = 0; i < length; i++) { features.Add(new Feature() { maxResults = 10, type = (Enumerators.FeatureType)i }); } var img = new Image(); if (string.IsNullOrEmpty(_selectedImageData)) { img.source = new ImageSource() { imageUri = _imageUrlInputField.text, gcsImageUri = string.Empty, }; img.content = string.Empty; } else { img.source = new ImageSource() { imageUri = string.Empty, gcsImageUri = string.Empty, }; img.content = _selectedImageData; } _gcVision.Annotate(new List <AnnotateRequest>() { new AnnotateRequest() { image = img, context = new ImageContext() { cropHintsParams = new CropHintsParams() { aspectRatios = new double[] { 1, 2 } }, languageHints = new string[] { "english" }, latLongRect = new LatLongRect() { maxLatLng = new LatLng() { latitude = 0, longitude = 0 }, minLatLng = new LatLng() { latitude = 0, longitude = 0 } } }, features = features } }); _workingState.color = UnityEngine.Color.yellow; _selectedImageData = string.Empty; _selectedImageText.text = "No Image selected."; _imageUrlInputField.text = string.Empty; }
public void AnnotateImage(string imageData) { //flag showing if annotation process has ended. localiazationCompleted = false; var features = new List <Feature>(); features.Add(new Feature() { maxResults = 50, type = Enumerators.FeatureType.LABEL_DETECTION.ToString() }); var img = new FrostweepGames.Plugins.GoogleCloud.Vision.Image(); if (string.IsNullOrEmpty(imageData)) { img.source = new ImageSource() { imageUri = string.Empty, gcsImageUri = string.Empty, }; img.content = string.Empty; } else { img.source = new ImageSource() { imageUri = string.Empty, gcsImageUri = string.Empty, }; img.content = imageData; } _gcVision.Annotate(new List <AnnotateRequest>() { new AnnotateRequest() { image = img, context = new ImageContext() { cropHintsParams = new CropHintsParams() { aspectRatios = new double[] { 1, 2 } }, languageHints = new string[] { "english" }, latLongRect = new LatLongRect() { maxLatLng = new LatLng() { latitude = 0, longitude = 0 }, minLatLng = new LatLng() { latitude = 0, longitude = 0 } } }, features = features } }); }