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
eb0b2e17
Commit
eb0b2e17
authored
Dec 29, 2016
by
Niels-Oliver Walkowski
Browse files
turn populate into multiple single functions for UnivariateSequence
parent
92877daa
Changes
2
Hide whitespace changes
Inline
Side-by-side
itten/views.py
View file @
eb0b2e17
...
...
@@ -349,7 +349,7 @@ class UnivariateSequence(View):
return
mean
,
mad
# TODO: Kurve muß unbeding von cuts bereinigt werde und interpolation funktioniert da nicht
def
populate
(
self
,
variant
=
[
'mean'
,
'dev'
],
ctrst
=
'light_dark'
,
def
seqmean
(
self
,
variant
=
[
'mean'
,
'dev'
],
ctrst
=
'light_dark'
,
method
=
'luminance'
,
frm_stp
=
10
,
bins
=
256
):
"""Creates a scatterplot for the dynamic of contrast across movie frames
...
...
@@ -370,7 +370,7 @@ class UnivariateSequence(View):
# self._frames.start = start
# self._frames.end = end
contrast_points
=
np
.
empty
((
0
,
2
),
dtype
=
np
.
uint32
)
contrast_points
=
np
.
empty
((
0
),
dtype
=
np
.
uint32
)
# pwd list sollte in Frames sein und hier nur durchlaufen werden
for
frm_nr
in
range
(
self
.
_frames
.
start
,
self
.
_frames
.
end
,
...
...
@@ -391,13 +391,67 @@ class UnivariateSequence(View):
# TODO Ergebnisse der unterschiedlichen Verfahrenstimmt nicht überein
# contrast = hist_value.mean()
# deviation = hist_value.std()
contrast
,
deviation
=
UnivariateSequence
.
meanmad
(
hist_value
)
contrast
,
_
=
UnivariateSequence
.
meanmad
(
hist_value
)
contrast_points
=
np
.
v
stack
((
contrast_points
,
[
contrast
,
deviation
]
))
contrast_points
=
np
.
h
stack
((
contrast_points
,
contrast
))
contrast_points
=
np
.
asarray
(
contrast_points
,
np
.
uint32
)
shape
=
contrast_points
.
shape
self
.
resize
(
shape
,
refcheck
=
False
)
self
[:,
:]
=
contrast_points
self
[:]
=
contrast_points
contrast_points
=
None
# TODO: Kurve muß unbeding von cuts bereinigt werde und interpolation funktioniert da nicht
def
seqmad
(
self
,
variant
=
[
'mean'
,
'dev'
],
ctrst
=
'light_dark'
,
method
=
'luminance'
,
frm_stp
=
10
,
bins
=
256
):
"""Creates a scatterplot for the dynamic of contrast across movie frames
frm_fld: path to folder with movie images
frm_pref: file nave in fron of the count value
frm_step: take every x frame
channel: channel in the HSV color space
save: save plot also to disk
"""
# set class properties
self
.
_variant
=
variant
self
.
_contrast
=
ctrst
self
.
_method
=
method
self
.
_frame_step
=
frm_stp
self
.
_bins
=
bins
# TODO um start und end in der Methode zu parametrisieren müssen erst
# getters und setters in movie.frames definiert werden
# self._frames.start = start
# self._frames.end = end
contrast_points
=
np
.
empty
((
0
),
dtype
=
np
.
uint32
)
# pwd list sollte in Frames sein und hier nur durchlaufen werden
for
frm_nr
in
range
(
self
.
_frames
.
start
,
self
.
_frames
.
end
,
self
.
_frame_step
):
pwd
=
self
.
_frames
.
folder
+
self
.
_frames
.
prefix
+
str
(
frm_nr
)
+
'.png'
img
=
cv2
.
imread
(
pwd
)
ctrst_cls
=
self
.
_get_ctrst_cls_name
(
self
.
_contrast
)
ctrst_img
=
ctrst_cls
(
img
).
ctrst
hist_value
,
_
=
np
.
histogram
(
ctrst_img
.
flatten
(),
bins
=
self
.
_bins
,
range
=
(
0
,
256
))
hist_value
=
hist_value
.
flatten
()
hist_value
=
hist_value
.
astype
(
np
.
uint32
,
copy
=
False
)
# eigenes mean und devi durch numpy ersetzt
# TODO Ergebnisse der unterschiedlichen Verfahrenstimmt nicht überein
# contrast = hist_value.mean()
# deviation = hist_value.std()
_
,
deviation
=
UnivariateSequence
.
meanmad
(
hist_value
)
contrast_points
=
np
.
hstack
((
contrast_points
,
deviation
))
contrast_points
=
np
.
asarray
(
contrast_points
,
np
.
uint32
)
shape
=
contrast_points
.
shape
self
.
resize
(
shape
,
refcheck
=
False
)
self
[:]
=
contrast_points
contrast_points
=
None
testing/bootstrap.py
View file @
eb0b2e17
from
itten.movie
import
Movie
from
itten.views
import
Mult
ivariateSequence
from
itten.views
import
Un
ivariateSequence
from
itten.visuals
import
MultivariatePlot
movie
=
Movie
(
prefix
=
'rec_'
,
folder
=
'../DHd-2017/Data/Frames/Rec/'
)
cont
=
Mult
ivariateSequence
(
movie
.
_frames
)
cont
.
populate
(
frm_stp
=
50
)
viz
=
MultivariatePlot
()
fig
,
ax
=
viz
.
plot
(
cont
)
cont
=
Un
ivariateSequence
(
movie
.
_frames
)
#
cont.populate(frm_stp=50)
#
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