View individual components of NTSC (Y, I and Q) image

9 views (last 30 days)
BJG
BJG on 19 Sep 2016
Answered: DGM on 7 Nov 2021
I'm trying to figure out how to take an image in NTSC format (Y,I,Q colorspace) and plot/view each component individually. An example of this can be found on the YIQ Wikipedia page where they show the Y,I,Q components from a picture of a barn.
If I do something like this:
img = rgb2ntsc(rgbframe);
Y = img(:,:,1); % Y channel
I = img(:,:,2); % I channel
Q = img(:,:,3); % Q channel
a = zeros(size(img, 1), size(img, 2));
just_Y = cat(3, Y, a, a);
just_I = cat(3, a, I, a);
just_Q = cat(3, a, a, Q);
figure, imshow(just_Y), title('Y channel')
figure, imshow(just_I), title('I channel')
figure, imshow(just_Q), title('Q channel')
It doesn't work because imshow is treating the image as if it's in RGB colorspace.
I can't seem to find an 'ntsc' or 'yiq' colormap.

Answers (1)

DGM
DGM on 7 Nov 2021
You need to assume some nominal Y and then convert back to RGB.
A = imread('YIQ_components.jpg'); % original barn image montage
rgbframe = A(1:size(A,1)/4,:,:); % cropped RGB portion
img = rgb2ntsc(rgbframe);
[Y I Q] = imsplit(img);
a = zeros(size(img, 1), size(img, 2));
b = 0.5*ones(size(img, 1), size(img, 2)); % assume Y = 0.5
just_Y = repmat(Y,[1 1 3]); % replicate so that it can be concatenated
just_I = ntsc2rgb(cat(3, b, I, a));
just_Q = ntsc2rgb(cat(3, b, a, Q));
% concatenate for simple viewing
imshow([im2double(rgbframe) just_Y; just_I just_Q]);
The astute observer may note that the I,Q representations here aren't quite the same as in the example. I am not sure where exactly that error came from, but considering that the colors in this example are on-axis, I'd say that the wiki example is probably the one that's wrong or using a different model. For example, the locus of colors in the wiki example of I is rotated about 13-15 degrees off-axis. The luma representations match, so the assumption of Rec 470/601 luma constants should be correct. Luma-chroma models are often incorrectly treated as synonymous. It may simply be YUV or something, which might explain the rotation direction.
In the end, it's just a visualization aid. In all likelihood, the image may have been tweaked for sake of content visibility.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!