Beispiel #1
0
def main():
    vp = VideoPlayer('resources/video/field1/WideWide - Clip 001.mp4')
    frames = vp.extract_frames()

    #for frame in frames:
    hsv = cv2.cvtColor(frames[13], cv2.COLOR_BGR2HSV)
    if colors:
        cv2.putText(hsv, str(colors[-1]), (10, 50), cv2.FONT_HERSHEY_PLAIN, 2,
                    (0, 0, 0), 2)
    cv2.imshow('frame', hsv)
    cv2.setMouseCallback('frame', on_mouse_click, hsv)

    cv2.waitKey()

    cv2.destroyAllWindows()

    # avgb = int(sum(c[0] for c in colors) / len(colors))
    # avgg = int(sum(c[0] for c in colors) / len(colors))
    # avgr = int(sum(c[0] for c in colors) / len(colors))
    # print avgb, avgg, avgr

    minb = min(c[0] for c in colors)
    ming = min(c[1] for c in colors)
    minr = min(c[2] for c in colors)
    maxb = max(c[0] for c in colors)
    maxg = max(c[1] for c in colors)
    maxr = max(c[2] for c in colors)
    print(minr, ming, minb, maxr, maxg, maxb)

    lb = [minb, ming, minr]
    ub = [maxb, maxg, maxr]
    print(lb, ub)
Beispiel #2
0
 def watch(self):
     '''Plays a video after the download'''
     file = QFileDialog.getOpenFileName(self, "Open", self.output,
                                        "mp4 file (*.mp4)")
     file_name = file[0]
     newWidget = VideoPlayer(file_name)
     self.ui.sw_player.addWidget(newWidget)
     self.ui.sw_player.setCurrentWidget(newWidget)
Beispiel #3
0
 def __init__(self, parent=None):
     super().__init__(parent)
     self.timer = QtCore.QTimer()
     self.timer.timeout.connect(self.nextFrame)
     self.image = QImage()
     self.video = VideoPlayer()
     self.frame_counter = 0
     self.parent = parent
     self.status = self.STATUS_NOT_LOADED
     self.play_speed = 1.0
     self.updateRate = 24
Beispiel #4
0
 def testVideoPlayerLayer(self):
   config = Config.load(Version.appName() + ".ini", setAsDefault = True)
   self.e = GameEngine(config)
   winWidth, winHeight = (self.e.view.geometry[2], self.e.view.geometry[3])
   vidPlayer = VideoPlayer(framerate, self.src, (winWidth, winHeight),
                           loop = False)
   self.e.view.pushLayer(vidPlayer)
   while not vidPlayer.finished:
     self.e.run()
   self.e.view.popLayer(vidPlayer)
   self.e.audio.close()
   self.e.quit()
Beispiel #5
0
    def loadVideo(self,
                  libraryName,
                  songName,
                  songVideo=None,
                  songVideoStartTime=None,
                  songVideoEndTime=None):
        if not videoAvailable:
            raise NameError('Video (gstreamer) is not available!')
        self.vidSource = None
        if self.songStage == 1:
            songAbsPath = os.path.join(libraryName, songName)
            if songVideo is not None and \
                   os.path.isfile(os.path.join(songAbsPath, songVideo)):
                self.vidSource = os.path.join(songAbsPath, songVideo)
            elif os.path.exists(os.path.join(songAbsPath, "default.avi")):
                Log.warn("Video not found: %s" % \
                         os.path.join(songAbsPath, songVideo))
                self.vidSource = os.path.join(songAbsPath, "default.avi")
        if self.vidSource is None:
            if self.songStage == 1:
                Log.warn("Video not found: %s" % \
                         os.path.join(songAbsPath, "default.avi"))
            songVideoStartTime = None
            songVideoEndTime = None
            self.vidSource = os.path.join(self.pathfull, "default.avi")

        if not os.path.exists(self.vidSource):
            Log.warn("Video not found: %s" % \
                     os.path.join(self.pathfull, "default.avi"))
            Log.warn(
                "No video found, fallbacking to default static image mode for now"
            )
            self.mode = 1  # Fallback
            self.vidSource = None
            return

        winWidth, winHeight = (self.engine.view.geometry[2],
                               self.engine.view.geometry[3])
        Log.debug("Attempting to load video: %s" % self.vidSource)
        try:  # Catches invalid video files or unsupported formats
            Log.debug("Attempting to load video: %s" % self.vidSource)
            self.vidPlayer = VideoPlayer(-1,
                                         self.vidSource, (winWidth, winHeight),
                                         mute=True,
                                         loop=True,
                                         startTime=songVideoStartTime,
                                         endTime=songVideoEndTime)
            self.engine.view.pushLayer(self.vidPlayer)
            self.vidPlayer.paused = True
        except:
            self.mode = 1
            Log.warn("Failed to load video, fallback to default stage mode.")
Beispiel #6
0
  def testVideoPlayerSlaveShowOff(self):
    winWidth, winHeight = 500, 500
    pygame.init()
    flags = DOUBLEBUF|OPENGL|HWPALETTE|HWSURFACE
    pygame.display.set_mode((winWidth, winHeight), flags)
    vidPlayer = VideoPlayer(-1, self.src, (winWidth, winHeight))
    glViewport(0, 0, winWidth, winHeight) # Both required as...
    glScissor(0, 0, winWidth, winHeight)  # ...GameEngine changes it
    glClearColor(0, 0, 0, 1.)
    x, y = 0.0, 1.0
    fx, fy, ftheta = 1, 1, 1
    theta = 0.0
    time = 0.0
    clock = pygame.time.Clock()
    while not vidPlayer.finished:
      vidPlayer.run()
      vidPlayer.textureUpdate()
      # Save and clear both transformation matrices
      glMatrixMode(GL_PROJECTION)
      glPushMatrix()
      glLoadIdentity()
      glMatrixMode(GL_MODELVIEW)
      glPushMatrix()
      glLoadIdentity()

      glClear(GL_COLOR_BUFFER_BIT)
      glColor3f(1., 1., 1.)
      glBindTexture(GL_TEXTURE_2D, vidPlayer.videoTex)
      glTranslatef(x, y, 0)
      glRotatef(theta, 0, 0, 1.)
      glScalef(.5, .5, 1.)
      glCallList(vidPlayer.videoList)

      # Restore both transformation matrices
      glPopMatrix()
      glMatrixMode(GL_PROJECTION)
      glPopMatrix()

      pygame.display.flip()

      x = (x + fx*time)
      y = (y + fy*time)
      theta = theta + ftheta
      if x > 1.0 or x < -1.0:
        fx = fx * -1
      if y > 1.0 or y < -1.0:
        fy = fy * -1
      if theta > 90 or theta < -90:
        ftheta = ftheta * -1
      time = time + 0.00001
      clock.tick(60)
    pygame.quit()
def main_routine():
    vp = VideoPlayer()
    while True:
        mag_switch = GPIO.input(23)
        if mag_switch:
            if not vp.video_is_playing:
                GPIO.output(24, 0)
                check_for_current()
                global current_video
                vp.set_video(UPLOAD_FOLDER + current_video)
                vp.play_video()
        else:
            GPIO.output(24, 1)
            vp.stop_video()
Beispiel #8
0
 def testVideoPlayerSlave(self):
     winWidth, winHeight = 800, 600
     pygame.init()
     flags = DOUBLEBUF | OPENGL | HWPALETTE | HWSURFACE
     pygame.display.set_mode((winWidth, winHeight), flags)
     vidPlayer = VideoPlayer(self.e, framerate, self.src,
                             (winWidth, winHeight))
     glViewport(0, 0, winWidth,
                winHeight)  # Required as GameEngine changes it
     font = self.e.data.font
     while not vidPlayer.finished:
         vidPlayer.run()
         vidPlayer.render()
         pygame.display.flip()
Beispiel #9
0
 def testVideoPlayerSlave(self):
   winWidth, winHeight = 800, 600
   pygame.init()
   flags = DOUBLEBUF|OPENGL|HWPALETTE|HWSURFACE
   pygame.display.set_mode((winWidth, winHeight), flags)
   vidPlayer = VideoPlayer(framerate, self.src, (winWidth, winHeight))
   glViewport(0, 0, winWidth, winHeight) # Both required as...
   glScissor(0, 0, winWidth, winHeight)  # ...GameEngine changes it
   glClearColor(0, 0, 0, 1.)
   while not vidPlayer.finished:
     vidPlayer.run()
     vidPlayer.render()
     pygame.display.flip()
   pygame.quit()
Beispiel #10
0
 def testVideoPlayerLayer(self):
     config = Config.load(Version.PROGRAM_UNIXSTYLE_NAME + ".ini",
                          setAsDefault=True)
     self.e = GameEngine(config)
     winWidth, winHeight = (self.e.view.geometry[2],
                            self.e.view.geometry[3])
     vidPlayer = VideoPlayer(framerate,
                             self.src, (winWidth, winHeight),
                             loop=False,
                             startTime=10000,
                             endTime=14000)
     self.e.view.pushLayer(vidPlayer)
     while not vidPlayer.finished:
         self.e.run()
     self.e.view.popLayer(vidPlayer)
     self.e.audio.close()
     self.e.quit()
Beispiel #11
0
    pygame.init()
    pygame.mouse.set_visible(False)
    # init rendering screen
    displaymode = (IMAGE_WIDTH, IMAGE_HEIGHT)
    screen = pygame.display.set_mode(displaymode)
    pygame.display.toggle_fullscreen()

    # load cover image
    cover = pygame.image.load(IMAGE_NAME).convert()

    # set cover position
    position = pygame.Rect((0, -IMAGE_HEIGHT, IMAGE_WIDTH, IMAGE_HEIGHT))
    screen.blit(cover, position)

    audioPlayer = AudioPlayer(AUDIO_NAME)
    videoPlayer = VideoPlayer(VIDEO_NAME, IMAGE_WIDTH, IMAGE_HEIGHT, USE_VLC,
                              audioPlayer, pygame)

    inputLen = getInputDevices()
    prevInputLen = inputLen

    # MAIN LOOP
    while True:
        pygame.mouse.set_cursor((8, 8), (0, 0), (0, 0, 0, 0, 0, 0, 0, 0),
                                (0, 0, 0, 0, 0, 0, 0, 0))
        try:
            if areThereNewInputsDevices():
                hardKill()
                killAll()

            # update digital switches
            if USE_CHAPTERS:
Beispiel #12
0
def main():
    playing = None
    configFile = None
    fullscreen = None
    resolution = None
    theme = None
    debug = False
    difficulty = None
    part = None
    mode = 0
    nbrplayers = 1
    for opt, arg in opts:
        if opt in ["--verbose", "-v"]:
            Log.quiet = False
        if opt in ["--config", "-c"]:
            configFile = arg
        if opt in ["--fullscreen", "-f"]:
            fullscreen = arg
        if opt in ["--resolution", "-r"]:
            resolution = arg
        if opt in ["--theme", "-t"]:
            theme = arg
        if opt in ["--song", "-s"]:
            playing = arg
        if opt in ["--part", "-p"]:
            part = arg
        if opt in ["--diff", "-d", "-l"]:
            difficulty = arg
        #evilynux - Multiplayer and mode selection support
        if opt in ["--mode", "-m"]:
            mode = int(arg)
        if opt in ["--nbrplayers", "-n"]:
            nbrplayers = int(arg)

    # Load the configuration file.
    if configFile is not None:
        if configFile.lower() == "reset":
            fileName = os.path.join(Resource.getWritableResourcePath(),
                                    Version.PROGRAM_UNIXSTYLE_NAME + ".ini")
            os.remove(fileName)
            config = Config.load(Version.PROGRAM_UNIXSTYLE_NAME + ".ini",
                                 setAsDefault=True)
        else:
            config = Config.load(configFile, setAsDefault=True)
    else:
        config = Config.load(Version.PROGRAM_UNIXSTYLE_NAME + ".ini",
                             setAsDefault=True)

    #Lysdestic - Allow support for manipulating fullscreen via CLI
    if fullscreen is not None:
        Config.set("video", "fullscreen", fullscreen)

    #Lysdestic - Change resolution from CLI
    if resolution is not None:
        Config.set("video", "resolution", resolution)

    #Lysdestic - Alter theme from CLI
    if theme is not None:
        Config.set("coffee", "themename", theme)

    engine = GameEngine(config)
    engine.cmdPlay = 0

    # Check for a valid invocation of one-shot mode.
    if playing is not None:
        Log.debug('Validating song directory for one-shot mode.')
        library = Config.get("game", "base_library")
        basefolder = os.path.join(Version.dataPath(), library, "songs",
                                  playing)
        if not (os.path.exists(os.path.join(basefolder, "song.ini")) and
                (os.path.exists(os.path.join(basefolder, "notes.mid"))
                 or os.path.exists(
                     os.path.join(basefolder, "notes-unedited.mid"))) and
                (os.path.exists(os.path.join(basefolder, "song.ogg"))
                 or os.path.exists(os.path.join(basefolder, "guitar.ogg")))):
            Log.warn(
                "Song directory provided ('%s') is not a valid song directory. Starting up FoFiX in standard mode."
                % playing)
            engine.startupMessages.append(
                _("Song directory provided ('%s') is not a valid song directory. Starting up FoFiX in standard mode."
                  ) % playing)
            playing = None

    # Set up one-shot mode if the invocation is valid for it.
    if playing is not None:
        Log.debug('Entering one-shot mode.')
        Config.set("game", "selected_library", "songs")
        Config.set("game", "selected_song", playing)
        engine.cmdPlay = 1
        if difficulty is not None:
            engine.cmdDiff = int(difficulty)
        if part is not None:
            engine.cmdPart = int(part)
        #evilynux - Multiplayer and mode selection support
        Config.set("game", "players", nbrplayers)
        if nbrplayers == 1:
            Config.set("game", "game_mode", mode)
        else:
            Config.set("game", "game_mode", 0)
            Config.set("game", "multiplayer_mode", mode)

    encoding = Config.get("game", "encoding")
    if encoding is not None:
        #stump: XXX: Everything I have seen indicates that this is a
        # horrible, horrible hack.  Is there another way?  Do we even need this?
        reload(sys)
        sys.setdefaultencoding(encoding)

    # Play the intro video if it is present, we have the capability, and
    # we are not in one-shot mode.
    videoLayer = False
    if videoAvailable and not engine.cmdPlay:
        # TODO: Parameters to add to theme.ini:
        #  - intro_video_file
        #  - intro_video_start_time
        #  - intro_video_end_time
        themename = Config.get("coffee", "themename")
        vidSource = os.path.join(Version.dataPath(), 'themes', themename, \
                                 'menu', 'intro.avi')
        if os.path.isfile(vidSource):
            winWidth, winHeight = engine.view.geometry[2:4]
            songVideoStartTime = 0
            songVideoEndTime = None
            vidPlayer = VideoPlayer(-1,
                                    vidSource, (winWidth, winHeight),
                                    startTime=songVideoStartTime,
                                    endTime=songVideoEndTime)
            if vidPlayer.validFile:
                engine.view.pushLayer(vidPlayer)
                videoLayer = True
                try:
                    engine.ticksAtStart = pygame.time.get_ticks()
                    while not vidPlayer.finished:
                        engine.run()
                    engine.view.popLayer(vidPlayer)
                    engine.view.pushLayer(MainMenu(engine))
                except KeyboardInterrupt:
                    engine.view.popLayer(vidPlayer)
                    engine.view.pushLayer(MainMenu(engine))
    if not videoLayer:
        engine.setStartupLayer(MainMenu(engine))

    #stump: make psyco optional
    if Config.get("performance", "use_psyco"):
        try:
            import psyco
            psyco.profile()
        except:
            Log.error("Unable to enable psyco as requested: ")

    # Run the main game loop.
    try:
        engine.ticksAtStart = pygame.time.get_ticks()
        while engine.run():
            pass
    except KeyboardInterrupt:
        Log.notice("Left mainloop due to KeyboardInterrupt.")
        # don't reraise

    # Restart the program if the engine is asking that we do so.
    if engine.restartRequested:
        Log.notice("Restarting.")
        engine.audio.close()
        try:
            # Extra arguments to insert between the executable we call and our
            # command line arguments.
            args = []
            # Figure out what executable to call.
            if hasattr(sys, "frozen"):
                if os.name == "nt":
                    # When py2exe'd, sys.executable is the name of the EXE.
                    exe = os.path.abspath(
                        unicode(sys.executable, sys.getfilesystemencoding()))
                elif sys.frozen == "macosx_app":
                    # When py2app'd, sys.executable is a Python interpreter copied
                    # into the same dir where we live.
                    exe = os.path.join(
                        os.path.dirname(sys.executable),
                        'FoFiX')  # FIXME: don't hard-code "FoFiX" here
                else:
                    raise RuntimeError, "Don't know how to restart when sys.frozen is %s" % repr(
                        sys.frozen)
            else:
                # When running from source, sys.executable is the Python interpreter
                # being used to run the program.
                exe = sys.executable
                # Pass the optimization level on iif python version >= 2.6.0 as
                # sys.flags has been introduced in 2.6.0.
                if sys.version_info[:3] >= (2, 6,
                                            0) and sys.flags.optimize > 0:
                    args.append('-%s' % ('O' * sys.flags.optimize))
                args.append(__file__)
            os.execv(exe, [sys.executable] + args + sys.argv[1:])
        except:
            Log.error("Restart failed: ")
            raise

    # evilynux - MainMenu class already calls this - useless?
    engine.quit()
Beispiel #13
0
					# ~ videoPlayer.stop()
					videoPlayer.next(videoFiles[nextVideo])
					videoPlayer.player.pause()
					timestamp = time.time()
					connection.run_sender("play " + videoFiles[nextVideo] + " " + str(timestamp) + " \n")
					while time.time() - timestamp < 3:
						c = 10
					videoPlayer.player.play()
			else:
				# stop player at end last video
				videoPlaylist.sort()
				connection.run_sender("stop ")
				videoPlayer.stop()
	
from VideoPlayer import VideoPlayer
videoPlayer = VideoPlayer()
# DICT OF VIDEO FILES. 
# THE KEY IS A CHARACTER OF THE INDEX
videoFiles = get_videos()
# ARRAY OF videoFiles INDEXES. 
# EVERY TIME THE PLAY ORDER CHANGE, 
# IT CHANGES
videoPlaylist = [x for x in videoFiles]
videoPlaylist.sort()
# ABSOLUTE INDEX OF THE videoFiles, 
# USED TO CALCULATE THE NEXT VIDEO AND 
currVideo = 0

#~ currVideoPlaying
videoPlayer.loadVideo(videoFiles[videoPlaylist[currVideo]])
Beispiel #14
0
import cv2
import numpy as np
from VideoPlayer import VideoPlayer
from VideoWriter import VideoWriter
from LineDrawer import LineDrawer
from Model import Model
from LinePicker import LinePicker
from ModelTransformer import ModelTransformer
from HSVTrackbar import HSVPicker

if __name__ == '__main__':

    vp = VideoPlayer(
        'resources/video/field1/cliphd4.mp4')  #inicializa com o caminho
    frames = vp.extract_frames(
    )  # abre o arquivo e retorna um vetor com os frames
    frames_with_line = []  # cria vetor com frames com linha
    field_lines_mask = []  # mascara das linhas do campo

    lp = LinePicker(
        frames[1]
    )  #abre o frame de número 1 para a escolha dos pontos (fp,sc) -apertar enter

    #copia e imprime os pontos
    first_point = lp.first_down_point
    scrimmage = lp.scrimmage_point
    print(first_point, scrimmage)

    HSV_LOW, HSV_HIGH, BLUR = HSVPicker(frames[1]).getHSVMask(
    )  #abre o seletor de filtros pro HSV e retorna os limites da máscara
Beispiel #15
0
    def __init__(self, engine, songName=None):
        self.engine = engine
        self.time = 0.0
        self.offset = 0.5  # akedrou - this seems to fix the delay issue, but I'm not sure why. Return here!
        self.speedDiv = 20000.0
        self.speedDir = 1.0
        self.doneList = []
        self.themename = Config.get("coffee", "themename")

        nf = self.engine.data.font
        bf = self.engine.data.bigFont
        ns = 0.002
        bs = 0.001
        hs = 0.003
        c1 = (1, 1, .5, 1)
        c2 = (1, .75, 0, 1)
        self.text_size = nf.getLineSpacing(scale=hs)

        #akedrou - Translatable Strings:
        self.bank = {}
        self.bank['intro'] = [
            _("This mod was built on Alarian's mod,"),
            _("which was built on UltimateCoffee's Ultimate mod,"),
            _("which was built on RogueF's RF_mod 4.15,"),
            _("which was, of course, built on Frets on Fire 1.2.451,"),
            _("which was created by Unreal Voodoo")
        ]
        self.bank['noOrder'] = [_("No Particular Order")]
        self.bank['coders'] = [_("Active Coders:")]
        self.bank['pastCoders'] = [_("Past Coders:")]
        self.bank['graphics'] = [_("Main Graphic Contributors:")]
        self.bank['translators'] = [_("Translators:")]
        self.bank['Team Hero'] = [_("Team Hero:")]
        self.bank['careerMode'] = [_("Creators of Career Mode")]
        self.bank['honorary'] = [_("Honorary Credits to:")]
        self.bank['donations'] = [_("Donations to MFH")]
        self.bank['adonations'] = [_("Donations to akedrou")]
        self.bank['majorDonor'] = [_("Major Donations:")]
        self.bank['otherDonor'] = [_("Other Donations:")]
        self.bank['other'] = [_("Other Credits:")]
        self.bank['tutorial'] = [
            _("Jurgen FoF tutorial inspired by adam02"),
            _("Drum test song tutorial by Heka"),
            _("Bang Bang Mystery Man song tutorial is from the original FoF"),
            _("Drum Rolls practice tutorial by venom426")
        ]
        self.bank['disclaimer'] = [
            _("If you see your work included in this game and you aren't"),
            _("in the credits, please leave a polite post stating what you"),
            _("did and when, as specific as possible."),
            _("If you can, please provide a link to your original posting"),
            _("of the work in question."),
            _("Then we can properly credit you.")
        ]
        self.bank['thanks'] = [_("Thank you for your contribution.")]
        self.bank['oversight'] = [
            _("Please keep in mind that it is not easy to trace down and"),
            _("credit every single person who contributed; if your name is"),
            _("not included, it was not meant to slight you."),
            _("It was an oversight.")
        ]
        # evilynux - Theme strings
        self.bank['themeCreators'] = [_("%s theme credits:") % self.themename]
        self.bank['themeThanks'] = [
            _("%s theme specific thanks:") % self.themename
        ]
        # Languages
        self.bank['french'] = [_("French")]
        self.bank['french90'] = [_("French (reform 1990)")]
        self.bank['german'] = [_("German")]
        self.bank['italian'] = [_("Italian")]
        self.bank['piglatin'] = [_("Pig Latin")]
        self.bank['portuguese-b'] = [_("Portuguese (Brazilian)")]
        self.bank['russian'] = [_("Russian")]
        self.bank['spanish'] = [_("Spanish")]
        self.bank['swedish'] = [_("Swedish")]

        self.videoLayer = False
        self.background = None

        if videoAvailable:
            # TODO: Parameters to add to theme.ini:
            #  - credits_video_file
            #  - credits_video_start_time
            #  - credits_video_end_time
            vidSource = os.path.join(Version.dataPath(), 'themes', self.themename, \
                                     'menu', 'credits.avi')
            if os.path.exists(vidSource):
                winWidth, winHeight = self.engine.view.geometry[2:4]
                songVideoStartTime = 0
                songVideoEndTime = None
                self.vidPlayer = VideoPlayer(-1,
                                             vidSource, (winWidth, winHeight),
                                             mute=True,
                                             loop=True,
                                             startTime=songVideoStartTime,
                                             endTime=songVideoEndTime)
                if self.vidPlayer.validFile:
                    self.engine.view.pushLayer(self.vidPlayer)
                    self.videoLayer = True

        if not self.videoLayer and \
           not self.engine.loadImgDrawing(self, 'background', os.path.join('themes', self.themename, 'menu', 'credits.png')):
            self.background = None

        if not self.engine.loadImgDrawing(
                self, 'topLayer',
                os.path.join('themes', self.themename, 'menu',
                             'creditstop.png')):
            self.topLayer = None

        space = Text(nf, hs, c1, "center", " ")
        self.credits = [
            Picture(self.engine, "fofix_logo.png", .10),
            Text(nf, ns, c1, "center", "%s" % Version.version())
        ]

        # evilynux: Main FoFiX credits (taken from CREDITS).
        self.parseText("CREDITS")
        # evilynux: Theme credits (taken from data/themes/<theme name>/CREDITS).
        self.parseText(
            os.path.join('data', 'themes', self.themename, 'CREDITS'))

        self.credits.append(space)
        for i in self.bank['disclaimer']:
            self.credits.append(Text(nf, ns, c2, "center", i))
        self.credits.append(space)
        for i in self.bank['thanks']:
            self.credits.append(Text(nf, ns, c2, "center", i))
        self.credits.append(space)
        for i in self.bank['oversight']:
            self.credits.append(Text(nf, ns, c2, "center", i))

        self.credits.extend([
            space,
            Text(nf, ns, c1, "left", _("Made with:")),
            Text(nf, ns, c2, "right", "Python " + sys.version.split(' ')[0]
                 ),  #stump: the version that's actually in use
            Text(nf, bs, c2, "right", "http://www.python.org"),
            space,
            Text(nf, ns, c2, "right", "PyGame " + pygame.version.ver.replace(
                'release', '')),  #stump: the version that's actually in use
            Text(nf, bs, c2, "right", "http://www.pygame.org"),
            space,
            Text(nf, ns, c2, "right", "PyOpenGL " + OpenGL.__version__
                 ),  #evilynux: the version that's actually in use
            Text(nf, bs, c2, "right", "http://pyopengl.sourceforge.net"),
            space,
            #Text(nf, ns, c2, "right",  "Amanith Framework"),
            #Text(nf, bs, c2, "right",  "http://www.amanith.org"),
            #space,
            Text(nf, ns, c2, "right", "Illusoft Collada module 1.4"),
            Text(nf, bs, c2, "right", "http://colladablender.illusoft.com"),
            space,
            Text(nf, ns, c2, "right", "Psyco specializing compiler"),
            Text(nf, bs, c2, "right", "http://psyco.sourceforge.net"),
            space,
            Text(nf, ns, c2, "right", "MXM Python Midi Package 0.1.4"),
            Text(nf, bs, c2, "right",
                 "http://www.mxm.dk/products/public/pythonmidi"),
            space,
            space,
            Text(
                nf, bs, c1, "center",
                _("Source Code available under the GNU General Public License")
            ),
            Text(nf, bs, c2, "center", "http://code.google.com/p/fofix"),
            space,
            space,
            Text(nf, bs, c1, "center",
                 _("Copyright 2006, 2007 by Unreal Voodoo")),
            Text(nf, bs, c1, "center", _("Copyright 2008-2010 by Team FoFiX")),
            space,
            space
        ])
Beispiel #16
0
    def create_frames(self):
        # Top frame - Buttons and list
        self.frame1 = tk.LabelFrame(
            self.master, text='', relief=tk.RAISED
        )

        self.frame1.pack(side='top', expand=True, fill='both')

        self.load_q_button = tk.Button(
            self.frame1, text='Load Query', command=self.load_query_video)
        self.load_q_button.grid(row=0, column=0)

        self.run_button = tk.Button(
            self.frame1, text='Find matches', command=self.run_match)
        self.run_button.grid(row=1, column=0)

        # self.dummy_btn = tk.Button(
        #     self.frame1, text='Debug', command=self.dummy_fn)
        # self.dummy_btn.grid(row=2, column=0)

        self.match_list = tk.Listbox(self.frame1, height=4)
        self.yscroll = tk.Scrollbar(
            self.frame1, orient=tk.VERTICAL, command=self.match_list.yview)
        self.match_list['yscrollcommand'] = self.yscroll.set

        self.match_list.grid(row=0, column=1, rowspan=2, stick='wens')
        self.yscroll.grid(row=0, column=1, rowspan=2, sticky='nse')

        self.match_list.bind('<Double-Button-1>', self.poll_match_list)

        self.curr_selection = -1

        self.frame1.grid_columnconfigure(0, weight=1)
        self.frame1.grid_columnconfigure(1, weight=2)

        # Middle frame - Status box and correlation plots
        self.frame2 = tk.LabelFrame(
            self.master, text='', relief=tk.RAISED,
            height=200
        )
        self.frame2.pack(side='top', expand=True, fill='both')

        self.info_text = tk.StringVar()
        self.info_text.set('STATUS')
        self.info_label = tk.Label(
            self.frame2, textvar=self.info_text, justify=tk.LEFT, anchor='w')
        # self.info_label = tk.Label(self.frame2, text='')
        self.info_label.grid(row=0, column=0, stick='nswe')

        self.corr_curve_label = tk.Label(self.frame2)
        # self.corr_curve_label.config(background='yellow')
        self.corr_curve_label.bind("<Button-1>", self.show_corr_plots)
        self.corr_curve_label.grid(row=0, column=1, stick='nse')

        self.frame2.grid_columnconfigure(0, weight=1)
        self.frame2.grid_columnconfigure(1, weight=1)

        self.query_player = VideoPlayer(self.frame2)
        self.query_player.grid(row=1, column=0, stick='nsw')
        self.db_player = VideoPlayer(self.frame2)
        self.db_player.grid(row=1, column=1, stick='nse')

        self.draw_corr_label()
Beispiel #17
0
 def __init__(self, parent, video1FilePath=None, annotation1FilePath=None, video2FilePath=None, annotation2FilePath=None):
     self.root = parent
     # Set status of the player
     self.statusPlayer = StatusPlayer.NOT_STARTED
     self.eventPause = threading.Event()
     # current path
     currentPath = os.path.dirname(os.path.realpath(__file__))
     self.root.title("VDAO - Videos visualization")
     self.pnlMain = tk.PanedWindow(self.root, orient=tk.VERTICAL)
     self.pnlMain.pack(fill=tk.BOTH, expand=True)
     # Define video player 1 
     self.videoPlayer1 = VideoPlayer(parent=self.pnlMain, titleVideo='Video #1', fileName='', videoFilePath='', annotationFilePath='', currentFrameNbr=0, callback_FrameUpdated=self.callback_PlayFrame1, callBack_PlayPauseBtn_Clicked=self.callback_PlayPause, callBack_EquateFrames=self.callBack_EquateFrames)
     # Define video Difference
     self.videoPlayerDifference = VideoPlayer(self.pnlMain, 'Video Difference', "", "", None, 1, None, None, videoIsProcessed=True)
     # Define video player 2        
     self.videoPlayer2 = VideoPlayer(parent=self.pnlMain, titleVideo='Video #2', fileName='', videoFilePath='', annotationFilePath='', currentFrameNbr=0, callback_FrameUpdated=self.callback_PlayFrame2, callBack_PlayPauseBtn_Clicked=self.callback_PlayPause, callBack_EquateFrames=self.callBack_EquateFrames)
    # Buttons
     pnlButtons = tk.PanedWindow(self.root)
     pnlButtons.pack()
     # Load images
     self.imgBackwardsBeg = tk.PhotoImage(file=os.path.join(currentPath,'aux_images','rewind_beg.png'))
     self.imgBackwards1 = tk.PhotoImage(file=os.path.join(currentPath,'aux_images','rewind_1.png'))
     self.imgBackwards5 = tk.PhotoImage(file=os.path.join(currentPath,'aux_images','rewind_5.png'))
     self.imgBackwards10 = tk.PhotoImage(file=os.path.join(currentPath,'aux_images','rewind_10.png'))
     self.imgPlay = tk.PhotoImage(file=os.path.join(currentPath,'aux_images','play.png'))
     self.imgPause = tk.PhotoImage(file=os.path.join(currentPath,'aux_images','pause.png'))
     self.imgForwardEnd = tk.PhotoImage(file=os.path.join(currentPath,'aux_images','forward_end.png'))
     self.imgForward1 = tk.PhotoImage(file=os.path.join(currentPath,'aux_images','forward_1.png'))
     self.imgForward5 = tk.PhotoImage(file=os.path.join(currentPath,'aux_images','forward_5.png'))
     self.imgForward10 = tk.PhotoImage(file=os.path.join(currentPath,'aux_images','forward_10.png'))
     self.imgSelectFrame = tk.PhotoImage(file=os.path.join(currentPath,'aux_images','select_frame.png'))
     # Create and add buttons
     self.btnBackwardsBeg = tk.Button(pnlButtons, width=24, height=24, image=self.imgBackwardsBeg, state=tk.NORMAL, command=self.btnBackwardsBeg_Clicked)
     self.btnBackwardsBeg.pack(side=tk.LEFT, padx=2, pady=2)
     self.btnBackwards10 = tk.Button(pnlButtons, width=24, height=24, image=self.imgBackwards10, state=tk.NORMAL, command=self.btnBackwards10_Clicked)
     self.btnBackwards10.pack(side=tk.LEFT, padx=2, pady=2)
     self.btnBackwards5 = tk.Button(pnlButtons, width=24, height=24, image=self.imgBackwards5, state=tk.NORMAL, command=self.btnBackwards5_Clicked)
     self.btnBackwards5.pack(side=tk.LEFT, padx=2, pady=2)
     self.btnBackwards1 = tk.Button(pnlButtons, width=24, height=24, image=self.imgBackwards1, state=tk.NORMAL, command=self.btnBackwards1_Clicked)
     self.btnBackwards1.pack(side=tk.LEFT, padx=2, pady=2)
     self.btnPlayPause = tk.Button(pnlButtons, width=24, height=24, image=self.imgPlay, state=tk.NORMAL, command=self.btnPlayPause_Clicked)
     self.btnPlayPause.pack(side=tk.LEFT, padx=2, pady=2)
     self.btnForward1 = tk.Button(pnlButtons, width=24, height=24, image=self.imgForward1, state=tk.NORMAL, command=self.btnForward1_Clicked)
     self.btnForward1.pack(side=tk.LEFT, padx=2, pady=2)
     self.btnForward5 = tk.Button(pnlButtons, width=24, height=24, image=self.imgForward5, state=tk.NORMAL, command=self.btnForward5_Clicked)
     self.btnForward5.pack(side=tk.LEFT, padx=2, pady=2)
     self.btnForward10 = tk.Button(pnlButtons, width=24, height=24, image=self.imgForward10, state=tk.NORMAL, command=self.btnForward10_Clicked)
     self.btnForward10.pack(side=tk.LEFT, padx=2, pady=2)
     self.btnForwardEnd = tk.Button(pnlButtons, width=24, height=24, image=self.imgForwardEnd, state=tk.NORMAL, command=self.btnForwardEnd_Clicked)
     self.btnForwardEnd.pack(side=tk.LEFT, padx=2, pady=2)
     self.btnSelectFrame = tk.Button(pnlButtons, width=24, height=24, image=self.imgSelectFrame, state=tk.NORMAL, command=self.btnSelectFrame_Clicked)
     self.btnSelectFrame.pack(side=tk.LEFT, padx=2, pady=2)
     # Desabilita botoes
     self.ChangeNavButtonsStatus(False)
     # Se tiver não frames para tocar em ambos vídeos
     if self.videoPlayer1.totalFrames == 0 or self.videoPlayer2.totalFrames == 0: # Se vídeo não tem frames para tocar
         self.statusPlayer = StatusPlayer.FAILED
         # self.loadedFrame1 = self.loadedFrame2 = False
         self.videoPlayer1.loadedFrames = self.videoPlayer2.loadedFrames = False
         # Desabilita botão geral para tocar vídeos
         self.btnPlayPause.config(state="disabled")
     else: # Tem frames para tocar em ambos videos
         self.statusPlayer = StatusPlayer.NOT_STARTED 
         # self.loadedFrame1 = self.loadedFrame2 = True
         self.videoPlayer1.loadedFrames = self.videoPlayer2.loadedFrames = True
         # Habilita botão geral para tocar vídeos
         self.btnPlayPause.config(state="normal")
     # Desabilita botões de navegação entre para os 2 vídeos
     self.videoPlayer1.ChangeNavButtonsStatus(False)
     self.videoPlayer2.ChangeNavButtonsStatus(False)
     # Se videoPlayer1 não tiver frames para tocar, desabilita o play
     if self.videoPlayer1.totalFrames == 0:
         self.videoPlayer1.btnPlayPause.config(state="disabled")
     else: # habilita o play
         self.videoPlayer1.btnPlayPause.config(state="normal")
     # Se videoPlayer2 não tiver frames para tocar, desabilita o play
     if self.videoPlayer2.totalFrames == 0:
         self.videoPlayer2.btnPlayPause.config(state="disabled")
     else: # habilita o play
         self.videoPlayer2.btnPlayPause.config(state="normal")
     # identifies last video that was created (0: None, 1: First video, 2: Second video)
     self.lastVideoCreated = 0
     # Creates empty frames
     self.frame1 = self.frame2 = None
Beispiel #18
0
 def testVideoPlayerLayer(self):
     vidPlayer = VideoPlayer(self.e, framerate, self.src, loop=False)
     self.e.view.pushLayer(vidPlayer)
     while not vidPlayer.finished:
         self.e.run()
 def __init__(self):
     logging.info('Init Experiment...')
     self.player = VideoPlayer()
     self.tracker = Tracker()
     self.tracker.start()
     pass
                             bg="black",
                             disabledbackground="black",
                             disabledforeground='snow',
                             justify='center',
                             state='disabled')
txtPlatNumberDisplay.pack(pady=15)

# control panel
control_frame_top = Canvas(MainPanel,
                           width=350,
                           height=5,
                           bg="black",
                           relief=SUNKEN)
control_frame_top.pack(fill=BOTH, expand=False)

board = Label(control_frame_top, width=80, height=-1, bg="black")
board.pack(fill=BOTH, expand=True)

# control panel
control_frame_main = Canvas(MainPanel,
                            width=300,
                            height=700,
                            bg="blue",
                            relief=SUNKEN)
control_frame_main.pack(fill=BOTH, expand=True)

# video player
vid = VideoPlayer(control_frame_main, image=True, algo=True)
vid.command = lambda frame: extract_image(frame)
root.mainloop()
        if i == 0: # EOF
            break

        # Comment/Uncomment this line
        if frames == 3:
            break

    bitstream.closeFile()
    print("Video decoded with success!")




    if True:
        info = (height, width, formatC1, fps1)
        videoPlayer01 = VideoPlayer(fromFile=False)
        videoPlayer01.openInfo(info, decoded_matrixes)

        while (videoPlayer01.visualizeFrame()):
            pass
    # Code bellow, altho very hardcoded, shows the up to 3 frame, so we can check whether things went well or not
    if False:
        Y = decoded_matrixes[0]
        U = decoded_matrixes[1]
        V = decoded_matrixes[2]
        YUV = np.dstack((Y, U, V))[:720, :1280, :].astype(np.float)
        YUV[:, :, 0] = YUV[:, :, 0] - 16  # Offset Y by 16
        YUV[:, :, 1:] = YUV[:, :, 1:] - 128  # Offset UV by 128
        # YUV conversion matrix from ITU-R BT.601 version (SDTV)
        # Note the swapped R and B planes!
        #              Y       U       V