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

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

NameAccessible byRequired ParamsDescription
projects_locations_products_reference_images_getSELECTlocationsId, productsId, projectsId, referenceImagesIdGets information associated with a ReferenceImage. Possible errors: * Returns NOT_FOUND if the specified image does not exist.
projects_locations_products_reference_images_listSELECTlocationsId, productsId, projectsIdLists 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_createINSERTlocationsId, productsId, projectsIdCreates 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_deleteDELETElocationsId, productsId, projectsId, 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.

SELECT examples

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 locationsId = '{{ locationsId }}'
AND productsId = '{{ productsId }}'
AND projectsId = '{{ projectsId }}';

INSERT example

Use the following StackQL query and manifest file to create a new reference_images resource.

/*+ create */
INSERT INTO google.vision.reference_images (
locationsId,
productsId,
projectsId,
name,
uri,
boundingPolys
)
SELECT
'{{ locationsId }}',
'{{ productsId }}',
'{{ projectsId }}',
'{{ name }}',
'{{ uri }}',
'{{ boundingPolys }}'
;

DELETE example

Deletes the specified reference_images resource.

/*+ delete */
DELETE FROM google.vision.reference_images
WHERE locationsId = '{{ locationsId }}'
AND productsId = '{{ productsId }}'
AND projectsId = '{{ projectsId }}'
AND referenceImagesId = '{{ referenceImagesId }}';