rgb2lab color conversion
8 ビュー (過去 30 日間)
古いコメントを表示
Hi, I am using rgb2lab color space conversion and am receiving values in the range of e+03, are these values correct?
2 件のコメント
Stephen23
2017 年 10 月 31 日
@Foram Sanghavi: please show us the input values that produce that output.
採用された回答
Stephen23
2017 年 10 月 31 日
編集済み: Stephen23
2017 年 10 月 31 日
Either convert the input argument to uint8 or divide it by 255 and you will get the correct output. Many MATLAB color/image functions assume that a double input is in the range 0-1, which clearly your data is not.
2 件のコメント
Image Analyst
2017 年 10 月 31 日
I think this will explain everything. Write back if it doesn't.
rgb = uint8([253,244,245])
lab = rgb2lab(rgb)
rgb = lab2rgb(lab) % Doubles in the range 0-1
rgb = uint8(255 * rgb) % Integers in the range 0-255
You'll see
rgb =
1×3 uint8 row vector
253 244 245
lab =
96.8926628404762 3.17508673704292 0.590818112564628
rgb =
0.992156862745098 0.956862745098039 0.96078431372549
rgb =
1×3 uint8 row vector
253 244 245
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Image Processing Toolbox についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!