├── .eslintrc.cjs
├── .github
├── FUNDING.yml
├── ISSUE_TEMPLATE
│ ├── bug_report.yml
│ └── config.yml
└── workflows
│ └── static.yml
├── .gitignore
├── .prettierrc.json
├── LICENSE
├── README.ja.md
├── README.md
├── README.zh.md
├── env.d.ts
├── index.html
├── main.d.ts
├── output_pose.json
├── package-lock.json
├── package.json
├── pose_hand_fixed.json
├── preload.py
├── process_keypoints.py
├── public
└── favicon.ico
├── readme_assets
├── install_guide.png
└── restart_ui_guide.png
├── scripts
└── openpose_editor.py
├── src
├── App.vue
├── Notification.ts
├── Openpose.ts
├── assets
│ ├── base.css
│ ├── logo.svg
│ └── main.css
├── components
│ ├── FlipOutlined.vue
│ ├── GroupSwitch.vue
│ ├── Header.vue
│ ├── IconSwitch.vue
│ ├── LockSwitch.vue
│ ├── OpenposeObjectPanel.vue
│ ├── VisibleSwitch.vue
│ ├── __tests__
│ │ └── Openpose.spec.ts
│ └── icons
│ │ ├── IconCommunity.vue
│ │ ├── IconDocumentation.vue
│ │ ├── IconEcosystem.vue
│ │ ├── IconSupport.vue
│ │ └── IconTooling.vue
├── i18n.ts
├── main.ts
└── stores
│ └── counter.ts
├── tsconfig.app.json
├── tsconfig.json
├── tsconfig.node.json
├── tsconfig.vitest.json
├── vite.config.ts
├── vitest.config.ts
└── zip_dist.js
/.eslintrc.cjs:
--------------------------------------------------------------------------------
1 | /* eslint-env node */
2 | require('@rushstack/eslint-patch/modern-module-resolution')
3 |
4 | module.exports = {
5 | root: true,
6 | 'extends': [
7 | 'plugin:vue/vue3-essential',
8 | 'eslint:recommended',
9 | '@vue/eslint-config-typescript',
10 | '@vue/eslint-config-prettier/skip-formatting'
11 | ],
12 | parserOptions: {
13 | ecmaVersion: 'latest'
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/.github/FUNDING.yml:
--------------------------------------------------------------------------------
1 | # These are supported funding model platforms
2 |
3 | github: # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2]
4 | patreon: # Replace with a single Patreon username
5 | open_collective: # Replace with a single Open Collective username
6 | ko_fi: huchenlei
7 | tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
8 | community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
9 | liberapay: # Replace with a single Liberapay username
10 | issuehunt: # Replace with a single IssueHunt username
11 | otechie: # Replace with a single Otechie username
12 | lfx_crowdfunding: # Replace with a single LFX Crowdfunding project-name e.g., cloud-foundry
13 | custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2']
14 |
--------------------------------------------------------------------------------
/.github/ISSUE_TEMPLATE/bug_report.yml:
--------------------------------------------------------------------------------
1 | name: Bug Report
2 | description: Create a report
3 | title: "[Bug]: "
4 | labels: ["bug-report"]
5 |
6 | body:
7 | - type: checkboxes
8 | attributes:
9 | label: Is there an existing issue for this?
10 | description: Please search to see if an issue already exists for the bug you encountered, and that it hasn't been fixed in a recent build/commit.
11 | options:
12 | - label: I have searched the existing issues and checked the recent builds/commits of both this extension and the webui
13 | required: true
14 | - type: markdown
15 | attributes:
16 | value: |
17 | *Please fill this form with as much information as possible, don't forget to fill "What OS..." and "What browsers" and *provide screenshots if possible**
18 | - type: textarea
19 | id: what-did
20 | attributes:
21 | label: What happened?
22 | description: Tell us what happened in a very clear and simple way
23 | validations:
24 | required: true
25 | - type: textarea
26 | id: steps
27 | attributes:
28 | label: Steps to reproduce the problem
29 | description: Please provide us with precise step by step information on how to reproduce the bug. Ideally with image/json uploaded to help debug the issue.
30 | value: |
31 | 1. Go to ....
32 | 2. Press ....
33 | 3. ...
34 | validations:
35 | required: true
36 | - type: textarea
37 | id: what-should
38 | attributes:
39 | label: What should have happened?
40 | description: Tell what you think the normal behavior should be
41 | validations:
42 | required: true
43 | - type: textarea
44 | id: commits
45 | attributes:
46 | label: Commit where the problem happens
47 | description: Which commit of the extension are you running on? Please include the commit of both the extension and the webui (Do not write *Latest version/repo/commit*, as this means nothing and will have changed by the time we read your issue. Rather, copy the **Commit** link at the bottom of the UI, or from the cmd/terminal if you can't launch it.)
48 | value: |
49 | webui:
50 | controlnet:
51 | openpose-editor:
52 | validations:
53 | required: true
54 | - type: dropdown
55 | id: browsers
56 | attributes:
57 | label: What browsers do you use to access the UI ?
58 | multiple: true
59 | options:
60 | - Mozilla Firefox
61 | - Google Chrome
62 | - Brave
63 | - Apple Safari
64 | - Microsoft Edge
65 | - type: textarea
66 | id: cmdargs
67 | attributes:
68 | label: Command Line Arguments
69 | description: Are you using any launching parameters/command line arguments (modified webui-user .bat/.sh) ? If yes, please write them below. Write "No" otherwise.
70 | render: Shell
71 | validations:
72 | required: true
73 | - type: textarea
74 | id: logs
75 | attributes:
76 | label: Console logs
77 | description: Please provide full cmd/terminal logs from the moment you started UI to the end of it, after your bug happened. If it's very long, provide a link to pastebin or similar service.
78 | render: Shell
79 | validations:
80 | required: true
81 | - type: textarea
82 | id: browserlogs
83 | attributes:
84 | label: Browser logs
85 | description: Please provide full browser logs from the moment you started UI to the end of it, after your bug happened. If it's very long, provide a link to pastebin or similar service.
86 | validations:
87 | required: true
88 | - type: textarea
89 | id: misc
90 | attributes:
91 | label: Additional information
92 | description: Please provide us with any relevant additional info or context.
93 |
--------------------------------------------------------------------------------
/.github/ISSUE_TEMPLATE/config.yml:
--------------------------------------------------------------------------------
1 | blank_issues_enabled: true
2 |
--------------------------------------------------------------------------------
/.github/workflows/static.yml:
--------------------------------------------------------------------------------
1 | # Simple workflow for deploying static content to GitHub Pages
2 | name: Deploy static content to Pages
3 |
4 | on:
5 | # Runs on pushes targeting the default branch
6 | push:
7 | branches: ['main']
8 |
9 | # Allows you to run this workflow manually from the Actions tab
10 | workflow_dispatch:
11 |
12 | # Sets the GITHUB_TOKEN permissions to allow deployment to GitHub Pages
13 | permissions:
14 | contents: read
15 | pages: write
16 | id-token: write
17 |
18 | # Allow one concurrent deployment
19 | concurrency:
20 | group: 'pages'
21 | cancel-in-progress: true
22 |
23 | jobs:
24 | # Single deploy job since we're just deploying
25 | deploy:
26 | environment:
27 | name: github-pages
28 | url: ${{ steps.deployment.outputs.page_url }}
29 | runs-on: ubuntu-latest
30 | steps:
31 | - name: Checkout
32 | uses: actions/checkout@v3
33 | - name: Set up Node
34 | uses: actions/setup-node@v3
35 | with:
36 | node-version: 18
37 | cache: 'npm'
38 | - name: Install dependencies
39 | run: npm install
40 | - name: Install npm-run-all
41 | run: npm install -g npm-run-all
42 | - name: Build
43 | run: npm run build
44 | env:
45 | GITHUB_PAGES_PATH: '/sd-webui-openpose-editor/'
46 | - name: Setup Pages
47 | uses: actions/configure-pages@v3
48 | - name: Upload artifact
49 | uses: actions/upload-pages-artifact@v1
50 | with:
51 | # Upload dist repository
52 | path: './dist'
53 | - name: Deploy to GitHub Pages
54 | id: deployment
55 | uses: actions/deploy-pages@v1
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | # Logs
2 | logs
3 | *.log
4 | npm-debug.log*
5 | yarn-debug.log*
6 | yarn-error.log*
7 | pnpm-debug.log*
8 | lerna-debug.log*
9 |
10 | node_modules
11 | .DS_Store
12 | dist
13 | dist-ssr
14 | coverage
15 | *.local
16 |
17 | /cypress/videos/
18 | /cypress/screenshots/
19 |
20 | # Editor directories and files
21 | .vscode/*
22 | !.vscode/extensions.json
23 | .idea
24 | *.suo
25 | *.ntvs*
26 | *.njsproj
27 | *.sln
28 | *.sw?
29 |
30 | # Python
31 | __pycache__/
32 | *.pyc
33 |
34 | dist.zip
--------------------------------------------------------------------------------
/.prettierrc.json:
--------------------------------------------------------------------------------
1 | {
2 | "$schema": "https://json.schemastore.org/prettierrc",
3 | "semi": false,
4 | "tabWidth": 2,
5 | "singleQuote": true,
6 | "printWidth": 100,
7 | "trailingComma": "none"
8 | }
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2023 Chenlei Hu
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/README.ja.md:
--------------------------------------------------------------------------------
1 | # Stable Diffusion WebUIのためのControlNet内Openposeエディタ
2 | この拡張機能は、特にStable Diffusion WebUIのControlNet拡張機能に統合するために開発されました。
3 |
4 | 
5 |
6 | # 前提条件
7 | [ControlNet](https://github.com/Mikubill/sd-webui-controlnet) `1.1.216`以上が必要です。
8 |
9 | # インストール
10 | ControlNet拡張v1.1.411から、ユーザーはこの拡張をローカルにインストールする必要はありません。ControlNet拡張は、ローカルのエディタのインストールが検出されない場合、https://huchenlei.github.io/sd-webui-openpose-editor/ というリモートエンドポイントを使用します。インターネット接続が不安定、またはgithub.ioドメインへの接続に問題がある場合は、ローカルインストールを推奨します。
11 |
12 | ## ローカルインストール
13 | 
14 | 
15 |
16 | UI再起動時、拡張機能はコンパイル済みのVueアプリをGithubからダウンロードしようとします。`stable-diffusion-webui\extensions\sd-webui-openpose-editor\dist`が存在し、中に内容があるかどうかを確認してください。
17 |
18 | 中国の一部のユーザーは、autoupdateスクリプトでdistのダウンロードに問題があると報告しています。そのような状況では、ユーザーは次の2つのオプションからdistを手動で取得することができます:
19 |
20 | ### オプション1:アプリケーションのビルド
21 | nodeJS環境が準備できていることを確認し、`Development`セクションに従ってください。アプリケーションをコンパイルするために`npm run build`を実行します。
22 |
23 | ### オプション2:コンパイル済みアプリケーションのダウンロード
24 | [リリース](https://github.com/huchenlei/sd-webui-openpose-editor/releases)ページからコンパイル済みアプリケーション(`dist.zip`)をダウンロードできます。リポジトリのルートでパッケージを解凍し、解凍したディレクトリが`dist`という名前であることを確認してください。
25 |
26 | # 使用法
27 | OpenposeエディタのコアはVue3で構築されています。Gradio拡張スクリプトは、`/openpose_editor_index`上にVue3アプリケーションをマウントする薄いラッパーです。
28 |
29 | 必要であれば、ユーザーは`localhost:7860/openpose_editor_index`でエディタに直接アクセスできますが、主なエントリーポイントはControlNet拡張機能内でエディタを呼び出すことです。ControlNet拡張機能で、任意のopenpose前処理器を選択し、前処理器実行ボタンを押します。前処理結果のプレビューが生成されます。生成された画像の右下隅の`編集`ボタンをクリックすると、モーダル内にopenposeエディタが表示されます。編集後、`ControlNetにポーズを送信`ボタンをクリックすると、ポーズがControlNetに送り返されます。
30 |
31 | 以下のデモは基本的なワークフローを示しています:
32 |
33 | [](http://www.youtube.com/watch?v=WEHVpPNIh8M)
34 |
35 | # 特長
36 | 1. controlnetで使用される顔/手のサポート。
37 | - 拡張機能はcontrolnetの前処理結果で顔/手のオブジェクトを認識します。
38 | - ユーザーは、前処理結果がそれらを欠落している場合に顔/手を追加することができます。これは以下のどちらかで行うことができます。
39 | - デフォルトの手を追加する(顔はキーポイントが多すぎる(70キーポイント)ため、手動でそれらを調整することは非常に困難なため、サポートされていません。)
40 | - ポーズJSONをアップロードしてオブジェクトを追加する。最初の人の対応するオブジェクトが使用されます。
41 | 1. 可視性の切り替え
42 | - キーポイントがControlNet前処理器に認識されない場合、その座標は`(-1, -1)`になります。このような無効なキーポイントはエディタで不可視に設定されます。
43 | - ユーザーがキーポイントを不可視に設定し、ポーズをcontrolnetに戻すと、キーポイントが接続する肢節はレンダリングされません。実質的に、これがエディタで肢節を削除する方法です。
44 | 1. グループ切り替え
45 | - キャンバスオブジェクト(手/顔/体)のキーポイントを誤って選択して変更することを避けたい場合、それらをグループ化できます。グループ化されたオブジェクトは一つのオブジェクトのように動作します。グループを拡大、回転、歪ませることができます。
46 |
47 |
48 | # Development
49 | ## Recommended IDE Setup
50 |
51 | [VSCode](https://code.visualstudio.com/) + [Volar](https://marketplace.visualstudio.com/items?itemName=Vue.volar) (and disable Vetur) + [TypeScript Vue Plugin (Volar)](https://marketplace.visualstudio.com/items?itemName=Vue.vscode-typescript-vue-plugin).
52 |
53 | ## Type Support for `.vue` Imports in TS
54 |
55 | TypeScript cannot handle type information for `.vue` imports by default, so we replace the `tsc` CLI with `vue-tsc` for type checking. In editors, we need [TypeScript Vue Plugin (Volar)](https://marketplace.visualstudio.com/items?itemName=Vue.vscode-typescript-vue-plugin) to make the TypeScript language service aware of `.vue` types.
56 |
57 | If the standalone TypeScript plugin doesn't feel fast enough to you, Volar has also implemented a [Take Over Mode](https://github.com/johnsoncodehk/volar/discussions/471#discussioncomment-1361669) that is more performant. You can enable it by the following steps:
58 |
59 | 1. Disable the built-in TypeScript Extension
60 | 1) Run `Extensions: Show Built-in Extensions` from VSCode's command palette
61 | 2) Find `TypeScript and JavaScript Language Features`, right click and select `Disable (Workspace)`
62 | 2. Reload the VSCode window by running `Developer: Reload Window` from the command palette.
63 |
64 | ## Customize configuration
65 |
66 | See [Vite Configuration Reference](https://vitejs.dev/config/).
67 |
68 | ## Project Setup
69 |
70 | ```sh
71 | npm install
72 | ```
73 |
74 | ### Compile and Hot-Reload for Development
75 |
76 | ```sh
77 | npm run dev
78 | ```
79 |
80 | ### Type-Check, Compile and Minify for Production
81 |
82 | ```sh
83 | npm run build
84 | ```
85 |
86 | ### Run Unit Tests with [Vitest](https://vitest.dev/)
87 |
88 | ```sh
89 | npm run test:unit
90 | ```
91 |
92 | ### Lint with [ESLint](https://eslint.org/)
93 |
94 | ```sh
95 | npm run lint
96 | ```
97 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # Openpose Editor for ControlNet in Stable Diffusion WebUI
2 | This extension is specifically build to be integrated into Stable Diffusion
3 | WebUI's ControlNet extension.
4 |
5 | 
6 |
7 | # Translations of README.md
8 | - [English](./README.md)
9 | - [中文](./README.zh.md)
10 | - [日本語](./README.ja.md)
11 |
12 | # Prerequisite
13 | [ControlNet](https://github.com/Mikubill/sd-webui-controlnet) `1.1.216`+
14 |
15 | # Installation
16 | From ControlNet extension v1.1.411, users no longer need to install this
17 | extension locally, as ControlNet extension now uses the remote endpoint at
18 | https://huchenlei.github.io/sd-webui-openpose-editor/ if no local editor
19 | installation is detected. Local installation is still recommended if you have
20 | poor internet connection, or have hard time connecting to github.io domain.
21 |
22 | ## Local Installation
23 | 
24 | 
25 |
26 | On UI restart, the extension will try to download the compiled Vue app from
27 | Github. Check whether `stable-diffusion-webui\extensions\sd-webui-openpose-editor\dist`
28 | exists and has content in it.
29 |
30 | Some users in China have reported having issue downloading dist with the autoupdate
31 | script. In such situtations, the user has 2 following options to get dist
32 | manually:
33 |
34 | ### Option1: Build the application
35 | Make sure you have nodeJS environment ready and follow `Development` section.
36 | Run `npm run build` to compile the application.
37 |
38 | ### Option2: Download the compiled application
39 | You can download the compiled application(`dist.zip`) from the
40 | [release](https://github.com/huchenlei/sd-webui-openpose-editor/releases) page.
41 | Unzip the package in the repository root and make sure hte unziped directory is
42 | named `dist`.
43 |
44 | # Usage
45 | The openpose editor core is build with Vue3. The gradio extension script is
46 | a thin wrapper that mounts the Vue3 Application on `/openpose_editor_index`.
47 |
48 | The user can directly access the editor at `localhost:7860/openpose_editor_index`
49 | or `https://huchenlei.github.io/sd-webui-openpose-editor/`
50 | if desired, but the main entry point is invoking the editor in the ControlNet
51 | extension. In ControlNet extension, select any openpose preprocessor, and hit
52 | the run preprocessor button. A preprocessor result preview will be genereated.
53 | Click `Edit` button at the bottom right corner of the generated image will bring
54 | up the openpose editor in a modal. After the edit, clicking the
55 | `Send pose to ControlNet` button will send back the pose to ControlNet.
56 |
57 | Following demo shows the basic workflow:
58 |
59 | [](http://www.youtube.com/watch?v=WEHVpPNIh8M)
60 |
61 | # Features
62 | 1. Support for face/hand used in controlnet.
63 | - The extension recognizes the face/hand objects in the controlnet preprocess
64 | results.
65 | - The user can add face/hand if the preprocessor result misses them. It can
66 | be done by either
67 | - Add Default hand (Face is not supported as face has too many keypoints (70 keypoints),
68 | which makes adjust them manually really hard.)
69 | - Add the object by uploading a pose JSON. The corresponding object of
70 | the first person will be used.
71 | 1. Visibility toggle
72 | - If a keypoint is not recognized by ControlNet preprocessor, it will have
73 | `(-1, -1)` as coordinates. Such invalid keypoints will be set as invisible
74 | in the editor.
75 | - If the user sets a keypoint as invisible and send the pose back to
76 | controlnet, the limb segments that the keypoint connects will not be rendered.
77 | Effectively this is how you remove a limb segment in the editor.
78 | 1. Group toggle
79 | - If you don't want to accidentally select and modify the keypoint of an
80 | canvas object (hand/face/body). You can group them. The grouped object will
81 | act like it is a single object. You can scale, rotate, skew the group.
82 |
83 | # Development
84 | ## Recommended IDE Setup
85 |
86 | [VSCode](https://code.visualstudio.com/) + [Volar](https://marketplace.visualstudio.com/items?itemName=Vue.volar) (and disable Vetur) + [TypeScript Vue Plugin (Volar)](https://marketplace.visualstudio.com/items?itemName=Vue.vscode-typescript-vue-plugin).
87 |
88 | ## Type Support for `.vue` Imports in TS
89 |
90 | TypeScript cannot handle type information for `.vue` imports by default, so we replace the `tsc` CLI with `vue-tsc` for type checking. In editors, we need [TypeScript Vue Plugin (Volar)](https://marketplace.visualstudio.com/items?itemName=Vue.vscode-typescript-vue-plugin) to make the TypeScript language service aware of `.vue` types.
91 |
92 | If the standalone TypeScript plugin doesn't feel fast enough to you, Volar has also implemented a [Take Over Mode](https://github.com/johnsoncodehk/volar/discussions/471#discussioncomment-1361669) that is more performant. You can enable it by the following steps:
93 |
94 | 1. Disable the built-in TypeScript Extension
95 | 1) Run `Extensions: Show Built-in Extensions` from VSCode's command palette
96 | 2) Find `TypeScript and JavaScript Language Features`, right click and select `Disable (Workspace)`
97 | 2. Reload the VSCode window by running `Developer: Reload Window` from the command palette.
98 |
99 | ## Customize configuration
100 |
101 | See [Vite Configuration Reference](https://vitejs.dev/config/).
102 |
103 | ## Project Setup
104 |
105 | ```sh
106 | npm install
107 | ```
108 |
109 | ### Compile and Hot-Reload for Development
110 |
111 | ```sh
112 | npm run dev
113 | ```
114 |
115 | ### Type-Check, Compile and Minify for Production
116 |
117 | ```sh
118 | npm run build
119 | ```
120 |
121 | ### Run Unit Tests with [Vitest](https://vitest.dev/)
122 |
123 | ```sh
124 | npm run test:unit
125 | ```
126 |
127 | ### Lint with [ESLint](https://eslint.org/)
128 |
129 | ```sh
130 | npm run lint
131 | ```
132 |
--------------------------------------------------------------------------------
/README.zh.md:
--------------------------------------------------------------------------------
1 | # Openpose Editor for ControlNet in Stable Diffusion WebUI
2 |
3 | 这个扩展专门为整合到 Stable Diffusion WebUI 的 ControlNet 扩展中而设计。
4 |
5 | 
6 |
7 | # 外部环境
8 | 需要预先安装[ControlNet](https://github.com/Mikubill/sd-webui-controlnet) `1.1.216`+.
9 |
10 | # 安装
11 | 从ControlNet扩展v1.1.411开始,用户不再需要在本地安装此扩展,因为ControlNet扩展现在使用远程端点https://huchenlei.github.io/sd-webui-openpose-editor/,如果未检测到本地编辑器安装。如果您的互联网连接差,或者连接到github.io域名有困难,仍然建议您在本地进行安装。
12 |
13 | ## 本地安装
14 | 
15 | 
16 |
17 | 在 UI 重启后,此扩展将尝试从 Github 下载编译好的 Vue 应用程序。请检查 `stable-diffusion-webui\extensions\sd-webui-openpose-editor\dist` 是否存在且包含内容。
18 |
19 | 中国大陆的一些用户报告了使用自动更新脚本下载 dist 时遇到的问题。在这种情况下,用户有两种手动获取 dist 的方法:
20 |
21 | ### 选项1:构建应用程序
22 | 确保你已经准备好了 nodeJS 环境并遵循 `Development` 部分的步骤。运行 `npm run build` 来编译应用程序。
23 |
24 | ### 选项2:下载编译好的应用程序
25 | 你可以从 [发布](https://github.com/huchenlei/sd-webui-openpose-editor/releases) 页面下载编译好的应用程序(`dist.zip`)。在仓库的根目录解压该包,确保解压后的目录命名为 `dist`。
26 |
27 | # 使用
28 | Openpose 编辑器核心是使用 Vue3 构建的。gradio 扩展脚本是一个轻量级的包装器,它将 Vue3 应用程序挂载在 `/openpose_editor_index` 上。
29 |
30 | 用户可以直接在 `localhost:7860/openpose_editor_index` 访问编辑器,如果需要,但主要的入口点是在 ControlNet 扩展中调用编辑器。在 ControlNet 扩展中,选择任何 openpose 预处理器,然后点击运行预处理器按钮。将会生成一个预处理器结果预览。点击生成图像右下角的 `Edit` 按钮将会在一个模态中打开 openpose 编辑器。编辑后,点击 `Send pose to ControlNet` 按钮会将姿势发送回 ControlNet。
31 |
32 | 以下演示展示了基本的工作流程:
33 |
34 | [](http://www.youtube.com/watch?v=WEHVpPNIh8M)
35 |
36 | # 特性
37 | 1. 支持在 controlnet 中使用的面部/手部。
38 | - 该扩展能识别 controlnet 预处理结果中的面部/手部对象。
39 | - 如果预处理结果中遗漏了它们,用户可以添加面部/手部。可以通过以下两种方式实现:
40 | - 添加默认的手(面部不支持,因为面部的关键点太多(70个关键点),这使得手动调整它们变得非常困难。)
41 | - 通过上传一个姿势 JSON 来添加对象。将会使用第一人称的相应对象。
42 | 2. 可视性切换
43 | - 如果 ControlNet 预处理器无法识别一个关键点,它将会有 `(-1, -1)` 作为坐标。这种无效的关键点在编辑器中将被设置为不可见。
44 | - 如果用户将一个关键点设置为不可见并将姿势发送回 controlnet,该关键点连接的肢体段将不会被渲染。实际上,这就是你在编辑器中移除一个肢体段的方式。
45 | 3. 组切换
46 | - 如果你不想意外地选择和修改一个画布对象(手/面部/身体)的关键点。你可以将它们分组。分组后的对象会表现得像一个单一的对象。你可以对组进行缩放、旋转、扭曲。
47 |
48 | # Development
49 | ## Recommended IDE Setup
50 | [VSCode](https://code.visualstudio.com/) + [Volar](https://marketplace.visualstudio.com/items?itemName=Vue.volar) (and disable Vetur) + [TypeScript Vue Plugin (Volar)](https://marketplace.visualstudio.com/items?itemName=Vue.vscode-typescript-vue-plugin).
51 |
52 | ## Type Support for `.vue` Imports in TS
53 |
54 | TypeScript cannot handle type information for `.vue` imports by default, so we replace the `tsc` CLI with `vue-tsc` for type checking. In editors, we need [TypeScript Vue Plugin (Volar)](https://marketplace.visualstudio.com/items?itemName=Vue.vscode-typescript-vue-plugin) to make the TypeScript language service aware of `.vue` types.
55 |
56 | If the standalone TypeScript plugin doesn't feel fast enough to you, Volar has also implemented a [Take Over Mode](https://github.com/johnsoncodehk/volar/discussions/471#discussioncomment-1361669) that is more performant. You can enable it by the following steps:
57 |
58 | 1. Disable the built-in TypeScript Extension
59 | 1) Run `Extensions: Show Built-in Extensions` from VSCode's command palette
60 | 2) Find `TypeScript and JavaScript Language Features`, right click and select `Disable (Workspace)`
61 | 2. Reload the VSCode window by running `Developer: Reload Window` from the command palette.
62 |
63 | ## Customize configuration
64 |
65 | See [Vite Configuration Reference](https://vitejs.dev/config/).
66 |
67 | ## Project Setup
68 |
69 | ```sh
70 | npm install
71 | ```
72 |
73 | ### Compile and Hot-Reload for Development
74 |
75 | ```sh
76 | npm run dev
77 | ```
78 |
79 | ### Type-Check, Compile and Minify for Production
80 |
81 | ```sh
82 | npm run build
83 | ```
84 |
85 | ### Run Unit Tests with [Vitest](https://vitest.dev/)
86 |
87 | ```sh
88 | npm run test:unit
89 | ```
90 |
91 | ### Lint with [ESLint](https://eslint.org/)
92 |
93 | ```sh
94 | npm run lint
95 | ```
96 |
--------------------------------------------------------------------------------
/env.d.ts:
--------------------------------------------------------------------------------
1 | ///
2 |
--------------------------------------------------------------------------------
/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |