from PyQt5.QtWidgets import *
from PyQt5 import QtWidgets, QtGui
from PIL import Image, ImageQt
import cv2 as cv
img = cv.imread('1.1 cat.jpeg.jpeg')
im = Image.fromarray(img)
im.save('file.png')
con = lite.connect('Final_Avirs.db')
cur = con.cursor()
def createtb():
queryveh = """CREATE TABLE IF NOT EXISTS VehicleTB(Scan_DI INTEGER PRIMARY KEY NOT NULL UNIQUE,
Vehicle_number TEXT NOT NULL, Vehicle_type TEXT NOT NULL, Cam_loc TEXT NOT NULL, Date_Time TEXT NOT NULL,
Vehicle_number_pic BLOB NOT NULL) """
cur.execute(queryveh)
con.commit()
def vehicledetailsquery(vn, vt, cl, dt, vnp):
scan_id = vn + "1"
query = " INSERT INTO 'VehicleTB' ( Vehicle_number, Vehicle_type, Cam_loc, " \
"Date_Time, Vehicle_number_pic ) VALUES( ?, ?, ?, ?, ?)"
cur.execute(query, (vn, vt, cl, dt, vnp))
con.commit()
img = Image.open('file.png')
createtb()
vehicledetailsquery('aswe23','2039230', 'cam-2', '23343', img )
app = QtWidgets.QApplication([])
def vehicletbquery():
query = "SELECT * from VehicleTB"
vehicletb = cur.execute(query).fetchall()
return vehicletb
data = vehicletbquery()
ww = QtWidgets.QLabel()
for i, d in enumerate(data):
if i == 6:
ww.w.setPixmap(QtGui.QPixmap.fromImage(d))
ww.show()
app.exec()
我知道问题出在我的图像值上,但我不知道如何处理它,我能做的最好的是将枕头图像转换为字符串,然后这样做,我可以在 PYQT 标签上显示图像,标签只是出来是空的。
喵喵时光机
相关分类