Thread: OpenCV woes
hey! not sure should go, try here. using opencv stream images logitech quickcam chat, works ekiga , gstreamer. however, when running following program, attached corrupted image.
if can great!code:import pygame import image pygame.locals import * import sys import opencv #this important capturing/displaying images opencv import highgui camera = highgui.cvcreatecameracapture(0) def get_image(): im = highgui.cvqueryframe(camera) # add line below if need (ubuntu 8.04+) im = opencv.cvgetmat(im) #convert ipl image pil image return opencv.adaptors.ipl2pil(im) fps = 30.0 pygame.init() window = pygame.display.set_mode((640,480)) pygame.display.set_caption("webcam demo") screen = pygame.display.get_surface() while true: events = pygame.event.get() event in events: if event.type == quit or event.type == keydown: sys.exit(0) im = get_image() pg_img = pygame.image.frombuffer(im.tostring(), im.size, im.mode) screen.blit(pg_img, (0,0)) pygame.display.flip() pygame.time.delay(int(1000 * 1.0/fps))
thanks,
sam
and have verified in other applications, can see image correctly, right? isn't firmware/driver issue?
Forum The Ubuntu Forum Community Ubuntu Specialised Support Development & Programming Programming Talk OpenCV woes
Ubuntu
Comments
Post a Comment