#!/usr/bin/env python # -*- coding: utf-8 -*- from __future__ import print_function # Python 3 compatibility try: # first, try to load the "test_ext" module if it already exists, otherwise build it import test_ext except ImportError: from setup import main as setup_main setup_main() # run "setup.py" to compile the "test_ext" module import test_ext # retry import import numpy as np def main(): # Setup arguments a = 1.0 b = 3.0 buf = np.array([[0, -1], # note that we provide a bigger matrix: 4x2 instead of 3x2, [0, +1], # so only the first 3x2 matrix should be altered by func1() [-1, 0], [+1, 0]], dtype=np.int32) print ("a:", a) print ("b:", b) print ("buf:") print (buf) print () # Run the functions defined in "test.c" print ("Running func2()")
def setup_shortcut(): from setup import setup_main setup_main()
try: # first, try to load the "gtsam_ext" module if it already exists, ... from gtsam_ext import * except ImportError: # ... otherwise build it from setup import main as setup_main setup_main() # run "setup.py" to compile the "gtsam_ext" module from gtsam_ext import * # retry import
loaded = True try: # first, try to load the "triangulation_ext" module if it already exists, ... import triangulation_ext except ImportError: # ... otherwise build it from setup import main as setup_main try: setup_main( ) # run "setup.py" to compile the "triangulation_ext" module import triangulation_ext # retry import except: loaded = False import numpy as np from triangulation_ext import linear_LS_triangulation as linear_LS_triangulation_c def linear_LS_triangulation(u1, P1, u2, P2): """ Linear Least Squares based triangulation. Relative speed: 3.0 (u1, P1) is the reference pair containing normalized image coordinates (x, y) and the corresponding camera matrix. (u2, P2) is the second pair. u1 and u2 are matrices: amount of points equals #rows and should be equal for u1 and u2. The status-vector will be True for all points. """
#!/usr/bin/env python # -*- coding: utf-8 -*- from __future__ import print_function # Python 3 compatibility try: # first, try to load the "test_ext" module if it already exists, otherwise build it import test_ext except ImportError: from setup import main as setup_main setup_main() # run "setup.py" to compile the "test_ext" module import test_ext # retry import import numpy as np def main(): # Setup arguments a = 1.0 b = 3.0 buf = np.array( [ [0, -1 ], # note that we provide a bigger matrix: 4x2 instead of 3x2, [0, +1 ], # so only the first 3x2 matrix should be altered by func1() [-1, 0], [+1, 0] ], dtype=np.int32) print("a:", a) print("b:", b) print("buf:")
loaded = True try: # first, try to load the "triangulation_ext" module if it already exists, ... import triangulation_ext except ImportError: # ... otherwise build it from setup import main as setup_main try: setup_main() # run "setup.py" to compile the "triangulation_ext" module import triangulation_ext # retry import except: loaded = False import numpy as np from triangulation_ext import linear_LS_triangulation as linear_LS_triangulation_c def linear_LS_triangulation(u1, P1, u2, P2): """ Linear Least Squares based triangulation. Relative speed: 3.0 (u1, P1) is the reference pair containing normalized image coordinates (x, y) and the corresponding camera matrix. (u2, P2) is the second pair. u1 and u2 are matrices: amount of points equals #rows and should be equal for u1 and u2. The status-vector will be True for all points. """ # Cast to double if needed