Closed mipamio closed 1 year ago
Hello, thank you for your question. I wrote the code for BT.2407 three years ago, so it really takes me back.
Upon further review, I've realized that the code for BT.2407 doesn't work as it is. Therefore, after answering your question, I'll also guide you through the steps to execute the Python code.
The souce code of BT.2407 doesn't work with the latest libraries because it hasn't been maintained. It should be run in the environment listed below.
> python --version
Python 3.8.2
> pip freeze
alabaster==0.7.12
attrs==19.3.0
Babel==2.8.0
backcall==0.2.0
bleach==3.1.5
certifi==2020.6.20
chardet==3.0.4
colour-science==0.3.15
cycler==0.10.0
decorator==4.4.2
defusedxml==0.6.0
docutils==0.16
entrypoints==0.3
flake8==3.8.3
idna==2.10
imageio==2.9.0
imagesize==1.2.0
ipykernel==5.3.2
ipython==7.16.1
ipython-genutils==0.2.0
ipywidgets==7.5.1
jedi==0.17.1
Jinja2==2.11.2
json5==0.9.5
jsonschema==3.2.0
jupyter==1.0.0
jupyter-client==6.1.5
jupyter-console==6.1.0
jupyter-core==4.6.3
jupyterlab==2.1.5
jupyterlab-server==1.2.0
kiwisolver==1.2.0
MarkupSafe==1.1.1
matplotlib==3.2.2
mccabe==0.6.1
mistune==0.8.4
more-itertools==8.4.0
mpmath==1.1.0
nbconvert==5.6.1
nbformat==5.0.7
notebook==6.0.3
numpy==1.19.0
opencv-python==4.3.0.36
packaging==20.4
pandocfilters==1.4.2
parso==0.7.0
pexpect==4.8.0
pickleshare==0.7.5
Pillow==7.2.0
pkg-resources==0.0.0
pluggy==0.13.1
prometheus-client==0.8.0
prompt-toolkit==3.0.5
ptyprocess==0.6.0
py==1.9.0
pycodestyle==2.6.0
pyflakes==2.2.0
Pygments==2.6.1
pyparsing==2.4.7
pyrsistent==0.16.0
PySimpleGUI==4.24.0
pytest==5.4.3
python-dateutil==2.8.1
pytz==2020.1
pyzmq==19.0.1
qtconsole==4.7.5
QtPy==1.9.0
requests==2.24.0
scipy==1.5.1
Send2Trash==1.5.0
six==1.15.0
snowballstemmer==2.0.0
Sphinx==3.1.2
sphinx-rtd-theme==0.5.0
sphinxcontrib-applehelp==1.0.2
sphinxcontrib-devhelp==1.0.2
sphinxcontrib-htmlhelp==1.0.3
sphinxcontrib-jsmath==1.0.1
sphinxcontrib-qthelp==1.0.3
sphinxcontrib-serializinghtml==1.1.4
sympy==1.6.1
terminado==0.8.3
testpath==0.4.4
tornado==6.0.4
traitlets==4.3.3
urllib3==1.25.9
wcwidth==0.2.5
webencodings==0.5.1
widgetsnbextension==3.5.1
bt2407_gamut_mapping_for_rgb_linear
function of bt2047_gamut_mapping.pyFirst, it would be best to revert the "sample_code" back to its state from three years ago. You can do this by executing the command provided below.
> git checkout https://github.com/toru-ver4/sample_code.git
> cd sample_code
> git checkout e1f9166
Second, you need to set up the Python environment mentioned earlier. If you're having difficulty setting up the environment, you can also use the Docker environment I used three years ago.
You can launch the Docker Image using the command provided below.
docker run -it -P --name python_dev_11 -v <PATH_TO_THE_"sample_code">:/work/src -e DISPLAY=host.docker.internal:0.0 -e PYTHONPATH="/usr/local/lib/python3.8/site-packages:/work/src/ty_lib" --rm takuver4/python_dev:rev07 bash
Next, you'll need to modify make_bt2407_luts.py, as it's necessary to create the LUTs in advance.
--- a/2020/020_explain_BT2407/make_bt2047_luts.py
+++ b/2020/020_explain_BT2407/make_bt2047_luts.py
@@ -987,19 +987,19 @@ def make_chroma_mapping_lut(
def main_func():
# make_gamut_boundary_lut_all()
# make_gamut_boundary_lut_all_fast()
- # make_gamut_boundary_lut_all_fastest()
+ make_gamut_boundary_lut_all_fastest()
make_focal_lut(
outer_color_space_name=cs.BT2020,
inner_color_space_name=cs.BT709)
- # make_focal_lut(
- # outer_color_space_name=cs.P3_D65,
- # inner_color_space_name=cs.BT709)
- # make_chroma_map_lut(
- # outer_color_space_name=cs.BT2020,
- # inner_color_space_name=cs.BT709)
- # make_chroma_map_lut(
- # outer_color_space_name=cs.P3_D65,
- # inner_color_space_name=cs.BT709)
+ make_focal_lut(
+ outer_color_space_name=cs.P3_D65,
+ inner_color_space_name=cs.BT709)
+ make_chroma_map_lut(
+ outer_color_space_name=cs.BT2020,
+ inner_color_space_name=cs.BT709)
+ make_chroma_map_lut(
+ outer_color_space_name=cs.P3_D65,
+ inner_color_space_name=cs.BT709)
pass
Finally, you'll create LUTs using the command provided below.
> cd /<checkout_path>/2020/020_explain_BT2407/
> mkdir ./luts
> mkdir ./3DLUT
> python make_bt2047_luts.py
It's been a long explanation, but this should prepare you to successfully run bt2407_gamut_mapping_for_rgb_linear
.
I hope it works well for you.
Hi,when I ran the BT2407 method 2 code, there were a lot of errors, mostly related to the environment configuration. Would you provide a python requirement file in your projects if convenient?