Welcome to HBH! If you have tried to register and didn't get a verification email, please using the following link to resend the verification email.

Predator Vision (work in progress) - Python Code Bank


Predator Vision (work in progress)
My friend is making me a custom Predator mask, it will house video glasses and a webcam. This is the first progress of motion tracking as seen in the movies. Note: THIS IS NOT THERMAL NOR INFRARED VISION. Video found here: http://www.youtube.com/watch?v=DRKn0ECdsS0
                #load what we need
from VideoCapture import Device
import pygame, Image, sys, ImageChops, time
from pygame.locals import *

#grab handle
cam = Device()

#find out the resolution
res = cam.getImage()
res = res.size

#initiate pygame
pygame.init()
screen = pygame.display.set_mode(res)
pygame.display.set_caption("Predator Vision: by Tech B")

while 1:
    #check for quit
    for event in pygame.event.get():
        if event.type == pygame.QUIT: sys.exit()

    #grab two images
    im1 = cam.getImage()
    #you will need to wait a sec before taking another image
    #if not, the screen will remain black and buggy
    time.sleep(.2)
    im2 = cam.getImage()

    #im2-im1 per pixel
    diff = ImageChops.difference(im1,im2)
    
    #convert image to pygame type and then display
    shot = pygame.image.frombuffer(diff.tostring(), res, "RGB")
    screen.blit(shot,(0,0))
    pygame.display.flip()


            
Comments
Sorry but there are no comments to display