Home > src > matlab > pfs_write_luminance.m

pfs_write_luminance

PURPOSE ^

PFS_WRITE_LUMINANCE writes an image file

SYNOPSIS ^

function pfs_write_luminance( fileName, img )

DESCRIPTION ^

PFS_WRITE_LUMINANCE writes an image file
 
 PFS_WRITE_LUMINANCE ( file_name, img )

 img - 2D matrix representing luminance values

 The format of the file is recognized based in the file name extension:
 .hdr for Radiance images, .exr for OpenEXR, .jpg for JPEG and .png for
 PNG. See manual of "pfsout" shell command for the full list of the
 supported formats. 

 See also: PFS_WRITE_IMAGE, PFS_WRITE_RGB, PFS_WRITE_XYZ,
 PFS_READ_IMAGE.

 Copyright 2009 Rafal Mantiuk

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function pfs_write_luminance( fileName, img )
0002 %PFS_WRITE_LUMINANCE writes an image file
0003 %
0004 % PFS_WRITE_LUMINANCE ( file_name, img )
0005 %
0006 % img - 2D matrix representing luminance values
0007 %
0008 % The format of the file is recognized based in the file name extension:
0009 % .hdr for Radiance images, .exr for OpenEXR, .jpg for JPEG and .png for
0010 % PNG. See manual of "pfsout" shell command for the full list of the
0011 % supported formats.
0012 %
0013 % See also: PFS_WRITE_IMAGE, PFS_WRITE_RGB, PFS_WRITE_XYZ,
0014 % PFS_READ_IMAGE.
0015 %
0016 % Copyright 2009 Rafal Mantiuk
0017 
0018 if( nargin ~= 2 )
0019     error( 'pfs_write_luminance: improper usage' );
0020 end
0021 
0022 %cmd = sprintf( '%spfsout %s%s', pfs_shell(), fileName, pfs_shell(1) )
0023 fid = pfspopen( sprintf( '%spfsout ''%s''%s', pfs_shell(), fileName, pfs_shell(1) ), 'w' );    
0024 pfs = pfsopen( fid, size( img ) );
0025 
0026 pfs.channels.Y = img;
0027 
0028 pfsput( pfs );
0029 pfsclose( pfs );
0030 pfspclose( fid );
0031 
0032 end

Generated on Tue 03-Mar-2009 13:03:09 by m2html © 2003