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

조회 수: 1 (최근 30일)
nt
nt 2014년 2월 13일
편집: DGM 2023년 12월 31일
I want to only use hue and saturation. How can I delete value and convert the image to gray?

답변 (1개)

DGM
DGM 2023년 12월 31일
편집: DGM 2023년 12월 31일
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?

카테고리

Help CenterFile Exchange에서 Convert Image Type에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by