[Scilab-users] buliding masks for images

Samuel Gougeon sgougeon at free.fr
Mon Mar 4 19:05:29 CET 2019


Hello Philipp,

Le 04/03/2019 à 14:15, P M a écrit :
> Dear all,
>
> I build some masks with scilab, that I want to apply later on a set of 
> images.
> I can build these masks a batch process, because I have pixel 
> coordinates that define the mask coordinates.
> Each mask itself will be an image....
> For now I use xs2svg and/or xs2png
>
> Now: Is there a way to export images from scilab applying alpha channel?
>
> I ask, because several masks will be layered on top of each 
> other...together with a mask that is build manually by a user.
> To get the final result I - for now - have to make each (mask-) image 
> a bit transparent, to still see the underlaying image.
> Thus I loose the original color of the mask image.
>
> I could probably build an R-G-B-alpha image such as:
>
> img = zeros[imgHeight, imgWidht ,4];
>
> R = img[ : , : ,1];
> G = img[ : , : ,2];
> B = img[ : , : ,3];
> A = img[ : , : ,4];
>
> and than set the right pixel values at the right positions.
>
> However: It seems, that it is not possible to add the alpha channel to 
> an image when exporting it to a native image file..such as png.

Interesting piece of information. It would deserve being documented in 
the xs*() pages for formats theoretically supporting the transparency.
Have you tried with xs2gif() as well?

At least, since Scilab 5.5.0, images with an alpha channel can be 
handled and display with Matlpot().

>
> imwrite (IPCV-toolbox) seems to support only 8bit (one-channel) or 
> 24bit (3-channel) image.

Have you tried with https://atoms.scilab.org/toolboxes/scicv ? It is 
likely the most huge external image processing library available for Scilab.

Regards
Samuel




More information about the users mailing list