Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
Mobile-robotics
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
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
efvega
Mobile-robotics
Commits
666f00c4
Commit
666f00c4
authored
2 years ago
by
josephna
Browse files
Options
Downloads
Patches
Plain Diff
Upload New File - Includes bivariate distribution of Gaussian and skewed t (attempt)
parent
e332373d
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
extraction/bivariate.py
+52
-0
52 additions, 0 deletions
extraction/bivariate.py
with
52 additions
and
0 deletions
extraction/bivariate.py
0 → 100644
+
52
−
0
View file @
666f00c4
import
numpy
as
np
import
matplotlib.pyplot
as
plt
import
argparse
import
math
from
scipy.stats
import
multivariate_t
from
convolution
import
convolution
def
gauss2D
(
shape
=
(
3
,
3
),
sigma
=
0.5
):
"""
2D gaussian mask - should give the same result as MATLAB
'
s
fspecial(
'
gaussian
'
,[shape],[sigma])
"""
m
,
n
=
[(
ss
-
1.
)
/
2.
for
ss
in
shape
]
y
,
x
=
np
.
ogrid
[
-
m
:
m
+
1
,
-
n
:
n
+
1
]
h
=
np
.
exp
(
-
(
x
*
x
+
y
*
y
)
/
(
2.
*
sigma
*
sigma
)
)
/
(
sigma
*
np
.
sqrt
(
2
*
np
.
pi
))
h
[
h
<
np
.
finfo
(
h
.
dtype
).
eps
*
h
.
max
()
]
=
0
sumh
=
h
.
sum
()
if
sumh
!=
0
:
h
/=
sumh
return
h
def
attempt_skewed2D
(
shape
=
(
3
,
3
),
upsilon
=
2
):
"""
2D skewed mask - attempt
"""
m1
,
n1
=
[(
ss
-
1.
)
/
2.
for
ss
in
shape
]
y1
,
x1
=
np
.
mgrid
[
0
:
2
*
m1
+
1
:
1
,
0
:
2
*
n1
+
1
:
1
]
pos
=
np
.
dstack
((
x1
,
y1
))
rv
=
multivariate_t
([
1
*
(
2
*
m1
+
1
)
/
5
,
3
*
(
2
*
n1
+
1
)
/
5
],[[
1
,
0
],
[
0
,
1
]],
df
=
upsilon
)
tile
=
np
.
array
(
rv
.
pdf
(
pos
))
m
,
n
=
[(
ss
-
1.
)
/
2.
for
ss
in
shape
]
y
,
x
=
np
.
ogrid
[
-
m
:
m
+
1
,
-
n
:
n
+
1
]
h
=
tile
h
[
h
<
np
.
finfo
(
h
.
dtype
).
eps
*
h
.
max
()
]
=
0
sumh
=
h
.
sum
()
if
sumh
!=
0
:
h
/=
sumh
return
h
def
gaussian_blur
(
image
,
verbose
=
False
):
kernel
=
gauss2D
((
5
,
5
),
1
)
return
convolution
(
image
,
kernel
,
average
=
False
,
verbose
=
verbose
)
def
skew_blur
(
image
,
verbose
=
False
):
kernel
=
attempt_skewed2D
((
5
,
5
),
1
)
return
convolution
(
image
,
kernel
,
average
=
False
,
verbose
=
verbose
)
if
__name__
==
'
__main__
'
:
ap
=
argparse
.
ArgumentParser
()
ap
.
add_argument
(
"
-i
"
,
"
--image
"
,
required
=
True
,
help
=
"
Path to the image
"
)
args
=
vars
(
ap
.
parse_args
())
\ No newline at end of file
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