Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
U
uva
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
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
Taddeüs Kroes
uva
Commits
23aeccb1
Commit
23aeccb1
authored
13 years ago
by
Taddeüs Kroes
Browse files
Options
Downloads
Patches
Plain Diff
improc ass4: Added 'jet' plot option to gauss.py.
parent
95bc6bd9
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
improc/ass4/gauss.py
+24
-4
24 additions, 4 deletions
improc/ass4/gauss.py
improc/ass4/report/jet_3.pdf
+0
-0
0 additions, 0 deletions
improc/ass4/report/jet_3.pdf
with
24 additions
and
4 deletions
improc/ass4/gauss.py
+
24
−
4
View file @
23aeccb1
...
@@ -77,7 +77,7 @@ def plot_kernel(W, ax):
...
@@ -77,7 +77,7 @@ def plot_kernel(W, ax):
def
exit_with_usage
():
def
exit_with_usage
():
"""
Print an error message with the program
'
s usage and exit the program.
"""
"""
Print an error message with the program
'
s usage and exit the program.
"""
print
'
Usage: python %s ( 2d SCALE | 1d SCALE IORDER JORDER
'
\
print
'
Usage: python %s ( 2d SCALE | 1d SCALE IORDER JORDER
'
\
'
| timer METHOD [ REPEAT ] )
'
%
argv
[
0
]
'
| timer METHOD [ REPEAT ]
| jet SCALE
)
'
%
argv
[
0
]
exit
(
1
)
exit
(
1
)
if
__name__
==
'
__main__
'
:
if
__name__
==
'
__main__
'
:
...
@@ -87,7 +87,7 @@ if __name__ == '__main__':
...
@@ -87,7 +87,7 @@ if __name__ == '__main__':
F
=
imread
(
'
cameraman.png
'
)
F
=
imread
(
'
cameraman.png
'
)
if
argv
[
1
]
==
'
2d
'
:
if
argv
[
1
]
==
'
2d
'
:
#
Calculate and plot the convolution of the given scale
"""
Calculate and plot the convolution of the given scale
.
"""
if
len
(
argv
)
<
3
:
if
len
(
argv
)
<
3
:
exit_with_usage
()
exit_with_usage
()
...
@@ -102,11 +102,11 @@ if __name__ == '__main__':
...
@@ -102,11 +102,11 @@ if __name__ == '__main__':
subplot
(
133
)
subplot
(
133
)
imshow
(
G
,
cmap
=
'
gray
'
)
imshow
(
G
,
cmap
=
'
gray
'
)
elif
argv
[
1
]
==
'
1d
'
:
elif
argv
[
1
]
==
'
1d
'
:
"""
Calculate the gaussian kernel using derivatives of the specified
order in both directions.
"""
if
len
(
argv
)
<
5
:
if
len
(
argv
)
<
5
:
exit_with_usage
()
exit_with_usage
()
# Calculate the gaussian kernel using derivatives of the specified
# order in both directions
s
=
float
(
argv
[
2
])
s
=
float
(
argv
[
2
])
iorder
=
int
(
argv
[
3
])
iorder
=
int
(
argv
[
3
])
jorder
=
int
(
argv
[
4
])
jorder
=
int
(
argv
[
4
])
...
@@ -125,6 +125,7 @@ if __name__ == '__main__':
...
@@ -125,6 +125,7 @@ if __name__ == '__main__':
subplot
(
133
)
subplot
(
133
)
imshow
(
G
,
cmap
=
'
gray
'
)
imshow
(
G
,
cmap
=
'
gray
'
)
elif
argv
[
1
]
==
'
timer
'
:
elif
argv
[
1
]
==
'
timer
'
:
"""
Time the performance of a 1D/2D convolution and plot the results.
"""
if
len
(
argv
)
<
3
:
if
len
(
argv
)
<
3
:
exit_with_usage
()
exit_with_usage
()
...
@@ -157,6 +158,25 @@ if __name__ == '__main__':
...
@@ -157,6 +158,25 @@ if __name__ == '__main__':
xlabel
(
'
s
'
)
xlabel
(
'
s
'
)
ylabel
(
'
time (s)
'
)
ylabel
(
'
time (s)
'
)
plot
(
S
,
times
,
'
o-
'
)
plot
(
S
,
times
,
'
o-
'
)
elif
argv
[
1
]
==
'
jet
'
:
"""
Show a 2d jet Gaussian plot of the image.
"""
if
len
(
argv
)
<
3
:
exit_with_usage
()
s
=
float
(
argv
[
2
])
subplot
(
331
)
imshow
(
gD
(
F
,
s
,
0
,
0
),
cmap
=
'
gray
'
)
subplot
(
334
)
imshow
(
gD
(
F
,
s
,
1
,
0
),
cmap
=
'
gray
'
)
subplot
(
335
)
imshow
(
gD
(
F
,
s
,
0
,
1
),
cmap
=
'
gray
'
)
subplot
(
337
)
imshow
(
gD
(
F
,
s
,
2
,
0
),
cmap
=
'
gray
'
)
subplot
(
338
)
imshow
(
gD
(
F
,
s
,
1
,
1
),
cmap
=
'
gray
'
)
subplot
(
339
)
imshow
(
gD
(
F
,
s
,
0
,
2
),
cmap
=
'
gray
'
)
else
:
else
:
exit_with_usage
()
exit_with_usage
()
...
...
This diff is collapsed.
Click to expand it.
improc/ass4/report/jet_3.pdf
0 → 100644
+
0
−
0
View file @
23aeccb1
File added
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