def fn(path, img): r = self.pRange.value() if r == '0-max': r = (0, w.levelMax) elif r == 'min-max': r = (w.levelMin, w.levelMax) else: # 'current' r = w.ui.histogram.getLevels() int_img = toUIntArray(img, # cutNegative=self.pCutNegativeValues.value(), cutHigh=~self.pStretchValues.value(), range=r, dtype={'8 bit': np.uint8, '16 bit': np.uint16}[self.pDType.value()]) if isColor(int_img): int_img = cv2.cvtColor(int_img, cv2.COLOR_RGB2BGR) cv2.imwrite(path, transpose(int_img))
def fn(path, img): imwrite(path, transpose(img), dtype=float)