VOIT = Virtual Object Insertion Tooolkit.
Project description
VOIT (Virtual Object Insertion Toolkit) is a simple library to insert objects to images.
The library focuses on the ease of use and low-level control instead of the raw quality.
The pre-existing object insertion tool, on which VOIT is heavily based, is in the repositories of the original authors: inverse renderer, object insertion tool.
Main features:
- Handle shadows.
- Handle reflections on the floor.
- Provide tools for authoring of datasets with inserted objects (editing, serialization, deserialization).
Installation
VOIT depends on Pytorch, but it does not declare it as a requirement in its metadata. You have to manually install it based on the instructions here.
You can then install VOIT from PIP or its GitHub repository.
From PIP:
pip install voit-inserter
From GitHub:
pip install git+https://github.com/mntusr/voit
Usage
The simplest example of using VOIT looks like this:
import torch
import numpy as np
import voit
from pathlib import Path
# the image to which the object should be inserted
rgb_image: np.ndarray = ...
# the projection matrix of the camera
t_proj_mat: np.ndarray = ...
# where you want to insert the object
the_pixel_of_the_origin_of_the_inserted_object: voit.Vec2i = ...
the_depth_at_the_pixel_where_the_object_is_inserted: float = ...
# the normal vector of the previous surface
the_normal_of_the_surface_on_which_the_object_is_inserted = voit.Vec3 = ...
inserter = voit.Inserter(
t_proj_mat=t_proj_mat,
floor_proxy_size=voit.Vec2(5, 5), # good default for most cases
im_size=voit.Vec2i(image.shape[2], image.shape[1]),
shadow_map_size=1024, # good default for most cases
pt_device=torch.device("cuda")
)
try:
# the object to insert
obj = inserter.load_model(Path("mymodel.glb"))
result = inserter.insert(
input_im=image,
input_im_linear=False,
output_im_linear=False,
pos_px=the_pixel_of_the_origin_of_the_inserted_object,
pos_depth=the_depth_at_the_pixel_where_the_object_is_inserted,
normal_vs=the_normal_of_the_surface_on_which_the_object_is_inserted,
obj=obj,
)
finally:
inserter.destroy()
# the image you made 😁
resulting_image = result.im
How to cite
TBD
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file voit_inserter-0.1.1.tar.gz.
File metadata
- Download URL: voit_inserter-0.1.1.tar.gz
- Upload date:
- Size: 2.0 MB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2ea6c27475e0f2a01c10aca59f40a7c53ca0026e4607db17a5dcc160865bb570
|
|
| MD5 |
f85399141a2ff8c65c38a918f00b250e
|
|
| BLAKE2b-256 |
d83bf21a4658edfa4728bf08d8eb3ce9385084fbfa0957917eb48f8a6a2376ac
|
Provenance
The following attestation bundles were made for voit_inserter-0.1.1.tar.gz:
Publisher:
pypi.yml on mntusr/voit
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
voit_inserter-0.1.1.tar.gz -
Subject digest:
2ea6c27475e0f2a01c10aca59f40a7c53ca0026e4607db17a5dcc160865bb570 - Sigstore transparency entry: 168252789
- Sigstore integration time:
-
Permalink:
mntusr/voit@3adc4abc3edce3b99c0f030d6e75b150dfea9837 -
Branch / Tag:
refs/tags/v0.1.1 - Owner: https://github.com/mntusr
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
pypi.yml@3adc4abc3edce3b99c0f030d6e75b150dfea9837 -
Trigger Event:
release
-
Statement type:
File details
Details for the file voit_inserter-0.1.1-py3-none-any.whl.
File metadata
- Download URL: voit_inserter-0.1.1-py3-none-any.whl
- Upload date:
- Size: 2.0 MB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ee8d7c3c3ddb3cb71c7cd4fe08316dc1ee6286ce603fabf22d7ea27abe108581
|
|
| MD5 |
b9fbddac356b9fe1c58e9f42e6dd4fb1
|
|
| BLAKE2b-256 |
015707d0f272a21bcb66fd119d8abcc650c1eab71468150ae8cfa231e0bf1120
|
Provenance
The following attestation bundles were made for voit_inserter-0.1.1-py3-none-any.whl:
Publisher:
pypi.yml on mntusr/voit
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
voit_inserter-0.1.1-py3-none-any.whl -
Subject digest:
ee8d7c3c3ddb3cb71c7cd4fe08316dc1ee6286ce603fabf22d7ea27abe108581 - Sigstore transparency entry: 168252791
- Sigstore integration time:
-
Permalink:
mntusr/voit@3adc4abc3edce3b99c0f030d6e75b150dfea9837 -
Branch / Tag:
refs/tags/v0.1.1 - Owner: https://github.com/mntusr
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
pypi.yml@3adc4abc3edce3b99c0f030d6e75b150dfea9837 -
Trigger Event:
release
-
Statement type: