Toggle navigation
Toggle navigation
This project
Loading...
Sign in
2020-2-capstone-design1
/
PKH_project
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Snippets
Network
Create a new issue
Builds
Commits
Issue Boards
Authored by
강세희
2020-11-18 13:38:25 +0900
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
86b7efe1909ea2a9530ca51be67acc334c8070ca
86b7efe1
1 parent
5b23f159
sehee:[추가]이미지처리
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
54 additions
and
0 deletions
source/sharp.py
source/sharp.py
0 → 100644
View file @
86b7efe
import
cv2
import
numpy
as
np
from
PIL
import
Image
from
PIL
import
ImageFilter
img
=
cv2
.
imread
(
'Lenna.png'
)
cv2
.
imshow
(
'Original'
,
img
)
output
=
img
"""
#Blur_gaussian
output = cv2.GaussianBlur(img,(5,5),1)
cv2.imshow('BlurGaussian',output)
cv2.imwrite('BlurGaussian.png',output)
"""
"""
#Blur
size = 3
kernel_motion_blur = np.zeros((size,size))
kernel_motion_blur[int((size-1)/2),:] = np.ones(size)
kernel_motion_blur = kernel_motion_blur / size
output = cv2.filter2D(img,-1,kernel_motion_blur)
cv2.imshow('Blur',output)
cv2.imwrite('Blur.png',output)
"""
#Sharpening
kernel_sharpen_1
=
np
.
array
([[
-
1
,
-
1
,
-
1
],[
-
1
,
9
,
-
1
],[
-
1
,
-
1
,
-
1
]])
#kernel_sharpen_2 = np.array([[1,1,1],[1,-7,1],[1,1,1]])
#kernel_sharpen_3 = np.array([[-1,-1,-1,-1,-1],[-1,2,2,2,-1],[-1,2,8,2,-1],[-1,2,2,2,-1],[-1,-1,-1,-1,-1]])/8.0
output_1
=
cv2
.
filter2D
(
output
,
-
1
,
kernel_sharpen_1
)
#output_2 = cv2.filter2D(img,-1,kernel_sharpen_2)
#output_3 = cv2.filter2D(img,-1,kernel_sharpen_3)
cv2
.
imshow
(
'Sharpening'
,
output_1
)
#cv2.imshow('Excessive Sharpening',output_2)
#cv2.imshow('Edge Enhancement',output_3)
cv2
.
imwrite
(
'Sharpening.png'
,
output_1
)
img
=
cv2
.
imread
(
'input2.png'
)
img_yuv
=
cv2
.
cvtColor
(
output_1
,
cv2
.
COLOR_BGR2YUV
)
img_yuv
[:,:,
0
]
=
cv2
.
equalizeHist
(
img_yuv
[:,:,
0
])
img_output
=
cv2
.
cvtColor
(
img_yuv
,
cv2
.
COLOR_YUV2BGR
)
cv2
.
imshow
(
'histogram_equalization'
,
img_output
)
cv2
.
imwrite
(
'histogram_equalization.png'
,
img_output
)
cv2
.
waitKey
()
Please
register
or
login
to post a comment