googleapis / nodejs-vision

This repository is deprecated. All of its content and history has been moved to googleapis/google-cloud-node.
https://cloud.google.com/vision/
Apache License 2.0
495 stars 139 forks source link

OCR Response different from Demo #410

Closed fritzfr closed 5 years ago

fritzfr commented 5 years ago

Hi,

I am trying to understand why the response I am getting from the API using this library is different form the JSON result on the demo (https://cloud.google.com/vision/). Lets take this image for example:

wurst

link

With the example code (https://cloud.google.com/vision/docs/ocr#detect_text_in_a_local_image) I am getting for every text result a confidence of 0, also the locale is empty for every single element.

With the demo however, there are values for each of these if you open the JSON dropdown below the demo. Why is there a difference here?

Environment details

Steps to reproduce

  1. Get the example code from the link above
  2. Use my provided Image
  3. Compare the results of the printed response from this library with the JSON from the demo page
habib-Boloorchi commented 5 years ago

I think if you add: .v1 to this line of code 'const vision = require('@google-cloud/vision').v1;' it works: and it will also solve many other problem. I think you need also use this 'client.documentTextDetection(gs://${bucketName}/${filename})' instead of '.textDetection(gs://${bucketName}/${filename})' hope it goes well.

fritzfr commented 5 years ago

Hm, doesn't look like this changed much for me.

callmehiphop commented 5 years ago

@felix-voicehub looks like in the Node.js sample you're referencing it uses the textAnnotations field of the response, but it would appear that the vision demo is using fullTextAnnotations field instead.

Louis345 commented 5 years ago

@callmehiphop how do I use the fullTextAnnotations. When attempting to the method I get a typeError TypeError: client.fullTextAnnotations is not a function

callmehiphop commented 5 years ago

@Louis345 interesting, would you be willing to open a new issue that contained some code to reproduce the issue you are seeing?

Louis345 commented 5 years ago

@callmehiphop I figured it out. FullTextAnnotation is a response, not a method.

stephenplusplus commented 5 years ago

Sounds like everything is working out. Let us know if there's more we can help with!