* 주요 데이터 타입 종류
uint8 : cv2.imread() 함수를 통해 읽은 경우
float32 : pytorch tensor를 numpy matrix로 바꾼 경우
* 데이터 타입 확인(Python)
print(image.dtype)
* 데이터 타입 변경 방법
- float32를 uint8로
J = I*255
J = J.astype(np.uint8)
- uint8을 float32로
image = image.astype(np.float32)
image /= 255.
* Reference
https://stackoverflow.com/questions/53235638/how-should-i-convert-a-float32-image-to-an-uint8-image
How should I convert a float32 image to an uint8 image?
I want to convert a float32 image into uint8 image in Python using the openCV library. I used the following code, but I do not know whether it is correct or not. Here I is the float32 image. J = ...
stackoverflow.com
https://stackoverflow.com/questions/57325720/opencv-convert-uint8-image-to-float32-normalized-image
OpenCV - convert uint8 image to float32 normalized image
I'm trying to convert parts of a Keras DarkNet code to try to make the code run faster. Here is the code I'm trying to optimize: model_image_size = (416, 416) import cv2 from PIL import Image fr...
stackoverflow.com
'Libraries & Packages > OpenCV' 카테고리의 다른 글
QObject::moveToThread: Current thread () is not the object's thread (). 에러 (0) | 2023.05.03 |
---|---|
c++에서 이미지 가로,세로 크기 확인 및 크기 변환 (0) | 2023.04.06 |
error: ‘CV_LOAD_IMAGE_COLOR’ was not declared in this scope 에러 해결 방법 (0) | 2023.04.06 |
fatal error: opencv2/opencv.hpp: No such file or directory 에러 해결 (0) | 2023.04.06 |