REST Resource: projects.locations.products.referenceImages

Resource: ReferenceImage

A ReferenceImage represents a product image and its associated metadata, such as bounding boxes.

JSON representation
{
  "name": string,
  "uri": string,
  "boundingPolys": [
    {
      object(BoundingPoly)
    }
  ]
}
Fields
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.

uri

string

The Google Cloud Storage URI of the reference image.

The URI must start with gs://.

Required.

boundingPolys[]

object(BoundingPoly)

Bounding polygons around the areas of interest in the reference image. Optional. 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).

BoundingPoly

A bounding polygon for the detected image annotation.

JSON representation
{
  "vertices": [
    {
      object(Vertex)
    }
  ],
  "normalizedVertices": [
    {
      object(NormalizedVertex)
    }
  ]
}
Fields
vertices[]

object(Vertex)

The bounding polygon vertices.

normalizedVertices[]

object(NormalizedVertex)

The bounding polygon normalized vertices.

Vertex

A vertex represents a 2D point in the image. NOTE: the vertex coordinates are in the same scale as the original image.

JSON representation
{
  "x": number,
  "y": number
}
Fields
x

number

X coordinate.

y

number

Y coordinate.

Zero coordinate values


The general format for bounding polys in the JSON response when detected is an array of 4 vertex objects:
  • [{"x": 63,"y": 18},{"x": 123,"y": 18},{"x": 123,"y": 38},{"x": 63,"y": 38}]
When the API detects a coordinate ("x" or "y") value of 0, that coordinate is omitted in the JSON response. For example, a response could take the following form: [{},{"x": 28}, {"x": 28,"y": 43},{"y": 43}]. This response shows all three representation possibilities:
  • {} - an empty object when both "x":0 and "y":0.
  • {"x": 28} and {"y": 43} - an object with a single key-value pair when one coordinate is 0 but the other is a non-zero value.
  • {"x": 28,"y": 43} - an object with both key-value pairs when both coordinates have a non-zero value.

NormalizedVertex

A vertex represents a 2D point in the image. NOTE: the normalized vertex coordinates are relative to the original image and range from 0 to 1.

JSON representation
{
  "x": number,
  "y": number
}
Fields
x

number

X coordinate.

y

number

Y coordinate.

Zero coordinate values


The general format for bounding polys in the JSON response when detected is an array of 4 vertex objects:
  • [{"x": 0.063,"y": 0.018},{"x": 0.123,"y": 0.018},{"x": 0.123,"y": 0.038},{"x": 0.063,"y": 0.038}]
When the API detects a coordinate ("x" or "y") value of 0.0, that coordinate is omitted in the JSON response. For example, a response could take the following form: [{},{"x": 0.028}, {"x": 0.028,"y": 0.043},{"y": 0.043}]. This response shows all three representation possibilities:
  • {} - an empty object when both "x":0.0 and "y":0.0.
  • {"x": 0.028} and {"y": 0.043} - an object with a single key-value pair when one coordinate is 0.0 but the other is a non-zero value.
  • {"x": 0.028,"y": 0.043} - an object with both key-value pairs when both coordinates have a non-zero value.

Methods

create

Creates and returns a new ReferenceImage resource.

delete

Permanently deletes a reference image.

get

Gets information associated with a ReferenceImage.

list

Lists reference images.
Was this page helpful? Let us know how we did:

Send feedback about...

Cloud Vision API
Need help? Visit our support page.