Skip to content
Snippets Groups Projects
Commit 7120ad33 authored by Stephan Hilb's avatar Stephan Hilb
Browse files

refactor and complete optflow examples

parent 217f4e96
No related branches found
No related tags found
No related merge requests found
...@@ -430,6 +430,18 @@ git-tree-sha1 = "a2951c93684551467265e0e32b577914f69532be" ...@@ -430,6 +430,18 @@ git-tree-sha1 = "a2951c93684551467265e0e32b577914f69532be"
uuid = "82e4d734-157c-48bb-816b-45c225c6df19" uuid = "82e4d734-157c-48bb-816b-45c225c6df19"
version = "0.5.9" version = "0.5.9"
[[deps.ImageMagick]]
deps = ["FileIO", "ImageCore", "ImageMagick_jll", "InteractiveUtils"]
git-tree-sha1 = "ca8d917903e7a1126b6583a097c5cb7a0bedeac1"
uuid = "6218d12a-5da1-5696-b52f-db25d2ecc6d1"
version = "1.2.2"
[[deps.ImageMagick_jll]]
deps = ["JpegTurbo_jll", "Libdl", "Libtiff_jll", "Pkg", "Zlib_jll", "libpng_jll"]
git-tree-sha1 = "1c0a2295cca535fabaf2029062912591e9b61987"
uuid = "c73af94c-d91f-53ed-93a7-00f77d67a9d7"
version = "6.9.10-12+3"
[[deps.ImageMorphology]] [[deps.ImageMorphology]]
deps = ["ImageCore", "LinearAlgebra", "Requires", "TiledIteration"] deps = ["ImageCore", "LinearAlgebra", "Requires", "TiledIteration"]
git-tree-sha1 = "5581e18a74a5838bd919294a7138c2663d065238" git-tree-sha1 = "5581e18a74a5838bd919294a7138c2663d065238"
... ...
......
...@@ -5,6 +5,7 @@ Colors = "5ae59095-9a9b-59fe-a467-6f913c188581" ...@@ -5,6 +5,7 @@ Colors = "5ae59095-9a9b-59fe-a467-6f913c188581"
DataFrames = "a93c6f00-e57d-5684-b7b6-d8193f3e46c0" DataFrames = "a93c6f00-e57d-5684-b7b6-d8193f3e46c0"
FileIO = "5789e2e9-d7fb-5bc7-8068-2c6fae9b9549" FileIO = "5789e2e9-d7fb-5bc7-8068-2c6fae9b9549"
ImageIO = "82e4d734-157c-48bb-816b-45c225c6df19" ImageIO = "82e4d734-157c-48bb-816b-45c225c6df19"
ImageMagick = "6218d12a-5da1-5696-b52f-db25d2ecc6d1"
ImageQualityIndexes = "2996bd0c-7a13-11e9-2da2-2f5ce47296a9" ImageQualityIndexes = "2996bd0c-7a13-11e9-2da2-2f5ce47296a9"
OpticalFlowUtils = "ab0dad50-ab19-448c-b796-13553ec8b2d3" OpticalFlowUtils = "ab0dad50-ab19-448c-b796-13553ec8b2d3"
PGFPlotsX = "8314cec4-20b6-5062-9cdb-752b83310925" PGFPlotsX = "8314cec4-20b6-5062-9cdb-752b83310925"
... ...
......
...@@ -5,3 +5,4 @@ const datapath = joinpath(@__DIR__, "..", "data") ...@@ -5,3 +5,4 @@ const datapath = joinpath(@__DIR__, "..", "data")
ctx = Util.Context(datapath) ctx = Util.Context(datapath)
ctx(experiment_pd-comparison, "pd-comparison") ctx(experiment_pd-comparison, "pd-comparison")
ctx(experiment_optflow_middlebury_all, "fem/optflow/middlebury")
This diff is collapsed.
...@@ -76,24 +76,8 @@ end ...@@ -76,24 +76,8 @@ end
Base.show(io, ::MIME"text/latex", x) = print(io, x) Base.show(io, ::MIME"text/latex", x) = print(io, x)
function Base.show(io::IO, ::MIME"text/latex", x::AbstractFloat) function Base.show(io::IO, ::MIME"text/latex", x::Union{Integer,AbstractFloat})
exponent = x == 0. ? 0 : floor(Int, log10(x)) print(io, "\\pgfmathprintnumber{", x ,"}")
if abs(exponent) <= 3
print(io, "\\ensuremath{", x, "}")
else
base = x / 10. ^ exponent
print(io, "\\ensuremath{", base, "\\cdot 10^{", exponent, "}}")
end
end
function Base.show(io::IO, ::MIME"text/latex", x::Integer)
p = log10(x)
pr = round(Int, p)
if x == 10^pr
print(io, "\\ensuremath{10^{", pr, "}}")
else
print(io, "\\ensuremath{", x, "}")
end
end end
end end
...@@ -215,6 +215,11 @@ function integrate(mesh::Mesh, expr; params...) ...@@ -215,6 +215,11 @@ function integrate(mesh::Mesh, expr; params...)
return val return val
end end
"""
bind!(f::FeFunction, cell)
Prepare `f` for local evaluation on `cell` by e.g. `evaluate`.
"""
function bind!(f::FeFunction, cell) function bind!(f::FeFunction, cell)
@boundscheck cell in axes(f.space.dofmap, 3) @boundscheck cell in axes(f.space.dofmap, 3)
gdofs = SArray{Tuple{prod(f.space.size) * ndofs(f.space.element)}}( gdofs = SArray{Tuple{prod(f.space.size) * ndofs(f.space.element)}}(
... ...
......
...@@ -335,15 +335,13 @@ function refine!(hmesh::HMesh, marked_cells::Set; fs...) ...@@ -335,15 +335,13 @@ function refine!(hmesh::HMesh, marked_cells::Set; fs...)
new_f.data[new_gdofs] .= f.data[gdofs] new_f.data[new_gdofs] .= f.data[gdofs]
end end
end end
return new_fs return new_mesh, new_fs
end end
"refine by creating temporary hierarchical mesh on the fly" "refine by creating temporary hierarchical mesh on the fly"
function refine(mesh::Mesh, marked_cells; fs...) function refine(mesh::Mesh, marked_cells; fs...)
hmesh = HMesh(mesh) hmesh = HMesh(mesh)
fs_new = refine!(hmesh, Set(marked_cells); fs...) return refine!(hmesh, Set(marked_cells); fs...)
mesh_new = sub_mesh(hmesh)
return mesh_new, fs_new
end end
function geo_tolocal(A, v) function geo_tolocal(A, v)
... ...
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment