-
-
Notifications
You must be signed in to change notification settings - Fork 41
docs: Binary image segmentation example #1795
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
aleksanderkatan
merged 62 commits into
main
from
docs/binary-image-segmentation-example
Nov 18, 2025
Merged
Changes from 55 commits
Commits
Show all changes
62 commits
Select commit
Hold shift + click to select a range
fa18202
Fork chroma-keying, rewrite it to tgsl
661ac6b
Use fixed resources
cad7e0b
Use const
707946b
Update Chroma Keying
58e721b
Remove unnecessary controls
3995789
Split into files
5c582be
Add onnx
37d78bf
Merge remote-tracking branch 'origin/main' into docs/binary-image-seg…
c8af87a
Semi working state
4b9cae9
Add downscaling pipeline
d23f00b
Somewhat working one frame
0376eb3
Extract fullscreen triangle and model creation to dedicated files
8d5912a
Remove ios handling temporarily (surely)
c077735
Move downscale to another file
53f0677
Change downscale from render to compute
75111fb
More refactor
5180176
More refactor
2788f54
Rewrite generateMasko to compute
67b5b9b
More refactor
c9d4113
More refactor
8a9c68a
More refactor
2d8584e
Add a new model to assets
2152bca
Switch models
9dea9f7
Fix the offset
f69b10b
Better model
5555457
Calculate mask independently
0f78115
Add blur
d7956d5
Remove options uniform
20224b4
Fix the blur to cover the entire screen
8b24433
Merge remote-tracking branch 'origin/main' into docs/binary-image-seg…
89fb49f
Use fullScreenTriangle
f2ce2cf
Merge remote-tracking branch 'origin/main' into docs/binary-image-seg…
e29e193
Fix camera tresholding, use fullscreen triangle
71d6fe2
Update tests
e74fbb7
Add blur strength controls
fdb447d
Update tags and add thumbnail
a9b6165
Add proper cleanup
ef4a9d0
Docs & refactor
bd7b82a
Add attribution
cd21293
Review fixes
136ba07
Remove the x coordinate flip
9cee84d
Add back iOS support
0ed89b9
Make attribution transparent until the model loads
744bd47
Use mipmaps for blur
9d75a5f
Add controls to swap between blur types
152bb5b
Add subgroups check
bb13302
Create textures for the blurred images immediately
131a6c6
Precompute bind groups for blur
1e9b36a
Precompute mask bind group
5d14aa6
Merge remote-tracking branch 'origin/main' into docs/binary-image-seg…
89b88e7
Lint
a40be8a
Throw an appropriate error on Safari
2bfb616
Merge remote-tracking branch 'origin/main' into docs/binary-image-seg…
b3a16ea
Remove iOS handling (again...)
652673b
Add back lazy textures (didn't work with mobile resolutions)
f715c32
Merge branch 'main' into docs/binary-image-segmentation-example
aleksanderkatan 7d4ce5b
Update tests
20306ae
Merge remote-tracking branch 'origin/main' into docs/binary-image-seg…
b5ac9ba
Move the attribution to the code
09485e1
Move from css styling to tailwind
2ab4704
Merge remote-tracking branch 'origin/main' into docs/binary-image-seg…
68d58ec
Update tests
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
44 changes: 44 additions & 0 deletions
44
apps/typegpu-docs/src/examples/image-processing/background-segmentation/index.html
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,44 @@ | ||
| <canvas></canvas> | ||
| <video autoplay playsinline></video> | ||
|
|
||
| <style> | ||
| /* Keep the video "painted" so Safari continues decoding frames. */ | ||
| video { | ||
| position: absolute; | ||
| top: 0; | ||
| left: 0; | ||
| width: 1px; | ||
| height: 1px; | ||
| opacity: 0; | ||
| pointer-events: none; | ||
| } | ||
aleksanderkatan marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| #attribution { | ||
| opacity: 0; | ||
| position: absolute; | ||
| margin: 0 auto; | ||
| text-align: left; | ||
| z-index: 1; | ||
| background-color: rgba(0, 0, 0, 0.7); | ||
| color: white; | ||
| padding: 0.625rem; | ||
| border-radius: 0.625rem; | ||
| user-select: none; | ||
| transition: opacity 0.5s; | ||
| } | ||
| </style> | ||
|
|
||
| <div id="attribution"> | ||
| <h3 class="controls-header">Attribution (click to dismiss)</h3> | ||
| Background segmentation uses the | ||
| <a | ||
| href="https://github.com/xuebinqin/U-2-Net" | ||
| target="_blank" | ||
| style="color: #7cd9ff" | ||
| >u2netp</a> model by Xuebin Qin et al., licensed under the | ||
| <a | ||
| href="https://www.apache.org/licenses/LICENSE-2.0" | ||
| target="_blank" | ||
| style="color: #7cd9ff" | ||
| >Apache License 2.0</a>. | ||
| </div> | ||
aleksanderkatan marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Bump reminder (when patched)