"""
@File : test.py
@Time : 2020/7/2 13:57
@Author : Dontla
@Email : sxana@qq.com
@Software: PyCharm
"""
import cv2
as cv
import numpy
as np
def test(img
):
return (img
* 0.5).astype
(np
.uint8
)
img
= cv
.imread
('cat300_300.jpg')
img_
= test
(img
)
cv
.imshow
('win1', img
)
cv
.imshow
('win2', img_
)
cv
.waitKey
(0)
在做四舍五入时,np.astype()函数貌似跟np.around()函数是一样的
原图: 代码运行结果:
转载请注明原文地址:https://ipadbbs.8miu.com/read-25827.html