question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Clear previous frame from video pipeline

See original GitHub issue

Hi Marco,

I am trying to create a video sequence from some pcds that I am loading each time based on the tutorials, however the viewer and the output video file just puts the new pcds on top of each other so it accumulates all the scenes. Is it possible to clear the previous loaded pcd before I show the new one and added to the video output as a new frame.

Code snippet:

cam = dict(
        pos=(-3.373, -1.983, -3.673),
        focalPoint=(-0.3201, -0.2132, 1.150),
        viewup=(0.1560, -0.9551, 0.2518),
        distance=5.976,
        clippingRange=(2.888, 9.879),
    )
vp = vd.Plotter(axes=0, interactive=0, sharecam=False)

video = vd.Video("elephant.mp4", backend='ffmpeg')  # backend='opencv'

for i, pcd in enumerate(scanned_pcds):
    p = vd.Points(pcd)
   
    vp.show(p.lighting(style='metallic'), elevation=1, azimuth=2, camera=cam)  # render the scene
    video.addFrame() # add frame

video.close()
vp.show().close()

Thanks.

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
ttsesmcommented, Jul 27, 2022

Hi what if you remove it explicitly:

    vp.show(p.lighting(style='metallic'), elevation=1, azimuth=2, camera=cam)  # render the scene
    vp.remove(p)

ok Marco, sorry my bad. This actually works, you just need to add the video.addFrame() before the remove:

vp.show(p.lighting(style='metallic'), camera=cam)  # render the scene
video.addFrame()
vp.remove(p)

My apologies. Pfff, long day at work…

0reactions
marcomusycommented, Jul 27, 2022

what about

from vedo import *

scanned_pcds = [Points(np.random.rand(100,3)), Points(np.random.rand(100,3)+0.5)]

vp = Plotter()

vp.show(Axes(scanned_pcds[0]))

for i, pcd in enumerate(scanned_pcds):
    pcd.lighting(style='metallic')
    vp.add(pcd)
    vp.screenshot(f'm{i}.png') # or add frame
    vp.remove(pcd)

vp.interactive()
Read more comments on GitHub >

github_iconTop Results From Across the Web

ffmpeg - replace black frames with previous frames
I found this question "remove black frames from vob files with ffmpeg", but I don't want to cut out the frames but instead...
Read more >
OpenCV: reading frames from VideoCapture advances the ...
In a nutshell: I reproduced your problem on an Ubuntu 12.04 machine with OpenCV 2.4.13, noticed that the codec used in your video...
Read more >
Remove the same or similar frame in a video|Python opencv
Delete the same or similar frame in a video by using python opencv.
Read more >
How to view previous frame transparent across curr...
Solved: I'm doing a video with animation, and I would like to see the previous frame as I animate (a la dragonframe) in...
Read more >
Object detection, reading from RTSP stream with no buffer
I'm trying to run object detection using a remote camera, and I'm accessing the video through a RTSP stream. The object detection routine ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found