Hello guest, if you like this forum, why don't you register? https://fanrestore.com/member.php?action=register (December 14, 2021) x


Thread Rating:
  • 1 Vote(s) - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
AutoOverlay (PKA AutoAlign) discussion
#51
(2018-01-14, 10:23 AM)random.next Wrote:
(2018-01-14, 09:58 AM)TomArrow Wrote: random.next would have to implement some form of pre-multiply for that (I hope that's the right term), where basically the image is always pushed to 100% alpha internally where it is above 0% alpha. The mask then recreates the original border, eliminating the imperfection. That's what TIFF images with alpha masks do.

OR, make use of RGBA mode with an actual alpha channel. That way there would be no black background in the first place. But the implementation would have to likely use some form of premultiply anyway, so it probably doesn't matter.

The plugin only supports planar and RGB24 color spaces with mask images. RGB32 with alpha is not supported currently because it is completly different way to process transperency.
Inside the plugin OvelayRender uses  standard avisynth functions to overlay frames. Only OverlayEngine directly works with images when diff are calculated and some other support filters.

Ah I see. Maybe the solution is then to find an AviSynth resize/rotate function that does a form of premultiplying and pass that one through to OverlayRender.
Reply
Thanks given by:
#52
(2018-01-14, 10:13 AM)random.next Wrote: The first question. Why you always use bd as source clip and other clips as overlay? Overlay always at the top of source. I think bd has higher quality for this. 

I've tested various combinations using three sources, and those are the best to get an image that "touches" the top/bottom (or left/right, depending on the situation); then, overlay would be changed to have best quality source on top.

Quote:Next. Why you don't use resampleMT as recommended? Using Spline64Resize is bad descision for engine (not render) because it is slow. BilinearResize usually provide the same result. BilinearResizeMT is much faster than Spline64Resize. If your source clip have lower resolution than overlay (as sdtv), upsize it first. Subpixel in this case can be set to default 0. 

I just took one script as template and keep using it... Big Grin I'll try resampleMT - EDIT: yep, the sd sources are upsized beforehand.

Quote:So use sourceMask or overlayMask to exclude some areas from frames. Excluded area in mask must be pure black: PC levels for YUV. To load mask from file (black logo on white background): ImageSource("mask.png", pixel_type="Y8").ColorYUV(levels="TV->PC"). Then you are able to use the same mask in OverlayRender to break the transperency of excluded areas if you use opacity<1 or gradient and noise. 
To exclude black angles on borders use mask from OverlayRender with mode=6.

My aim is to get a mask that is the same as the borders (including the 1/2px near borders), but frankly I can't grasp how to get it - maybe mt_expand could do, but I'm not that good at that... Sad
Reply
Thanks given by:
#53
(2018-01-14, 10:25 AM)TomArrow Wrote:
(2018-01-14, 10:12 AM)spoRv Wrote: I guess the 1px "merged" border and 1px near-black border are due to subpixel alignment and resize; cropping the final image by 2px (with an optional command) would help to have a border of one color (possibly custom Wink )

It's because of resampling and is a desired effect to avoid aliasing. But it leads to problems when you're using a specific color as mask, because it creates gradients that no longer match the mask color. For example if the image is #FFFFFF and the background is #000000 and the mask color is #000000 as well, and you rotate/change subpixel alignment/resize, then resampling creates a continuum of middle values between #000000 and #FFFFFF which of course is stupid because only pure #000000 will function as mask. Transparent GIF images have the same problem, as they only have a 1-bit alpha channel (as oppposed to a full 8 bit alpha channel).

You could deactivate resampling, which would essentially result in that which we all know as "Nearest Neighbor" algorithm. As well all know, the result of that is unnacceptable for all but the most undemanding circumstances.
Maybe PointResize will be best for mask resizing because it has not such aliasing effect I think. 
Other way is make mask image pure black and white by somehing like ColorYUV(off_y=-M, gamma_y=N) to increase dynamic range.
Reply
Thanks given by:
#54
The plugin containes ColorRangeMask filter as well. It provides pure b&w image depends on color range. Try it: OverlayRender(mode=6...).ColorRangeMask(low=17). 17 or near values.
Reply
Thanks given by:
#55
(2018-01-14, 10:39 AM)random.next Wrote:
(2018-01-14, 10:25 AM)TomArrow Wrote:
(2018-01-14, 10:12 AM)spoRv Wrote: I guess the 1px "merged" border and 1px near-black border are due to subpixel alignment and resize; cropping the final image by 2px (with an optional command) would help to have a border of one color (possibly custom Wink )

It's because of resampling and is a desired effect to avoid aliasing. But it leads to problems when you're using a specific color as mask, because it creates gradients that no longer match the mask color. For example if the image is #FFFFFF and the background is #000000 and the mask color is #000000 as well, and you rotate/change subpixel alignment/resize, then resampling creates a continuum of middle values between #000000 and #FFFFFF which of course is stupid because only pure #000000 will function as mask. Transparent GIF images have the same problem, as they only have a 1-bit alpha channel (as oppposed to a full 8 bit alpha channel).

You could deactivate resampling, which would essentially result in that which we all know as "Nearest Neighbor" algorithm. As well all know, the result of that is unnacceptable for all but the most undemanding circumstances.
Maybe PointResize will be best for mask resizing because it has not such aliasing effect I think. 
Other way is make mask image pure black and white by somehing like ColorYUV(off_y=-M, gamma_y=N) to increase dynamic range.

Yes, but the problem (although it is a small problem) is that PointResize will not perfectly overlap with others like Spline64Resize, so the mask will not fit perfectly and result in the borders that spoRv meant, I think. Adjusting the mask with some levels function may indeed be the best idea (push all grey pixels to be completely black), but it would also theoretically cost some fringe pixels. The only way to save those would be to use Levels to push all grey pixels to White (in the mask) and have the normal image premultiplied. But then, one may question the validity of the result, because those fringe pixels may have had an alpha value of maybe even only 1% and should not really be fully visible and overlay other pixels that had an alpha of 100%.

I guess the only 100% perfect solution would be RGBA. The best realistic workable solution is probably to discard some pixels by doing what you suggested with some color adjustment to the mask by pushing grey pixels to black. Seems like the safest way.
Reply
Thanks given by:
#56
I think the proposed solution with ColorRangeMask is cover this case. With this filter you can make "grey" pixels pure white or black depend on of your purpose. Have no time to test it.
Reply
Thanks given by:
#57
Yap, sounds like a good call.
Reply
Thanks given by:
#58
Had some fun over the weekend with John Woo's Broken Arrow. Probably will release this hybrid in few weeks.

[Image: 1.png]
[Image: 2.png]
[Image: 3.png]
[Image: 4.png]
[Image: 5.png]

Used Open Matte STARZ WEB-DL and overlaid HDTV over STARZ logo (as it appears sometimes). Then used Bluray to enhance quality and details. Glad to report color matching works very well!
Reply
Thanks given by: maksnew
#59
Are these constant adjustments? How can we used this script on open mattes where the framing changes from shot to shot?
Reply
Thanks given by:
#60
(2018-01-15, 12:36 PM)Stamper Wrote: Are these constant adjustments? How can we used this script on open mattes where the framing changes from shot to shot?

This is made just for what you describe. I think it automatically recognizes how much a scene has changed with the backwardsFrames parameter (might have misspelled it!), so it usually keeps the setting until a scene change is detected. This can be disabled for frame-by-frame alignment, but it becomes much slower.
Reply
Thanks given by:


Possibly Related Threads…
Thread Author Replies Views Last Post
  home 7.1 releases - general discussion spoRv 7 3,153 2021-10-11, 05:51 PM
Last Post: spoRv
  Recordable blu-ray disc general discussion spoRv 6 7,990 2017-05-20, 11:37 AM
Last Post: spoRv

Forum Jump:


Users browsing this thread: 27 Guest(s)