Skip to content

Commit

Permalink
WIP Establishes basic estimation framework
Browse files Browse the repository at this point in the history
  • Loading branch information
zygmuntszpak committed Mar 22, 2018
1 parent e053f7c commit 52eabc3
Show file tree
Hide file tree
Showing 5 changed files with 40 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/MultipleViewGeometry.jl
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,20 @@ include("types.jl")
include("math_aliases.jl")

# Types exported from `types.jl`
export HomogeneousPoint
export HomogeneousPoint, ProjectiveEntity, FundamentalMatrix

# Functions exported from `operators.jl`.
export 𝑛

# Functions exported from `hartley_transformation.jl`.
export hartley_normalization, hartley_transformation

# Functions exported from `moments_fundamentalmatrix.jl`
export moments

include("operators.jl")
include("data_normalization/hartley_transformation.jl")
include("twoview_estimation/moments_fundamentalmatrix.jl")

# package code goes here

Expand Down
1 change: 1 addition & 0 deletions src/math_aliases.jl
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
const = sqrt
const= sum
const = kron
14 changes: 14 additions & 0 deletions src/twoview_estimation/moments_fundamentalmatrix.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
function moments(entity::FundamentalMatrix, matches...)
# ʹ : CTRL + SHIFT + 02b9
pts1, pts2 = matches

𝐀 = fill(0.0,(9,9))
for correspondence in zip(pts1, pts2)
m , mʹ = correspondence
𝐦 = 𝑛(collect(m.coords))
𝐦ʹ = 𝑛(collect(mʹ.coords))
𝐀 = 𝐀 + (𝐦*transpose(𝐦) , 𝐦ʹ*transpose(𝐦ʹ))
end
dump(𝐀)

end
5 changes: 5 additions & 0 deletions src/types.jl
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
struct HomogeneousPoint{T <: AbstractFloat,N}
coords::NTuple{N, T}
end

abstract type ProjectiveEntity end

type FundamentalMatrix <: ProjectiveEntity
end
15 changes: 15 additions & 0 deletions test/moments_fundamentalmatrix_tests.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
using MultipleViewGeometry, Base.Test

pts1 = map(HomogeneousPoint,
[(-10.0, -10.0, 1.0),
(-10.0, 10.0, 1.0),
( 10.0, -10.0, 1.0),
( 10.0, 10.0, 1.0)])

pts2 = map(HomogeneousPoint,
[(-20.0, -20.0, 1.0),
(-20.0, 20.0, 1.0),
( 20.0, -20.0, 1.0),
( 20.0, 20.0, 1.0)])

moments(FundamentalMatrix(), (pts1,pts2)...)

0 comments on commit 52eabc3

Please sign in to comment.