import sys
from PyQt5 import QtCore
from PyQt5.QtWidgets import QApplication, QWidget
import pyqtgraph
import cv2
import numpy as np
if __name__ == '__main__':
app = QApplication(sys.argv)
app.setStyle("fusion")
plot_widget = pyqtgraph.PlotWidget()
plot_widget.show()
plot_item = plot_widget.getPlotItem()
in_image = cv2.imread("D:/Projects/radar_lab_models/radar_lab_models/gui/sample.png")
b_channel, g_channel, r_channel = cv2.split(in_image)
alpha_channel = np.ones(b_channel.shape, dtype=b_channel.dtype) * 128 # creating a dummy alpha channel image.
bgra_image = cv2.merge((b_channel, g_channel, r_channel, alpha_channel))
# background
background_item = pyqtgraph.ImageItem()
background_item.setImage(bgra_image, autoDownsample=True)
background_item.setRect(QtCore.QRectF(-100e3, -100e3, 200e3, 200e3))
plot_widget.addItem(background_item)
sys.exit(app.exec_())