Created
September 28, 2020 06:56
-
-
Save ChingT/bbc77f7a0deb52a05dabb7d4be756e0c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
from scipy.spatial.distance import cdist | |
import camera_models as cm | |
CORE = "Pupil Cam1 ID2" | |
PI = "PI world v1" | |
FHD = 1920, 1080 | |
HD = 1280, 720 | |
VGA = 640, 480 | |
SQR = 1088, 1080 | |
model_wide_lens_fhd = cm.Camera_Model.from_default(CORE, FHD) | |
model_wide_lens_hd = cm.Camera_Model.from_default(CORE, HD) | |
model_wide_lens_vga = cm.Camera_Model.from_default(CORE, VGA) | |
model_pi = cm.Camera_Model.from_default(PI, SQR) | |
points = [(1088 / 2, 0), (1088 / 2, 1080)] | |
res = model_pi.unprojectPoints(points) | |
fov_cos = 1.0 - cdist([res[0]], [res[1]], metric="cosine") | |
fov_cos = np.rad2deg(np.arccos(fov_cos)) | |
print("Vertical FOV Option 1:", fov_cos.item()) | |
points = [(0, 0), (0, 1080)] | |
res = model_pi.unprojectPoints(points) | |
fov_cos = 1.0 - cdist([res[0]], [res[1]], metric="cosine") | |
fov_cos = np.rad2deg(np.arccos(fov_cos)) | |
print("Vertical FOV Option 2:", fov_cos.item()) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment