
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Convert RGB Image to YIQ Image using MATLAB
In the field of digital image and video processing, there are two popular color spaces namely RGB and YIQ. Where, RGB stands for Red, Green, and Blue. The RGB color space is widely used for displaying digital images on display screens. This color space utilizes a combination of intensities of red, green, and blue lights. Therefore, in the RGB color space, each pixel in a digital image composed of three?color channels namely red, green, and blue.
On the other hand, YIQ is another color space that is mainly employed in analog video or NTSC systems. YIQ stands for Luminance (Y), In?Phase (I), and Quadrature (Q). In this color space, the brightness of the image is represented by Y component, and the other two components, i.e. I and Q represent the color information in the image.
In this article, we will learn how to convert an RGB image to YIQ image using MATLAB programming.
Convert RGB Image to YIQ Image in MATLAB
MATLAB provides a built?in function namely, ?rgb2ntsc' to convert an RGB image to YIQ image. The syntax of the ?rgb2ntsc' function is specified below:
yiq_img = rgb2ntsc(rgb_img);
The step?by?step procedure to covert an RGB image to YIQ image in MATLAB is explained below:
Step (1) ? Read the input RGB image.
Step (2) ? Convert the input RGB image to YIQ image using the ?rgb2ntsc' function.
Step (3) ? Display the output image.
Hence, the conversion of an RGB image to YIQ image is quite simple and straightforward process.
Now, let us learn the code implementation to convert an RGB image to YIQ image in MATLAB programming.
The following MATLAB program demonstrates the use of the ?rgb2ntsc' function to convert an RGB image to YIQ image.
Example
% MATLAB Code to convert an RGB image to YIQ image % Read the input RGB image rgb_img = imread('https://www.tutorialspoint.com/assets/questions/media/14304-1687425236.jpg'); % Convert the RGB image to YIQ image yiq_img = rgb2ntsc(rgb_img); % Display the RGB and YIQ images subplot(1, 2, 1); imshow(rgb_img); title('Original Image'); subplot(1, 2, 2); imshow(yiq_img); title('YIQ Image');
Output

Code Explanation
The above MATLAB code performs the conversion of an RGB image to YIQ image. In this code, we start by reading an input RGB image and store it in a variable ?rgb_img'. Next, we convert this RGB image to a YIQ image using the ?rgb2ntsc' function.
Finally, we display the input RGB image and the converted YIQ image using the ?disp' function with a suitable title.
Try this code with your image's address.