PanoSAM is a Python library for running SAM3 segmentation on equirectangular panorama images with automatic perspective projection and deduplication.
Project description
PanoSAM
SAM3 segmentation for equirectangular panorama images.
Handles perspective projection, coordinate conversion, and mask deduplication.
https://github.com/user-attachments/assets/61a546ac-3fce-4c26-b87c-3e09b0e4c331
Installation
pip install panosam[sam3] # Recommended: includes SAM3 dependencies
| Extra | Command | Use Case |
|---|---|---|
| (none) | pip install panosam |
Bring your own engine |
[sam3] |
pip install panosam[sam3] |
SAM3 segmentation |
[viz] |
pip install panosam[viz] |
Visualization |
[full] |
pip install panosam[full] |
All features |
SAM3 requires HuggingFace authentication:
huggingface-cli login
Usage
import panosam as ps
from panosam.engines.sam3 import SAM3Engine
engine = SAM3Engine()
client = ps.PanoSAM(engine=engine, views=ps.PerspectivePreset.DEFAULT)
result = client.segment("panorama.jpg", prompt="car")
for mask in result.masks:
print(f"{mask.label}: yaw={mask.center_yaw:.1f}, pitch={mask.center_pitch:.1f}")
result.save_json("results.panosam.json")
Custom Engine
Any class with a matching segment() method works:
class MyEngine:
def segment(
self,
image: Image.Image,
text_prompt: str,
threshold: float = 0.5,
mask_threshold: float = 0.5,
simplify_tolerance: float = 0.005,
) -> list[ps.FlatMaskResult]:
...
client = ps.PanoSAM(engine=MyEngine())
Perspective Presets
| Preset | FOV | Resolution | Perspectives |
|---|---|---|---|
DEFAULT |
45° | 2048x2048 | 16 |
ZOOMED_IN |
22.5° | 1024x1024 | 32 |
ZOOMED_OUT |
60° | 2500x2500 | 12 |
WIDEANGLE |
90° | 2500x2500 | 8 |
Documentation
See yz3440.github.io/panosam for full API reference and examples.
License
MIT
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 panosam-0.1.1.tar.gz.
File metadata
- Download URL: panosam-0.1.1.tar.gz
- Upload date:
- Size: 6.6 MB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5bbadcbde1c85ffbb3697bb93d618b695f2f422480b4d98325b47cc1a74f0480
|
|
| MD5 |
477d8d6efda5642224a785478a7aad25
|
|
| BLAKE2b-256 |
3e36c39be1d3fef6a6696e1876b015bd8d45885d38c7d761c318cdabeec7709c
|
Provenance
The following attestation bundles were made for panosam-0.1.1.tar.gz:
Publisher:
publish.yml on yz3440/panosam
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
panosam-0.1.1.tar.gz -
Subject digest:
5bbadcbde1c85ffbb3697bb93d618b695f2f422480b4d98325b47cc1a74f0480 - Sigstore transparency entry: 836395172
- Sigstore integration time:
-
Permalink:
yz3440/panosam@d71ea2293f19e39239d3f05a7e7d16d11a9404a3 -
Branch / Tag:
refs/tags/v0.1.1 - Owner: https://github.com/yz3440
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@d71ea2293f19e39239d3f05a7e7d16d11a9404a3 -
Trigger Event:
release
-
Statement type:
File details
Details for the file panosam-0.1.1-py3-none-any.whl.
File metadata
- Download URL: panosam-0.1.1-py3-none-any.whl
- Upload date:
- Size: 29.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
829f25cdd97393825f0c2d7619fb7900ff7be5f9a9c326d828caf41dd7b8ffd0
|
|
| MD5 |
dd7725847de031010793031e9ec980ad
|
|
| BLAKE2b-256 |
bdcebaefd029b36974356254d0c250be93a532c8c63d197742ff21f847248c99
|
Provenance
The following attestation bundles were made for panosam-0.1.1-py3-none-any.whl:
Publisher:
publish.yml on yz3440/panosam
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
panosam-0.1.1-py3-none-any.whl -
Subject digest:
829f25cdd97393825f0c2d7619fb7900ff7be5f9a9c326d828caf41dd7b8ffd0 - Sigstore transparency entry: 836395174
- Sigstore integration time:
-
Permalink:
yz3440/panosam@d71ea2293f19e39239d3f05a7e7d16d11a9404a3 -
Branch / Tag:
refs/tags/v0.1.1 - Owner: https://github.com/yz3440
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@d71ea2293f19e39239d3f05a7e7d16d11a9404a3 -
Trigger Event:
release
-
Statement type: