def show(clip, t=0, with_mask=True, interactive=False): """ Splashes the frame of clip corresponding to time ``t``. Parameters ---------- t : float or tuple or str, optional Time in seconds of the frame to display. with_mask : bool, optional ``False`` if the clip has a mask but you want to see the clip without the mask. interactive : bool, optional Displays the image freezed and you can clip in each pixel to see the pixel number and its color. Examples -------- >>> from moviepy.editor import * >>> >>> clip = VideoFileClip("media/chaplin.mp4") >>> clip.show(t=4, interactive=True) """ if with_mask and (clip.mask is not None): clip = CompositeVideoClip([clip.with_position((0, 0))]) img = clip.get_frame(t) imdisplay(img) if interactive: result = [] while True: for event in pg.event.get(): if event.type == pg.KEYDOWN: if event.key == pg.K_ESCAPE: print("Keyboard interrupt") return result elif event.type == pg.MOUSEBUTTONDOWN: x, y = pg.mouse.get_pos() rgb = img[y, x] result.append({"position": (x, y), "color": rgb}) print("position, color : ", "%s, %s" % (str( (x, y)), str(rgb))) time.sleep(0.03)
def show(clip, t=0, with_mask=True, interactive=False): """ Splashes the frame of clip corresponding to time ``t``. Parameters ------------ t Time in seconds of the frame to display. with_mask ``False`` if the clip has a mask but you want to see the clip without the mask. """ if isinstance(t, tuple): t = convert_to_seconds(*t) if with_mask and (clip.mask is not None): clip = CompositeVideoClip([clip.with_position((0, 0))]) img = clip.get_frame(t) imdisplay(img) if interactive: result = [] while True: for event in pg.event.get(): if event.type == pg.KEYDOWN: if event.key == pg.K_ESCAPE: print("Keyboard interrupt") return result elif event.type == pg.MOUSEBUTTONDOWN: x, y = pg.mouse.get_pos() rgb = img[y, x] result.append({"position": (x, y), "color": rgb}) print("position, color : ", "%s, %s" % (str( (x, y)), str(rgb))) time.sleep(0.03)