htpp

htrdr-image post-processing
git clone git://git.meso-star.fr/htpp.git
Log | Files | Refs | README | LICENSE

commit 46086843732ed4b5d1fc0a2c169e68c8d85588bb
parent df629b1d9c8024705748ff87ee95d693f12579e1
Author: Vincent Forest <vincent.forest@meso-star.com>
Date:   Wed, 11 Jan 2023 11:32:36 +0100

Merge branch 'release_0.4.3'

Diffstat:
MREADME.md | 36+++++++++++++++++++-----------------
Mcmake/CMakeLists.txt | 61+++++++++++++++++++++++++------------------------------------
Dcmake/doc/CMakeLists.txt | 145-------------------------------------------------------------------------------
Ddoc/htpp-man.css | 96-------------------------------------------------------------------------------
Adoc/htpp.1.scd | 257+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Ddoc/htpp.1.txt | 188-------------------------------------------------------------------------------
Msrc/htpp.c | 32++++++++------------------------
Msrc/htpp_version.h.in | 5+++--
8 files changed, 312 insertions(+), 508 deletions(-)

diff --git a/README.md b/README.md @@ -1,14 +1,8 @@ -# High-Tune: Post-Process +# htpp -This program is used to post process HDR images saved in the CIE 1931 XYZ color -space, as generated by the [HTRDR](https://gitlab.com/meso-star/htcp/) program. - -The input images are simple ASCII files where empty lines are ignored. The text -behind the `#` char is considered as comments. The first valid line of the file -must list 2 integers defining the width and the height of the image. Then, each -subsequent line must list 3 pairs of floating point data, each pair -representing the estimation and the uncertainty of the X, Y and Z component of -a pixel. The pixels are row major ordered, i.e. they are listed row by row. +This program is used to post process images saved in the +[htrdr-image](https://gitlab.com/meso-star/htrdr/-/blob/master/doc/htrdr-image.5.scd) +file format. ## How to build @@ -29,6 +23,12 @@ informations on CMake. ## Release notes +### Version 0.4.3 + +- Add list of available palettes to man page. +- Use scdoc rather than asciidoc as file format for man sources. +- Remove deprecated MSVC support. + ### Version 0.4.2 - Fix a wrong assertion on the range of the data to display: in debug `htpp` @@ -85,12 +85,14 @@ informations on CMake. [htrdr](https://gitlab.com/meso-star/htrdr/) 0.1 that adds to each pixel the estimation of the per realisation path computation time. -## License +## Copyright notice + +Copyright © 2018-2020, 2023 [|Méso|Star>](https://www.meso-star.com) (<contact@meso-star.com>) +Copyright © 2018-2019 Centre National de la Recherche Scientifique +Copyright © 2018-2019 Université Paul Sabatier -Copyright (C) 2018, 2019, 2029 [|Meso|Star>](https://www.meso-star.com) -<contact@meso-star.com>. Copyright (C) 2018-2019 Centre National de la -Recherche (CNRS), Université Paul Sabatier -<contact-edstar@laplace.univ-tlse.fr>. htpp is free software released under the -GPL v3+ license: GNU GPL version 3 or later. You are welcome to redistribute it -under certain conditions; refer to the COPYING file for details. +## License +`htpp` is free software released under the GPL v3+ license: GNU GPL version 3 +or later. You are welcome to redistribute it under certain conditions; refer to +the COPYING file for details. diff --git a/cmake/CMakeLists.txt b/cmake/CMakeLists.txt @@ -1,5 +1,6 @@ -# Copyright (C) 2018, 2019, 2020 |Meso|Star> (contact@meso-star.com) -# Copyright (C) 2018, 2019 Université Paul Sabatier +# Copyright (C) 2018-2020, 2023 |Méso|Star> (contact@meso-star.com) +# Copyright (C) 2018-2019 Centre National de la Recherche Scientifique +# Copyright (C) 2018-2019 Université Paul Sabatier # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -19,20 +20,6 @@ project(htpp C) set(HTPP_SOURCE_DIR ${PROJECT_SOURCE_DIR}/../src) -if(CMAKE_HOST_UNIX) - set(HTPP_DOC "TROFF" CACHE STRING - "Type of documentation to generate and install.") -else() - set(HTPP_DOC "HTML" CACHE STRING - "Type of documentation to generate and install.") -endif() - -set_property(CACHE HTPP_DOC PROPERTY STRINGS - "HTML" - "TROFF" - "TROFF & HTML" - "NONE") - ################################################################################ # Check dependencies ################################################################################ @@ -40,9 +27,6 @@ find_package(RCMake 0.3 REQUIRED) find_package(RSys 0.9 REQUIRED) find_package(StarCMap 0.0 REQUIRED) find_package(OpenMP 1.2 REQUIRED) -if(MSVC) - find_package(MuslGetopt REQUIRED) -endif() set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${RCMAKE_SOURCE_DIR}) include(rcmake) @@ -52,23 +36,13 @@ include_directories( ${RSys_INCLUDE_DIR} ${StarCMap_INCLUDE_DIR} ${CMAKE_CURRENT_BINARY_DIR}) -if(MSVC) - include_directories(${MuslGetopt_INCLUDE_DIR}) -endif() - -############################################################################### -# Build subprojects -############################################################################### -if(NOT HTPP_DOC STREQUAL "NONE") - add_subdirectory(doc) -endif() ################################################################################ # Configure and define targets ################################################################################ set(VERSION_MAJOR 0) set(VERSION_MINOR 4) -set(VERSION_PATCH 2) +set(VERSION_PATCH 3) set(VERSION ${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}) configure_file(${HTPP_SOURCE_DIR}/htpp_version.h.in @@ -87,12 +61,7 @@ if(CMAKE_COMPILER_IS_GNUCC) set(MATH_LIB m) endif() -if(MSVC) - set(GETOPT_LIB MuslGetopt) -endif() - target_link_libraries(htpp RSys StarCMap ${MATH_LIB} ${GETOPT_LIB}) - set_target_properties(htpp PROPERTIES COMPILE_FLAGS "${OpenMP_C_FLAGS}") if(CMAKE_COMPILER_IS_GNUCC) @@ -106,6 +75,27 @@ set_target_properties(htpp PROPERTIES SOVERSION ${VERSION_MAJOR}) ################################################################################ +# Man page +############################################################################### +find_program(SCDOC NAMES scdoc) +if(NOT SCDOC) + message(WARNING + "The `scdoc' program is missing. " + "The htpp man page cannot be generated.") +else() + set(_src ${PROJECT_SOURCE_DIR}/../doc/htpp.1.scd) + add_custom_command( + OUTPUT htpp.1 + COMMAND ${SCDOC} < ${_src} > htpp.1 + DEPENDS ${_src} + WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} + COMMENT "Buid ROFF man page htpp.1" + VERBATIM) + add_custom_target(man-roff ALL DEPENDS htpp.1) + install(FILES ${CMAKE_CURRENT_BINARY_DIR}/htpp.1 DESTINATION share/man/man1) +endif() + +################################################################################ # Define output & install directories ################################################################################ install(TARGETS htpp @@ -113,4 +103,3 @@ install(TARGETS htpp LIBRARY DESTINATION lib RUNTIME DESTINATION bin) install(FILES ${HTPP_FILES_DOC} DESTINATION share/doc/htpp) - diff --git a/cmake/doc/CMakeLists.txt b/cmake/doc/CMakeLists.txt @@ -1,145 +0,0 @@ -# Copyright (C) 2018-2020 |Meso|Star> -# -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program. If not, see <http://www.gnu.org/licenses/>. - -cmake_minimum_required(VERSION 3.0) - -string(REGEX MATCH ".*HTML.*" _html ${HTPP_DOC}) -string(REGEX MATCH ".*ROFF.*" _roff ${HTPP_DOC}) - -set(HTPP_DOC_DIR ${PROJECT_SOURCE_DIR}/../doc) - -################################################################################ -# Look for asciidoc and a2x programs -################################################################################ -if(_html) - find_program(ASCIIDOC NAMES asciidoc asciidoc.py) - if(NOT ASCIIDOC) - unset(_html) - message(WARNING - "The `asciidoc' program is missing. " - "The htpp HTML documentation cannot be generated.") - endif() -endif() - -if(_roff) - find_program(A2X NAMES a2x a2x.py) - if(NOT A2X) - unset(_roff) - message(WARNING - "The `a2x' program is missing. " - "The htpp man pages cannot be generated.") - endif() -endif() - -################################################################################ -# Copy doc files -################################################################################ -set(MAN_NAMES htpp.1) - -if(_roff OR _html) - set(MAN_FILES) - foreach(_name IN LISTS MAN_NAMES) - set(_src ${HTPP_DOC_DIR}/${_name}.txt) - set(_dst ${CMAKE_CURRENT_BINARY_DIR}/${_name}.txt) - add_custom_command( - OUTPUT ${_dst} - COMMAND ${CMAKE_COMMAND} -E copy ${_src} ${_dst} - DEPENDS ${_src} - COMMENT "Copy the asciidoc ${_src}" - VERBATIM) - list(APPEND MAN_FILES ${_dst}) - endforeach() - add_custom_target(man-copy ALL DEPENDS ${MAN_FILES}) -endif() - -################################################################################ -# ROFF man pages -################################################################################ -if(_roff) - set(A2X_OPTS -dmanpage -fmanpage) - set(MAN_FILES) - set(MAN5_FILES) - set(MAN1_FILES) - foreach(_name IN LISTS MAN_NAMES) - set(_man ${CMAKE_CURRENT_BINARY_DIR}/${_name}) - set(_txt ${CMAKE_CURRENT_BINARY_DIR}/${_name}.txt) - - add_custom_command( - OUTPUT ${_man} - COMMAND ${A2X} ${A2X_OPTS} ${_txt} - DEPENDS man-copy ${_txt} - WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} - COMMENT "Build ROFF man page ${_man}" - VERBATIM) - list(APPEND MAN_FILES ${_man}) - - string(REGEX MATCH "^.*.5$" _man5 ${_man}) - string(REGEX MATCH "^.*.1$" _man1 ${_man}) - if(_man1) - list(APPEND MAN1_FILES ${_man1}) - elseif(_man5) - list(APPEND MAN5_FILES ${_man5}) - else() - message(FATAL_ERROR "Unexpected man type") - endif() - endforeach() - add_custom_target(man-roff ALL DEPENDS ${MAN_FILES}) - - install(FILES ${MAN1_FILES} DESTINATION share/man/man1) - install(FILES ${MAN5_FILES} DESTINATION share/man/man5) -endif() - -################################################################################ -# HTML documentation -################################################################################ -if(_html) - set(ASCIIDOC_OPTS - -bxhtml11 - -dmanpage - --attribute themedir=${HTPP_DOC_DIR} - --theme=htpp-man) - - set(MAN_FILES) - set(MAN5_FILES) - set(MAN1_FILES) - foreach(_name IN LISTS MAN_NAMES) - set(_man ${CMAKE_CURRENT_BINARY_DIR}/${_name}.html) - set(_txt ${CMAKE_CURRENT_BINARY_DIR}/${_name}.txt) - - add_custom_command( - OUTPUT ${_man} - COMMAND ${ASCIIDOC} ${ASCIIDOC_OPTS} ${_txt} - DEPENDS man-copy ${_txt} ${HTPP_DOC_DIR}/htpp-man.css - WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} - COMMENT "Build HTML man page ${_man}" - VERBATIM) - list(APPEND MAN_FILES ${_man}) - - string(REGEX MATCH "^.*.5.html$" _man5 ${_man}) - string(REGEX MATCH "^.*.1.html$" _man1 ${_man}) - if(_man1) - list(APPEND MAN1_FILES ${_man1}) - elseif(_man5) - list(APPEND MAN5_FILES ${_man5}) - else() - message(FATAL_ERROR "Unexpected man type") - endif() - endforeach() - add_custom_target(man-html ALL DEPENDS ${MAN_FILES}) - - install(FILES ${MAN1_FILES} DESTINATION share/doc/htpp/html) - install(FILES ${MAN5_FILES} DESTINATION share/doc/htpp/html) -endif() - diff --git a/doc/htpp-man.css b/doc/htpp-man.css @@ -1,96 +0,0 @@ -/* Copyright (C) 2016-2018 CNRS - * - * This is free style sheet: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This CSS is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see http://www.gnu.org/licenses/. */ - -body.manpage { - font-family:"Liberation Sans",sans-serif; - font-size:10pt; - text-align: justify; - max-width: 55em; - margin: 1em; - background: #ffffff -} - -body.manpage .monospaced, .literalblock { - margin: 2em; - color: #636261 -} - -body.manpage em { - color: #660000 -} - -body.manpage div.verseblock > pre.content { - font-family: "Liberation Mono",monospace; -} - -body.manpage h1 { - padding-bottom: 0.5em; -} -body.manpage h2 { - border-style: none; -} -body.manpage div.sectionbody { - margin-left: 3em; -} - -body.manpage code { - font-family: "Liberation Mono",monospace; -} - -body.manpage #footer { display: none; } - -body.manpage div#toctitle { display: none; } - -body.manpage div#toc { - display: block; - position:fixed; - top:0; - left:60em; - height:100%; - width: 100%; - padding:3em 0 0 0; - border-left:1px solid #dbdbdb; - background: #eeeeee -} - -body.manpage a { - font-weight: bold; - color: #225588; -} - -body.manpage div#toc a, div#toc a:link, div#toc a:visited { - margin:0; - padding-left: 2em; - color:#999999; - text-decoration:none; - font-weight: normal; -} - -body.manpage div.toclevel1 { - line-height: 1.5em; -} - -body.manpage div.toclevel2 { - margin-left: 2em; -} - -body.manpage div#toc a:hover { - color:#666666; -} - -@media print { - body.manpage div#toc { display: none; } -} - diff --git a/doc/htpp.1.scd b/doc/htpp.1.scd @@ -0,0 +1,257 @@ +htpp(1) + +; Copyright (C) 2018-2020, 2023 |Méso|Star> (contact@meso-star.com) +; Copyright (C) 2018-2019 Centre National de la Recherche Scientifique +; Copyright (C) 2018-2019 Université Paul Sabatier +; +; This program is free software: you can redistribute it and/or modify +; it under the terms of the GNU General Public License as published by +; the Free Software Foundation, either version 3 of the License, or +; (at your option) any later version. +; +; This program is distributed in the hope that it will be useful, +; but WITHOUT ANY WARRANTY; without even the implied warranty of +; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +; GNU General Public License for more details. +; +; You should have received a copy of the GNU General Public License +; along with this program. If not, see <http://www.gnu.org/licenses/>. + +# NAME + +htpp - High-Tune: Post-Process + +# SYNOPSIS + +htpp [_option_] ... [_input_] + +# DESCRIPTION + +*htpp* post-processes an *htrdr-image*(5) and converts it to a PPM [1] image or a +*gnuplot*(1) script. If _input_ is not defined, the input image is read from +standard input. Two post-processing procedures are provided: image color +post-processing (*-i* option) and mapping of a given pixel component to a color +gradient (*-m* option). By default, *htpp* post-processes the color of the +image. + +## Color post-processsing + +To post-process image colors (*-i* option) *htpp* assumes that the first, third +and fifth components of each input pixel encode a color in the CIE 1931 XYZ +color space. First, *htpp* applies tone correction to these colors via the +following filmic tone mapping operator [2]: + +``` +out-color = f(in-color * exposure) / f(white-value * exposure) +``` + +with: + +``` +f(x) = (x * (A*x + C*B) + D*E) / (x*(A*x + B + D*F)) - E/F + +A = 0.15 +B = 0.50 +C = 0.10 +D = 0.20 +E = 0.02 +F = 0.30 +``` + +The term _exposure_ is a user-defined parameter provided via the _exposure_ +image option. If not set, a default _exposure_ of 1 is used. The _white-value_ +is either set by the user via the _white_ image option or calculated +automatically as the luminance such that 99.5% of the pixel luminances are below +_white-value_. + +After the tone correction function is applied, pixels are transformed from the +CIE 1931 XYZ color space to the linear sRGB color space before being gamma +corrected. Finally, the resulting pixel components are truncated between [0, 1] +and finally encoded to 8 bits. + +## Map a value to a color gradient + +The mapping of a pixel component to a color gradient is controlled by the *-m* +option. The pixel component to be post-processed is defined by the _pixcpnt_ +mapping option. *htpp* normalizes this component to its range across the whole +image or to the _range_ mapping option if set. The resulting value is then +mapped to a color gradient whose name is defined by the _palette_ mapping +option; see the PALETTES section for a list of available color gradients. + +# OPTIONS + +*-f* + Force overwrite of the _output_ file. + +*-h* + List short help and exit. + +*-i* <_sub-option_>[:<_sub-option_> ...] + Post-process the color of the *htrdr-image*(5). The first, the third and the + fifth pixel components are assumed to store the pixel color encoded into the + CIE 1931 XYZ color space. Available sub-options are: + + *default* + Use the default values of the sub-options. + + *exposure*=_real_ + Pixel exposure. By default its value is 1. + + *white*=_radiance_;; + Radiance in the _input_ image that will represent the white color in + _output_. If not defined, the white value is automatically computed from + the radiance of the _input_ image. + +*-m* <_sub-option_>[:<_sub-option_> ...] + Map a pixel component to a regular color. Available sub options are: + + *default* + Use the default values of the sub-options. + + *palette*=_palette-name_ + Color palette to use. See the _PALETTES_ section for a complete + list of supported palettes. The default palette is _inferno_. + + *pixcpnt*=_pixel-component_ + Index in [0, 7] of the pixel component to map. The default pixel component + is the first one, i.e. *pixcpnt*=0. + + *range*=_min_,_max_ + Range of the values to map. A degenerated range (i.e. _min_ >= _max_) means + that this range is automatically computed from the boundaries of the + selected pixel component over the whole image. This is the default + comportment. + + *gnuplot* + The _output_ image is formatted as a gnuplot script rather than a PPM + image. Once executed, the script generates a PNG image with an embedded + color ramp. Note that this script can be edited in order to adjust the + generated image to any requirements. + +*-o* _output_ + File where the result is written. If not defined, write _output_ to standard + output. + +*-t* _threads-count_ + Hint on the number of threads to use. By default use as many threads as CPU + cores. + +*-v* + Make *htpp* verbose. When used in pixel color post-processing (*-i* option), + *htpp* displays the radiance of the _white_ color in the output image. When + mapping a pixel component to a color gradient (*-m* option), *htpp* displays + the color gradient and its associated values. + +*--version* + Display version information and exit. + +# EXAMPLES + +Post-process the *htrdr-image*(5) saved in _img.htrdr_ and write the resulting +PPM image in _img.ppm_. Use the *-f* option to overwrite _img.ppm_ if it +already exists: + +``` +htpp -f -o img.ppm img.htrdr +``` + +Convert _img.htrdr_ and visualise the resulting image by redirecting the +standard output to the *feh*(1) image viewer. Use an _exposure_ of _0.2_ and +explicitly define the white color to _31.2_ W/sr/m²: + +``` +htpp -i exposure=0.2:white=31.2 img.htrdr | feh - +``` + +Use the *-m* option to map the values of the second pixel component clamped in [0, 2] +to the color ramp _magma_. + +``` +htpp -v -m pixcpnt=1:palette=magma:range=0,2 img.htrdr | feh - +``` + +Use the *-m* option to map the values of the sixth pixel component and write +it as a gnuplot script. Run *gnuplot*(1) to generate a PNG of the result and +visualise the resulting image with *feh*(1). + +``` +htpp -m pixcpnt=6:gnuplot -o img.gp img.htrdr +gnuplot img.gp | feh - +``` + +# PALETTES + +This section lists the available palettes that can be used to map a pixel +component to a color (*-m* option): + +- accent +- blues +- brbg +- bugn +- bupu +- chromajs +- dark2 +- gnbu +- gnpu +- greens +- greys +- inferno +- jet +- magma +- moreland +- oranges +- orrd +- paired +- parula +- pastel1 +- pastel2 +- piyg +- plasma +- prgn +- pubu +- pubugn +- puor +- purd +- purples +- rdbu +- rdgy +- rdpu +- rdylbu +- rdylgn +- reds +- sand +- set1 +- set2 +- set3 +- spectral +- viridis +- whgnbu +- whylrd +- ylgn +- ylgnbu +- ylorbr +- ylorrd +- ylrd + +# COPYRIGHT + +Copyright © 2018, 2019, 2020, 2023 |Méso|Star> <contact@meso-star.com>++ +Copyright © 2018, 2019 Centre National de la Recherche Scientifique++ +Copyright © 2018, 2019 Université Paul Sabatier + +# LICENSE + +*htpp* is free software released under the GPLv3+ license: GNU GPL version 3 or +later <https://gnu.org/licenses/gpl.html>. You are free to change and +redistribute it. There is NO WARRANTY, to the extent permitted by law. + +# SEE ALSO + +. Portable PixMap - <http://netpbm.sourceforge.net/doc/ppm.html> +. Filmic tone mapping operator - + <http://filmicworlds.com/blog/filmic-tonemapping-operators/> +. Star-ColorMap - <https://gitlab.com/meso-star/star-cmap> + +*feh*(1), +*gnuplot*(1), +*htrdr-image*(5) diff --git a/doc/htpp.1.txt b/doc/htpp.1.txt @@ -1,188 +0,0 @@ -// Copyright (C) 2018, 2019, 2020 |Meso|Star> (contact@meso-star.com) -// Copyright (C) 2018, 2019 CNRS, Université Paul Sabatier -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program. If not, see <http://www.gnu.org/licenses/>. -:toc: - -htpp(1) -======= - -NAME ----- -htpp - High-Tune: Post-Process - -SYNOPSIS --------- -[verse] -htpp [_option_] ... [_input_] - -DESCRIPTION ------------ - -*htpp* post-processes a *htrdr-image*(5) and converts it to a PPM image [1] or -to a *gnuplot*(1) script. If _input_ is not defined, the *htrdr-image*(5) is -read from standard input. Two post-processing procedures are provided: the -post-processing of the image colors (option *-i*), and the mapping of a given -pixel component onto a color ramp (option "*-m*). By default, *htpp* -post-processes the image color. - -To post-process the image colors (option *-i*) *htpp* assumes that the first, -the third and the fifth components of each *htrdr-image*(5) pixel encode a -color with respect to the CIE 1931 XYZ color space. *htpp* first tone maps -these colors with the following filmic tone mapping operator [2]: - - out-color = f(in-color * exposure) / f(white-value * exposure) - -with: - - f(x) = (x * (A*x + C*B) + D*E) / (x*(A*x + B + D*F)) - E/F - - A = 0.15 - B = 0.50 - C = 0.10 - D = 0.20 - E = 0.02 - F = 0.30 - -The _exposure_ term is an user-defined parameter provided as the _exposure_ -image option. If not defined, a default _exposure_ of 1 is used. The -_white-value_ is either defined by the user through the _white_ image option -or automatically computed as the radiance that is such that 99.5% of pixel -radiances are less than _white-value. Once tone mapped, the pixels are -transformed from the CIE 1931 XYZ color space into the sRGB linear color space -before being gamma corrected. Finally, the resulting pixel components are -clamped to [0, 1] and encoded on 8-bits. - -The mapping of a pixel component onto a color ramp is controlled by the *-m* -option. The pixel component to post-process is defined by the _pixcpnt_ -mapping option. *htpp* normalizes this component according to its range onto -the whole image or with respect to the _range_ mapping option if it is -defined. The resuling value is then mapped to a built-in color ramp whose name -is defined by the _palette_ mapping option. - -OPTIONS -------- -*-f*:: - Force overwrite of the _output_ file. - -*-h*:: - List short help and exit. - -*-i* <__sub-option__>[:<__sub-option__> ...]:: - Post-process the color of the *htrdr-image*(5). The first, the third and the - fifth pixel components are assumed to store the pixel color encoded into the - CIE 1931 XYZ color space. Available sub-options are: - - **default**;; - Use the default values of the sub-options. - - **exposure**=__real__;; - Pixel exposure. By default its value is 1. - - **white**=__radiance__;; - Radiance in the _input_ image that will represent the white color in - _output_. If not defined, the white value is automatically computed from - the radiance of the _input_ image. - -*-m* <__sub-option__>[:<__sub-option__> ...]:: - Map a pixel component to a regular color. Available sub options are: - - **default**;; - Use the default values of the sub-options. - - **palette**=__palette-name__;; - Color palette to use. Available palettes are the ones supported - by the Star-ColorMap library [3]. The default palette is inferno. - - **pixcpnt**=__pixel-component__;; - Index in [0, 7] of the pixel component to map. The default pixel component - is the first one, i.e. *pixcpnt*=0. - - **range**=__min__,__max__;; - Range of the values to map. A degenerated range (i.e. __min__ >= __max__) - means that this range is automatically computed from the boundaries of the - selected pixel component over the whole image. This is the default - comportment. - - **gnuplot**;; - The _output_ image is formatted as a gnuplot script rather than a PPM - image. Once executed, the script generates a PNG image with an embedded - color ramp. Note that this script can be edited in order to adjust the - generated image to any requirements. - -*-o* _output_:: - File where the result is written. If not defined, write _output_ to standard - output. - -*-t* _threads-count_:: - Hint on the number of threads to use. By default use as many threads as CPU - cores. - -*-v*:: - Make *htpp* verbose. When used in post-processing of the pixel color (*-i* - option), this option displays the radiance corresponding to the __white__ - color in the output image. In pixel component mapping mode (*-m* option), - this option displays the color ramp and its associated values. - -*--version*:: - Display version information and exit. - -EXAMPLES --------- - -Post-process the *htrdr-image*(5) saved in *img.htrdr* and write the resulting -PPM image in *img.ppm*. Use the *-f* option to overwrite *img.ppm* if it -already exists: - - $ htpp -f -o img.ppm img.htrdr - -Convert *img.htrdr* and visualise the resulting image by redirecting the -standard output to the *feh*(1) image viewer. Use an _exposure_ of *0.2* and -explicitly define the white color to *31.2* W/sr/m^2: - - $ htpp -i exposure=0.2:white=31.2 img.htrdr | feh - - -Use the *-m* option to map the values of the second pixel component clamped in -[0, 2] to the color ramp _magma_. - - $ htpp -v -m pixcpnt=1:palette=magma:range=0,2 img.htrdr | feh - - -Use the *-m* option to map the values of the sixth pixel component and write -it as a gnuplot script. Run *gnuplot*(1) to generate a PNG of the result and -visualise the resulting image with *feh*(1). - - $ htpp -m pixcpnt=6:gnuplot -o img.gp img.htrdr - $ gnuplot img.gp | feh - - -NOTES ------ -1. Portable PixMap - <http://netpbm.sourceforge.net/doc/ppm.html> -2. Filmic tone mapping operator - - <http://filmicworlds.com/blog/filmic-tonemapping-operators/> -3. Star-ColorMap - <https://gitlab.com/meso-star/star-cmap> - -COPYRIGHT ---------- -Copyright &copy; 2018, 2019, 2020 |Meso|Star> <contact@meso-star.com>. -Copyright &copy; 2018, 2019 CNRS, Université Paul Sabatier -<contact-edstar@laplace.univ-tlse.fr>. *htpp* is free software released under -the GPLv3+ license: GNU GPL version 3 or later -<https://gnu.org/licenses/gpl.html>. You are free to change and redistribute -it. There is NO WARRANTY, to the extent permitted by law. - -SEE ALSO --------- -*feh*(1), -*gnuplot*(1) -*htrdr-image*(5) diff --git a/src/htpp.c b/src/htpp.c @@ -1,5 +1,6 @@ -/* Copyright (C) 2018, 2019, 2020 |Meso|Star> (contact@meso-star.com) - * Copyright (C) 2018, 2019 CNRS, Université Paul Sabatier +/* Copyright (C) 2018-2020, 2023 |Méso|Star> (contact@meso-star.com) + * Copyright (C) 2018-2019 Centre National de la Recherche Scientifique + * Copyright (C) 2018-2019 Université Paul Sabatier * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -31,21 +32,7 @@ #include <omp.h> #include <string.h> #include <sys/stat.h> /* S_IRUSR & S_IWUSR */ - -#ifndef COMPILER_CL - #include <unistd.h> /* getopt & close functions */ -#else - #include <getopt.h> - #include <io.h> - - /* Wrap POSIX functions and constants */ - #define open _open - #define close _close - #define fdopen _fdopen - #define S_IRUSR S_IREAD - #define S_IWUSR S_IWRITE - #define strtok_r strtok_s -#endif /* !COMPILER_CL */ +#include <unistd.h> /* getopt & close functions */ enum pixcpnt { PIXCPNT_X, @@ -137,7 +124,7 @@ print_help(const char* cmd) cmd); printf("\n"); printf( -" -f overwrite the OUTPUT file if it already exists.\n"); +" -f overwrite the output file if it already exists.\n"); printf( " -h display this help and exit.\n"); printf( @@ -163,12 +150,9 @@ print_help(const char* cmd) " --version display version information and exit.\n"); printf("\n"); printf( -"Copyright (C) 2018, 2019, 2020 |Meso|Star> <contact@meso-star.com>.\n" -"Copyright (C) 2018, 2019 CNRS, Université Paul Sabatier\n" -"<contact-edstar@laplace.univ-tlse.fr>. htpp is free software released\n" -"under the GNU GPL license, version 3 or later. You are free to change\n" -"or redistribute it under certain conditions\n" -"<http://gnu.org/licenses/gpl.html>.\n"); +"htpp is free software released under the GNU GPL license, version 3 or\n" +"later. You are free to change or redistribute it under certain\n" +"conditions <http://gnu.org/licenses/gpl.html>.\n"); } static res_T diff --git a/src/htpp_version.h.in b/src/htpp_version.h.in @@ -1,5 +1,6 @@ -/* Copyright (C) 2018, 2019, 2020 |Meso|Star> (contact@meso-star.com) - * Copyright (C) 2018, 2019 CNRS, Université Paul Sabatier +/* Copyright (C) 2018-2020, 2023 |Méso|Star> (contact@meso-star.com) + * Copyright (C) 2018-2019 Centre National de la Recherche Scientifique + * Copyright (C) 2018-2019 Université Paul Sabatier * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by