Welcome to Doom9's Forum, THE in-place to be for everyone interested in DVD conversion.

Before you start posting please read the forum rules. By posting to this forum you agree to abide by the rules.

 

Go Back   Doom9's Forum > Capturing and Editing Video > VapourSynth
Register FAQ Calendar Today's Posts Search

Reply
 
Thread Tools Search this Thread Display Modes
Old 30th August 2021, 21:02   #41  |  Link
zorr
Registered User
 
Join Date: Mar 2018
Posts: 447
Quote:
Originally Posted by vcmohan View Post
The documentation for these two filters (F1QClean and F1QLimit) are revised. Please check now. Thanks for pointing out the errors. regards.
Thanks, I'll test them.
zorr is offline   Reply With Quote
Old 3rd September 2021, 09:16   #42  |  Link
sl1pkn07
Pajas Mentales...
 
Join Date: Dec 2004
Location: Spanishtán
Posts: 496
hi

now fails with:

Code:
vcm.cpp:91:10: fatal error: Mean.cpp: No such file or directory
   91 | #include "Mean.cpp"
      |          ^~~~~~~~~~
compilation terminated.
greetings
__________________
[AUR] Vapoursynth Stuff
[AUR] Avisynth Stuff
sl1pkn07 is offline   Reply With Quote
Old 4th September 2021, 14:06   #43  |  Link
vcmohan
Registered User
 
Join Date: Jul 2003
Location: India
Posts: 890
Quote:
Originally Posted by sl1pkn07 View Post
hi

now fails with:

Code:
vcm.cpp:91:10: fatal error: Mean.cpp: No such file or directory
   91 | #include "Mean.cpp"
      |          ^~~~~~~~~~
compilation terminated.
greetings
Sorry. I included it now. Hope no more misses. I am somewhat overwhelmed with this. I have to seriously learn to use GitHub.
__________________
mohan
my plugins are now hosted here
vcmohan is offline   Reply With Quote
Old 5th September 2021, 18:29   #44  |  Link
sl1pkn07
Pajas Mentales...
 
Join Date: Dec 2004
Location: Spanishtán
Posts: 496
sorry vcmohan, but still fails

https://sl1pkn07.wtf/paste/view/raw/e14324ca

greetings
__________________
[AUR] Vapoursynth Stuff
[AUR] Avisynth Stuff
sl1pkn07 is offline   Reply With Quote
Old 5th September 2021, 19:22   #45  |  Link
Myrsloik
Professional Code Monkey
 
Myrsloik's Avatar
 
Join Date: Jun 2003
Location: Kinnarps Chair
Posts: 2,555
Quote:
Originally Posted by sl1pkn07 View Post
sorry vcmohan, but still fails

https://sl1pkn07.wtf/paste/view/raw/e14324ca

greetings
Why are you trying to compile windows only code on not windows?
__________________
VapourSynth - proving that scripting languages and video processing isn't dead yet
Myrsloik is offline   Reply With Quote
Old 5th September 2021, 21:56   #46  |  Link
sl1pkn07
Pajas Mentales...
 
Join Date: Dec 2004
Location: Spanishtán
Posts: 496
then unixDynamicLinkingCodeForFFT.cpp is for?
__________________
[AUR] Vapoursynth Stuff
[AUR] Avisynth Stuff
sl1pkn07 is offline   Reply With Quote
Old 7th September 2021, 13:45   #47  |  Link
vcmohan
Registered User
 
Join Date: Jul 2003
Location: India
Posts: 890
Quote:
Originally Posted by sl1pkn07 View Post
then unixDynamicLinkingCodeForFFT.cpp is for?
Sorry. It is not required. Long time back tried to convert to Unix. That is a remnant. Please ignore or delete.
__________________
mohan
my plugins are now hosted here
vcmohan is offline   Reply With Quote
Old 11th September 2021, 08:42   #48  |  Link
vcmohan
Registered User
 
Join Date: Jul 2003
Location: India
Posts: 890
I have added two functions to this plugin. 1. CorrectLD and 2. Circles.
CorrectLD is short for correct Lens Distortion. This includes barrel, pincushion , different formula to the DeBarrel, and also fish eye. Fish eye correction can be done with 4 methods viz: Orthoganal, Linear, equisolid and panaromic. Normal images can also be convereted to fish eye images by this function. In test mode dots on original image show the area covered and curvatures. This function takes in 3 parameters diameter, fk and rix. Test mode may be useful to decide upon parameters to use.
Circles just draws circles on image and may be useful to specify center of a circular curvature seen in fish eye images which have been edited.
For the image from mars used in a post above the following code may be tried.
Code:
##ret=core.imwri.Read ( r'C:\images\fisheye.jpg')
##ret = core.std.AddBorders(ret,270,270,670,0)
##ret = core.vcm.Circles(ret, dim = 0.5,dots = 1,xo = 870, yo = 1270, fdia = 2800, cint =50)
##ret = core.vcm.CorrectLD(ret, test = 0,dim = 0.5,dots = 2, method = 3,q = 4, fk = 2.804825, rix = 1.25,xo = 870, yo = 1270, fdia = 2800)
##ret = core.vcm.CorrectLD(ret, test = 0,dim = 0.5,dots = 2, method = 4,q = 4, fk = 2.804825, rix = 1.25,xo = 870, yo = 1270, fdia = 2500)
##ret = core.vcm.CorrectLD(ret, test = 0,dim = 0.5,dots = 2, method = 5,q = 4, fk = 2.804825, rix = 1.25,xo = 870, yo = 1270, fdia = 2500)
##ret = core.vcm.CorrectLD(ret, test = 0,dim = 0.5,dots = 2, method = 6,q = 4, fk = 3.04825, rix = 1.25,xo = 870, yo = 1270, fdia = 2500)
Request feed back on features or bugs.
@selur may look into. I have some reservation in why should a horizontal horizon be strived at? It should remain circular I think.
__________________
mohan
my plugins are now hosted here
vcmohan is offline   Reply With Quote
Old 17th September 2021, 13:54   #49  |  Link
Selur
Registered User
 
Selur's Avatar
 
Join Date: Oct 2001
Location: Germany
Posts: 7,277
Thanks new function seems to work fine.
I think the horizontal horizont is simply something one would expect when looking at a horizont.
__________________
Hybrid here in the forum, homepage
Selur is offline   Reply With Quote
Old 17th September 2021, 14:07   #50  |  Link
vcmohan
Registered User
 
Join Date: Jul 2003
Location: India
Posts: 890
If one sees all around the horizontal horizon should be all around so must be circular. From a paper from Pune University I read a scheme to make the circle fit into a rectangle. Possibly it has made the change in deFish fitxy. I will try a different procedure and check. Will take some time.
__________________
mohan
my plugins are now hosted here
vcmohan is offline   Reply With Quote
Old 18th September 2021, 00:07   #51  |  Link
zorr
Registered User
 
Join Date: Mar 2018
Posts: 447
Quote:
Originally Posted by vcmohan View Post
The documentation for these two filters (F1QClean and F1QLimit) are revised. Please check now.
Still testing these but it's already clear that the latest version gives different results, was that intentional?

Also a small documentation error, minimum allowed span seems to be 3 and not 5.
zorr is offline   Reply With Quote
Old 20th September 2021, 14:09   #52  |  Link
vcmohan
Registered User
 
Join Date: Jul 2003
Location: India
Posts: 890
Quote:
Originally Posted by zorr View Post
Still testing these but it's already clear that the latest version gives different results, was that intentional?
Different in what way? If you run F1Quiver test prior and after to applying these filters you will notice the the changes in freq spectra. If the results are not as expected please inform me. I am forgetting things and do not recall what other changes I might have made.

Quote:
Also a small documentation error, minimum allowed span seems to be 3 and not 5.
I will correct it next upload. Thanks for pointing out. I was debating whether to use 3 or 5 as minimum.
__________________
mohan
my plugins are now hosted here
vcmohan is offline   Reply With Quote
Old 25th September 2021, 18:30   #53  |  Link
zorr
Registered User
 
Join Date: Mar 2018
Posts: 447
Quote:
Originally Posted by vcmohan View Post
If you run F1Quiver test prior and after to applying these filters you will notice the the changes in freq spectra.
Thanks, is there a way to only show the test display (test=1) without any processing? That would be needed to show before and after differences of F1QLimit. Argument filter is compulsory and cannot be an empty array, also I wasn't able to find a combination of filter settings which don't do any changes.
zorr is offline   Reply With Quote
Old 27th September 2021, 13:50   #54  |  Link
vcmohan
Registered User
 
Join Date: Jul 2003
Location: India
Posts: 890
I probably did not understand clearly. One can compare the unprocessed input and processed output by using StackHorizontal(input, output) If I remember correct in F1Quiver test in test mode custom filter 0,100,512,100 should not do any filtering.
__________________
mohan
my plugins are now hosted here
vcmohan is offline   Reply With Quote
Old 27th September 2021, 22:36   #55  |  Link
zorr
Registered User
 
Join Date: Mar 2018
Posts: 447
Quote:
Originally Posted by vcmohan View Post
I probably did not understand clearly. One can compare the unprocessed input and processed output by using StackHorizontal(input, output) If I remember correct in F1Quiver test in test mode custom filter 0,100,512,100 should not do any filtering.
You understood correctly, I needed the filter settings which don't touch the output. However your example doesn't work, there's an error message "F1Quiver: degree the sharpness value of filter pair should be 1 to 12 only". I tried changing the last parameter (the sharpness) to 1 and 12 but the resulting filter does changes in both cases.

By the way I'm testing if there are any changes with

Code:
video2 = core.vcm.F1Quiver(video, filter=[0,100,512,1], test=0)
diff = core.std.MakeDiff(video, video2, planes=0)
diff = core.std.Expr(clips=[diff], expr=f"x 128 = 0 255 ?")
diff.set_output()
which will display white where video2 is not identical to video and black where it is.
zorr is offline   Reply With Quote
Old 29th September 2021, 13:56   #56  |  Link
vcmohan
Registered User
 
Join Date: Jul 2003
Location: India
Posts: 890
try with
video2 = core.vcm.F1Quiver(video, filter=[10,100,50,100], test=0, custom = 1)
It will propagate values back and forward. Essentially there should be no filtering. However as all values are converted into floating point and back there can be round off errors and should be minor.
__________________
mohan
my plugins are now hosted here
vcmohan is offline   Reply With Quote
Old 2nd October 2021, 22:29   #57  |  Link
zorr
Registered User
 
Join Date: Mar 2018
Posts: 447
Quote:
Originally Posted by vcmohan View Post
try with
video2 = core.vcm.F1Quiver(video, filter=[10,100,50,100], test=0, custom = 1)
Thanks, it works.

So I made a comparison of F1QLimit versions, the settings used were

Code:
core.vcm.F1QLimit(video, limit=80, span=7, freqs=[29])
Below you can see the original frame, F1QLimit dated 2021-05-31 and the latest version dated 2021-09-13. It looks like they manipulate the same frequencies but the older version has a much stronger effect.


Last edited by zorr; 3rd October 2021 at 00:39. Reason: Wrong function name
zorr is offline   Reply With Quote
Old 3rd October 2021, 01:04   #58  |  Link
MysteryX
Soul Architect
 
MysteryX's Avatar
 
Join Date: Apr 2014
Posts: 2,559
Just ran some benchmark on my script.

Code:
Script evaluation done in 10.57 seconds
Output 30 frames in 29.24 seconds (1.03 fps)
Filtername           Filter mode   Time (%)   Time (s)
Median               parallel       504.36     147.47
Analyse              parallel        48.44      14.16
Analyse              parallel        47.72      13.95
Analyse              parallel        47.69      13.94
Analyse              parallel        47.49      13.88
Analyse              parallel        46.58      13.62
Analyse              parallel        45.95      13.44
KNLMeansCL           parreq          43.67      12.77
I'm not happy. vcm.Median is a prefilter to a prefilter to a prefilter, before doing MDegrain analysis. What would be a MUCH faster alternative? Plain Convolution matrix?

Edit: this actually gives me better results than Median
Code:
std.Convolution(matrix=[1, 2, 1, 2, 4, 2, 1, 2, 1])

Last edited by MysteryX; 3rd October 2021 at 01:13.
MysteryX is offline   Reply With Quote
Old 4th October 2021, 13:47   #59  |  Link
vcmohan
Registered User
 
Join Date: Jul 2003
Location: India
Posts: 890
Quote:
Originally Posted by MysteryX View Post
Just ran some benchmark on my script.

Code:
Filtername           Filter mode   Time (%)   Time (s)
Median               parallel       504.36     147.47
I'm not happy. vcm.Median is a prefilter to a prefilter to a prefilter, before doing MDegrain analysis. What would be a MUCH faster alternative?
[/code]
As mentioned in the description of vcm.Median
starting value of grid is 3 i.e. 3x3 pixels.
Compute max, min and median of the grid
1. if median is more than minimum and less than maximium:-
if the grid center value is greater than minimum and less than maximum,the value is not changed
Otherwise center value of grid is replaced by median.
2 else:-
if grid size is less than maxgrid, it is increased to next step and process repeated.
Otherwise center value is unchanged.

As per theory
Quote "Ordinary median filters perform well as long as the spatial density of impulsive noise is small. Adaptive Median filter can handle impulsive noise having larger probability. An additional benefit is this seeks to preserve detail while smoothing non impulse noise something that the traditional median filter does not do.

The algorithm described has three purposes.
1.To remove salt and pepper (impulse) noise.
2.To smooth other noise which may not be impulsive
3.To reduce distortion such as excessive thinning or thickening of object boundaries.
" unquote
It will be slow depending on the type and intensity of noise present.
I will look into the code again and see if I can improve speed.
__________________
mohan
my plugins are now hosted here
vcmohan is offline   Reply With Quote
Old 4th October 2021, 16:31   #60  |  Link
MysteryX
Soul Architect
 
MysteryX's Avatar
 
Join Date: Apr 2014
Posts: 2,559
Thanks, it helps to know what it's supposed to do to put it at the right place.

With 4K/5K videos, I actually have that problem where the noise is only removed locally (stabilized) but larger visible grain patterns are very hard to address.

You could test with this short 5K clip

Here's another one with more severe noise

With Median at the start of the denoising on the first clip, I'm seeing a slight improvement with Median(maxgrid=9)... but not really with maxgrid=5. Could be useful if it wasn't such a performance pit.

Last edited by MysteryX; 4th October 2021 at 16:45.
MysteryX is offline   Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 22:11.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.