15 |
16 |
--------------------------------------------------------------------------------
/src/matlab/Contents.m:
--------------------------------------------------------------------------------
1 | % pfstools - matlab interface
2 | %
3 | % This is an entry page for pfstools matlab documentation.
4 | %
5 | % -----------------------------------------------------------------
6 | % The most frequently used functions:
7 | %
8 | % PFS_READ_IMAGE - read image from file
9 | % PFS_WRITE_IMAGE - write image to file
10 | % PFSVIEW - view matrices as images using pfsview
11 | %
12 | % -----------------------------------------------------------------
13 | % More specialized functions:
14 | %
15 | % PFS_TRANSFORM_COLORSPACE - transform between color spaces
16 | % PFS_READ_LUMINANCE - read luminance image from file
17 | % PFS_READ_RGB - read RGB image from file
18 | % PFS_READ_XYZ - read XYZ image from file
19 | % PFS_WRITE_LUMINANCE - write luminance image to file
20 | % PFS_WRITE_RGB - write RGB image to file
21 | % PFS_WRITE_XYZ - write XYZ image to file
22 | % PFS_TEST_SHELL - diagnoze for possible problems if pfstools interface is not working
23 | %
24 | % -----------------------------------------------------------------
25 | % Low-level interface, probably you do not need this:
26 | %
27 | % PFSOPEN - open pfs-stream for reading/writing
28 | % PFSPOPEN - execute shell command and acquire its input / output stream
29 | % PFSCLOSE - close pfs-stream
30 | % PFSPCLOSE - close stream created with PFSPOPEN
31 | % PFSGET - read one frame from pfs-stream
32 | % PFSPUT - write one frame to pfs-stream
33 | % PFS_SHELL - wrapper for calling pfstools shell programs from matlab
34 | %
35 | % -----------------------------------------------------------------
36 |
--------------------------------------------------------------------------------
/src/octave/help_files/pfsopen_help.h:
--------------------------------------------------------------------------------
1 | "Open pfs stream for reading or writing. pfs is an interchange format for high dynamic range images (see http://pfstools.sourceforge.net).\n"
2 | "\n"
3 | "usage: pfs_struct = pfsopen( fileName );\n"
4 | " pfs_struct = pfsopen( fileName, rows, columns );\n"
5 | " pfs_struct = pfsopen( fileName, [ rows columns ] );\n"
6 | " \n"
7 | " fileName - name of the file to read or write. \"stdin\" or \"stdout\" for standard input and output\n"
8 | " rows - height of images to write\n"
9 | " columns - width of images to write\n"
10 | "\n"
11 | "The first usage of pfsopen opens pfs stream for reading; the second and third for writing. Use pfsget or pfsput to read or write frames or single images. You must close pfs stream with pfsclose. The stream will not be closed when pfs_struct is deleted (for example with 'clear pfs_struct').\n"
12 | "\n"
13 | "pfs_struct is a structure that contains the following fields:\n"
14 | " EOF - set to 1 if there are no more frames; 0 otherwise\n"
15 | " FH - file handle of the file. For internal pruposes, do not use\n"
16 | " MODE - file open mode: R - for reading, W - for writing\n"
17 | " columns, rows - dimensions of each channel in the stream\n"
18 | " channels - structure that contains channels represented as real matrices\n"
19 | " tags - structure that contains tags represented as strings\n"
20 | " channelTags - structure that contains a structure for each channel, which contains tags. The format of the latter structure is the same as for 'tags' field.\n"
21 | " \n"
22 | ;
23 |
--------------------------------------------------------------------------------
/cmake/FindNETPBM.cmake:
--------------------------------------------------------------------------------
1 | # - Find NETPBM
2 | # Find the native NETPBM includes and library
3 | # This module defines
4 | # NETPBM_INCLUDE_DIR, where to find jpeglib.h, etc.
5 | # NETPBM_LIBRARIES, the libraries needed to use NETPBM.
6 | # NETPBM_FOUND, If false, do not try to use NETPBM.
7 | # also defined, but not for general use are
8 | # NETPBM_LIBRARY, where to find the NETPBM library.
9 |
10 | FIND_PATH(NETPBM_INCLUDE_DIR pam.h
11 | /usr/local/include
12 | /usr/local/include/netpbm
13 | /usr/include
14 | /usr/include/netpbm
15 | )
16 |
17 | SET(NETPBM_NAMES ${NETPBM_NAMES} netpbm)
18 | FIND_LIBRARY(NETPBM_LIBRARY
19 | NAMES ${NETPBM_NAMES}
20 | PATHS /usr/lib /usr/local/lib
21 | )
22 |
23 | IF (NETPBM_LIBRARY AND NETPBM_INCLUDE_DIR)
24 | SET(NETPBM_LIBRARIES ${NETPBM_LIBRARY})
25 | SET(NETPBM_FOUND "YES")
26 | ELSE (NETPBM_LIBRARY AND NETPBM_INCLUDE_DIR)
27 | SET(NETPBM_FOUND "NO")
28 | ENDIF (NETPBM_LIBRARY AND NETPBM_INCLUDE_DIR)
29 |
30 |
31 | IF (NETPBM_FOUND)
32 | IF (NOT NETPBM_FIND_QUIETLY)
33 | MESSAGE(STATUS "Found NETPBM: ${NETPBM_LIBRARIES}")
34 | ENDIF (NOT NETPBM_FIND_QUIETLY)
35 | ELSE (NETPBM_FOUND)
36 | IF (NETPBM_FIND_REQUIRED)
37 | MESSAGE(FATAL_ERROR "Could not find NETPBM library")
38 | ENDIF (NETPBM_FIND_REQUIRED)
39 | ENDIF (NETPBM_FOUND)
40 |
41 | # Deprecated declarations.
42 | SET (NATIVE_NETPBM_INCLUDE_PATH ${NETPBM_INCLUDE_DIR} )
43 | GET_FILENAME_COMPONENT (NATIVE_NETPBM_LIB_PATH ${NETPBM_LIBRARY} PATH)
44 |
45 | MARK_AS_ADVANCED(
46 | NETPBM_LIBRARY
47 | NETPBM_INCLUDE_DIR
48 | )
49 |
50 |
--------------------------------------------------------------------------------
/src/fileformat/pfsoutffmpeg.1:
--------------------------------------------------------------------------------
1 | .TH "pfsoutffmpeg" 1
2 | .SH NAME
3 | pfsoutffmpeg \- Read pfs frames from stdin and forward them to ffmpeg program
4 | .SH SYNOPSIS
5 | .B pfsoutffmpeg
6 | [--help]
7 | output_file
8 | .SH DESCRIPTION
9 | This command is a wrapper for ffmpeg program and can be used to
10 | write pfs frames to a compressed video.
11 |
12 | Check the examples section to for sample usage and see manual of
13 | ffmpeg for further information.
14 |
15 | Note that the usage of '-f' switch (input format specifier) and '-i'
16 | switch (input file specifier) of the ffmpeg program is implemented
17 | inside the script and is therefore not allowed.
18 |
19 | .SH EXAMPLES
20 | .TP
21 | pfsinrgbe frame%04d.hdr --frames 100:2:200 | pfstmo_reinhard02 -s
22 | | pfsgamma -g 1.7 | pfsoutffmpeg -qscale 4 test.avi
23 |
24 | 1. Read HDR frames in RGBE format with the following names:
25 | frame0100.hdr, frame0102.hdr, frame0104.hdr,... frame0200.hdr
26 |
27 | 2. Apply local tone mapping operator to each frame (Reinhard2002
28 | model, part of the PFSTMO package)
29 |
30 | 3. Apply gamma correction to each tone mapped frame
31 |
32 | 4. Compress frames to test.avi animation
33 |
34 | .SH "SEE ALSO"
35 | .BR ffmpeg (1)
36 | .BR pfsin (1)
37 | .BR pfstmo_reinhard02 (1)
38 | .BR pfsgamma (1)
39 |
40 | .SH BUGS
41 | Frames smaller than 512x384 can cause broken pipe error, due to bug in
42 | ppm pipe reading routine in ffmpeg.
43 |
44 | Please report bugs and comments to
45 | Rafal Mantiuk or
46 | Grzegorz Krawczyk .
47 |
--------------------------------------------------------------------------------
/src/tmo/mai11/pfstmo_mai11.1:
--------------------------------------------------------------------------------
1 | .TH "pfstmo_mai11" 1
2 | .SH NAME
3 | pfstmo_mai11 \- Tone-mapping for backward-compatible compression
4 | .SH SYNOPSIS
5 | \fBpfstmo_mai11\fR [\fB--verbose\fR][\fB--quiet\fR] [\fB--help\fR]
6 | .SH DESCRIPTION
7 | This is a tone-mapping operator that is optimized to give the best
8 | performance for images or video that are encoded using a backward-compatible
9 | compression, such as HDR-JPEG, or HDR-MPEG. The images produced by
10 | this operator do not need to be visually pleasing. The details on the
11 | operator can be found in:
12 | .IP
13 | Mai, Z., Mansour, H., Mantiuk, R., Nasiopoulos, P., Ward, R., &
14 | Heidrich, W.
15 | .IP
16 | Optimizing a tone curve for backward-compatible high dynamic range
17 | image and video compression.
18 | .IP
19 | .PP
20 | If you find this TMO useful in your research project, please cite the
21 | paper above.
22 | .PP
23 | The result of this TMO does not require gamma correction.
24 | .SH OPTIONS
25 | .TP
26 | \fB--verbose\fR, \fB-v\fR
27 | Print additional information during program execution.
28 | .TP
29 | \fB--quiet\fR, \fB-q\fR
30 | Do not display progress report.
31 | .TP
32 | \fB--help\fR, \fB-h\fR
33 | Print list of commandline options.
34 | .SH EXAMPLES
35 | .TP
36 | pfsin memorial.hdr | pfstmo_mai11 | pfsout memorial_to_encode.png
37 | .IP
38 | Tone map memorial image and store the result in the PNG format.
39 | .SH "SEE ALSO"
40 | .BR pfsin (1)
41 | .BR pfsout (1)
42 | .BR pfsview (1)
43 | .SH BUGS
44 | Please report bugs and comments to the pfstools discussion group
45 | (http://groups.google.com/group/pfstools).
46 |
--------------------------------------------------------------------------------
/src/hdrhtml/hdrhtml_hdrlabs_templ/hdrhtml_page_templ_short.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | @title@
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
38 |
39 |
40 | @image_htmlcode@
41 |
42 |
43 |
44 |
45 |
--------------------------------------------------------------------------------
/src/filter/pfsclamp.1:
--------------------------------------------------------------------------------
1 | .TH "pfsclamp" 1
2 | .SH NAME
3 | pfsclamp \- Clamp color and luminance channel values to be within the specified range
4 | .SH SYNOPSIS
5 | .B pfsclamp
6 | [--min ] [--max ]
7 | [--percentile] [--zero] [--rgb]
8 | .SH DESCRIPTION
9 | Use this command to clamp values of luminance and color channels to be
10 | within the specified range. I.e. if a value in the channel is above
11 | the specified maximum or below specified minimum, set the value to either
12 | minimum or maximum.
13 |
14 | The command operates directly on XYZ channels.
15 | .SH OPTIONS
16 | .TP
17 | --min
18 |
19 | Lower bound for clamping. Default value: 0.0001 (10^-4)
20 |
21 | .TP
22 | --max
23 |
24 | Upper bound for clamping. Default value: 100000000 (10^8)
25 |
26 | .TP
27 | --percentile, -p
28 |
29 | Treat given min and max values as a percentile.
30 |
31 | .TP
32 | --zero, -z
33 |
34 | Set values out of clamping range to zero, instead of setting to
35 | specified maximum and minimum.
36 |
37 | .TP
38 | --rgb
39 |
40 | Perform clamping in RGB space.
41 |
42 | .SH EXAMPLES
43 | .TP
44 | pfsin memorial.hdr | pfsclamp | pfsout memorial_cl.hdr
45 |
46 | Remove possible out-of-range values, for examples zeros, from memorial
47 | image.
48 |
49 | .TP
50 | pfsin memorial.hdr | pfsclamp --max 0.95 -p | pfsout memorial_cl.hdr
51 |
52 | Remove 5% of the brightest pixels from the original image.
53 | .SH "SEE ALSO"
54 | .BR pfsin (1)
55 | .BR pfsout (1)
56 | .SH BUGS
57 | Please report bugs and comments to Rafal Mantiuk
58 | and Grzegorz Krawczyk
59 | .
60 |
--------------------------------------------------------------------------------
/src/octave/pfs_open_frames.m:
--------------------------------------------------------------------------------
1 | function pfs_struct = pfs_open_frames( filePattern, frameSize )
2 | ## Open frames / image in one of the suppoted formats for reading or
3 | ## writing. Reading or writting frames is donw with pfsput or pfsget.
4 | ##
5 | ## usage: pfs_struct = pfs_open_frames( filePattern, size )
6 | ## pfs_struct = pfs_open_frames( filePattern )
7 | ##
8 | ## This command is equivalent to pfsopen, but can handle files in any
9 | ## format supported by pfstools. 'filePattern' can specify files,
10 | ## frames, including '--frames' and '--skip-missing', similarly as
11 | ## 'pfsin' / 'pfsout' commands. You can pass also additional options,
12 | ## like --compression=RLE for exr files in filePattern.
13 | ## All option that take an argument (except --frames) must given in
14 | ## the form --option=value, that is without a space between an
15 | ## option and its argument.
16 | ##
17 | ## pfs_close_frames should be used instead of pfs_close to close pfsstream.
18 | ##
19 |
20 | doWrite = exist( "frameSize" );
21 |
22 | try
23 | if( doWrite )
24 | execStr = sprintf( "pfsout %s", filePattern );
25 | fid = popen( execStr, "w" );
26 | pfs_struct = pfsopen( fid, frameSize );
27 | pfs_struct.fid = fid;
28 | else
29 | execStr = sprintf( "pfsin %s", filePattern );
30 | fid = popen( execStr, "r" );
31 | pfs_struct = pfsopen( fid );
32 | pfs_struct.fid = fid;
33 | endif
34 | catch
35 | fclose( pfs_struct.fid );
36 | error( [ "pfs_open_frames: " __error_text__ ] );
37 | end_try_catch
38 |
39 | endfunction
40 |
--------------------------------------------------------------------------------
/src/tmo/ferradans11/pfstmo_ferradans11.1:
--------------------------------------------------------------------------------
1 | .TH "pfstmo_ferradans11" 1
2 | .SH NAME
3 | pfstmo_ferradans11 \- Tone mapping operator with visual adaptation and local contrast enhancement
4 | .SH SYNOPSIS
5 | .B pfstmo_ferradans11
6 | [--rho-r ] [--inv_alpha-a ] [--help]
7 | .SH DESCRIPTION
8 | This command implements a tone mapping operator as described in:
9 | .PD 0
10 | .IP
11 | S. Ferradans, M. Bertalmio, E. Provenzi and V. Caselles
12 | .IP
13 | An analysis of visual adaptation and contrast perception for tone mapping.
14 | .IP
15 | In: Trans. on Pattern Analysis and Machine Intelligence, 2011.
16 | .PD
17 | .PP
18 | Note that this operator does NOT require gamma correction. See the example below.
19 | .PP
20 | .SH OPTIONS
21 | .TP
22 | \fB--rho-r\fR , \fB-r\fR
23 | Controls over all lightness(related to the adaptation level), the greater the value the brighter the final image. Default value: -4
24 | .TP
25 | \fB--inv_alpha-a\fR , \fB-a\fR
26 | Controls the level of detail, the higher the value the bigger the level of detail enhancement. Default value: 0.1
27 | .TP
28 | \fB--verbose\fR
29 | Print additional information during program execution.
30 | .TP
31 | \fB--help\fR, \fB-h\fR
32 | Print list of commandline options.
33 | .SH EXAMPLES
34 | .TP
35 | pfsin Tree.pfm | pfstmo_ferradans11 --rho -3 --inv_alpha 10 | pfsout tree.png
36 | Tone map image and save it in png format.
37 | .SH "SEE ALSO"
38 | .BR pfsgamma (1)
39 | .BR pfsin (1)
40 | .BR pfsout (1)
41 | .BR pfsview (1)
42 | .SH BUGS
43 | Please report bugs and comments to the pfstools discussion group
44 | (http://groups.google.com/group/pfstools).
45 |
--------------------------------------------------------------------------------
/src/octave/pfsstat.1:
--------------------------------------------------------------------------------
1 | .TH "pfsstat" 1
2 | .SH NAME
3 | pfsstat \- Show frame / image statistics
4 | .SH SYNOPSIS
5 | .B pfsstat
6 | .SH DESCRIPTION
7 | This command will show a short text statistic on each image in the pfs
8 | stream. In the statistics you can find:
9 | .TP
10 | \fBFile\fR - name of the input file
11 | .TP
12 | \fBWidth, Height\fR - image dimensions
13 | .TP
14 | \fBMinimum\fR - minimum luminance of an image(*), given in linear
15 | units (relative luminance in cd/m^2) and logarithmic units
16 | .TP
17 | \fBMaximum\fR - maximum luminance of an image(*)
18 | .TP
19 | \fBAverage\fR - average luminance of an image(*)
20 | .TP
21 | \fBMean\fR - mean luminance of an image(*)
22 | .PP
23 | (*) Before min, max, average, median and dynamic range is computed,
24 | the following processing is performed on an image: 1) negative and
25 | zero values are replaced with the smallest positive value (to compute
26 | logarithms); 2) the image is low-pass filtered. The low-pass filtering
27 | removes few very dark or very bright pixels that can significantly
28 | influence estimation of the dynamic range. The percentile, instead of
29 | a low-pass filter, is sometimes used for the same purpose. However, a
30 | low-pass filter is preferred to the percentile in pfstools since,
31 | taking into account the processing that is happening in the human
32 | visual system, low-frequency band filter is more plausible.
33 | .PP
34 | Note: This command requires GNU Octave.
35 | .SH EXAMPLES
36 | .TP
37 | pfsin memorial.hdr | pfsstat
38 | .PP
39 | Show statistics for the memorial image.
40 | .SH BUGS
41 | Please report bugs and comments to Rafal Mantiuk
42 | .
43 |
44 |
45 |
--------------------------------------------------------------------------------
/src/pfsview/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | include_directories ("${PROJECT_BINARY_DIR}/" "${PROJECT_SOURCE_DIR}/src/pfs" ${QT_INCLUDES})
2 | if( NOT HAS_GETOPT )
3 | include_directories ("${GETOPT_INCLUDE}")
4 | endif( NOT HAS_GETOPT )
5 |
6 | #include_directories ("${PROJECT_BINARY_DIR}/" "${PROJECT_SOURCE_DIR}/src/pfs" ${QT_QT_INCLUDE_DIR} ${QT_QTCORE_INCLUDE_DIR} ${QT_QTGUI_INCLUDE_DIR})
7 | link_directories("${PROJECT_SOURCE_DIR}/src/pfs")
8 |
9 | SET(pfsview_SOURCES main.cpp pfsview_widget.cpp luminancerange_widget.cpp histogram.cpp resources.cpp)
10 | SET(pfsview_HEADERS main.h pfsview_widget.h luminancerange_widget.h)
11 |
12 | if (OPENMP_FOUND)
13 | # set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OpenMP_C_FLAGS}")
14 | set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}")
15 | endif()
16 |
17 | QT4_WRAP_CPP(pfsview_HEADERS_MOC ${pfsview_HEADERS})
18 |
19 | QT4_WRAP_CPP(pfsview_HEADERS_MOC ${pfsview_HEADERS})
20 |
21 | # Replace the tag with the path to bash
22 | file(READ ${CMAKE_CURRENT_SOURCE_DIR}/pfsv.in file_content)
23 | string(REGEX REPLACE "@BASH_PATH@" "${BASH_EXECUTABLE}" file_content "${file_content}")
24 | file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/pfsv" "${file_content}")
25 |
26 | install (FILES "${CMAKE_CURRENT_BINARY_DIR}/pfsv"
27 | PERMISSIONS OWNER_EXECUTE GROUP_EXECUTE WORLD_EXECUTE OWNER_WRITE WORLD_READ GROUP_READ OWNER_READ
28 | DESTINATION bin)
29 |
30 |
31 | ADD_EXECUTABLE(pfsview ${pfsview_SOURCES}
32 | ${pfsview_HEADERS_MOC} "${GETOPT_OBJECT}")
33 | TARGET_LINK_LIBRARIES(pfsview pfs ${QT_LIBRARIES} ${QT_QTCORE_LIBRARY} ${QT_QTGUI_LIBRARY})
34 |
35 | install (TARGETS pfsview DESTINATION bin)
36 | install (FILES pfsview.1 DESTINATION ${MAN_DIR})
37 |
--------------------------------------------------------------------------------
/src/pfsglview/glenv.h:
--------------------------------------------------------------------------------
1 |
2 | #ifndef __GLENV_H
3 | #define __GLENV_H
4 |
5 | #ifdef __APPLE__ // "Think different" for OS/X :)
6 | #include "GLUT/glut.h"
7 | #include "OPENGL/gl.h"
8 | #include "OPENGL/glu.h"
9 | #include "OPENGL/glext.h"
10 | #else
11 | #if defined(_WIN32) || defined(_WIN64) || defined(__CYGWIN__)
12 | #include
13 | #endif
14 | #include "GL/glut.h"
15 | #include "GL/gl.h"
16 | #include "GL/glu.h"
17 | #include "GL/glext.h"
18 | #endif
19 |
20 |
21 | // uncomment the define for a console live call graph
22 | // this will not work in all situations, since some code is executed concurrently
23 |
24 | //#define CALLGRAPH
25 |
26 | #include
27 | #ifdef CALLGRAPH
28 | extern int ident ;
29 | inline void dbs(std::string message) { for(int i = ident-1; i > 0 ; i--)
30 | ((i==1)?printf("\u251c\u2500\u2500"):printf("\u2502 "));
31 | printf("\u252c\u2500"); printf("%s\n", message.c_str()); ident++;
32 | }
33 | inline void dbe(std::string message) { ident--;
34 | // comment out next three lines for more compact display
35 | for(int i = ident; i > 0 ; i--)
36 | ((i==1)?printf("\u2514\u2500\u2500"):printf("\u2502 "));
37 | printf("\u2518"); printf("\n", message.c_str());
38 | }
39 | #else
40 | inline void dbs(std::string message) {}
41 | inline void dbe(std::string message) {}
42 | #endif
43 |
44 |
45 |
46 | #endif
47 |
--------------------------------------------------------------------------------
/src/filter/pfscat.1:
--------------------------------------------------------------------------------
1 | .TH "pfscat" 1
2 | .SH NAME
3 | pfscat \- Concatenate frames in PFS stream
4 | .SH SYNOPSIS
5 | .B pfscat
6 | [--horizontal] [--vertical] [-j ]
7 | [-R ] [-G ] [-B ] [-Y ] [--help] image1.pfs image2.pfs ...
8 | .SH DESCRIPTION
9 | Read number of frames as input, stitch them either horizontally
10 | or vertically, and produce single frame as output. If frames are not all
11 | the same size they are justified with each other - by default they are
12 | centered, but can also be flushed with a specified edge.
13 | .SH OPTIONS
14 | .TP
15 | --horizontal, -H
16 | Stitch frames horizontally.
17 | .TP
18 | --vertical, -V
19 | Stitch frames vertically.
20 | .TP
21 | -j
22 | Specify justification of input frames. Predefined types are: min,
23 | max, center.
24 | .TP
25 | -R , -G , -B
26 | Color of an extra space in a resulting image. Default color is black,
27 | and if some of the components is not specified, its value is set to 0.0.
28 | .TP
29 | -Y
30 | Color of an extra space in luminance mode.
31 | .TP
32 | --help, -h
33 | Print a list of commandline options.
34 | .SH EXAMPLES
35 | .TP
36 | pfsinmulti anim1_%04d.hdr anim2_%04d.hdr -- pfscat @1 @2 --vertical
37 | Stitch two hdr animations in vertical alignment. 'pfscat' is taken as an
38 | argument by 'pfsinmulti', therefore it must be preceded with '--'. Number
39 | of @1 @2 ... @n arguments must be the same as number of animations to combine.
40 | .SH NOTES
41 | Note that either --horizontal or --vertical option must be specified.
42 | .SH SEE ALSO
43 | .BR pfsin (1)
44 | .BR pfsout (1)
45 | .SH BUGS
46 | Please report bugs and comments to Dorota Zdrojewska
47 | .
48 |
--------------------------------------------------------------------------------
/src/matlab/pfs_write_xyz.m:
--------------------------------------------------------------------------------
1 | function pfs_write_xyz( fileName, varargin )
2 | %PFS_WRITE_XYZ write an XYZ image file.
3 | %
4 | % PFS_WRITE_XYZ( file_name, X, Y, Z )
5 | % PFS_WRITE_XYZ( file_name, img )
6 | %
7 | % X, Y, Z - XYZ color channels, given as linear response
8 | % img - 3D matrix image, where img(:,:,1:3) represents XYZ color channels
9 | %
10 | % The format of the file is recognized based in the file name extension:
11 | % .hdr for Radiance images, .exr for OpenEXR, .jpg for JPEG and .png for
12 | % PNG. See manual of "pfsout" shell command for the full list of the
13 | % supported formats.
14 | %
15 | % See also: PFS_WRITE_IMAGE, PFS_WRITE_LUMINANCE, PFS_WRITE_RGB,
16 | % PFS_READ_IMAGE.
17 | %
18 | % Copyright 2009 Rafal Mantiuk
19 |
20 | %cmd = sprintf( '%spfsout %s%s', pfs_shell(), fileName, pfs_shell(1) )
21 | fid = pfspopen( sprintf( '%spfsout ''%s''%s', pfs_shell(), fileName, pfs_shell(1) ), 'w' );
22 | pfs = pfsopen( fid, [size( varargin{1}, 1 ) size( varargin{1}, 2 )] );
23 |
24 | if( nargin == 4 )
25 | if( ~isnumeric(varargin{1}) || ~isnumeric(varargin{2}) || ~isnumeric(varargin{1}) )
26 | error( 'pfs_write_xyz: matrices of the equal size expected as an arguments' );
27 | end
28 | pfs.channels.X = single(varargin{1});
29 | pfs.channels.Y = single(varargin{2});
30 | pfs.channels.Z = single(varargin{3});
31 | elseif( nargin == 2 && ndims(varargin{1}) == 3 )
32 | pfs.channels.X = single(varargin{1}(:,:,1));
33 | pfs.channels.Y = single(varargin{1}(:,:,2));
34 | pfs.channels.Z = single(varargin{1}(:,:,3));
35 | else
36 | error( 'pfs_write_xyz: improper usage' );
37 | end
38 |
39 | pfsput( pfs );
40 | pfsclose( pfs );
41 | pfspclose( fid );
42 |
43 | end
44 |
--------------------------------------------------------------------------------
/src/matlab/pfsopen.m:
--------------------------------------------------------------------------------
1 | % Open pfs stream for reading or writing. pfs is an interchange format for high dynamic range images (see http://pfstools.sourceforge.net).
2 | %
3 | % usage: pfs_struct = pfsopen( fileName );
4 | % pfs_struct = pfsopen( fileName, rows, columns );
5 | % pfs_struct = pfsopen( fileName, [ rows columns ] );
6 | % pfs_struct = pfsopen( fid, ... );
7 | %
8 | % fileName - name of the file to read or write. \"stdin\" or \"stdout\" for standard input and output
9 | % rows - height of images to write
10 | % columns - width of images to write
11 | %
12 | % The first usage of pfsopen opens pfs stream for reading, the second and
13 | % the third for writing. pfsopen also accepts file descriptor returned from
14 | % pfspopen, which can be used instead of a file name (the fourth usage). Use
15 | % pfsget or pfsput to read or write frames or single images. You must close
16 | % pfs stream with pfsclose. The stream will not be closed when pfs_struct
17 | % is deleted (for example with 'clear pfs_struct').
18 | %
19 | % pfs_struct is a structure that contains the following fields:
20 | % EOF - set to 1 if there are no more frames; 0 otherwise
21 | % FH - file handle of the file. For internal pruposes, do not use
22 | % MODE - file open mode: R - for reading, W - for writing
23 | % columns, rows - dimensions of each channel in the stream
24 | % channels - structure that contains channels represented as real matrices
25 | % tags - structure that contains tags represented as strings
26 | % channelTags - structure that contains a structure for each channel,
27 | % which contains tags. The format of the latter structure is the same as
28 | % for 'tags' field.
29 |
--------------------------------------------------------------------------------
/src/matlab/pfs_write_rgb.m:
--------------------------------------------------------------------------------
1 | function pfs_write_rgb( fileName, varargin )
2 | %PFS_WRITE_RGB write an RGB image file.
3 | %
4 | % PFS_WRITE_RGB( file_name, R, G, B )
5 | % PFS_WRITE_RGB( file_name, img )
6 | %
7 | % R, G, B - red, green and blue color channels, given as linear response
8 | % img - 3D matrix image, where img(:,:,1:3) represents red, blue and green
9 | % color channels
10 | %
11 | % The format of the file is recognized based in the file name extension:
12 | % .hdr for Radiance images, .exr for OpenEXR, .jpg for JPEG and .png for
13 | % PNG. See manual of "pfsout" shell command for the full list of the
14 | % supported formats.
15 | %
16 | % See also: PFS_WRITE_IMAGE, PFS_WRITE_LUMINANCE, PFS_WRITE_XYZ,
17 | % PFS_READ_IMAGE.
18 | %
19 | % Copyright 2009 Rafal Mantiuk
20 |
21 | if( nargin == 4 )
22 | if( ~isnumeric(varargin{1}) || ~isnumeric(varargin{2}) || ~isnumeric(varargin{1}) )
23 | error( 'pfs_write_rgb: matrices of the equal size expected as an arguments' );
24 | end
25 | [X Y Z] = pfs_transform_colorspace( 'RGB', varargin{1}, varargin{2}, varargin{3}, 'XYZ' );
26 | elseif( nargin == 2 && ndims(varargin{1}) == 3 )
27 | [X Y Z] = pfs_transform_colorspace( 'RGB', varargin{1}(:,:,1), varargin{1}(:,:,2), varargin{1}(:,:,3), 'XYZ' );
28 | else
29 | error( 'pfs_write_rgb: improper usage' );
30 | end
31 |
32 | %cmd = sprintf( '%spfsout %s%s', pfs_shell(), fileName, pfs_shell(1) )
33 | fid = pfspopen( sprintf( '%spfsout ''%s''%s', pfs_shell(), fileName, pfs_shell(1) ), 'w' );
34 | pfs = pfsopen( fid, size( X ) );
35 |
36 | pfs.channels.X = X;
37 | pfs.channels.Y = Y;
38 | pfs.channels.Z = Z;
39 |
40 | pfsput( pfs );
41 | pfsclose( pfs );
42 | pfspclose( fid );
43 |
44 | end
45 |
--------------------------------------------------------------------------------
/src/pfs/CMakeLists.txt:
--------------------------------------------------------------------------------
1 |
2 | include_directories ("${PROJECT_BINARY_DIR}/")
3 | if( NOT HAS_GETOPT )
4 | include_directories ("${GETOPT_INCLUDE}")
5 | endif( NOT HAS_GETOPT )
6 | add_library(pfs ${LIB_TYPE} colorspace.cpp pfs.cpp pfsutils.cpp array2d.h pfs.h "${GETOPT_OBJECT}")
7 |
8 | # SOVERSION changes only when the library API changes, so it may be
9 | # different from the package version
10 | set_target_properties(pfs PROPERTIES VERSION 2.0.0 SOVERSION 2)
11 |
12 | # TODO: Make it platform dependent - only GCC linux / perhaps Mac
13 | # This is needed when linking with matlab mex files
14 | SET( CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fPIC" )
15 | SET( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC" )
16 |
17 | # Replace a few tags in pfs.pc.in file, create pfs.pc
18 | file(READ ${CMAKE_CURRENT_SOURCE_DIR}/pfs.pc.in file_content)
19 | #message("Input:\n${file_content}")
20 | set (file_content_res)
21 | string(REGEX REPLACE "(@prefix@)" "${CMAKE_INSTALL_PREFIX}" file_content_res "${file_content}")
22 | string(REGEX REPLACE "(@PACKAGE_VERSION@)" "${pfstools_VERSION_MAJOR}.${pfstools_VERSION_MINOR}" file_content_res "${file_content_res}")
23 | #message("Output:\n${file_content_res}")
24 | file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/pfs.pc" "${file_content_res}")
25 |
26 | install (TARGETS pfs
27 | LIBRARY DESTINATION lib${LIB_SUFFIX}
28 | ARCHIVE DESTINATION lib${LIB_SUFFIX})
29 |
30 | #install (FILES ${CMAKE_CURRENT_BINARY_DIR}/cygpfs.dll DESTINATION bin)
31 | install (FILES ${CMAKE_CURRENT_SOURCE_DIR}/pfs.h ${CMAKE_CURRENT_SOURCE_DIR}/array2d.h DESTINATION include/pfs)
32 | install (FILES ${CMAKE_CURRENT_BINARY_DIR}/pfs.pc DESTINATION lib${LIB_SUFFIX}/pkgconfig)
33 |
34 | #install (FILES pfsoutppm.1 DESTINATION ${MAN_DIR})
35 |
36 |
37 |
--------------------------------------------------------------------------------
/src/camera/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | include_directories ("${PROJECT_BINARY_DIR}/"
2 | "${PROJECT_SOURCE_DIR}/src/pfs" "${CMAKE_CURRENT_SOURCE_DIR}")
3 |
4 | link_directories("${PROJECT_SOURCE_DIR}/src/pfs")
5 |
6 | set(TRG pfshdrcalibrate)
7 | add_executable(${TRG} ${TRG}.cpp responses.cpp robertson02.cpp mitsunaga99.cpp mitsunaga99_numerical.cpp nrutil.cpp "${GETOPT_OBJECT}")
8 | target_link_libraries(${TRG} pfs)
9 | install (TARGETS ${TRG} DESTINATION bin)
10 | install (FILES ${TRG}.1 DESTINATION ${MAN_DIR})
11 |
12 | if( OpenCV_FOUND AND EXIF_FOUND )
13 |
14 | set(TRG pfsalign)
15 | add_executable(${TRG} ${TRG}.cpp "${GETOPT_OBJECT}")
16 | target_link_libraries(${TRG} pfs ${OpenCV_LIBS}
17 | ${EXIF_LIBRARIES})
18 | include_directories( ${EXIF_INCLUDE_DIRS} )
19 | install (TARGETS ${TRG} DESTINATION bin)
20 | install (FILES ${TRG}.1 DESTINATION ${MAN_DIR})
21 |
22 | endif( OpenCV_FOUND AND EXIF_FOUND )
23 |
24 |
25 | # Shell scripts
26 | set(SCRIPTS dcraw2hdrgen jpeg2hdrgen pfsinme pfsplotresponse pfsinhdrgen)
27 |
28 | foreach(SCRIPT ${SCRIPTS})
29 |
30 | # Replace the tag with the path to bash
31 | file(READ ${CMAKE_CURRENT_SOURCE_DIR}/${SCRIPT}.in file_content)
32 | string(REGEX REPLACE "@BASH_PATH@" "${BASH_EXECUTABLE}" file_content "${file_content}")
33 | string(REGEX REPLACE "@PERL_PATH@" "${PERL_EXECUTABLE}" file_content "${file_content}")
34 | file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/${SCRIPT}" "${file_content}")
35 |
36 | install (FILES "${CMAKE_CURRENT_BINARY_DIR}/${SCRIPT}"
37 | PERMISSIONS OWNER_EXECUTE GROUP_EXECUTE WORLD_EXECUTE OWNER_WRITE WORLD_READ GROUP_READ OWNER_READ
38 | DESTINATION bin)
39 |
40 | install (FILES ${SCRIPT}.1 DESTINATION ${MAN_DIR})
41 |
42 | endforeach(SCRIPT)
43 |
44 |
45 |
46 |
--------------------------------------------------------------------------------
/src/fileformat/pfsout.1:
--------------------------------------------------------------------------------
1 | .TH "pfsout" 1
2 | .SH NAME
3 | pfsout \- Read pfs frames from stdin and write them in the format determined by
4 | the extension of the file name
5 | .SH SYNOPSIS
6 | .B pfsout
7 | pfsout [...]
8 | .SH DESCRIPTION
9 | This command can be used to write pfs frames piped to standard input
10 | in one of the several recognized formats. The proper format is
11 | determined by the extension of the give file name. To get a list of
12 | recognized formats and extensions, execute:
13 |
14 | pfsin --help
15 |
16 | This command is a front-end for pfsout* programs for writing images:
17 | pfsoutrgbe, pfsoutexr, etc. Based on the file extension, appropriate
18 | program is executed. If two different file format are given as
19 | parameters, two different program for writing images are
20 | executed. Additional options starting with dash '-' can be passed to
21 | pfsout* programs. The following rules apply for passing the options:
22 | the options given before any image file name (or %d pattern) are
23 | passed to all pfsout* programs. Options given after image file name
24 | are only passed to the program executed for that file(s). Note also that
25 | all option that take an argument (except \fB--frames\fR) must given in
26 | the form \fI--option=value\fR, that is without a space between an
27 | option and its argument.
28 |
29 | .SH EXAMPLES
30 | .TP
31 | pfsin memorial.tiff | pfsout memorial.hdr
32 |
33 | Converts from one HDR format to another
34 | .SH "SEE ALSO"
35 | .BR pfsin (1)
36 | .SH BUGS
37 | This command currently does not handle multiple frames given with a
38 | \%%d pattern in case of LDR formats: JPEG, PNG, PNM.
39 |
40 | Please report bugs and comments on implementation to
41 | the discussion group http://groups.google.com/group/pfstools
42 |
--------------------------------------------------------------------------------
/src/fileformat/pfsindcraw.1:
--------------------------------------------------------------------------------
1 | .TH "pfsindcraw" 1
2 | .SH NAME
3 | pfsindcraw \- Read an image in a camera RAW file format supported by
4 | DCRAW and write pfs stream to the standard output
5 | .SH SYNOPSIS
6 | .B pfsindcraw
7 | [--\fBnative\fR] [...]
8 | .SH DESCRIPTION
9 | This command can be used to read images in a camera RAW file format
10 | supported by DCRAW and write pfs stream to the standard output as if
11 | read from 16bit ppm file (no gamma correction, white balance from
12 | camera if available). In principle such data should conform to the
13 | definition of High Dynamic Range contents used in the pfstools
14 | package.
15 | .PP
16 | A raw image may in some cases require clamping to remove zero values,
17 | see examples.
18 | .SH OPTIONS
19 | .TP
20 | --\fBnative\fR, -\fBn\fR
21 | Read images in native camera color space (instead of sRGB).
22 | To be used with pfscolortransform. Must be specified before any file name.
23 | .SH EXAMPLES
24 | .TP
25 | pfsindcraw img_0070.cr2 | pfsview
26 | View a full dynamic range of a raw image from Canon 350D camera.
27 | .TP
28 | pfsindcraw img_0070.cr2 | pfsclamp --rgb | pfstmo_drago03 | pfsout img.jpg
29 | Tone map a raw image and save it as JPEG. Clamping is used to remove
30 | zero values, which otherwise result in NaN values after tone mapping.
31 | .TP
32 | pfsindcraw --native img_0070.cr2 | pfscolortransform --rgbxyz canon500d.txt | pfsout img.exr
33 | Load a RAW image in its native camera color space, calibrate using matrix stored in canon500d.txt
34 | file (not supplied) and save as an EXR image.
35 | .SH "SEE ALSO"
36 | .BR pfsout (1)
37 | .BR pfsinppm (1)
38 | .BR pfscolortransform (1)
39 | .SH BUGS
40 | Please report bugs and comments to the pfstools discussion group
41 | (http://groups.google.com/group/pfstools).
42 |
--------------------------------------------------------------------------------
/src/camera/pfsplotresponse.in:
--------------------------------------------------------------------------------
1 | #!@BASH_PATH@
2 | #
3 | # This file is a part of PFS CALIBRATION package.
4 | # ----------------------------------------------------------------------
5 | #
6 | # This program is free software; you can redistribute it and/or modify
7 | # it under the terms of the GNU General Public License as published by
8 | # the Free Software Foundation; either version 2 of the License, or
9 | # (at your option) any later version.
10 | #
11 | # This program is distributed in the hope that it will be useful,
12 | # but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | # GNU General Public License for more details.
15 | #
16 | # You should have received a copy of the GNU General Public License
17 | # along with this program; if not, write to the Free Software
18 | # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 | # ----------------------------------------------------------------------
20 | #
21 | # @author Rafal Mantiuk,
22 | #
23 | # $Id: pfsplotresponse,v 1.1 2011/03/04 10:00:59 rafm Exp $
24 |
25 | if test -z $1 || test "$1" = "--help"; then
26 | cat < [ ...]
30 |
31 | See the man page for more information.
32 | EOF
33 | exit 1
34 | fi
35 |
36 | if ! which gnuplot >/dev/null; then
37 | cat <
9 |
10 | .SH DESCRIPTION
11 | This program reads files defined in given hdrgen script and outputs
12 | them in a PFS stream. Each frame has a tag BV with corresponding
13 | brightness value (APEX standard). Larger BV corresponds to less
14 | exposure (darker image), necessary to capture a bright scene.
15 |
16 | The generated PFS stream is to be used with photo-metric calibration
17 | software and with generators of HDR images.
18 |
19 | HDRGEN script file is a plain text file in which each line contains:
20 | 0
21 |
22 | In most cases it is convenient to use the jpeg2hdrgen program to
23 | create such a file automatically. In case it could not parse the exif
24 | information from jpeg files, it is necessary to create this file by
25 | hand. Below are the sample contents of such file:
26 |
27 | <--- cut here: sample.hdrgen
28 | /var/tmp/images/img08.jpg 4 2.8 100 0
29 | /var/tmp/images/img09.jpg 58.8235 2.8 100 0
30 | /var/tmp/images/img10.jpg 76.9231 2.8 100 0
31 | /var/tmp/images/img11.jpg 322.581 2.8 100 0
32 | /var/tmp/images/img12.jpg 400 2.8 100 0
33 | <--- cut here: sample.hdrgen
34 |
35 |
36 | .SH EXAMPLES
37 | .TP
38 | pfsinhdrgen sample.hdrgen | pfsview
39 |
40 | View exposures defined in sample.hdrgen script.
41 |
42 | .SH "SEE ALSO"
43 | .BR jpeg2hdrgen (1)
44 | .BR pfshdrcalibrate (1)
45 | .BR pfsinme (1)
46 | .SH BUGS
47 | The command cannot handle files with a space in the name.
48 | .PP
49 | Please report bugs and comments on implementation to
50 | Grzegorz Krawczyk .
51 |
--------------------------------------------------------------------------------
/src/fileformat/pfsinmulti.1:
--------------------------------------------------------------------------------
1 | .TH "pfsinmulti" 1
2 | .SH NAME
3 | pfsinmulti \- read several streams of frames and write pfs streams to
4 | named pipes
5 | .SH SYNOPSIS
6 | .B pfsinmulti
7 | pfsinmulti [--frames f:s:t] [--skip-frames] [...] -- command @1 @2 [@3 ...]
8 | .SH DESCRIPTION
9 | Use this command to read several animation sequences and write them to
10 | pfsstreams. This command is useful with those pfs programs, which take
11 | several pfs streams as arguments. For example, the following command
12 | can be used to combine two animations so that there are stitched
13 | together:
14 |
15 | pfsinmulti anim_a-%04d.hdr anim_b-%04d.hdr -- pfscat @1 @2
16 |
17 | arguments @1 and @2 are replaced with named pipes for anim_a-%04d.hdr
18 | and anim_b-%04d.hdr frames respectively. \fIcommand\fR argument is
19 | obligatory and it must be preceded with '--'. There should be as many
20 | @1, @2, .., @n arguments as there are animation sequences given as
21 | input.
22 |
23 | Arguments \fB--frames\fR, \fB--skip-frames\fR and other options are
24 | handled the same way as in \fIpfsin\fR program. Also pfsinmulti
25 | recognizes the same file formats as pfsin.
26 |
27 | Technically, pfsinmulti creates a named pipe for each pfsstream,
28 | replaces @n arguments with the names of those pipes and deletes
29 | the pipes when \fIcommand\fR finishes.
30 |
31 | .SH EXAMPLES
32 | .TP
33 | pfsinmulti image1.hdr image2.hdr -- cat @1 @2 | pfsview
34 |
35 | Does the same as 'pfsv image1.hdr image2.hdr' but in much more
36 | sophisticated way.
37 |
38 | .SH "SEE ALSO"
39 | .BR pfsin (1)
40 | .SH BUGS
41 | This command currently does not handle multiple frames given with a
42 | \%%d pattern in case of LDR formats: JPEG, PNG, PNM.
43 |
44 | Please report bugs and comments to Rafal Mantiuk
45 | .
46 |
--------------------------------------------------------------------------------
/src/pfsglview/histogram.h:
--------------------------------------------------------------------------------
1 | #ifndef HISTOGRAM_H
2 | #define HISTOGRAM_H
3 |
4 | #include "rmglwin.h"
5 |
6 | enum SelectedBar
7 | {
8 | NONE,
9 | LEFT_BAR,
10 | RIGHT_BAR,
11 | WHOLE_SLIDER
12 | };
13 |
14 | class Histogram : public RMGLWin {
15 |
16 | private:
17 | int xPos, yPos;
18 | int width, height;
19 | int* frequencyValues;
20 | GLfloat* backgroundColor;
21 | float frequencyMax;
22 | float sliderPosMin, sliderPosMax; // luminance volues for start and end of slider
23 | float lumMin, lumMax;
24 | float logLumMin, logLumMax;
25 |
26 | SelectedBar selectionState;
27 |
28 | private:
29 | void drawBackground();
30 | void drawScale();
31 | void drawStatistic();
32 | void drawSlider();
33 |
34 | public:
35 | Histogram( int xPos, int yPos, int width, int height);
36 | ~Histogram();
37 |
38 | void computeFrequency(const pfs::Array2D *image);
39 | void drawHistogram();
40 | float getHighFrequency() const;
41 | float getMaxFrequency() const;
42 |
43 | int getWidth( void);
44 | int getHeight( void);
45 | int getBackgroundWidth(void);
46 | int getBackgroundHeight(void);
47 | float getLumMin();
48 | float getLumMax();
49 |
50 | float pos2lum( float pos);
51 | float lum2pos( float lum);
52 | void computeLumRange( float& min, float& max);
53 |
54 | void processSliderSelection(int xCoord, int yCoord);
55 | int setSliderSelectionState(SelectedBar newState);
56 | SelectedBar getSliderSelectionState();
57 | void setSliderPosMin( float pos);
58 | float getSliderPosMin(void);
59 | void setSliderPosMax( float pos);
60 | float getSliderPosMax(void);
61 | void setSliderPosMinMax( float min, float max);
62 | void resetFrequencyMax(void);
63 |
64 | void redraw(void);
65 |
66 | };
67 |
68 |
69 |
70 |
71 | #endif
72 |
73 |
74 |
75 |
76 |
77 |
--------------------------------------------------------------------------------
/src/filter/pfsretime.1:
--------------------------------------------------------------------------------
1 | .TH "pfsretime" 1
2 | .SH NAME
3 | pfsretime \- Retime an animation stream from one frame-rate to another
4 | .SH SYNOPSIS
5 | .B pfsretime
6 | [--\fBin-fps\fR | --\fBout-fps\fR ] [--\fBspeedup\fR ]
7 | .SH DESCRIPTION
8 | Changes the frame-rate of the animation stream from the input-frame rate
9 | to the output frame-rate. Currently this is done by skipping or
10 | replicating frames. The command can be useful for creating time-lapse
11 | animations with temporal tone-mapping operators.
12 | .SH OPTIONS
13 | .TP
14 | --\fBin-fps\fR , -\fBi\fR
15 | The frame-rate of the input animation stream in frames per
16 | second. Fractional numbers are supported. By default, the FPS tag
17 | in the stream is used. If the tag cannot be found, 30 frames per
18 | second is assumed.
19 | .TP
20 | --\fBout-fps\fR , -\fBo\fR
21 | The frame-rate of the output animation stream in frames per
22 | second. Fractional numbers are supported. The default value is 30 frames per
23 | second.
24 | .TP
25 | --\fBspeedup\fR , -\fBs\fR
26 | How much faster (factor > 1) or slower (factor < 1) the output
27 | animation should run as compared with the input animation. The output
28 | frame-rate is kept the same as the input frame-rate.
29 | .SH EXAMPLES
30 | .TP
31 | pfsin frame%04d.hdr | pfsretime -v -i 1 -o 30 | pfstmo_mantiuk08 | pfsout res/frame%04d.jpg
32 | .IP
33 | Read the sequence of animation frames at 1 frame per second and
34 | output the sequence at 30 frames per second. This will replicate each
35 | input frame 30 times. The frames are then tone-mapped and stored in
36 | the res folder.
37 | .SH "SEE ALSO"
38 | .BR pfsin (1)
39 | .BR pfsout (1)
40 | .BR pfstmo_mantiuk08 (1)
41 | .SH BUGS
42 | Please report bugs and comments to the pfstools discussion group
43 | (http://groups.google.com/group/pfstools).
44 |
--------------------------------------------------------------------------------
/src/matlab/pfsview_rgb.m:
--------------------------------------------------------------------------------
1 | function pfsview_rgb( varargin )
2 | % Shows high-dynamic range RGB image using pfsview
3 | %
4 | % Usage: pfsview( R, G, B )
5 | % pfsview( img )
6 | % R, G, B - red, green and blue color channels, given as linear response
7 | % img - 3D matrix image, where img(:,:,1:3) represents red, blue and green
8 | % color channels
9 |
10 | if( nargin == 3 )
11 | if( ~isnumeric(varargin{1}) || ~isnumeric(varargin{2}) || ~isnumeric(varargin{1}) )
12 | error( 'pfsview_rgb: matrices of the equal size expected as an arguments' );
13 | end
14 | [X Y Z] = pfs_transform_colorspace( 'RGB', varargin{1}, varargin{2}, varargin{3}, 'XYZ' );
15 | [height width] = size( varargin{1} );
16 | elseif( nargin == 1 && ndims(varargin{1}) == 3 )
17 | [X Y Z] = pfs_transform_colorspace( 'RGB', varargin{1}(:,:,1), varargin{1}(:,:,2), varargin{1}(:,:,3), 'XYZ' );
18 | [height width] = size( varargin{1}(:,:,1) );
19 | else
20 | error( 'pfsview_rgb: improper usage' );
21 | end
22 |
23 |
24 | if( exist( 'window_min', 'var' ) == 1 && exist( 'window_max', 'var' ) == 1 )
25 | minmax_window = sprintf( '--window_min %g --window_max %g ', window_min, window_max );
26 | else
27 | minmax_window = '';
28 | end
29 |
30 | % tmp file is used rather than pipes to run pfsview in background without
31 | % blocking matlab
32 | tmp_file = tempname();
33 | % hv_fid = pfspopen( sprintf( '%spfsview %s%s', pfs_shell(), minmax_window, pfs_shell(1) ), 'w' );
34 | pfsout = pfsopen( tmp_file, height, width );
35 | pfsout.channels.X = X;
36 | pfsout.channels.Y = Y;
37 | pfsout.channels.Z = Z;
38 | pfsout.tags.FILE_NAME = 'matlab';
39 | pfsput( pfsout );
40 | pfsclose( pfsout );
41 |
42 | system( sprintf( '%s(pfsview <''%s'' && rm -f %s) &%s', pfs_shell(), tmp_file, tmp_file, pfs_shell( 1 ) ) );
43 |
44 | end
45 |
--------------------------------------------------------------------------------
/src/tmo/mantiuk08/cqp/initial_point.h:
--------------------------------------------------------------------------------
1 | /**
2 | * @brief Convex Quadratic Programming library
3 | *
4 | * From:
5 | * http://ra.uni-trier.de/~huebner/software.html
6 | *
7 | * ----------------------------------------------------------------------
8 | * This program is free software; you can redistribute it and/or modify
9 | * it under the terms of the GNU General Public License as published by
10 | * the Free Software Foundation; either version 2 of the License, or
11 | * (at your option) any later version.
12 | *
13 | * This program is distributed in the hope that it will be useful,
14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 | * GNU General Public License for more details.
17 | *
18 | * You should have received a copy of the GNU General Public License
19 | * along with this program; if not, write to the Free Software
20 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21 | * ----------------------------------------------------------------------
22 | *
23 | * @author Ewgenij Hübner
24 | *
25 | * $$
26 | */
27 |
28 | #ifdef __cplusplus
29 | # define __BEGIN_DECLS extern "C" {
30 | # define __END_DECLS }
31 | #else
32 | # define __BEGIN_DECLS /* empty */
33 | # define __END_DECLS /* empty */
34 | #endif
35 |
36 | __BEGIN_DECLS
37 |
38 | int pdip_initial_point_feasible_x(const gsl_matrix * A, const gsl_vector *b, gsl_vector *x);
39 |
40 | int pdip_initial_point_feasible_s(const gsl_matrix * C, const gsl_vector *d, const gsl_vector *x, gsl_vector *s);
41 |
42 | int pdip_initial_point_y(const gsl_matrix *Q, const gsl_vector *q, const gsl_matrix *A, const gsl_vector *x, gsl_vector *y);
43 |
44 | int pdip_initial_point_z(gsl_vector *z);
45 |
46 | int pdip_initial_point_strict_feasible(gsl_vector *x, gsl_vector *s);
47 |
48 | __END_DECLS
49 |
--------------------------------------------------------------------------------
/src/matlab/pfs_read_rgb.m:
--------------------------------------------------------------------------------
1 | function [varargout] = pfs_read_rgb( fileName )
2 | %PFS_READ_RGB Read image file and return R, G, and B color channels or a single 3D matrix.
3 | %
4 | % [R G B] = PFS_READ_RGB( file_name )
5 | % IMG = PFS_READ_RGB( file_name)
6 | %
7 | % R, G, B - red, green and blue color channels, given as linear response
8 | % img - 3D matrix image, where img(:,:,1:3) represents red, blue and green
9 | % color channels
10 | %
11 | % PFS_READ_RGB accepts all formats recognized by the shell "pfsin"
12 | % command.
13 | %
14 | % See also: PFS_READ_IMAGE, PFS_READ_LUMINANCE, PFS_READ_XYZ, PFS_WRITE_IMAGE.
15 | %
16 | % Copyright 2009 Rafal Mantiuk
17 |
18 | %Check if file exists
19 | fid = fopen( fileName, 'rb' );
20 | if( fid == -1 )
21 | error( 'pfs_read_rgb: File "%s" does not exist', fileName );
22 | end
23 | fclose( fid );
24 |
25 | fid = pfspopen( sprintf( '%spfsin ''%s''%s', pfs_shell(), fileName, pfs_shell( 1 ) ), 'r' );
26 | pin = pfsopen( fid );
27 | pin = pfsget( pin );
28 |
29 | if( isfield( pin.channels, 'X' ) && isfield( pin.channels, 'Z' ) )
30 | [R G B] = pfs_transform_colorspace( 'XYZ', pin.channels.X, pin.channels.Y, pin.channels.Z, 'RGB' );
31 | elseif( isfield( pin.channels, 'Y' ) )
32 | R = pin.channels.Y;
33 | G = pin.channels.Y;
34 | B = pin.channels.Y;
35 | else
36 | error( 'Color channels missing in the pfs frame' );
37 | end
38 |
39 | if( nargout == 3 )
40 | varargout{1} = R;
41 | varargout{2} = G;
42 | varargout{3} = B;
43 | elseif( nargout == 1 )
44 | varargout{1}(:,:,1) = R;
45 | varargout{1}(:,:,2) = G;
46 | varargout{1}(:,:,3) = B;
47 | else
48 | error( 'pfs_read_rgb: wrong number of output arguments' );
49 | end
50 |
51 | pfsclose( pin );
52 | % TODO: Check why crashes on windows
53 | if ~ispc()
54 | pfspclose( fid );
55 | end
56 | end
57 |
--------------------------------------------------------------------------------
/src/pfsview/histogram.h:
--------------------------------------------------------------------------------
1 | #ifndef HISTOGRAM_H
2 | #define HISTOGRAM_H
3 | /**
4 | * @brief
5 | *
6 | * This file is a part of PFSTOOLS package.
7 | * ----------------------------------------------------------------------
8 | * Copyright (C) 2003,2004 Rafal Mantiuk and Grzegorz Krawczyk
9 | *
10 | * This program is free software; you can redistribute it and/or modify
11 | * it under the terms of the GNU General Public License as published by
12 | * the Free Software Foundation; either version 2 of the License, or
13 | * (at your option) any later version.
14 | *
15 | * This program is distributed in the hope that it will be useful,
16 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 | * GNU General Public License for more details.
19 | *
20 | * You should have received a copy of the GNU General Public License
21 | * along with this program; if not, write to the Free Software
22 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
23 | * ----------------------------------------------------------------------
24 | *
25 | * @author Rafal Mantiuk,
26 | *
27 | * $Id: histogram.h,v 1.2 2005/09/02 13:10:35 rafm Exp $
28 | */
29 |
30 | #include
31 |
32 | class Histogram
33 | {
34 | float *P;
35 | int bins;
36 | int accuracy;
37 |
38 | public:
39 | Histogram( int bins, int accuracy = 1 );
40 | ~Histogram();
41 |
42 | void computeLog( const pfs::Array2D *image );
43 | void computeLog( const pfs::Array2D *image, float min, float max );
44 |
45 | int getBins() const
46 | {
47 | return bins;
48 | }
49 |
50 | float getMaxP() const;
51 | float getP( int bin ) const
52 | {
53 | assert( bin < bins );
54 | return P[bin];
55 | }
56 |
57 |
58 |
59 | };
60 |
61 |
62 |
63 | #endif
64 |
--------------------------------------------------------------------------------
/src/tmo/durand02/fastbilateral.h:
--------------------------------------------------------------------------------
1 | /**
2 | * @file fastbilateral.h
3 | * @brief Fast bilateral filtering
4 | *
5 | *
6 | * This file is a part of PFSTMO package.
7 | * ----------------------------------------------------------------------
8 | * Copyright (C) 2003,2004 Grzegorz Krawczyk
9 | *
10 | * This program is free software; you can redistribute it and/or modify
11 | * it under the terms of the GNU General Public License as published by
12 | * the Free Software Foundation; either version 2 of the License, or
13 | * (at your option) any later version.
14 | *
15 | * This program is distributed in the hope that it will be useful,
16 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 | * GNU General Public License for more details.
19 | *
20 | * You should have received a copy of the GNU General Public License
21 | * along with this program; if not, write to the Free Software
22 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
23 | * ----------------------------------------------------------------------
24 | *
25 | * @author Grzegorz Krawczyk,
26 | *
27 | * $Id: fastbilateral.h,v 1.3 2008/09/09 00:56:49 rafm Exp $
28 | */
29 |
30 |
31 | #ifndef _fastbilateral_h_
32 | #define _fastbilateral_h_
33 |
34 | #include
35 |
36 | /**
37 | * @brief Fast bilateral filtering
38 | *
39 | * Pieceweise linear algorithm (fast).
40 | *
41 | * @param I [in] input array
42 | * @param J [out] filtered array
43 | * @param sigma_s sigma value for spatial kernel
44 | * @param sigma_r sigma value for range kernel
45 | */
46 | void fastBilateralFilter( const pfstmo::Array2D *I,
47 | pfstmo::Array2D *J, float sigma_s, float sigma_r, int downsample,
48 | pfstmo_progress_callback progress_cb );
49 |
50 |
51 | #endif /* #ifndef _fastbilateral_h_ */
52 |
--------------------------------------------------------------------------------
/src/fileformat/pfsindcraw.in:
--------------------------------------------------------------------------------
1 | #!@BASH_PATH@
2 | ############################################################
3 | # Wrapper for dcraw.
4 | # Convert digital camera RAW files to 16bit PPMs.
5 | #
6 | # this is a stub with basic functionality
7 | ############################################################
8 |
9 | if test -z "$1" || test "$1" = "--help" || test "$1" = "-h"; then
10 | cat < [...]
18 |
19 | See the man page for more information.
20 |
21 | EOF
22 | exit 1
23 | fi
24 |
25 |
26 | if ! which dcraw 2>/dev/null 1>/dev/null; then
27 | echo >&2 "pfsindcraw: dcraw program not found. Check if it is installed and can be found in the PATH."
28 | exit 1;
29 | fi
30 |
31 | if ! which pfsinppm 2>/dev/null 1>/dev/null; then
32 | echo >&2 "pfsindcraw: pfsinppm program not found. Check if pfstools are compiled with netpbm support."
33 | exit 1;
34 | fi
35 |
36 | COLORSPACE=1
37 | #Arguments used for all images passed to pfsindcraw
38 | global_arguments=""
39 | if test -n "$1"; then
40 | while test "${1:0:1}" = "-"; do
41 |
42 | case "$1" in
43 | "--native" | "-n")
44 | # Use native (RAW) color space
45 | COLORSPACE=0
46 | ;;
47 | *)
48 | echo >&2 "Unrecognized option '$1'."
49 | exit 1;
50 | esac
51 | global_arguments="$global_arguments $1"
52 | shift
53 | done
54 | fi
55 |
56 | while test "$1"; do
57 |
58 | file_pattern="$1"
59 |
60 | dcraw -c -o $COLORSPACE -4 -w "$file_pattern" | pfsinppm - 2> /dev/null | \
61 | pfstag --set "FILE_NAME=${file_pattern}" --set "LUMINANCE=RELATIVE"
62 |
63 | shift
64 | done
65 |
--------------------------------------------------------------------------------
/src/tmo/durand02/bilateral.h:
--------------------------------------------------------------------------------
1 | /**
2 | * @file bilateral.h
3 | * @brief Bilateral filtering
4 | *
5 | *
6 | * This file is a part of PFSTMO package.
7 | * ----------------------------------------------------------------------
8 | * Copyright (C) 2003,2004 Grzegorz Krawczyk
9 | *
10 | * This program is free software; you can redistribute it and/or modify
11 | * it under the terms of the GNU General Public License as published by
12 | * the Free Software Foundation; either version 2 of the License, or
13 | * (at your option) any later version.
14 | *
15 | * This program is distributed in the hope that it will be useful,
16 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 | * GNU General Public License for more details.
19 | *
20 | * You should have received a copy of the GNU General Public License
21 | * along with this program; if not, write to the Free Software
22 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
23 | * ----------------------------------------------------------------------
24 | *
25 | * @author Rafal Mantiuk,
26 | * @author Grzegorz Krawczyk,
27 | *
28 | * $Id: bilateral.h,v 1.3 2008/09/09 00:56:49 rafm Exp $
29 | */
30 |
31 |
32 | #ifndef _bilateral_h_
33 | #define _bilateral_h_
34 |
35 |
36 | /**
37 | * @brief Bilateral filtering
38 | *
39 | * Conventional (slow) algorithm.
40 | *
41 | * @param I [in] input array
42 | * @param J [out] filtered array
43 | * @param sigma_s sigma value for spatial kernel
44 | * @param sigma_r sigma value for range kernel
45 | *
46 | * $Id: bilateral.h,v 1.3 2008/09/09 00:56:49 rafm Exp $
47 | */
48 | void bilateralFilter( const pfstmo::Array2D *I,
49 | pfstmo::Array2D *J, float sigma_s, float sigma_r,
50 | pfstmo_progress_callback progress_cb );
51 |
52 |
53 | #endif /* #ifndef _bilateral_h_ */
54 |
--------------------------------------------------------------------------------
/src/matlab/compatibility.h:
--------------------------------------------------------------------------------
1 | /**
2 | * @brief Compatibility header file
3 | *
4 | * This file is a part of PFSTOOLS package.
5 | * ----------------------------------------------------------------------
6 | * Copyright (C) 2003,2004 Rafal Mantiuk and Grzegorz Krawczyk
7 | *
8 | * This program is free software; you can redistribute it and/or modify
9 | * it under the terms of the GNU General Public License as published by
10 | * the Free Software Foundation; either version 2 of the License, or
11 | * (at your option) any later version.
12 | *
13 | * This program is distributed in the hope that it will be useful,
14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 | * GNU General Public License for more details.
17 | *
18 | * You should have received a copy of the GNU General Public License
19 | * along with this program; if not, write to the Free Software
20 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21 | * ----------------------------------------------------------------------
22 | *
23 | * @author Grzegorz Krawczyk,
24 | *
25 | * $Id: compatibility.h,v 1.1 2007/03/01 14:10:57 rdmantiuk Exp $
26 | */
27 |
28 | #ifndef COMPATIBILITY_H
29 | #define COMPATIBILITY_H
30 |
31 | #ifdef _MSC_VER
32 |
33 | #include
34 |
35 | #define popen _popen
36 | #define dup _dup
37 | //#define fileno _fileno
38 | #define fdopen _fdopen
39 | #define open _open
40 | #define pclose _pclose
41 |
42 | #define O_CREAT _O_CREAT
43 | #define O_TRUNC _O_TRUNC
44 | #define O_RDWR _O_RDWR
45 | #define S_IREAD _S_IREAD
46 | #define S_IWRITE _S_IWRITE
47 | #define O_BINARY _O_BINARY
48 |
49 | #endif
50 |
51 |
52 | #ifdef __linux__
53 |
54 | #include
55 |
56 | #define O_BINARY 0
57 |
58 | #define stricmp strcasecmp
59 |
60 | #endif
61 |
62 | #define DEBUG_STR if(1); else cerr
63 |
64 | #endif
65 |
--------------------------------------------------------------------------------
/src/octave/octave_util.h:
--------------------------------------------------------------------------------
1 | #ifndef OCTAVE_UTIL_H
2 | #define OCTAVE_UTIL_H
3 |
4 | /**
5 | * @brief Utility functions for interfacing pfs::Array2D with Octave
6 | *
7 | * This file is a part of PFSTOOLS package.
8 | * ----------------------------------------------------------------------
9 | * Copyright (C) 2003,2004 Rafal Mantiuk and Grzegorz Krawczyk
10 | *
11 | * This program is free software; you can redistribute it and/or modify
12 | * it under the terms of the GNU General Public License as published by
13 | * the Free Software Foundation; either version 2 of the License, or
14 | * (at your option) any later version.
15 | *
16 | * This program is distributed in the hope that it will be useful,
17 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 | * GNU General Public License for more details.
20 | *
21 | * You should have received a copy of the GNU General Public License
22 | * along with this program; if not, write to the Free Software
23 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
24 | * ----------------------------------------------------------------------
25 | *
26 | * @author Rafal Mantiuk,
27 | *
28 | * $Id: octave_util.h,v 1.1 2005/06/15 13:36:54 rafm Exp $
29 | */
30 |
31 | #include
32 | #include
33 |
34 | inline void copy( const Matrix &in, pfs::Array2D *out )
35 | {
36 | int index = 0;
37 | for( int r = 0; r < in.rows(); r++ )
38 | for( int c = 0; c < in.cols(); c++ ) {
39 | (*out)(index++) = (float)in(r,c);
40 | }
41 | }
42 |
43 | inline void copy( const pfs::Array2D *in, Matrix &out )
44 | {
45 | int index = 0;
46 | for( int r = 0; r < in->getRows(); r++ )
47 | for( int c = 0; c < in->getCols(); c++ ) {
48 | out(r,c) = (double)(*in)(index++);
49 | }
50 | }
51 |
52 |
53 |
54 | #endif
55 |
56 |
--------------------------------------------------------------------------------
/src/pfsglview/m_on_screen_display.h:
--------------------------------------------------------------------------------
1 | /**
2 | * @brief PFS library - additional utilities
3 | *
4 | * This file is a part of PFSTOOLS package.
5 | * ----------------------------------------------------------------------
6 | * Copyright (C) 2006 Radoslaw Mantiuk
7 | *
8 | * This library is free software; you can redistribute it and/or
9 | * modify it under the terms of the GNU Lesser General Public
10 | * License as published by the Free Software Foundation; either
11 | * version 2.1 of the License, or (at your option) any later version.
12 | *
13 | * This library is distributed in the hope that it will be useful,
14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 | * Lesser General Public License for more details.
17 | *
18 | * You should have received a copy of the GNU Lesser General Public
19 | * License along with this library; if not, write to the Free Software
20 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21 | * ----------------------------------------------------------------------
22 | *
23 | * @author Radoslaw Mantiuk,
24 | * @author Oliver Barth
25 | */
26 |
27 | #ifndef M_ON_SCREEN_DISPLAY_H
28 | #define M_ON_SCREEN_DISPLAY_H
29 |
30 | #include
31 |
32 | #include "module.h"
33 |
34 |
35 | class M_OnScreenDisplay : public Module {
36 |
37 |
38 | private:
39 | float start_y ;
40 | int max_row_length ;
41 | int row_count ;
42 | bool hasBorder ;
43 |
44 | std::string* text ;
45 |
46 |
47 | public:
48 | M_OnScreenDisplay(std::string* s, int row_count);
49 | ~M_OnScreenDisplay();
50 |
51 | void redraw(void);
52 | void println(std::string s) ;
53 | int getDesiredWinHeight() ;
54 | int getDesiredWinWidth() ;
55 |
56 | void setHasBorder(bool has_border) ;
57 | void setBackgroundColor(float _r, float _g, float _b, float _a) ;
58 | };
59 |
60 | #endif
61 |
--------------------------------------------------------------------------------
/src/matlab/pfs_read_image.m:
--------------------------------------------------------------------------------
1 | function img = pfs_read_image( fileName )
2 | %PFS_READ_IMAGE Read image file and return RGB, luminance or multichannel matrix.
3 | %
4 | % IMG = PFS_READ_IMAGE( file_name )
5 | %
6 | % If input is a gray-scale or luminance image, IMG is a 2D matrix. If input is
7 | % a color image, IMG(:,:,k) represents red, blue and green color channels for k=1,2 and 3.
8 | % If input is a multi-channel image (channel names C1, C2, ..., Cn), IMG is a
9 | % 3D matrix with 3rd dimension corresponding to the channels.
10 | %
11 | % PFS_READ_IMAGE accepts all formats recognized by the shell "pfsin"
12 | % command.
13 | %
14 | % Example:
15 | % img = PFS_READ_IMAGE( 'hdr_images/memorial.exr' );
16 | %
17 | % See also: PFS_READ_RGB, PFS_READ_LUMINANCE, PFS_READ_XYZ,
18 | % PFS_WRITE_IMAGE, PFSVIEW.
19 | %
20 | % Copyright 2009 Rafal Mantiuk
21 |
22 | %Check if file exists
23 | fid = fopen( fileName, 'rb' );
24 | if( fid == -1 )
25 | error( 'pfs_read_image: File "%s" does not exist', fileName );
26 | end
27 | fclose( fid );
28 |
29 | fid = pfspopen( sprintf( '%spfsin ''%s''%s', pfs_shell(), fileName, pfs_shell( 1 ) ), 'r' );
30 | pin = pfsopen( fid );
31 | pin = pfsget( pin );
32 |
33 | if( isfield( pin.channels, 'X' ) && isfield( pin.channels, 'Z' ) )
34 | img = pfs_transform_colorspace( 'XYZ', pin.channels.X, pin.channels.Y, pin.channels.Z, 'RGB' );
35 | elseif( isfield( pin.channels, 'Y' ) )
36 | img = pin.channels.Y;
37 | elseif( isfield( pin.channels, 'C1' ) )
38 | ch=1;
39 | % count the number of channels
40 | while( isfield( pin.channels, sprintf( 'C%d', ch ) ) )
41 | ch = ch+1;
42 | end
43 | ch_max = ch-1;
44 | img = zeros(pin.rows, pin.columns, ch_max);
45 | for ch=1:ch_max
46 | img(:,:,ch) = pin.channels.(sprintf( 'C%d', ch ));
47 | end
48 | else
49 | error( 'Color channels missing in the pfs frame' );
50 | end
51 |
52 | pfsclose( pin );
53 | % TODO: Check why crashes on windows
54 | if ~ispc()
55 | pfspclose( fid );
56 | end
57 | end
58 |
--------------------------------------------------------------------------------
/src/matlab/pfs_test_shell.m:
--------------------------------------------------------------------------------
1 | function pfs_test_shell()
2 | %PFS_TEST_SHELL run several test to check for common problems with pfstools
3 | %matlab interface.
4 | %
5 | % PFS_TEST_SHELL()
6 | %
7 | % The function displays test results and instruction what to do if the
8 | % test has failed.
9 | %
10 | % Copyright 2009 Rafal Mantiuk
11 |
12 | tmp_file = tempname;
13 |
14 | cmd = sprintf( '%secho "OK" | cat >''%s''%s', pfs_shell(), tmp_file, pfs_shell( 1 ) );
15 |
16 | display( '===========================' );
17 | display( ['Test 1: executing: ' cmd ] );
18 | system( cmd );
19 | display( ' If the lines below show a single line "OK", eveything is correct.' );
20 | display( ' If the lines are empty, the shell most probably cannot be executed.' );
21 | display( ' In such a case check error messages either in matlab command window' );
22 | display( ' (Windows) or in the shell window from which you have started matlab (unix).' );
23 | display( ' Then edit pfs_shell.m to fix these problems.' );
24 | display( ' If the lines contain besides "OK" additional lines of text, fix shell startup' );
25 | display( ' files (/etc/profile, ~/.bash_profile and others) so that no messages are' );
26 | display( ' displayed when shell is started' );
27 | display( '---- START ----' );
28 | display_file( tmp_file );
29 | display( '---- END ----' );
30 |
31 | cmd = sprintf( '%swhich pfsin%s', pfs_shell(), pfs_shell( 1 ) );
32 |
33 | display( '===========================' );
34 | display( ['Test 2: executing: ' cmd ] );
35 | [status result] = system( cmd );
36 | if( status == 0 )
37 | display( 'Successful.' );
38 | else
39 | display( 'Shell failed to find pfstools in the PATH. Make sure that the PATH' );
40 | display( ' includes directories with pfstools at shell startup.' );
41 | display( 'Error message: ' );
42 | display( result );
43 | end
44 |
45 | end
46 |
47 | function display_file( file_name )
48 |
49 | fid=fopen( file_name );
50 | while 1
51 | tline = fgetl(fid);
52 | if ~ischar(tline), break, end
53 | disp(tline)
54 | end
55 | fclose(fid);
56 |
57 | end
--------------------------------------------------------------------------------
/cmake/FindEXIF.cmake:
--------------------------------------------------------------------------------
1 | # - Try to find EXIF
2 | # Once done this will define
3 | #
4 | # EXIF_FOUND - system has EXIF
5 | # EXIF_INCLUDE_DIRS - the EXIF include directory
6 | # EXIF_LIBRARIES - Link these to use EXIF
7 | # EXIF_DEFINITIONS - Compiler switches required for using EXIF
8 | #
9 | # Copyright (c) 2006 Andreas Schneider
10 | #
11 | # Redistribution and use is allowed according to the terms of the New
12 | # BSD license.
13 | # For details see the accompanying COPYING-CMAKE-SCRIPTS file.
14 | #
15 |
16 |
17 | if (EXIF_LIBRARIES AND EXIF_INCLUDE_DIRS)
18 | # in cache already
19 | set(EXIF_FOUND TRUE)
20 | else (EXIF_LIBRARIES AND EXIF_INCLUDE_DIRS)
21 | find_path(EXIF_INCLUDE_DIRS
22 | NAMES
23 | exif-data.h
24 | PATHS
25 | /usr/include
26 | /usr/local/include
27 | /opt/local/include
28 | /sw/include
29 | /usr/include/libexif
30 | /usr/local/include/libexif
31 | /opt/local/include/libexif
32 | /sw/include/libexif
33 | )
34 |
35 | # debian uses version suffixes
36 | # add suffix evey new release
37 | find_library(EXIF_LIBRARIES
38 | NAMES
39 | exif
40 | PATHS
41 | /usr/lib
42 | /usr/local/lib
43 | /opt/local/lib
44 | /sw/lib
45 | )
46 |
47 | if (EXIF_INCLUDE_DIRS AND EXIF_LIBRARIES)
48 | set(EXIF_FOUND TRUE)
49 | endif (EXIF_INCLUDE_DIRS AND EXIF_LIBRARIES)
50 |
51 | if (EXIF_FOUND)
52 | if (NOT EXIF_FIND_QUIETLY)
53 | message(STATUS "Found EXIF: ${EXIF_LIBRARIES}")
54 | endif (NOT EXIF_FIND_QUIETLY)
55 | else (EXIF_FOUND)
56 | if (EXIF_FIND_REQUIRED)
57 | message(FATAL_ERROR "Could not find EXIF")
58 | endif (EXIF_FIND_REQUIRED)
59 | endif (EXIF_FOUND)
60 |
61 | # show the EXIF_INCLUDE_DIRS and EXIF_LIBRARIES variables only in the advanced view
62 | mark_as_advanced(EXIF_INCLUDE_DIRS EXIF_LIBRARIES)
63 |
64 | endif (EXIF_LIBRARIES AND EXIF_INCLUDE_DIRS)
65 |
66 | if (WIN32)
67 | set(EXIF_FOUND TRUE)
68 | set(EXIF_LIBRARIES "")
69 | set(EXIF_INCLUDE_DIRS "")
70 | endif (WIN32)
71 |
72 |
--------------------------------------------------------------------------------
/src/filter/pfscolortransform.1:
--------------------------------------------------------------------------------
1 | .TH "pfscolortransform" 1
2 | .SH NAME
3 | pfscolortransform \- Apply color calibration using user provided matrix file.
4 | .SH SYNOPSIS
5 | .B pfscolortransform
6 | (--\fBxyzrgb\fR matrix-file | --\fBrgbxyz\fR matrix-file) [--\fBtranspose]
7 | .SH DESCRIPTION
8 | Use this command to calibrate colours using a calibration matrix supplied in a text file.
9 | The command is intended for linearized (not gamma corrected) color spaces.
10 | The matrix should be 3x3 and it should transform from CIE XYZ to ITU rec. 709 RGB (sRGB primaries but linear, no gamma)
11 | or from the same RGB to CIE XYZ (see options below). The text file should contain three rows with numbers separated by a comma,
12 | for example:
13 | .PP
14 | .PD 0
15 | .IP
16 | 0.0292,0.0126,0.0009
17 | .IP
18 | 0.0052,0.0340,-0.0049
19 | .IP
20 | 0.0055,-0.0059,0.0409
21 | .PD
22 | .PP
23 | If the --\fBxyzrgb\fR is supplied, the pixel values are color-transformed as follows:
24 | .IP
25 | [RGB]' = M * [XYZ]
26 | .PP
27 | where ' is matrix transposition, * is matrix multiplication, RGB is a vector of RGB values
28 | and XYZ is the vector of CIE XYZ trichromatic values. If the --\fBrgbxyz\fR is supplied,
29 | the pixel values are color-transformed as follows:
30 | .IP
31 | [XYZ]' = M * [RGB]
32 | .SH OPTIONS
33 | .TP
34 | --\fBxyzrgb\fR matrix-file, -\fBx\fR matrix-file
35 | User provided matrix is a conversion matrix to convert from XYZ to RGB color space.
36 | .TP
37 | --\fBrgbxyz\fR matrix-file, -\fBr\fR matrix-file
38 | User provided matrix is a conversion matrix to convert from RGB to XYZ color space.
39 | .TP
40 | --\fBtranspose, -\fBt
41 | Take transpose of provided matrix file.
42 | .SH EXAMPLES
43 | .TP
44 | pfsin memorial.hdr | pfscolortransform -x matrix.txt | pfsout memorial_gc.ppm
45 | .IP
46 | Color calibrate memorial image with matrix in matrix.txt file and save to memorial_gc.ppm.
47 | .SH "SEE ALSO"
48 | .BR pfsin (1)
49 | .BR pfsout (1)
50 | .BR pfsdisplayfunction (1)
51 | .SH BUGS
52 | Please report bugs and comments to the pfstools discussion group
53 | (http://groups.google.com/group/pfstools).
54 |
--------------------------------------------------------------------------------
/src/fileformat/exrio.h:
--------------------------------------------------------------------------------
1 | /**
2 | * @brief IO operations on OpenEXR file format
3 | *
4 | * This file is a part of PFSTOOLS package.
5 | * ----------------------------------------------------------------------
6 | * Copyright (C) 2003,2004 Rafal Mantiuk and Grzegorz Krawczyk
7 | *
8 | * This program is free software; you can redistribute it and/or modify
9 | * it under the terms of the GNU General Public License as published by
10 | * the Free Software Foundation; either version 2 of the License, or
11 | * (at your option) any later version.
12 | *
13 | * This program is distributed in the hope that it will be useful,
14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 | * GNU General Public License for more details.
17 | *
18 | * You should have received a copy of the GNU General Public License
19 | * along with this program; if not, write to the Free Software
20 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21 | * ----------------------------------------------------------------------
22 | *
23 | * @author Grzegorz Krawczyk,
24 | *
25 | * $Id: exrio.h,v 1.1 2005/06/15 13:36:54 rafm Exp $
26 | */
27 |
28 | #ifndef _EXR_IO_H_
29 | #define _EXR_IO_H_
30 |
31 | #include
32 | #include
33 |
34 |
35 | class OpenEXRReader
36 | {
37 | Imf::RgbaInputFile* file; /// OpenEXR file object
38 | Imath::Box2i dw; /// data window
39 |
40 | int width, height;
41 |
42 | public:
43 | OpenEXRReader( const char* filename );
44 | ~OpenEXRReader();
45 |
46 | int getWidth() const
47 | {
48 | return width;
49 | }
50 |
51 | int getHeight() const
52 | {
53 | return height;
54 | }
55 |
56 | void readImage( pfs::Array2D *R, pfs::Array2D *G, pfs::Array2D *B );
57 | };
58 |
59 |
60 | class OpenEXRWriter
61 | {
62 | char fileName[1024];
63 |
64 | public:
65 | OpenEXRWriter( const char* filename );
66 |
67 | void writeImage( pfs::Array2D *R, pfs::Array2D *G, pfs::Array2D *B );
68 | };
69 |
70 | #endif
71 |
--------------------------------------------------------------------------------
/src/filter/pfsabsolute.1:
--------------------------------------------------------------------------------
1 | .TH "pfsabsolute" 1
2 | .SH NAME
3 | pfsabsolute \- Convert luminance in images to absolute measure
4 | .SH SYNOPSIS
5 | .B pfsabsolute
6 | [] [--verbose] [--help]
7 | .SH DESCRIPTION
8 | \fBpfsabsolute\fR applies all necessary operations to convert an image
9 | from relative luminance (tag LUMINANCE is RELATIVE) or
10 | display-dependent luma (tag LUMINANCE is DISPLAY) to absolute
11 | luminance values. When the luminance in an image is absolute (tag
12 | LUMINANCE set to ABSOLUTE), the Y channel represents physical
13 | luminance in cd/m^2. Absolute luminance levels are useful for some
14 | tone mapping algorithms and also for image or video compression.
15 |
16 | The argument \fB\fR denotes the level of luminance that
17 | relative luminance \fB\fR should be rescaled to. The luminance
18 | is in fact multiplied by the ratio /. \fB\fR is
19 | normally relative luminance checked with pfsview in the spot where the
20 | absolute luminance \fB\fR is measured, known or guessed. If
21 | \fB\fR is omitted, the value 1 is assumed, so \fB\fR is
22 | just a scaling factor.
23 |
24 | In case if display-depended luma (tag LUMINANCE is DISPLAY), the
25 | inverse gamma correction is applied (assuming sRGB color space). In
26 | such case \fB\fR is usually the maximum luminance of a display
27 | (e.g. 80 cd/m^2).
28 |
29 | This command always sets LUMINANCE tag to ABSOLUTE.
30 |
31 | .SH EXAMPLES
32 | .TP
33 | pfsin memorial.hdr | pfsabsolute 20 0.04 | pfsview
34 |
35 | Multiply luminance in memorial image, so that relative luminance 0.04
36 | becomes 20 cd/m^2. Normally, the value 0.04 is check using pfsview in
37 | the spot, where the absolute luminance (which equals in this case 20
38 | cd/m^2) is known.
39 |
40 | .TP
41 | pfsin lena.png | pfsabsolute 80 | pfsview
42 |
43 | Convert lena image from sRGB color space to absolute XYZ, assuming
44 | maximum luminance of the monitor 80 cd/m^2.
45 |
46 | .SH "SEE ALSO"
47 | .BR pfsgamma (1)
48 | .BR pfsinppm (1)
49 | .SH BUGS
50 | Please report bugs and comments to Rafal Mantiuk
51 | .
52 |
--------------------------------------------------------------------------------
/src/filter/pfspad.1:
--------------------------------------------------------------------------------
1 | .TH "pfspad" 1
2 | .SH NAME
3 | pfspad \- Add borders to a frame in PFS stream
4 | .SH SYNOPSIS
5 | .B pfspad
6 | [--left ] [--right ]
7 | [--top ] [--bottom ]
8 | [--width ] [--height ]
9 | [--R ] [--G ] [--B ] [--Y ] [--help]
10 | .SH DESCRIPTION
11 | Add borders to each frame in PFS stream. User specifies size of left,
12 | right, top and bottom border or size of an output image. Color of
13 | borders can be specified as well.
14 | .SH OPTIONS
15 | .TP
16 | --left , -l
17 | Width in pixels of the left border.
18 | .TP
19 | --right , -r
20 | Width in pixels of the right border.
21 | .TP
22 | --top , -t
23 | Height in pixels of the top border.
24 | .TP
25 | --bottom , -b
26 | Height in pixels of the bottom border.
27 | .TP
28 | --width , -W
29 | Width of an output image. Note that --width can be mixed with either
30 | --left or --right option.
31 | .TP
32 | --height , -H
33 | Height of an output image. Note that --height can be mixed with either
34 | --top or --bottom option.
35 | .TP
36 | --R , -R , --G , -G , --B , -B
37 | Color of borders in RGB mode. Default color is black, and if some of
38 | the components is not specified, its value is set to 0.0.
39 | .TP
40 | --Y , -Y
41 | Color of borders in luminance mode.
42 | .TP
43 | --help, -h
44 | Print a list of commandline options.
45 | .SH EXAMPLES
46 | .TP
47 | pfsin image.hdr | pfspad --left 50 --bottom 20 | pfsout out.hdr
48 | Add 50 columns to the left and 20 rows to the bottom side of image.hdr.
49 | Color of borders is default black.
50 | .TP
51 | pfsin image.hdr | pfspad --top 20 --height 500 --width 400 --R 1.0 | pfsout out.hdr
52 | Add 20 rows to the top side of image.hdr and create output image out.hdr
53 | 500 pixels in height and 400 pixels in width. Color of borders is set to red.
54 | .SH SEE ALSO
55 | .BR pfsin (1)
56 | .BR pfsout (1)
57 | .SH BUGS
58 | Please report bugs and comments to Dorota Zdrojewska
59 | .
60 |
--------------------------------------------------------------------------------
/src/pfsglview/module.h:
--------------------------------------------------------------------------------
1 | /**
2 | * @brief PFS library - additional utilities
3 | *
4 | * This file is a part of PFSTOOLS package.
5 | * ----------------------------------------------------------------------
6 | * Copyright (C) 2006 Radoslaw Mantiuk
7 | *
8 | * This library is free software; you can redistribute it and/or
9 | * modify it under the terms of the GNU Lesser General Public
10 | * License as published by the Free Software Foundation; either
11 | * version 2.1 of the License, or (at your option) any later version.
12 | *
13 | * This library is distributed in the hope that it will be useful,
14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 | * Lesser General Public License for more details.
17 | *
18 | * You should have received a copy of the GNU Lesser General Public
19 | * License along with this library; if not, write to the Free Software
20 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21 | * ----------------------------------------------------------------------
22 | *
23 | * @author Radoslaw Mantiuk,
24 | * @author Oliver Barth
25 | */
26 |
27 | #include "glenv.h"
28 |
29 | #ifndef MODULE_H
30 | #define MODULE_H
31 |
32 | // pixel width of the module border
33 | #define X_BAR 20
34 | #define Y_BAR 20
35 |
36 | class Module {
37 |
38 | private:
39 | GLint param[4];
40 |
41 | protected:
42 | int isVisible;
43 | int pos_x;
44 | int pos_y;
45 | int width;
46 | int height;
47 | GLfloat* winBackgroundColor;
48 |
49 | void drawBackground(void);
50 | int redrawStart(void);
51 | void redrawEnd(void);
52 |
53 | public:
54 |
55 | Module();
56 | ~Module();
57 |
58 | void setPosition( int _x, int _y);
59 | void setSize(int _width, int _height);
60 |
61 | int getWidth();
62 | int getHeight();
63 | void setWidth(int _width);
64 | void setHeight(int _height);
65 |
66 | void setVisible(bool _isVisible);
67 | bool getVisible(void);
68 |
69 | // not used anymore
70 | // int processSelection(int xCoord, int yCoord);
71 | };
72 |
73 | #endif
74 |
--------------------------------------------------------------------------------
/src/fileformat/ppmio.h:
--------------------------------------------------------------------------------
1 | /**
2 | * @brief
3 | *
4 | * This file is a part of PFSTOOLS package.
5 | * ----------------------------------------------------------------------
6 | * Copyright (C) 2003,2004 Rafal Mantiuk and Grzegorz Krawczyk
7 | *
8 | * This program is free software; you can redistribute it and/or modify
9 | * it under the terms of the GNU General Public License as published by
10 | * the Free Software Foundation; either version 2 of the License, or
11 | * (at your option) any later version.
12 | *
13 | * This program is distributed in the hope that it will be useful,
14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 | * GNU General Public License for more details.
17 | *
18 | * You should have received a copy of the GNU General Public License
19 | * along with this program; if not, write to the Free Software
20 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21 | * ----------------------------------------------------------------------
22 | *
23 | * @author Rafal Mantiuk,
24 | *
25 | * $Id: ppmio.h,v 1.5 2009/05/25 19:24:49 rafm Exp $
26 | */
27 |
28 | #ifndef PPMIO_H
29 | #define PPMIO_H
30 |
31 | #include
32 | #include
33 |
34 | struct PPMData;
35 |
36 | class PPMReader
37 | {
38 | FILE *fh;
39 | int width, height;
40 | PPMData *data;
41 | public:
42 | PPMReader( const char *program_name, FILE *fh );
43 | ~PPMReader();
44 |
45 | int getWidth() const
46 | {
47 | return width;
48 | }
49 | int getHeight() const
50 | {
51 | return height;
52 | }
53 |
54 | int getBitDepth();
55 |
56 | bool readImage( pfs::Array2D *X, pfs::Array2D *Y, pfs::Array2D *Z );
57 |
58 | };
59 |
60 | class PPMWriter
61 | {
62 | FILE *fh;
63 | const int bit_depth;
64 |
65 | public:
66 | PPMWriter( const char *program_name, FILE *fh, int bit_depth = 8 );
67 |
68 | void writeImage( pfs::Array2D *X, pfs::Array2D *Y, pfs::Array2D *Z );
69 |
70 | };
71 |
72 |
73 |
74 | #endif
75 |
--------------------------------------------------------------------------------
/src/tmo/reinhard05/tmo_reinhard05.h:
--------------------------------------------------------------------------------
1 | /**
2 | * @file tmo_reinhard05.cpp
3 | * @brief Tone map XYZ channels using Reinhard05 model
4 | *
5 | * Dynamic Range Reduction Inspired by Photoreceptor Physiology.
6 | * E. Reinhard and K. Devlin.
7 | * In IEEE Transactions on Visualization and Computer Graphics, 2005.
8 | *
9 | * This file is a part of PFSTMO package.
10 | * ----------------------------------------------------------------------
11 | * Copyright (C) 2007 Grzegorz Krawczyk
12 | *
13 | * This program is free software; you can redistribute it and/or modify
14 | * it under the terms of the GNU General Public License as published by
15 | * the Free Software Foundation; either version 2 of the License, or
16 | * (at your option) any later version.
17 | *
18 | * This program is distributed in the hope that it will be useful,
19 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 | * GNU General Public License for more details.
22 | *
23 | * You should have received a copy of the GNU General Public License
24 | * along with this program; if not, write to the Free Software
25 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
26 | * ----------------------------------------------------------------------
27 | *
28 | * @author Grzegorz Krawczyk,
29 | *
30 | * $Id: tmo_reinhard05.h,v 1.2 2008/09/04 12:46:49 julians37 Exp $
31 | */
32 |
33 | #ifndef _tmo_reinhard05_h_
34 | #define _tmo_reinhard05_h_
35 |
36 | /**
37 | * @brief: Tone mapping algorithm [Reinhard2005]
38 | *
39 | * @param width image width
40 | * @param height image height
41 | * @param R red channel
42 | * @param G green channel
43 | * @param B blue channel
44 | * @param Y luminance channel
45 | * @param br brightness level -8:8 (def 0)
46 | * @param ca amount of chromatic adaptation 0:1 (saturation, def 0)
47 | * @param la amount of light adaptation 0:1 (local/global, def 1)
48 | */
49 | void tmo_reinhard05(unsigned int width, unsigned int height,
50 | float* R, float* G, float* B,
51 | const float* Y, float br, float ca, float la );
52 |
53 | #endif
54 |
--------------------------------------------------------------------------------
/src/octave/pfssize.m:
--------------------------------------------------------------------------------
1 | function varargout = pfssize( n_rows, n_cols, varargin )
2 | ## Resizes the set of matrices using pfssize. All matrices must be
3 | ## of the same size.
4 | ##
5 | ## Usage: [rchannel [,rchannel...]] = pfssize( rows, cols, [filter], channel [,channel...] )
6 | ## n_rows - number of rows of the destination matrix
7 | ## n_cols - number of columns of the destination matrix
8 | ## filter - a string with the name of the filter to use. Recognized
9 | ## names: BOX, LINEAR, MITCHEL
10 | ## channel - a real matrix
11 | ## rchannel - resized matrix
12 |
13 | if( !isscalar( n_rows ) || !isscalar( n_cols ) )
14 | error( "pfssize: bad arguments" );
15 | return
16 | endif
17 |
18 | execStr = "pfswrite( hdr_in_name";
19 | filter_type = "LINEAR";
20 | channel_num = 1;
21 | for i=1:length( varargin )
22 | if( ischar( varargin{i} ) )
23 | filter_type = varargin{i};
24 | continue;
25 | elseif( !ismatrix(varargin{i}) || !isreal(varargin{i}) )
26 | error( "pfssize: each channel must be a matrix of real-valued numbers" );
27 | return
28 | endif
29 | chStr = sprintf( ", \"ch%d\", varargin{%d}", channel_num++, i );
30 | execStr = [ execStr chStr ];
31 | endfor
32 | execStr = strcat( execStr, " );" );
33 |
34 | hdr_in_name = tmpnam();
35 | hdr_out_name = tmpnam();
36 | eval( execStr );
37 |
38 | cmd = sprintf ("pfssize -x %d -y %d --filter %s <%s >%s", \
39 | n_cols, n_rows, filter_type, hdr_in_name, hdr_out_name );
40 | system( cmd );
41 |
42 | execStr = "pfsread( hdr_out_name";
43 | retStr = "[";
44 | channel_num = 1;
45 | for i=1:length( varargin )
46 | if( ischar( varargin{i} ) )
47 | continue;
48 | endif
49 | if( channel_num!=1 )
50 | separator = ", ";
51 | else
52 | separator = "";
53 | endif
54 | retStr = [ retStr separator sprintf( "varargout{%d} ", channel_num ) ];
55 | execStr = [ execStr sprintf( ", \"ch%d\"", channel_num++ ) ];
56 | endfor
57 | retStr = [ retStr "] = " ];
58 | execStr = [ retStr execStr " );" ];
59 | eval( execStr );
60 |
61 | unlink( hdr_in_name );
62 | unlink( hdr_out_name );
63 |
64 | endfunction
65 |
--------------------------------------------------------------------------------
/src/octave/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | include_directories("${PROJECT_BINARY_DIR}/" "${PROJECT_SOURCE_DIR}/src/pfs" "${PROJECT_SOURCE_DIR}/src/octave/help_files" ${OCTAVE_DEST_DIR})
2 | link_directories("${PROJECT_SOURCE_DIR}/src/pfs")
3 |
4 | set(HELP_FILES pfsget.help pfsopen.help pfsput.help pfsread.help pfstransform_colorspace.help pfswrite.help)
5 |
6 | set(SRC_OCT pfsread pfswrite pfstransform_colorspace pfsopen pfsget pfsput pfsclose)
7 |
8 | set(SRC_M pfsview.m pfsview_rgb.m pfsview_list.m pfs_read_rgb.m pfs_read_xyz.m pfs_read_luminance.m pfs_write_rgb.m pfssize.m pfs_open_frames.m pfs_close_frames.m)
9 |
10 | set(OCT_SCRIPTS pfsoctavelum pfsoctavergb pfsstat)
11 |
12 | set(CMAKE_CXXFLAGS "-cxx -largeArrayDims")
13 | set(ENV{CXXFLAGS} ${CMAKE_CXXFLAGS})
14 |
15 | SET( CMAKE_CXX_COMPILER MKOCTFILE )
16 | SET( CMAKE_C_COMPILER MKOCTFILE )
17 |
18 | SET( CMAKE_SHARED_LIBRARY_PREFIX )
19 |
20 | set(HEADERS "${PROJECT_SOURCE_DIR}/src/pfs/")
21 |
22 | #Building phase
23 | foreach(SRC ${SRC_OCT})
24 | get_filename_component(OCT_NAME ${SRC} NAME)
25 | add_custom_command(
26 | OUTPUT ${OCT_NAME}.oct
27 | COMMAND ${MKOCTFILE} "${CMAKE_CURRENT_SOURCE_DIR}/${OCT_NAME}.cpp"
28 | ARGS -I${HEADERS} -I${CMAKE_CURRENT_SOURCE_DIR}/help_files
29 | -L${PROJECT_BINARY_DIR}/src/pfs -lpfs
30 | DEPENDS ${OCT_NAME}.cpp
31 | COMMENT "Generating ${OCT_NAME}.oct"
32 | VERBATIM)
33 | endforeach(SRC)
34 |
35 | foreach(SRC ${SRC_OCT})
36 | add_custom_target(${SRC}.mkoct ALL DEPENDS ${SRC}.oct)
37 | endforeach(SRC)
38 |
39 | #Installation
40 | foreach(SRC ${SRC_OCT})
41 | install (FILES ${CMAKE_CURRENT_BINARY_DIR}/${SRC}.oct
42 | PERMISSIONS OWNER_EXECUTE GROUP_EXECUTE WORLD_EXECUTE OWNER_WRITE WORLD_READ GROUP_READ OWNER_READ
43 | DESTINATION ${OCTAVE_DEST_DIR})
44 | endforeach(SRC)
45 |
46 | foreach(SRC ${SRC_M})
47 | install (FILES ${SRC} DESTINATION ${OCTAVE_DEST_DIR})
48 | endforeach(SRC)
49 |
50 | install (FILES ${OCT_SCRIPTS}
51 | PERMISSIONS OWNER_EXECUTE GROUP_EXECUTE WORLD_EXECUTE OWNER_WRITE WORLD_READ GROUP_READ OWNER_READ
52 | DESTINATION bin)
53 |
54 | foreach(SCRIPT ${OCT_SCRIPTS})
55 |
56 | install (FILES ${SCRIPT}.1 DESTINATION ${MAN_DIR})
57 |
58 | endforeach(SCRIPT ${OCT_SCRIPTS})
59 |
--------------------------------------------------------------------------------
/src/filter/pfscut.1:
--------------------------------------------------------------------------------
1 | .TH "pfscut" 1
2 | .SH NAME
3 | pfscut \- Extract a rectangle out of a frame in PFS stream
4 | .SH SYNOPSIS
5 | .B pfscut
6 | [--left ] [--right ]
7 | [--top ] [--bottom ]
8 | [--width ] [--height ] [--help]
9 | [x_ul y_ul x_br y_br]
10 | .SH DESCRIPTION
11 | Extract a rectangle out of each frame in PFS stream. You can either
12 | specify x and y coordinates of upper left and lower right corner (the
13 | coordinates start with 0 and rise in the left-to-right and
14 | up-to-botton directions) or give a combination of the options listed
15 | below.
16 | .SH OPTIONS
17 | .TP
18 | --left , -l
19 | Number of columns to be cut out from the left edge of an image.
20 | .TP
21 | --right , -r
22 | Number of columns to be cut out from the right edge of an image.
23 | .TP
24 | --top , -t
25 | Number of rows to be cut out from the top edge of an image.
26 | .TP
27 | --bottom , -b
28 | Number of rows to be cut out from the bottom edge of an image.
29 | .TP
30 | --width , -W
31 | Width of an output image. Note that --width can be mixed with either
32 | --left or --right option.
33 | .TP
34 | --height , -H
35 | Height of an output image. Note that --height can be mixed with either
36 | --top or --bottom option.
37 | .TP
38 | --help, -h
39 | Print a list of commandline options.
40 | .SH EXAMPLES
41 | .TP
42 | pfsin image.hdr | pfscut --left 20 --top 5 | pfsout out.hdr
43 | Cut out 20 columns from the left and 5 rows from the top edge of
44 | image.hdr and save frame as out.hdr.
45 | .TP
46 | pfsin image.hdr | pfscut --left 20 --width 400 | pfsout out.hdr
47 | Cut out 20 columns from the left edge of image.hdr, and create output
48 | image 400 pixels in width.
49 | .TP
50 | pfsin image.hdr | pfscut 0 0 511 511 | pfsout out.hdr
51 | Cut left-upper part of the image of the size 512x512 (note that
52 | coordinates start with 0 and 512 is the last row/column that is
53 | included in the resulting image).
54 | .TP
55 | .SH SEE ALSO
56 | .BR pfsin (1)
57 | .BR pfsout (1)
58 | .SH BUGS
59 | Please report bugs and comments to Dorota Zdrojewska
60 | .
61 |
62 |
--------------------------------------------------------------------------------
/src/matlab/pfs_shell.m:
--------------------------------------------------------------------------------
1 | function cmd = pfs_shell( suffix )
2 | % Returns command line that starts shell. Internal, do not use.
3 |
4 | if ispc()
5 | % -i option is needed to make sure that .bash_rc is executed and thus
6 | % DISPLAY and other environment variables are set
7 | if( exist( 'suffix', 'var' ) )
8 | % This is put at the end of the shell command
9 | cmd = '''';
10 | else
11 | work_dir = strrep(pwd(),'\','/');
12 |
13 | % work_dir = regexprep(work_dir, ...
14 | % '([a-z]):','/cygdrive/$1', 'ignorecase','once');
15 |
16 | [pstatus pdir] = dos('set CYGWIN_HOME');
17 | if(pstatus == 1)
18 | pdir = 'c:\\cygwin';
19 | else
20 | [pstatus pdir] = dos('echo %CYGWIN_HOME%');
21 | pdir = strcat(pdir, ''); % used to remove final LF
22 | end
23 |
24 | % This is put at the beginning of the shell command
25 | cmd = sprintf('%s\\bin\\bash -i -l -c ''cd "%s";', pdir, work_dir);
26 | end
27 | else
28 | if( ~exist( 'suffix', 'var' ) )
29 | work_dir = strrep(pwd(),'\','/');
30 |
31 | % It is necessary to set all ENV variables before invoking
32 | % pfstools commands. '/bin/bash' may need to be replaced with the
33 | % shell you are using.
34 |
35 | % This will remove all references to matlab libraries from the
36 | % LD_LIBRARY_PATH. pfstools usually do not work with matlab version
37 | % of the standard libraries
38 | set_ld_path='export LD_LIBRARY_PATH=`echo $LD_LIBRARY_PATH | sed "y/:/\n/" | grep -v "matlab" | sed ":beg;N;s/\n/:/;t beg;"`';
39 |
40 | if( strcmp( computer, 'MACI64' ) || strcmp( computer, 'MACI32' ) )
41 | set_ld_path=cat( 2, set_ld_path, '; export DYLD_FRAMEWORK_PATH=`echo $DYLD_FRAMEWORK_PATH | sed "y/:/\n/" | grep -v "matlab" | sed ":beg;N;s/\n/:/;t beg;"`' );
42 | end
43 |
44 | % Start shell, cd to the working directory and remove matlab
45 | % libraries
46 | cmd = sprintf('/bin/bash -l -c ''cd "%s"; %s;', work_dir, set_ld_path );
47 | else
48 | cmd='''';
49 | end
50 | end
51 |
52 | end
53 |
--------------------------------------------------------------------------------
/src/fileformat/rgbeio.h:
--------------------------------------------------------------------------------
1 | /**
2 | * @brief IO operations on Radiance's RGBE file format
3 | *
4 | * This file is a part of PFSTOOLS package.
5 | * ----------------------------------------------------------------------
6 | * Copyright (C) 2003,2004 Rafal Mantiuk and Grzegorz Krawczyk
7 | *
8 | * This program is free software; you can redistribute it and/or modify
9 | * it under the terms of the GNU General Public License as published by
10 | * the Free Software Foundation; either version 2 of the License, or
11 | * (at your option) any later version.
12 | *
13 | * This program is distributed in the hope that it will be useful,
14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 | * GNU General Public License for more details.
17 | *
18 | * You should have received a copy of the GNU General Public License
19 | * along with this program; if not, write to the Free Software
20 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21 | * ----------------------------------------------------------------------
22 | *
23 | * @author Grzegorz Krawczyk,
24 | *
25 | * $Id: rgbeio.h,v 1.4 2014/06/17 21:57:09 rafm Exp $
26 | */
27 |
28 | #ifndef _RGBEIO_H_
29 | #define _RGBEIO_H_
30 |
31 | #include
32 | #include
33 |
34 |
35 | class RGBEReader
36 | {
37 | FILE *fh;
38 | int width, height;
39 | float exposure;
40 | bool radiance_compatibility;
41 |
42 | public:
43 | RGBEReader( FILE *fh, bool radiance_compatibility = false );
44 | ~RGBEReader();
45 |
46 | int getWidth() const
47 | {
48 | return width;
49 | }
50 |
51 | int getHeight() const
52 | {
53 | return height;
54 | }
55 |
56 | void readImage( pfs::Array2D *X, pfs::Array2D *Y, pfs::Array2D *Z );
57 |
58 | };
59 |
60 |
61 | class RGBEWriter
62 | {
63 | FILE *fh;
64 | bool radiance_compatibility;
65 | public:
66 | RGBEWriter(FILE *fh, bool radiance_compatibility = false) : fh(fh), radiance_compatibility(radiance_compatibility)
67 | {
68 | }
69 |
70 | void writeImage( pfs::Array2D *X, pfs::Array2D *Y, pfs::Array2D *Z );
71 | };
72 |
73 | #endif
74 |
--------------------------------------------------------------------------------
/src/filter/pfsgamma.1:
--------------------------------------------------------------------------------
1 | .TH "pfsgamma" 1
2 | .SH NAME
3 | pfsgamma \- Apply gamma correction to color or gray-scale images
4 | .SH SYNOPSIS
5 | .B pfsgamma
6 | [--\fBgamma\fR | --\fBinverse-gamma\fR ] [--\fBmul\fR ]
7 | .SH DESCRIPTION
8 | Use this command to gamma correct a stream of pfs images. Gamma
9 | correction is equivalent to raising value of R, G and B (or Y for
10 | gray-scale images) channels to 1/gamma power. More information on
11 | gamma correction can be found at:
12 | .PP
13 | http://www.poynton.com/notes/colour_and_gamma/GammaFAQ.html
14 | .PP
15 | This command can work on color images, in which case XYZ channels are
16 | transformed to RGB space, then they are gamma corrected before they
17 | are converted back to XYZ. For gray-scale images (only Y channel and
18 | XZ missing) gamma correction is applied only to Y channel.
19 | .PP
20 | Data can be multiplied by an optional multiplier \fBbefore\fR gamma
21 | correction.
22 | .PP
23 | Note: gamma correction will set the 'LUMINANCE' tag to 'DISPLAY' thus
24 | cancelling any sRGB correction when saving to LDR files (like PPM,
25 | TIFF). This will also cause a warning message when saving to HDR
26 | files, because the intensities after gamma correction are not linearly
27 | related to luminance any more.
28 | .SH OPTIONS
29 | .TP
30 | --\fBgamma\fR , -\fBg\fR
31 | Perform gamma correction (input^(1/gamma)). This can be used to convert
32 | images from relative luminance or radiance to pixel values. Default
33 | value: 1.0
34 | .TP
35 | --\fBinverse-gamma\fR , -\fBi\fR
36 | Perform inverse gamma correction (input^(gamma)). This can be used
37 | to convert images from pixel values to relative radiance or luminance.
38 | .TP
39 | --\fBmul\fR , -\fBm\fR
40 | Multiply data by this value before gamma correction. Default value: 1
41 | .SH EXAMPLES
42 | .TP
43 | pfsin memorial.hdr | pfsgamma -g 1.8 -m 10 | pfsout memorial_gc.ppm
44 | .IP
45 | Multiply memorial image by 10, gamma correct it and save to
46 | memorial_gc.ppm.
47 | .SH "SEE ALSO"
48 | .BR pfsin (1)
49 | .BR pfsout (1)
50 | .BR pfsdisplayfunction (1)
51 | .SH BUGS
52 | Please report bugs and comments to the pfstools discussion group
53 | (http://groups.google.com/group/pfstools).
54 |
--------------------------------------------------------------------------------
/src/fileformat/pfsoutffmpeg:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 | ############################################################
3 | # Read pfs frames from stdin and forward them to ffmpeg
4 | # program
5 | ############################################################
6 | #
7 | # This file is a part of PFSTOOLS package.
8 | # ----------------------------------------------------------------------
9 | # Copyright (C) 2003,2004 Rafal Mantiuk and Grzegorz Krawczyk
10 | #
11 | # This program is free software; you can redistribute it and/or modify
12 | # it under the terms of the GNU General Public License as published by
13 | # the Free Software Foundation; either version 2 of the License, or
14 | # (at your option) any later version.
15 | #
16 | # This program is distributed in the hope that it will be useful,
17 | # but WITHOUT ANY WARRANTY; without even the implied warranty of
18 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 | # GNU General Public License for more details.
20 | #
21 | # You should have received a copy of the GNU General Public License
22 | # along with this program; if not, write to the Free Software
23 | # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
24 | # ----------------------------------------------------------------------
25 | #
26 |
27 | if test "$1" = "--help"; then
28 | cat < output_file.avi
33 |
34 | See manual of ffmpeg for further information. Note that the usage of
35 | '-f' switch (input format specifier) and '-i' switch (input file
36 | specifier) is implemented inside the script and is therefore not
37 | allowed.
38 |
39 | See the man page for sample usage.
40 | EOF
41 | exit 1
42 | fi
43 |
44 | FFMPEG="/usr/bin/ffmpeg"
45 | FFMPEG_SWICHES="-f imagepipe -i - "
46 | FFMPEG_USER_SWICHES=""
47 |
48 | while test "$1"; do
49 | if test "$1" = "-f" -o "$1" = "-i"; then
50 | echo "pfsoutffmpeg: Usage of -f and -i switches is not allowed." &1>2
51 | exit 1
52 | fi
53 | FFMPEG_USER_SWICHES="${FFMPEG_USER_SWICHES} $1"
54 | shift
55 | done
56 |
57 | pfsoutppm - | ${FFMPEG} ${FFMPEG_SWICHES} ${FFMPEG_USER_SWICHES}
58 |
--------------------------------------------------------------------------------
/src/matlab/pfs_write_image.m:
--------------------------------------------------------------------------------
1 | function pfs_write_image( file_name, img, options )
2 | %PFS_WRITE_IMAGE write an RGB, luminance or multichannel image to a file.
3 | %
4 | % PFS_WRITE_IMAGE( file_name, IMG [, options] )
5 | %
6 | % Writes a luminance image if IMG is a 2D matrix, an RGB image if
7 | % size(IMG,3) == 3, and a multi-channel image otherwise. Each channel in a
8 | % multi-channel image has a name C1, C2, .., Cn.
9 | %
10 | % 'options' passes a string with additional options recognized by each of
11 | % the image format writers. For example '--compression=PXR24' modifies the
12 | % compression algorithm for OpenEXR files. See the manual pages of the
13 | % "pfsout*" shell commands for the list of supported options.
14 | %
15 | % The format of the file is recognized based in the file name extension:
16 | % .hdr for Radiance images, .exr for OpenEXR, .jpg for JPEG and .png for
17 | % PNG. See manual of "pfsout" shell command for the full list of the
18 | % supported formats.
19 | %
20 | % Currently only OpenEXR and PFS formats support multi-channel files.
21 | %
22 | % Pass single precission matrices for better performance.
23 | %
24 | % Example:
25 | % pfs_write_image( 'image.exr', cat( 3, R, G, B ) );
26 | %
27 | % R, G, and B are 2D matrices with red, green and blue channel data.
28 | %
29 | % See also: PFS_WRITE_RGB, PFS_WRITE_LUMINANCE, PFS_WRITE_XYZ,
30 | % PFS_READ_IMAGE, PFSVIEW.
31 | %
32 | % Copyright 2009 Rafal Mantiuk
33 |
34 | img_sz = size( img );
35 | dims = length( img_sz );
36 |
37 | if( dims > 3 )
38 | error( 'image matrix has too many dimenstions' );
39 | end
40 |
41 | if( ~exist( 'options', 'var' ) )
42 | options = '';
43 | end
44 |
45 | fid = pfspopen( sprintf( '%spfsout ''%s'' %s%s', pfs_shell(), file_name, options, pfs_shell(1) ), 'w' );
46 | pfs = pfsopen( fid, [img_sz(1) img_sz(2)] );
47 |
48 | if( dims == 2 || img_sz(3) == 1 )
49 | pfs.channels.Y = single(img);
50 | elseif( dims == 3 && img_sz(3) == 3 )
51 | [pfs.channels.X pfs.channels.Y pfs.channels.Z] = pfs_transform_colorspace( 'RGB', img, 'XYZ' );
52 | else
53 | for k=1:img_sz(3)
54 | pfs.channels.(sprintf('C%d', k)) = single(img(:,:,k));
55 | end
56 | end
57 |
58 | pfsput( pfs );
59 | pfsclose( pfs );
60 | pfspclose( fid );
61 |
62 | end
63 |
--------------------------------------------------------------------------------
/src/camera/pfsinme.in:
--------------------------------------------------------------------------------
1 | #!@BASH_PATH@
2 | #
3 | # This file is a part of PFS CALIBRATION package.
4 | # ----------------------------------------------------------------------
5 | #
6 | # This program is free software; you can redistribute it and/or modify
7 | # it under the terms of the GNU General Public License as published by
8 | # the Free Software Foundation; either version 2 of the License, or
9 | # (at your option) any later version.
10 | #
11 | # This program is distributed in the hope that it will be useful,
12 | # but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | # GNU General Public License for more details.
15 | #
16 | # You should have received a copy of the GNU General Public License
17 | # along with this program; if not, write to the Free Software
18 | # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 | # ----------------------------------------------------------------------
20 | #
21 | # @author Rafal Mantiuk,
22 | #
23 | # $Id: pfsinme,v 1.6 2013/12/25 16:13:45 rafm Exp $
24 |
25 | if test -z "$1" || test "$1" = "--help"; then
26 | cat < [...]
30 |
31 | Recognized file formats and extensions:
32 | JPEG - .jpeg, .jpg
33 | Canon 350D RAW - .cr2
34 | (and other camera RAW formats recognized by dcraw)
35 |
36 | All listed files must be the same type, that is mising JPEG and RAW
37 | images is not allowed. You can use wildcards.
38 |
39 | See the man page for more information.
40 | EOF
41 | exit 1
42 | fi
43 |
44 | extension=${1##*.}
45 |
46 | HDRGEN_CMD="dcraw2hdrgen"
47 |
48 | case $extension in
49 | ("jpg"|"JPG"|"jpeg"|"JPEG")
50 | HDRGEN_CMD="jpeg2hdrgen"
51 | ;;
52 | esac
53 |
54 | unamestr=`uname`
55 |
56 | if [[ "$unamestr" == 'Darwin' ]]; then
57 | hdrgen_file=`mktemp -t pfsinme`
58 | else
59 | hdrgen_file=`mktemp`
60 | fi
61 |
62 | ${HDRGEN_CMD} "$@" | sort -k 2 -n >$hdrgen_file
63 |
64 | #echo 1>&2 $hdrgen_file
65 |
66 | echo 1>&2 "pfsinme: Recognized exposures: "
67 | cat 1>&2 $hdrgen_file
68 |
69 | pfsinhdrgen $hdrgen_file
70 |
71 | rm $hdrgen_file
72 |
--------------------------------------------------------------------------------
/src/tmo/mantiuk08/display_size.h:
--------------------------------------------------------------------------------
1 | /**
2 | * @brief Display Adaptive TMO
3 | *
4 | * From:
5 | * Rafal Mantiuk, Scott Daly, Louis Kerofsky.
6 | * Display Adaptive Tone Mapping.
7 | * To appear in: ACM Transactions on Graphics (Proc. of SIGGRAPH'08) 27 (3)
8 | * http://www.mpi-inf.mpg.de/resources/hdr/datmo/
9 | *
10 | * This file is a part of PFSTMO package.
11 | * ----------------------------------------------------------------------
12 | * This program is free software; you can redistribute it and/or modify
13 | * it under the terms of the GNU General Public License as published by
14 | * the Free Software Foundation; either version 2 of the License, or
15 | * (at your option) any later version.
16 | *
17 | * This program is distributed in the hope that it will be useful,
18 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
19 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 | * GNU General Public License for more details.
21 | *
22 | * You should have received a copy of the GNU General Public License
23 | * along with this program; if not, write to the Free Software
24 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
25 | * ----------------------------------------------------------------------
26 | *
27 | * @author Rafal Mantiuk,
28 | *
29 | * $Id: display_size.h,v 1.2 2008/06/16 18:42:58 rafm Exp $
30 | */
31 |
32 | #ifndef DISPLAY_SIZE_H
33 | #define DISPLAY_SIZE_H
34 |
35 | #include
36 |
37 | class DisplaySize
38 | {
39 | float view_d;
40 | float ppd;
41 | public:
42 | /**
43 | * @param vres vertical screen resolution in pixels
44 | * @param vd_screen_h viewing distance as the multiplies of screen height (e.g. 2)
45 | * @param vd_meters viewing distance in meters
46 | */
47 | DisplaySize( int vres, float vd_screen_h, float vd_meters = 0.5 );
48 |
49 |
50 | /**
51 | * @param ppd number of pixels per one visual degree (e.g. 30)
52 | * @param vd_meters viewing distance in meters
53 | */
54 | DisplaySize( float ppd, float vd_meters = 0.5 );
55 |
56 | void print( FILE *fh );
57 |
58 | float getPixPerDeg();
59 | float getViewD();
60 | };
61 |
62 | DisplaySize *createDisplaySizeFromArgs( int &argc, char* argv[] );
63 |
64 | #endif
65 |
--------------------------------------------------------------------------------
/src/tmo/reinhard02/pfstmo_reinhard02.1:
--------------------------------------------------------------------------------
1 | .TH "pfstmo_reinhard02" 1
2 | .SH NAME
3 | pfstmo_reinhard02 \- Photographic Tone Reproduction for Digital Images
4 | .SH SYNOPSIS
5 | .B pfstmo_reinhard02
6 | [--scales] [--key ] [--phi ]
7 | [--range ] [--lower ] [--upper ]
8 | [--temporal-coherent]
9 | [--verbose] [--help]
10 | .SH DESCRIPTION
11 | This command implements a tone mapping operator as described in:
12 |
13 | Photographic Tone Reproduction for Digital Images.
14 | E. Reinhard, M. Stark, P. Shirley, and J. Ferwerda.
15 | In ACM Transactions on Graphics, 2002.
16 |
17 | According to the paper, results of this TMO require gamma correction.
18 | .SH OPTIONS
19 | .TP
20 | [--scales]
21 |
22 | Use scales to calculate local adaptation. That means: use local
23 | version of this operator. By default, global version is used.
24 | .TP
25 | [--key ]
26 |
27 | Set key value for the image (refer to paper for details).
28 | Default value: 0.18, accepted range <0..1>.
29 | .TP
30 | [--phi ]
31 |
32 | Set phi value (refer to paper for details).
33 | Default value: 1.0, accepted range >=0.0.
34 | .TP
35 | [--range ]
36 |
37 | Set range size (refer to paper for details).
38 | Default value: 8, accepted range >1.
39 | .TP
40 | [--lower ]
41 |
42 | Set lower scale size (refer to paper for details).
43 | Default value: 1, accepted range >=1.
44 | .TP
45 | [--upper ]
46 |
47 | Set upper scale size (refer to paper for details).
48 | Default value: 43, accepted range >=1.
49 | .TP
50 | [--temporal-coherent], [-t]
51 |
52 | When this option is specified, tone mapping is time coherent for video
53 | sequences. Currently the option imposes that the average and maximum
54 | luminance value can change at most by 1% between two consecutive
55 | frames.
56 | .TP
57 | --verbose
58 |
59 | Print additional information during program execution.
60 | .TP
61 | --help
62 |
63 | Print list of commandline options.
64 | .SH EXAMPLES
65 | .TP
66 | pfsin memorial.hdr | pfstmo_reinhard02 -s | pfsgamma -g 2.2 | pfsout memorial.png
67 |
68 | Tone map image and save it in png format.
69 | .SH "SEE ALSO"
70 | .BR pfsgamma (1)
71 | .BR pfsin (1)
72 | .BR pfsout (1)
73 | .BR pfsview (1)
74 | .SH BUGS
75 | Please report bugs and comments on implementation to
76 | Grzegorz Krawczyk .
77 |
--------------------------------------------------------------------------------
/src/matlab/pfsclose.cpp:
--------------------------------------------------------------------------------
1 | /**
2 | * @brief Close pfs stream (MATLAB interface)
3 | *
4 | * This file is a part of PFSTOOLS package.
5 | * ----------------------------------------------------------------------
6 | * Copyright (C) 2003,2004 Rafal Mantiuk and Grzegorz Krawczyk
7 | *
8 | * This program is free software; you can redistribute it and/or modify
9 | * it under the terms of the GNU General Public License as published by
10 | * the Free Software Foundation; either version 2 of the License, or
11 | * (at your option) any later version.
12 | *
13 | * This program is distributed in the hope that it will be useful,
14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 | * GNU General Public License for more details.
17 | *
18 | * You should have received a copy of the GNU General Public License
19 | * along with this program; if not, write to the Free Software
20 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21 | * ----------------------------------------------------------------------
22 | *
23 | * @author Rafal Mantiuk,
24 | *
25 | * $Id: pfsclose.cpp,v 1.5 2007/03/01 14:00:44 rdmantiuk Exp $
26 | */
27 |
28 | #include "compatibility.h"
29 |
30 | #include
31 | #include
32 | #include
33 |
34 | #include