Skip to main content

reference_images

Creates, updates, deletes, gets or lists a reference_images resource.

Overview

Namereference_images
TypeResource
Idgoogle.vision.reference_images

Fields

The following fields are returned by SELECT queries:

Successful response

NameDatatypeDescription
namestringThe 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.
boundingPolysarrayOptional. 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).
uristringRequired. The Google Cloud Storage URI of the reference image. The URI must start with gs://.

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
projects_locations_products_reference_images_getselectprojectsId, locationsId, productsId, referenceImagesIdGets information associated with a ReferenceImage. Possible errors: * Returns NOT_FOUND if the specified image does not exist.
projects_locations_products_reference_images_listselectprojectsId, locationsId, productsIdpageSize, pageTokenLists 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_createinsertprojectsId, locationsId, productsIdreferenceImageIdCreates 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_deletedeleteprojectsId, locationsId, productsId, referenceImagesIdPermanently 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.

NameDatatypeDescription
locationsIdstring
productsIdstring
projectsIdstring
referenceImagesIdstring
pageSizeinteger (int32)
pageTokenstring
referenceImageIdstring

SELECT examples

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;

INSERT examples

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
;

DELETE examples

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;