A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from http://cloud.google.com/bigquery/docs/reference/standard-sql/bigqueryml-syntax-convert-color-space below:

The ML.CONVERT_COLOR_SPACE function | BigQuery

Stay organized with collections Save and categorize content based on your preferences.

The ML.CONVERT_COLOR_SPACE function

This document describes the ML.CONVERT_COLOR_SPACE scalar function, which lets you convert images that have an RGB color space to a different color space. You can use ML.CONVERT_COLOR_SPACE with the ML.PREDICT function or chain it with other functions or subqueries.

Syntax
ML.CONVERT_COLOR_SPACE(image, target_color_space)
Arguments

ML.CONVERT_COLOR_SPACE takes the following arguments:

Output

ML.CONVERT_COLOR_SPACE returns a STRUCT value that represents the modified image in the form STRUCT<ARRAY<INT64>, ARRAY<FLOAT64>>.

The first array in the struct represents the dimensions of the image, and the second array in the struct contains the image data, similar to the image input argument. Each value in the second array is between [0, 1).

Note: If you reference ML.CONVERT_COLOR_SPACE in SQL statements in the BigQuery editor, it is possible for the function output to be too large to display. If this occurs, write the output to a table instead. Example

The following example uses the ML.CONVERT_COLOR_SPACE function within the ML.PREDICT function to change the color space for input images from RGB to GRAYSCALE:

CREATE OR REPLACE TABLE mydataset.model_output
AS (
  SELECT *
  FROM
    ML.PREDICT(
      MODEL `mydataset.mymodel`,
      SELECT
        ML.CONVERT_COLOR_SPACE(ML.DECODE_IMAGE(data), 'GRAYSCALE')
          AS image,
        uri
      FROM `mydataset.images`)
);
What's next

Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.

Last updated 2025-08-07 UTC.

[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-08-07 UTC."],[[["The `ML.CONVERT_COLOR_SPACE` function converts images from the `RGB` color space to a specified target color space, like `HSV`, `GRAYSCALE`, `YIQ`, or `YUV`."],["This function accepts an `image` argument, which is a `STRUCT` containing the image dimensions and data, and a `target_color_space` argument specifying the desired color space."],["The function outputs a `STRUCT` value representing the modified image, with dimensions in the first array and the converted image data in the second array, with each value between `[0, 1)`."],["The `ML.CONVERT_COLOR_SPACE` function can be utilized within the `ML.PREDICT` function or combined with other functions or subqueries, such as shown in the example with `ML.DECODE_IMAGE`."]]],[]]


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4