JuliaImages / ImageTracking.jl

Other
26 stars 8 forks source link

Adds Lucas-Kanade optical flow algorithm #1

Closed arijitkar98 closed 6 years ago

arijitkar98 commented 6 years ago

@zygmuntszpak For the initial implementation I have used a Coordinate struct type. I am not sure if this is the correct way to go.

Also, I need some help regarding which versions of packages to put in REQUIRE and how to set the build status in README.

I will tests and comments to the code tomorrow.

zygmuntszpak commented 6 years ago

At the the pull-request fails with errors for me

              _
   _       _ _(_)_     |  A fresh approach to technical computing
  (_)     | (_) (_)    |  Documentation: https://docs.julialang.org
   _ _   _| |_  __ _   |  Type "?help" for help.
  | | | | | | |/ _` |  |
  | | |_| | | | (_| |  |  Version 0.6.2 (2017-12-13 18:08 UTC)
 _/ |\__'_|_|_|\__'_|  |  Official http://julialang.org/ release
|__/                   |  x86_64-pc-linux-gnu

julia> Pkg.test("ImageTracking")
INFO: Computing test dependencies for ImageTracking...
INFO: No packages to install, update or remove
INFO: Testing ImageTracking
lucas-kanade: Error During Test
  Got an exception of type MethodError outside of a @test
  MethodError: no method matching getindex(::ColorTypes.Gray{Float64})
  Stacktrace:
   [1] macro expansion at /home/zygmunt/.julia/v0.6/StaticArrays/src/broadcast.jl:173 [inlined]
   [2] _broadcast at /home/zygmunt/.julia/v0.6/StaticArrays/src/broadcast.jl:134 [inlined]
   [3] broadcast_c at /home/zygmunt/.julia/v0.6/StaticArrays/src/broadcast.jl:37 [inlined]
   [4] broadcast at ./broadcast.jl:455 [inlined]
   [5] + at /home/zygmunt/.julia/v0.6/ColorVectorSpace/src/ColorVectorSpace.jl:322 [inlined]
   [6] _rightborder!(::Array{ColorTypes.Gray{Float64},2}, ::Array{ColorTypes.Gray{FixedPointNumbers.Normed{UInt8,8}},2}, ::ImageFiltering.KernelFactors.TriggsSdika{Float64,3,3,9}, ::CartesianIndex{0}, ::UnitRange{Int64}, ::CartesianIndex{1}, ::ColorTypes.Gray{FixedPointNumbers.Normed{UInt8,8}}) at /home/zygmunt/.julia/v0.6/ImageFiltering/src/imfilter.jl:1393
   [7] _imfilter_dim!(::ComputationalResources.CPU1{ImageFiltering.Algorithm.IIR}, ::Array{ColorTypes.Gray{Float64},2}, ::Array{ColorTypes.Gray{FixedPointNumbers.Normed{UInt8,8}},2}, ::ImageFiltering.KernelFactors.TriggsSdika{Float64,3,3,9}, ::CartesianRange{CartesianIndex{0}}, ::Base.OneTo{Int64}, ::CartesianRange{CartesianIndex{1}}, ::ImageFiltering.Fill{ColorTypes.Gray{Float64},0}) at /home/zygmunt/.julia/v0.6/ImageFiltering/src/imfilter.jl:1329
   [8] _imfilter_inplace_tuple! at /home/zygmunt/.julia/v0.6/ImageFiltering/src/imfilter.jl:1272 [inlined]
   [9] imfilter!(::ComputationalResources.CPU1{ImageFiltering.Algorithm.IIR}, ::Array{ColorTypes.Gray{Float64},2}, ::Array{ColorTypes.Gray{FixedPointNumbers.Normed{UInt8,8}},2}, ::Tuple{ImageFiltering.KernelFactors.TriggsSdika{Float64,3,3,9},ImageFiltering.KernelFactors.TriggsSdika{Float64,3,3,9}}, ::ImageFiltering.Fill{ColorTypes.Gray{Float64},0}) at /home/zygmunt/.julia/v0.6/ImageFiltering/src/imfilter.jl:1229
   [10] imfilter_na_separable! at /home/zygmunt/.julia/v0.6/ImageFiltering/src/imfilter.jl:1452 [inlined]
   [11] _imfilter_na! at /home/zygmunt/.julia/v0.6/ImageFiltering/src/imfilter.jl:687 [inlined]
   [12] imfilter!(::ComputationalResources.CPU1{ImageFiltering.Algorithm.IIR}, ::Array{ColorTypes.Gray{Float64},2}, ::Array{ColorTypes.Gray{FixedPointNumbers.Normed{UInt8,8}},2}, ::Tuple{ImageFiltering.KernelFactors.TriggsSdika{Float64,3,3,9},ImageFiltering.KernelFactors.TriggsSdika{Float64,3,3,9}}, ::ImageFiltering.NA{0}) at /home/zygmunt/.julia/v0.6/ImageFiltering/src/imfilter.jl:662
   [13] imfilter!(::Array{ColorTypes.Gray{Float64},2}, ::Array{ColorTypes.Gray{FixedPointNumbers.Normed{UInt8,8}},2}, ::Tuple{ImageFiltering.KernelFactors.TriggsSdika{Float64,3,3,9},ImageFiltering.KernelFactors.TriggsSdika{Float64,3,3,9}}, ::ImageFiltering.NA{0}, ::ImageFiltering.Algorithm.IIR) at /home/zygmunt/.julia/v0.6/ImageFiltering/src/imfilter.jl:612
   [14] gaussian_pyramid(::Array{ColorTypes.Gray{FixedPointNumbers.Normed{UInt8,8}},2}, ::Int64, ::Int64, ::Tuple{ImageFiltering.KernelFactors.TriggsSdika{Float64,3,3,9},ImageFiltering.KernelFactors.TriggsSdika{Float64,3,3,9}}) at /home/zygmunt/.julia/v0.6/Images/src/algorithms.jl:802
   [15] optflow(::Array{ColorTypes.Gray{FixedPointNumbers.Normed{UInt8,8}},2}, ::Array{ColorTypes.Gray{FixedPointNumbers.Normed{UInt8,8}},2}, ::ImageTracking.LK{Int64,Float64,Bool}) at /home/zygmunt/.julia/v0.6/ImageTracking/src/lucas_kanade.jl:53
   [16] optical_flow(::Array{ColorTypes.Gray{FixedPointNumbers.Normed{UInt8,8}},2}, ::Array{ColorTypes.Gray{FixedPointNumbers.Normed{UInt8,8}},2}, ::ImageTracking.LK{Int64,Float64,Bool}) at /home/zygmunt/.julia/v0.6/ImageTracking/src/optical_flow.jl:21
   [17] macro expansion at /home/zygmunt/.julia/v0.6/ImageTracking/test/optical_flow.jl:58 [inlined]
   [18] macro expansion at ./test.jl:860 [inlined]
   [19] anonymous at ./<missing>:?
   [20] include_from_node1(::String) at ./loading.jl:576
   [21] include(::String) at ./sysimg.jl:14
   [22] include_from_node1(::String) at ./loading.jl:576
   [23] include(::String) at ./sysimg.jl:14
   [24] process_options(::Base.JLOptions) at ./client.jl:305
   [25] _start() at ./client.jl:371

However, by looking at Travis it seems that it did actually execute successfully on 0.6 so I'm somewhat confused. Is it building fine for you?

arijitkar98 commented 6 years ago

Yes, it is building at my end. I will incorporate these changes by tonight

codecov[bot] commented 6 years ago

Codecov Report

:exclamation: No coverage uploaded for pull request base (master@272fbf0). Click here to learn what that means. The diff coverage is 97.22%.

Impacted file tree graph

@@            Coverage Diff            @@
##             master       #1   +/-   ##
=========================================
  Coverage          ?   97.22%           
=========================================
  Files             ?        2           
  Lines             ?      108           
  Branches          ?        0           
=========================================
  Hits              ?      105           
  Misses            ?        3           
  Partials          ?        0
Impacted Files Coverage Δ
src/optical_flow.jl 100% <100%> (ø)
src/lucas_kanade.jl 97.16% <97.16%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update 272fbf0...db2295a. Read the comment docs.

arijitkar98 commented 6 years ago

@zygmuntszpak I have added the OffsetArrays capability. This build will fail until the PR #722 in Images.jl gets merged.