Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
SemiSmoothNewton.jl
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Stephan Hilb
SemiSmoothNewton.jl
Commits
241d2669
Commit
241d2669
authored
3 years ago
by
Stephan Hilb
Browse files
Options
Downloads
Patches
Plain Diff
save image difference for optflow
parent
ea9ba79d
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
scripts/run_experiments.jl
+8
-0
8 additions, 0 deletions
scripts/run_experiments.jl
src/image.jl
+12
-0
12 additions, 0 deletions
src/image.jl
with
20 additions
and
0 deletions
scripts/run_experiments.jl
+
8
−
0
View file @
241d2669
...
...
@@ -32,6 +32,13 @@ loadimg(x) = Float64.(FileIO.load(x))
saveimg
(
io
,
x
::
Array
{
<:
Gray
})
=
FileIO
.
save
(
io
,
grayclamp
.
(
x
))
saveimg
(
io
,
x
)
=
FileIO
.
save
(
io
,
x
)
function
saveimgdiff
(
io
,
f0
,
f1
)
n
=
2
^
8
# colors
cmap
=
colormap
(
"RdBu"
,
n
)
k
(
v0
,
v1
)
=
cmap
[
clamp
(
ceil
(
Int
,
n
*
((
v1
-
v0
)
/
2
+
0.5
)),
1
,
n
)]
saveimg
(
io
,
k
.
(
f0
,
f1
))
end
# convert image to/from image coordinate system
from_img
(
arr
)
=
permutedims
(
reverse
(
arr
;
dims
=
1
))
to_img
(
arr
)
=
permutedims
(
reverse
(
arr
;
dims
=
2
))
...
...
@@ -1191,6 +1198,7 @@ function optflow(ctx)
u_sampled
=
sample
(
st
.
u
)
saveimg
(
joinpath
(
ctx
.
outdir
,
"f0.png"
),
to_img
(
imgf0
))
saveimg
(
joinpath
(
ctx
.
outdir
,
"f1.png"
),
to_img
(
imgf1
))
saveimgdiff
(
joinpath
(
ctx
.
outdir
,
"g.png"
),
to_img
(
imgf0
),
to_img
(
imgf1
))
saveimg
(
joinpath
(
ctx
.
outdir
,
"output.png"
),
colorflow
(
to_img
(
u_sampled
);
ctx
.
params
.
maxflow
))
imgfw
=
warp_backwards
(
imgf1
,
u_sampled
)
saveimg
(
joinpath
(
ctx
.
outdir
,
"fw.png"
),
to_img
(
imgfw
))
...
...
This diff is collapsed.
Click to expand it.
src/image.jl
+
12
−
0
View file @
241d2669
...
...
@@ -442,3 +442,15 @@ function project_l2_pixel!(u::FeFunction, img)
u
.
data
.=
A
\
b
return
u
end
function
save_csv
(
path
,
img
::
AbstractArray
{
<:
Any
,
2
})
df
=
DataFrame
()
for
ci
in
CartesianIndices
(
img
)
push!
(
df
,
(
x
=
ci
[
1
],
y
=
ci
[
2
],
f_xy
=
img
[
ci
],
))
end
CSV
.
write
(
path
,
df
)
end
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment