Linking to C from Scilab: looking for some advice

Antoine Monmayrant antoine.monmayrant at laas.fr
Thu Jan 6 13:23:54 CET 2011


Hi everyone,

As some of you have seen here, I was looking for a way to load 16bit 
tiff images in Scilab.
I found a way: compile a C routine that uses libtiff and link to it 
using "ilib_for_link".
It's the first time I manage to link to C code and I am looking for some 
advice on what is good/bad practice.
Is there a tutorial or an article on that?
I also have a specific question concerning "dynamic allocation".
More precisely, I would like in the end to get something like:

    image=openTIFF("test.tiff");

where "test.tiff" is an image of unknown width and height, and "image" a 
matrix of the same size than the image.
My problem is that it involves filling the "image" matrix without a 
priori knowing how big the matrix is.
Is there a way to do it properly using a single C call?
Or should I resort to something like

    function image=openTIFF("test.tiff")
        w=call("width_of_tiff","out",[1,1],1,"i");
        h=call("height_of_tiff","out",[1,1],1,"i");
        image=call("read_tiff","out",[h,w],1,"i");
    endfunction

that uses several calls to C?

Thanks in advance,

Antoine




More information about the users mailing list