Pano2pers
Covert paronoma to perspective
Source code in urbanworm/pano2pers.py
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 |
|
GetPerspective(FOV, THETA, PHI, height, width, RADIUS=128)
¶
Convert an equirectangular panorama image to a perspective view.
This function computes the perspective projection of a 360° panorama image based on field of view and view angles, returning the perspective as a base64-encoded PNG image (useful for web/LLM APIs).
Parameters:
Name | Type | Description | Default |
---|---|---|---|
FOV
|
float
|
Field of view in degrees. |
required |
THETA
|
float
|
Horizontal viewing angle (left/right), in degrees. |
required |
PHI
|
float
|
Vertical viewing angle (up/down), in degrees. |
required |
height
|
int
|
Height of the output image. |
required |
width
|
int
|
Width of the output image. |
required |
RADIUS
|
int
|
Projection sphere radius. Defaults to 128. |
128
|
Returns:
Name | Type | Description |
---|---|---|
str |
str
|
A base64-encoded PNG string representing the perspective view. |
Source code in urbanworm/pano2pers.py
45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 |
|
__init__(img_path=None, img_url=None)
¶
Add image
Parameters:
Name | Type | Description | Default |
---|---|---|---|
img_path
|
str
|
Image path |
None
|
img_url
|
str
|
Image URL |
None
|
Source code in urbanworm/pano2pers.py
16 17 18 19 20 21 22 23 24 25 26 27 28 |
|
read_url2img(url)
¶
Read image from a URL
Parameters:
Name | Type | Description | Default |
---|---|---|---|
url
|
str
|
Image URL |
required |
Returns:
Type | Description |
---|---|
ndarray
|
np.ndarray: The image as a NumPy array. |
Source code in urbanworm/pano2pers.py
30 31 32 33 34 35 36 37 38 39 40 41 42 43 |
|