[scilab-Users] converting matrix to image
Samuel Gougeon
Samuel.Gougeon at univ-lemans.fr
Wed Apr 7 10:55:46 CEST 2010
Hi Robert,
----- Message d'origine -----
De : Robert Fong
Date : 05/04/2010 07:12:
> Hi,
> I would like to convert a matrix of floating point numbers
> (representing gray scale) to an image file such as a jpg file, that
> can be displayed as am image. Matlab does this with the "image"
> function. Does Scilab have a similar function? If not does anyone have
> any a way to accomplish this?
It is possible to display a real matrix as an image with Matplot or
Matplot1 as said before. Here is an example
clf
Ncolors=70; // Number of colors whished
M=grand(200,200,"uin",0,Ncolors); // Creating data. Replace by your own real matrix M
RGB=graycolormap(Ncolors+1); // You can choose another colormap. Here is the grey one.
LUT=addcolor(RGB); // Mandatory resampling of colors through all colors available in the colormap
Matplot(matrix(LUT(M+1),size(M))) // Displays the matrix
It is also possible to display the related colorbar in the margin: See
colorbar()
Once the matrix is displayed, use xs2jpg() or xs2gif() or xs2png... etc
to record the graphic windows into a image file.
Regards
Samuel
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.scilab.org/pipermail/users/attachments/20100407/2000e212/attachment.htm>
More information about the users
mailing list