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

Time:05-17

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);

CodePudding user response:

Try to do:

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