Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
I
Informatik 3 Afg 2
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
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
Niklas Bretz
Informatik 3 Afg 2
Commits
21ad18a2
Commit
21ad18a2
authored
2 years ago
by
niklasBr
Browse files
Options
Downloads
Patches
Plain Diff
Changed names of methods in KernelFactory.py and Image.py to snake case
parent
4bbfd259
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
Image.py
+1
-1
1 addition, 1 deletion
Image.py
KernelFactory.py
+3
-3
3 additions, 3 deletions
KernelFactory.py
main.py
+7
-7
7 additions, 7 deletions
main.py
with
11 additions
and
11 deletions
Image.py
+
1
−
1
View file @
21ad18a2
...
...
@@ -15,7 +15,7 @@ class Image:
self
.
pixels
=
pixels
@icontract.require
(
lambda
filename
:
filename
.
endswith
(
Image
.
PGM_FILE_EXTENSION
),
"
provided filename should be in .pgm format
"
)
def
read
F
rom
F
ile
(
self
,
filename
):
def
read
_f
rom
_f
ile
(
self
,
filename
):
file
=
open
(
filename
,
"
r
"
)
content
=
file
.
readlines
()
content
=
Image
.
remove_comments
(
content
)
...
...
This diff is collapsed.
Click to expand it.
KernelFactory.py
+
3
−
3
View file @
21ad18a2
...
...
@@ -4,17 +4,17 @@ import icontract
class
KernelFactory
:
@staticmethod
def
create
V
ertical
P
rewitt
K
ernel
():
def
create
_v
ertical
_p
rewitt
_k
ernel
():
return
[
-
1
,
-
1
,
-
1
,
0
,
0
,
0
,
1
,
1
,
1
]
@staticmethod
def
create
H
orizontal
P
rewitt
K
ernel
():
def
create
_h
orizontal
_p
rewitt
_k
ernel
():
return
[
-
1
,
0
,
1
,
-
1
,
0
,
1
,
-
1
,
0
,
1
]
@staticmethod
@icontract.require
(
lambda
radius
:
isinstance
(
radius
,
int
)
is
True
,
f
"
wrong datatype for radius provided
"
)
def
create
BoxF
ilter
(
radius
):
def
create
_box_f
ilter
(
radius
):
dimension
=
((
2
*
radius
)
+
1
)
**
2
return
[
1
/
dimension
for
_
in
range
(
dimension
)]
This diff is collapsed.
Click to expand it.
main.py
+
7
−
7
View file @
21ad18a2
...
...
@@ -7,14 +7,14 @@ from ClampingBorderBehavior import ClampingPaddingBorderBehavior
def
aufgabe1
():
d
=
Image
()
d
.
read
F
rom
F
ile
(
"
Bild1.pgm
"
)
d
.
read
_f
rom
_f
ile
(
"
Bild1.pgm
"
)
zero_p_bb
=
ZeroPaddingBorderBehavior
()
clamping_p_bb
=
ClampingPaddingBorderBehavior
()
horizontal_pk
=
Kernel
(
KernelFactory
().
create
H
orizontal
P
rewitt
K
ernel
())
vertical_pk
=
Kernel
(
KernelFactory
().
create
V
ertical
P
rewitt
K
ernel
())
horizontal_pk
=
Kernel
(
KernelFactory
().
create
_h
orizontal
_p
rewitt
_k
ernel
())
vertical_pk
=
Kernel
(
KernelFactory
().
create
_v
ertical
_p
rewitt
_k
ernel
())
d
.
convolve
(
horizontal_pk
,
zero_p_bb
,
"
./images/Ergebnis1-horizontal(zero-padding).pgm
"
)
d
.
convolve
(
horizontal_pk
,
clamping_p_bb
,
"
./images/Ergebnis1-horizontal(clamping-padding).pgm
"
)
...
...
@@ -27,10 +27,10 @@ def aufgabe2():
clamping_p_bb
=
ClampingPaddingBorderBehavior
()
e
=
Image
()
e
.
read
F
rom
F
ile
(
"
Bild2.pgm
"
)
boxfilter_3
=
Kernel
(
KernelFactory
().
create
BoxF
ilter
(
1
))
boxfilter_11
=
Kernel
(
KernelFactory
().
create
BoxF
ilter
(
5
))
boxfilter_27
=
Kernel
(
KernelFactory
().
create
BoxF
ilter
(
13
))
e
.
read
_f
rom
_f
ile
(
"
Bild2.pgm
"
)
boxfilter_3
=
Kernel
(
KernelFactory
().
create
_box_f
ilter
(
1
))
boxfilter_11
=
Kernel
(
KernelFactory
().
create
_box_f
ilter
(
5
))
boxfilter_27
=
Kernel
(
KernelFactory
().
create
_box_f
ilter
(
13
))
e
.
convolve
(
boxfilter_3
,
zero_p_bb
,
"
./images/Ergebnis2-3(zero-bb).pgm
"
)
e
.
convolve
(
boxfilter_3
,
clamping_p_bb
,
"
./images/Ergebnis2-3(clamping_p_bb).pgm
"
)
e
.
convolve
(
boxfilter_11
,
clamping_p_bb
,
"
./images/Ergebnis2-11.pgm
"
)
...
...
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