Exemple #1
0
    def createSurface(self, interface):
        if self.driver == "v4l":
            # Setup the surface
            interface = int(interface)
            self.surfaces[len(self.surfaces)] = {
                0: v4l.video(self.interfaces[interface][0]),
                1: 0
            }
            i = len(self.surfaces) - 1
            # Setup v4l image
            self.surfaces[i][0].setupImage(self.dimensions[0],
                                           self.dimensions[1],
                                           v4l.VIDEO_PALETTE_YUV420P,
                                           v4l.VIDEO_PALETTE_RGB24)

            # Select the correct interface
            interfaces = self.interfaces[interface]
            self.surfaces[i][0].setChannel(int(interfaces[1]))

            if int(interfaces[1]) != 1:
                self.surfaces[i][0].setFrequency(int(interfaces[2]))

            # Begin queueing frames
            self.surfaces[i][0].preQueueFrames()

            # Return surface number
            return i
        else:
            return False
    def __init__(self, width, height, *args, **kwargs):
	TVWindow.__init__(self, *args, **kwargs)
	self.width = width
	self.height = height
	vid = v4l.video('/dev/video')
	self.vid = vid
	vid.setupImage(self.width, self.height, v4l.VIDEO_PALETTE_YUV422P)
	vid.getChannel(0) # TV
	vid.setChannel(0) # set to TV
	vid.setFrequency(216250)
	vid.setVolume(5)
	vid.startCapture()
Exemple #3
0
 def __init__(self, width, height, *args, **kwargs):
     TVWindow.__init__(self, *args, **kwargs)
     self.width = width
     self.height = height
     vid = v4l.video('/dev/video')
     self.vid = vid
     vid.setupImage(self.width, self.height, v4l.VIDEO_PALETTE_YUV422P)
     vid.getChannel(0)  # TV
     vid.setChannel(0)  # set to TV
     vid.setFrequency(216250)
     vid.setVolume(5)
     vid.startCapture()
Exemple #4
0
    def start(self):
#       print "start"

        tmpPath =  "/dev/" + str(self.ui.cb_video.currentText())
        if tmpPath not in self.deviceDic:
            self.deviceDic[tmpPath] = v4l.video(tmpPath)

        self.device = self.deviceDic[tmpPath]
        self.picture = self.device.getPicture()
        self.capabilities = self.device.getCapabilities()
        self.device.preQueueFrames()
        self.nextFrame = 0
        self.ui.connect(self.ui.timer, qt.SIGNAL("timeout()"), self.ui.cam.getFrame)
        self.ui.timer.start(100)
Exemple #5
0
    def start(self):
        #       print "start"

        tmpPath = "/dev/" + str(self.ui.cb_video.currentText())
        if tmpPath not in self.deviceDic:
            self.deviceDic[tmpPath] = v4l.video(tmpPath)

        self.device = self.deviceDic[tmpPath]
        self.picture = self.device.getPicture()
        self.capabilities = self.device.getCapabilities()
        self.device.preQueueFrames()
        self.nextFrame = 0
        self.ui.connect(self.ui.timer, qt.SIGNAL("timeout()"),
                        self.ui.cam.getFrame)
        self.ui.timer.start(100)
Exemple #6
0
    def capture(self):
        #       print "capture"
        tmpPath = "/dev/" + str(self.ui.cb_video.currentText())
        if tmpPath not in self.deviceDic:
            self.deviceDic[tmpPath] = v4l.video(tmpPath)

        self.device = self.deviceDic[tmpPath]
        self.picture = self.device.getPicture()
        self.capabilities = self.device.getCapabilities()
        self.device.preQueueFrames()

        out = self.device.getImage(self.nextFrame)
        out = self.RGB2BGR(out)
        image = Image.fromstring("RGB", (self.WIDTH, self.HEIGHT), out)
        image.save("image.jpg", "JPEG")
        self.ui.timer.stop()
Exemple #7
0
    def capture(self):
#       print "capture"
        tmpPath =  "/dev/" + str(self.ui.cb_video.currentText())
        if tmpPath not in self.deviceDic:
            self.deviceDic[tmpPath] = v4l.video(tmpPath)


        self.device = self.deviceDic[tmpPath]
        self.picture = self.device.getPicture()
        self.capabilities = self.device.getCapabilities()
        self.device.preQueueFrames()

        out = self.device.getImage(self.nextFrame)
        out = self.RGB2BGR(out)
        image = Image.fromstring("RGB", (self.WIDTH, self.HEIGHT), out)
        image.save("image.jpg", "JPEG")
        self.ui.timer.stop()
Exemple #8
0
    def __init__(self, parent):
        self._init_ctrls(parent)

        self.vid = v4l.video('/dev/video')
        cap = self.vid.getCapabilities()
        print "Device Name: %s" % cap[0]
        print "Type: %d" % cap[1]
        print "Channels: %d" % cap[2]
        print "Audios: %d" % cap[3]
        print "Maximum Width: %d" % cap[4]
        print "Maximum Height: %d" % cap[5]
        print "Minimum Width: %d" % cap[6]
        print "Minimum Height: %d" % cap[7]
        self.vid.setupImage(WIDTH, HEIGHT)
        print self.vid.getChannel(1)  # TV

        self.vid.preQueueFrames()
        self.nextFrame = 0
        self.vid.mute()

        self.im = wxEmptyImage(WIDTH, HEIGHT)
        self.bitmap = wxEmptyBitmap(WIDTH, HEIGHT)
    def __init__(self, parent):
        self._init_ctrls(parent)

	self.vid = v4l.video('/dev/video')
	cap = self.vid.getCapabilities()
	print "Device Name: %s" % cap[0]
	print "Type: %d" % cap[1]
	print "Channels: %d" % cap[2]
	print "Audios: %d" % cap[3]
	print "Maximum Width: %d" % cap[4]
	print "Maximum Height: %d" % cap[5]
	print "Minimum Width: %d" % cap[6]
	print "Minimum Height: %d" % cap[7]
	self.vid.setupImage(WIDTH, HEIGHT)
	print self.vid.getChannel(1) # TV
	 
        self.vid.preQueueFrames()
        self.nextFrame = 0;
        self.vid.mute()
 
        self.im = wxEmptyImage(WIDTH,HEIGHT)
        self.bitmap = wxEmptyBitmap(WIDTH,HEIGHT)  
Exemple #10
0
   def createSurface(self,interface):
      if self.driver == "v4l":
         # Setup the surface
         interface = int(interface);
         self.surfaces[len(self.surfaces)] = {0:v4l.video(self.interfaces[interface][0]),1:0};
         i = len(self.surfaces) - 1;
         # Setup v4l image
         self.surfaces[i][0].setupImage(self.dimensions[0],self.dimensions[1],v4l.VIDEO_PALETTE_YUV420P, v4l.VIDEO_PALETTE_RGB24);

         # Select the correct interface
         interfaces = self.interfaces[interface];
         self.surfaces[i][0].setChannel(int(interfaces[1]));
         
         if int(interfaces[1]) != 1:
            self.surfaces[i][0].setFrequency(int(interfaces[2]));
                     
         # Begin queueing frames
         self.surfaces[i][0].preQueueFrames();
         
         # Return surface number
         return i;
      else:
         return False;
Exemple #11
0
#!/usr/bin/env python
# Sample TV overlay viewing application for pyv4l >= 0.4 - by Michael Dove <*****@*****.**>

import v4l
import time
import os
import sys

WIDTH = 640
HEIGHT = 480
X = 300
Y = 300
vid = v4l.video('/dev/video')

# set appropriate palette else you may get incorrect images
try:
    vid.setupFrameBuffer()
except v4l.VideoError, e:
    print "WARNING:", e, "Attempting to run v4l-conf"
    vid.mute()
    del vid
    pipefd = os.popen('v4l-conf -q -c /dev/video')
    if (pipefd.close()):
        print "Unable to setup framebuffer"
        sys.exit(1)

vid = v4l.video('/dev/video')
cap = vid.getCapabilities()
print "Device Name: %s" % cap[0]
print "Type: %d" % cap[1]
print "Channels: %d" % cap[2]
Exemple #12
0
#!/usr/bin/env python
# Sample still image captured from TV for pyv4l >= 0.3 - by Michael Dove <*****@*****.**>
import v4l
import Image
import ImageChops
WIDTH = 924
HEIGHT = 576
vid = v4l.video('/dev/video')
cap = vid.getCapabilities()
print "Device Name: %s" % cap[0]
print "Type: %d" % cap[1]
print "Channels: %d" % cap[2]
print "Audios: %d" % cap[3]
print "Maximum Width: %d" % cap[4]
print "Maximum Height: %d" % cap[5]
print "Minimum Width: %d" % cap[6]
print "Minimum Height: %d" % cap[7]

tuner = vid.getTuner()
print "Tuner %d" %tuner[0]
print "Tuner Name: %s" %tuner[1]
print "Range Low: %d" %tuner[2]
print "Range High: %d" %tuner[3]
print "Flags: %d" %tuner[4]
print "Mode: %d" %tuner[5]
print "Signal Strength: %d" %tuner[6]
print "Frequency: %d" %vid.getFrequency()
vid.setChannel(0) # TV
vid.setFrequency(216250)
vid.setupImage(WIDTH, HEIGHT)
picture = vid.getPicture()