필터 지우기
필터 지우기

convert matrix to jet colormap image and save as tiff

조회 수: 19 (최근 30일)
Hosup Song
Hosup Song 2016년 6월 29일
댓글: Image Analyst 2022년 11월 13일
I'm working with hundreds of images that I need to convert to images using the jet colormap.
I work with tiff files.
I can import these in as matrices, but I can't seem to find a way to convert them to jet colormap images.
I wish to be able to convert them to jet colormap images and export them as a tiff file.

채택된 답변

Image Analyst
Image Analyst 2016년 6월 29일
Try ind2rgb
rgbImage = ind2rgb(grayImage, jet(256));
  댓글 수: 5
Walter Roberson
Walter Roberson 2016년 7월 1일
We still not understand what you mean about image with JET colormap, unless you mean what I gave in my Answer
Image Analyst
Image Analyst 2016년 7월 1일
What do you mean by "layer"? Do you mean a page of a multi-page TIFF file, or do you mean one color channel of a full color RGB TIFF image? If you mean the latter and want to convert, say, the green channel, then the 3 steps are
originalImage = imread(fileName); % Import image.
grayImage = rgbImage(:, :, 2); % Extract green "layer".
rgbImage = ind2rgb(grayImage, jet(256)); % Pseudocolor with jet colormap.
By the way, the TIFF file after being read in by imread() is already an image. An image is a matrix, and vice versa, so there is no need to convert a "layer" (i.e. a color channel) to a matrix because it ALREADY IS a matrix. Nor is there any need to convert a matrix to an image because they're one and the same thing. But you can "pseudocolor an image" or "apply a colormap to a monochrome image" which basically assigns a color to every gray level in the image, turning it from a monochrome (gray scale) image into a full color image.

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

추가 답변 (1개)

Walter Roberson
Walter Roberson 2016년 6월 29일
Choose the number of colors you want in your jet colormap.
numcolor = 27;
Then
cmap = jet(numcolor);
jetind = rgb2ind(YourRGBImage, cmap);
What would be returned is an array of indices into the jet colormap with the given number of colors, with each original RGB pixel having been converted into its closest match in the jet colormap.
  댓글 수: 7
Sarvagya
Sarvagya 2022년 11월 13일
It's defined in the function imd2rgb. I think it's the colormap variable.
Image Analyst
Image Analyst 2022년 11월 13일
You could not pass an entire image as indexes into an N-by-3 colormap.
Please start a new thread of your own with your image and m-file attached.
If you have any more questions, then attach your data and code to read it in with the paperclip icon after you read this:

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

카테고리

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

태그

Community Treasure Hunt

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

Start Hunting!

Translated by