Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Cittena
cittena
Commits
6a55aae7
Commit
6a55aae7
authored
Jan 18, 2017
by
Niels-Oliver Walkowski
Browse files
add list like vlines to UnivariatePlot
parent
9ff935dd
Changes
5
Hide whitespace changes
Inline
Side-by-side
README.md
View file @
6a55aae7
...
...
@@ -20,3 +20,22 @@ ToDo
implementieren
[] frame_range aus UnivariatePlot in Frames outsourcen und Folgen in allen
Klassen beseitigen. (wieder rekursives Aufrufproblem in __init__
[] Möglichkeit view instanzen zu picklen (siehe Abschnitt)
[] Visualisierung innerhalb derer die Pixel des Ursprungsbildes entlang der
Achse des zu Grunde liegenden Kontrastwertes sortiert werden
[] helper function zur Umrechnung von Frames in Zeit und umgekehrt (mit Aufruf
von mplayer, Bildbetrachter an der entsprechenden Stell)
[] Sequence Daten (Plot) Clustern mit K-Means statt descriptiv zu evaluieren
[] Mittels Fancy Indexing, die Bereiche in eine View isolieren, die ich für
ein bestimmtes Muster identifiziert habe und dann statistisch beschreiben
Möglichkeiten View instanzen zu picklen
---------------------------------------
bereits ausprobiert, jedoch kan die Frames Instanz
`_frames`
die von der view
Instanz benötigt wird nach dem unpickling nicht aufgerufen werden, so dass
meine Methoden nicht mehr funktionieren. Zur Lösung der Problematik:
<http://stackoverflow.com/questions/3614379/attributeerror-when-unpickling-an-object>
<http://stackoverflow.com/questions/3363281/attributeerror-module-object-has-no-attribute-when-using-cpickle>
itten/movie.py
View file @
6a55aae7
...
...
@@ -2,6 +2,7 @@
# -*- coding: utf-8 -*-
from
pathlib
import
Path
# TODO wie kann ich third-party module nach außen verstecken
import
pickle
# TODO Ist der import aus dem selben Pakte so korrekt?
from
.
import
views
...
...
@@ -74,7 +75,7 @@ class Movie(object):
# compute multivariatee contrast representation
multivariate
=
views
.
MultivariateSequence
(
self
.
_frames
)
multivariate
.
populate
(
ctrst
=
ctrst
,
frm_stp
=
stp
)
multivariate
.
populate
(
ctrst
=
ctrst
,
frm_stp
=
stp
+
2
)
# TODO: pickle instance instead of just deleating it!
...
...
@@ -99,7 +100,7 @@ class Movie(object):
vis
=
visuals
.
UnivariatePlot
(
univariate
)
# summarizing methods of univariate class
summarizations
=
[
'seqmean'
,
'seqmad'
,
'seqvar'
]
# TODO Varianz funktioniert so nicht
summarizations
=
[
'seqmean'
,
'seqmad'
]
# TODO Varianz funktioniert so nicht
for
feature
in
summarizations
:
# compute summarizations for given univariate value
...
...
@@ -127,6 +128,9 @@ class Movie(object):
filename
=
self
.
_frames
.
prefix
+
'univariateplot_'
+
ctrst
+
'_'
+
desc
vis
.
saveplt
(
fname
=
filename
,
title
=
header
)
with
open
(
prefix
[:
-
1
]
+
'_summary.pickle'
,
'wb'
)
as
f
:
pickle
.
dump
(
summary
,
f
)
return
summary
...
...
itten/views.py
View file @
6a55aae7
...
...
@@ -9,6 +9,7 @@ import peakutils
from
.helpers
import
luminance
from
copy
import
deepcopy
from
.
import
contrasts
from
.
import
movie
# subclassing numpy ndarray
# Vorgehen: https://docs.scipy.org/doc/numpy/user/basics.subclassing.html
...
...
itten/visuals.py
View file @
6a55aae7
...
...
@@ -106,8 +106,6 @@ class MultivariatePlot(SequencePlot):
self
.
fig
.
tight_layout
()
self
.
fig
.
set_size_inches
(
self
.
width
,
self
.
height
)
self
.
fig
.
savefig
(
"intest.png"
,
dpi
=
200
)
return
self
.
fig
,
self
.
_ax
...
...
@@ -120,7 +118,7 @@ class UnivariatePlot(SequencePlot):
self
.
_ax
=
plt
.
axes
()
self
.
_ax
,
self
.
_axt
=
self
.
ittenstyle
(
self
.
_ax
,
view
)
def
plot
(
self
,
view
,
mark_gt
=
False
,
mark_lt
=
False
):
def
plot
(
self
,
view
,
mark_gt
=
False
,
mark_lt
=
False
,
mark
=
False
):
# Interpolation mit savitzky_golay funktioniert nicht
# contrast_points = savitzky_golay(np.array(contrast_points), 51, 7)
...
...
@@ -133,11 +131,14 @@ class UnivariatePlot(SequencePlot):
if
mark_gt
:
poss
=
npx
[
view
>
mark_gt
]
for
pos
in
poss
:
self
.
_ax
.
axvline
(
pos
,
color
=
'#
f3f315
'
,
alpha
=
0.3
,
linewidth
=
3
)
el
if
mark_lt
:
poss
=
npx
[
view
>
mark_
g
t
]
self
.
_ax
.
axvline
(
pos
,
color
=
'#
a6e22e
'
,
alpha
=
0.3
,
linewidth
=
3
)
if
mark_lt
:
poss
=
npx
[
view
<
mark_
l
t
]
for
pos
in
poss
:
self
.
_ax
.
axvline
(
pos
,
color
=
'#f3f315'
,
alpha
=
0.3
,
linewidth
=
3
)
self
.
_ax
.
axvline
(
pos
,
color
=
'#f92672'
,
alpha
=
0.3
,
linewidth
=
3
)
if
mark
:
for
pos
in
mark
:
self
.
_ax
.
axvline
(
pos
,
color
=
'#66d9ef'
,
alpha
=
0.3
,
linewidth
=
3
)
self
.
_axt
.
legend
()
...
...
testing/bootstrap.py
View file @
6a55aae7
from
itten.movie
import
Movie
from
itten.views
import
Un
ivariateSequence
from
itten.visuals
import
Un
ivariatePlot
from
itten.views
import
Mult
ivariateSequence
from
itten.visuals
import
Mult
ivariatePlot
movie
=
Movie
(
prefix
=
'
rec
_'
,
folder
=
'../DHd-2017/Data/Frames/
Rec
/'
)
movie
.
_frames
.
start
=
367
movie
.
_frames
.
end
=
784
cont
=
Un
ivariateSequence
(
movie
.
_frames
,)
cont
.
seqmean
(
frm_stp
=
3
,
ctrst
=
'saturation'
)
viz
=
Un
ivariatePlot
(
cont
)
viz
.
plot
(
cont
,
mark
_gt
=
140
)
cont
.
seqper
(
frm_stp
=
3
,
ctrst
=
'saturation'
,
perc
=
50
)
viz
.
plot
(
cont
)
viz
.
saveplt
(
'
Percentile Test
'
)
movie
=
Movie
(
prefix
=
'
wwz
_'
,
folder
=
'../DHd-2017/Data/Frames/
WWZ
/'
)
#
movie._frames.start = 367
#
movie._frames.end =
1000
cont
=
Mult
ivariateSequence
(
movie
.
_frames
,)
cont
.
populate
(
frm_stp
=
1
,
ctrst
=
'saturation'
)
viz
=
Mult
ivariatePlot
(
cont
)
viz
.
plot
(
cont
,
mark
=
[
243
,
1885
,
3430
,
4237
,
4543
]
)
#
cont.seqper(frm_stp=
5
, ctrst='saturation', perc=50)
#
viz.plot(cont)
viz
.
saveplt
(
'
testplot_vline
'
)
# viz = MultivariatePlot()
# fig, ax = viz.plot(cont)
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment