Capturing Image from web cam in Python -


import cv2.cv cv  import numpy np  capture = cv.capturefromcam(0) image = cv.queryframe(capture) #here have iplimage imgarray = np.asarray(image[:,:]) #this way use convert numpy ar 

i using code capture image webcam , want show on canvas,please help.the above code activates web cam without error ,please can either may save iplimage on hard-disk or display on canvas.really urgent.this part of project doing. appreciated

i used code using pygame

import pygame import pygame.camera pygame.locals import * import pygame.image  pygame.init() pygame.camera.init()  camlist = pygame.camera.list_cameras() cam = pygame.camera.camera(camlist[0],(640,480))  if camlist:     cam = pygame.camera.camera(camlist[0],(640,480)) cam.start() image = cam.get_image() 

i used code capture image web cam , same but,it not please me either store image on hard-disk or display on canvas

import cv2 cam = cv2.videocapture(0) winname = "image" cv2.namedwindow(winname, cv2.cv_window_autosize) s, im = cam.read() # captures image cv2.imshow(winname, im) # displays captured image cv2.imwrite("test.bmp",im) # writes image test.bmp disk cv2.waitkey() 

Comments

Popular posts from this blog

javascript - Jquery show_hide, what to add in order to make the page scroll to the bottom of the hidden field once button is clicked -

javascript - Highcharts multi-color line -

javascript - Enter key does not work in search box -