필터 지우기
필터 지우기

Matlab Color Vectors

조회 수: 30 (최근 30일)
John
John 2011년 9월 29일
댓글: Brittany 2014년 3월 18일
Is there any website where I may obtain a list of Matlab's color vectors? I can only seem to find a website with the rgb color vectors but matlab's color vectors values are only between 0 and 1.
  댓글 수: 1
Jan
Jan 2011년 9월 29일
Please use the search in the forum. The previous question about RGB colors was posted only 10 hours ago.

댓글을 달려면 로그인하십시오.

답변 (3개)

the cyclist
the cyclist 2011년 9월 29일
RGB values are typically given on a range (0,255). You can scale those linearly to get the MATLAB range of (0,1).

Walter Roberson
Walter Roberson 2011년 9월 29일
"rgb color vectors" does not specify representation. MATLAB's representation is an rgb representation.
You are probably more accustomed to seeing RGB values as either hex or integers in the range 0 to 255.
To convert the 0-1 representation to 0-255 representation,
color8bit = floor(colordouble * 255);
To convert the 0-1 representation to standard hex RGB:
color8hex = sprintf('#%02X%02X%02X', floor(colordouble * 255));
  댓글 수: 4
Jan
Jan 2011년 9월 29일
Using UINT8 instead of ROUND cares for the 256.
But I'm not convinced. u = [12, 17, 243]; d = u / 255; u2 = UINT8(d * 255 + 0.5); Now u2 is [13, 18, 244].
Walter Roberson
Walter Roberson 2011년 9월 29일
d * 255 + 0.5 fills over the interval closed-closed interval [0,255 1/2] instead of filling over the closed-open interval [0,256) . That 1/2 slot not filled can cause values to round in to the same slot.

댓글을 달려면 로그인하십시오.


Jan
Jan 2011년 9월 29일
MATLAB's color vectors are RGB color vectors. I guess, that you have colors in UINT8 format as [12, 17, 243], and MATLAB used the DOUBLE format [0.047059, 0.066667, 0.95294].
The conversion is trivial:
uint8_RGB = [12, 17, 243];
double_RGB = uint8_RGB / 255;
  댓글 수: 1
Brittany
Brittany 2014년 3월 18일
Not very familiar with working in matlab colors and I wanted to define my own colormap using an Mby3 matrix but could not find useful info on how to convert RGB values to those that matlab could use....thank you!!

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Get Started with MATLAB에 대해 자세히 알아보기

제품

Community Treasure Hunt

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

Start Hunting!

Translated by