For Programmers: Free Programming Magazines  


Home > Archive > Matlab > April 2005 > Separate h,s,v components of image









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Separate h,s,v components of image
MR

2005-04-24, 3:58 am

Hi,
You can convert a rgb to hsv using functions rgb2hsv.After this how
does one separate the h ,s and v components of the image.I need to
perform a specific operation only on the v component of the
image.AFter this ,I need to put the h,s and modified v components
together.

What would be the easiest way to go about this?

thanks,
MR
daniel Ennis

2005-04-24, 3:58 am

Your original RGB image will be MxNx3 is size where the R data is in
the MxNx1 channel, G in MxNx2 channel, and B in MxNx3 channel. After
conversion with rgb2hsv the H data is in the MxNx1 channel etc. All
you need to do is operate on the channel of interest. Example: If
you want to double the saturation you can simply do this:

HSV=rgb2hsv(RGB);

HSV(:,:,2)=2*HSV(:,:,2);

Done. Be aware, however that no value can be outside the interval
[0,1] so you need to set values <0 and >1 to 0 or 1
respectively.

Hope that helps.
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com