pyqtgraph中在使用Qspliter时崩溃

def render(self):
    # Convert data to QImage for display.
    
    profile = debug.Profiler()
    if self.image is None or self.image.size == 0:
        return
    if isinstance(self.lut, collections.Callable):
        lut = self.lut(self.image)
    else:
        lut = self.lut

    if self.autoDownsample:
        # reduce dimensions of image based on screen resolution
        o = self.mapToDevice(QtCore.QPointF(0,0))
        x = self.mapToDevice(QtCore.QPointF(1,0))
        y = self.mapToDevice(QtCore.QPointF(0,1))
        w = Point(x-o).length()
        h = Point(y-o).length()
        if w == 0 or h == 0:
            self.qimage = None
            return
        xds = max(1, int(1.0 / w))
        yds = max(1, int(1.0 / h))
        axes = [1, 0] if self.axisOrder == 'row-major' else [0, 1]
        image = fn.downsample(self.image, xds, axis=axes[0])
        image = fn.downsample(image, yds, axis=axes[1])
        self._lastDownsample = (xds, yds)
    else:
        image = self.image

原因mapToDevice返回None,但是在ImageItem模块中并未做处理,需修改一下,在x,o,y为None时返回return即可

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值