MATLAB Answers

0

How do I use a .lut file (or the equivalent in MATLAB) to reference pixels in a grayscale image and assign them new values for pseudocoloring based on the LUT?

Elliott Gorman さんによって質問されました 2018 年 7 月 9 日
最新アクティビティ Anton Semechko さんによって コメントされました 2018 年 7 月 10 日
Hey, everyone. I'm creating a program to analyze grayscale images into pseudocolored images. Currently, my program works; however, it's fairly slow. The program currently iterates through each pixel and assigns it a new value, based on what I selected through tons of ifs and elseifs. As you could imagine, it does take quite some time to run (about a minute). I want to rewrite this code in order to utilize a LookUp Table for the R, G, and B layers as the values I assign them now are essentially constants, thus an LUT would work great. I'm just struggling trying to actually utilize it in matlab.
Really, what I need to know how to do is have a LookUp Table with x-values of 0-255, and corresponding y-values that will eventually become the multiplier for the original pixel (after some analysis of course), and actually utilize this table to change pixel values instead of iterating through like the program does now. Is it possible to use an LUT in this way with MATLAB?

  0 件のコメント

サインイン to comment.

1 件の回答

回答者: Anton Semechko 2018 年 7 月 10 日
 採用された回答

There is a Matlab function that maps gray values to RGB values using custom made look-up-tables. Its called 'ind2rgb': https://www.mathworks.com/help/matlab/ref/ind2rgb.html

  6 件のコメント

In that case you would have to modify your gray-scale (i.e., index) image. For example, suppose that the range of intensities in your image (im) varies between 0 and 64, and size of the LUT is 256-by-3. To ensure that 0 maps to LUT(1,:) and 64 to LUT(256,:), rescale intensities in im to the range [0 255]. For this particular example, this would be done as follows:
im=unit8((255/64)*double(im));
Ah, I was thinking about that but was weary about changing the values of the pixels beforehand as they are very important. I got that cleared up and a idea to fix that though. Thanks for all of your help!

サインイン to comment.



Translated by