display cv2.VideoCapture image inside Pygame surface

我的梦境 提交于 2019-12-03 14:58:37

No the color error lies in here

frame=cv2.cvtColor(frame,cv2.COLOR_BGR2GRAY)

so for normal screen color u simply change that to

frame=cv2.cvtColor(frame,cv2.COLOR_BGR2RGB)

That will do because it works for me

Juan

I tried your code, but I'm only getting a picture not a movie, so i copied

frame=getCamFrame(color,camera)
screen=blitCamFrame(frame,screen)
pygame.display.flip()

into a while loop, it worked but then the video was flipped, to fix it i added cv2.flip(frame,1,frame) # mirror the image before frame=numpy.rot90(frame) in getcamFrame function and now everything works fine.

Sorry for the poor English.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!