MATLAB: How to generate an image from a matrix imageimshow The image would be 3 x 3 with the colors as shown below. The other can stay white. Red Yellow Green Green Blue Best Answer Red = [255 0 0];Yellow = [0 255 255];Green = [0 0 255];Blue = [0 255 0];Im = uint8(255) * ones(3,3,3,'uint8');Im(1,1,:) = Red;Im(1,3,:) = Yellow;and so on. Related SolutionsMATLAB: How to get back the rgb image from r g b component Exactly the opposite of how you pulled out the data;im = imread(...);red = im(:,:,1);grn = im(:,:,2);blu = im(:,:,3);original_mk2 = zeros(size(im));original_mk2(:,:,1) = red;original_mk2(:,:,2) = grn;original_mk2(:,:,3) = blu;fiugre; imshow(original_mk2); MATLAB: Create a colormap for scatter3 This works:T = [0,1,0; 1,1,0; 1,0,0]; % Green - Yellow - RedT = interp1([1:3]', T, linspace(1, 3, 5)');m = 161;map = zeros(m , 3);x = [0 50 120 160 255];map = interp1(x/255,T,linspace(0,1,255));I = linspace(0,1,255);imagesc(I(ones(1,10),:)')colormap(map) Related QuestionProblem to adding pixel values
Best Answer