├── debian ├── compat ├── dirs ├── pfstools.dir ├── libpfstools1.dirs ├── libpfstools.install ├── libpfstools1.install ├── libpfstools-dev.dirs ├── pfstools.install ├── octave-pfstools.install ├── libpfstools-dev.install ├── docs ├── changelog ├── README.Debian ├── copyright └── control ├── src ├── pfsview │ ├── mac_os │ │ ├── PkgInfo │ │ ├── pfsview_icon_mac.icns │ │ └── Info.plist │ ├── icons │ │ └── appicon.png │ ├── pfsview.qrc │ ├── pfsv.in │ ├── pfsv.1 │ ├── CMakeLists.txt │ └── histogram.h ├── matlab │ ├── compile_win32.bat │ ├── pfspclose.m │ ├── pfsclose.m │ ├── pfsget.m │ ├── pfspopen.m │ ├── pfsput.m │ ├── pfs_transform_colorspace.m │ ├── pfs_write_luminance.m │ ├── pfs_read_luminance.m │ ├── Makefile.win32 │ ├── pfspopen.cpp │ ├── pfspclose.cpp │ ├── pfs_read_xyz.m │ ├── Contents.m │ ├── pfs_write_xyz.m │ ├── pfsopen.m │ ├── pfs_write_rgb.m │ ├── pfsview_rgb.m │ ├── pfs_read_rgb.m │ ├── compatibility.h │ ├── pfs_read_image.m │ ├── pfs_test_shell.m │ ├── pfs_shell.m │ ├── pfs_write_image.m │ └── pfsclose.cpp ├── getopt │ └── CMakeLists.txt ├── hdrhtml │ ├── hdrhtml_hdrlabs_templ │ │ ├── hdrhtml_assets │ │ │ ├── information.png │ │ │ ├── slider-black.png │ │ │ ├── slider-red.png │ │ │ ├── slider-white.png │ │ │ ├── information-red.png │ │ │ ├── loading-spinner.gif │ │ │ ├── mouse2touch.js │ │ │ └── hdr_viewer.css │ │ ├── hdrhtml_image_templ.html │ │ ├── hdrhtml_image_templ_slider-above.html │ │ └── hdrhtml_page_templ_short.html │ ├── hdrhtml_c_b2.csv │ ├── hdrhtml_t_b2.csv │ ├── hdrhtml_c_b3.csv │ ├── hdrhtml_t_b3.csv │ ├── CMakeLists.txt │ ├── hdrhtml_c_b4.csv │ ├── hdrhtml_t_b4.csv │ ├── hdrhtml_c_b5.csv │ ├── hdrhtml_t_b5.csv │ └── hdrhtml_default_templ │ │ └── hdrhtml_image_templ.html ├── octave │ ├── pfsclose.help │ ├── help_files │ │ ├── pfsclose_help.h │ │ ├── pfsget_help.h │ │ ├── pfswrite_help.h │ │ ├── pfstransform_colorspace_help.h │ │ ├── pfsread_help.h │ │ ├── pfsput_help.h │ │ └── pfsopen_help.h │ ├── pfsget.help │ ├── pfs_close_frames.m │ ├── pfswrite.help │ ├── pfstransform_colorspace.help │ ├── pfsput.help │ ├── pfsread.help │ ├── pfs_read_luminance.m │ ├── pfs_read_xyz.m │ ├── pfsview_list.m │ ├── pfs_read_rgb.m │ ├── pfs_write_rgb.m │ ├── pfsoctavergb.1 │ ├── pfsoctavelum.1 │ ├── pfsview_rgb.m │ ├── pfscrop │ ├── pfsopen.help │ ├── pfs_open_frames.m │ ├── pfsstat.1 │ ├── octave_util.h │ ├── pfssize.m │ ├── CMakeLists.txt │ └── pfsview.m ├── tmo │ ├── mantiuk08 │ │ ├── cqp │ │ │ ├── README.txt │ │ │ └── initial_point.h │ │ ├── CMakeLists.txt │ │ └── display_size.h │ ├── mai11 │ │ ├── compression_tmo.h │ │ ├── CMakeLists.txt │ │ └── pfstmo_mai11.1 │ ├── CMakeLists.txt │ ├── drago03 │ │ ├── CMakeLists.txt │ │ ├── pfstmo_drago03.1 │ │ └── tmo_drago03.h │ ├── mantiuk06 │ │ └── CMakeLists.txt │ ├── reinhard05 │ │ ├── CMakeLists.txt │ │ ├── pfstmo_reinhard05.1 │ │ └── tmo_reinhard05.h │ ├── pattanaik00 │ │ └── CMakeLists.txt │ ├── reinhard02 │ │ ├── CMakeLists.txt │ │ ├── tmo_reinhard02.h │ │ └── pfstmo_reinhard02.1 │ ├── ferradans11 │ │ ├── CMakeLists.txt │ │ └── pfstmo_ferradans11.1 │ ├── durand02 │ │ ├── CMakeLists.txt │ │ ├── fastbilateral.h │ │ ├── bilateral.h │ │ └── pfstmo_durand02.1 │ └── fattal02 │ │ └── CMakeLists.txt ├── pfs │ ├── pfs.pc.in │ └── CMakeLists.txt ├── filter │ ├── pfsextractchannels.1 │ ├── CMakeLists.txt │ ├── pfsflip.1 │ ├── pfsrotate.1 │ ├── pfstag.1 │ ├── pfsclamp.1 │ ├── pfscat.1 │ ├── pfsretime.1 │ ├── pfscolortransform.1 │ ├── pfsabsolute.1 │ ├── pfspad.1 │ ├── pfscut.1 │ ├── pfsgamma.1 │ └── pfssize.1 ├── fileformat │ ├── pfsinjpeghdr.1 │ ├── pfsingdal.1 │ ├── pfsinpfm.1 │ ├── pfsoutpfm.1 │ ├── pfsoutffmpeg.1 │ ├── pfsout.1 │ ├── pfsindcraw.1 │ ├── pfsinmulti.1 │ ├── pfsindcraw.in │ ├── exrio.h │ ├── ppmio.h │ ├── rgbeio.h │ └── pfsoutffmpeg ├── camera │ ├── pfsplotresponse.1 │ ├── jpeg2hdrgen.1 │ ├── dcraw2hdrgen.1 │ ├── pfsinme.1 │ ├── mitsunaga99_numerical.h │ ├── CMakeLists.txt │ ├── pfsplotresponse.in │ ├── pfsinhdrgen.1 │ ├── pfsinme.in │ └── pfsinhdrgen.in ├── CMakeLists.txt └── pfsglview │ ├── winstat.h │ ├── CMakeLists.txt │ ├── glenv.h │ ├── histogram.h │ ├── m_on_screen_display.h │ └── module.h ├── doc └── data_model.png ├── TODO ├── README.OSX ├── make_src_dist.sh ├── AUTHORS ├── README.Cygwin ├── cmake ├── FindTIFF.cmake ├── FindFFTW.cmake ├── FindNETPBM.cmake └── FindEXIF.cmake ├── README.VisualStudio └── cmake_config.h.in /debian/compat: -------------------------------------------------------------------------------- 1 | 4 2 | -------------------------------------------------------------------------------- /debian/dirs: -------------------------------------------------------------------------------- 1 | usr/bin 2 | -------------------------------------------------------------------------------- /debian/pfstools.dir: -------------------------------------------------------------------------------- 1 | usr/bin 2 | -------------------------------------------------------------------------------- /debian/libpfstools1.dirs: -------------------------------------------------------------------------------- 1 | usr/lib 2 | -------------------------------------------------------------------------------- /src/pfsview/mac_os/PkgInfo: -------------------------------------------------------------------------------- 1 | APPL???? 2 | -------------------------------------------------------------------------------- /debian/libpfstools.install: -------------------------------------------------------------------------------- 1 | usr/lib/libpfs*.so* 2 | -------------------------------------------------------------------------------- /debian/libpfstools1.install: -------------------------------------------------------------------------------- 1 | usr/lib/lib*.so.* 2 | -------------------------------------------------------------------------------- /debian/libpfstools-dev.dirs: -------------------------------------------------------------------------------- 1 | usr/lib 2 | usr/include 3 | -------------------------------------------------------------------------------- /debian/pfstools.install: -------------------------------------------------------------------------------- 1 | usr/bin/ 2 | usr/share/man/man1 3 | -------------------------------------------------------------------------------- /debian/octave-pfstools.install: -------------------------------------------------------------------------------- 1 | /usr/lib/octave/* 2 | /usr/share/octave/* 3 | -------------------------------------------------------------------------------- /src/matlab/compile_win32.bat: -------------------------------------------------------------------------------- 1 | 2 | nmake -f Makefile.win32 3 | 4 | 5 | -------------------------------------------------------------------------------- /doc/data_model.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Steve132/pfstools/HEAD/doc/data_model.png -------------------------------------------------------------------------------- /debian/libpfstools-dev.install: -------------------------------------------------------------------------------- 1 | usr/include/* 2 | usr/lib/lib*.a 3 | usr/lib/pkgconfig/* 4 | usr/lib/*.la 5 | -------------------------------------------------------------------------------- /debian/docs: -------------------------------------------------------------------------------- 1 | NEWS 2 | README 3 | TODO 4 | doc/faq.txt 5 | doc/pfs_format_spec.tex 6 | doc/pfs_format_spec.pdf 7 | -------------------------------------------------------------------------------- /src/pfsview/icons/appicon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Steve132/pfstools/HEAD/src/pfsview/icons/appicon.png -------------------------------------------------------------------------------- /src/pfsview/mac_os/pfsview_icon_mac.icns: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Steve132/pfstools/HEAD/src/pfsview/mac_os/pfsview_icon_mac.icns -------------------------------------------------------------------------------- /src/getopt/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | 2 | include_directories ("${PROJECT_BINARY_DIR}/") 3 | add_library(getopt OBJECT getopt.c getopt.h) 4 | 5 | -------------------------------------------------------------------------------- /src/pfsview/pfsview.qrc: -------------------------------------------------------------------------------- 1 | 2 | 3 | icons/appicon.png 4 | 5 | 6 | -------------------------------------------------------------------------------- /src/matlab/pfspclose.m: -------------------------------------------------------------------------------- 1 | % Close fifo pipe. Used internally by pfstools. 2 | % 3 | % pfspclose( fid ) 4 | % 5 | % fid - file descriptor returned by pfspopen 6 | -------------------------------------------------------------------------------- /debian/changelog: -------------------------------------------------------------------------------- 1 | pfstools (1.2.1-1) unstable; urgency=low 2 | 3 | * Initial release 4 | 5 | -- Andreas Hirczy Wed, 26 Oct 2005 23:20:58 +0200 6 | 7 | -------------------------------------------------------------------------------- /src/hdrhtml/hdrhtml_hdrlabs_templ/hdrhtml_assets/information.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Steve132/pfstools/HEAD/src/hdrhtml/hdrhtml_hdrlabs_templ/hdrhtml_assets/information.png -------------------------------------------------------------------------------- /src/hdrhtml/hdrhtml_hdrlabs_templ/hdrhtml_assets/slider-black.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Steve132/pfstools/HEAD/src/hdrhtml/hdrhtml_hdrlabs_templ/hdrhtml_assets/slider-black.png -------------------------------------------------------------------------------- /src/hdrhtml/hdrhtml_hdrlabs_templ/hdrhtml_assets/slider-red.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Steve132/pfstools/HEAD/src/hdrhtml/hdrhtml_hdrlabs_templ/hdrhtml_assets/slider-red.png -------------------------------------------------------------------------------- /src/hdrhtml/hdrhtml_hdrlabs_templ/hdrhtml_assets/slider-white.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Steve132/pfstools/HEAD/src/hdrhtml/hdrhtml_hdrlabs_templ/hdrhtml_assets/slider-white.png -------------------------------------------------------------------------------- /src/octave/pfsclose.help: -------------------------------------------------------------------------------- 1 | Close pfs stream. See also help for pfsopen function. 2 | 3 | usage: pfsclose( pfs_struct ); 4 | pfs_struct - structure returned by pfsopen or pfsget 5 | -------------------------------------------------------------------------------- /src/matlab/pfsclose.m: -------------------------------------------------------------------------------- 1 | % Close pfs stream. See also help for pfsopen function. 2 | % 3 | % usage: pfsclose( pfs_struct ); 4 | % pfs_struct - structure returned by pfsopen or pfsget 5 | -------------------------------------------------------------------------------- /src/hdrhtml/hdrhtml_hdrlabs_templ/hdrhtml_assets/information-red.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Steve132/pfstools/HEAD/src/hdrhtml/hdrhtml_hdrlabs_templ/hdrhtml_assets/information-red.png -------------------------------------------------------------------------------- /src/hdrhtml/hdrhtml_hdrlabs_templ/hdrhtml_assets/loading-spinner.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Steve132/pfstools/HEAD/src/hdrhtml/hdrhtml_hdrlabs_templ/hdrhtml_assets/loading-spinner.gif -------------------------------------------------------------------------------- /src/octave/help_files/pfsclose_help.h: -------------------------------------------------------------------------------- 1 | "Close pfs stream. See also help for pfsopen function.\n" 2 | "\n" 3 | "usage: pfsclose( pfs_struct );\n" 4 | "\n pfs_struct - structure returned by pfsopen or pfsget" 5 | ; 6 | -------------------------------------------------------------------------------- /src/tmo/mantiuk08/cqp/README.txt: -------------------------------------------------------------------------------- 1 | This directory contains: 2 | 3 | CQP - Convex Quadratic Programming by Ewgenij Hübner 4 | URL: http://ra.uni-trier.de/~huebner/software.html 5 | 6 | with several modification that allow to run the solver without 7 | equality constraints. 8 | 9 | 10 | -------------------------------------------------------------------------------- /src/octave/pfsget.help: -------------------------------------------------------------------------------- 1 | Read next frame from the pfs stream. See also help for pfsopen function. 2 | 3 | usage: new_pfs_struct = pfsget( pfs_struct ); 4 | pfs_struct - the structure returned by pfsopen or pfsget 5 | new_pfs_struct - new structure with new fields containing channels and tags 6 | -------------------------------------------------------------------------------- /src/matlab/pfsget.m: -------------------------------------------------------------------------------- 1 | % Read next frame from the pfs stream. See also help for pfsopen function. 2 | % 3 | % usage: new_pfs_struct = pfsget( pfs_struct ); 4 | % pfs_struct - the structure returned by pfsopen or pfsget 5 | % new_pfs_struct - new structure with new fields containing channels and tags 6 | -------------------------------------------------------------------------------- /src/pfs/pfs.pc.in: -------------------------------------------------------------------------------- 1 | prefix=@prefix@ 2 | exec_prefix=${prefix} 3 | libdir=${prefix}/lib 4 | includedir=${prefix}/include 5 | 6 | Name: PFS 7 | Description: Library for manipulating pfs image format 8 | Requires: 9 | Version: @PACKAGE_VERSION@ 10 | Libs: -L${libdir} -lpfs 11 | Cflags: -I${includedir}/pfs 12 | -------------------------------------------------------------------------------- /TODO: -------------------------------------------------------------------------------- 1 | Some planned changes 2 | 3 | * pfsview should use OpenGL and GLSL for better performance 4 | * Add support for ICC color profiles (litecms) 5 | * pfssize should use better filters when downsizing 6 | * Performance improvements: 7 | * Shared memory instead of pipes 8 | * "Lazy" color space transform 9 | 10 | -------------------------------------------------------------------------------- /src/octave/help_files/pfsget_help.h: -------------------------------------------------------------------------------- 1 | "Read next frame from the pfs stream. See also help for pfsopen function.\n" 2 | "\n" 3 | "usage: new_pfs_struct = pfsget( pfs_struct );\n" 4 | " pfs_struct - the structure returned by pfsopen or pfsget\n" 5 | " new_pfs_struct - new structure with new fields containing channels and tags\n" 6 | ; 7 | -------------------------------------------------------------------------------- /src/pfsview/pfsv.in: -------------------------------------------------------------------------------- 1 | #!@BASH_PATH@ 2 | ############################################################ 3 | # View HDR images 4 | ############################################################ 5 | 6 | if [ -z "$1" ]; then 7 | echo "View HDR images"; 8 | echo "Usage: pfsv [...]" 9 | exit 0; 10 | fi 11 | 12 | pfsin "$@" | pfsview 13 | -------------------------------------------------------------------------------- /debian/README.Debian: -------------------------------------------------------------------------------- 1 | pfstools for Debian 2 | ---------------------- 3 | 4 | create 4 packages: 5 | 6 | - pfstools: binaries 7 | 8 | - libpfstools: shared libraries 9 | 10 | - libpfstools-dev: static libraries and header files 11 | 12 | - octave-pfstools: ovctave binding 13 | 14 | -- Andreas Hirczy , Thu Oct 27 16:25:44 2005 15 | -------------------------------------------------------------------------------- /src/tmo/mai11/compression_tmo.h: -------------------------------------------------------------------------------- 1 | #ifndef COMPRESSION_TMO 2 | #define COMPRESSION_TMO 3 | 4 | #include 5 | 6 | class CompressionTMO 7 | { 8 | public: 9 | void tonemap(const float *R_in, const float *G_in, float *B_in, int width, int height, 10 | float *R_out, float *G_out, float *B_out, const float *L_in, 11 | pfstmo_progress_callback progress_cb = NULL ); 12 | }; 13 | 14 | 15 | #endif 16 | -------------------------------------------------------------------------------- /src/tmo/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_subdirectory (drago03) 2 | add_subdirectory (mantiuk06) 3 | add_subdirectory (reinhard02) 4 | add_subdirectory (reinhard05) 5 | add_subdirectory (pattanaik00) 6 | add_subdirectory (fattal02) 7 | add_subdirectory (durand02) 8 | add_subdirectory (mai11) 9 | 10 | if( FFTW_FOUND ) 11 | add_subdirectory (ferradans11) 12 | endif( FFTW_FOUND ) 13 | 14 | if( GSL_FOUND ) 15 | add_subdirectory (mantiuk08) 16 | endif( GSL_FOUND ) 17 | -------------------------------------------------------------------------------- /src/matlab/pfspopen.m: -------------------------------------------------------------------------------- 1 | % Execute the command line and create a fifo pipe for reading/writing 2 | % output/input. Used internally by pfstools. 3 | % 4 | % fid = pfspopen( command_line, mode ) 5 | % 6 | % command_line - shell command line that should be executed 7 | % mode - either 'r' for reading output, or 'w' for writing input 8 | % fid - file ID, which should be passed to pfsopen 9 | % 10 | % Always use pfspclose() to close the pipe created with pfspopen 11 | -------------------------------------------------------------------------------- /src/octave/pfs_close_frames.m: -------------------------------------------------------------------------------- 1 | function pfs_close_frames( pfs_struct ) 2 | ## Close pfs stream opened with pfs_open_frames. Removes all temporary 3 | ## files. 4 | ## 5 | ## usage: pfs_close_frames( pfs_struct ) 6 | ## 7 | 8 | if( !isfield( pfs_struct, "fid" ) ) 9 | error( "pfs_close_frames: pfs_struct wasn't opened with pfs_open_frames\n" ); 10 | endif 11 | 12 | pfsclose( pfs_struct ); 13 | fclose( pfs_struct.fid ); 14 | 15 | endfunction 16 | -------------------------------------------------------------------------------- /src/octave/pfswrite.help: -------------------------------------------------------------------------------- 1 | DEPRECIATED! Use pfsopen/pfsput/pfsclose instead 2 | Write matrices as channels in PFS format to stdout. 3 | 4 | usage: pfswrite( fileName, c1n, C1, c2n, C2, ...); 5 | fileName - name of the file to write, or \"stdout\" for standard output 6 | c1n - name of the first channel 7 | C1 - matrix with the first channel 8 | c2n - name of the second channel 9 | C2 - matrix with the second channel 10 | 11 | Channel names are case sensitive 12 | -------------------------------------------------------------------------------- /src/octave/pfstransform_colorspace.help: -------------------------------------------------------------------------------- 1 | Tranform between color spaces using pfs library. 2 | 3 | usage: [C1 C2 C2] = pfstranform_colorspace( inCSname, c1, c2, c3, outCSname ); 4 | inCSname - name of the input color space 5 | c - matrix with n-th channel of input color space 6 | C - matrix with n-th channel of output color space 7 | outCSname - name of the output color space 8 | 9 | Recognized color space names: 'XYZ', 'RGB', 'sRGB', 'YUV', 'Yxy'. 10 | Color space names are case insensitive. 11 | -------------------------------------------------------------------------------- /README.OSX: -------------------------------------------------------------------------------- 1 | To compile pfstools from sources on OSX, you need: 2 | 1. XCode 3 | 2. Any of: 4 | Homebrew - http://brew.sh/ (recommended) 5 | Fink - http://www.finkproject.org/ 6 | MacPorts - https://www.macports.org/ 7 | 8 | Refer to REAME file for the instruction on how to compile with cmake. 9 | 10 | ===== Image Magick ===== 11 | 12 | In case of problems with ImageMagick on Mountain Lion: 13 | 14 | brew install libtool --universal 15 | brew link libtool --force 16 | brew install imagemagick --with-magick-plus-plus 17 | 18 | -------------------------------------------------------------------------------- /src/octave/help_files/pfswrite_help.h: -------------------------------------------------------------------------------- 1 | "DEPRECIATED! Use pfsopen/pfsput/pfsclose instead\n" 2 | "Write matrices as channels in PFS format to stdout.\n" 3 | "\n" 4 | "usage: pfswrite( fileName, c1n, C1, c2n, C2, ...);\n" 5 | " fileName - name of the file to write, or \"stdout\" for standard output\n" 6 | " c1n - name of the first channel\n" 7 | " C1 - matrix with the first channel\n" 8 | " c2n - name of the second channel\n" 9 | " C2 - matrix with the second channel\n" 10 | "\n" 11 | "Channel names are case sensitive\n" 12 | ; 13 | -------------------------------------------------------------------------------- /src/tmo/drago03/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | include_directories ("${PROJECT_BINARY_DIR}/" 2 | "${PROJECT_SOURCE_DIR}/src/pfs" "${PROJECT_SOURCE_DIR}/src/tmo/pfstmo") 3 | if( NOT HAS_GETOPT ) 4 | include_directories ("${GETOPT_INCLUDE}") 5 | endif( NOT HAS_GETOPT ) 6 | link_directories("${PROJECT_SOURCE_DIR}/src/pfs") 7 | 8 | set(TRG pfstmo_drago03) 9 | add_executable(${TRG} ${TRG}.cpp tmo_drago03.cpp "${GETOPT_OBJECT}") 10 | target_link_libraries(${TRG} pfs) 11 | install (TARGETS ${TRG} DESTINATION bin) 12 | install (FILES ${TRG}.1 DESTINATION ${MAN_DIR}) 13 | -------------------------------------------------------------------------------- /src/tmo/mai11/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | include_directories ("${PROJECT_BINARY_DIR}/" 2 | "${PROJECT_SOURCE_DIR}/src/pfs" "${PROJECT_SOURCE_DIR}/src/tmo/pfstmo") 3 | if( NOT HAS_GETOPT ) 4 | include_directories ("${GETOPT_INCLUDE}") 5 | endif( NOT HAS_GETOPT ) 6 | link_directories("${PROJECT_SOURCE_DIR}/src/pfs") 7 | 8 | set(TRG pfstmo_mai11) 9 | add_executable(${TRG} ${TRG}.cpp compression_tmo.cpp "${GETOPT_OBJECT}") 10 | target_link_libraries(${TRG} pfs) 11 | install (TARGETS ${TRG} DESTINATION bin) 12 | install (FILES ${TRG}.1 DESTINATION ${MAN_DIR}) 13 | -------------------------------------------------------------------------------- /src/tmo/mantiuk06/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | include_directories ("${PROJECT_BINARY_DIR}/" 2 | "${PROJECT_SOURCE_DIR}/src/pfs" "${PROJECT_SOURCE_DIR}/src/tmo/pfstmo") 3 | if( NOT HAS_GETOPT ) 4 | include_directories ("${GETOPT_INCLUDE}") 5 | endif( NOT HAS_GETOPT ) 6 | link_directories("${PROJECT_SOURCE_DIR}/src/pfs") 7 | 8 | set(TRG pfstmo_mantiuk06) 9 | add_executable(${TRG} ${TRG}.cpp contrast_domain.cpp "${GETOPT_OBJECT}") 10 | target_link_libraries(${TRG} pfs) 11 | install (TARGETS ${TRG} DESTINATION bin) 12 | install (FILES ${TRG}.1 DESTINATION ${MAN_DIR}) 13 | -------------------------------------------------------------------------------- /src/tmo/reinhard05/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | include_directories ("${PROJECT_BINARY_DIR}/" 2 | "${PROJECT_SOURCE_DIR}/src/pfs" "${PROJECT_SOURCE_DIR}/src/tmo/pfstmo") 3 | if( NOT HAS_GETOPT ) 4 | include_directories ("${GETOPT_INCLUDE}") 5 | endif( NOT HAS_GETOPT ) 6 | link_directories("${PROJECT_SOURCE_DIR}/src/pfs") 7 | 8 | set(TRG pfstmo_reinhard05) 9 | add_executable(${TRG} ${TRG}.cpp tmo_reinhard05.cpp "${GETOPT_OBJECT}") 10 | target_link_libraries(${TRG} pfs) 11 | install (TARGETS ${TRG} DESTINATION bin) 12 | install (FILES ${TRG}.1 DESTINATION ${MAN_DIR}) 13 | -------------------------------------------------------------------------------- /src/tmo/pattanaik00/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | include_directories ("${PROJECT_BINARY_DIR}/" 2 | "${PROJECT_SOURCE_DIR}/src/pfs" "${PROJECT_SOURCE_DIR}/src/tmo/pfstmo") 3 | if( NOT HAS_GETOPT ) 4 | include_directories ("${GETOPT_INCLUDE}") 5 | endif( NOT HAS_GETOPT ) 6 | link_directories("${PROJECT_SOURCE_DIR}/src/pfs") 7 | 8 | set(TRG pfstmo_pattanaik00) 9 | add_executable(${TRG} ${TRG}.cpp tmo_pattanaik00.cpp "${GETOPT_OBJECT}") 10 | target_link_libraries(${TRG} pfs) 11 | install (TARGETS ${TRG} DESTINATION bin) 12 | install (FILES ${TRG}.1 DESTINATION ${MAN_DIR}) 13 | -------------------------------------------------------------------------------- /src/pfsview/mac_os/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleIconFile 6 | pfsview_icon_mac.icns 7 | CFBundlePackageType 8 | APPL 9 | CFBundleGetInfoString 10 | pfstools 1.8 11 | CFBundleSignature 12 | ttxt 13 | CFBundleExecutable 14 | pfsview 15 | 16 | 17 | -------------------------------------------------------------------------------- /src/octave/help_files/pfstransform_colorspace_help.h: -------------------------------------------------------------------------------- 1 | "Tranform between color spaces using pfs library.\n" 2 | "\n" 3 | "usage: [C1 C2 C2] = pfstranform_colorspace( inCSname, c1, c2, c3, outCSname );\n" 4 | " inCSname - name of the input color space\n" 5 | " c - matrix with n-th channel of input color space\n" 6 | " C - matrix with n-th channel of output color space\n" 7 | " outCSname - name of the output color space\n" 8 | "\n" 9 | "Recognized color space names: 'XYZ', 'RGB', 'sRGB', 'YUV', 'Yxy'.\n" 10 | "Color space names are case insensitive.\n" 11 | ; 12 | -------------------------------------------------------------------------------- /src/tmo/reinhard02/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | include_directories ("${PROJECT_BINARY_DIR}/" 2 | "${PROJECT_SOURCE_DIR}/src/pfs" "${PROJECT_SOURCE_DIR}/src/tmo/pfstmo") 3 | if( NOT HAS_GETOPT ) 4 | include_directories ("${GETOPT_INCLUDE}") 5 | endif( NOT HAS_GETOPT ) 6 | link_directories("${PROJECT_SOURCE_DIR}/src/pfs") 7 | 8 | set(TRG pfstmo_reinhard02) 9 | add_executable(${TRG} ${TRG}.cpp tmo_reinhard02.cpp approx.cpp "${GETOPT_OBJECT}") 10 | target_link_libraries(${TRG} pfs) 11 | install (TARGETS ${TRG} DESTINATION bin) 12 | install (FILES ${TRG}.1 DESTINATION ${MAN_DIR}) 13 | -------------------------------------------------------------------------------- /src/octave/pfsput.help: -------------------------------------------------------------------------------- 1 | Write frame to the pfs stream. See also help for pfsopen function. 2 | 3 | usage: pfsput( pfs_struct ); 4 | pfs_struct - the structure returned by pfsopen. The stream must be open for writing 5 | 6 | Typical usage: 7 | 8 | ## Create you image 9 | Y = ones( 512, 512 ); 10 | Y(256,:) = 10; 11 | 12 | ## Create pfs stream for writing 13 | pout = pfsopen( \"output.pfs\", size( Y ) ); 14 | 15 | ## Add channels 16 | pout.channels.Y = Y; 17 | 18 | ## Write frame. You can 'put' multiple frames. 19 | pfsput( pout ); 20 | 21 | ##Close stream 22 | pfsclose( pout ) 23 | 24 | -------------------------------------------------------------------------------- /src/tmo/ferradans11/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | include_directories ("${PROJECT_BINARY_DIR}/" 2 | "${PROJECT_SOURCE_DIR}/src/pfs" "${PROJECT_SOURCE_DIR}/src/tmo/pfstmo") 3 | 4 | if( NOT HAS_GETOPT ) 5 | include_directories ("${GETOPT_INCLUDE}") 6 | endif( NOT HAS_GETOPT ) 7 | 8 | link_directories("${PROJECT_SOURCE_DIR}/src/pfs") 9 | 10 | set(TRG pfstmo_ferradans11) 11 | add_executable(${TRG} ${TRG}.cpp Imagen.cpp tmo_ferradans11.cpp "${GETOPT_OBJECT}") 12 | target_link_libraries(${TRG} pfs ${FFTW_LIBS}) 13 | install (TARGETS ${TRG} DESTINATION bin) 14 | install (FILES ${TRG}.1 DESTINATION ${MAN_DIR}) 15 | -------------------------------------------------------------------------------- /src/octave/pfsread.help: -------------------------------------------------------------------------------- 1 | DEPRECIATED! Use pfsopen/pfsget/pfsclose instead 2 | Read selected PFS channels from stdin. 3 | 4 | usage: [C1 C2 ...] = pfsread( fileName, c1n, c2n, ...); 5 | fileName - name of the file to read, or \"stdin\" for standard input 6 | c1n - name of the first channel 7 | c2n - name of the second channel 8 | C1 - matrix with the first channel 9 | C2 - matrix with the second channel 10 | 11 | Channel names are case sensitive 12 | 13 | Returns \"EOF\" strings instead of matrices if there are no more frames. Note the function can read multiple frames only from the stdin 14 | -------------------------------------------------------------------------------- /src/hdrhtml/hdrhtml_c_b2.csv: -------------------------------------------------------------------------------- 1 | 1.000000, 0.000000 2 | 1.000000, 0.029169 3 | 1.000000, 0.063614 4 | 1.000000, 0.100425 5 | 1.000000, 0.139501 6 | 1.000000, 0.180528 7 | 1.000000, 0.223219 8 | 1.000000, 0.267228 9 | 1.000000, 0.312396 10 | 1.000000, 0.358571 11 | 1.000000, 0.405153 12 | 1.000000, 0.451895 13 | 1.000000, 0.498571 14 | 1.000000, 0.544955 15 | 1.000000, 0.590843 16 | 1.000000, 0.636067 17 | 1.000000, 0.680764 18 | 1.000000, 0.724061 19 | 1.000000, 0.766052 20 | 1.000000, 0.806596 21 | 1.000000, 0.845547 22 | 1.000000, 0.882793 23 | 1.000000, 0.918213 24 | 1.000000, 0.951773 25 | 0.985495, 0.983571 26 | -------------------------------------------------------------------------------- /make_src_dist.sh: -------------------------------------------------------------------------------- 1 | #/bin/bash 2 | # 3 | # This script is used to create a clean source distribution (starting from 2.0.0) 4 | # 5 | 6 | REL=2.0.3 7 | 8 | DIR="pfstools-${REL}" 9 | DEST="${DIR}.tgz" 10 | 11 | echo "Preparing ${DEST}" 12 | 13 | cd .. 14 | 15 | # Create a clean copy 16 | rm -rf ${DIR} 17 | rm -rf ${DEST} 18 | cp -r pfstools ${DIR} 19 | 20 | # Remove unnecessary files 21 | rm -rf ${DIR}/.git 22 | rm -rf ${DIR}/.nfs* 23 | rm -r ${DIR}/debian 24 | rm -r ${DIR}/build 25 | rm ${DIR}/make_src_dist.sh 26 | 27 | # Put into .tgz 28 | tar -czf ${DEST} ${DIR} 29 | 30 | # Test 31 | tar -tzf ${DEST} ${DIR} 32 | -------------------------------------------------------------------------------- /src/filter/pfsextractchannels.1: -------------------------------------------------------------------------------- 1 | .TH "pfsextractchannels" 1 2 | .SH NAME 3 | pfsextractchannels \- Extract selected channels from the stream 4 | .SH SYNOPSIS 5 | .B pfsextractchannels 6 | [ ...] 7 | .SH DESCRIPTION 8 | Removes all channels from the pfs stream that are not listed in arguments. 9 | 10 | .SH EXAMPLES 11 | .TP 12 | pfsin memorial.hdr | pfsextractchannels Y | pfsview 13 | 14 | View luminance channel of the memorial image. 15 | 16 | .SH "SEE ALSO" 17 | .BR pfsin (1) 18 | .BR pfsout (1) 19 | .SH BUGS 20 | Please report bugs and comments to Rafal Mantiuk 21 | . 22 | -------------------------------------------------------------------------------- /src/matlab/pfsput.m: -------------------------------------------------------------------------------- 1 | % Write frame to the pfs stream. See also help for pfsopen function. 2 | % 3 | % usage: pfsput( pfs_struct ); 4 | % pfs_struct - the structure returned by pfsopen. The stream must be open for writing 5 | % 6 | % Typical usage: 7 | % 8 | % ## Create you image 9 | % Y = ones( 512, 512 ); 10 | % Y(256,:) = 10; 11 | % 12 | % ## Create pfs stream for writing 13 | % pout = pfsopen( \"output.pfs\", size( Y ) ); 14 | % 15 | % ## Add channels 16 | % pout.channels.Y = Y; 17 | % 18 | % ## Write frame. You can 'put' multiple frames. 19 | % pfsput( pout ); 20 | % 21 | % ##Close stream 22 | % pfsclose( pout ) 23 | -------------------------------------------------------------------------------- /AUTHORS: -------------------------------------------------------------------------------- 1 | The project is currently maintained by: 2 | 3 | Rafal Mantiuk 4 | 5 | Multiple people contributed to the project, including (in arbitrary order): 6 | 7 | Grzegorz Krawczyk 8 | Miloslaw Smyk 9 | Ivo Ihrke 10 | Alexander Efremov 11 | Dorota Zdrojewska 12 | Jan Otop 13 | Christian Bloch (Improved templates for HDR-HTML in src/hdthtml/hdrhtml_hdrlabs_templ) 14 | Radoslaw Mantiuk 15 | Oliver Barth 16 | Delvin Varghese 17 | Hugo Brito Lima 18 | -------------------------------------------------------------------------------- /README.Cygwin: -------------------------------------------------------------------------------- 1 | pfstools can be compiled under Windows from the cygwin 2 | environment. You can download cygwin from: http://www.cygwin.com/ 3 | 4 | The compilation with cygwin was tested on 4 Oct 2014 using 5 | cmake. Refer to the README file for the instruction how to compile 6 | with cmake. 7 | 8 | You may need to install x window client to use pfsview or pfsglview. 9 | 10 | Check README file for the complete list of dependencies. 11 | 12 | OpenEXR library must be build from sources since no cygwin development package is 13 | available. Sources can be downloaded from http://www.openexr.com/. It is recommended to use cmake to compile OpenEXR. 14 | 15 | -------------------------------------------------------------------------------- /src/octave/help_files/pfsread_help.h: -------------------------------------------------------------------------------- 1 | "DEPRECIATED! Use pfsopen/pfsget/pfsclose instead\n" 2 | "Read selected PFS channels from stdin.\n" 3 | "\n" 4 | "usage: [C1 C2 ...] = pfsread( fileName, c1n, c2n, ...);\n" 5 | " fileName - name of the file to read, or \"stdin\" for standard input\n" 6 | " c1n - name of the first channel\n" 7 | " c2n - name of the second channel\n" 8 | " C1 - matrix with the first channel\n" 9 | " C2 - matrix with the second channel\n" 10 | "\n" 11 | "Channel names are case sensitive\n" 12 | "\n" 13 | "Returns \"EOF\" strings instead of matrices if there are no more frames. Note the function can read multiple frames only from the stdin" 14 | ; 15 | -------------------------------------------------------------------------------- /src/fileformat/pfsinjpeghdr.1: -------------------------------------------------------------------------------- 1 | .TH "pfsinjpeghdr" 1 2 | .SH NAME 3 | pfsinjpeghdr \- Load images or frames in JPEG-HDR format 4 | .SH SYNOPSIS 5 | .B pfsinjpeghdr 6 | 7 | 8 | .SH DESCRIPTION 9 | Use this command to read JPEG file with HDR extension. This software 10 | makes use of the High Dynamic Range Imaging Library from Sunnybrook 11 | Technologies Inc. (c) Sunnybrook Inc. 2005 12 | 13 | .SH EXAMPLES 14 | .TP 15 | pfsinhdrjpeg memorial.jpeg | pfsout memorial.hdr 16 | 17 | Converts from one HDR format to another 18 | .SH BUGS 19 | Please report bugs and comments to Rafal Mantiuk 20 | . 21 | .SH "SEE ALSO" 22 | .BR pfsoutjpeghdr (1) 23 | 24 | 25 | -------------------------------------------------------------------------------- /src/octave/help_files/pfsput_help.h: -------------------------------------------------------------------------------- 1 | "Write frame to the pfs stream. See also help for pfsopen function.\n" 2 | "\n" 3 | "usage: pfsput( pfs_struct );\n" 4 | " pfs_struct - the structure returned by pfsopen. The stream must be open for writing\n" 5 | "\n" 6 | "Typical usage:\n" 7 | "\n" 8 | "## Create you image \n" 9 | "Y = ones( 512, 512 );\n" 10 | "Y(256,:) = 10;\n" 11 | "\n" 12 | "## Create pfs stream for writing\n" 13 | "pout = pfsopen( \"output.pfs\", size( Y ) );\n" 14 | "\n" 15 | "## Add channels\n" 16 | "pout.channels.Y = Y;\n" 17 | "\n" 18 | "## Write frame. You can 'put' multiple frames.\n" 19 | "pfsput( pout );\n" 20 | "\n" 21 | "##Close stream\n" 22 | "pfsclose( pout )\n" 23 | ; 24 | -------------------------------------------------------------------------------- /src/tmo/mantiuk08/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | include_directories ("${PROJECT_BINARY_DIR}/" 2 | "${PROJECT_SOURCE_DIR}/src/pfs" "${PROJECT_SOURCE_DIR}/src/tmo/pfstmo" "${GSL_INCLUDE_DIR}") 3 | 4 | if( NOT HAS_GETOPT ) 5 | include_directories ("${GETOPT_INCLUDE}") 6 | endif( NOT HAS_GETOPT ) 7 | 8 | link_directories("${PROJECT_SOURCE_DIR}/src/pfs") 9 | 10 | set(TRG pfstmo_mantiuk08) 11 | add_executable(${TRG} ${TRG}.cpp display_adaptive_tmo.cpp display_function.cpp display_size.cpp cqp/cqpminimizer.cpp cqp/initial_point.cpp cqp/mg_pdip.cpp "${GETOPT_OBJECT}") 12 | target_link_libraries(${TRG} pfs ${GSL_LIBRARIES}) 13 | install (TARGETS ${TRG} DESTINATION bin) 14 | install (FILES ${TRG}.1 DESTINATION ${MAN_DIR}) 15 | -------------------------------------------------------------------------------- /src/hdrhtml/hdrhtml_t_b2.csv: -------------------------------------------------------------------------------- 1 | 0.0078125,0 2 | 0.0099575,0 3 | 0.012691,0 4 | 0.016176,0.034072 5 | 0.020617,0.072078 6 | 0.026278,0.11268 7 | 0.033493,0.15532 8 | 0.042689,0.20165 9 | 0.054409,0.24921 10 | 0.069348,0.29912 11 | 0.088388,0.35227 12 | 0.11266,0.40442 13 | 0.14359,0.45943 14 | 0.18301,0.51602 15 | 0.23326,0.57033 16 | 0.2973,0.62743 17 | 0.37893,0.68417 18 | 0.48297,0.73784 19 | 0.61557,0.79391 20 | 0.78458,0.84724 21 | 1,0.89681 22 | 1.2746,0.93968 23 | 1.6245,0.97889 24 | 2.0705,1 25 | 2.639,1 26 | 3.3636,1 27 | 4.2871,1 28 | 5.4642,1 29 | 6.9644,1 30 | 8.8766,1 31 | 11.314,1 32 | 14.42,1 33 | 18.379,1 34 | 23.425,1 35 | 29.857,1 36 | 38.055,1 37 | 48.503,1 38 | 61.82,1 39 | 78.793,1 40 | 100.43,1 41 | 128,1 42 | -------------------------------------------------------------------------------- /src/pfsview/pfsv.1: -------------------------------------------------------------------------------- 1 | .TH "pfsv" 1 2 | .SH NAME 3 | pfsv \- Viewer for high-dynamic range images 4 | .SH SYNOPSIS 5 | .B pfsv 6 | [files...] 7 | .SH DESCRIPTION 8 | Display a HDR image or sequence of images using pfsview. This is a 9 | shell wrapper that invokes pfsin to load an image in one of the 10 | several recognized formats (see pfsin for the list of formats) and 11 | displays it using pfsview. 12 | 13 | Note: This program was renamed from \fBpv\fR to avoid conflict with 14 | the pipe viewer 'pv'. 15 | .SH EXAMPLES 16 | .TP 17 | pfsv memorial.hdr 18 | Display memorial image. 19 | 20 | .SH "SEE ALSO" 21 | .BR pfsview (1) 22 | .BR pfsin (1) 23 | 24 | .SH BUGS 25 | Please report bugs and comments to Rafal Mantiuk 26 | . 27 | -------------------------------------------------------------------------------- /src/octave/pfs_read_luminance.m: -------------------------------------------------------------------------------- 1 | function Y = pfs_read_luminance( fileName ) 2 | ## Read hdr image file (formats accepted by pfsin) and return 3 | ## luminance channel Y. 4 | ## 5 | ## Y = hdr_read_luminance( fileName ) 6 | 7 | ## Check if file exists 8 | fid = fopen( fileName, "rb" ); 9 | if( fid == -1 ) 10 | error( sprintf( "pfs_read_luminance: File '%s' does not exist", fileName ) ); 11 | endif 12 | fclose( fid ); 13 | 14 | unwind_protect 15 | fid = popen( sprintf( "pfsin %s", fileName ), "r" ); 16 | pin = pfsopen( fid ); 17 | pin = pfsget( pin ); 18 | Y = pin.channels.Y; 19 | 20 | unwind_protect_cleanup 21 | pfsclose( pin ); 22 | fclose( fid ); 23 | end_unwind_protect 24 | 25 | endfunction 26 | -------------------------------------------------------------------------------- /src/camera/pfsplotresponse.1: -------------------------------------------------------------------------------- 1 | .TH "pfsplotresponse" 1 2 | .SH NAME 3 | pfsplotresponse \- Plot camera response curve using Gnuplot 4 | 5 | .SH SYNOPSIS 6 | .B pfsplotresponse [ [...]] 7 | 8 | .SH DESCRIPTION 9 | Plot camera response curve generated by \fIpfshdrcalibrate\fR using 10 | Gnuplot. The three curves show separate responses for red, green and 11 | blue color channels. The fourth curve is the weighting function used 12 | to merge the exposures. 13 | 14 | .SH EXAMPLES 15 | .TP 16 | pfsplotresponse canon.resp 17 | Plot the camera response curve from canon.resp. 18 | 19 | .SH "SEE ALSO" 20 | .BR pfshdrcalibrate (1) 21 | .SH BUGS 22 | Please report bugs and comments on implementation to 23 | the discussion group http://groups.google.com/group/pfstools 24 | -------------------------------------------------------------------------------- /src/octave/pfs_read_xyz.m: -------------------------------------------------------------------------------- 1 | function [X Y Z] = pfs_read_xyz( fileName ) 2 | ## Read hdr image file (formats accepted by pfsin) and return X, Y, 3 | ## and Z color channels. 4 | ## 5 | ## [X Y Z] = hdr_read_rgb( fileName ) 6 | 7 | ## Check if file exists 8 | fid = fopen( fileName, "rb" ); 9 | if( fid == -1 ) 10 | error( sprintf( "pfs_read_xyz: File '%s' does not exist", fileName ) ); 11 | endif 12 | fclose( fid ); 13 | 14 | unwind_protect 15 | fid = popen( sprintf( "pfsin %s", fileName ), "r" ); 16 | pin = pfsopen( fid ); 17 | pin = pfsget( pin ); 18 | X = pin.channels.X; 19 | Y = pin.channels.Y; 20 | Z = pin.channels.Z; 21 | unwind_protect_cleanup 22 | pfsclose( pin ); 23 | fclose( fid ); 24 | end_unwind_protect 25 | 26 | -------------------------------------------------------------------------------- /src/octave/pfsview_list.m: -------------------------------------------------------------------------------- 1 | function pfsview_list( M, idx ) 2 | ## Shows list of high-dynamic range matrices using pfsview 3 | ## 4 | ## Usage: pfsview_list( list, idx ) 5 | ## list - list of channels 6 | ## idx - vector of list indexes to show (optional) 7 | 8 | if !exist("idx") 9 | idx = 1:length(M); 10 | endif 11 | 12 | execStr = "pfswrite( hdr_name"; 13 | for i=idx 14 | chStr = sprintf( ", \"ch%d\",real(nth(M,%d))", i, i ); 15 | execStr = [ execStr chStr ]; 16 | endfor 17 | execStr = strcat( execStr, " );" ); 18 | 19 | hdr_name = tmpnam(); 20 | eval( execStr ); 21 | 22 | xv = sprintf ("pfsview <%s", hdr_name); 23 | rm = sprintf ("rm -f %s", hdr_name); 24 | 25 | system (sprintf ("( %s && %s ) > /dev/null 2>&1 &", xv, rm)); 26 | endfunction 27 | 28 | -------------------------------------------------------------------------------- /src/tmo/durand02/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | include_directories ("${PROJECT_BINARY_DIR}/" 2 | "${PROJECT_SOURCE_DIR}/src/pfs" "${PROJECT_SOURCE_DIR}/src/tmo/pfstmo") 3 | if( NOT HAS_GETOPT ) 4 | include_directories ("${GETOPT_INCLUDE}") 5 | endif( NOT HAS_GETOPT ) 6 | 7 | link_directories("${PROJECT_SOURCE_DIR}/src/pfs") 8 | 9 | if( FFTW_FOUND ) 10 | set( FFTW_LIBRARIES ${FFTW_LIBS} ) 11 | set( FAST_BILATERAL "fastbilateral.cpp" ) 12 | else( FFTW_FOUND ) 13 | set( FFTW_LIBRARIES ) 14 | endif( FFTW_FOUND ) 15 | 16 | set(TRG pfstmo_durand02) 17 | add_executable(${TRG} ${TRG}.cpp tmo_durand02.cpp bilateral.cpp "${FAST_BILATERAL}" "${GETOPT_OBJECT}") 18 | target_link_libraries(${TRG} pfs ${FFTW_LIBRARIES}) 19 | install (TARGETS ${TRG} DESTINATION bin) 20 | install (FILES ${TRG}.1 DESTINATION ${MAN_DIR}) 21 | -------------------------------------------------------------------------------- /src/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | if( NOT HAS_GETOPT ) 2 | add_subdirectory (getopt) 3 | endif( NOT HAS_GETOPT ) 4 | 5 | add_subdirectory (pfs) 6 | add_subdirectory (fileformat) 7 | add_subdirectory (filter) 8 | 9 | if( ImageMagick_FOUND ) 10 | add_subdirectory (hdrhtml) 11 | endif( ImageMagick_FOUND ) 12 | 13 | if( QT_FOUND ) 14 | add_subdirectory (pfsview) 15 | endif( QT_FOUND ) 16 | 17 | if( MATLAB_FOUND ) 18 | add_subdirectory (matlab) 19 | endif( MATLAB_FOUND ) 20 | 21 | if( OPENGL_FOUND AND GLUT_FOUND ) 22 | add_subdirectory (pfsglview) 23 | endif( OPENGL_FOUND AND GLUT_FOUND ) 24 | 25 | if( WITH_HDRVC ) 26 | add_subdirectory (hdrvc) 27 | endif( WITH_HDRVC ) 28 | 29 | if( MKOCTFILE ) 30 | add_subdirectory (octave) 31 | endif( MKOCTFILE ) 32 | 33 | add_subdirectory (tmo) 34 | add_subdirectory (camera) 35 | -------------------------------------------------------------------------------- /src/pfsglview/winstat.h: -------------------------------------------------------------------------------- 1 | 2 | #include "rmglwin.h" 3 | 4 | class WinStat : public RMGLWin { 5 | 6 | private: 7 | int pixelX; 8 | int pixelY; 9 | int colR, colG, colB; 10 | float lumMax; 11 | const char* mappingMode; 12 | int frameNo; 13 | const char* channel; 14 | int rawPosX, rawPosY; 15 | float rawX, rawY, rawZ; 16 | bool bZoom; 17 | 18 | public: 19 | //WinStat( int posX, int posY, int width, int height); 20 | WinStat(); 21 | ~WinStat(); 22 | 23 | void redraw(void); 24 | void setPixelData( int xx, int yy, int r, int g, int b); 25 | void setMaxFreq(float val); 26 | void setMapping(const char*); 27 | void setFrameNo(int no); 28 | void setChannel(const char* ch) ; 29 | void setRawData(int x, int y, float X, float Y, float Z); 30 | void setBZoom(bool bb); 31 | }; 32 | 33 | -------------------------------------------------------------------------------- /src/pfsglview/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | 2 | include_directories ("${PROJECT_BINARY_DIR}/" "${PROJECT_SOURCE_DIR}/src/pfs" ${OPENGL_INCLUDE_DIRS} ${GLUT_INCLUDE_DIRS}) 3 | if( NOT HAS_GETOPT ) 4 | include_directories ("${GETOPT_INCLUDE}") 5 | endif( NOT HAS_GETOPT ) 6 | 7 | if (OPENMP_FOUND) 8 | # set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OpenMP_C_FLAGS}") 9 | set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}") 10 | endif() 11 | 12 | add_executable(pfsglview pfsglview.cpp picture_io.cpp module.cpp m_histogram.cpp m_status.cpp m_on_screen_display.cpp) 13 | 14 | # TODO: Use ${GLUT_LIBRARY} instead. 15 | target_link_libraries(pfsglview ${OPENGL_LIBRARIES} ${GLUT_glut_LIBRARY} pfs) 16 | 17 | install (TARGETS pfsglview DESTINATION bin) 18 | install (FILES pfsglview.1 DESTINATION ${MAN_DIR}) 19 | 20 | 21 | -------------------------------------------------------------------------------- /src/octave/pfs_read_rgb.m: -------------------------------------------------------------------------------- 1 | function [R G B] = pfs_read_rgb( fileName ) 2 | ## Read hdr image file (formats accepted by pfsin) and return R, G, 3 | ## and B color channels. 4 | ## 5 | ## [R G B] = hdr_read_rgb( fileName ) 6 | 7 | ## Check if file exists 8 | fid = fopen( fileName, "rb" ); 9 | if( fid == -1 ) 10 | error( sprintf( "pfs_read_rgb: File '%s' does not exist", fileName ) ); 11 | endif 12 | fclose( fid ); 13 | 14 | unwind_protect 15 | fid = popen( sprintf( 'pfsin %s', fileName ), 'r' ); 16 | pin = pfsopen( fid ); 17 | pin = pfsget( pin ); 18 | [R G B] = pfstransform_colorspace( 'XYZ', pin.channels.X, pin.channels.Y, pin.channels.Z, 'RGB' ); 19 | unwind_protect_cleanup 20 | pfsclose( pin ); 21 | fclose( fid ); 22 | end_unwind_protect 23 | 24 | endfunction 25 | -------------------------------------------------------------------------------- /src/octave/pfs_write_rgb.m: -------------------------------------------------------------------------------- 1 | function pfs_write_rgb( fileName, R, G, B ) 2 | ## Write an hdr image file (formats accepted by pfsout). You can 3 | ## specify additional options in fileName, such as 4 | ## "--compression=PXR24" for OpenEXR files. Check manual pages of 5 | ## pfsout* commands for the list of available options. 6 | ## 7 | ## pfs_write_rgb( fileName, R, G, B ) 8 | 9 | unwind_protect 10 | fid = popen( sprintf( "pfsout %s", fileName ), "w" ); 11 | 12 | pfs = pfsopen( fid, size( R ) ); 13 | pfs.channels = struct; 14 | [pfs.channels.X pfs.channels.Y pfs.channels.Z] = ... 15 | pfstransform_colorspace( "RGB", R, G, B, "XYZ" ); 16 | pfsput( pfs ); 17 | unwind_protect_cleanup 18 | pfsclose( pfs ); 19 | fclose( fid ); 20 | end_unwind_protect 21 | 22 | endfunction 23 | -------------------------------------------------------------------------------- /src/hdrhtml/hdrhtml_c_b3.csv: -------------------------------------------------------------------------------- 1 | 1.000000, 0.004753, 0.000806 2 | 1.000000, 0.077796, 0.000000 3 | 1.000000, 0.153789, 0.000000 4 | 1.000000, 0.232821, 0.000000 5 | 1.000000, 0.313796, 0.000000 6 | 1.000000, 0.395649, 0.000000 7 | 1.000000, 0.477428, 0.000000 8 | 1.000000, 0.558251, 0.000000 9 | 1.000000, 0.637553, 0.000000 10 | 1.000000, 0.714245, 0.000000 11 | 1.000000, 0.787620, 0.000000 12 | 1.000000, 0.857177, 0.000000 13 | 1.000000, 0.897915, 0.045207 14 | 1.000000, 0.931794, 0.101116 15 | 1.000000, 0.960051, 0.165419 16 | 0.828804, 1.000000, 0.230594 17 | 0.824994, 1.000000, 0.314135 18 | 0.815345, 1.000000, 0.399492 19 | 0.807275, 1.000000, 0.484852 20 | 0.792214, 1.000000, 0.569285 21 | 0.820934, 1.000000, 0.651947 22 | 0.888018, 1.000000, 0.732082 23 | 0.932047, 1.000000, 0.809024 24 | 1.000000, 0.930768, 0.886016 25 | 0.674939, 0.597552, 0.947762 26 | -------------------------------------------------------------------------------- /cmake/FindTIFF.cmake: -------------------------------------------------------------------------------- 1 | # - Find TIFF library 2 | # Find the native TIFF includes and library 3 | # This module defines 4 | # TIFF_INCLUDE_DIR, where to find tiff.h, etc. 5 | # TIFF_LIBRARIES, libraries to link against to use TIFF. 6 | # TIFF_FOUND, If false, do not try to use TIFF. 7 | # also defined, but not for general use are 8 | # TIFF_LIBRARY, where to find the TIFF library. 9 | 10 | FIND_PATH(TIFF_INCLUDE_DIR tiff.h) 11 | 12 | SET(TIFF_NAMES ${TIFF_NAMES} tiff) 13 | FIND_LIBRARY(TIFF_LIBRARY NAMES ${TIFF_NAMES} ) 14 | 15 | # handle the QUIETLY and REQUIRED arguments and set TIFF_FOUND to TRUE if 16 | # all listed variables are TRUE 17 | INCLUDE(FindPackageHandleStandardArgs) 18 | FIND_PACKAGE_HANDLE_STANDARD_ARGS(TIFF DEFAULT_MSG TIFF_LIBRARY TIFF_INCLUDE_DIR) 19 | 20 | IF(TIFF_FOUND) 21 | SET( TIFF_LIBRARIES ${TIFF_LIBRARY} ) 22 | ENDIF(TIFF_FOUND) 23 | -------------------------------------------------------------------------------- /src/octave/pfsoctavergb.1: -------------------------------------------------------------------------------- 1 | .TH "pfsoctavergb" 1 2 | .SH NAME 3 | pfsoctavergb \- Process red, green and blue channels in pfs stream using Octave 4 | .SH SYNOPSIS 5 | .B pfsoctavergb 6 | .SH DESCRIPTION 7 | Use this command to execute a GNU Octave program on red, green and blue 8 | channels of each frame in the pfs stream. \fIoctave_program\fR must be 9 | given in quotation marks ("") and must not produce any output (it can 10 | output to stderr, not to stdout). Red, green and blue color channels 11 | are available in \fIoctave_program\fR as \fBR\fR, \fBG\fR and \fBB\fR 12 | matrices. 13 | .PP 14 | Note: This command requires GNU Octave. 15 | .SH EXAMPLES 16 | .TP 17 | pfsinrgbe frames_%04d.hdr | pfsoctavergb "R = R.^2; G = G.^2; B = B.^2;" | pfsview 18 | .PP 19 | Expand the dynamic range of a sequence of frames and show the result 20 | with pfsview. 21 | .SH BUGS 22 | Please report bugs and comments to Rafal Mantiuk 23 | . 24 | -------------------------------------------------------------------------------- /src/tmo/fattal02/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | include_directories ("${PROJECT_BINARY_DIR}/" 2 | "${PROJECT_SOURCE_DIR}/src/pfs" "${PROJECT_SOURCE_DIR}/src/tmo/pfstmo") 3 | if( NOT HAS_GETOPT ) 4 | include_directories ("${GETOPT_INCLUDE}") 5 | endif( NOT HAS_GETOPT ) 6 | link_directories("${PROJECT_SOURCE_DIR}/src/pfs") 7 | 8 | if( FFTW_FOUND AND OPENMP_FOUND) 9 | set( FFTW_LIBRARIES ${FFTW_LIBS} ) 10 | set( PDE_FFT "pde_fft.cpp" ) 11 | set( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OpenMP_C_FLAGS}" ) 12 | set( CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${OpenMP_C_FLAGS}" ) 13 | else( FFTW_FOUND AND OPENMP_FOUND ) 14 | set( FFTW_LIBRARIES ) 15 | endif( FFTW_FOUND AND OPENMP_FOUND ) 16 | 17 | 18 | set(TRG pfstmo_fattal02) 19 | add_executable(${TRG} ${TRG}.cpp tmo_fattal02.cpp pde.cpp ${PDE_FFT} "${GETOPT_OBJECT}") 20 | target_link_libraries(${TRG} pfs ${FFTW_LIBRARIES}) 21 | install (TARGETS ${TRG} DESTINATION bin) 22 | install (FILES ${TRG}.1 DESTINATION ${MAN_DIR}) 23 | -------------------------------------------------------------------------------- /src/octave/pfsoctavelum.1: -------------------------------------------------------------------------------- 1 | .TH "pfsoctavelum" 1 2 | .SH NAME 3 | pfsoctavelum \- Process luminance in pfs stream using Octave 4 | .SH SYNOPSIS 5 | .B pfsoctavelum 6 | .SH DESCRIPTION 7 | Use this command to execute a GNU Octave program on luminance channel of each 8 | frame in the pfs stream. \fIoctave_program\fR must be given in 9 | quotation marks ("") and must not produce any output (it can output to 10 | stderr, not to stdout). Color channels are scaled proportionaly to the 11 | luminance channel. Luminance channel is represented by matrix \fIY\fR. 12 | .PP 13 | Note: This command requires GNU Octave. 14 | .SH EXAMPLES 15 | .TP 16 | pfsinrgbe frames_%04d.hdr | pfsoctavelum "Y = conv2( Y, gaussian( 10, 1/5 )*gaussian( 10, 1/5 )', 'same' );" | pfsview 17 | .PP 18 | Blur the sequence of frames with gaussian blur and show the result 19 | with pfsview. 20 | .SH BUGS 21 | Please report bugs and comments to Rafal Mantiuk 22 | . 23 | 24 | 25 | -------------------------------------------------------------------------------- /src/filter/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | include_directories ("${PROJECT_BINARY_DIR}/" "${PROJECT_SOURCE_DIR}/src/pfs") 2 | if( NOT HAS_GETOPT ) 3 | include_directories ("${GETOPT_INCLUDE}") 4 | endif( NOT HAS_GETOPT ) 5 | link_directories("${PROJECT_SOURCE_DIR}/src/pfs") 6 | 7 | set(PFS_FILT pfsgamma pfsclamp pfstag pfssize pfsextractchannels 8 | pfspanoramic pfsrotate pfsflip pfscut pfspad pfscat pfsabsolute pfsretime 9 | pfscolortransform) 10 | 11 | foreach(TRG ${PFS_FILT}) 12 | add_executable(${TRG} ${TRG}.cpp "${GETOPT_OBJECT}") 13 | target_link_libraries(${TRG} pfs) 14 | install (TARGETS ${TRG} DESTINATION bin) 15 | install (FILES ${TRG}.1 DESTINATION ${MAN_DIR}) 16 | endforeach(TRG) 17 | 18 | add_executable(pfsdisplayfunction pfsdisplayfunction.cpp display_function.cpp display_function.h "${GETOPT_OBJECT}") 19 | target_link_libraries(pfsdisplayfunction pfs) 20 | install (TARGETS pfsdisplayfunction DESTINATION bin) 21 | install (FILES pfsdisplayfunction.1 DESTINATION ${MAN_DIR}) 22 | 23 | -------------------------------------------------------------------------------- /src/fileformat/pfsingdal.1: -------------------------------------------------------------------------------- 1 | .TH "pfsingdal" 1 2 | .SH NAME 3 | pfsingdal \- Load data using the GDAL library 4 | .SH SYNOPSIS 5 | .B pfsingdal 6 | [...] 7 | 8 | .SH DESCRIPTION 9 | This command can load images or frames in the multitude of data 10 | formats supported by GDAL (Geospatial Data Abstraction Library). 11 | See \fIhttp://www.gdal.org/formats_list.html\fR for a list of supported formats. 12 | .PP 13 | \fBpfsingdal\fR reads images or frames from files and writes 14 | \fIpfs\fR stream to the Standard Output. The \fIpfs\fR stream is 15 | usually piped to another program for further processing. 16 | .PP 17 | The output of \fBpfsingdal\fR is the closest possible match of the input data. 18 | 19 | .SH EXAMPLES 20 | .TP 21 | pfsingdal sardata.cosar | pfsview 22 | 23 | .SH NOTES 24 | pfsingdal can not read from pipes, due to the design of GDAL. 25 | .PP 26 | Please report bugs and comments to Martin Lambers . 27 | .SH "SEE ALSO" 28 | .BR pfsin (1), 29 | .BR pfsout (1) 30 | 31 | -------------------------------------------------------------------------------- /src/hdrhtml/hdrhtml_t_b3.csv: -------------------------------------------------------------------------------- 1 | 0.0078125,0,0 2 | 0.0099575,0.04108,3.708e-20 3 | 0.012691,0.047823,5.4321e-20 4 | 0.016176,0.065391,5.9717e-20 5 | 0.020617,0.083157,5.6894e-20 6 | 0.026278,0.10398,6.3196e-20 7 | 0.033493,0.12791,6.3889e-20 8 | 0.042689,0.1563,6.041e-20 9 | 0.054409,0.19097,5.6943e-20 10 | 0.069348,0.23139,5.4626e-20 11 | 0.088388,0.2763,0.010773 12 | 0.11266,0.32933,0.021906 13 | 0.14359,0.39697,0.033063 14 | 0.18301,0.46994,0.045095 15 | 0.23326,0.54158,0.061894 16 | 0.2973,0.61753,0.082825 17 | 0.37893,0.69394,0.10713 18 | 0.48297,0.76558,0.13532 19 | 0.61557,0.83936,0.1691 20 | 0.78458,0.90635,0.20897 21 | 1,0.96558,0.25482 22 | 1.2746,1,0.30533 23 | 1.6245,1,0.37926 24 | 2.0705,1,0.45322 25 | 2.639,1,0.53436 26 | 3.3636,1,0.61317 27 | 4.2871,1,0.69167 28 | 5.4642,1,0.77153 29 | 6.9644,1,0.84026 30 | 8.8766,1,0.90374 31 | 11.314,1,0.96351 32 | 14.42,1,1 33 | 18.379,1,1 34 | 23.425,1,1 35 | 29.857,1,1 36 | 38.055,1,1 37 | 48.503,1,1 38 | 61.82,1,1 39 | 78.793,1,1 40 | 100.43,1,1 41 | 128,1,1 42 | -------------------------------------------------------------------------------- /src/matlab/pfs_transform_colorspace.m: -------------------------------------------------------------------------------- 1 | %PFS_TRANSFORM_COLORSPACE Tranform between color spaces using pfs library. 2 | % 3 | % [C1 C2 C2] = PFS_TRANSFORM_COLORSPACE( inCSname, c1, c2, c3, outCSname ); 4 | % img_out = PFS_TRANSFORM_COLORSPACE( inCSname, img_in, outCSname ); 5 | % img_out = PFS_TRANSFORM_COLORSPACE( inCSname, c1, c2, c3, outCSname ); 6 | % [C1 C2 C2] = PFS_TRANSFORM_COLORSPACE( inCSname, img_in, outCSname ); 7 | % 8 | % inCSname - name of the input color space 9 | % c - matrix with n-th channel of input color space 10 | % C - matrix with n-th channel of output color space 11 | % img_in - input image given as 3D height/width/3 matrix 12 | % img_out - output image given as 3D height/width/3 matrix 13 | % outCSname - name of the output color space 14 | % 15 | % Recognized color space names: 'XYZ', 'RGB', 'sRGB', 'YUV', 'Yxy'. 16 | % Color space names are case insensitive. 17 | % 18 | % See also: PFS_READ_IMAGE, PFS_WRITE_IMAGE, PFSVIEW. 19 | % 20 | % Copyright 2009 Rafal Mantiuk 21 | -------------------------------------------------------------------------------- /src/hdrhtml/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | include_directories ("${PROJECT_BINARY_DIR}/" "${PROJECT_SOURCE_DIR}/src/pfs" ${ImageMagick_INCLUDE_DIRS}) 2 | link_directories("${PROJECT_SOURCE_DIR}/src/pfs") 3 | 4 | add_executable(pfsouthdrhtml pfsouthdrhtml.cpp hdrhtml.cpp) 5 | target_link_libraries(pfsouthdrhtml pfs ${ImageMagick_LIBRARIES}) 6 | set_target_properties(pfsouthdrhtml PROPERTIES COMPILE_FLAGS "-DMAGICKCORE_HDRI_ENABLE=0 -DMAGICKCORE_QUANTUM_DEPTH=16") 7 | 8 | install (TARGETS pfsouthdrhtml DESTINATION bin) 9 | install (FILES pfsouthdrhtml.1 DESTINATION ${MAN_DIR}) 10 | 11 | set(DATAFILES hdrhtml_c_b2.csv hdrhtml_t_b2.csv hdrhtml_c_b3.csv hdrhtml_t_b3.csv hdrhtml_c_b4.csv hdrhtml_t_b4.csv hdrhtml_c_b5.csv hdrhtml_t_b5.csv) 12 | 13 | foreach(SRC ${DATAFILES}) 14 | install (FILES ${SRC} DESTINATION ${PKG_DATADIR}) 15 | endforeach(SRC) 16 | 17 | install( DIRECTORY "hdrhtml_default_templ" DESTINATION ${PKG_DATADIR} ) 18 | install( DIRECTORY "hdrhtml_hdrlabs_templ" DESTINATION ${PKG_DATADIR} ) 19 | 20 | -------------------------------------------------------------------------------- /src/camera/jpeg2hdrgen.1: -------------------------------------------------------------------------------- 1 | .TH "jpeg2hdrgen" 1 2 | .SH NAME 3 | jpeg2hdrgen \- Parse EXIF information in given JPEG files and output a 4 | hdrgen script for generation of HDR images. 5 | 6 | .SH SYNOPSIS 7 | .B jpeg2hdrgen 8 | [...] 9 | 10 | .SH DESCRIPTION 11 | This program can be used to automatically create a hdrgen script for 12 | use with software creating HDR images. The exposure information is 13 | extracted from EXIF data contained in jpeg images created using 14 | digital cameras. 15 | 16 | If this script doesn't recognise the exposure settings from the images 17 | taken by your camera, send me an output of a `jhead your_image.jpg` 18 | program. 19 | 20 | .SH EXAMPLES 21 | .TP 22 | jpeg2hdrgen IMG_0001.JPG IMG_0002.JPG IMG_0003.JPG > sample.hdrgen 23 | 24 | Creates a sample.hdrgen script for given images. 25 | 26 | .SH "SEE ALSO" 27 | .BR pfsinhdrgen (1) 28 | .BR pfshdrcalibrate (1) 29 | .SH BUGS 30 | Please report bugs and comments on implementation to 31 | Grzegorz Krawczyk . 32 | -------------------------------------------------------------------------------- /src/matlab/pfs_write_luminance.m: -------------------------------------------------------------------------------- 1 | function pfs_write_luminance( fileName, img ) 2 | %PFS_WRITE_LUMINANCE writes an image file 3 | % 4 | % PFS_WRITE_LUMINANCE ( file_name, img ) 5 | % 6 | % img - 2D matrix representing luminance values 7 | % 8 | % The format of the file is recognized based in the file name extension: 9 | % .hdr for Radiance images, .exr for OpenEXR, .jpg for JPEG and .png for 10 | % PNG. See manual of "pfsout" shell command for the full list of the 11 | % supported formats. 12 | % 13 | % See also: PFS_WRITE_IMAGE, PFS_WRITE_RGB, PFS_WRITE_XYZ, 14 | % PFS_READ_IMAGE. 15 | % 16 | % Copyright 2009 Rafal Mantiuk 17 | 18 | if( nargin ~= 2 ) 19 | error( 'pfs_write_luminance: improper usage' ); 20 | end 21 | 22 | %cmd = sprintf( '%spfsout %s%s', pfs_shell(), fileName, pfs_shell(1) ) 23 | fid = pfspopen( sprintf( '%spfsout ''%s''%s', pfs_shell(), fileName, pfs_shell(1) ), 'w' ); 24 | pfs = pfsopen( fid, size( img ) ); 25 | 26 | pfs.channels.Y = img; 27 | 28 | pfsput( pfs ); 29 | pfsclose( pfs ); 30 | pfspclose( fid ); 31 | 32 | end 33 | -------------------------------------------------------------------------------- /cmake/FindFFTW.cmake: -------------------------------------------------------------------------------- 1 | # - Find FFTW 2 | # Find the native FFTW includes and library 3 | # 4 | # FFTW_INCLUDES - where to find fftw3.h 5 | # FFTW_LIBRARIES - List of libraries when using FFTW. 6 | # FFTW_FOUND - True if FFTW found. 7 | 8 | if (FFTW_INCLUDES) 9 | # Already in cache, be silent 10 | set (FFTW_FIND_QUIETLY TRUE) 11 | endif (FFTW_INCLUDES) 12 | 13 | find_path (FFTW_INCLUDES fftw3.h) 14 | 15 | find_library (FFTW3_LIB NAMES fftw3) 16 | 17 | find_library (FFTW3F_LIB NAMES fftw3f) 18 | 19 | find_library (FFTW3F_THREADS_LIB NAMES fftw3_threads) 20 | 21 | #set (FFTW_LIBRARIES ${FFTW3_LIB} ${FFTW3F_LIB}) 22 | 23 | # handle the QUIETLY and REQUIRED arguments and set FFTW_FOUND to TRUE if 24 | # all listed variables are TRUE 25 | include (FindPackageHandleStandardArgs) 26 | find_package_handle_standard_args (FFTW DEFAULT_MSG FFTW3_LIB FFTW3F_LIB FFTW3F_THREADS_LIB FFTW_INCLUDES) 27 | 28 | SET(FFTW_LIBS ${FFTW3_LIB} ${FFTW3F_LIB} ${FFTW3F_THREADS_LIB}) 29 | 30 | mark_as_advanced (FFTW_LIBRARIES FFTW_INCLUDES) 31 | -------------------------------------------------------------------------------- /src/filter/pfsflip.1: -------------------------------------------------------------------------------- 1 | .TH "pfsflip" 1 2 | .SH NAME 3 | pfsflip \- Flip images horizontally and/or vertically. 4 | .SH SYNOPSIS 5 | .B pfsflip 6 | [--h] [--v] [--help] 7 | .SH DESCRIPTION 8 | Use this command to flip images from a stream of pfs. The --h option results in 9 | a horizontal exchange, and the --v option results in a vertical exchange. Both 10 | options may be applied, which is equivalent to rotation of the image 180 11 | degrees. 12 | 13 | .SH OPTIONS 14 | .TP 15 | --h, -h 16 | 17 | Flip the image horizontally. 18 | 19 | .TP 20 | --v, -v 21 | 22 | Flip the image vertically. 23 | 24 | .SH EXAMPLES 25 | .TP 26 | pfsin memorial.hdr | pfsflip -h -v | pfsout memorial_gc.hdr 27 | 28 | Flip memorial image horizontally and vertically (rotate the image 180 degrees) 29 | and save to memorial_gc.hdr. 30 | 31 | .SH "NOTES" 32 | Notice that either --h or --v must be specified. 33 | 34 | .SH "SEE ALSO" 35 | .BR pfsin(1) 36 | .BR pfsout(1) 37 | .BR pfsrotate(1) 38 | 39 | .SH BUGS 40 | Please report bugs and comments to Alexander Efremov 41 | . 42 | -------------------------------------------------------------------------------- /src/filter/pfsrotate.1: -------------------------------------------------------------------------------- 1 | .TH "pfsrotate" 1 2 | .SH NAME 3 | pfsrotate \- Rotate images 90 degrees. 4 | .SH SYNOPSIS 5 | .B pfsrotate 6 | [--r] [--help] 7 | .SH DESCRIPTION 8 | Use this command to rotate images from a stream of pfs. This command is useful 9 | for output on hardcopy devices with aspect ratios opposite to the input image. 10 | By default, the image is rotated clockwise. The --r option may be used to rotate 11 | the image counter-clockwise instead. 12 | 13 | .SH OPTIONS 14 | .TP 15 | --r, -r 16 | 17 | Rotate the image counter-clockwise instead of clockwise. 18 | 19 | .SH EXAMPLES 20 | .TP 21 | pfsin memorial.hdr | pfsrotate -r | pfsout memorial_gc.hdr 22 | 23 | Rotate memorial image 90 degrees counter-clockwise and save to memorial_gc.hdr. 24 | 25 | .SH "NOTES" 26 | To rotate an image 180 degrees, use 27 | .BR pfsflip (1) 28 | with both the --h and --v options specified. 29 | 30 | .SH "SEE ALSO" 31 | .BR pfsin(1) 32 | .BR pfsout(1) 33 | .BR pfsflip(1) 34 | 35 | .SH BUGS 36 | Please report bugs and comments to Alexander Efremov 37 | . 38 | -------------------------------------------------------------------------------- /src/matlab/pfs_read_luminance.m: -------------------------------------------------------------------------------- 1 | function Y = pfs_read_luminance( fileName ) 2 | %PFS_READ_LUMINANCE read image file and return luminance channel Y. 3 | % 4 | % Y = PFS_READ_LUMINANCE( file_name ) 5 | % 6 | % PFS_READ_LUMINANCE accepts all formats recognized by the shell "pfsin" 7 | % command. 8 | % 9 | % See also: PFS_READ_IMAGE, PFS_READ_LUMINANCE, PFS_READ_XYZ, PFS_WRITE_IMAGE. 10 | % 11 | % Copyright 2009 Rafal Mantiuk 12 | 13 | % Check if file exists 14 | fid = fopen( fileName, 'r' ); 15 | if( fid == -1 ) 16 | error( 'pfs_read_luminance: File "%s" does not exist', fileName ); 17 | end 18 | fclose( fid ); 19 | 20 | % try 21 | cmd = sprintf( '%spfsin ''%s''%s', pfs_shell(), fileName, pfs_shell( 1 ) ); 22 | fid = pfspopen( cmd, 'r' ); 23 | pin = pfsopen( fid ); 24 | pin = pfsget( pin ); 25 | Y = pin.channels.Y; 26 | pfsclose( pin ); 27 | % TODO: Check why crashes on windows 28 | if ~ispc() 29 | pfspclose( fid ); 30 | end 31 | % catch 32 | % pfsclose( pin ); 33 | % pfspclose( fid ); 34 | % end 35 | 36 | end -------------------------------------------------------------------------------- /src/hdrhtml/hdrhtml_hdrlabs_templ/hdrhtml_image_templ.html: -------------------------------------------------------------------------------- 1 | 2 | 3 |
4 |
 
5 |
7 |
 
8 |
9 |
 
10 |
11 | 12 | 13 |
14 | 15 | 16 | -------------------------------------------------------------------------------- /src/hdrhtml/hdrhtml_c_b4.csv: -------------------------------------------------------------------------------- 1 | 1.000000, 0.000000, 0.000000, 0.000000 2 | 1.000000, 0.107779, 0.000000, 0.000000 3 | 1.000000, 0.225141, 0.000000, 0.000000 4 | 1.000000, 0.346138, 0.000000, 0.000000 5 | 1.000000, 0.468157, 0.000000, 0.000000 6 | 1.000000, 0.588770, 0.000000, 0.000000 7 | 1.000000, 0.705845, 0.000000, 0.000000 8 | 1.000000, 0.817590, 0.000000, 0.000000 9 | 1.000000, 0.900184, 0.035347, 0.000000 10 | 1.000000, 0.949359, 0.116636, 0.000000 11 | 1.000000, 0.986104, 0.215020, 0.000000 12 | 0.939311, 1.000000, 0.330480, 0.000000 13 | 0.984719, 1.000000, 0.453535, 0.000000 14 | 0.983375, 1.000000, 0.575528, 0.000000 15 | 0.982920, 1.000000, 0.694216, 0.000000 16 | 0.981837, 1.000000, 0.807719, 0.000000 17 | 0.973294, 1.000000, 0.894052, 0.033054 18 | 1.000000, 0.944328, 0.946046, 0.117524 19 | 1.000000, 0.613026, 0.985231, 0.220520 20 | 0.824505, 0.830313, 1.000000, 0.340765 21 | 0.822916, 0.826307, 1.000000, 0.471029 22 | 0.828063, 0.831705, 1.000000, 0.600446 23 | 0.803956, 0.831663, 1.000000, 0.726575 24 | 0.734713, 0.805514, 1.000000, 0.847311 25 | 0.109163, 0.305546, 0.885145, 0.956582 26 | -------------------------------------------------------------------------------- /src/matlab/Makefile.win32: -------------------------------------------------------------------------------- 1 | #MEX=mex 2 | MEX=c:\progra~1\MATLAB\R2006b\bin\mex.bat 3 | #MEX="c:\matlab\bin\win32\mex.bat" 4 | MEXOPTIONS=COMPFLAGS^#"$$COMPFLAGS -GX" 5 | 6 | all: pfsclose.mexw32 pfsopen.mexw32 pfsput.mexw32 pfsget.mexw32 pfspopen.mexw32 \ 7 | pfspclose.mexw32 pfs_transform_colorspace.mexw32 8 | 9 | pfsopen.mexw32: pfsopen.cpp mex_utils.cpp ../pfs/pfs.cpp 10 | $(MEX) $(MEXOPTIONS) -I..\pfs\ $** 11 | 12 | pfsclose.mexw32: pfsclose.cpp mex_utils.cpp 13 | $(MEX) $(MEXOPTIONS) -I..\pfs\ $** 14 | 15 | pfsput.mexw32: pfsput.cpp mex_utils.cpp ..\pfs\pfs.cpp 16 | $(MEX) $(MEXOPTIONS) -I..\pfs\ $** 17 | 18 | pfsget.mexw32: pfsget.cpp mex_utils.cpp ..\pfs\pfs.cpp 19 | $(MEX) $(MEXOPTIONS) -I..\pfs\ $** 20 | 21 | pfs_transform_colorspace.mexw32: pfs_transform_colorspace.cpp mex_utils.cpp ..\pfs\colorspace.cpp 22 | $(MEX) $(MEXOPTIONS) -I..\pfs\ $** 23 | 24 | pfspclose.mexw32: pfspclose.cpp mex_utils.cpp 25 | $(MEX) $(MEXOPTIONS) -I../../ -I../pfs $** 26 | 27 | pfspopen.mexw32: pfspopen.cpp mex_utils.cpp 28 | $(MEX) $(MEXOPTIONS) -I../../ -I../pfs $** 29 | -------------------------------------------------------------------------------- /src/hdrhtml/hdrhtml_hdrlabs_templ/hdrhtml_image_templ_slider-above.html: -------------------------------------------------------------------------------- 1 | 2 | 3 |
4 |
6 |
 
7 |
8 |
 
9 |
10 |
 
11 | 12 | 13 |
14 | 15 | 16 | -------------------------------------------------------------------------------- /src/matlab/pfspopen.cpp: -------------------------------------------------------------------------------- 1 | #include "compatibility.h" 2 | 3 | #include 4 | #include 5 | 6 | #include "mex.h" 7 | #include "mex_utils.h" 8 | 9 | #define SCRIPT_NAME "pfspopen" 10 | 11 | extern void _main(); 12 | 13 | 14 | void mexFunction(int nlhs, mxArray *plhs[], 15 | int nrhs, const mxArray *prhs[]) 16 | { 17 | /* Check for proper number of arguments. */ 18 | if (nrhs != 2) 19 | mexErrMsgTxt("Expecting two parameters."); 20 | 21 | char *cmd_line = get_mex_string( prhs[0] ); 22 | char *mode = get_mex_string( prhs[1] ); 23 | 24 | FILE *in = popen( cmd_line, mode ); 25 | if( in == NULL ) { 26 | mexErrMsgTxt("popen has failed."); 27 | } 28 | 29 | int fd = fileno( in ); 30 | // int fd = dup( fileno( in ) ); 31 | // if( fclose( in ) != 0 ) 32 | // mexErrMsgTxt("fclose has failed."); 33 | 34 | plhs[0] = mxCreateNumericMatrix( 1, 2, mxDOUBLE_CLASS, mxREAL ); 35 | double *df_ptr = (double*)mxGetData( plhs[0] ); 36 | *df_ptr = fd; 37 | // Very bad hack 38 | df_ptr[1] = (unsigned long)in; 39 | 40 | mxFree( cmd_line ); 41 | mxFree( mode ); 42 | 43 | return; 44 | } 45 | -------------------------------------------------------------------------------- /src/hdrhtml/hdrhtml_t_b4.csv: -------------------------------------------------------------------------------- 1 | 0.0078125,0,0,0 2 | 0.0099575,0.043298,5.3555e-22,0 3 | 0.012691,0.068233,5.24e-22,0 4 | 0.016176,0.099217,3.7926e-22,0 5 | 0.020617,0.13105,1.5847e-22,0 6 | 0.026278,0.16193,9.295e-23,0 7 | 0.033493,0.19249,1.0223e-22,0 8 | 0.042689,0.22187,0.0067226,0 9 | 0.054409,0.24216,0.035882,0 10 | 0.069348,0.26569,0.063736,0 11 | 0.088388,0.2928,0.095934,0 12 | 0.11266,0.32552,0.12706,0 13 | 0.14359,0.36657,0.15933,0 14 | 0.18301,0.41682,0.19143,0 15 | 0.23326,0.48389,0.21451,0.018561 16 | 0.2973,0.56838,0.23449,0.047253 17 | 0.37893,0.65793,0.25599,0.078825 18 | 0.48297,0.74446,0.28194,0.11068 19 | 0.61557,0.83468,0.31458,0.14454 20 | 0.78458,0.91545,0.35677,0.17699 21 | 1,0.9877,0.40835,0.20735 22 | 1.2746,1,0.49517,0.21996 23 | 1.6245,1,0.58843,0.23782 24 | 2.0705,1,0.68195,0.25835 25 | 2.639,1,0.77954,0.28525 26 | 3.3636,1,0.86504,0.32097 27 | 4.2871,1,0.94003,0.36756 28 | 5.4642,1,1,0.43014 29 | 6.9644,1,1,0.51864 30 | 8.8766,1,1,0.61233 31 | 11.314,1,1,0.71075 32 | 14.42,1,1,0.80082 33 | 18.379,1,1,0.88543 34 | 23.425,1,1,0.9645 35 | 29.857,1,1,1 36 | 38.055,1,1,1 37 | 48.503,1,1,1 38 | 61.82,1,1,1 39 | 78.793,1,1,1 40 | 100.43,1,1,1 41 | 128,1,1,1 42 | -------------------------------------------------------------------------------- /src/matlab/pfspclose.cpp: -------------------------------------------------------------------------------- 1 | #include "compatibility.h" 2 | 3 | #include 4 | #include 5 | 6 | #if defined( __win32__ ) 7 | #include 8 | #include 9 | #else 10 | #include 11 | #endif 12 | 13 | #include "mex.h" 14 | #include "mex_utils.h" 15 | 16 | #define SCRIPT_NAME "pfspclose" 17 | 18 | void mexFunction(int nlhs, mxArray *plhs[], 19 | int nrhs, const mxArray *prhs[]) 20 | { 21 | /* Check for proper number of arguments. */ 22 | if (nrhs != 1 && !is_mex_scalar( prhs[0] ) ) 23 | mexErrMsgTxt( SCRIPT_NAME ": Expecting one parameter - file descriptor." ); 24 | 25 | if( mxGetN(prhs[0]) != 2 ) 26 | mexErrMsgTxt( SCRIPT_NAME ": File descriptor not created with pfspopen." ); 27 | 28 | double *p_fid = mxGetPr( prhs[0] ); 29 | // int fid = (int)p_fid[0]; 30 | FILE *fh = (FILE*)((unsigned long)p_fid[1]); 31 | 32 | // FILE *fh = fdopen( fid, "r" ); 33 | if( pclose( fh ) == -1 ) 34 | mexErrMsgTxt( SCRIPT_NAME ": pclose has failed."); 35 | 36 | // int res = close( fid ); 37 | // if( res == -1 ) 38 | // mexErrMsgTxt( SCRIPT_NAME ": pclose has failed."); 39 | 40 | return; 41 | } 42 | -------------------------------------------------------------------------------- /src/fileformat/pfsinpfm.1: -------------------------------------------------------------------------------- 1 | .TH "pfsinpfm" 1 2 | .SH NAME 3 | pfsinpfm \- Load images or frames in PFM format 4 | .SH SYNOPSIS 5 | .B pfsinpfm 6 | ( [--frames ] [--skip-missing]) [...] 7 | 8 | .SH DESCRIPTION 9 | Use this command to read frames in PFM format. PFM format is used for 10 | HDR Shop plug-ins and is also supported by some recent versions of 11 | NetPBM package (pamtopfm and pfmtopam commands). The frames are 12 | converted to pfs stream and send to the Standard Output. This command 13 | can handle both color and gray-scale images. 14 | 15 | Details on the format of the pattern file names, which are used for 16 | reading multiple frames, can be found in the manual page of pfsinppm. 17 | 18 | To automatically recognize a file format from the extension, use 19 | \fIpfsin\fR command instead. 20 | 21 | .SH EXAMPLES 22 | .TP 23 | pfsin memorial.pfm | pfsout memorial.hdr 24 | 25 | Converts from one HDR format to another 26 | 27 | .SH BUGS 28 | Please report bugs and comments on implementation to 29 | the discussion group http://groups.google.com/group/pfstools 30 | .SH "SEE ALSO" 31 | .BR pfsin (1) 32 | .BR pfsinppm (1) 33 | .BR pfsoutpfm (1) 34 | 35 | 36 | -------------------------------------------------------------------------------- /src/fileformat/pfsoutpfm.1: -------------------------------------------------------------------------------- 1 | .TH "pfsoutpfm" 1 2 | .SH NAME 3 | pfsoutpfm \- Write images or frames in OpenEXR format 4 | .SH SYNOPSIS 5 | 6 | .B pfsoutpfm 7 | ( [--frames ]) [...] 8 | 9 | .SH DESCRIPTION 10 | Use this command to write frames in PFM format. PFM format is used for 11 | HDR Shop plug-ins and is also supported by some recent versions of 12 | NetPBM package (pamtopfm and pfmtopam commands). Source pfs frames 13 | should be piped to the Standard Input. This command can handle both 14 | color (XYZ channels) and grayscale (Y channel) images. 15 | 16 | Details on the format of the pattern file names, which are used for 17 | saving multiple frames, can be found in the manual page of pfsoutppm. 18 | 19 | .SH EXAMPLES 20 | .TP 21 | pfsin memorial.hdr | pfsoutpfm memorial.pfm 22 | 23 | Converts from one HDR format to another 24 | .TP 25 | pfsin memorial.hdr | pfsextractchannels Y | pfsoutpfm memorial.pfm 26 | 27 | Stores memorial image as a grayscale PFM file. 28 | .SH "SEE ALSO" 29 | .BR pfsout (1) 30 | .BR pfsoutppm (1) 31 | .BR pfsinpfm (1) 32 | .SH BUGS 33 | Please report bugs and comments on implementation to 34 | the discussion group http://groups.google.com/group/pfstools 35 | -------------------------------------------------------------------------------- /src/camera/dcraw2hdrgen.1: -------------------------------------------------------------------------------- 1 | .TH "dcraw2hdrgen" 1 2 | .SH NAME 3 | dcraw2hdrgen \- Parse information in given Digital Camera RAW files and output a 4 | hdrgen script for generation of HDR images. 5 | 6 | .SH SYNOPSIS 7 | .B dcraw2hdrgen 8 | [...] 9 | 10 | .SH DESCRIPTION 11 | This program can be used to automatically create an hdrgen script for 12 | use with software creating HDR images. The exposure information is 13 | extracted from RAW files using the `dcraw` tool. 14 | 15 | If this script doesn't recognise the exposure settings from the images 16 | taken by your camera, please verify if dcraw supports your camera: 17 | `dcraw -i -v your_image.cr2`. You should see a detailed information on 18 | shot settings including exposure time. Maybe compiling the newest 19 | version will help. 20 | 21 | .SH EXAMPLES 22 | .TP 23 | dcraw2hdrgen IMG_0001.CR2 IMG_0002.CR2 IMG_0003.CR2 > sample.hdrgen 24 | 25 | Creates a sample.hdrgen script for given images. 26 | 27 | .SH "SEE ALSO" 28 | .BR dcraw (1) 29 | .BR pfsindcraw (1) 30 | .BR pfsinhdrgen (1) 31 | .BR pfshdrcalibrate (1) 32 | .SH BUGS 33 | Please report bugs and comments on implementation to 34 | Grzegorz Krawczyk . 35 | -------------------------------------------------------------------------------- /src/matlab/pfs_read_xyz.m: -------------------------------------------------------------------------------- 1 | function varargout = pfs_read_xyz( fileName ) 2 | %PFS_READ_XYZ read image file and return X, Y, and Z color channels. 3 | % 4 | % [X Y Z] = PFS_READ_XYZ( file_name ) 5 | % IMG = PFS_READ_XYZ( file_name ) 6 | % 7 | % PFS_READ_XYZ accepts all formats recognized by the shell "pfsin" 8 | % command. 9 | % 10 | % See also: PFS_READ_IMAGE, PFS_READ_LUMINANCE, PFS_READ_XYZ, PFS_WRITE_IMAGE. 11 | % 12 | % Copyright 2009 Rafal Mantiuk 13 | 14 | % Check if file exists 15 | fid = fopen( fileName, 'rb' ); 16 | if( fid == -1 ) 17 | error( 'pfs_read_xyz: File "%s" does not exist', fileName ); 18 | end 19 | fclose( fid ); 20 | 21 | fid = pfspopen( sprintf( '%spfsin ''%s''%s', pfs_shell(), fileName, pfs_shell( 1 ) ), 'r' ); 22 | pin = pfsopen( fid ); 23 | pin = pfsget( pin ); 24 | pfsclose( pin ); 25 | pfspclose( fid ); 26 | 27 | if( nargout == 3 ) 28 | varargout{1} = pin.channels.X; 29 | varargout{2} = pin.channels.Y; 30 | varargout{3} = pin.channels.Z; 31 | elseif( nargout == 1 ) 32 | varargout{1} = cat( 3, pin.channels.X, pin.channels.Y, pin.channels.Z ); 33 | else 34 | error( 'Wrong number of output parameters' ); 35 | end 36 | 37 | end 38 | -------------------------------------------------------------------------------- /src/tmo/drago03/pfstmo_drago03.1: -------------------------------------------------------------------------------- 1 | .TH "pfstmo_drago03" 1 2 | .SH NAME 3 | pfstmo_drago03 \- Adaptive logarithmic tone mapping operator 4 | .SH SYNOPSIS 5 | .B pfstmo_drago03 6 | [--bias ] 7 | [--verbose] [--help] 8 | .SH DESCRIPTION 9 | This command implements adaptive logarithmic tone mapping operator as 10 | described in: 11 | 12 | Adaptive logarithmic mapping for displaying high contrast scenes. 13 | F. Drago, K. Myszkowski, T. Annen, and N. Chiba. In Eurographics 2003. 14 | 15 | According to the paper, results of this TMO require gamma correction. 16 | .SH OPTIONS 17 | .TP 18 | --bias , -b 19 | 20 | Bias value within the range 0..1. Default value: 0.85 21 | .TP 22 | --verbose 23 | 24 | Print additional information during program execution. 25 | .TP 26 | --help 27 | 28 | Print list of commandline options. 29 | .SH EXAMPLES 30 | .TP 31 | pfsin memorial.hdr | pfstmo_drago03 -b 0.8 | pfsgamma -g 1.7 | pfsout memorial.png 32 | 33 | Tone map image, apply gamma correction, and save it in png format. 34 | .SH "SEE ALSO" 35 | .BR pfsgamma (1) 36 | .BR pfsin (1) 37 | .BR pfsout (1) 38 | .BR pfsview (1) 39 | .SH BUGS 40 | Please report bugs and comments on implementation to 41 | Grzegorz Krawczyk . 42 | -------------------------------------------------------------------------------- /debian/copyright: -------------------------------------------------------------------------------- 1 | This package was debianized by Andreas Hirczy on 2 | Wed, 26 Oct 2005 23:20:58 +0200. 3 | 4 | It was downloaded from http://www.mpi-sb.mpg.de/resources/pfstools/ 5 | 6 | Copyright Holder: Rafal Mantiuk (mantiuk [at] mpi-sb.mpg.de) 7 | Grzegorz Krawczyk (krawczyk [at] mpi-sb.mpg.de) 8 | 9 | License: 10 | 11 | This package 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 package 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 package; if not, write to the Free Software 23 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 24 | 25 | On Debian systems, the complete text of the GNU General 26 | Public License can be found in `/usr/share/common-licenses/GPL'. 27 | 28 | -------------------------------------------------------------------------------- /src/tmo/reinhard02/tmo_reinhard02.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file tmo_reinhard02.h 3 | * @brief Tone map luminance channel using Reinhard02 model 4 | * 5 | * @author Grzegorz Krawczyk, 6 | * 7 | * $Id: tmo_reinhard02.h,v 1.2 2008/09/04 12:46:49 julians37 Exp $ 8 | */ 9 | 10 | #ifndef _tmo_reinhard02_h_ 11 | #define _tmo_reinhard02_h_ 12 | 13 | /* 14 | * @brief Photographic tone-reproduction 15 | * 16 | * @param width image width 17 | * @param height image height 18 | * @param Y input luminance 19 | * @param L output tonemapped intensities 20 | * @param use_scales true: local version, false: global version of TMO 21 | * @param key maps log average luminance to this value (default: 0.18) 22 | * @param phi sharpening parameter (defaults to 1 - no sharpening) 23 | * @param num number of scales to use in computation (default: 8) 24 | * @param low size in pixels of smallest scale (should be kept at 1) 25 | * @param high size in pixels of largest scale (default 1.6^8 = 43) 26 | */ 27 | void tmo_reinhard02(unsigned int width, unsigned int height, 28 | const float *Y, float *L, 29 | bool use_scales, float key, float phi, 30 | int num, int low, int high, bool temporal_coherent ); 31 | 32 | #endif /* _tmo_reinhard02_h_ */ 33 | -------------------------------------------------------------------------------- /src/octave/pfsview_rgb.m: -------------------------------------------------------------------------------- 1 | function pfsview_rgb( R, G, B, window_min, window_max ) 2 | ## Shows high-dynamic range RGB image using pfsview 3 | ## 4 | ## Usage: pfsview( R, G, B[, min, max] ) 5 | ## R, G, B - red, green and blue color channels, given as linear 6 | ## window_min - minimum luminance to show (in log10 units) 7 | ## window_max - maksimum luminance to show (in log10 units) 8 | ## response function 9 | 10 | if( !is_matrix(R) || !is_matrix(G) || !is_matrix(B) || \ 11 | any(size(R) != size(G)) || any(size(G) != size(B)) ) 12 | error( "pfsview_rgb: matrices of the equal size expected as an arguments" ); 13 | endif 14 | 15 | [X Y Z] = pfstransform_colorspace( "RGB", R, G, B, "XYZ" ); 16 | 17 | hdr_name = tmpnam(); 18 | pfswrite( hdr_name, "X", X, "Y", Y, "Z", Z ); 19 | 20 | rm = sprintf ("rm -f %s", hdr_name); 21 | if( exist( "window_min" ) && exist( "window_max" ) ) 22 | minmax_window = sprintf( "--window_min %g --window_max %g ", \ 23 | window_min, window_max ); 24 | else 25 | minmax_window = ""; 26 | endif 27 | pfsv = sprintf ("pfsview %s <%s", minmax_window, hdr_name); 28 | 29 | system (sprintf ("( %s && %s ) > /dev/null 2>&1 &", 30 | pfsv, rm)); 31 | endfunction 32 | -------------------------------------------------------------------------------- /src/camera/pfsinme.1: -------------------------------------------------------------------------------- 1 | .TH "pfsinme" 1 2 | .SH NAME 3 | pfsinme \- Read image files containing multiple exposures to be merged into an HDR image 4 | 5 | .SH SYNOPSIS 6 | .B pfsinme [] 7 | 8 | .SH DESCRIPTION 9 | Use this program to read multiple exposure JPEG or RAW images. The 10 | output of this command should be piped to \fIpfshdrcalibrate\fR to 11 | recover a camera response or merge images into an HDR image. 12 | 13 | All listed files must be the same type, that is mixing JPEG and RAW 14 | images is not allowed. You can use wildcards. 15 | 16 | This command is a convinience wrapper for \fIjpeg2hdrgen\fR, 17 | \fIdcraw2hdrgen\fR and \fIpfsinhdrgen\fR, which skips the step of 18 | generating an \fIhdrgen\fR file 19 | 20 | .SH EXAMPLES 21 | .TP 22 | pfsinme *.jpg | pfsrotate -r | pfshdrcalibrate -s response.m -v 23 | 24 | Read all JPEG images in the current directory, rotate them and merge 25 | into an HDR image 26 | 27 | .SH "SEE ALSO" 28 | .BR pfshdrcalibrate (1) 29 | .BR jpeg2hdrgen (1) 30 | .BR dcraw2hdrgen (1) 31 | .BR pfsinhdrgen (1) 32 | .SH BUGS 33 | The command cannot handle files with a space in the file name because 34 | of the pfsinhdrgen limitation. 35 | .PP 36 | Please report bugs and comments on implementation to 37 | the discussion group http://groups.google.com/group/pfstools 38 | -------------------------------------------------------------------------------- /src/hdrhtml/hdrhtml_hdrlabs_templ/hdrhtml_assets/mouse2touch.js: -------------------------------------------------------------------------------- 1 | /* 2 | --- 3 | description: A MooTools plugin that automatically map mouse events to touch events 4 | 5 | license: MIT-style 6 | 7 | authors: 8 | - Chi Wai Lau (http://tabqwert.com) 9 | - Scott Kyle (http://appden.com) 10 | 11 | requires: 12 | - core/1.2.4: '*' 13 | 14 | provides: [Mouse2Touch] 15 | ... 16 | */ 17 | 18 | if((navigator.userAgent.match(/iPhone/i)) || (navigator.userAgent.match(/iPod/i)) || (navigator.userAgent.match(/iPad/i))) { 19 | 20 | (function() { 21 | try { 22 | document.createEvent("TouchEvent"); 23 | } catch(e) { 24 | return; 25 | } 26 | 27 | ['touchstart', 'touchmove', 'touchend'].each(function(type){ 28 | Element.NativeEvents[type] = 2; 29 | }); 30 | 31 | var mapping = { 32 | 'mousedown': 'touchstart', 33 | 'mousemove': 'touchmove', 34 | 'mouseup': 'touchend' 35 | }; 36 | 37 | var condition = function(event) { 38 | var touch = event.event.changedTouches[0]; 39 | event.page = { 40 | x: touch.pageX, 41 | y: touch.pageY 42 | }; 43 | return true; 44 | }; 45 | 46 | for (var e in mapping) { 47 | Element.Events[e] = { 48 | base: mapping[e], 49 | condition: condition 50 | }; 51 | } 52 | })(); 53 | 54 | } 55 | -------------------------------------------------------------------------------- /src/hdrhtml/hdrhtml_c_b5.csv: -------------------------------------------------------------------------------- 1 | 1.000000, 0.004941, 0.000000, 0.000000, 0.000000 2 | 1.000000, 0.157191, 0.000000, 0.000000, 0.000000 3 | 1.000000, 0.316501, 0.000000, 0.000000, 0.000000 4 | 1.000000, 0.477850, 0.000000, 0.000000, 0.000000 5 | 1.000000, 0.636794, 0.000000, 0.000000, 0.000000 6 | 1.000000, 0.789464, 0.000000, 0.000000, 0.000000 7 | 1.000000, 0.891700, 0.056136, 0.000000, 0.000000 8 | 1.000000, 0.954463, 0.164808, 0.000000, 0.000000 9 | 0.995961, 1.000000, 0.298554, 0.000000, 0.000000 10 | 0.992357, 1.000000, 0.460134, 0.000000, 0.000000 11 | 0.992921, 1.000000, 0.619440, 0.000000, 0.000000 12 | 0.993587, 1.000000, 0.772463, 0.000000, 0.000000 13 | 0.994573, 1.000000, 0.874541, 0.057581, 0.000000 14 | 1.000000, 0.951017, 0.939871, 0.167569, 0.000000 15 | 1.000000, 0.328929, 0.988487, 0.302869, 0.000000 16 | 0.844179, 0.878493, 1.000000, 0.459841, 0.000000 17 | 0.804767, 0.851381, 1.000000, 0.623223, 0.000000 18 | 0.793615, 0.861199, 1.000000, 0.780415, 0.000000 19 | 0.750195, 0.823210, 1.000000, 0.887745, 0.056321 20 | 0.702168, 0.777604, 1.000000, 0.951909, 0.171740 21 | 0.563097, 0.610780, 0.754127, 1.000000, 0.312939 22 | 0.538779, 0.594761, 0.695918, 1.000000, 0.483468 23 | 0.413003, 0.469412, 0.564120, 1.000000, 0.652870 24 | 0.195722, 0.274036, 0.417979, 1.000000, 0.816901 25 | 0.095966, 0.000000, 0.000000, 0.911089, 0.966808 26 | -------------------------------------------------------------------------------- /src/filter/pfstag.1: -------------------------------------------------------------------------------- 1 | .TH "pfstag" 1 2 | .SH NAME 3 | pfstag \- Set or remove tags to/from pfs stream 4 | .SH SYNOPSIS 5 | .B pfstag 6 | [--set [channel:]name=value] [--remove [channel:]name] 7 | .SH DESCRIPTION 8 | Use this command to set or remove tags from the pfs-stream. Tags are 9 | used to add additional information to pfs frames and they are in the 10 | format: 'name=value'. To learn more about tags, read 'Specification of 11 | the PFS File Format'. 12 | 13 | Tags are set/removed to/from all pfs frames in the stream. 14 | 15 | Note that currently only OpenEXR file format supports tags. 16 | .SH OPTIONS 17 | .TP 18 | --set [channel:]name=value], -s [channel:]name=value], --add [channel:]name=value] 19 | Change existing or add a new tag of the given name. If no channel is given, 20 | tags are added to the frame. 21 | 22 | .TP 23 | --remove [channel:]name], -r [channel:]name] 24 | Remove tag of the given name. Ignore if the tag does not exist. If no 25 | channel is given, tags are removed from the frame. 26 | 27 | .SH EXAMPLES 28 | .TP 29 | pfsin memorial.hdr | pfstag --add "EXTRA_INFO=foo" | pfsout memorial_ei.exr 30 | 31 | Add tag "EXTRA_INFO=foo" to the memorial image and save it as memorial_ei.exr. 32 | 33 | .SH "SEE ALSO" 34 | .BR pfsin (1) 35 | .BR pfsout (1) 36 | .SH BUGS 37 | Please report bugs and comments to Rafal Mantiuk 38 | . 39 | -------------------------------------------------------------------------------- /src/octave/pfscrop: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | if test -z "$1" || test "$1" = "--help" || (test $# != "2" && test $# != "4"); then 4 | cat < "Cropping window pos: $CW_X $CW_Y size: $CW_W $CW_H" 31 | 32 | SCRIPTFILE=`tempfile` 33 | cat >${SCRIPTFILE} < rows( Y ) || ${CW_X} + ${CW_W}-1 > columns(Y) ) 38 | error( "Cropping window exceeds image size" ); 39 | exit( 1 ) 40 | endif 41 | X = X(${CW_Y}:${CW_Y} + ${CW_H}-1, ${CW_X}:${CW_X} + ${CW_W}-1); 42 | Y = Y(${CW_Y}:${CW_Y} + ${CW_H}-1, ${CW_X}:${CW_X} + ${CW_W}-1); 43 | Z = Z(${CW_Y}:${CW_Y} + ${CW_H}-1, ${CW_X}:${CW_X} + ${CW_W}-1); 44 | pfswrite( "stdout", "X", X, "Y", Y, "Z", Z ); 45 | EOF 46 | 47 | octave2.1 -q ${SCRIPTFILE} 48 | 49 | rm ${SCRIPTFILE} 50 | 51 | -------------------------------------------------------------------------------- /src/hdrhtml/hdrhtml_t_b5.csv: -------------------------------------------------------------------------------- 1 | 0.0078125,0,0,0,0 2 | 0.0099575,0.046825,0,0,0 3 | 0.012691,0.071986,1.3855e-21,0,1.3404e-21 4 | 0.016176,0.1037,1.8408e-21,0,4.4849e-21 5 | 0.020617,0.13616,8.0301e-22,0,3.2708e-21 6 | 0.026278,0.16633,0.007471,0,3.1119e-21 7 | 0.033493,0.1947,0.032949,0,3.1648e-21 8 | 0.042689,0.22529,0.058851,0,3.0057e-21 9 | 0.054409,0.253,0.094366,0,2.6424e-21 10 | 0.069348,0.2829,0.12843,0,1.5325e-22 11 | 0.088388,0.31506,0.16299,0.0037173,0 12 | 0.11266,0.3466,0.18855,0.03263,0 13 | 0.14359,0.38407,0.21578,0.061727,0 14 | 0.18301,0.42874,0.2435,0.093971,0 15 | 0.23326,0.48464,0.26963,0.12885,0 16 | 0.2973,0.55177,0.29885,0.16477,0.0031392 17 | 0.37893,0.64391,0.32942,0.19135,0.033828 18 | 0.48297,0.73599,0.36529,0.21705,0.063574 19 | 0.61557,0.83329,0.40955,0.24375,0.098502 20 | 0.78458,0.92083,0.46476,0.27055,0.13365 21 | 1,0.99702,0.53092,0.2982,0.16758 22 | 1.2746,1,0.63416,0.32596,0.19102 23 | 1.6245,1,0.73977,0.35658,0.22051 24 | 2.0705,1,0.83777,0.39756,0.24813 25 | 2.639,1,0.92953,0.45196,0.27761 26 | 3.3636,1,1,0.52151,0.30659 27 | 4.2871,1,1,0.62457,0.33166 28 | 5.4642,1,1,0.73619,0.36229 29 | 6.9644,1,1,0.83644,0.40322 30 | 8.8766,1,1,0.92453,0.45727 31 | 11.314,1,1,1,0.52709 32 | 14.42,1,1,1,0.62724 33 | 18.379,1,1,1,0.73253 34 | 23.425,1,1,1,0.83977 35 | 29.857,1,1,1,0.92215 36 | 38.055,1,1,1,1 37 | 48.503,1,1,1,1 38 | 61.82,1,1,1,1 39 | 78.793,1,1,1,1 40 | 100.43,1,1,1,1 41 | 128,1,1,1,1 42 | -------------------------------------------------------------------------------- /src/octave/pfsopen.help: -------------------------------------------------------------------------------- 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 | 7 | fileName - name of the file to read or write. \"stdin\" or \"stdout\" for standard input and output 8 | rows - height of images to write 9 | columns - width of images to write 10 | 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'). 12 | 13 | pfs_struct is a structure that contains the following fields: 14 | EOF - set to 1 if there are no more frames; 0 otherwise 15 | FH - file handle of the file. For internal pruposes, do not use 16 | MODE - file open mode: R - for reading, W - for writing 17 | columns, rows - dimensions of each channel in the stream 18 | channels - structure that contains channels represented as real matrices 19 | tags - structure that contains tags represented as strings 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. 21 | 22 | -------------------------------------------------------------------------------- /README.VisualStudio: -------------------------------------------------------------------------------- 1 | pfstools can be compiled with Visual Studio using CMake build system. This file contains some troubleshooting hints. 2 | 3 | Refer to README for details on building pfstools using CMake. 4 | 5 | The compilation was tested with Visual Studio Express 2013. 6 | 7 | Note that this compilation procedure is an alternative to using cygwin (refer to README.Cygwin). 8 | 9 | === QT === 10 | Download and install Qt4 (not Qt5) for Visual Studio from: http://qt-project.org/downloads 11 | 12 | Then add entry to CMake variables: 13 | QT_QMAKE_EXECUTABLE:FILEPATH=E:\Qt\4.8.5\bin\qmake 14 | where E:\Qt\4.8.5\bin\qmake should be replaced with the path to qmake on your computer. 15 | 16 | You may need to compile in Release mode. Otherwise some DLLs might be missing. 17 | 18 | === OpenEXR === 19 | 20 | Compiling OpenEXR on Windows with Visual Studio is not a task for faint hearted. Be prepared to fix quite a few issues with the code. 21 | 22 | * If the compiler complains about missing "__builtin_trap()", add 23 | 24 | #define PLATFORM_WINDOWS 1 25 | 26 | to config/IlmBaseConfig.h 27 | 28 | see 29 | 30 | https://lists.nongnu.org/archive/html/openexr-devel/2013-12/msg00001.html 31 | 32 | * If the compiler complains about "std::max", add missing include in all offending files: 33 | 34 | #include 35 | 36 | Other useful web pages: 37 | 38 | http://buildopenexr.blogspot.co.uk/ 39 | http://blog.gmane.org/gmane.comp.video.openexr.devel 40 | -------------------------------------------------------------------------------- /src/tmo/reinhard05/pfstmo_reinhard05.1: -------------------------------------------------------------------------------- 1 | .TH "pfstmo_reinhard05" 1 2 | .SH NAME 3 | pfstmo_reinhard05 \- Photoreceptor based dynamic range reduction 4 | .SH SYNOPSIS 5 | .B pfstmo_reinhard05 6 | [--brightness ] [--chromatic ] [--light ] 7 | [--verbose] [--help] 8 | .SH DESCRIPTION 9 | This command implements a tone mapping operator as described in: 10 | 11 | Dynamic Range Reduction Inspired by Photoreceptor Physiology. 12 | E. Reinhard and K. Devlin. 13 | In IEEE Transactions on Visualization and Computer Graphics, 2005. 14 | 15 | .SH OPTIONS 16 | .TP 17 | --brightness , -b 18 | 19 | Brightness correction (-8..8), parameter 'f' in paper. 20 | Default value: 0.0 21 | .TP 22 | --chromatic , -c 23 | 24 | Amount of chromatic adaptation (von Kries model) (0..1), parameter 'c' in paper. 25 | Default value: 0.0 26 | .TP 27 | --light , -l 28 | 29 | Amount of light adaptation adaptation (0..1), parameter 'l' in paper. 30 | Default value: 1.0 31 | .TP 32 | --verbose 33 | 34 | Print additional information during program execution. 35 | .TP 36 | --help 37 | 38 | Print list of commandline options. 39 | .SH EXAMPLES 40 | .TP 41 | pfsin memorial.hdr | pfstmo_reinhard05 -s 0.5 | pfsgamma -g 2.2 | pfsout memorial.png 42 | 43 | Tone map image and save it in png format. 44 | .SH "SEE ALSO" 45 | .BR pfsgamma (1) 46 | .BR pfsin (1) 47 | .BR pfsout (1) 48 | .BR pfsview (1) 49 | .SH BUGS 50 | Please report bugs and comments on implementation to 51 | Grzegorz Krawczyk . 52 | -------------------------------------------------------------------------------- /cmake_config.h.in: -------------------------------------------------------------------------------- 1 | /* config.h.in. Generated from configure.ac by autoheader. */ 2 | 3 | 4 | /* Define to the version of this package. */ 5 | #define PACKAGE_VERSION "${pfstools_VERSION_MAJOR}.${pfstools_VERSION_MINOR}" 6 | 7 | #define PACKAGE_STRING "pfstools ${pfstools_VERSION_MAJOR}.${pfstools_VERSION_MINOR}" 8 | 9 | /* Directory where data files are located. */ 10 | #define PKG_DATADIR "${PKG_DATADIR}" 11 | 12 | /* Define to 1 if you have the ANSI C header files. */ 13 | //#undef STDC_HEADERS 14 | 15 | /* Version number of package */ 16 | //#undef VERSION 17 | 18 | /* Windows compilation. */ 19 | //#undef WIN32 20 | 21 | #if ${CYGWIN} 22 | #define CYGWIN 23 | #endif 24 | 25 | #if ${HAVE_OpenMP} 26 | #define HAVE_OpenMP 27 | #endif 28 | 29 | 30 | #if ${HAVE_FFTW3F} 31 | #define HAVE_FFTW3F 32 | #endif 33 | 34 | #if ${HAVE_FFTW3} 35 | #define HAVE_FFTW3 36 | #endif 37 | 38 | /* Output stream for debug messages. */ 39 | #ifdef DEBUG 40 | #define DEBUG_STR std::cerr 41 | #else 42 | #define DEBUG_STR if(1) {;} else std::cerr 43 | #endif 44 | 45 | /* Output stream for verbose messages */ 46 | #define VERBOSE_STR if(verbose) std::cerr << PROG_NAME << ": " 47 | 48 | #if defined(_WIN32) || defined(_WIN64) 49 | #define strcasecmp _stricmp 50 | #define strncasecmp _strnicmp 51 | #endif 52 | 53 | #ifdef BRANCH_PREDICTION 54 | #define likely(x) __builtin_expect((x),1) 55 | #define unlikely(x) __builtin_expect((x),0) 56 | #else 57 | #define likely(x) (x) 58 | #define unlikely(x) (x) 59 | #endif 60 | 61 | -------------------------------------------------------------------------------- /src/camera/mitsunaga99_numerical.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @brief Algorithm for automatic HDR images capture. 3 | * 4 | * 5 | * This file is a part of PFS CALIBRATION package. 6 | * ---------------------------------------------------------------------- 7 | * Copyright (C) 2006 Radoslaw Mantiuk 8 | * 9 | * This program is free software; you can redistribute it and/or modify 10 | * it under the terms of the GNU General Public License as published by 11 | * the Free Software Foundation; either version 2 of the License, or 12 | * (at your option) any later version. 13 | * 14 | * This program is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | * GNU General Public License for more details. 18 | * 19 | * You should have received a copy of the GNU General Public License 20 | * along with this program; if not, write to the Free Software 21 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 22 | * ---------------------------------------------------------------------- 23 | * 24 | * @author Radoslaw Mantiuk, 25 | * 26 | */ 27 | 28 | 29 | 30 | #ifndef _mitsunaga99_numerical_h_ 31 | #define _mitsunaga99_numerical_h_ 32 | 33 | #define NR_LINEAR_EQUATIONS_MAX 20 34 | 35 | class MitsunagaNumerical { 36 | 37 | public: 38 | static int linearEquationsSystem( int n, float a[][NR_LINEAR_EQUATIONS_MAX], float b[]); 39 | 40 | }; 41 | 42 | #endif 43 | -------------------------------------------------------------------------------- /src/hdrhtml/hdrhtml_default_templ/hdrhtml_image_templ.html: -------------------------------------------------------------------------------- 1 | 2 | 3 |
4 | 5 |
6 |
1
7 | ? 8 |
9 |
10 | 14 |
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 35 | 36 | #include 37 | 38 | #include "mex.h" 39 | #include "mex_utils.h" 40 | 41 | #define SCRIPT_NAME "pfsclose" 42 | #define error mexErrMsgTxt 43 | 44 | 45 | 46 | void mexFunction(int nlhs, mxArray *plhs[], 47 | int nrhs, const mxArray *prhs[]) 48 | { 49 | 50 | /* Check for proper number of arguments. */ 51 | if( nrhs != 1 || !mxIsStruct( prhs[0] ) ) 52 | error(SCRIPT_NAME ": Improper usage!"); 53 | 54 | const mxArray *pfs_stream = prhs[0]; 55 | 56 | mxArray *f_fid = mxGetField( pfs_stream, 0, "FID" ); 57 | if( f_fid == NULL || !is_mex_scalar( f_fid ) ) 58 | { 59 | error( SCRIPT_NAME ": FH field missing in the structure or it has wrong type"); 60 | } 61 | 62 | int fid = (int)get_mex_double( f_fid ); 63 | int ret = close( fid ); 64 | if( ret != 0 ) 65 | error( SCRIPT_NAME ": Cannot close the file. Perhaps it is already closed."); 66 | } 67 | -------------------------------------------------------------------------------- /src/tmo/drago03/tmo_drago03.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @brief Frederic Drago logmapping operator 3 | * 4 | * This file is a part of PFSTMO package. 5 | * ---------------------------------------------------------------------- 6 | * Copyright (C) 2003,2004 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: tmo_drago03.h,v 1.3 2008/09/04 12:46:48 julians37 Exp $ 26 | */ 27 | 28 | #ifndef _tmo_drago03_h_ 29 | #define _tmo_drago03_h_ 30 | 31 | /** 32 | * @brief Frederic Drago Logmapping Algorithm 33 | * 34 | * Implementation obtained from source code provided 35 | * by Frederic Drago on 16 May 2003. 36 | * 37 | * @param width image width 38 | * @param height image height 39 | * @param Y [in] image luminance values 40 | * @param L [out] tone mapped values 41 | * @param maxLum maximum luminance in the image 42 | * @param avLum logarithmic average of luminance in the image 43 | * @param bias bias parameter of tone mapping algorithm (eg 0.85) 44 | */ 45 | void tmo_drago03(unsigned int width, unsigned int height, 46 | const float* Y, float* L, 47 | float maxLum, float avLum, float bias); 48 | 49 | /** 50 | * @brief Find average and maximum luminance in an image 51 | * 52 | * @param Y [in] image luminance values 53 | * @param avLum [out] average luminance 54 | * @param maxLum [out] maximum luminance 55 | */ 56 | void calculateLuminance(unsigned int width, unsigned int height, const float* Y, float& avLum, float& maxLum ); 57 | 58 | #endif 59 | -------------------------------------------------------------------------------- /src/filter/pfssize.1: -------------------------------------------------------------------------------- 1 | .TH "pfssize" 1 2 | .SH NAME 3 | pfssize \- Resize frames 4 | .SH SYNOPSIS 5 | .B pfssize 6 | [--x ] [--y ] [--ratio ] [--maxx ] [--maxy ] [--minx ] [--miny ] [--filter ] 7 | .SH DESCRIPTION 8 | Resize all frames and all channels in the stream. Note that resampling 9 | is done on each channel as it is - for color images resampling is 10 | usually done in linear (not gamma corrected) XYZ color space. 11 | .SH OPTIONS 12 | .TP 13 | --x , -x 14 | 15 | New x resolution in pixels. 16 | 17 | .TP 18 | --y , -y 19 | 20 | New y resolution in pixels. 21 | 22 | .TP 23 | --ratio , -r 24 | 25 | Resize both width and height using the given ratio. Ratio equal 1 is the original 26 | size, lower than 1 makes the frames smaller and greater than 1, 27 | enlarges the frames. 28 | 29 | .TP 30 | --minx , --miny 31 | 32 | Make sure that the resulting image has at least width 33 | and/or height. Cannot be used in combination with -x, -y 34 | and --ratio. 35 | 36 | .TP 37 | --maxx , --maxy 38 | 39 | Make sure that the resulting image has at most width 40 | and/or height. Cannot be used in combination with -x, -y 41 | and --ratio. 42 | 43 | .TP 44 | --filter , -f 45 | 46 | Use filter for upsampling (on downsampling, box filter 47 | is always used). Available filters: 48 | 49 | .B BOX 50 | Box filter. This is the fastest and the filter, but it also causes 51 | visible aliasing artifacts. 52 | 53 | .B LINEAR 54 | (deafult) Bi-linear filter. 55 | 56 | .B MITCHELL 57 | Mitchell filter. From \fIMitchell and Netravali, Reconstruction 58 | Filters in Computer Graphics,In Computer Graphics, vol. 22 (4) 59 | 1988\fR. Since the filter contains negative parts, it may cause halo 60 | artifacts and it may result in negative values for HDR images. 61 | 62 | 63 | .SH EXAMPLES 64 | .TP 65 | pfsin memorial.hdr | pfssize -r 0.25 | pfsout memorial_small.hdr 66 | 67 | Lower the resolution of memorial.hdr four times. 68 | 69 | .SH "SEE ALSO" 70 | .BR pfsin (1) 71 | .BR pfsout (1) 72 | .SH BUGS 73 | Please report bugs and comments to Rafal Mantiuk 74 | . 75 | -------------------------------------------------------------------------------- /debian/control: -------------------------------------------------------------------------------- 1 | Source: pfstools 2 | Priority: optional 3 | Maintainer: Andreas Hirczy 4 | Build-Depends: debhelper (>= 4.0.0), autotools-dev, libtiff-dev, libopenexr-dev, libnetpbm10-dev, octave2.1, octave2.1-headers, qt3-dev-tools, libqt3-mt-dev 5 | Standards-Version: 3.6.2 6 | Section: libs 7 | 8 | Package: pfstools 9 | Section: graphics 10 | Architecture: any 11 | Depends: ${shlibs:Depends}, ${misc:Depends}, libpfstools (= ${Source-Version}) 12 | Description: properly colorimetry of images 13 | pfstools package is a set of command line (and one GUI) programs for 14 | reading, writing, manipulating and viewing high-dynamic range (HDR) images 15 | and video frames. All programs in the package exchange data using a simple 16 | generic file format (pfs) for HDR data. The concept of the pfstools is 17 | similar to netpbm package for low-dynamic range images. 18 | . 19 | pfstools come with a library for reading and writing pfs files. The library 20 | can be used for writing custom applications that can integrate with the 21 | existing pfstools programs. 22 | . 23 | pfstools offers also a good integration with a high-level mathematical 24 | programming language GNU Octave. pfstools can be used as the extension of 25 | Octave for reading and writing HDR images or simply to store effectively 26 | large matrices. 27 | . 28 | Note that pfs in not just another format for storing HDR images (and there 29 | are already quite a few of them). It is more an attempt to integrate the 30 | existing file formats by providing a simple data format that can be used to 31 | exchange data between applications. 32 | . 33 | 34 | 35 | 36 | Package: libpfstools-dev 37 | Section: libdevel 38 | Architecture: any 39 | Depends: libpfstools (= ${Source-Version}) 40 | Description: properly colorimetry of images - development files 41 | development files for pfstools 42 | 43 | Package: libpfstools 44 | Section: libs 45 | Architecture: any 46 | Depends: ${shlibs:Depends}, ${misc:Depends} 47 | Description: properly colorimetry of images - libraries 48 | libraries for pfstools 49 | 50 | Package: octave-pfstools 51 | Section: math 52 | Architecture: any 53 | Depends: libpfstools (= ${Source-Version}), octave 54 | Description: properly colorimetry of images - ocatve bindings 55 | octave bindings for pfstools 56 | 57 | -------------------------------------------------------------------------------- /src/tmo/durand02/pfstmo_durand02.1: -------------------------------------------------------------------------------- 1 | .TH "pfstmo_durand02" 1 2 | .SH NAME 3 | pfstmo_durand02 \- Fast bilateral filtering for the display of HDR images 4 | .SH SYNOPSIS 5 | .B pfstmo_durand02 6 | [--sigma-s ] [--sigma-r ] [--base-contrast ] 7 | [--quiet] [--verbose] [--help] 8 | .SH DESCRIPTION 9 | This command implements a tone mapping operator as described in: 10 | .PD 0 11 | .IP 12 | F. Durand and J. Dorsey. 13 | .IP 14 | Fast Bilateral Filtering for the Display of High-Dynamic-Range Images. 15 | .IP 16 | In: In ACM Transactions on Graphics, 2002. 17 | .PD 18 | .PP 19 | According to paper, results of this TMO require gamma correction. 20 | .PP 21 | .PD 0 22 | Unless \fB-g\fR option is specified, this operator also employs color 23 | correction mechanism from: 24 | .IP 25 | Radoslaw Mantiuk, Rafal Mantiuk, Anna Tomaszewska, Wolfgang Heidrich. 26 | .IP 27 | Color Correction for Tone Mapping. 28 | .IP 29 | In: Computer Graphics Forum (Proc. of EUROGRAPHICS'09), 28(2), 2009. 30 | .IP 31 | http://zgk.wi.ps.pl/color_correction/ 32 | .PD 33 | .SH OPTIONS 34 | .TP 35 | \fB--sigma-s\fR , \fB-s\fR 36 | Sigma value for spatial kernel. Default value: 40 37 | .TP 38 | \fB--sigma-r\fR , \fB-r\fR 39 | Sigma value for range kernel. Default value: 0.4 40 | .TP 41 | \fB--base-contrast\fR , \fB-c\fR 42 | Contrast of the base layer. Default value is 5.0f. Lower value causes 43 | higher contrast compression and results in darker picture - can help 44 | if after tone mapping too many pixels remain saturated. 45 | .IP 46 | Increasing this value will results in brighter and more 'dynamic' picture. 47 | .TP 48 | \fB--original\fR, \fB-g\fR 49 | Use original algorithm as described in the 50 | paper with no extensions. For this operator the switch will disable 51 | color correction. 52 | .TP 53 | \fB--verbose\fR 54 | Print additional information during program execution. 55 | .TP 56 | \fB--quiet\fR, \fB-q\fR 57 | Do not display progress report. 58 | .TP 59 | \fB--help\fR, \fB-h\fR 60 | Print list of commandline options. 61 | .SH EXAMPLES 62 | .TP 63 | pfsin memorial.hdr | pfstmo_durand02 | pfsgamma -g 2.2 | pfsout memorial.png 64 | Tone map image and save it in png format. 65 | .SH "SEE ALSO" 66 | .BR pfsgamma (1) 67 | .BR pfsin (1) 68 | .BR pfsout (1) 69 | .BR pfsview (1) 70 | .SH BUGS 71 | Please report bugs and comments on implementation to 72 | Grzegorz Krawczyk . 73 | -------------------------------------------------------------------------------- /src/camera/pfsinhdrgen.in: -------------------------------------------------------------------------------- 1 | #!@PERL_PATH@ -w 2 | # 3 | # This file is a part of PFS CALIBRATION package. 4 | # ---------------------------------------------------------------------- 5 | # Copyright (C) 2004 Grzegorz Krawczyk, 6 | # 7 | # This program is free software; you can redistribute it and/or modify 8 | # it under the terms of the GNU General Public License as published by 9 | # the Free Software Foundation; either version 2 of the License, or 10 | # (at your option) any later version. 11 | # 12 | # This program is distributed in the hope that it will be useful, 13 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | # GNU General Public License for more details. 16 | # 17 | # You should have received a copy of the GNU General Public License 18 | # along with this program; if not, write to the Free Software 19 | # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 20 | # ---------------------------------------------------------------------- 21 | # 22 | # $Id: pfsinhdrgen,v 1.5 2007/08/28 15:15:24 gkrawczyk Exp $ 23 | 24 | use Getopt::Long; 25 | 26 | #--- check params 27 | GetOptions ('v|verbose' => \$verbose, 28 | 'h|help' => \$help); 29 | 30 | if( $help or @ARGV<1 ) { 31 | print STDERR "Usage: pfsinhdrgen [--verbose] \n"; 32 | exit; 33 | } 34 | 35 | ($hdrgen) = $ARGV[0]; 36 | 37 | (-e $hdrgen) or die "File does not exist '$hdrgen'"; 38 | open HDRGEN, "<$hdrgen"; 39 | 40 | #--- parse file 41 | while( $line= ) 42 | { 43 | @token = split " ", $line; 44 | $file = $token[0]; 45 | $inv_exposure_time = $token[1]; 46 | $aperture = $token[2]; 47 | $iso_speed = $token[3]; 48 | 49 | ## defaults 50 | $iso_speed = 100 if( $iso_speed==0); 51 | $aperture = 1.0 if( $aperture==0); 52 | 53 | ## APEX calculations 54 | $Av = 2 * log($aperture) / log(2); 55 | $Tv = log($inv_exposure_time) / log(2); 56 | $Sv = log( $iso_speed / 3.125 ) / log(2); 57 | 58 | ## Brightness value 59 | $Bv = $Av+$Tv-$Sv; 60 | 61 | (-e $file) or die "Missing image '$file'"; 62 | 63 | print STDERR "pfsinhdrgen: reading $file (iso$iso_speed,f/$aperture,t=$inv_exposure_time)\n" if( $verbose );; 64 | system "pfsin $file | pfstag --set \"BV=$Bv\"\n"; 65 | } 66 | 67 | close HDRGEN; 68 | 69 | -------------------------------------------------------------------------------- /src/hdrhtml/hdrhtml_hdrlabs_templ/hdrhtml_assets/hdr_viewer.css: -------------------------------------------------------------------------------- 1 | /* optional: full page styling with dark background */ 2 | 3 | body { background-color: #1A1C1F; font-family: sans-serif, Helvetica Narrow; color: CDCDCD; } 4 | 5 | a { color: #FF5020; text-decoration: none; } 6 | a:hover { color: #FF5020; text-decoration: underline; } 7 | 8 | /* required: HDR-Viewer styling, adjust as needed */ 9 | 10 | .hdr_viewer { 11 | background-color: #000; 12 | -moz-border-radius: 8px; 13 | -webkit-border-radius: 8px; 14 | padding: 4px 6px 4px 6px; 15 | margin: 10px; 16 | font-family: sans-serif; 17 | } 18 | 19 | .hdr_viewport { 20 | position: relative; 21 | margin: 3px 0px 3px 0px; 22 | } 23 | 24 | .hdr_controller { 25 | position: relative; 26 | height: 36px; 27 | margin: 2px 0px 2px 0px; 28 | overflow: hidden; 29 | } 30 | 31 | .knob { position: absolute; 32 | height: 36px; 33 | opacity: 0.3; 34 | filter: alpha(opacity = 30); 35 | background: #FFFFFF center center url('slider-black.png') no-repeat; 36 | cursor: pointer; 37 | -moz-border-radius: 3px; 38 | -webkit-border-radius: 3px; 39 | } 40 | 41 | div.knob:hover { 42 | background-color: #FF5020; 43 | opacity: 0.7; 44 | filter: alpha(opacity = 70); 45 | } 46 | 47 | .label { 48 | color: white; 49 | font-family: Florence, cursive; 50 | width: 110px; 51 | padding: 5px 10px 5px 10px; 52 | } 53 | 54 | .labelnumber { 55 | text-align: right; 56 | display: inline-block; 57 | width: 50px; 58 | } 59 | 60 | .hdr_help { 61 | position: absolute; 62 | right: 6px; 63 | top: 8px; 64 | opacity: 0.5; 65 | filter: alpha(opacity = 50); 66 | width: 22px; 67 | height: 22px; 68 | background: top left url('information.png') no-repeat; 69 | cursor: pointer; 70 | } 71 | 72 | div.hdr_help:hover { 73 | background: top left url('information-red.png') no-repeat; 74 | opacity: 1; 75 | } 76 | 77 | .hdr_instructions { 78 | color: #FFF; 79 | background-color: #000; 80 | } 81 | 82 | .spinner { 83 | position: absolute; 84 | opacity: 0.9; 85 | filter: alpha(opacity=90); 86 | z-index: 999; 87 | background: #000; 88 | } 89 | 90 | .spinner-img { 91 | background: url('loading-spinner.gif') no-repeat; 92 | width: 31px; 93 | height: 31px; 94 | margin: 0 auto; 95 | } 96 | -------------------------------------------------------------------------------- /src/octave/pfsview.m: -------------------------------------------------------------------------------- 1 | function pfsview( varargin ) 2 | ## Shows set of high-dynamic range matrices using pfsview 3 | ## 4 | ## Usage: pfsview( ["title",] channel [,"channel name"], ... ) 5 | ## 6 | ## title - (optional) a title to be displayed in the title bar of pfsview 7 | ## channel - a real matrix, or a cell array of real matrixes 8 | ## channel name - (optional) name for the channel given as next argument 9 | 10 | C = varargin{1}; 11 | width = -1; 12 | height = -1; 13 | 14 | title = "Octave"; 15 | n = 1; 16 | for i=1:length( varargin ) 17 | if iscell(varargin{i}) 18 | C = varargin{i}; 19 | width = columns( C{1} ); 20 | height = rows( C{1} ); 21 | for j=1:length(C) 22 | ch_name = sprintf( "ch%d", n++ ); 23 | if( !exist( "channels" ) ) 24 | channels = struct( ch_name, C{j} ); 25 | else 26 | channels = setfield( channels, ch_name, C{j} ); 27 | endif 28 | endfor 29 | elseif( ismatrix( varargin{i} ) ) 30 | ch_name = sprintf( "ch%d", n++ ); 31 | if( !exist( "channels" ) ) 32 | channels = struct( ch_name, varargin{i} ); 33 | else 34 | channels = setfield( channels, ch_name, varargin{i} ); 35 | endif 36 | width = columns( varargin{i} ); 37 | height = rows( varargin{i} ); 38 | elseif( ischar( varargin{i} ) ) 39 | if( i == 1 ) 40 | title = varargin{i}; 41 | else 42 | if( !exist( "channels" ) || !exist( "ch_name" ) ) 43 | error( "channel_name argument must follow channel argument" ); 44 | else 45 | channels = setfield( channels, varargin{i}, ... 46 | getfield( channels, ch_name ) ); 47 | channels = rmfield( channels, ch_name ); 48 | clear ch_name; 49 | endif 50 | endif 51 | endif 52 | endfor 53 | 54 | hdr_name = tmpnam(); 55 | 56 | pfsout = pfsopen( hdr_name, height, width ); 57 | pfsout.channels = channels; 58 | pfsout.tags.FILE_NAME = title; 59 | 60 | ## This should go after 'system' call, but it is so fifo seems to be 61 | ## not initialized for reading 62 | pfsput( pfsout ); 63 | 64 | xv = sprintf ("pfsview <%s", hdr_name); 65 | rm = sprintf ("rm -f %s", hdr_name); 66 | 67 | system (sprintf ("( %s && %s ) > /dev/null 2>&1 &", 68 | xv, rm)); 69 | 70 | pfsclose( pfsout ); 71 | 72 | endfunction 73 | --------------------------------------------------------------------------------