What are the desired characteristics of your target matrix? And what images do you want to rasterize?
You see, for the only example you gave us, itβs almost trivial to define a matrix representing your image ...
1. figmat = ones(10,10,3) % create a 10x10 raster where each entry is a triple for RGB, setting them all to 1 colours the whole raster white 2. figmat(2:5,2:5,1:2) = 0 % sets RG components in the coloured area to 0, leaving only blue
Your matrix is ββa raster, for starters. Now you can use the built-in function image to visualize your matrix. See the documentation for this feature. Please note that my suggestion does not meet the specification for use with image () and colormap ().
High performance mark
source share