Skip to content

Commit

Permalink
Adds yosemite test sequence for optical flow
Browse files Browse the repository at this point in the history
  • Loading branch information
arijitkar98 committed Jul 31, 2018
1 parent 875177d commit ffc53a7
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 1 deletion.
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.

0 comments on commit ffc53a7

Please sign in to comment.