Skip to content

Commit 46c1557

Browse files
authored
Merge pull request #44 from PaulDebus/master
make projective more generic
2 parents 1c3108f + 54a96fa commit 46c1557

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/projective.jl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ Returns:
160160
See also: Camera(), camstruct2projmatrix()
161161
162162
"""
163-
function cameraproject(P::Array, pt::Array) # Projection matrix version
163+
function cameraproject(P::Matrix{T}, pt::Array) where T # Projection matrix version
164164

165165
if size(P) != (3,4)
166166
error("Projection matrix must be 3x4")
@@ -171,7 +171,7 @@ function cameraproject(P::Array, pt::Array) # Projection matrix version
171171
end
172172

173173
nPts = size(pt,2)
174-
xy = zeros(2,nPts)
174+
xy = zeros(T, 2,nPts)
175175

176176
for i in 1:nPts
177177
s = P[3,1]*pt[1,i] + P[3,2]*pt[2,i] + P[3,3]*pt[3,i] + P[3,4]
@@ -1899,7 +1899,7 @@ function solvestereopt(xy::Array{T1,2}, P::Array{Array{T2,2}}; reprojecterror=fa
18991899
@assert N >= 2 "Must have at least 2 camera views"
19001900
19011901
# Build eqn of the form A*pt = 0
1902-
A = zeros(2*N, 4)
1902+
A = zeros(T1, 2*N, 4)
19031903
for n = 1:N
19041904
A[2*n-1,:] = xy[1,n]*P[n][3,:] .- P[n][1,:]
19051905
A[2*n ,:] = xy[2,n]*P[n][3,:] .- P[n][2,:]

0 commit comments

Comments
 (0)