Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
yakir12 committed Dec 19, 2024
1 parent 6608326 commit d6061d4
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 8 deletions.
1 change: 1 addition & 0 deletions src/buildcalibrations.jl
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ function calculate_errors(c, imgpointss, objpoints, checker_size, sz, files, n_c
inverse = 0.0
for (i, imgpoints) in pairs(imgpointss)
reprojection += _reprojection(c, i, objpoints, imgpoints)
@show reprojection

projected = c.(imgpoints, i)
projection += sum(LinearAlgebra.norm_sqr, projected .- objpoints)
Expand Down
8 changes: 0 additions & 8 deletions src/detect_fit.jl
Original file line number Diff line number Diff line change
Expand Up @@ -46,18 +46,12 @@ function fit_model(sz, objpoints, imgpointss, n_corners, with_distortion, aspec

Rs = vec.(rvecs)
ts = vec.(tvecs)
# Rs = reverse.(vec.(rvecs))
# ts = reverse.(vec.(tvecs))

mtx = reshape(mtx, 3, 3)'
frow = mtx[1,1]
fcol = mtx[2,2]
crow = mtx[1,3]
ccol = mtx[2,3]
# fcol = mtx[1,1]
# frow = mtx[2,2]
# ccol = mtx[1,3]
# crow = mtx[2,3]

return (; k, Rs, ts, frow, fcol, crow, ccol)
end
Expand All @@ -68,9 +62,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)
# objpoints = XYZ.(Tuple.(CartesianIndices(((n_corners[1] - 1):-1:0, (n_corners[2] - 1):-1:0, 0:0))))
objpoints = XYZ.(Tuple.(CartesianIndices((0:(n_corners[1] - 1), 0:(n_corners[2] - 1), 0:0))))
# objpoints = XYZ.(Tuple.(CartesianIndices(((0:n_corners[1] - 1), (n_corners[2] - 1):-1:0, 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)
end

0 comments on commit d6061d4

Please sign in to comment.