フィルターのクリア

Using colormap of a lookup table from MetaMorph in MATLAB?

10 ビュー (過去 30 日間)
Guangfeng Yu
Guangfeng Yu 2021 年 6 月 23 日
回答済み: Abhinaya Kennedy 2024 年 5 月 7 日
There is a Look up table from the image analysis software MetaMorph I want to import and use in MATLAB as a 256X3 colormap. I was trying to see if I can 1) import LUT files (.lut extension) directly to MATLAB or 2) extract the colormap from a colored image. Has anyone had experience of doing this? I am aware of the function of rgb2ind, which can return [indexed_image, colormap], with a colormap that can map the indexed_image to the colored image. However is there a way I can do it for any other grayscale image I want to apply the colormap to? Please let me know if you have any suggestions. Thanks.

回答 (1 件)

Abhinaya Kennedy
Abhinaya Kennedy 2024 年 5 月 7 日
Hi Guangfeng Yu,
MATLAB doesn't directly import .lut files, but you can achieve your goal in a couple of ways:
1. Reading the LUT as text and converting to colormap:
  • MetaMorph LUT files might be plain text files with RGB values for each index.
  • Use "fopen" to open the file and "fscanf" to read the RGB values into a matrix.
  • The matrix should have dimensions (256, 3) with each row representing an RGB value for a corresponding index (0-255). This matrix can be directly used as your colormap.
2. Extract from reference image:
  • Read the image with "imread".
  • Use "rgb2ind" to get a 256-color indexed image and its colormap (LUT).
3.Applying the colormap:
  • Use "imshow" with your grayscale image and the obtained colormap as the third argument.
Here are some resources that might be helpful:

カテゴリ

Help Center および File ExchangeRed についてさらに検索

タグ

製品

Community Treasure Hunt

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

Start Hunting!

Translated by