Output error vector in the grayscale
3 ビュー (過去 30 日間)
古いコメントを表示
I have this piece of code:
resRGB = HSVtoRGB(resHSV);
but I have this error:
Input error: please pass as input a vector variable with 3 elements with value in the range [0,1]
How do I have to improve my code?
2 件のコメント
Voss
2022 年 2 月 25 日
I'm guessing that resHSV is not in fact "a vector variable with 3 elements with value in the range [0,1]" (or is it?), so what is resHSV?
Also, you may consider using the built-in MATLAB function hsv2rgb to convert HSV colors to RGB.
採用された回答
Image Analyst
2022 年 2 月 26 日
Why not use the built-in hsv2rgb()
resRGB = hsv2rgb(resHSV);
5 件のコメント
Image Analyst
2022 年 2 月 27 日
No those would do diffferent things and make diffferent assumptions.
resRGB = HSVtoRGB(resHSV);
assumes that HSVtoRGB is a function, and that resHSV is a 3-D array.
While
HSVtoRGB = resHSV;
would take the resHSV array and make a copy of the array in a new array called HSVtoRGB. HSV2RGB should not be an existing function. Then if you do
resRGB = HSVtoRGB;
you're essentially overwriting the original resRGB array with HSVtoRGB array, which is the same thing as overwriting resRGB array with the resHSV array, which is crazy since that array is from a different color space.
その他の回答 (1 件)
yanqi liu
2022 年 2 月 26 日
yes,sir,may be check resHSV value,such as
resHSV = [.6 1 1; .6 .7 1; .6 .5 1; .6 .3 1; .6 0 1]
size(resHSV)
rgb = hsv2rgb(hsv);
surf(peaks);
colormap(rgb);
colorbar
参考
カテゴリ
Help Center および File Exchange で Color and Styling についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
