findTransformECC for image with floating vignette

I am trying to perform video stabilization using findTransformECC, which generally works quite well for me with ideal videos. However, my video comprises a rather static image, to which I want to stabilize, plus a vignette with very soft edge that floats over the image, with motion unrelated to the image’s motion. Performing the ECC transform on the straight frames leads to stabilizing mostly to the vignette instead of the image. Any high-level ideas? Cheers.

gonna need the data for any opinions. source data. if not a video, then at least two frames that represent the problem well.

of course! As a new user, I’m limited to links/media per post…
edge case:


ideal case:
(this already works rather well just by cropping largely within the vignette)


I don’t know where I can upload the full 1080p vid for download, but here is a 720p version easily downloadable:

based on that video, I’d recommend to generate “proxy” data that you ECC on, then use the tracking on the source data.

I would recommend the “proxy” to be a highpass, i.e. laplacian or difference of gaussian or something like that. that removes illumination and leaves high frequency features.

Now that I am about to wrap up my thesis, just to update what I ended up doing… I had some luck with applying a Sobel transform (similar to as you suggested with the Laplacian) and then setting a minimum threshold so all the soft gradients just disappear. What I ended up doing was applying a 2-step stabilization. I take the red channel that is pretty uniform (most of the contrast is on the green channel) and apply a bit of a gaussian blur to it then put it through the ECC optimizer. That stabilizes to the vignette. Then I set the active frame to the stable vignette, switch over to green channel (normalized by red to take care of the edge of the vignette) and restabilize, which now tracks the blood vessels very well.