我需要在qt designer中创建的窗体上放置一个显示实时视频捕获的openCV窗口。我可以显示带有视频提要的窗口,但无法将窗口附加到窗体。我在这里尝试了一些其他资源,但没有效果。我真的被困住了,所以任何帮助都将不胜感激
我尝试将cv窗口放入QLabel中,但它不会显示任何内容。我也试过一个容器和一些其他类似的面板,但没有成功。我正在使用PyPylon Basler库来制作相机,我被它卡住了
def showVideo(exit):
Camera.camera.StartGrabbing(pylon.GrabStrategy_LatestImageOnly)
converter = pylon.ImageFormatConverter()
# converting to opencv bgr format
converter.OutputPixelFormat = pylon.PixelType_BGR8packed
converter.OutputBitAlignment = pylon.OutputBitAlignment_MsbAligned
try:
while exit:
grabResult = Camera.camera.RetrieveResult(5000, pylon.TimeoutHandling_ThrowException)
if grabResult.GrabSucceeded():
# Access the image data
image = converter.Convert(grabResult)
img = image.GetArray()
win = "main"
cv2.moveWindow(win, 350,140)
cv2.resizeWindow(win, 451,581)
cv2.imshow(win, img)
k = cv2.waitKey(1)
except:
pass
理想的解决方案是简单地让cv窗口相对于窗体移动,并在窗体关闭时关闭
目前没有回答
相关问题 更多 >
编程相关推荐