软件开发时采用了两种获取图像的方式,最后都是得到八位彩图,但喂入深度学习模型,结果出现一点偏差,值得注意!
方式一:
image = cv2.imdecode(np.fromfile(self.mainWin.show2.fileName, dtype=np.uint16), -1)
if image.dtype == 'uint16':
image = image / 65535 * 255
image = image.astype(np.uint8)
if len(image.shape) == 2:
image = cv2.cvtColor(image, cv2.COLOR_GRAY2BGR)
方式二:
image = cv2.imdecode(np.fromfile(self.mainWin.show2.fileName, dtype=np.uint8), 1)