Page MenuHome

Compositor: 'invert' option of the 'Stabilize 2D' node does not work correctly
Closed, ResolvedPublicBUG

Description

System Information
Operating system: Win10 64
Graphics card: 3070

Blender Version
Broken: 2.83
Worked: N/A

Short description of error
As indicated in the tip and in the manual, the invert option of the Stabilize2D node kind of undoes the stabilization effect and "reintroduces montion to the frame".
But in practice, when undoing the stabilization, while the rotation and scale appear to be correct, the image position is incorrect.

Exact steps for others to reproduce the error

  • Open the attached file
  • Switch between frames 1, 2 and 3 to see a correct stabilization
  • Unmute the Stabilize 2D node that has the invert option enabled
  • Switch frames again and see that the image position is not corrected

The Transform node can help you see what's going on.

Event Timeline

It would definitely help if you can provide example file. I would recommend to rendering very simple and short video so that files provided would illustrate the issue clearly. Then simply upload video same way as you upload .blend file.

Here you go hopefully it helps

Germano Cavalcante (mano-wii) renamed this task from Stabilize2d Comp Node Invert to Compositor: 'invert' option of the 'Stabilize 2D' node does not work correctly.Aug 7 2020, 3:46 AM
Germano Cavalcante (mano-wii) changed the task status from Needs Triage to Confirmed.
Germano Cavalcante (mano-wii) updated the task description. (Show Details)
Germano Cavalcante (mano-wii) changed the subtype of this task from "Report" to "Bug".Aug 7 2020, 3:49 AM

Thanks for the file.
It really helps to identify the bug.

Richard Antalik (ISS) closed this task as Invalid.Aug 7 2020, 5:14 AM
Richard Antalik (ISS) claimed this task.

File definitely helped.

Looking at code, this doesn't look like bug. Invert property does _exactly_ what it says in manual https://docs.blender.org/manual/en/dev/compositing/types/distort/stabilize_2d.html

Issue here is, that image is scaled, translated and rotated with reference to center of the image. This operation is performed again with inverse values, but reference point is still in the center of image. I think reversing order doesn't apply here really.

This could be resolved by passing reference to new center of image, but I am not aware how this would be useful in real life application.

Thanks for the clarification.

Just as an example of a real life application, I was trying to overlay some cartoon sun glasses on a face and wanted them to track the eyes of a person (position/scale/rotation), something you can typically do with reverse stabilisation.

I think the manual does indicate a bug, it says if "no invert" move up by 5 units then "invert" moves down by 5 units. That isn't the case as in the example blend (previously submitted) you can see the number of units that where moved up with the stabalize doesn't equal the number of units moved down by the invert.

You really shouldn't need to add any additional reference to new center of image as it can be done with some maths and transform nodes (see attached blend with node setup). All that needs to happen is that the order of operation needs to be reversed, ie for stabilize then invert the list of operations are currently:
[Stabilize2d]( scale -> rotate -> translate ) -> [Stabilize2d Invert]( unscale -> unrotate -> untranslate )
but they should be:
[Stabilize2d]( scale -> rotate -> translate ) -> [Stabilize2d Invert]( untranslate -> unrotate -> unscale )
The change won't effect anything without scale and rotation but will make the invert actually useful for case where scale and rotation are used.

Hopefully, the attached blend is helpful in illustrating the problem.

Richard Antalik (ISS) reopened this task as Needs Triage.EditedAug 7 2020, 12:21 PM

Thanks for the clarification.

Just as an example of a real life application, I was trying to overlay some cartoon sun glasses on a face and wanted them to track the eyes of a person (position/scale/rotation), something you can typically do with reverse stabilisation.

I think the manual does indicate a bug, it says if "no invert" move up by 5 units then "invert" moves down by 5 units. That isn't the case as in the example blend (previously submitted) you can see the number of units that where moved up with the stabalize doesn't equal the number of units moved down by the invert.

You really shouldn't need to add any additional reference to new center of image as it can be done with some maths and transform nodes (see attached blend with node setup). All that needs to happen is that the order of operation needs to be reversed, ie for stabilize then invert the list of operations are currently:
[Stabilize2d]( scale -> rotate -> translate ) -> [Stabilize2d Invert]( unscale -> unrotate -> untranslate )
but they should be:
[Stabilize2d]( scale -> rotate -> translate ) -> [Stabilize2d Invert]( untranslate -> unrotate -> unscale )
The change won't effect anything without scale and rotation but will make the invert actually useful for case where scale and rotation are used.

Hopefully, the attached blend is helpful in illustrating the problem.

I closed this after @Germano Cavalcante (mano-wii) confirmed without noticing that, so I should really reopen this.

Reversing order would work. I stand corrected. But my question was rather why wouldn't you just use original images. This is solely demonstration of bug not real world use case am I correct?

I did this reverse stabilization trick and you are correct, it doesn't work as expected with stabilize 2D node. I am not sure whether this is intentional or not. I will need info from @Sergey Sharybin (sergey).

You can switch between stabilize 2D and desired behavior nodes in this file to see issue clearly:

yep, the included files are just to show the bug in cleanest way I could. You're right it would be ridiculous to actually do what was in the example, so I can see the confusion.

Sergey Sharybin (sergey) changed the task status from Needs Triage to Confirmed.Aug 7 2020, 3:43 PM

I think there is even simpler possible demo case: 2D Stabilize -> Inevrted 2D Stabilize. That is supposed to give original image (I think even the black "padding" wouldn't be expected, but my memories are a bit rusty).
Since the Stabilize work, and manual inverted stabilize work, i think it's the wrong order of operations in the Stabilize2dNode::convertToOperations for the invert case.

@Richard Antalik (ISS), Just noticed the task is assigned to you. Are you looking into it? Otherwise i can do it next week.