# ImageContext

- [JSON representation](https://docs.cloud.google.com/vision/docs/reference/rest/v1/ImageContext#SCHEMA_REPRESENTATION)
- [LatLongRect](https://docs.cloud.google.com/vision/docs/reference/rest/v1/ImageContext#LatLongRect)
  - [JSON representation](https://docs.cloud.google.com/vision/docs/reference/rest/v1/ImageContext#LatLongRect.SCHEMA_REPRESENTATION)
- [CropHintsParams](https://docs.cloud.google.com/vision/docs/reference/rest/v1/ImageContext#CropHintsParams)
  - [JSON representation](https://docs.cloud.google.com/vision/docs/reference/rest/v1/ImageContext#CropHintsParams.SCHEMA_REPRESENTATION)
- [ProductSearchParams](https://docs.cloud.google.com/vision/docs/reference/rest/v1/ImageContext#ProductSearchParams)
  - [JSON representation](https://docs.cloud.google.com/vision/docs/reference/rest/v1/ImageContext#ProductSearchParams.SCHEMA_REPRESENTATION)
- [WebDetectionParams](https://docs.cloud.google.com/vision/docs/reference/rest/v1/ImageContext#WebDetectionParams)
  - [JSON representation](https://docs.cloud.google.com/vision/docs/reference/rest/v1/ImageContext#WebDetectionParams.SCHEMA_REPRESENTATION)
- [TextDetectionParams](https://docs.cloud.google.com/vision/docs/reference/rest/v1/ImageContext#TextDetectionParams)
  - [JSON representation](https://docs.cloud.google.com/vision/docs/reference/rest/v1/ImageContext#TextDetectionParams.SCHEMA_REPRESENTATION)

Image context and/or feature-specific parameters.

| JSON representation |
|---|
| ``` { "latLongRect": { object (`https://docs.cloud.google.com/vision/docs/reference/rest/v1/ImageContext#LatLongRect`) }, "languageHints": [ string ], "cropHintsParams": { object (`https://docs.cloud.google.com/vision/docs/reference/rest/v1/ImageContext#CropHintsParams`) }, "productSearchParams": { object (`https://docs.cloud.google.com/vision/docs/reference/rest/v1/ImageContext#ProductSearchParams`) }, "webDetectionParams": { object (`https://docs.cloud.google.com/vision/docs/reference/rest/v1/ImageContext#WebDetectionParams`) }, "textDetectionParams": { object (`https://docs.cloud.google.com/vision/docs/reference/rest/v1/ImageContext#TextDetectionParams`) } } ``` |

| Fields ||
|---|---|
| `latLongRect` | ``object (`https://docs.cloud.google.com/vision/docs/reference/rest/v1/ImageContext#LatLongRect`)`` Not used. |
| `languageHints[]` | `string` List of languages to use for TEXT_DETECTION. In most cases, an empty value yields the best results since it enables automatic language detection. For languages based on the Latin alphabet, setting `languageHints` is not needed. In rare cases, when the language of the text in the image is known, setting a hint will help get better results (although it will be a significant hindrance if the hint is wrong). Text detection returns an error if one or more of the specified languages is not one of the [supported languages](https://cloud.google.com/vision/docs/languages). |
| `cropHintsParams` | ``object (`https://docs.cloud.google.com/vision/docs/reference/rest/v1/ImageContext#CropHintsParams`)`` Parameters for crop hints annotation request. |
| `productSearchParams` | ``object (`https://docs.cloud.google.com/vision/docs/reference/rest/v1/ImageContext#ProductSearchParams`)`` Parameters for product search. |
| `webDetectionParams` | ``object (`https://docs.cloud.google.com/vision/docs/reference/rest/v1/ImageContext#WebDetectionParams`)`` Parameters for web detection. |
| `textDetectionParams` | ``object (`https://docs.cloud.google.com/vision/docs/reference/rest/v1/ImageContext#TextDetectionParams`)`` Parameters for text detection and document text detection. |

## LatLongRect

Rectangle determined by min and max `LatLng` pairs.

| JSON representation |
|---|
| ``` { "minLatLng": { object (`https://docs.cloud.google.com/vision/docs/reference/rest/v1/LatLng`) }, "maxLatLng": { object (`https://docs.cloud.google.com/vision/docs/reference/rest/v1/LatLng`) } } ``` |

| Fields ||
|---|---|
| `minLatLng` | ``object (`https://docs.cloud.google.com/vision/docs/reference/rest/v1/LatLng`)`` Min lat/long pair. |
| `maxLatLng` | ``object (`https://docs.cloud.google.com/vision/docs/reference/rest/v1/LatLng`)`` Max lat/long pair. |

## CropHintsParams

Parameters for crop hints annotation request.

| JSON representation |
|---|
| ``` { "aspectRatios": [ number ] } ``` |

| Fields ||
|---|---|
| `aspectRatios[]` | `number` Aspect ratios in floats, representing the ratio of the width to the height of the image. For example, if the desired aspect ratio is 4/3, the corresponding float value should be 1.33333. If not specified, the best possible crop is returned. The number of provided aspect ratios is limited to a maximum of 16; any aspect ratios provided after the 16th are ignored. |

## ProductSearchParams

Parameters for a product search request.

| JSON representation |
|---|
| ``` { "boundingPoly": { object (`https://docs.cloud.google.com/vision/docs/reference/rest/v1/projects.locations.products.referenceImages#BoundingPoly`) }, "productSet": string, "productCategories": [ string ], "filter": string } ``` |

| Fields ||
|---|---|
| `boundingPoly` | ``object (`https://docs.cloud.google.com/vision/docs/reference/rest/v1/projects.locations.products.referenceImages#BoundingPoly`)`` The bounding polygon around the area of interest in the image. If it is not specified, system discretion will be applied. |
| `productSet` | `string` The resource name of a `https://docs.cloud.google.com/vision/docs/reference/rest/v1/projects.locations.productSets#ProductSet` to be searched for similar images. Format is: `projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID`. |
| `productCategories[]` | `string` The list of product categories to search in. Currently, we only consider the first category, and either "homegoods-v2", "apparel-v2", "toys-v2", "packagedgoods-v1", or "general-v1" should be specified. The legacy categories "homegoods", "apparel", and "toys" are still supported but will be deprecated. For new products, please use "homegoods-v2", "apparel-v2", or "toys-v2" for better product search accuracy. It is recommended to migrate existing products to these categories as well. |
| `filter` | `string` The filtering expression. This can be used to restrict search results based on Product labels. We currently support an AND of OR of key-value expressions, where each expression within an OR must have the same key. An '=' should be used to connect the key and value. For example, "(color = red OR color = blue) AND brand = Google" is acceptable, but "(color = red OR brand = Google)" is not acceptable. "color: red" is not acceptable because it uses a ':' instead of an '='. |

## WebDetectionParams

Parameters for web detection request.

| JSON representation |
|---|
| ``` { "includeGeoResults": boolean } ``` |

| Fields ||
|---|---|
| `includeGeoResults (deprecated)` | `boolean` > [!WARNING] > This item is deprecated! This field has no effect on results. |

## TextDetectionParams

Parameters for text detections. This is used to control TEXT_DETECTION and DOCUMENT_TEXT_DETECTION features.

| JSON representation |
|---|
| ``` { "enableTextDetectionConfidenceScore": boolean, "advancedOcrOptions": [ string ] } ``` |

| Fields ||
|---|---|
| `enableTextDetectionConfidenceScore` | `boolean` By default, Cloud Vision API only includes confidence score for DOCUMENT_TEXT_DETECTION result. Set the flag to true to include confidence score for TEXT_DETECTION as well. |
| `advancedOcrOptions[]` | `string` A list of advanced OCR options to further fine-tune OCR behavior. Current valid values are: - `legacyLayout`: a heuristics layout detection algorithm, which serves as an alternative to the current ML-based layout detection algorithm. Customers can choose the best suitable layout algorithm based on their situation. |