我是第一次实施谷歌云愿景。成功创建产品集、产品并为产品分配图像。当我尝试执行发送 base64 编码图像的产品搜索时,结果始终为空。但是当我尝试使用来自谷歌云存储的图像时,它正在工作。知道为什么它不起作用吗?
$productSearchClient = new ProductSearchClient();
$productSetPath = $productSearchClient->productSetName(config('web.google_vision.project_id'), config('web.google_vision.location'), 2);
# product search specific parameters
$productSearchParams = (new ProductSearchParams())
->setProductSet($productSetPath)
->setProductCategories(['general-v1']);
# search products similar to the image
$imageAnnotatorClient = new ImageAnnotatorClient();
//$image = 'gs://picfly-bucket/wendys-5.jpeg';
$image = base64_encode(file_get_contents(public_path('gallery/test/wendy-search.png')));
$response = $imageAnnotatorClient->productSearch($image, $productSearchParams);
dd($response->getProductSearchResults());