def paintGL(self): img = CVtypes.cvRetrieveFrame(self.cap) print 'W: %s, H: %s, D: %s, C: %s' % (img[0].width, img[0].height, img[0].depth, img[0].nChannels) glClearColor(0.5, 0.5, 0.5, 0.0) img_bitmap = CVtypes.cvImageAsBitmap(img) glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT ) glRasterPos2i(0,0) glDrawPixels(img[0].width,img[0].height, GL_RGB, GL_UNSIGNED_BYTE, img[0].imageData)
def paintGL(self): img_rgb = CVtypes.cvRetrieveFrame(self.cap) # convert bgr to rgb CVtypes.cvCvtColor(img_rgb, img_rgb, CVtypes.CV_BGR2RGB) CVtypes.cvFlip(img_rgb, None, 1) glClearColor(0.5, 0.5, 0.5, 0.0) glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT ) #glDrawArrays(GL_TRIANGLE_STRIP, 0, 4) glRasterPos2i(0,0) #glDrawPixels(self.img_width,self.img_height, GL_RGBA, GL_UNSIGNED_BYTE, self.image) glDrawPixels(img_rgb[0].width,img_rgb[0].height, GL_RGB, GL_UNSIGNED_BYTE, img_rgb[0].imageData)
def paintGL(self): img_rgb = CVtypes.cvRetrieveFrame(self.cap) # convert bgr to rgb CVtypes.cvCvtColor(img_rgb, img_rgb, CVtypes.CV_BGR2RGB) CVtypes.cvFlip(img_rgb, None, 1) glClearColor(0.5, 0.5, 0.5, 0.0) glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT) #glDrawArrays(GL_TRIANGLE_STRIP, 0, 4) glRasterPos2i(0, 0) #glDrawPixels(self.img_width,self.img_height, GL_RGBA, GL_UNSIGNED_BYTE, self.image) glDrawPixels(img_rgb[0].width, img_rgb[0].height, GL_RGB, GL_UNSIGNED_BYTE, img_rgb[0].imageData)