{"id":49428434,"url":"https://github.com/cobanov/depth2normal","last_synced_at":"2026-04-29T10:34:57.829Z","repository":{"id":349508783,"uuid":"627262693","full_name":"cobanov/depth2normal","owner":"cobanov","description":"Converts a depth map image to a normal map image using Python","archived":false,"fork":false,"pushed_at":"2026-04-06T08:37:57.000Z","size":1219,"stargazers_count":112,"open_issues_count":2,"forks_count":2,"subscribers_count":2,"default_branch":"main","last_synced_at":"2026-04-06T10:27:11.037Z","etag":null,"topics":["blender","blender-python","depth-map","midas","normal-map","normal-mapping","opencv","python","sobel"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/cobanov.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2023-04-13T05:35:30.000Z","updated_at":"2026-04-06T08:38:07.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/cobanov/depth2normal","commit_stats":null,"previous_names":["cobanov/depth2normal"],"tags_count":null,"template":false,"template_full_name":null,"purl":"pkg:github/cobanov/depth2normal","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cobanov%2Fdepth2normal","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cobanov%2Fdepth2normal/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cobanov%2Fdepth2normal/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cobanov%2Fdepth2normal/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cobanov","download_url":"https://codeload.github.com/cobanov/depth2normal/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cobanov%2Fdepth2normal/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32422142,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-29T06:29:02.080Z","status":"ssl_error","status_checked_at":"2026-04-29T06:29:00.631Z","response_time":110,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["blender","blender-python","depth-map","midas","normal-map","normal-mapping","opencv","python","sobel"],"created_at":"2026-04-29T10:34:56.132Z","updated_at":"2026-04-29T10:34:57.817Z","avatar_url":"https://github.com/cobanov.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# depth2normal\n\nConvert depth map images to RGB normal maps for shading and 3D workflows.\n\n**Requirements:** Python 3.10 or newer. Runtime dependencies are NumPy, SciPy, Pillow, and Click (no OpenCV).\n\n| Depth (input) | Normal map (output) |\n| --- | --- |\n| ![Depth example](https://raw.githubusercontent.com/cobanov/depth2normal/main/assets/depth.png) | ![Normal map example](https://raw.githubusercontent.com/cobanov/depth2normal/main/assets/normal.png) |\n\n## Install\n\n**From PyPI** (after you publish the package):\n\n```bash\npip install depth2normal\n```\n\nWith uv in **another** project (not this repository):\n\n```bash\nuv add depth2normal\n```\n\nOr without editing that project’s `pyproject.toml`:\n\n```bash\nuv pip install depth2normal\n```\n\n\u003e **Note:** Inside this repository, do **not** run `uv add depth2normal`—the project name matches the package name, and uv blocks that self-dependency. Use `uv sync` instead (see below).\n\n## Usage\n\nAll CLI forms share the same options (see table at the end of this section).\n\n### After `pip install` or `uv pip install`\n\n```bash\ndepth2normal path/to/depth.png -o normal.png\n```\n\n### From a clone (recommended for development)\n\nInstall the project and dev tools, then use the console script or the helper script:\n\n```bash\ngit clone https://github.com/cobanov/depth2normal.git\ncd depth2normal\nuv sync\n```\n\n```bash\nuv run depth2normal assets/depth.png -o normal.png\n```\n\nOr run the repo-root helper without an editable install (still uses deps from `uv sync`):\n\n```bash\nuv run run.py assets/depth.png -o normal.png\n```\n\nWith plain `python` (dependencies must be available in that environment, e.g. after `pip install -e .`):\n\n```bash\npython run.py assets/depth.png -o normal.png\n```\n\nModule entry point when `src` is on `PYTHONPATH` or the package is installed:\n\n```bash\nPYTHONPATH=src python -m depth2normal assets/depth.png -o normal.png\n```\n\n### Python API\n\n```python\nimport depth2normal\n\ndepth2normal.convert(\"depth.png\", \"normal.png\")\ndepth2normal.convert(\"depth.png\", \"normal.png\", strength=2.0, method=\"gaussian\", sigma=1.5)\n\nimport numpy as np\n\ndepth_array = np.load(\"depth.npy\")\nnormal_map = depth2normal.depth_to_normal(depth_array, method=\"scharr\")\n```\n\n### CLI options\n\n| Option | Default | Description |\n| --- | --- | --- |\n| `-o`, `--output` | `normal_map.png` | Output image path |\n| `-s`, `--strength` | `1.0` | Scales gradients (stronger = more pronounced normals) |\n| `-m`, `--method` | `gaussian` | Gradient algorithm: `gaussian`, `sobel`, or `scharr` |\n| `--sigma` | `1.0` | Gaussian kernel width (only with `--method gaussian`) |\n| `--version` | — | Print version and exit |\n\nPositional argument: path to the depth image file.\n\n### Gradient methods\n\n| Method | Quality | Speed | Notes |\n| --- | --- | --- | --- |\n| `gaussian` | Best | Moderate | Smooth normals via Gaussian derivative. `--sigma` controls the smoothness/detail tradeoff. |\n| `sobel` | Good | Fast | Classic 3x3 Sobel. Sharp but can show staircase artifacts on quantized depth. |\n| `scharr` | Good | Fast | Better rotational accuracy than Sobel, similar speed. |\n\n## How it works\n\n1. Load depth as grayscale float array.\n2. Estimate surface gradients with the selected filter (Gaussian derivative, Sobel, or Scharr).\n3. Build normals (-dx, -dy, 1), normalize to unit length, then map to 8-bit RGB.\n\n## Development\n\n```bash\nuv sync\nuv run pytest\nuv run ruff check .\nuv run ruff format --check .\n```\n\n## License\n\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcobanov%2Fdepth2normal","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcobanov%2Fdepth2normal","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcobanov%2Fdepth2normal/lists"}