728x90
import cv2
import numpy as np
source = cv2.imread("data/images/sample.jpg")
scalingFactor = 1/255.0
# Convert unsigned int 8bit to float
source = np.float32(source)
source = source*scalingFactor
print(source)
# Convert back to unsigned int(8bit)
source = source*(1.0/scalingFactor)
source = np.uint8(source)
print(source)
728x90
'OpenCV' 카테고리의 다른 글
OpenCV 2 Video read/write (0) | 2021.04.18 |
---|---|
OpenCV 이미지에 도형 그리기 (0) | 2021.04.15 |
OpenCV 이미지 crop 하기 (1) | 2021.04.15 |
OpenCV 읽고 저장하고 표시하기 (0) | 2021.04.15 |
OpenCV_numpy_array (0) | 2021.04.15 |