Skip to content

Commit

Permalink
wip3
Browse files Browse the repository at this point in the history
  • Loading branch information
yakir12 committed Dec 20, 2024
1 parent f2ef414 commit 963a140
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
1 change: 1 addition & 0 deletions src/detect_fit.jl
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ function detect_fit(_files, n_corners, with_distortion, aspect)
@assert !isempty(fi) "No checkers were detected in any of the images, perhaps try a different `n_corners`."
files = first.(fi)
imgpointss = last.(fi)
@show imgpointss
objpoints = XYZ.(Tuple.(CartesianIndices((0:(n_corners[1] - 1), 0:(n_corners[2] - 1), 0:0))))
k, Rs, ts, frow, fcol, crow, ccol = fit_model(sz, objpoints, imgpointss, n_corners, with_distortion, aspect)
return (; files, objpoints, imgpointss, sz, k, Rs, ts, frow, fcol, crow, ccol)
Expand Down
14 changes: 12 additions & 2 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,17 @@ function compare(n_corners, ratio)
end
end

function attempts(n_corners, ratio)
for attempt in 1:3
if compare(n_corners, ratio)
return true
else
@warn "attempt $attempt failed"
end
end
return false
end


@testset "CameraCalibrations.jl" begin
@testset "Code quality (Aqua.jl)" begin
Expand All @@ -39,7 +50,7 @@ end
# for w in 5:15, h in 5:15, ratio in 50:100
if isodd(w) isodd(h)
n_corners = (w, h)
@test compare(n_corners, ratio)
@test attempts(n_corners, ratio)
end
end
end
Expand Down Expand Up @@ -67,7 +78,6 @@ end
c, (n, ϵ...) = fit(files, n_corners, checker_size)

@testset "Accuracy" begin
@show n, ϵ
@test all(<(1), ϵ)
end

Expand Down

0 comments on commit 963a140

Please sign in to comment.