From 4a3f19d874dbe01b3de245107cc7ce5c9f2af5e8 Mon Sep 17 00:00:00 2001 From: BalconyJH Date: Sun, 19 Nov 2023 15:48:10 +0800 Subject: [PATCH 1/3] =?UTF-8?q?:pushpin:=20=E4=BF=AE=E6=94=B9opencv?= =?UTF-8?q?=E4=BE=9D=E8=B5=96=E7=89=88=E6=9C=AC,=20=E6=B7=BB=E5=8A=A0pdm?= =?UTF-8?q?=E4=BE=9D=E8=B5=96=E7=AE=A1=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- tools/CropRoi/.gitignore | 163 +++++++++++++++++++++++++++++++++ tools/CropRoi/README.md | 0 tools/CropRoi/pdm.lock | 60 ++++++++++++ tools/CropRoi/pyproject.toml | 12 +++ tools/CropRoi/requirements.txt | 6 +- 5 files changed, 240 insertions(+), 1 deletion(-) create mode 100644 tools/CropRoi/.gitignore create mode 100644 tools/CropRoi/README.md create mode 100644 tools/CropRoi/pdm.lock create mode 100644 tools/CropRoi/pyproject.toml diff --git a/tools/CropRoi/.gitignore b/tools/CropRoi/.gitignore new file mode 100644 index 0000000..8a62dc8 --- /dev/null +++ b/tools/CropRoi/.gitignore @@ -0,0 +1,163 @@ +### Python template +# Byte-compiled / optimized / DLL files +__pycache__/ +*.py[cod] +*$py.class + +# C extensions +*.so + +# Distribution / packaging +.Python +build/ +develop-eggs/ +dist/ +downloads/ +eggs/ +.eggs/ +lib/ +lib64/ +parts/ +sdist/ +var/ +wheels/ +share/python-wheels/ +*.egg-info/ +.installed.cfg +*.egg +MANIFEST + +# PyInstaller +# Usually these files are written by a python script from a template +# before PyInstaller builds the exe, so as to inject date/other infos into it. +*.manifest +*.spec + +# Installer logs +pip-log.txt +pip-delete-this-directory.txt + +# Unit test / coverage reports +htmlcov/ +.tox/ +.nox/ +.coverage +.coverage.* +.cache +nosetests.xml +coverage.xml +*.cover +*.py,cover +.hypothesis/ +.pytest_cache/ +cover/ + +# Translations +*.mo +*.pot + +# Django stuff: +*.log +local_settings.py +db.sqlite3 +db.sqlite3-journal + +# Flask stuff: +instance/ +.webassets-cache + +# Scrapy stuff: +.scrapy + +# Sphinx documentation +docs/_build/ + +# PyBuilder +.pybuilder/ +target/ + +# Jupyter Notebook +.ipynb_checkpoints + +# IPython +profile_default/ +ipython_config.py + +# pyenv +# For a library or package, you might want to ignore these files since the code is +# intended to run in multiple environments; otherwise, check them in: +# .python-version + +# pipenv +# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control. +# However, in case of collaboration, if having platform-specific dependencies or dependencies +# having no cross-platform support, pipenv may install dependencies that don't work, or not +# install all needed dependencies. +#Pipfile.lock + +# poetry +# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control. +# This is especially recommended for binary packages to ensure reproducibility, and is more +# commonly ignored for libraries. +# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control +#poetry.lock + +# pdm +# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control. +#pdm.lock +# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it +# in version control. +# https://pdm.fming.dev/#use-with-ide +.pdm.toml +.pdm-python + +# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm +__pypackages__/ + +# Celery stuff +celerybeat-schedule +celerybeat.pid + +# SageMath parsed files +*.sage.py + +# Environments +.env +.venv +env/ +venv/ +ENV/ +env.bak/ +venv.bak/ + +# Spyder project settings +.spyderproject +.spyproject + +# Rope project settings +.ropeproject + +# mkdocs documentation +/site + +# mypy +.mypy_cache/ +.dmypy.json +dmypy.json + +# Pyre type checker +.pyre/ + +# pytype static type analyzer +.pytype/ + +# Cython debug symbols +cython_debug/ + +# PyCharm +# JetBrains specific template is maintained in a separate JetBrains.gitignore that can +# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore +# and can be added to the global gitignore or merged into this file. For a more nuclear +# option (not recommended) you can uncomment the following to ignore the entire idea folder. +#.idea/ + diff --git a/tools/CropRoi/README.md b/tools/CropRoi/README.md new file mode 100644 index 0000000..e69de29 diff --git a/tools/CropRoi/pdm.lock b/tools/CropRoi/pdm.lock new file mode 100644 index 0000000..f7d1ffe --- /dev/null +++ b/tools/CropRoi/pdm.lock @@ -0,0 +1,60 @@ +# This file is @generated by PDM. +# It is not intended for manual editing. + +[metadata] +groups = ["default"] +strategy = ["cross_platform"] +lock_version = "4.4" +content_hash = "sha256:c8ef58caa94bb224e56b87703c59a64edc481e38be9413403097d225ff9caccb" + +[[package]] +name = "numpy" +version = "1.26.2" +requires_python = ">=3.9" +summary = "Fundamental package for array computing in Python" +files = [ + {file = "numpy-1.26.2-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:b96e7b9c624ef3ae2ae0e04fa9b460f6b9f17ad8b4bec6d7756510f1f6c0c841"}, + {file = "numpy-1.26.2-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:aa18428111fb9a591d7a9cc1b48150097ba6a7e8299fb56bdf574df650e7d1f1"}, + {file = "numpy-1.26.2-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:06fa1ed84aa60ea6ef9f91ba57b5ed963c3729534e6e54055fc151fad0423f0a"}, + {file = "numpy-1.26.2-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:96ca5482c3dbdd051bcd1fce8034603d6ebfc125a7bd59f55b40d8f5d246832b"}, + {file = "numpy-1.26.2-cp311-cp311-musllinux_1_1_aarch64.whl", hash = "sha256:854ab91a2906ef29dc3925a064fcd365c7b4da743f84b123002f6139bcb3f8a7"}, + {file = "numpy-1.26.2-cp311-cp311-musllinux_1_1_x86_64.whl", hash = "sha256:f43740ab089277d403aa07567be138fc2a89d4d9892d113b76153e0e412409f8"}, + {file = "numpy-1.26.2-cp311-cp311-win32.whl", hash = "sha256:a2bbc29fcb1771cd7b7425f98b05307776a6baf43035d3b80c4b0f29e9545186"}, + {file = "numpy-1.26.2-cp311-cp311-win_amd64.whl", hash = "sha256:2b3fca8a5b00184828d12b073af4d0fc5fdd94b1632c2477526f6bd7842d700d"}, + {file = "numpy-1.26.2-cp312-cp312-macosx_10_9_x86_64.whl", hash = "sha256:a4cd6ed4a339c21f1d1b0fdf13426cb3b284555c27ac2f156dfdaaa7e16bfab0"}, + {file = "numpy-1.26.2-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:5d5244aabd6ed7f312268b9247be47343a654ebea52a60f002dc70c769048e75"}, + {file = "numpy-1.26.2-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:6a3cdb4d9c70e6b8c0814239ead47da00934666f668426fc6e94cce869e13fd7"}, + {file = "numpy-1.26.2-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:aa317b2325f7aa0a9471663e6093c210cb2ae9c0ad824732b307d2c51983d5b6"}, + {file = "numpy-1.26.2-cp312-cp312-musllinux_1_1_aarch64.whl", hash = "sha256:174a8880739c16c925799c018f3f55b8130c1f7c8e75ab0a6fa9d41cab092fd6"}, + {file = "numpy-1.26.2-cp312-cp312-musllinux_1_1_x86_64.whl", hash = "sha256:f79b231bf5c16b1f39c7f4875e1ded36abee1591e98742b05d8a0fb55d8a3eec"}, + {file = "numpy-1.26.2-cp312-cp312-win32.whl", hash = "sha256:4a06263321dfd3598cacb252f51e521a8cb4b6df471bb12a7ee5cbab20ea9167"}, + {file = "numpy-1.26.2-cp312-cp312-win_amd64.whl", hash = "sha256:b04f5dc6b3efdaab541f7857351aac359e6ae3c126e2edb376929bd3b7f92d7e"}, + {file = "numpy-1.26.2-pp39-pypy39_pp73-macosx_10_9_x86_64.whl", hash = "sha256:1cc3d5029a30fb5f06704ad6b23b35e11309491c999838c31f124fee32107c79"}, + {file = "numpy-1.26.2-pp39-pypy39_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:94cc3c222bb9fb5a12e334d0479b97bb2df446fbe622b470928f5284ffca3f8d"}, + {file = "numpy-1.26.2-pp39-pypy39_pp73-win_amd64.whl", hash = "sha256:fe6b44fb8fcdf7eda4ef4461b97b3f63c466b27ab151bec2366db8b197387841"}, + {file = "numpy-1.26.2.tar.gz", hash = "sha256:f65738447676ab5777f11e6bbbdb8ce11b785e105f690bc45966574816b6d3ea"}, +] + +[[package]] +name = "opencv-python" +version = "4.8.1.78" +requires_python = ">=3.6" +summary = "Wrapper package for OpenCV python bindings." +dependencies = [ + "numpy>=1.17.0; python_version >= \"3.7\"", + "numpy>=1.17.3; python_version >= \"3.8\"", + "numpy>=1.19.3; python_version >= \"3.6\" and platform_system == \"Linux\" and platform_machine == \"aarch64\"", + "numpy>=1.19.3; python_version >= \"3.9\"", + "numpy>=1.21.2; python_version >= \"3.10\"", + "numpy>=1.21.4; python_version >= \"3.10\" and platform_system == \"Darwin\"", + "numpy>=1.23.5; python_version >= \"3.11\"", +] +files = [ + {file = "opencv-python-4.8.1.78.tar.gz", hash = "sha256:cc7adbbcd1112877a39274106cb2752e04984bc01a031162952e97450d6117f6"}, + {file = "opencv_python-4.8.1.78-cp37-abi3-macosx_10_16_x86_64.whl", hash = "sha256:91d5f6f5209dc2635d496f6b8ca6573ecdad051a09e6b5de4c399b8e673c60da"}, + {file = "opencv_python-4.8.1.78-cp37-abi3-macosx_11_0_arm64.whl", hash = "sha256:bc31f47e05447da8b3089faa0a07ffe80e114c91ce0b171e6424f9badbd1c5cd"}, + {file = "opencv_python-4.8.1.78-cp37-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:9814beca408d3a0eca1bae7e3e5be68b07c17ecceb392b94170881216e09b319"}, + {file = "opencv_python-4.8.1.78-cp37-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:c4c406bdb41eb21ea51b4e90dfbc989c002786c3f601c236a99c59a54670a394"}, + {file = "opencv_python-4.8.1.78-cp37-abi3-win32.whl", hash = "sha256:a7aac3900fbacf55b551e7b53626c3dad4c71ce85643645c43e91fcb19045e47"}, + {file = "opencv_python-4.8.1.78-cp37-abi3-win_amd64.whl", hash = "sha256:b983197f97cfa6fcb74e1da1802c7497a6f94ed561aba6980f1f33123f904956"}, +] diff --git a/tools/CropRoi/pyproject.toml b/tools/CropRoi/pyproject.toml new file mode 100644 index 0000000..dd9172b --- /dev/null +++ b/tools/CropRoi/pyproject.toml @@ -0,0 +1,12 @@ + +[project] +# PEP 621 project metadata +# See https://www.python.org/dev/peps/pep-0621/ +dependencies = [ + "opencv-python>=4.5.3", +] +requires-python = ">=3.11" + +[build-system] +requires = ["pdm-backend"] +build-backend = "pdm.backend" \ No newline at end of file diff --git a/tools/CropRoi/requirements.txt b/tools/CropRoi/requirements.txt index 07d7224..00a91ec 100644 --- a/tools/CropRoi/requirements.txt +++ b/tools/CropRoi/requirements.txt @@ -1 +1,5 @@ -opencv-python~=4.5.3 +# This file is @generated by PDM. +# Please do not edit it manually. + +numpy==1.26.2 +opencv-python==4.8.1.78 From 13858f13b6e5e0b5947fc46850b56519d613ab1d Mon Sep 17 00:00:00 2001 From: BalconyJH Date: Sun, 19 Nov 2023 16:17:11 +0800 Subject: [PATCH 2/3] =?UTF-8?q?:memo:=20=E6=B7=BB=E5=8A=A0=E4=BD=BF?= =?UTF-8?q?=E7=94=A8=E6=96=87=E6=A1=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- tools/CropRoi/README.md | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/tools/CropRoi/README.md b/tools/CropRoi/README.md index e69de29..aaa7ccc 100644 --- a/tools/CropRoi/README.md +++ b/tools/CropRoi/README.md @@ -0,0 +1,31 @@ +# 截图工具 + +## 环境 + +需要 `python` 环境 + +## 依赖 + +在./tools/CropRoi下执行以下命令 + +```shell +python -m pip install pipx +pipx ensurepath +``` +重启终端 + +```shell +pipx install pdm +pdm install +``` + +## 使用 +截图需预先保存到 `./src/` 路径下, 产物将会保存在 `./dst/` 路径下 + +打开cmd, 执行以下命令 +```shell +.venv\Scripts\Activate.ps1 +pdm run python main.py +``` + +在弹出窗口中使用鼠标左键画框, `s` 键保存, `q` 键退出 From 55a3e1d55aeafa3053ac558af3e6dd3ed6fa331e Mon Sep 17 00:00:00 2001 From: BalconyJH Date: Sun, 19 Nov 2023 16:36:13 +0800 Subject: [PATCH 3/3] =?UTF-8?q?:memo:=20=E6=9B=B4=E6=96=B0readme?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- tools/CombatGenerator/README.md | 39 +++++++++++++++++++++++++++------ tools/CropRoi/README.md | 5 +++++ 2 files changed, 37 insertions(+), 7 deletions(-) diff --git a/tools/CombatGenerator/README.md b/tools/CombatGenerator/README.md index 77af540..9e2eeb6 100644 --- a/tools/CombatGenerator/README.md +++ b/tools/CombatGenerator/README.md @@ -1,14 +1,39 @@ # CombatGenerator +## 环境 + +需要 `python` 环境 + +## 依赖 + +### ⚠️在.tools/CombatGenerator目录下执行所有命令 + +(如果已经安装过pipx和pdm可以跳过直接使用pdm install) + +```shell +python -m pip install pipx +pipx ensurepath +``` + +重启终端 + +```shell +pipx install pdm +pdm install +``` + ## 使用 - cd path/to/CombatGenerator - pip install pipx - pipx ensurepath - pipx install pdm - pdm install +输入文件需预先保存到 `.tools/CombatGenerator/data/` 路径下, +产物如果没有使用可选参数将会使用默认值保存在 `.tools/CombatGenerator/data/output.json` 路径下 + +打开cmd, 执行以下命令 -重启终端后,直接运行`CombatGenerator`下`__init__.py`即可。 +```shell +.venv\Scripts\Activate.ps1 +cd src/combatgenerator +pdm run python __init__.py +``` ## 可选参数 @@ -28,7 +53,7 @@ 例如我想使用反序列器,传入路径为F:/1.json, 输出路径为F:/2.json - python __init__.py -r -i F:/1.json -o F:/2.json + pdm run python __init__.py -r -i F:/1.json -o F:/2.json ## input说明 diff --git a/tools/CropRoi/README.md b/tools/CropRoi/README.md index aaa7ccc..8e3480c 100644 --- a/tools/CropRoi/README.md +++ b/tools/CropRoi/README.md @@ -8,10 +8,13 @@ 在./tools/CropRoi下执行以下命令 +(如果已经安装过pipx和pdm可以跳过直接使用pdm install) + ```shell python -m pip install pipx pipx ensurepath ``` + 重启终端 ```shell @@ -20,9 +23,11 @@ pdm install ``` ## 使用 + 截图需预先保存到 `./src/` 路径下, 产物将会保存在 `./dst/` 路径下 打开cmd, 执行以下命令 + ```shell .venv\Scripts\Activate.ps1 pdm run python main.py