0

I am using Google Vision via Rest API v1 with feature DOCUMENT_TEXT_DETECTION and API is returning correct result:

var response = await httpClient.PostAsync("https://vision.googleapis.com/v1/images:annotate?key=XXXXX",new StringContent(requestJson, Encoding.UTF8, "application/json"));

var gVisionContent = await request.Content.ReadAsStringAsync();

what I want to deserialize via Json.Net to Google vision object (from Google.Cloud.Vision.V1 nuget), but when I run this JsonConvert.DeserializeObject<AnnotateImageResponse>(gVisionContent) it will return me empty results

Context null
CropHintsAnnotation null
Error   null
FaceAnnotations {[ ]}
FullTextAnnotation  null
ImagePropertiesAnnotation   null
LabelAnnotations    {[ ]}
LandmarkAnnotations {[ ]}
LogoAnnotations {[ ]}
SafeSearchAnnotation    null
TextAnnotations {[ ]}
WebDetection    null

When I try to deserialize it to AnotateFileResponse, then I am getting this error message..

Error converting value "LINE_BREAK" to type 
'Google.Cloud.Vision.V1.TextAnnotation+Types+DetectedBreak+Types+BreakType'. 
Path 'responses[0].fullTextAnnotation.pages[0] 
.blocks[0].paragraphs[0].words[1].symbols[0].property.detectedBreak.type', 
line 3850, position 52.

I cannot use nuget package directly for detection, because I need to call it via rest API

Kicker
  • 606
  • 1
  • 12
  • 27

0 Answers0