Back to h(hue),s (situration) ,v to HSV color space

1 view (last 30 days)
hai I am working on flame detection vedio...First I aplied backroud subtraction methon on each frame of vedio. first the frame value is in RGB.Then I convert Into hsv....Then I convert this hsv to seprate channel H,S and V.Now after the processing I want to this unique channles to convert in one matrix means back to hsv.
for l=1:1
frameForHsv = fc(:, :, :, l); %l is frame Number
hsvValues = rgb2hsv(frameForHsv );
for m=1:height
for n=1:width
h(m,n)=hsvValues(m,n,1);
s(m,n)=hsvValues(m,n,2);
v(m,n)=hsvValues(m,n,3);
if ((h(m,n)>=0 && h(m,n)<=60) && (s(m,n)>=0 && s(m,n)<=0.2)&&(v(m,n)>=127 && v(m,n)<=255) )
newH(m,n)=h(m,n);
newS(m,n)=s(m,n);
newV(m,n)=v(m,n);
else
newH(m,n)=0;
newS(m,n)=0;
end
end
end
% Now how to this seprate channel newH,newS and newV into one Channel HSV?
end
  1 Comment
Image Analyst
Image Analyst on 14 May 2016
But those new images are masks. What do you intend to do with the masks? Maybe you should AND them together to get an overall mask. By the way, don't use for loops - it can be done faster vectorized in a couple of lines.

Sign in to comment.

Answers (1)

Walter Roberson
Walter Roberson on 14 May 2016
cat(3, newH, newS, newV)

Categories

Find more on Colormaps in Help Center and File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!