how to delete value of hsv and convert hsv to gray?

1 view (last 30 days)
nt
nt on 13 Feb 2014
Edited: DGM on 31 Dec 2023
I want to only use hue and saturation. How can I delete value and convert the image to gray?

Answers (1)

DGM
DGM on 31 Dec 2023
Edited: DGM on 31 Dec 2023
This is a nonsense question. In one sentence, your goal is to preserve color information only and delete brightness information. In the second sentence, you want to preserve brightness information only and delete color information. If you ask for two apparently mutually-exclusive things, people assume that you have no idea what you want, let alone what you actually need. Writing an unanswerable question is the best way to make sure you don't get an answer.
Let's play guessing games though. Maybe "gray" isn't actually a brightness representation. Maybe it's just any color component in isolation. So let's say you deleted V and had H and S left.
% you have an RGB image
RGB = imread('peppers.png');
% now you have loose H,S, and V images
[H S V] = rgb2hsv(RGB);
% so delete V as if that accomplishes anything
% deleting V has the exact same effect as simply not using it
clear V % this has no effect on other variables and is a complete waste of time
Then what? Are we trying to convert H to gray and S to gray? If we're using this loose definition of "gray", then they already are, so there's nothing to convert. Are we supposed to combine H and S, reducing the pair to a single component? How do you combine a normalized fraction and an angle? Average them? Multiply them? What would it even mean in concept?
But wait. Maybe you're just trying to segment an image based on color information in H and S. That might be a plausible explanation -- but that's not what was asked, and it doesn't require deleting V or creating grayscale images from H and S, or any of the baloney that was asked about.
Read your own question and consider that the other people reading it are not you. Will they understand what you wrote? Is the thing you asked for actually the thing you want?

Categories

Find more on Convert Image Type 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!