Tiff function in Octave

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Tiff function in Octave

Gabriele Ciccone
Hi everybody,
I'm trying to convert a function I use in Matlab to merge a RGB image with a IR image (both in JPG formats) and create a Tiff image with 4 bands (R, G, B, IR). But I have some problem using Tiff function, 'cause looks like that Tiff function is still not implemented in Octave.

Someone know how can I converte for Octave the Tiff part of following function?

for fidx = 1:numel(filelist1)
    rgb = imread(fullfile(folder1, filelist1{fidx}));
    numrows = size(rgb,1);
    numcols = size(rgb,2);
    ir = imread(fullfile(folder2, filelist2{fidx}));
    data = cat(3,rgb,ir);


    t = Tiff(fullfile(folderout, sprintf(outfilepattern, fidx))','w');

setTag(t,'Photometric',Tiff.Photometric.RGB);
setTag(t,'Compression',Tiff.Compression.None);
setTag(t,'BitsPerSample',8);
setTag(t,'SamplesPerPixel',4);
setTag(t,'SampleFormat',Tiff.SampleFormat.UInt);
setTag(t,'ExtraSamples',Tiff.ExtraSamples.Unspecified);
setTag(t,'ImageLength',numrows);
setTag(t,'ImageWidth',numcols);
setTag(t,'TileLength',32);
setTag(t,'TileWidth',32);
setTag(t,'PlanarConfiguration',Tiff.PlanarConfiguration.Chunky);

    write(t,data);
    close(t);



Thank you so much!!

GCiccone




Reply | Threaded
Open this post in threaded view
|

Re: Tiff function in Octave

John W. Eaton
Administrator
On 6/24/20 5:27 AM, Gabriele Ciccone wrote:
> Hi everybody,
> I'm trying to convert a function I use in Matlab to merge a RGB image with a IR image (both in JPG formats) and create a Tiff image with 4 bands (R, G, B, IR). But I have some problem using Tiff function, 'cause looks like that Tiff function is still not implemented in Octave.
>

It looks like the Tiff function is a constructor for an object in Matlab
that allows manipulation of tiff images.  So someone would have to
provide a replacement for Octave.  To be included as part of Octave, it
would need to be an independent implementation, not based in any way on
or derived from the Matlab code, other than to provide the same
interface (same requirement as for all other code in Octave).

jwe



Reply | Threaded
Open this post in threaded view
|

Re: Tiff function in Octave

Pantxo
In reply to this post by Gabriele Ciccone
You would try to use the alpha channel to store your IR map, maybe this
would do the trick. Something like:

   ## Read images and cast them to uint8

   rgb = im2uint8 (imread (image_file)); # N-by-M-by-3 uint8

   ir = im2uint8 (imread (ir_file));            # N-by-M uint8

   imwrite (rgb, composite_file, "alpha", ir)


Pantxo



Reply | Threaded
Open this post in threaded view
|

Re: Tiff function in Octave

Gabriele Ciccone
It works!
Thank you so much!

Gabriele

> Il giorno 24 giu 2020, alle ore 20:58, Pantxo Diribarne <[hidden email]> ha scritto:
>
> You would try to use the alpha channel to store your IR map, maybe this would do the trick. Something like:
>
>   ## Read images and cast them to uint8
>
>   rgb = im2uint8 (imread (image_file)); # N-by-M-by-3 uint8
>
>   ir = im2uint8 (imread (ir_file));            # N-by-M uint8
>
>   imwrite (rgb, composite_file, "alpha", ir)
>
>
> Pantxo
>
>
>