Add transparency to colormap
조회 수: 41 (최근 30일)
이전 댓글 표시
Hi,
How can I add transparency to a colormap 2D?
I have the following code and I am using the version R2016a of MATLAB.
function covFunc( mapa, minPrx, maxPrx, arrayPrx )
wallMask(:,:,1) = mapa.img(:,:,1) ~= 255 & mapa.img(:,:,2) ~= 255 & mapa.img(:,:,3) ~= 255;
cover = (arrayPrx') .* ~wallMask + wallMask.*minPrx;
cover = cover + 0 * wallMask;
cover = (arrayPrx') .* wallMask;
imshow(cover);
caxis([minPrx maxPrx]) % Set colormap limits
colormap (jet(round((maxPrx-minPrx/50))))
colorbar
end
I need that the image stays intact and the new colors created by the color map stay transparent.
댓글 수: 0
답변 (1개)
Image Analyst
2020년 8월 11일
편집: Image Analyst
2020년 8월 11일
I'd probably create a new RGB image with the colormap and ind2rgb(). Then take a weighted average of them
rgbImage = cat(3, grayImage, grayImage, grayImage);
rgbOverlay = ind2rgb(grayImage, cmap);
factor = 0.6; % 60% or whatever.
rbgOutput = uint8(factor * double(rgbImage) + (1-factor) * 255 * rg0bOverlay);
댓글 수: 4
Image Analyst
2020년 8월 16일
You forgot to attach your script and your image. So, how can I help? cmap can be as many colors as you want to quantize it into. I have no idea what your maxPrx and minPrx are.
참고 항목
카테고리
Help Center 및 File Exchange에서 Orange에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!