Google Vision OCR

Time:2020-6-29

Google vision OCR pit climbing suggestions

Install Google vision firstshell composer require google/cloud-vision The first time I used it, I really encountered a lot of problems. The document is in English, so I can’t help but go on the way to exploreBaiduandgoogleHowever, the search results are not satisfactory. It may be that the search method is not correct. Ha ha ~, in fact, it is quite simple to use. Because other people have ready-made wheels, they only use them at the right time. Therefore, the following points are specially listed. 1. Identity authentication (I worked on this identity authentication for 2 hours) 2$vision->image($img_path)An exception will be thrown if the image is passed in the URL

identity authentication

get into https://imgs.developpaper.com/imgs/ServiceLogin ‘, ‘r’),

 

 

[‘faces’]The features method can be multi passed and has more requirements passed in. In the end, I list all features.

There is also a problem here. My picture is URL, and I try to use itfopenandfilegetContents’ opens a URL, but an exception is thrown (the exception is not deep, too high-end to understand, and we are not willing to ask). Finally, it is successful and returns successfully.

[
    'faces',          // Corresponds to `FACE_DETECTION`
    'landmarks',      // Corresponds to `LANDMARK_DETECTION`
    'logos',          // Corresponds to `LOGO_DETECTION`
    'labels',         // Corresponds to `LABEL_DETECTION`
    'text',           // Corresponds to `TEXT_DETECTION`,
    'document',       // Corresponds to `DOCUMENT_TEXT_DETECTION`
    'safeSearch',     // Corresponds to `SAFE_SEARCH_DETECTION`
    'imageProperties',// Corresponds to `IMAGE_PROPERTIES`
    'crop',           // Corresponds to `CROP_HINTS`
    'web'             // Corresponds to `WEB_DETECTION`
]

 

features

[
    'faces',          // Corresponds to `FACE_DETECTION`
    'landmarks',      // Corresponds to `LANDMARK_DETECTION`
    'logos',          // Corresponds to `LOGO_DETECTION`
    'labels',         // Corresponds to `LABEL_DETECTION`
    'text',           // Corresponds to `TEXT_DETECTION`,
    'document',       // Corresponds to `DOCUMENT_TEXT_DETECTION`
    'safeSearch',     // Corresponds to `SAFE_SEARCH_DETECTION`
    'imageProperties',// Corresponds to `IMAGE_PROPERTIES`
    'crop',           // Corresponds to `CROP_HINTS`
    'web'             // Corresponds to `WEB_DETECTION`
]

 

 

The above pit is used for the first time. I have little knowledge (maybe my understanding and usage are wrong). I hope you can help in the process of using it!