小编pm0*_*464的帖子

未找到Google Vision条形码库

我正在尝试使用Google Play服务(Vision)中的新功能将QR码扫描添加到我的应用程序中.但当我运行我的应用程序时,我得到了这个:

I/Vision? Supported ABIS: [armeabi-v7a, armeabi]
D/Vision? Library not found: /data/data/com.google.android.gms/files/com.google.android.gms.vision/barcode/libs/armeabi-v7a/libbarhopper.so
I/Vision? Requesting barcode detector download.
Run Code Online (Sandbox Code Playgroud)

我按照教程声明了条形码依赖:

<meta-data
    android:name="com.google.android.gms.vision.DEPENDENCIES"
    android:value="barcode" />
Run Code Online (Sandbox Code Playgroud)

我尝试重新安装应用程序并重新启动手机,没有任何帮助.

使用Google Play Services 7.8,设备上安装的版本为7.8.11.

compile 'com.google.android.gms:play-services-vision:7.8.0'
Run Code Online (Sandbox Code Playgroud)

用于创建条形码检测器的代码:

boolean initBarcodeDetector() {
    final BarcodeTrackerFactory barcodeTrackerFactory = new BarcodeTrackerFactory(this);
    final MultiProcessor<Barcode> multiProcessor = new MultiProcessor.Builder<>(barcodeTrackerFactory)
            .build();
    barcodeDetector = new BarcodeDetector.Builder(this)
            .build();
    barcodeDetector.setProcessor(multiProcessor);

    if (barcodeDetector.isOperational() == false) {
        Toast.makeText(this, R.string.barcode_not_operational, Toast.LENGTH_LONG).show();
        finish();
        return false;
    }

    return true;
}
Run Code Online (Sandbox Code Playgroud)

上面的close返回false并barcodeDetector.isOperational()返回活动,因为返回false.

android barcode google-play-services google-vision android-vision

15
推荐指数
3
解决办法
1万
查看次数

google vision API可以接受外部图片网址吗?

我正在阅读有关vision API请求架构的文档.在图像源中,我只看到使用GCS图像路径的URL的选项.是否可以使用http://example.com/images/image01.jpg等外部图片网址?

google-cloud-vision

11
推荐指数
2
解决办法
4856
查看次数

如何用Python pip安装google.cloud?

我对Python比较陌生,而且我坚持一些可能相对容易解决的问题.

我安装了以下软件包:

pip install --upgrade google-api-python-client
pip install --upgrade google-cloud
pip install --upgrade google-cloud-vision
Run Code Online (Sandbox Code Playgroud)

在我的Python文件中,我有:

import cv2
import io
import os

# Imports the Google Cloud client library
from google.cloud import vision

...etc...
Run Code Online (Sandbox Code Playgroud)

这给了我错误:

Traceback (most recent call last):
  File "test.py", line 6, in <module>
    from google.cloud import vision
ImportError: No module named 'google.cloud'
Run Code Online (Sandbox Code Playgroud)

我错过了什么,我应该在哪里(日志?)找到答案.

PS:
Pip安装google-cloudgoogle-cloud-vision输出:

Cannot remove entries from nonexistent file /Users/foobar/anaconda/lib/python3.5/site-packages/easy-install.pth
Run Code Online (Sandbox Code Playgroud)

更新:
运行pip freeze不显示要安装的包...

python pip google-cloud-vision

9
推荐指数
1
解决办法
1万
查看次数

Google Vision条形码检测库未在某些设备上安装

我正在使用新的Google Play服务视觉库编写应用程序以检测条形码.

在我测试过的大多数设备上一切正常,但是一个特定设备拒绝安装本机库(在此评论中提到)

// Note: The first time that an app using the barcode or face API is installed on a
// device, GMS will download a native libraries to the device in order to do detection.
// Usually this completes before the app is run for the first time.  But if that
// download has not yet completed, then the above call will not detect any barcodes
// and/or faces.
//
// isOperational() can be used to check if …
Run Code Online (Sandbox Code Playgroud)

android google-play-services google-vision android-vision

7
推荐指数
1
解决办法
2045
查看次数

尝试将代码从GitHub导入Android Studio

我对此感到非常愚蠢,但我已经下载了Android Mobile Vision API的示例代码:https://github.com/googlesamples/android-vision.

我正在尝试将此代码导入Android Studio,以便我能够运行示例应用程序,但无论我如何导入(导入现有Android Studio项目,导入非Android Studio项目,打开项目),我不是能够以我可以编译和点击播放来运行应用程序的方式导入它.

由于这是Android的官方示例代码,我相信它不应该是这么复杂.我错过了什么?

android android-studio google-vision android-vision

6
推荐指数
1
解决办法
8681
查看次数

Google Cloud Vision API - 如何启用服务帐户

我试图了解GoogleVision API Java库.

我创建了一个服务帐户,下载了json并设置了这个环境变量.

GOOGLE_APPLICATION_CREDENTIALS=C:\GoogleAPI\keys\translate-41428d4d1ec6.json
Run Code Online (Sandbox Code Playgroud)

我使用以下方法设置了应用程序默认凭据:

gcloud beta auth application-default login
Run Code Online (Sandbox Code Playgroud)

我在这里关注这个例子:https: //cloud.google.com/vision/docs/reference/libraries

我现在假设所有调用都将使用服务帐户,就像魔术一样,因为我没有在代码中进行任何身份验证(根据示例).

但是,我无法看到我授权服务帐户使用Google Vision API的位置,我认为我必须这样做.所以,我可能根本就不能使用服务帐户......

当我进入IAM并尝试为服务帐户分配"角色"时,与视觉API没有任何关系?有角色,如

  • 我怎样才能确定我使用服务帐户拨打电话?
  • 如果未在IAM中列出特定API(例如GoogleVision),我还需要明确允许服务帐户访问特定API ...或者与项目相关的所有服务帐户是否都可以访问API?

文档中的示例显示了如何

任何帮助赞赏.

此外,我感兴趣的是如何调整示例以不使用Application Default Credentials,但实际上创建了一个特定的Credential实例并使用它来调用Google Vision,因为这一点并不清楚.示例给出的是调用GoogleStorage,但我无法将其转换为Google Vision.

public class StorageFactory {
  private static Storage instance = null;

  public static synchronized Storage getService() throws IOException, GeneralSecurityException {
    if (instance == null) {
      instance = buildService();
    }
    return instance;
  }

  private static Storage buildService() throws IOException, GeneralSecurityException {
    HttpTransport transport = GoogleNetHttpTransport.newTrustedTransport();
    JsonFactory jsonFactory = new JacksonFactory();
    GoogleCredential credential …
Run Code Online (Sandbox Code Playgroud)

java google-cloud-platform google-cloud-vision

5
推荐指数
1
解决办法
1797
查看次数

Python调整图像大小并发送到谷歌视觉函数

由于谷歌视觉对输入图像大小有一些限制,我想首先调整输入图像的大小,然后使用该detect_labels()功能。

这是他们的示例代码

def detect_labels(path):
"""Detects labels in the file."""
vision_client = vision.Client()

with io.open(path, 'rb') as image_file:
    content = image_file.read()

image = vision_client.image(content=content)

labels = image.detect_labels()
print('Labels:')

for label in labels:
    print(label.description)
Run Code Online (Sandbox Code Playgroud)

他们用来io打开图像文件。我想知道这样,如何调整内存中图像的大小然后调用detect_labels()

computer-vision python-2.7 google-cloud-vision

4
推荐指数
1
解决办法
2133
查看次数