From 8577a954e991fce1d48dce1324dcf6c332dec3b6 Mon Sep 17 00:00:00 2001 From: aoguai <1340219674@qq.com> Date: Tue, 6 Aug 2024 15:23:20 +0800 Subject: [PATCH] docs: Explanation of photo type and photo sheet size --- docs/README-EN.md | 24 ++++++++++-------------- docs/README.md | 16 ++++++---------- src/main.py | 4 ++-- 3 files changed, 18 insertions(+), 26 deletions(-) diff --git a/docs/README-EN.md b/docs/README-EN.md index d4880ad..5c9fb21 100644 --- a/docs/README-EN.md +++ b/docs/README-EN.md @@ -97,10 +97,6 @@ run_en.bat ./images/test1.jpg python main.py --help Usage: main.py [OPTIONS] IMG_PATH - Image Processing CLI Tools - - IMG_PATH: Input Image Path - Options: -y, --yolov8-model-path PATH Path to YOLOv8 model -u, --yunet-model-path PATH Path to YuNet model @@ -109,7 +105,7 @@ Options: for image composition -s, --save-path PATH Path to save the output image -p, --photo-type TEXT Type of photo - --photo-sheet-size [5|6] Size of the photo sheet (5-inch or 6-inch) + --photo-sheet-size TEXT Size of the photo sheet -c, --compress / --no-compress Whether to compress the image -sc, --save-corrected / --no-save-corrected Whether to save the corrected image @@ -127,22 +123,22 @@ Options: --help Show this message and exit. ``` -#### Other Configuration +### Other Configuration -In this version, the standard ID photo configuration is set in `data/data.ini`, which you can use with the `photo-type` parameter. +In this version, the standard ID photo settings are configured in `data/data_en.ini`. You can use the `photo-type` and `photo-sheet-size` parameters. -You can also modify this configuration file to customize ID photo types. The format is as follows: +Additionally, you can modify this configuration file to customize the ID photo types. For the Chinese environment, the format is as follows: ```text [XXX] -打印尺寸 = XXXcm x XXXcm -电子版尺寸 = XXXpx x XXXpx -分辨率 = XXXdpi +print_size = XXXcm x XXXcm +electronic_size = XXXpx x XXXpx +resolution = XXXdpi ``` -The section name and `电子版尺寸 = XXXpx x XXXpx` are required. +The section name `[XXX]` and the line `electronic_size = XXXpx x XXXpx` are mandatory. -The section name represents the `photo-type` parameter. +The section name represents the values for the `photo-type` and `photo-sheet-size` parameters. -Currently, the `key` for size only supports the fixed Chinese `电子版尺寸` (Digital Size). This will be improved in future versions. +Furthermore, `photo-type` and `photo-sheet-size` also support direct input of strings in the format `XXXpx x XXXpx`, representing width and height. ## Acknowledgments diff --git a/docs/README.md b/docs/README.md index 6783ee4..b521a50 100644 --- a/docs/README.md +++ b/docs/README.md @@ -97,18 +97,14 @@ run.bat ./images/test1.jpg python main.py --help Usage: main.py [OPTIONS] IMG_PATH - 图像处理 CLI 工具 - - IMG_PATH: 输入图像路径 - Options: -y, --yolov8-model-path PATH YOLOv8 模型路径 -u, --yunet-model-path PATH YuNet 模型路径 -r, --rmbg-model-path PATH RMBG 模型路径 - -b, --bgr-list BGR_LIST BGR 通道值列表(逗号分隔),用于图像合成 + -b, --bgr-list BGR_LIST BGR 通道值列表(英文逗号分隔),用于图像合成 -s, --save-path PATH 保存路径 -p, --photo-type TEXT 照片类型 - --photo-sheet-size [5|6] 选择照片表格的尺寸(五寸或六寸) + --photo-sheet-size TEXT 选择照片表格的尺寸 -c, --compress / --no-compress 是否压缩图像 -sc, --save-corrected / --no-save-corrected 是否保存修正图像后的图片 @@ -128,9 +124,9 @@ Options: #### 其他配置 -在该版本中,在`data/data.ini`中设置了常规的证件照配置,您可以在`photo-type`参数中使用。 +在该版本中,在`data/data-zh.ini`中设置了常规的证件照配置,您可以在`photo-type`和`photo-sheet-size`参数中使用。 -同时你可以修改该配置文件,自定义证件照类型。其格式为 +同时你可以修改该配置文件,自定义证件照类型。针对中文环境,其格式为 ```text [XXX] 打印尺寸 = XXXcm x XXXcm @@ -139,9 +135,9 @@ Options: ``` 其中节名称及`[XXX]`和`电子版尺寸 = XXXpx x XXXpx`是必须的。 -其中节名称代表了其`photo-type`参数。 +其中节名称代表了其`photo-type`和`photo-sheet-size`参数输入值。 -目前,针对尺寸大小的 `key` 只支持固定中文 `电子版尺寸`,将在以后版本改进。 +同时`photo-type`和`photo-sheet-size`还支持直接输入形如`XXXpx x XXXpx`的字符串,代表宽高。 ## 致谢 diff --git a/src/main.py b/src/main.py index e642801..27fa1d6 100644 --- a/src/main.py +++ b/src/main.py @@ -82,10 +82,10 @@ def echo_message(key, **kwargs): default=os.path.join(os.path.dirname(os.path.abspath(__file__)), 'model/RMBG-1.4-model.onnx'), help='Path to RMBG model' if get_language() == 'en' else 'RMBG 模型路径') @click.option('-b', '--bgr-list', type=BGRListType(), default='1.0,1.0,1.0', - help='BGR channel values list (comma-separated) for image composition' if get_language() == 'en' else 'BGR 通道值列表(逗号分隔),用于图像合成') + help='BGR channel values list (comma-separated) for image composition' if get_language() == 'en' else 'BGR 通道值列表(英文逗号分隔),用于图像合成') @click.option('-s', '--save-path', type=click.Path(), default='output.jpg', help='Path to save the output image' if get_language() == 'en' else '保存路径') -@click.option('-p', '--photo-type', type=str, default='一寸照片', +@click.option('-p', '--photo-type', type=str, default='one_inch_photo' if get_language() == 'en' else '一寸照片', help='Type of photo' if get_language() == 'en' else '照片类型') @click.option('--photo-sheet-size', type=str, default='five_inch_photo' if get_language() == 'en' else '五寸照片', help='Size of the photo sheet' if get_language() == 'en' else '选择照片表格的尺寸')