more than 256 colors in colormap no longer working

조회 수: 20 (최근 30일)
Richard Smith
Richard Smith 2012년 9월 5일
댓글: John Ebersole 2015년 2월 6일
I wondered if anyone has seen this before?
if i use: figure; imagesc(randn(256)) colormap(jet(256))
the image is displayed as i would expect with 256 graduations in the jet color scheme.
but if i change to colormap(jet(300)) it starts to mess up the color map and if increase higher, I end up, eventually, with one colour in the color map.
This used to work fine, and still works on my linux versions of matlab (i think it's 2011a), but on the 64 bit version on windows (both 2011a and 2012a on windows 7) it messes up.
This is causing some grief as i have some plotting functions that use custom colormaps with a large number of colors which no longer work.
anyone any idea why?
Cheers
Richard
  댓글 수: 2
Jan
Jan 2012년 9월 6일
Does this concern e.g. http://www.mathworks.com/matlabcentral/fileexchange/37971-colormaps-with-higher-bit-depth, which has been developped under 2012a?
Peter
Peter 2013년 10월 14일
The linked page that contained the answer has somehow been taken offline. Would anyone still have that answer?

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

답변 (2개)

Doug Hull
Doug Hull 2012년 9월 6일
Currently, there is a 256 row colormap limit on the PC platform. The workaround is to manually reduce the colormap length, by consolidating colors that are "close enough" into one color. The Image Processing Toolbox contains routines for accomplishing this. Our developers are aware of this limitation and are investigating other possible workarounds.
  댓글 수: 1
Richard Smith
Richard Smith 2012년 9월 6일
By PC platform do you mean Windows? PC means 'personal computer' to me, so I'm confused as to where the restricition lies?
if it is, then my only option at the moment is to run my old code on linux, which is annoying but at least possible.
Thanks

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


Richard Smith
Richard Smith 2012년 10월 10일
thanks for comments, the solution was in the comments of the link provided by Jan Simon above.
The issue seems to arise from using the default renderer, using the opengl renderer for windows instead of the default worked a treat. To change the renderer for a particular figure just type;
set(gcf,'renderer','OpenGL')
obviously this could cause more issues if your gfx card driver doesn't play nicely with opengl, but it worked for me.
  댓글 수: 2
Dennis
Dennis 2014년 1월 3일
Thanks Richard Smith! Your workaround works for me as well (R2013b 64bit). I do think matlab should solve this issue with their default renderer...
John Ebersole
John Ebersole 2015년 2월 6일
This is great! I've been looking for a while for this.
I perform gamma correction whenever I plot images, so for a PC with a gamma of 2.2, the following looks great:
imagesc(myimage); axis image; colormap(gray(8192).^(1/2.2)); set(gcf,'renderer','OpenGL')
If I only use 256 instead of 8192, deep grays turn black too easily.

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

카테고리

Help CenterFile Exchange에서 White에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by