警告:不建议使用QT_DEVICE_PIXEL_RATIO [英] Warning: QT_DEVICE_PIXEL_RATIO is deprecated

查看:2742
本文介绍了警告:不建议使用QT_DEVICE_PIXEL_RATIO的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在与openCV一起使用matplotlib来绘制一些阈值化方法,并抛出以下无输出警告:

I am using matplotlib alongside openCV to plot some thresholding methods and the following warning with no output is thrown:

警告:不推荐使用QT_DEVICE_PIXEL_RATIO.改为使用:
QT_AUTO_SCREEN_SCALE_FACTOR以启用平台插件控制 每个屏幕的因素. QT_SCREEN_SCALE_FACTORS设置每个屏幕 因素. QT_SCALE_FACTOR设置应用程序的全球规模 因素.

Warning: QT_DEVICE_PIXEL_RATIO is deprecated. Instead use:
QT_AUTO_SCREEN_SCALE_FACTOR to enable platform plugin controlled per-screen factors. QT_SCREEN_SCALE_FACTORS to set per-screen factors. QT_SCALE_FACTOR to set the application global scale factor.

我正在使用Ubuntu 19.04

I am using Ubuntu 19.04

import cv2 as cv
from matplotlib import pyplot as plt

img = cv.imread('gradient.jpg', 0)

_, th1 = cv.threshold(img, 50, 255, cv.THRESH_BINARY)
_, th2 = cv.threshold(img, 200, 255, cv.THRESH_BINARY_INV)
_, th3 = cv.threshold(img, 200, 255, cv.THRESH_TRUNC)
_, th4 = cv.threshold(img, 127, 255, cv.THRESH_TOZERO)
_, th5 = cv.threshold(img, 127, 255, cv.THRESH_TOZERO_INV)

titles = ['Original Image', 'BINARY', 'BINARY_INV', 'TRUNC', 'TOZERO', 'TOZERO_INV']
images = [img, th1, th2, th3, th4, th5]

for i in range(6):
    plt.subplot(2, 3, i + 1), plt.imshow(images[i], 'gray')
    plt.title(titles[i])
    plt.xticks([]), plt.yticks([])

推荐答案

在此解决方案中同样适用!

Came across this solution!

    export QT_DEVICE_PIXEL_RATIO=0
    export QT_AUTO_SCREEN_SCALE_FACTOR=1
    export QT_SCREEN_SCALE_FACTORS=1
    export QT_SCALE_FACTOR=1

这篇关于警告:不建议使用QT_DEVICE_PIXEL_RATIO的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆