How do I pseudo-color a grayscale image in Matlab using custom RGB values from .csv file

Viewed 52

I have an 8-bit image ('Example_image.tif') that I would like to pseudo-color using custom RGB values from a .csv file ('Pseudocolor_sheet.csv'). In the .csv file, the rows represent pixel values (0-255), whereas columns 1, 2, 3 represent the corresponding red, green, and blue intensities, respectively. Currently, the code yields an image where all pixels are displayed as white. I'm trying to figure out how to map the RBG values correctly. Thank you! Here's what I have so far:

clc;
clear;
close all;

[filename,filepath] = uigetfile({'C:\Users\'},'Select Example Image','*');
ExampleImage = imread(strcat(filepath, filename));

RGBImage = ind2rgb(ExampleImage,'pseudocolor_sheet.csv');

imshow(RGBImage);
1 Answers

Try to do:

cmap=csvread('pseudocolor_sheet.csv');
imshow(ExampleImage ,cmap);
Related