【发布时间】:2020-03-31 16:19:43
【问题描述】:
我正在尝试使用 php 中的 Google Vision API 裁剪图像。 API 返回可能的最佳裁剪,不考虑宽高比我发送。
这是我目前所拥有的:
$imageAnnotator = new ImageAnnotatorClient();
$image = file_get_contents(storage_path('test.jpg'));
$context = new \Google\Cloud\Vision\V1\ImageContext();
$cropHintsParams = new \Google\Cloud\Vision\V1\CropHintsParams();
$cropHintsParams->setAspectRatios([floatval(1)]);
$context->setCropHintsParams($cropHintsParams);
$response = $imageAnnotator->cropHintsDetection($image, [$context]);
$annotations = $response->getCropHintsAnnotation();
知道这有什么问题吗?
php 文档示例没有提供任何纵横比...https://cloud.google.com/vision/docs/detecting-crop-hints
提前谢谢你
【问题讨论】:
-
裁剪与纵横比有关系吗?我的意思是,它只会裁剪图像,不会调整大小,还是我错了?
-
它根据您正在寻找的纵横比评估最佳裁剪。 Google's python tutorial 在这一点上比较完整,但我还是不明白...
标签: php google-vision