Quantcast
Channel: OpenCV Q&A Forum - RSS feed
Viewing all articles
Browse latest Browse all 2088

does cv2.imwrite support float16 (half)?

$
0
0
import cv2 as cv import random import numpy as np # Reading an existing exr file img = cv.imread('Tree.exr', cv.IMREAD_UNCHANGED) print (img.dtype) \\ this prints float32 img_h = np.float16(img) \\ hoping to typecast float32(float) to float16 (half) print (img_h.dtype) \\ this prints float16 #cv.imwrite('cropped_tree.exr', img) #this works fine write float32 into exr #cv.imwrite('cropped_tree.exr', img, cv.IMWRITE_EXR_TYPE_FLOAT) # this doesn't work, gives: # cv.imwrite('cropped_tree.exr', img, cv.IMWRITE_EXR_TYPE_FLOAT) # SystemError: returned NULL without setting an error cv.imwrite('cropped_tree.exr', img_h, cv.IMWRITE_EXR_TYPE_HALF) # this doesn't work, gives : # cv.imwrite('cropped_tree.exr', img_h, cv.IMWRITE_EXR_TYPE_HALF) # TypeError: img data type = 23 is not supported Python version = 3.6 numpy version = 1.14.5 opencv-python = 3.4.1.15 also tried on other pc with opencv = 3.4.1 the problem seems like opencv doesn't support fp16 even though documentation says so. Also am I using the imwrite function properly?

Viewing all articles
Browse latest Browse all 2088

Trending Articles