FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
All-Algorithms-In-Python/classification/tools.py at master · codeme254/All-Algorithms-In-Python · GitHub
codeme254
/
All-Algorithms-In-Python
Public
forked from
AllAlgorithms/python
Notifications
You must be signed in to change notification settings
Fork
1
Star
2
Code
Pull requests
0
Actions
Projects
Security and quality
0
Insights
Additional navigation options
Code
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
All-Algorithms-In-Python
/
classification
/
tools.py
Copy path
More file actions
More file actions
Latest commit
History
History
History
20 lines (18 loc) · 524 Bytes
Breadcrumbs
All-Algorithms-In-Python
/
classification
/
tools.py
Copy path
File metadata and controls
20 lines (18 loc) · 524 Bytes
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
from
matplotlib
.
image
import
imread
import
matplotlib
.
pyplot
as
plt
from
math
import
sqrt
import
math
import
random
import
numpy
import
operator
from
scipy
.
spatial
.
distance
import
cdist
from
scipy
.
linalg
import
norm
import
datetime
def
Histogram
(
path
):
image
=
imread
(
path
)
if
len
(
image
.
shape
)
!=
2
:
def
gray
(
rgb
):
return
numpy
.
dot
(
rgb
[..., :
3
], [
0.2989
,
0.5870
,
0.1140
])
gray
=
gray
(
image
)
image
=
gray
hist
,
bins
=
numpy
.
histogram
(
image
.
ravel
(),
256
, [
0
,
256
])
return
adapt
(
hist
)
Back
|
FazBrowse Home
|
New Git URL