Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Conversion of YIQ image to RGB

Status
Not open for further replies.

cbecer2003

Newbie level 6
Joined
Feb 28, 2006
Messages
12
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,364
i want to show Y, I and Q components of the YIQ image.
i get these components by using

Yframe=0.299*Rframe+0.587*Gframe+0.114*Bframe;
Iframe=0.596*Rframe-0.275*Gframe-0.321*Bframe;
Qframe=0.212*Rframe-0.523*Gframe+0.311*Bframe;

after this,can i use 'imshow' like that

imshow(Yframe);
imshow(Iframe);
imshow(Qframe);

Must i use colormap or back to RGB?
 

Re: RGB - YIQ CONVERSION

Here is the code to display RGB images in three planes

RGB = imread('peppers.jpg')
[m,n]=size(RGB);
for i=1:m
for j=1:n/3
R(i,j)=RGB(i,j,1);
G(i,j)=RGB(i,j,2);
B(i,j)=RGB(i,j,3);
end
end
figure;imshow(R);
figure;imshow(G);
figure;imshow(B);

Added after 6 minutes:

Here is the code for HSI t0 RGB conversion ...just go through this ...u will get an idea..

clc;
clear all;
close all;
RGB= imread('peppers.png');
figure;imshow(RGB);title('original image');
HSI1=rgb2hsv(RGB);
HSI=imread('HSI1.png');
figure;imshow(HSI);title('HSI image');
HSI=double(HSI);
[m,n]=size(HSI);
RGB=hsv2rgb(HSI1);
figure;imshow(RGB);
for i=1:m
for j=1:n/3
R(i,j)=RGB(i,j,1);
G(i,j)=RGB(i,j,2);
B(i,j)=RGB(i,j,3);
end
end
figure;imshow(R);
figure;imshow(G);
figure;imshow(B);
for i=1:m
for j=1:n/3
H(i,j)=HSI(i,j,1);
S(i,j)=HSI(i,j,2);
I(i,j)=HSI(i,j,3);
%RG sector
if(H(i,j)>=0 && H(i,j)<120)
B(i,j)=I(i,j)*(1-S(i,j));
R(i,j)=I(i,j)*(1+(S(i,j)*cos(H(i,j))/cos(60-H(i,j))));
G(i,j)=1-(R(i,j)+B(i,j));
end
%GB Sector
if(H(i,j)>=120 && H(i,j)<240)
%H(i,j)=H(i,j)-120;
R(i,j)=I(i,j)*(1-S(i,j));
G(i,j)=I(i,j)*(1+(S(i,j)*cos(H(i,j))/cos(60-H(i,j))));
B(i,j)=1-(R(i,j)+G(i,j));
end
%BR Sector
if(H(i,j)>=240 && H(i,j)<360)
%H(i,j)=H(i,j)-240;
G(i,j)=I(i,j)*(1-S(i,j));
B(i,j)=I(i,j)*(1+(S(i,j)*cos(H(i,j))/cos(60-H(i,j))));
R(i,j)=1-(G(i,j)+B(i,j));
end
end
end
HSI=uint8(HSI);
for i=1:m
for j=1:n/3
RGB(i,j,1)=R(i,j);
RGB(i,j,2)=G(i,j);
RGB(i,j,3)=B(i,j);
end
end
figure;imshow(uint8(RGB),[]);
imwrite(RGB,'RGB1.png');
imshow('RGB1.png');title('RGB Image');
figure;imshow(uint8(R),[]);title('R Image');
figure;imshow(uint8(G),[]);title('G Image');
figure;imshow(uint8(B),[]);title('B Image');
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top