
How to create a 2D colorfield with red and green from 0 to 255 and b everywhere 128?
16 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Hello, can somebody tell me how to do it? I experimented with colormap but couldn't create the expected result.
r = [0:1/255:1]'; g = [0:1/255:1]'; b = repmat(0.5,1,256)';
map = [r,g,b];
cmap = colormap([r, g, b]);
but then only thing I received was an empty figure window :/
Can you help me?
0 commentaires
Réponses (1)
Image Analyst
le 29 Nov 2017
Try this:
rows = 480;
columns = 640;
red = uint8(linspace(0, 255, rows*columns));
red = reshape(red, rows, columns);
green = red;
blue = 128 * ones(rows, columns, 'uint8');
rgbImage = cat(3, red, green, blue);
imshow(rgbImage);

0 commentaires
Voir également
Catégories
En savoir plus sur Color and Styling dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!