Drawing on video to create a layer/mask

Hi there !

I’m working on a little useless project (like a like to do xD) but I got some problems.

I’m trying to create a drawing system where the user can draw on a video to cut some part of the video.

for example, I got a video loop with a man running, so I draw a circle around one of his legs, then it’s create a new layer over the original video with just the circle content (the leg in this case, and the legs keep running) as if I cut with scissors in a photography to extract a part of it (the only difference is that I wanna duplicate the cutted part, to keep the original video free from hole.

So right know I got the drawing interface, the video renderer of course, and I can basicly link them by putting the drawing interface over the video with a group node but I don’t know how to cut in the video using drawings.

So if somebody has an idea about some nodes I should look at or some patches working in this way cause I don’t really how to start to learn about this kind of concept, please give me a hand :)

hi,

you can use the Delaunay (2d) node to connect a number of points in a sensible way to turn them into a mesh (3d object) with additional help from VertexBuffer (EX9.Geometry Join) and Mesh (EX9.Geometry Join) ; you could then put the same video onto this mesh as a texture. the challenge to this approach is a) getting the texture coordinates for the mesh right and b) finding a sensible way to dynamically store multiple meshes (spreading the delaunay, mesh indices etc.).

another approach would be to draw into a texture, which you could then use as a mask in a shader; this might be slightly easier (less headache about spreaded delaunay, indices & texcoords).

for the texture approach, you will find a number of fitting mask shaders on the User Shaders page; for the mesh approach, you might be interested in this thread about a shader which changes texture coordinates in a way similar to masking.

hi crasse,
you can use a mask texture shader for this as diki said.
I attached a rough example. By this way you can save mask movement in an extra file or timeline, so your source video wont be touched.
The example is with one mask color only, but should be added more colors easily for more masks.

mask_video.zip (40.0 kB)

thks a lot dudes !

sorry for the late response, I’ve been on a trip.

anyway I’m on it rightnow thanks to your help ! :)

I’ll try both of the way, I didn’t think about 3D mesh, could be very interesting and funny way to do it !