def stop(self):
self.timer_camera.stop() # 关闭定时器
self.cap.release() # 释放视频流
self.label_ori_video.clear() # 清空视频显示区域
self.label_treated.clear() # 清空视频显示区域
app = QtWidgets.QApplication()
window = MWindow()
window.show()
app.exec()
if __name__=="__main__":
app = QtWidgets.QApplication.instance() # Check if QApplication instance already exists
if app is None:
app = QtWidgets.QApplication([])
else:
print("QApplication instance already exists. Reusing it.")
window = MWindow()
window.show()
app.exec_() # Start the application event loop