SaveToFile.py 文件源码

python
阅读 25 收藏 0 点赞 0 评论 0

项目:dataArtist 作者: radjkarl 项目源码 文件源码
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)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号