reference_images
Creates, updates, deletes, gets or lists a reference_images
resource.
Overview
Name | reference_images |
Type | Resource |
Id | google.vision.reference_images |
Fields
The following fields are returned by SELECT
queries:
- projects_locations_products_reference_images_get
- projects_locations_products_reference_images_list
Successful response
Name | Datatype | Description |
---|---|---|
name | string | The resource name of the reference image. Format is: projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID/referenceImages/IMAGE_ID . This field is ignored when creating a reference image. |
boundingPolys | array | Optional. Bounding polygons around the areas of interest in the reference image. If this field is empty, the system will try to detect regions of interest. At most 10 bounding polygons will be used. The provided shape is converted into a non-rotated rectangle. Once converted, the small edge of the rectangle must be greater than or equal to 300 pixels. The aspect ratio must be 1:4 or less (i.e. 1:3 is ok; 1:5 is not). |
uri | string | Required. The Google Cloud Storage URI of the reference image. The URI must start with gs:// . |
Successful response
Name | Datatype | Description |
---|---|---|
name | string | The resource name of the reference image. Format is: projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID/referenceImages/IMAGE_ID . This field is ignored when creating a reference image. |
boundingPolys | array | Optional. Bounding polygons around the areas of interest in the reference image. If this field is empty, the system will try to detect regions of interest. At most 10 bounding polygons will be used. The provided shape is converted into a non-rotated rectangle. Once converted, the small edge of the rectangle must be greater than or equal to 300 pixels. The aspect ratio must be 1:4 or less (i.e. 1:3 is ok; 1:5 is not). |
uri | string | Required. The Google Cloud Storage URI of the reference image. The URI must start with gs:// . |
Methods
The following methods are available for this resource:
Name | Accessible by | Required Params | Optional Params | Description |
---|---|---|---|---|
projects_locations_products_reference_images_get | select | projectsId , locationsId , productsId , referenceImagesId | Gets information associated with a ReferenceImage. Possible errors: * Returns NOT_FOUND if the specified image does not exist. | |
projects_locations_products_reference_images_list | select | projectsId , locationsId , productsId | pageSize , pageToken | Lists reference images. Possible errors: * Returns NOT_FOUND if the parent product does not exist. * Returns INVALID_ARGUMENT if the page_size is greater than 100, or less than 1. |
projects_locations_products_reference_images_create | insert | projectsId , locationsId , productsId | referenceImageId | Creates and returns a new ReferenceImage resource. The bounding_poly field is optional. If bounding_poly is not specified, the system will try to detect regions of interest in the image that are compatible with the product_category on the parent product. If it is specified, detection is ALWAYS skipped. The system converts polygons into non-rotated rectangles. Note that the pipeline will resize the image if the image resolution is too large to process (above 50MP). Possible errors: * Returns INVALID_ARGUMENT if the image_uri is missing or longer than 4096 characters. * Returns INVALID_ARGUMENT if the product does not exist. * Returns INVALID_ARGUMENT if bounding_poly is not provided, and nothing compatible with the parent product's product_category is detected. * Returns INVALID_ARGUMENT if bounding_poly contains more than 10 polygons. |
projects_locations_products_reference_images_delete | delete | projectsId , locationsId , productsId , referenceImagesId | Permanently deletes a reference image. The image metadata will be deleted right away, but search queries against ProductSets containing the image may still work until all related caches are refreshed. The actual image files are not deleted from Google Cloud Storage. |
Parameters
Parameters can be passed in the WHERE
clause of a query. Check the Methods section to see which parameters are required or optional for each operation.
Name | Datatype | Description |
---|---|---|
locationsId | string | |
productsId | string | |
projectsId | string | |
referenceImagesId | string | |
pageSize | integer (int32) | |
pageToken | string | |
referenceImageId | string |
SELECT
examples
- projects_locations_products_reference_images_get
- projects_locations_products_reference_images_list
Gets information associated with a ReferenceImage. Possible errors: * Returns NOT_FOUND if the specified image does not exist.
SELECT
name,
boundingPolys,
uri
FROM google.vision.reference_images
WHERE projectsId = '{{ projectsId }}' -- required
AND locationsId = '{{ locationsId }}' -- required
AND productsId = '{{ productsId }}' -- required
AND referenceImagesId = '{{ referenceImagesId }}' -- required;
Lists reference images. Possible errors: * Returns NOT_FOUND if the parent product does not exist. * Returns INVALID_ARGUMENT if the page_size is greater than 100, or less than 1.
SELECT
name,
boundingPolys,
uri
FROM google.vision.reference_images
WHERE projectsId = '{{ projectsId }}' -- required
AND locationsId = '{{ locationsId }}' -- required
AND productsId = '{{ productsId }}' -- required
AND pageSize = '{{ pageSize }}'
AND pageToken = '{{ pageToken }}';
INSERT
examples
- projects_locations_products_reference_images_create
- Manifest
Creates and returns a new ReferenceImage resource. The bounding_poly
field is optional. If bounding_poly
is not specified, the system will try to detect regions of interest in the image that are compatible with the product_category on the parent product. If it is specified, detection is ALWAYS skipped. The system converts polygons into non-rotated rectangles. Note that the pipeline will resize the image if the image resolution is too large to process (above 50MP). Possible errors: * Returns INVALID_ARGUMENT if the image_uri is missing or longer than 4096 characters. * Returns INVALID_ARGUMENT if the product does not exist. * Returns INVALID_ARGUMENT if bounding_poly is not provided, and nothing compatible with the parent product's product_category is detected. * Returns INVALID_ARGUMENT if bounding_poly contains more than 10 polygons.
INSERT INTO google.vision.reference_images (
data__name,
data__uri,
data__boundingPolys,
projectsId,
locationsId,
productsId,
referenceImageId
)
SELECT
'{{ name }}',
'{{ uri }}',
'{{ boundingPolys }}',
'{{ projectsId }}',
'{{ locationsId }}',
'{{ productsId }}',
'{{ referenceImageId }}'
RETURNING
name,
boundingPolys,
uri
;
# Description fields are for documentation purposes
- name: reference_images
props:
- name: projectsId
value: string
description: Required parameter for the reference_images resource.
- name: locationsId
value: string
description: Required parameter for the reference_images resource.
- name: productsId
value: string
description: Required parameter for the reference_images resource.
- name: name
value: string
description: >
The resource name of the reference image. Format is: `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID/referenceImages/IMAGE_ID`. This field is ignored when creating a reference image.
- name: uri
value: string
description: >
Required. The Google Cloud Storage URI of the reference image. The URI must start with `gs://`.
- name: boundingPolys
value: array
description: >
Optional. Bounding polygons around the areas of interest in the reference image. If this field is empty, the system will try to detect regions of interest. At most 10 bounding polygons will be used. The provided shape is converted into a non-rotated rectangle. Once converted, the small edge of the rectangle must be greater than or equal to 300 pixels. The aspect ratio must be 1:4 or less (i.e. 1:3 is ok; 1:5 is not).
- name: referenceImageId
value: string
DELETE
examples
- projects_locations_products_reference_images_delete
Permanently deletes a reference image. The image metadata will be deleted right away, but search queries against ProductSets containing the image may still work until all related caches are refreshed. The actual image files are not deleted from Google Cloud Storage.
DELETE FROM google.vision.reference_images
WHERE projectsId = '{{ projectsId }}' --required
AND locationsId = '{{ locationsId }}' --required
AND productsId = '{{ productsId }}' --required
AND referenceImagesId = '{{ referenceImagesId }}' --required;