Name | voit-inserter JSON |
Version |
0.1.1
JSON |
| download |
home_page | None |
Summary | VOIT = Virtual Object Insertion Tooolkit. |
upload_time | 2025-02-03 15:29:19 |
maintainer | None |
docs_url | None |
author | None |
requires_python | >=3.10 |
license | MIT License |
keywords |
object
insertion
|
VCS |
 |
bugtrack_url |
|
requirements |
No requirements were recorded.
|
Travis-CI |
No Travis.
|
coveralls test coverage |
No coveralls.
|
VOIT (**V**irtual **O**bject **I**nsertion **T**oolkit) 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](https://github.com/lzqsd/InverseRenderingOfIndoorScene), [object insertion tool](https://github.com/lzqsd/VirtualObjectInsertion).
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](https://https://pytorch.org/).
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:
```python
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
Raw data
{
"_id": null,
"home_page": null,
"name": "voit-inserter",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.10",
"maintainer_email": null,
"keywords": "object insertion",
"author": null,
"author_email": null,
"download_url": "https://files.pythonhosted.org/packages/d8/3b/f21a4658edfa4728bf08d8eb3ce9385084fbfa0957917eb48f8a6a2376ac/voit_inserter-0.1.1.tar.gz",
"platform": null,
"description": "VOIT (**V**irtual **O**bject **I**nsertion **T**oolkit) is a simple library to insert objects to images.\n\nThe library focuses on the ease of use and low-level control instead of the raw quality. \n\nThe pre-existing object insertion tool, on which VOIT is heavily based, is in the repositories of the original authors: [inverse renderer](https://github.com/lzqsd/InverseRenderingOfIndoorScene), [object insertion tool](https://github.com/lzqsd/VirtualObjectInsertion).\n\nMain features:\n\n* Handle shadows.\n* Handle reflections on the floor.\n* Provide tools for authoring of datasets with inserted objects (editing, serialization, deserialization).\n\n# Installation\n\nVOIT 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](https://https://pytorch.org/). \n\nYou can then install VOIT from PIP or its GitHub repository.\n\nFrom PIP:\n\n```\npip install voit-inserter\n```\n\nFrom GitHub:\n\n```\npip install git+https://github.com/mntusr/voit\n```\n\n# Usage\n\nThe simplest example of using VOIT looks like this:\n\n```python\nimport torch\nimport numpy as np\nimport voit\nfrom pathlib import Path\n\n# the image to which the object should be inserted\nrgb_image: np.ndarray = ...\n\n# the projection matrix of the camera\nt_proj_mat: np.ndarray = ...\n\n# where you want to insert the object\nthe_pixel_of_the_origin_of_the_inserted_object: voit.Vec2i = ...\nthe_depth_at_the_pixel_where_the_object_is_inserted: float = ...\n\n# the normal vector of the previous surface\nthe_normal_of_the_surface_on_which_the_object_is_inserted = voit.Vec3 = ...\n\ninserter = voit.Inserter(\n t_proj_mat=t_proj_mat,\n floor_proxy_size=voit.Vec2(5, 5), # good default for most cases\n im_size=voit.Vec2i(image.shape[2], image.shape[1]),\n shadow_map_size=1024, # good default for most cases\n pt_device=torch.device(\"cuda\")\n)\n\ntry:\n # the object to insert\n obj = inserter.load_model(Path(\"mymodel.glb\"))\n\n result = inserter.insert(\n input_im=image,\n input_im_linear=False,\n output_im_linear=False,\n pos_px=the_pixel_of_the_origin_of_the_inserted_object,\n pos_depth=the_depth_at_the_pixel_where_the_object_is_inserted,\n normal_vs=the_normal_of_the_surface_on_which_the_object_is_inserted,\n obj=obj,\n )\nfinally:\n inserter.destroy()\n\n# the image you made \ud83d\ude01\nresulting_image = result.im\n```\n\n# How to cite\n\nTBD\n",
"bugtrack_url": null,
"license": "MIT License",
"summary": "VOIT = Virtual Object Insertion Tooolkit.",
"version": "0.1.1",
"project_urls": {
"Homepage": "https://github.com/mntusr/voit"
},
"split_keywords": [
"object",
"insertion"
],
"urls": [
{
"comment_text": null,
"digests": {
"blake2b_256": "015707d0f272a21bcb66fd119d8abcc650c1eab71468150ae8cfa231e0bf1120",
"md5": "b9fbddac356b9fe1c58e9f42e6dd4fb1",
"sha256": "ee8d7c3c3ddb3cb71c7cd4fe08316dc1ee6286ce603fabf22d7ea27abe108581"
},
"downloads": -1,
"filename": "voit_inserter-0.1.1-py3-none-any.whl",
"has_sig": false,
"md5_digest": "b9fbddac356b9fe1c58e9f42e6dd4fb1",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.10",
"size": 2008743,
"upload_time": "2025-02-03T15:29:15",
"upload_time_iso_8601": "2025-02-03T15:29:15.452972Z",
"url": "https://files.pythonhosted.org/packages/01/57/07d0f272a21bcb66fd119d8abcc650c1eab71468150ae8cfa231e0bf1120/voit_inserter-0.1.1-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "d83bf21a4658edfa4728bf08d8eb3ce9385084fbfa0957917eb48f8a6a2376ac",
"md5": "f85399141a2ff8c65c38a918f00b250e",
"sha256": "2ea6c27475e0f2a01c10aca59f40a7c53ca0026e4607db17a5dcc160865bb570"
},
"downloads": -1,
"filename": "voit_inserter-0.1.1.tar.gz",
"has_sig": false,
"md5_digest": "f85399141a2ff8c65c38a918f00b250e",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.10",
"size": 2021018,
"upload_time": "2025-02-03T15:29:19",
"upload_time_iso_8601": "2025-02-03T15:29:19.276425Z",
"url": "https://files.pythonhosted.org/packages/d8/3b/f21a4658edfa4728bf08d8eb3ce9385084fbfa0957917eb48f8a6a2376ac/voit_inserter-0.1.1.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-02-03 15:29:19",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "mntusr",
"github_project": "voit",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "voit-inserter"
}