Ejemplo n.º 1
0
         and not f == PLYFILE and not f == PKLFILE)]

frames = {}
frames["files"] = np.array(files)
frames["images"] = []
frames["focal_length"] = RATIO * 4100.0 / 1.4
frames["K"] = bf.f2K(frames["focal_length"])
frames["num_images"] = len(files)

# graph dictionary
# -- motion is the frame-to-frame estimate of [R|t]
# -- 3Dmatches maps 3D points to 2D points in specific frames via a dictionary
#    whose keys are the tuple (kp_idx, most_recent_frame) and values are
#    the dict ([previous_frames], [xy_positions], [3D_estimates])
graph = {}
graph["motion"] = [bf.basePose()]
graph["3Dmatches"] = {}
graph["frameOffset"] = 0

# make an ORB detector
orb = cv2.ORB(nfeatures=50000)

# make a brute force matcher
matcher = cv2.BFMatcher(normType=cv2.NORM_HAMMING)

# keep track of last camera pose
lastRt = graph["motion"][0]

# for adjacent frames, detect ORB keypoints and extimate F
for i in range(1, frames["num_images"]):
Ejemplo n.º 2
0
"""
Test script.
"""

import numpy as np
import BasicFunctions as bf

f = 5.0
K = bf.f2K(f)
Rt1 = bf.basePose()

R21 = bf.fromAxisAngle(np.array([0, 0, np.pi / 2.0]))
C21 = np.matrix([[f], [0], [0]])
Rt21 = np.hstack([R21, -R21 * C21])
"""
x1 = np.matrix([[2.0*f],[0]])
x2 = np.matrix([[0],[f]])

print "x1 = " + str(x1.T)
print "x2 = " + str(x2.T)

p = bf.triangulateLM(Rt1, Rt2, x1, x2, K)

print "p = " + str(p.T)

px1 = bf.fromHomogenous(K * Rt1 * bf.toHomogenous(p))
px2 = bf.fromHomogenous(K * Rt2 * bf.toHomogenous(p))

print "px1 = " + str(px1.T)
print "px2 = " + str(px2.T)
"""
Ejemplo n.º 3
0
"""
Test script.
"""

import numpy as np
import BasicFunctions as bf

f = 5.0
K = bf.f2K(f)
Rt1 = bf.basePose()

R21 = bf.fromAxisAngle(np.array([0, 0, np.pi/2.0]))
C21 = np.matrix([[f], [0], [0]])
Rt21 = np.hstack([R21, -R21 * C21])

"""
x1 = np.matrix([[2.0*f],[0]])
x2 = np.matrix([[0],[f]])

print "x1 = " + str(x1.T)
print "x2 = " + str(x2.T)

p = bf.triangulateLM(Rt1, Rt2, x1, x2, K)

print "p = " + str(p.T)

px1 = bf.fromHomogenous(K * Rt1 * bf.toHomogenous(p))
px2 = bf.fromHomogenous(K * Rt2 * bf.toHomogenous(p))

print "px1 = " + str(px1.T)
print "px2 = " + str(px2.T)
Ejemplo n.º 4
0
files = [f for f in os.listdir(IMPATH) if (not f.startswith(".") and not f == PLYFILE and not f == PKLFILE)]

frames = {}
frames["files"] = np.array(files)
frames["images"] = []
frames["focal_length"] = RATIO * 4100.0 / 1.4
frames["K"] = bf.f2K(frames["focal_length"])
frames["num_images"] = len(files)

# graph dictionary
# -- motion is the frame-to-frame estimate of [R|t]
# -- 3Dmatches maps 3D points to 2D points in specific frames via a dictionary
#    whose keys are the tuple (kp_idx, most_recent_frame) and values are
#    the dict ([previous_frames], [xy_positions], [3D_estimates])
graph = {}
graph["motion"] = [bf.basePose()]
graph["3Dmatches"] = {}
graph["frameOffset"] = 0

# make an ORB detector
orb = cv2.ORB(nfeatures=50000)

# make a brute force matcher
matcher = cv2.BFMatcher(normType=cv2.NORM_HAMMING)

# keep track of last camera pose
lastRt = graph["motion"][0]

# for adjacent frames, detect ORB keypoints and extimate F
for i in range(1, frames["num_images"]):