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.![]()
+ Reply to Thread
Results 1 to 23 of 23
-
Want my help? Ask here! (not via PM!)
FAQs: Best Blank Discs • Best TBCs • Best VCRs for capture • Restore VHS -
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) -
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 -
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 Discs • Best TBCs • Best VCRs for capture • Restore VHS -
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) -
Last edited by lordsmurf; 9th Aug 2023 at 15:35.
Want my help? Ask here! (not via PM!)
FAQs: Best Blank Discs • Best TBCs • Best VCRs for capture • Restore VHS -
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 Selurusers currently on my ignore list: deadrats, Stears555, marcorocchini -
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)
... 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.
.
.Want my help? Ask here! (not via PM!)
FAQs: Best Blank Discs • Best TBCs • Best VCRs for capture • Restore VHS -
I need a shot that's nearly black except for the spot. This needs some more work...
[Attachment 73091 - Click to enlarge] -
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.
[Attachment 73094 - Click to enlarge] -
@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.
.
.
.Last edited by lordsmurf; 10th Aug 2023 at 08:12.
Want my help? Ask here! (not via PM!)
FAQs: Best Blank Discs • Best TBCs • Best VCRs for capture • Restore VHS -
@selur: was the 8-bit comment directed at me?users currently on my ignore list: deadrats, Stears555, marcorocchini
-
Want my help? Ask here! (not via PM!)
FAQs: Best Blank Discs • Best TBCs • Best VCRs for capture • Restore VHS -
Don't forget Overlay expects the mask to be full range, so after creating it, if it's limited range you should convert it.
Avisynth functions Resize8 Mod - Audio Speed/Meter/Wave - FixBlend.zip - Position.zip
Avisynth/VapourSynth functions CropResize - FrostyBorders - CPreview (Cropping Preview) -
Want my help? Ask here! (not via PM!)
FAQs: Best Blank Discs • Best TBCs • Best VCRs for capture • Restore VHS -
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)
Code:ConvertToYV12(matrix="pc.601") # or 709
Code:mt_lutxy(src, sub, expr="X Y - 160 +")
Last edited by jagabo; 11th Aug 2023 at 11:07.
-
What about
Code:Overlay(original, brightened, mask=mask)
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)
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 Discs • Best TBCs • Best VCRs for capture • Restore VHS -
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()
[Attachment 73115 - Click to enlarge] -
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 Discs • Best TBCs • Best VCRs for capture • Restore VHS -
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):
[Attachment 73127 - Click to enlarge]
Not quite enough vignette removal now. But you should get the idea.
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.
[Attachment 73126 - Click to enlarge]Last edited by jagabo; 12th Aug 2023 at 07:36.
-
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 +")
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 Discs • Best TBCs • Best VCRs for capture • Restore VHS -
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.
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.
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.
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).
I don't know exactly what Premiere's Lighten does but AviSynths' Overlay() has a lighten mode.
Similar Threads
-
Camera Out Of Focus, Film Blur After.IS THERE ANY SCRIPTS TO FIX THIS? HELP
By JeremyVN in forum Video ConversionReplies: 1Last Post: 28th Mar 2022, 01:22 -
Fix a badly de-interlaced video (with avisynth if possible)
By Roemer in forum EditingReplies: 3Last Post: 26th May 2021, 07:18 -
Manually fix pan, shift pixels, with Avisynth
By lordsmurf in forum RestorationReplies: 17Last Post: 19th Dec 2020, 09:34 -
Film deblend recovery? (Avisynth)
By lordsmurf in forum RestorationReplies: 16Last Post: 10th Sep 2020, 03:41 -
How do I fix these 3 Problems in Avisynth?
By geordie10 in forum RestorationReplies: 0Last Post: 21st Jul 2019, 04:11