Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adds yosemite test sequence for optical flow #8

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions test/REQUIRE
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,5 @@ TestImages 0.2.0
@windows ImageMagick
@linux ImageMagick
@osx QuartzImageIO
FileIO
JLD2
30 changes: 29 additions & 1 deletion test/optical_flow.jl
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using Images, TestImages, StaticArrays, OffsetArrays
using Images, TestImages, StaticArrays, OffsetArrays, JLD2, FileIO

# Testing constants
test_image = "mandrill"
Expand Down Expand Up @@ -92,4 +92,32 @@ end
@test max_err < max_allowed_error
println("Lost Points Percentage = ", (lost_points/length(pts))*100)
@test ((lost_points/length(pts))*100) < max_lost_points_percentage


#Yosemite Sequence
img1 = load("test_data/yosemite/images/img1.tif")
img2 = load("test_data/yosemite/images/img2.tif")

corners = imcorner(img1, 0.0025, method=shi_tomasi)
y, x = findn(corners)
a = map((yi, xi) -> SVector{2}(yi, xi), y, x)

flow, status, err = optical_flow(img1, img2, LK(a, [SVector{2}(0.0,0.0)], 25, 4, false, 20))

correct_flow = load("test_data/yosemite/flow/yosemite_correct_flow.jld2", "yosemite_correct_flow")

error_pts = 0
lost_points = 0
for i = 1:length(a)
if !status[i]
lost_points += 1
else
if abs(correct_flow[a[i]..., 1] - flow[i][1]) > 1 || abs(correct_flow[a[i]..., 2] - flow[i][2]) > 1
error_pts += 1
end
end
end

@test ((error_pts/length(a))*100) < 25
@test ((lost_points/length(a))*100) < 10
end
Binary file not shown.
Binary file added test/test_data/yosemite/images/img1.tif
Binary file not shown.
Binary file added test/test_data/yosemite/images/img2.tif
Binary file not shown.