diff --git a/test/REQUIRE b/test/REQUIRE index 7ffcfd5..b216d01 100644 --- a/test/REQUIRE +++ b/test/REQUIRE @@ -3,3 +3,5 @@ TestImages 0.2.0 @windows ImageMagick @linux ImageMagick @osx QuartzImageIO +FileIO +JLD2 diff --git a/test/optical_flow.jl b/test/optical_flow.jl index 00453e8..e1ab220 100644 --- a/test/optical_flow.jl +++ b/test/optical_flow.jl @@ -1,4 +1,4 @@ -using Images, TestImages, StaticArrays, OffsetArrays +using Images, TestImages, StaticArrays, OffsetArrays, JLD2, FileIO # Testing constants test_image = "mandrill" @@ -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 diff --git a/test/test_data/yosemite/flow/yosemite_correct_flow.jld2 b/test/test_data/yosemite/flow/yosemite_correct_flow.jld2 new file mode 100644 index 0000000..6692197 Binary files /dev/null and b/test/test_data/yosemite/flow/yosemite_correct_flow.jld2 differ diff --git a/test/test_data/yosemite/images/img1.tif b/test/test_data/yosemite/images/img1.tif new file mode 100644 index 0000000..43d5055 Binary files /dev/null and b/test/test_data/yosemite/images/img1.tif differ diff --git a/test/test_data/yosemite/images/img2.tif b/test/test_data/yosemite/images/img2.tif new file mode 100644 index 0000000..17b5073 Binary files /dev/null and b/test/test_data/yosemite/images/img2.tif differ