Home > src > matlab > pfsview_rgb.m

pfsview_rgb

PURPOSE ^

Shows high-dynamic range RGB image using pfsview

SYNOPSIS ^

function pfsview_rgb( varargin )

DESCRIPTION ^

 Shows high-dynamic range RGB image using pfsview

 Usage: pfsview( R, G, B )
        pfsview( img )
 R, G, B - red, green and blue color channels, given as linear response
 img - 3D matrix image, where img(:,:,1:3) represents red, blue and green
       color channels

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function pfsview_rgb( varargin )
0002 % Shows high-dynamic range RGB image using pfsview
0003 %
0004 % Usage: pfsview( R, G, B )
0005 %        pfsview( img )
0006 % R, G, B - red, green and blue color channels, given as linear response
0007 % img - 3D matrix image, where img(:,:,1:3) represents red, blue and green
0008 %       color channels
0009 
0010 if( nargin == 3 )
0011     if( ~isnumeric(varargin{1}) || ~isnumeric(varargin{2}) || ~isnumeric(varargin{1}) )
0012         error( 'pfsview_rgb: matrices of the equal size expected as an arguments' );
0013     end
0014     [X Y Z] = pfs_transform_colorspace( 'RGB', varargin{1}, varargin{2}, varargin{3}, 'XYZ' );
0015     [height width] = size( varargin{1} );
0016 elseif( nargin == 1 && ndims(varargin{1}) == 3 ) 
0017     [X Y Z] = pfs_transform_colorspace( 'RGB', varargin{1}(:,:,1), varargin{1}(:,:,2), varargin{1}(:,:,3), 'XYZ' );
0018     [height width] = size( varargin{1}(:,:,1) );
0019 else
0020     error( 'pfsview_rgb: improper usage' );
0021 end
0022   
0023 
0024   if( exist( 'window_min', 'var' ) == 1 && exist( 'window_max', 'var' ) == 1 )
0025     minmax_window = sprintf( '--window_min %g --window_max %g ', window_min, window_max );
0026   else
0027     minmax_window = '';
0028   end
0029   
0030   % tmp file is used rather than pipes to run pfsview in background without
0031   % blocking matlab
0032   tmp_file = tempname();
0033 %  hv_fid = pfspopen( sprintf( '%spfsview %s%s', pfs_shell(), minmax_window, pfs_shell(1) ), 'w' );
0034   pfsout = pfsopen( tmp_file, height, width );
0035   pfsout.channels.X = X;
0036   pfsout.channels.Y = Y;
0037   pfsout.channels.Z = Z;
0038   pfsout.tags.FILE_NAME = 'matlab';
0039   pfsput( pfsout );  
0040   pfsclose( pfsout );
0041 
0042   system( sprintf( '%s(pfsview <''%s'' && rm -f %s) &%s', pfs_shell(), tmp_file, tmp_file, pfs_shell( 1 ) ) );
0043   
0044 end

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