From 553a6fd31c9e141dd79f74642544405ed2b1eaf2 Mon Sep 17 00:00:00 2001
From: Ze-Yi LIN <58305964+Zeyi-Lin@users.noreply.github.com>
Date: Tue, 24 Sep 2024 04:57:52 +0800
Subject: [PATCH] feat: cut layout image (#165)
* style: layout photo -> array
* layout photo crop line
* v1.2.8
---
README.md | 2 +-
README_EN.md | 2 +-
README_JP.md | 2 +-
README_KO.md | 2 +-
demo/assets/title.md | 2 +-
demo/locales.py | 18 +++++------
demo/processor.py | 23 +++++++++++---
demo/ui.py | 38 ++++++++++++-----------
deploy_api.py | 4 +--
hivision/creator/layout_calculator.py | 44 +++++++++++++++++++++++++--
hivision/creator/photo_adjuster.py | 4 +--
inference.py | 4 +--
12 files changed, 101 insertions(+), 44 deletions(-)
diff --git a/README.md b/README.md
index 23ef52b6..4fe61cfa 100644
--- a/README.md
+++ b/README.md
@@ -55,6 +55,7 @@
- 在线体验: [![SwanHub Demo](https://img.shields.io/static/v1?label=Demo&message=SwanHub%20Demo&color=blue)](https://swanhub.co/ZeYiLin/HivisionIDPhotos/demo)、[![Spaces](https://img.shields.io/badge/🤗-Open%20in%20Spaces-blue)](https://huggingface.co/spaces/TheEeeeLin/HivisionIDPhotos)、[![][modelscope-shield]][modelscope-link]
+- 2024.09.24: Gradio Demo增加**排版照裁剪线**功能
- 2024.09.22: Gradio Demo增加**野兽模式**,可设置内存加载策略 | API接口增加**dpi、face_alignment**参数
- 2024.09.18: Gradio Demo增加**分享模版照**功能、增加**美式证件照**背景选项
- 2024.09.17: Gradio Demo增加**自定义底色-HEX输入**功能 | **(社区贡献)C++版本** - [HivisionIDPhotos-cpp](https://github.com/zjkhahah/HivisionIDPhotos-cpp) 贡献 by [zjkhahah](https://github.com/zjkhahah)
@@ -62,7 +63,6 @@
- 2024.09.14: Gradio Demo增加**自定义DPI**功能,增加日语和韩语支持,增加**调整亮度、对比度、锐度**功能
- 2024.09.12: Gradio Demo增加**美白**功能 | API接口增加**加水印**、**设置照片KB值大小**、**证件照裁切**
- 2024.09.11: Gradio Demo增加**透明图显示与下载**功能
-- 2024.09.10: 增加新的**人脸检测模型** Retinaface-resnet50,以稍弱于mtcnn的速度换取更高的检测精度,推荐使用
diff --git a/README_EN.md b/README_EN.md
index 7eaf64ba..d7d5e253 100644
--- a/README_EN.md
+++ b/README_EN.md
@@ -54,6 +54,7 @@ English / [中文](README.md) / [日本語](README_JP.md) / [한국어](README_K
- Online Experience: [![SwanHub Demo](https://img.shields.io/static/v1?label=Demo&message=SwanHub%20Demo&color=blue)](https://swanhub.co/ZeYiLin/HivisionIDPhotos/demo)、[![Spaces](https://img.shields.io/badge/🤗-Open%20in%20Spaces-blue)](https://huggingface.co/spaces/TheEeeeLin/HivisionIDPhotos)、[![][modelscope-shield]][modelscope-link]
+- 2024.09.24: Gradio Demo adds **Layout Photo Crop Line** feature
- 2024.09.22: Gradio Demo adds **Beast Mode** and **DPI** parameter
- 2024.09.18: Gradio Demo adds **Share Template Photos** feature and **American Style** background option
- 2024.09.17: Gradio Demo adds **Custom Background Color-HEX Input** feature | **(Community Contribution) C++ Version** - [HivisionIDPhotos-cpp](https://github.com/zjkhahah/HivisionIDPhotos-cpp) contributed by [zjkhahah](https://github.com/zjkhahah)
@@ -61,7 +62,6 @@ English / [中文](README.md) / [日本語](README_JP.md) / [한국어](README_K
- 2024.09.14: Gradio Demo adds **Custom DPI** feature, adds Japanese and Korean support, adds **Adjust Brightness, Contrast, Sharpness** feature
- 2024.09.12: Gradio Demo adds **Whitening** feature | API interface adds **Watermark**, **Set Photo KB Size**, **ID Photo Cropping**
- 2024.09.11: Added **transparent image display and download** feature to Gradio Demo.
-- 2024.09.10: Added a new **face detection model** Retinaface-resnet50, which offers higher detection accuracy at a slightly slower speed compared to mtcnn. Recommended for use.
diff --git a/README_JP.md b/README_JP.md
index 5ec91e1a..bfa7fd4a 100644
--- a/README_JP.md
+++ b/README_JP.md
@@ -51,13 +51,13 @@
- オンライン体験: [![SwanHub Demo](https://img.shields.io/static/v1?label=Demo&message=SwanHub%20Demo&color=blue)](https://swanhub.co/ZeYiLin/HivisionIDPhotos/demo)、[![Spaces](https://img.shields.io/badge/🤗-Open%20in%20Spaces-blue)](https://huggingface.co/spaces/TheEeeeLin/HivisionIDPhotos)、[![][modelscope-shield]][modelscope-link]
+- 2024.09.24: Gradioデモに**排版照裁剪线**機能を追加
- 2024.09.22: Gradioデモに**ビーストモード**と**DPI**パラメータを追加
- 2024.09.18: Gradioデモに**テンプレート写真の共有**機能を追加、**米国式**背景オプションを追加
- 2024.09.17: Gradioデモに**カスタム底色-HEX入力**機能を追加 | **(コミュニティ貢献)C++バージョン** - [HivisionIDPhotos-cpp](https://github.com/zjkhahah/HivisionIDPhotos-cpp) 貢献 by [zjkhahah](https://github.com/zjkhahah)
- 2024.09.16: Gradioデモに**顔回転対応**機能を追加、カスタムサイズ入力に**ミリメートル**をサポート
- 2024.09.14: Gradioデモに**カスタムDPI**機能を追加、日本語と韓国語を追加,**明るさ、コントラスト、鮮明度の調整**機能を追加
- 2024.09.12: Gradioデモに**ホワイトニング**機能を追加 | APIインターフェースに**ウォーターマーク追加**、**写真のKBサイズ設定**、**証明写真のトリミング**を追加
-- 2024.09.11: Gradioデモに**透過画像表示とダウンロード**機能を追加しました。
diff --git a/README_KO.md b/README_KO.md
index 3f782328..414fdf2a 100644
--- a/README_KO.md
+++ b/README_KO.md
@@ -51,13 +51,13 @@
- 온라인 체험: [![SwanHub Demo](https://img.shields.io/static/v1?label=Demo&message=SwanHub%20Demo&color=blue)](https://swanhub.co/ZeYiLin/HivisionIDPhotos/demo)、[![Spaces](https://img.shields.io/badge/🤗-Open%20in%20Spaces-blue)](https://huggingface.co/spaces/TheEeeeLin/HivisionIDPhotos)、[![][modelscope-shield]][modelscope-link]
+- 2024.09.24: Gradio Demo에 **排版照裁剪线** 기능 추가
- 2024.09.22: Gradio Demo에 **버스트 모드** 및 **DPI** 매개변수 추가
- 2024.09.18: Gradio Demo에 **템플릿 사진 공유** 기능 추가, **미국식** 배경 옵션 추가
- 2024.09.17: Gradio Demo에 **커스텀 배경색-HEX 입력** 기능 추가 | **(커뮤니티 기여) C++ 버전** - [HivisionIDPhotos-cpp](https://github.com/zjkhahah/HivisionIDPhotos-cpp) 기여 by [zjkhahah](https://github.com/zjkhahah)
- 2024.09.16: Gradio Demo에 **얼굴 회전 정렬** 기능 추가, 커스텀 사이즈 입력에 **밀리미터** 단위 추가
- 2024.09.14: Gradio Demo에 **커스텀 DPI** 기능 추가, 일본어와 한국어 추가, **밝기, 대비, 선명도 조절** 기능 추가
- 2024.09.12: Gradio 데모에 **미백** 기능 추가 | API 인터페이스에 **워터마크 추가**, **사진 KB 크기 설정**, **증명사진 자르기** 추가
-- 2024.09.11: Gradio Demo에 **투명 이미지 표시 및 다운로드** 기능 추가
diff --git a/demo/assets/title.md b/demo/assets/title.md
index d45cdd8e..07ab32d0 100644
--- a/demo/assets/title.md
+++ b/demo/assets/title.md
@@ -1,7 +1,7 @@