Toggle navigation
Toggle navigation
This project
Loading...
Sign in
문채연
/
OSS_termproject
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Graphs
Issues
0
Network
Create a new issue
Commits
Issue Boards
Authored by
MoonChaeyeon
2020-06-21 18:20:57 +0900
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
faeada9f0bc4e83dfa44d8821e59fe70f28d8eac
faeada9f
1 parent
d9dff2fa
convert color image to grayscale image
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
0 deletions
color_to_grayscale.py
color_to_grayscale.py
0 → 100644
View file @
faeada9
import
cv2
import
os
import
numpy
as
np
from
PIL
import
Image
path
=
'C:
\\
Users
\\
sso07
\\
Desktop
\\
OSS term project
\\
frozen_character_grayscale
\\
겨울왕국 브루니'
imagePaths
=
[
os
.
path
.
join
(
path
,
file_name
)
for
file_name
in
os
.
listdir
(
path
)]
count
=
0
for
imagePath
in
imagePaths
:
count
+=
1
img
=
Image
.
open
(
imagePath
)
.
convert
(
'L'
)
img_numpy
=
np
.
array
(
img
,
'uint8'
)
cv2
.
imwrite
(
"C:
\\
Users
\\
sso07
\\
Desktop
\\
OSS term project
\\
frozen_character_grayscale
\\
흑백 브루니
\\
사진겨울왕국브루니"
+
str
(
count
)
+
".jpg"
,
img_numpy
)
print
(
"All Done"
)
Please
register
or
login
to post a comment