I am trying to convert google.cloud.vision response to JSON in C#. I sent the picture to my webapi, and then I sent it to the ocr of google- here
The response returned is a google vision object, how do I convert it to JSON?
My code:
[Route("getPrice")]
public int GetPrice()
{
// Specify a Google Cloud Storage uri for the image
// or a publicly accessible HTTP or HTTPS uri.
var image = Image.FromUri("gs://tasmi/11.png");
var client = ImageAnnotatorClient.Create();
var response = client.DetectText(image);
// I tried It ,but It's not work well
//BatchAnnotateImagesResponse.Parser.ToString();
BatchAnnotateImagesResponse.Parser.ParseJson(response)
using (StreamWriter writer = new StreamWriter(fullPath))
{
writer.Write(response);
}
foreach (var annotation in response)
{
if (annotation.Description != null)
Console.WriteLine(annotation.Description);
}
return 0;
}