VideoHelp Forum




+ Reply to Thread
Results 1 to 23 of 23
  1. Video Restorer lordsmurf's Avatar
    Join Date
    Jun 2003
    Location
    dFAQ.us/lordsmurf
    Search Comp PM
    I have some film that is deeply vignetted.
    The vignette is just mild darkness, not any black.

    I know I'll need to mask.
    I can tighten that myself, so exact size not important here, sample not needed.
    1440*960 is resolution, outer 25% has vignette, hot spot is offset left some (not fully center)

    But I'm blanking out right now on what scripting would be best here.

    This thread was sorta-kinda (not really) close:
    https://forum.videohelp.com/threads/378783-Removing-white-haze-from-I-would-just-say-s...-online-videos

    In that thread, jagabo mentioned "normal vignetting you get from a poor projector telecine", and that's essentially what I have here.

    Help.
    Want my help? Ask here! (not via PM!)
    FAQs: Best Blank DiscsBest TBCsBest VCRs for captureRestore VHS
    Quote Quote  
  2. Overlay a brightened version with a vignette mask

    The mask should be more white on the periphery, dark near the hotspot

    Overlay(original, brightened, mask=mask)
    Quote Quote  
  3. Got a small sample? Maybe playing around with Retinex or Grayworld and adjusting the colors afterward can help,...
    users currently on my ignore list: deadrats, Stears555, marcorocchini
    Quote Quote  
  4. Video Restorer lordsmurf's Avatar
    Join Date
    Jun 2003
    Location
    dFAQ.us/lordsmurf
    Search Comp PM
    In photo, you just fade-brighten the edges.

    So here, you're suggesting darken the "hotspot" (it's not really hot), in addition? The levels are already fragile.

    I need some code to look at.
    Want my help? Ask here! (not via PM!)
    FAQs: Best Blank DiscsBest TBCsBest VCRs for captureRestore VHS
    Quote Quote  
  5. Not darken the hot spot. When a mask is 100% black, it means no effect. So if the mask is black over the hotspot, nothing happens to the hotspot. The mask is limiting the effect of the brightness layer . 100% white means 100% effect. 0% white (100% black) means 0% effect

    So when you apply a brightened layer through a vignette mask (dark in the middle, white in the periphery), the dark edges are "brightened" more, the hotspot not affected (unless you want it affected, then you'd make the mask over that area less black)
    Quote Quote  
  6. Video Restorer lordsmurf's Avatar
    Join Date
    Jun 2003
    Location
    dFAQ.us/lordsmurf
    Search Comp PM
    Originally Posted by Selur View Post
    Got a small sample? Maybe playing around with Retinex or Grayworld and adjusting the colors afterward can help,...
    The full video values are all over the place. Bright scenes, dark scenes, so don't look too deeply there. But the vignette is pretty universal, regardless of dark or bright scene.
    Image Attached Files
    Last edited by lordsmurf; 9th Aug 2023 at 15:35.
    Want my help? Ask here! (not via PM!)
    FAQs: Best Blank DiscsBest TBCsBest VCRs for captureRestore VHS
    Quote Quote  
  7. Okay, I agree with (denosiy), the approach should probably be:
    a. create a gray mask (if there was a frame with basically no content, so just the dark corners basically, one could take that ( + denoise) gray scale and invert it)
    b. use the mask to adjust the brightness.
    Judging by the sample, you probably will need to create the mask in an image editor.

    You might also be able to use HDR AGC (http://avisynth.nl/index.php/HDRAGC) to lessen the effect. (maybe apply it multiple times)
    (4xHDRAGC with default values helps somewhat)

    Cu Selur
    users currently on my ignore list: deadrats, Stears555, marcorocchini
    Quote Quote  
  8. Video Restorer lordsmurf's Avatar
    Join Date
    Jun 2003
    Location
    dFAQ.us/lordsmurf
    Search Comp PM
    Originally Posted by Selur View Post
    Okay, I agree with (denosiy), the approach should probably be:
    a. create a gray mask (if there was a frame with basically no content, so just the dark corners basically, one could take that ( + denoise) gray scale and invert it)
    b. use the mask to adjust the brightness.
    Judging by the sample, you probably will need to create the mask in an image editor.
    So I've now built a mask from multiple actual video frames.
    And ran an 85% gaussian blur to create a working mask.
    Both are attached.

    The film is color, but the color is all over the place on saturation level.

    Is it really as easy as this:
    Code:
    Overlay(original, brightened, mask=mask)
    (exact syntax?)

    ... or are you suggesting something else?

    HDR may attack the warbly color through, but my main concern is that vignette.

    ________________________

    Just as a note:

    - When the video is dark, it is dark. Muddy. Any tweak to contrast will wash to black.
    - When "normal", there is the center-screen hotspot.
    - When light, it washes into corrupted chroma and harsh bleeding, in addition to blowing out whites.

    ^ This is crappy film>VHS in action. The days where film was converted, then trashed, and all you have left is bad VHS conversions. What you saw was already way, way, way better than the tapes I started from.

    .
    .
    Image Attached Thumbnails Click image for larger version

Name:	Mask Flat.jpg
Views:	23
Size:	211.0 KB
ID:	73087  

    Click image for larger version

Name:	Mask Flat Blur.jpg
Views:	15
Size:	88.1 KB
ID:	73088  

    Want my help? Ask here! (not via PM!)
    FAQs: Best Blank DiscsBest TBCsBest VCRs for captureRestore VHS
    Quote Quote  
  9. I need a shot that's nearly black except for the spot. This needs some more work...

    Image
    [Attachment 73091 - Click to enlarge]
    Quote Quote  
  10. Member Skiller's Avatar
    Join Date
    Oct 2013
    Location
    Germany
    Search PM
    If you do this in 8 Bits per channel, it will introduce some banding.
    Quote Quote  
  11. I built a vignette image by merging frames 550 to ~764. Unfortunately, that section wasn't devoid of detail so I had to massage it a bit. Still not perfect but better. A better shot would give better results. I then subtracted it from the frames, and made some levels adjustments. I didn't address the chroma, only the luma.

    If you make the image greyscale the vignette is essentially gone.

    Image
    [Attachment 73094 - Click to enlarge]
    Image Attached Files
    Quote Quote  
  12. Video Restorer lordsmurf's Avatar
    Join Date
    Jun 2003
    Location
    dFAQ.us/lordsmurf
    Search Comp PM
    @jagabo: dark sample attached.

    @selur: was the 8-bit comment directed at me?

    @all: The most important issue here is to not lose any more detail. If vignette has to stay, then sadly it stays. In photo, this is far easier. In video, not so much. There's really nothing to remove, just add. No Premiere, DaVinci, Avisynth, VirtualDub, none of it. All manual dodging with masking.

    .
    .
    .
    Image Attached Thumbnails Click image for larger version

Name:	Mask Dark Sample.jpg
Views:	13
Size:	205.9 KB
ID:	73095  

    Last edited by lordsmurf; 10th Aug 2023 at 08:12.
    Want my help? Ask here! (not via PM!)
    FAQs: Best Blank DiscsBest TBCsBest VCRs for captureRestore VHS
    Quote Quote  
  13. @selur: was the 8-bit comment directed at me?
    That comment was by Skiller
    users currently on my ignore list: deadrats, Stears555, marcorocchini
    Quote Quote  
  14. Video Restorer lordsmurf's Avatar
    Join Date
    Jun 2003
    Location
    dFAQ.us/lordsmurf
    Search Comp PM
    Originally Posted by Selur View Post
    @selur: was the 8-bit comment directed at me?
    That comment was by Skiller
    That's what happens when you post before having morning coffee.
    Want my help? Ask here! (not via PM!)
    FAQs: Best Blank DiscsBest TBCsBest VCRs for captureRestore VHS
    Quote Quote  
  15. Don't forget Overlay expects the mask to be full range, so after creating it, if it's limited range you should convert it.
    Quote Quote  
  16. Video Restorer lordsmurf's Avatar
    Join Date
    Jun 2003
    Location
    dFAQ.us/lordsmurf
    Search Comp PM
    Originally Posted by hello_hello View Post
    Don't forget Overlay expects the mask to be full range, so after creating it, if it's limited range you should convert it.
    Convert to what, exactly?

    I'm a visual learner. I need to see code, and code in action, and then I can back into it, reverse engineer it, expand on it, etc.
    But it all starts with seeing code. Show me code.
    Want my help? Ask here! (not via PM!)
    FAQs: Best Blank DiscsBest TBCsBest VCRs for captureRestore VHS
    Quote Quote  
  17. Originally Posted by lordsmurf View Post
    Originally Posted by hello_hello View Post
    Don't forget Overlay expects the mask to be full range, so after creating it, if it's limited range you should convert it.
    Convert to what, exactly?
    Full range. Limited range (Y 16 to 235) needs to be converted to full range (Y 0 to 255) to be used as an alpha mask. One way to do this:

    Code:
    Levels(16, 1, 235, 0, 255, coring=false)
    Or if converting an RGB image to YUV:

    Code:
    ConvertToYV12(matrix="pc.601") # or 709
    In my script I didn't use the vignette image as an alpha mask but rather subtracted it from the source:

    Code:
    mt_lutxy(src, sub, expr="X Y - 160 +")
    The addition of 160 at the end was tuned manually.
    Last edited by jagabo; 11th Aug 2023 at 11:07.
    Quote Quote  
  18. Video Restorer lordsmurf's Avatar
    Join Date
    Jun 2003
    Location
    dFAQ.us/lordsmurf
    Search Comp PM
    What about
    Code:
    Overlay(original, brightened, mask=mask)
    I have functional Overlay scripting on another drive, but not available right now. So shooting in dark.

    I get original = file name of video source
    mask = file name of mask jpeg
    Nope, not it.
    What is "brightened"?

    And did you just use the submitted JPEG, or convert first?

    Code:
    overlay(clip=FILE.AVI, overlay=IMAGE.JPEG, mask=? 0-255)
    mode?
    opacity?

    I'm not in mood to code lately, like writer's block. Forcing myself to do some stuff.

    I appreciate the assist.
    Last edited by lordsmurf; 11th Aug 2023 at 11:22.
    Want my help? Ask here! (not via PM!)
    FAQs: Best Blank DiscsBest TBCsBest VCRs for captureRestore VHS
    Quote Quote  
  19. Here's a script that uses lordsmurf's images from post #8 to subtract the bright spot from the original video:

    Code:
    LWLibavVideoSource("vignette.avi", cache=false, prefer_hw=2) 
    src = last
    
    sub = ImageSource("mask flat blur.jpg", start=0, end=0) 
    sub = sub.BilinearResize(src.width, src.height).ConvertToYV16(matrix="pc.601") # why is the image not the same size as the video?
    
    mt_lutxy(src, sub, expr="X Y - 170 +") # subtract the bright spot, then lift levels for blacks at ~Y=16
    
    # analysis
    StackHorizontal(src, last, sub)
    BilinearResize(1920, 480)
    GreyScale()
    TurnRight().Histogram().TurnLeft()
    Image
    [Attachment 73115 - Click to enlarge]
    Quote Quote  
  20. Video Restorer lordsmurf's Avatar
    Join Date
    Jun 2003
    Location
    dFAQ.us/lordsmurf
    Search Comp PM
    This approach isn't going to work. The vignette is now just white instead of black, and it harms the inner image. Whatever is done must not touch the inner at all. While the inner does have some occasional hot spot effect, the inner is mostly exposed fine. It's just the outer with issues.

    What's I'm thinking is this:

    Invert the mask JPG, and then remove all black. It'll then be a white alpha mask at the edges, and feathers. In Photoshop, that's doable, saved as either PNG or PSD.

    Now, in Photoshop, there are layer opacity options for blending. That may be all that's needed here. But what exists for Avisynth? (I'm not sure if Premiere would work here better, never tried this exact operation. Testing it now.)

    I guess I'll have to locate the drive with my overlay scripts

    Any further suggestions or advice appreciated.
    Want my help? Ask here! (not via PM!)
    FAQs: Best Blank DiscsBest TBCsBest VCRs for captureRestore VHS
    Quote Quote  
  21. Originally Posted by lordsmurf View Post
    This approach isn't going to work. The vignette is now just white instead of black
    That's may just a matter of reducing the contrast of the mask before subtracting it. Or it may be more complex if automatic gain control causes the brightness of the vingnette to vary depending on the brightness of the shot (which may be the case here). Similar script but with gain and gamma adjustments to the vignette image (and using my imperfect vignette image based on frames take from the sample):

    Image
    [Attachment 73127 - Click to enlarge]


    Not quite enough vignette removal now. But you should get the idea.

    Originally Posted by lordsmurf View Post
    What's I'm thinking is this:

    Invert the mask JPG, and then remove all black. It'll then be a white alpha mask at the edges, and feathers.
    I subtract the vignette image : X - Y (X is the video, Y is the vignette image). You want to add an inverted inverted vignette image (X + (-Y). That's exactly the same thing.

    Image
    [Attachment 73126 - Click to enlarge]
    Last edited by jagabo; 12th Aug 2023 at 07:36.
    Quote Quote  
  22. Video Restorer lordsmurf's Avatar
    Join Date
    Jun 2003
    Location
    dFAQ.us/lordsmurf
    Search Comp PM
    When you state "just a matter of reducing the contrast of the mask before subtracting it", do you mean altering am Avisynth script value/number, or do you mean altering the blur mask image in Photoshop?

    The vignette is very static, no real AGC to speak of.

    I tried to play with this in Premiere, but I keep running into problems (some user error, some not).
    - I do have the vignette largely hidden in preview.
    - But I need to see what happens to it, after export, and contrast is upped, or brightness dimmed -- ie, does vignette return?
    - Premiere CS4 refuses to open FFV1, all black frames, must encode to larger Huffyuv. Ideas? (ffsdhow long ago installed, FFV1 enabled.)
    - Premiere sucks with film work. I have to take this 20fps source, convert/shift to 24fps, process in Premiere at 24, export 24, then convert/shift back to 20 in Avisynth. I suddenly remember why Premiere is a joke for restoration, beyond color correction for standard formats.

    So still hoping, thinking, Avisynth possible here.
    In Premiere, I have the clip, and then the inverted blur mask image is on the top layer, with Opacity 4.9% using the Lighten blend mode. Can that be repeated here?

    Do note that the video has BOTH vignette and hot spot scenes. I'm not addressing hot spots, too sporadic, not worth addressing. The sample given here often has both going on. That was unintentional, and I simply gave the first generic sample footage that I came across.
    Also, part of the issue here, with your last Avisynth script, is with the sample you're working with. It's too bright, meaning too many bright scenes, and hides the over-bright (over aggressive vignette removal) that is present in all medium or dark frames. At the time, I didn't realize this situation would happen. So I need to acquire a few more samples.

    The script you gave above wasn't what I was expecting. "Hm, that's new." So I've been reading up on it, though still not understanding it well.
    Code:
    mt_lutxy(src, sub, expr="X Y - 170 +")
    Simply altering 170 to any other number just makes matters worse.

    I actually do forget how to turn the black/white gradient to clear/white. Or maybe it's not possible, and I'm remembering wrong. But it may not matter if the Premiere can be replicated, as the Adobe blend modes essentially convert black/white to clear/white gradient.

    So, to sum up, it may be a "simple" matter of recreating Lighten blend mode in Avisynth. What are your thoughts?
    Want my help? Ask here! (not via PM!)
    FAQs: Best Blank DiscsBest TBCsBest VCRs for captureRestore VHS
    Quote Quote  
  23. Originally Posted by lordsmurf View Post
    When you state "just a matter of reducing the contrast of the mask before subtracting it", do you mean altering am Avisynth script value/number, or do you mean altering the blur mask image in Photoshop?
    I did it in AviSynth. After creating the vignette image I used ColorYUV(gain_y=-50, off_y=0, gamma_y=-70) to adjust it. I tried a few different gain and gamma adjustments first until I narrowed it down to that. Of course, you can do the same in some other software and import the adjusted vignette image.

    Originally Posted by lordsmurf View Post
    The vignette is very static, no real AGC to speak of.
    Look at frame 328 and the next few frames. On the scene change from the bright shot to the dark shot the brightness of the dark frames changes over five or so frames. So there is some AGC going on. The vignette subtraction doesn't work as well on that dark shot as it does on the brighter shots.

    Originally Posted by lordsmurf View Post
    Opacity
    Opacity can be done with mt_lutxy() but you have to do it yourself (apply different weights to the two videos). Or you could use Overlay to get different opacities.

    Originally Posted by lordsmurf View Post
    I actually do forget how to turn the black/white gradient to clear/white.
    mt_binarize(N) will turn everything below N to 0, everything above N to 255 (I forget which way N goes). If you just want to turn everything below N black keeping the rest of the gradient ColorYUV(off_y=-N).

    Originally Posted by lordsmurf View Post
    So, to sum up, it may be a "simple" matter of recreating Lighten blend mode in Avisynth. What are your thoughts?
    I don't know exactly what Premiere's Lighten does but AviSynths' Overlay() has a lighten mode.
    Quote Quote  



Similar Threads

Visit our sponsor! Try DVDFab and backup Blu-rays!