How to create a 2D colorfield with red and green from 0 to 255 and b everywhere 128?
2 views (last 30 days)
Show older comments
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 Comments
Answers (1)
Image Analyst
on 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 Comments
See Also
Categories
Find more on Colormaps in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!