-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #4 from ashwani-rathee/ash/basic_set
Stereo Extension made
- Loading branch information
Showing
5 changed files
with
91 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
/Manifest.toml | ||
practice.jl |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
module CalibrateExt | ||
|
||
using GridDetector, VideoIO | ||
using MultipleViewGeometry | ||
|
||
function MultipleViewGeometry.calibrate(device;save=false) | ||
cam = VideoIO.opencamera("video=" * device) | ||
|
||
count = 0 | ||
@info count "Calibrating..." | ||
fps = VideoIO.framerate(cam) | ||
images = [] | ||
corners = [] | ||
|
||
try | ||
while (count < 9) | ||
try | ||
img = Gray.(read(cam)) | ||
cam.flush = true | ||
|
||
# @info "Info:" cam.flush cam.finished cam.bits_per_result_pixel cam.frame_queue | ||
res = find_checkerboard(img) | ||
|
||
if (length(res) == 63) | ||
@info "Checkerboard size:" length(res) | ||
push!(images, img) | ||
push!(corners, res) | ||
count = count + 1 | ||
sleep(0.5) | ||
else | ||
sleep(0.01) | ||
end | ||
|
||
cam.flush = false | ||
catch e | ||
@info e.message | ||
if typeof(e) <: InterruptException | ||
println("caught Interrupt") | ||
return | ||
end | ||
end | ||
end | ||
|
||
if (save == true) | ||
for i in 1:9 | ||
save("image-$i.jpg", images[i]) | ||
end | ||
end | ||
|
||
@info "Images:" length(images) | ||
finally | ||
close(cam) | ||
end | ||
|
||
return images, corners | ||
end | ||
|
||
|
||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters