Skip to content

Commit

Permalink
include a projection test for validation
Browse files Browse the repository at this point in the history
the reprojection error seems to be quite large, we need 8px for the test
to pass by comparing the stored pixel coordinates with the computed
coordinates using ImageProjectiGeometry. As we are not testing the
projection, but loading the file, I guess this is fine. But still keep
this in mind...
  • Loading branch information
PaulDebus committed Oct 30, 2023
1 parent e159ec9 commit 0a7f031
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,25 @@ using FileIO
using Test
using BundlerIO
using Downloads
using ImageProjectiveGeometry

@testset "BundlerIO" begin
# download an example file
url = "https://raw.githubusercontent.com/snavely/bundler_sfm/master/examples/kermit/results.example/bundle.out"
filepath = tempdir()*"/bundle.out"
Downloads.download(url, filepath)
Downloads.download(url, filepath)

bundle = load(filepath)
@test length(bundle.cameras) == 11
@test length(bundle.points) == 634
@test length(bundle.views) == 2039
@test bundle.views[(4,452)] == [-40.93, -5.87]
# test the projections. the errors are surprisingly large...
for (cam_id, point_id) in keys(bundle.views)
p = bundle.points[point_id]
cam = bundle.cameras[cam_id]
@test isapprox(cameraproject(cam, collect(p.coords)), bundle.views[(cam_id, point_id)], atol=8.) # figure out if we can reduce the tolerance
end
save(filepath, bundle)
rm(filepath)
end

0 comments on commit 0a7f031

Please sign in to comment.