필터 지우기
필터 지우기

How can I Change grayscale color?

조회 수: 3 (최근 30일)
saleh Alghamdi
saleh Alghamdi 2017년 2월 6일
댓글: saleh Alghamdi 2017년 2월 12일
Hi Guys,
I have an image at the grayscale color and black background and I want to change the black background to white color and change the gray scale to pink scale that depends on concentration of color.
Can anyone tell me how I can do that?

채택된 답변

Walter Roberson
Walter Roberson 2017년 2월 6일
cmap = pink(256); %pink!
cmap(1,:) = [1.0 1.0 1.0]; %replace first entry with white
colormap(cmap)
  댓글 수: 3
Walter Roberson
Walter Roberson 2017년 2월 6일
sample_plot = sort( randi([0 255], 64, 80, 'uint8') ); %sample grayscale data
cmap = pink(256); %pink!
cmap(1,:) = [1.0 1.0 1.0]; %replace first entry with white
Then
image(sample_plot)
colormap(cmap)
or
imshow(sample_plot, cmap)
The white blocks that show up against the top edge are places where the background values of 0 have been drawn as white as you requested.
saleh Alghamdi
saleh Alghamdi 2017년 2월 12일
much appreciated.

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Color Space Formatting and Conversions에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by