def exportCV2(self):
'''
Use cv2.imwrite() to save the image array
'''
w = self.display.widget
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, int_img)
return self._export(fn)
评论列表
文章目录