## Motion Vectors

### Motion Vectors

What is be best way to get a motion vector from a Realflow mesh in C4D?

### Re: Motion Vectors

As is the case with many standard signal processing routines, it's quite straightforward on paper and a little tricky in practice. You separated your image into six blocks B(i,j)B(i,j) with i={0,1,2}i={0,1,2} and j={0,1}j={0,1}. each of this blocks has coordinates at (2i,2j)(2i,2j) (we consider top left corner of each to identify its location). We, therefore, now have six blocks at

(0,0) (0,2)

(2,0) (2,2)

(4,0) (4,2)

Your calculated motion vectors M(i,j)M(i,j) for each block are

(0,0) (0,0)

(0,1) (-1,1)

(0,0) (0,0)

Now, to calculate the resulting image, we must first know where every block moved. To do that, we simply add the above coordinate matrix to its motion matrix: B′(i,j)=B(i,j)+M(i,j)B′(i,j)=B(i,j)+M(i,j). We get

(0,0) (0,2)

(2,1) (1,3)

(4,0) (4,2)

In order to avoid "holes" as you said, we don't simply move blocks of the original frame around to get the new one, we take the original one as a reference and inject the newly calculated blocks. To do this, we first make a copy of the original frame. We then take every B′(i,j)B′(i,j) and replace it with pixels of corresponding B(i,j)B(i,j).

Note: We are not protected from any kind of overlapping of block "in motion" (two blocks are moved to overlapping locations). There are ways to handle that, but it's beyond the scope of this response. For now, we're just going to rewrite any pixels with a block we're moving to their location, so that even if there were blocks moved there previously, they will get overwritten.

Now, going block by block in the order you had in your question, we replace every B′(i,j)B′(i,j) by its corresponding B(i,j)B(i,j). We get the followinf estimated frame FeFe

7 7 7 7

7 7 5 7

7 7 7 8

7 5 5 8

8 9 8 9

9 9 9 9

The error EE is found between estimated frame FeFe and the one we're trying to predict FF is found by E=F−FeE=F−Fe which we calculate to be

0 0 0 0

0 0 0 -3

0 0 0 -1

0 0 3 0

0 0 0 0

0 0 0 0

(0,0) (0,2)

(2,0) (2,2)

(4,0) (4,2)

Your calculated motion vectors M(i,j)M(i,j) for each block are

(0,0) (0,0)

(0,1) (-1,1)

(0,0) (0,0)

Now, to calculate the resulting image, we must first know where every block moved. To do that, we simply add the above coordinate matrix to its motion matrix: B′(i,j)=B(i,j)+M(i,j)B′(i,j)=B(i,j)+M(i,j). We get

(0,0) (0,2)

(2,1) (1,3)

(4,0) (4,2)

In order to avoid "holes" as you said, we don't simply move blocks of the original frame around to get the new one, we take the original one as a reference and inject the newly calculated blocks. To do this, we first make a copy of the original frame. We then take every B′(i,j)B′(i,j) and replace it with pixels of corresponding B(i,j)B(i,j).

Note: We are not protected from any kind of overlapping of block "in motion" (two blocks are moved to overlapping locations). There are ways to handle that, but it's beyond the scope of this response. For now, we're just going to rewrite any pixels with a block we're moving to their location, so that even if there were blocks moved there previously, they will get overwritten.

Now, going block by block in the order you had in your question, we replace every B′(i,j)B′(i,j) by its corresponding B(i,j)B(i,j). We get the followinf estimated frame FeFe

7 7 7 7

7 7 5 7

7 7 7 8

7 5 5 8

8 9 8 9

9 9 9 9

The error EE is found between estimated frame FeFe and the one we're trying to predict FF is found by E=F−FeE=F−Fe which we calculate to be

0 0 0 0

0 0 0 -3

0 0 0 -1

0 0 3 0

0 0 0 0

0 0 0 0

### Who is online

Users browsing this forum: No registered users and 3 guests