Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
U
uva
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Taddeüs Kroes
uva
Commits
23aeccb1
Commit
23aeccb1
authored
Nov 04, 2011
by
Taddeüs Kroes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
improc ass4: Added 'jet' plot option to gauss.py.
parent
95bc6bd9
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
24 additions
and
4 deletions
+24
-4
improc/ass4/gauss.py
improc/ass4/gauss.py
+24
-4
improc/ass4/report/jet_3.pdf
improc/ass4/report/jet_3.pdf
+0
-0
No files found.
improc/ass4/gauss.py
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
()
...
...
improc/ass4/report/jet_3.pdf
0 → 100644
View file @
23aeccb1
File added
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