Compositor: 'invert' option of the 'Stabilize 2D' node does not work correctly #79563

Closed
opened 2020-08-05 18:05:07 +02:00 by Paul Brunt · 21 comments

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.
    Stabilize2DBug.blend
**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. [Stabilize2DBug.blend](https://archive.blender.org/developer/F8754029/Stabilize2DBug.blend)
Author

Added subscriber: @supereggbert

Added subscriber: @supereggbert

Added subscriber: @iss

Added subscriber: @iss

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.

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.
Author

Here you go hopefully it helps Stabilize2D.zip

Here you go hopefully it helps [Stabilize2D.zip](https://archive.blender.org/developer/F8751060/Stabilize2D.zip)
Germano Cavalcante changed title from Stabilize2d Comp Node Invert to Compositor: 'invert' option of the 'Stabilize 2D' node does not work correctly 2020-08-07 03:46:50 +02:00

Changed status from 'Needs Triage' to: 'Confirmed'

Changed status from 'Needs Triage' to: 'Confirmed'

Added subscriber: @mano-wii

Added subscriber: @mano-wii

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

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

Changed status from 'Confirmed' to: 'Archived'

Changed status from 'Confirmed' to: 'Archived'
Richard Antalik self-assigned this 2020-08-07 05:14:48 +02:00

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.

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.
Author

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.
Stabilize2Dfix.zip

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. [Stabilize2Dfix.zip](https://archive.blender.org/developer/F8754985/Stabilize2Dfix.zip)

Changed status from 'Archived' to: 'Needs Triage'

Changed status from 'Archived' to: 'Needs Triage'

In #79563#992436, @supereggbert wrote:
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.
Stabilize2Dfix.zip

I closed this after @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?

> In #79563#992436, @supereggbert wrote: > 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. > [Stabilize2Dfix.zip](https://archive.blender.org/developer/F8754985/Stabilize2Dfix.zip) I closed this after @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?

Added subscriber: @Sergey

Added subscriber: @Sergey

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.

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

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. You can switch between stabilize 2D and desired behavior nodes in this file to see issue clearly: [Stabilize2DFix.zip](https://archive.blender.org/developer/F8755387/Stabilize2DFix.zip)
Author

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.

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.

Changed status from 'Needs Triage' to: 'Confirmed'

Changed status from 'Needs Triage' to: 'Confirmed'

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.

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.

@iss, Just noticed the task is assigned to you. Are you looking into it? Otherwise i can do it next week.

@iss, Just noticed the task is assigned to you. Are you looking into it? Otherwise i can do it next week.
Richard Antalik removed their assignment 2020-08-08 00:33:58 +02:00
Sergey Sharybin self-assigned this 2020-08-10 09:33:25 +02:00

This issue was referenced by eca062b9cb

This issue was referenced by eca062b9cbea5b5e30345ae5de1cf5a089003a19

Changed status from 'Confirmed' to: 'Resolved'

Changed status from 'Confirmed' to: 'Resolved'
Author

Thanks all :-)

Thanks all :-)
Thomas Dinges added this to the 2.90 milestone 2023-02-08 16:25:41 +01:00
Sign in to join this conversation.
No Label
Interest
Alembic
Interest
Animation & Rigging
Interest
Asset Browser
Interest
Asset Browser Project Overview
Interest
Audio
Interest
Automated Testing
Interest
Blender Asset Bundle
Interest
BlendFile
Interest
Collada
Interest
Compatibility
Interest
Compositing
Interest
Core
Interest
Cycles
Interest
Dependency Graph
Interest
Development Management
Interest
EEVEE
Interest
EEVEE & Viewport
Interest
Freestyle
Interest
Geometry Nodes
Interest
Grease Pencil
Interest
ID Management
Interest
Images & Movies
Interest
Import Export
Interest
Line Art
Interest
Masking
Interest
Metal
Interest
Modeling
Interest
Modifiers
Interest
Motion Tracking
Interest
Nodes & Physics
Interest
OpenGL
Interest
Overlay
Interest
Overrides
Interest
Performance
Interest
Physics
Interest
Pipeline, Assets & IO
Interest
Platforms, Builds & Tests
Interest
Python API
Interest
Render & Cycles
Interest
Render Pipeline
Interest
Sculpt, Paint & Texture
Interest
Text Editor
Interest
Translations
Interest
Triaging
Interest
Undo
Interest
USD
Interest
User Interface
Interest
UV Editing
Interest
VFX & Video
Interest
Video Sequencer
Interest
Virtual Reality
Interest
Vulkan
Interest
Wayland
Interest
Workbench
Interest: X11
Legacy
Blender 2.8 Project
Legacy
Milestone 1: Basic, Local Asset Browser
Legacy
OpenGL Error
Meta
Good First Issue
Meta
Papercut
Meta
Retrospective
Meta
Security
Module
Animation & Rigging
Module
Core
Module
Development Management
Module
EEVEE & Viewport
Module
Grease Pencil
Module
Modeling
Module
Nodes & Physics
Module
Pipeline, Assets & IO
Module
Platforms, Builds & Tests
Module
Python API
Module
Render & Cycles
Module
Sculpt, Paint & Texture
Module
Triaging
Module
User Interface
Module
VFX & Video
Platform
FreeBSD
Platform
Linux
Platform
macOS
Platform
Windows
Priority
High
Priority
Low
Priority
Normal
Priority
Unbreak Now!
Status
Archived
Status
Confirmed
Status
Duplicate
Status
Needs Info from Developers
Status
Needs Information from User
Status
Needs Triage
Status
Resolved
Type
Bug
Type
Design
Type
Known Issue
Type
Patch
Type
Report
Type
To Do
No Milestone
No project
No Assignees
5 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: blender/blender#79563
No description provided.