F1Quiver & F1QTest


Author V. C. Mohan
Date May 2021
EMail: mohanvc

The freq domain filter functions require FFTw3f 32 bit dll or for 64 bit FFTw3f 64 bit dll, to be in the path. The F1Quiver filters the image row by row, in one dimensional frequency domain. Filters can be either Gaussian, or Butterworth or custom designed in frequency domain. Noise that appears vertically or sub vertically aligned (noise really is row wise) is filtered.


The freq values must correspond to what is indicated by ruler in F1QTest.

Standard filters included are low cut (high pass), highcut (low pass), band stop, band pass and notch reject filters of either Gaussian or Butterworth type. Up to 15 of these standard filters can be cascaded. Filter can also be custom (user) designed.instead of using the Cascadable standard filters. The custom designed filter is smoothed by 5 point average.

Each Standard filter is specified by a 4 integer set:
First integer value 1. low cut (high pass) 2. high cut or (low pass), or 3 band pass or 4. band stop or 5 notch (reject).
The Second value is the frequency 1 , 50% amplitude cut off or center frequency of notch filter.
The third value is freq2 value to be used for band pass or band stop and must be specified even if not relevant.


The fourth value if 0 then Gaussian Filter. Otherwise degree of sharpness of Butterworth filter.

Upto 15 X 4 such values can be specified. Each filter cascades over other

In May 2021 added another filter type. If the first value is zero, then the second is freq1, the third is freq2, and the 4th value is by how much the amplitude is attenuated between freq1 and freq2. 0 means no attennuation, 1 is for 1/ 2, 2 for 1/ 3 and so on 12 is for 1/ 13.

Alternatively by opting for Custom, filter is specified by a sereis of frequency and amplitude pairs . The first amplitude value is back ward propogated upto zero freq, and the last pair amplitude is propogated up to the nyquist frequency. The frequency values must increase monotonically. The custom filter is smoothed with 5 point average ..

F1QTest function displays in left half of frame, the averaged power spectrum of specified row(s) in two panels, top one with gamma scale and specified filter profile. Lower panel shows unscaled (only normalized) version. In the other half of frame the remaining part of input image is shown. A horizontal ruler with graduations (100s, 50s and 10s) assist in specifying frequency values.

The spectral display will be averaged spectrum of starting row to end row. This smmothes out a lot of noise and brings out persistent frequencies.

Presence of sharp high amplitude objects (such as logos) can create severe ringing due to filtering. A sharp discontinuity requires all frequencies of spectrum to be present. Any filtering that affects the balance can create undesirable ringing. If possible cropping and re joining after processing may be useful in those cases.

With the option 'morph' set to true, homomorphic filtering can be done.

F1QTest and F1QUiver accepts Only Planar Y U V or packed RGB formats. F1QTest uses Y of YUV or G of RGB formats for analysis. F1Quiver on the other hand filters all 3 colors of RGB and if opted Y, U, V of YUV444 formats. For other YUV formats only Y is filtered. Parameters for both functions are identical (ignored by the functions if not needed, but will not raise error messages)so that just name change in script facilitates switching between these two functions seamlessly

parameters


Details of parameters
Description Name Type Limits Default
Input clip clip YUY2 not accepted none
Array of values sets of integers. For "custom" pairs of frequency and percentage amplitude must follow. Each standard filter has a set of 4 values need not be specified for F1QTest none
Is filter of custom design? custom boolean true or false false
whether homomorphic filtering is to be done? morph boolean true or false false
Starting Row number of frame to use for F1QTest. Ignored by F1Quiver row integer within frame height top row
Ending Row number of frame to use for F1QTest. Ignored by F1Quiver erow integer not less than 'row' and within frame height row + 50
gamma value to be used for scaling spectrum F1QTest. Ignored by F1Quiver gamma float 1.0 is no scaling 0.1
Whether Planar U and V planes also to be filtered . Ignored by F1QTest uv boolean true, false false

Usage examples:-
F1QTest()
#F1QTest(25,100,34,0,42,0, 54,100,row = 155, erow=250,custom = true,gamma =0.2)
#F1Quiver(25,100,34,0,42,0, 54,100, custom = true)
F1Quiver(5,39,200,1, uv = true)
# After TurnLeft(),one of the two following script lines can be used to solve
#the problem shown in thread stripes
a =F1Quiver(0,21,28,12, 0, 70, 80, 6,0,120,130,4)
b =F1Quiver(0,100,20,100,25,0,30,0,38,100,40,100,60,100,75,0,82,0,87,100,100,100, custom = true,morph = false)
in image on left is input, middle is F1Quiver output and right is F1QTest display. The spikes in frequencies are to be attenuated and shown in freq spectrum. The white lines are the attenuations applied at step a
To my index page down load plugin To Avisynth