Main Content

rgb2ycbcr

RGB の色の値を YCbCr 色空間に変換

説明

YCBCR = rgb2ycbcr(RGB) は、RGB イメージの赤、緑、青の値を YCbCr イメージの輝度 (Y) と色差 (Cb および Cr) の値に変換します。

すべて折りたたむ

イメージの RGB から YCbCr への変換

RGB イメージをワークスペースに読み取ります。

RGB = imread("board.tif");

イメージを YCbCr に変換します。

YCBCR = rgb2ycbcr(RGB);

元のイメージと新しいイメージを表示します。

imshow(RGB);
title("Image in RGB Color Space");

Figure contains an axes object. The axes object with title Image in RGB Color Space contains an object of type image.

imshow(YCBCR);
title("Image in YCbCr Color Space");

Figure contains an axes object. The axes object with title Image in YCbCr Color Space contains an object of type image.

カラーマップの RGB から YCbCr への変換

インデックス付きイメージをワークスペースに読み込みます。カラーマップは、RGB 色空間のものです。

[I,map] = imread("forest.tif");

カラーマップを YCbCr に変換します。

newcmap = rgb2ycbcr(map);

グレースケール イメージを元のマップと新しいマップを使用して表示します。

imshow(I,map)
title("Indexed Image with RGB Colormap");

Figure contains an axes object. The axes object with title Indexed Image with RGB Colormap contains an object of type image.

imshow(I,newcmap)
title("Indexed Image with YCbCr Colormap");

Figure contains an axes object. The axes object with title Indexed Image with YCbCr Colormap contains an object of type image.

入力引数

すべて折りたたむ

変換する RGB カラー値。次のいずれかの形式の数値配列として指定します。

  • c 行 3 列のカラーマップ。各行が 1 つの RGB の色の値を指定します。

  • m x n x 3 のイメージ

データ型: single | double | uint8 | uint16

出力引数

すべて折りたたむ

変換後の YCbCr カラー値。入力と同じサイズの数値配列として返されます。

  • 入力が double または single の場合、Y の範囲は [16/255, 235/255]、CbCr の範囲は [16/255, 240/255] です。

  • 入力が uint8 の場合、Y の範囲は [16, 235]、CbCr の範囲は [16, 240] です。

  • 入力が uint16 の場合、Y の範囲は [4112, 60395]、CbCr の範囲は [4112, 61680] です。

参照

[1] Poynton, C. A.A Technical Introduction to Digital Video, John Wiley & Sons, Inc., 1996, p. 175.

[2] Rec. ITU-R BT.601-5, Studio Encoding Parameters of Digital Television for Standard 4:3 and Wide-screen 16:9 Aspect Ratios, (1982-1986-1990-1992-1994-1995), Section 3.5.

拡張機能

GPU コード生成
GPU Coder™ を使用して NVIDIA® GPU のための CUDA® コードを生成します。

バージョン履歴

R2006a より前に導入