Example #1
0
 def update(self, surface):
     global image_background
     surface.blit(image_background, (0, 0))
     TextRenderer.render(get_time() + ' ' + get_date(), 160, 220, TextRenderer.FONT_SMALL, surface, TextRenderer.CENTER_X)
     TextRenderer.render('Radio RSA Sachsen', 160, 20, TextRenderer.FONT_SMALL, surface, TextRenderer.CENTER_X)
Example #2
0
        _, count, caption = heapq.heappop(futureCaptions)
        heapq.heappush(currentCaptions,
                       PrioritizedCaption(caption.endTime, count, caption))
    while currentCaptions and currentCaptions[0].time < i:
        heapq.heappop(currentCaptions)
    # read frame
    frame = imageio.imread(path)
    videoWidth, videoHeight, _ = frame.shape
    if video == None:
        video = cv2.VideoWriter(outputPathNoAudio,
                                cv2.VideoWriter_fourcc(*'mp4v'), targetFps,
                                (videoHeight, videoWidth))
    # apply captions
    for j, (_, _, caption) in enumerate(currentCaptions):
        scale = max(0.25, captionVolumes[caption] / 16000)
        captionWidth, captionHeight = TextRenderer.getCaptionSize(
            caption.message, scale)
        if captionWidth >= videoWidth:
            scale = 0.6
            captionWidth, captionHeight = TextRenderer.getCaptionSize(
                caption.message, scale)

        if j == 0:
            energyMatrix = getEnergyMatrix(
                frame, [captionHeight, captionWidth],
                captionId=id(caption),
                objBox=objects[i] if i in objects else None)
            if energyVideo == None:
                energyWidth, energyHeight = energyMatrix.shape
                energyVideo = cv2.VideoWriter(outputPathEnergy,
                                              cv2.VideoWriter_fourcc(*'mp4v'),
                                              targetFps,
Example #3
0
 def update(self, surface):
     global image_off
     surface.blit(image_off, (0, 0))
     TextRenderer.render(get_date(), 160, 140, TextRenderer.FONT_SMALL, surface, TextRenderer.CENTER_X)
     TextRenderer.render(get_time(), 160, 160, TextRenderer.FONT_BIG, surface, TextRenderer.CENTER_X)