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 > Avisynth Development

Reply
 
Thread Tools Search this Thread Display Modes
Old 11th March 2010, 13:46   #41  |  Link
Archimedes
Registered User
 
Join Date: Apr 2005
Posts: 213
Quote:
Originally Posted by EuropeanMan View Post
Any updates on this filter?
No essential updates at the moment. In the meanwhile, if you want to use the layer function for each filter, you can do something like this: Create two scripts with the following content and copy them into the template directory (may be in a subdirectory called "Layer").

"LayerBegin.avs":
Code:
base_clip = last
"LayerEnd.avs":
Code:
# ==============================================================================
# http://avisynth.org/mediawiki/Layer
# ==============================================================================
op         = "add"
level      = 256
threshold  = 255
use_chroma = True
# ==============================================================================

Import("lib\FritzPhoto\FritzPhoto.avs")

base_clip.isYV12() <> isYV12() ? Eval("""
  base_clip = isYV12() ? base_clip.RGB32ToYV12() : base_clip.YV12toRGB32()
""") : Eval("""
  NOP()
""")
base_clip = base_clip.isYV12() ? base_clip.ConvertToYUY2() : base_clip
last = isYV12() ? ConvertToYUY2() : last
Layer(base_clip.Crop(0, 0, last.Width, last.Height), last, op=op, level=level, threshold=threshold, use_chroma=use_chroma)
isYUY2() ? ConvertToYV12() : last
Place "LayerBegin" in front of the used filter and "LayerEnd" afterwards.

Last edited by Archimedes; 11th March 2010 at 13:54.
Archimedes is offline   Reply With Quote
Old 12th March 2010, 13:03   #42  |  Link
Archimedes
Registered User
 
Join Date: Apr 2005
Posts: 213
I made a small update.

Assuming that we have the following filters in our job list:

Code:
Spline36Resize
SuperSlowSharpen
dfttest
If we want to compare the result before SuperSlowSharpen with the result after dfttest there was no way to do this.

I have added context menus to the preview windows. Now, you can refresh each preview window separateley (click on the right mouse button and click on "Refresh").

Last edited by Archimedes; 12th March 2010 at 13:09.
Archimedes is offline   Reply With Quote
Old 22nd April 2010, 20:43   #43  |  Link
Archimedes
Registered User
 
Join Date: Apr 2005
Posts: 213
Added a script inspector. Now you are able to view and edit your parameters outside of an AviSynth script.

Archimedes is offline   Reply With Quote
Old 23rd April 2010, 15:23   #44  |  Link
markanini
Registered User
 
Join Date: Apr 2006
Posts: 299
Thanks for adding median sharpening template. It really adds definition to small detail without too many I'll side effects.

I love following the development of Frtizphoto!

I've had fun "hacking" the NNEDI2 template, replacing strings with 'NNEDI3'. Same with the 'deinterlace' template which I use with 'turnleft' and 'turnright' for antialiasing.
It's indispensable for working with low-res, blocky and aliased images!

How do you use the average function?

Last edited by markanini; 23rd April 2010 at 15:29.
markanini is offline   Reply With Quote
Old 23rd April 2010, 17:02   #45  |  Link
Archimedes
Registered User
 
Join Date: Apr 2005
Posts: 213
Quote:
Originally Posted by markanini View Post
How do you use the average function?
Take "AverageBegin" in front of any filter and "AverageEnd" afterwards. In "AverageEnd" you can adjust the weight parameter. Same behavior with layer function.

Example:

Code:
AverageBegin
dfttest
AverageEnd
Another hint: If you want to hide some parameters from displaying in script inspector, just add a comment with the key word %%ScriptInspectorIgnore%% after the parameter.

Example: If you want to hide the parameter "denoise" (used in "SuperSlowSharpen") in script inspector, do this:

Code:
denoise  = 0 # %%ScriptInspectorIgnore%%
Just uploaded a new update, where i've changed the behavior of reading and writing values through the script inspector.

Last edited by Archimedes; 23rd April 2010 at 20:02.
Archimedes is offline   Reply With Quote
Old 30th April 2010, 14:41   #46  |  Link
Archimedes
Registered User
 
Join Date: Apr 2005
Posts: 213
Removed support for the script "FritzPhotoResize". With the implementation of the script inspector this script is no longer needed.

Depending on the AviSynth type, the script inspector do a simple validation of the input characters.

Added the ability to show tooltips for each parameter and value in script inspector. The information will be stored in the scripts.

A simple tooltip can be achieved with this:

Code:
# ==============================================================================
# http://forum.doom9.org/showthread.php?t=100626
# ==============================================================================
weight = 1.0
# ==============================================================================
# weight = Defines how much influence the previous filter should have
# ==============================================================================
Now, if you are in script inspector mode, you see a tooltip "Defines how much influence the previous filter should have" when your mouse cursor is moving over the parameter or the value.

If you want to show individual tooltips for parameter and its value, do this:

Code:
# ==============================================================================
# http://forum.doom9.org/showthread.php?t=100626
# ==============================================================================
weight = 1.0
# ==============================================================================
# weight = Defines how much influence the previous filter should have | [0.0, 1.0]
# ==============================================================================
Now, you will see "Defines how much influence the previous filter should have" when your mouse cursor is over the parameter and "[0.0, 1.0]" when your mouse cursor is over the value.

Some AviSynth types can only have discret values. For the boolean values "False" and "True" the script inspector automaticly add a pick list. If you want to create a pick list for other values, do this:

Code:
# ==============================================================================
# http://forum.doom9.org/showthread.php?p=1045226
# ==============================================================================
field = 0
# ==============================================================================
# field = PickList, False, {0, 1}
# ==============================================================================
This tells the script inspector, that it should create a pick list with the values 0 and 1. The booelean value "False" means, that the pick list is not readonly (sometimes it's better to put in a value directly and not over the list).

I've added already all pick list information i've found to the templates, but there are no informations for the tooltips at the moment. But the templates are already prepared for that. Keep in mind, that all tooltips have to be translated (from english to german).
Archimedes is offline   Reply With Quote
Old 7th May 2010, 03:28   #47  |  Link
Archimedes
Registered User
 
Join Date: Apr 2005
Posts: 213
Added tooltip informations to the scripts. If you have better explanations for the tooltips, please let me know.

Also added some levels to the script inspector: "Beginner", "Intermediate" and "Expert". An "Expert" see all parameters, an "Intermediate" only the essential parameters and so on.

Script inspector informations are structured as follows (example: GradFun2DBMod):

Code:
# ==============================================================================
# http://forum.doom9.org/showthread.php?t=144537
# ==============================================================================
thr    = 1.2
thrC   = 1.2
mode   = 2
str    = 0.8
strC   = 0.0
temp   = 50
adapt  = 64
custom = "empty"
mask   = True
radius = 2
range  = 2
# ==============================================================================
# thr    = True, False, Beginner, Strength for the luma channel | float
# thrC   = True, False, Beginner, Strength for the chroma channel | float
# mode   = True, False, Beginner, PickList, {1, 2, 3}, Mode for the addition of 16 pixels around the image | int, [1, 3]
# str    = True, False, Beginner, Standard deviation (strength) of the luma noise | float
# strC   = True, False, Beginner, Standard deviation (strength) of the chroma noise | float
# temp   = True, False, Beginner, Strength for temporal stabilization | int
# adapt  = True, False, Beginner, Threshold for luma-adaptative grain | int
# custom = True, False, Expert, PickList, {"empty"}, Use your own grain generator instead of AddGrain | string
# mask   = True, False, Beginner, Adaptative deband mask | bool, {False, True}
# radius = True, False, Beginner, Radius for the mask | int
# range  = True, False, Beginner, Range used in the mask | int
# ==============================================================================
The first boolean value stands for the visibility of the parameter. False means, that the parameter is not visible in the script inspector. The second value means the read only status of the parameter. The third value stands for the level. You have the choice between "Beginner", "Intermediate" and "Expert".

After that there may be a definiton of a pick list. And after that, there can be the information for the tooltips.

If no parameter information is available, the program works with default values. "True, False, Beginner" in a script are identical with this default values.

Last edited by Archimedes; 7th May 2010 at 03:32.
Archimedes is offline   Reply With Quote
Old 9th May 2010, 16:45   #48  |  Link
Archimedes
Registered User
 
Join Date: Apr 2005
Posts: 213
The script inspector can show now a font and color dialog (see script "Subtitle").

Fixed script inspector input checking.

Added a checkbox to disable script inspectors input checking. So you can enter "values" like "1.0/3.0" in a float type field.
Archimedes is offline   Reply With Quote
Old 24th May 2010, 16:34   #49  |  Link
Terka
Registered User
 
Join Date: Jan 2005
Location: cz
Posts: 704
Hi Archimedes. I wonder if is possible/usefull to use temporal filtering on photos. Mean using more shots and combining them using motion compensation scripts.
Terka is offline   Reply With Quote
Old 9th June 2010, 10:53   #50  |  Link
Heaud
Registered User
 
Join Date: Apr 2008
Posts: 58
Is there a script to add borders to an image in order to make it mod4, then removes the added borders? I want to batch run some images with gradfun2dbmod but it gives me errors due to the image size not being mod4.
Heaud is offline   Reply With Quote
Old 9th June 2010, 11:20   #51  |  Link
Archimedes
Registered User
 
Join Date: Apr 2005
Posts: 213
It seems, GradFun2DBMod needs a mod4 input. As we are working with double sized YY12 images, we need mod8 before feeding it to GradFun2DBMod.

In such cases, I simply crop the pixels on the right and bottom side.

Here is the corrected script.

Code:
# ==============================================================================
# http://forum.doom9.org/showthread.php?t=144537
# ==============================================================================
thr    = 1.2
thrC   = 1.2
mode   = 2
str    = 0.8
strC   = 0.0
temp   = 50
adapt  = 64
custom = "empty"
mask   = True
radius = 2
range  = 2
# ==============================================================================
# thr    = True, False, Beginner, Strength for the luma channel | float
# thrC   = True, False, Beginner, Strength for the chroma channel | float
# mode   = True, False, Beginner, PickList, {1, 2, 3}, Mode for the addition of 16 pixels around the image | int, [1, 3]
# str    = True, False, Beginner, Standard deviation (strength) of the luma noise | float
# strC   = True, False, Beginner, Standard deviation (strength) of the chroma noise | float
# temp   = True, False, Beginner, Strength for temporal stabilization | int
# adapt  = True, False, Beginner, Threshold for luma-adaptative grain | int
# custom = True, False, Expert, PickList, {"empty"}, Use your own grain generator instead of AddGrain | string
# mask   = True, False, Beginner, Adaptative deband mask | bool, {False, True}
# radius = True, False, Beginner, Radius for the mask | int
# range  = True, False, Beginner, Range used in the mask | int
# ==============================================================================

LoadPlugin("plugins\AddGrainC\AddGrainC.dll")
LoadPlugin("plugins\GradFun2DB\gradfun2db.dll")
LoadPlugin("plugins\GScript\GScript.dll")
LoadPlugin("plugins\MaskTools 2\mt_masktools.dll")
LoadPlugin("plugins\RemoveGrain 1.0\RemoveGrain.dll")

Import("lib\FritzPhoto\FritzPhoto.avs")
Import("lib\GradFun2DBMod\GradFun2DBMod.avs")

isYV12() ? GEval("""
  fp_GradFun2DBMod(thr, thrC, mode, str, strC, temp, adapt, custom, mask, radius, range)
""") : GEval("""
  if (%%KeepAlphaChannel%%) {
    fp_alpha = last
  }
  else {
    NOP()
  }
  RGB32toYV12()
  fp_GradFun2DBMod(thr, thrC, mode, str, strC, temp, adapt, custom, mask, radius, range)
  if (%%KeepAlphaChannel%%) {
    YV12toRGB32()
    MergeARGB(fp_alpha.Crop(0, 0, last.Width, last.Height), last, last, last)
  }
  else {
    NOP()
  }
""")

function fp_GradFun2DBMod(clip input, float thr, float thrC, int mode, float str, float strC, int temp, int adapt, string custom, bool mask, int radius, int range) {
  input = input.Crop(0, 0, -(input.Width % 8), -(input.Height % 8))

  luma = thr < 1.0 ? input : input.PointResize(input.Width / 2, input.Height / 2).\
    GradFun2DBMod(
      \ thr    = thr,
      \ thrC   = 1.0,
      \ mode   = mode,
      \ str    = str,
      \ strC   = 0.0,
      \ temp   = temp,
      \ adapt  = adapt,
      \ custom = custom,
      \ mask   = mask,
      \ radius = radius,
      \ range  = range
    \ ).\
    PointResize(input.Width, input.Height)

  chroma = thrC < 1.0 ? input : input.\
    GradFun2DBMod(
      \ thr    = 1.0,
      \ thrC   = thrC,
      \ mode   = mode,
      \ str    = 0.0,
      \ strC   = strC,
      \ temp   = temp,
      \ adapt  = adapt,
      \ custom = custom,
      \ mask   = mask,
      \ radius = radius,
      \ range  = range
    \ )

  luma.MergeChroma(chroma, 1)
}
Later on this day I will upload an update with the corrected script. I've also added the new SmoothAdjust plugin.

Last edited by Archimedes; 9th June 2010 at 11:26.
Archimedes is offline   Reply With Quote
Old 9th June 2010, 12:11   #52  |  Link
Archimedes
Registered User
 
Join Date: Apr 2005
Posts: 213
Quote:
Originally Posted by Terka View Post
Hi Archimedes. I wonder if is possible/usefull to use temporal filtering on photos. Mean using more shots and combining them using motion compensation scripts.
Sorry for not answering immediately. I tested this once, but the results was not very impressive. So i gave it up. May be, it was my fault.
Archimedes is offline   Reply With Quote
Old 9th June 2010, 12:45   #53  |  Link
Terka
Registered User
 
Join Date: Jan 2005
Location: cz
Posts: 704
Archimedes, thank you for reply and testing. Have small experience with Fritzphoto, do i understand correctly, the functionality of combining more pictures is available? Where?
Terka is offline   Reply With Quote
Old 9th June 2010, 13:07   #54  |  Link
Archimedes
Registered User
 
Join Date: Apr 2005
Posts: 213
Not implemented at the moment. First i need some feeling of success outside of the program.

Last edited by Archimedes; 9th June 2010 at 13:09.
Archimedes is offline   Reply With Quote
Old 9th June 2010, 14:05   #55  |  Link
Terka
Registered User
 
Join Date: Jan 2005
Location: cz
Posts: 704
eg median could be useful when eg taking a picture of building and want to remove people in the front.
Terka is offline   Reply With Quote
Old 9th June 2010, 14:07   #56  |  Link
Archimedes
Registered User
 
Join Date: Apr 2005
Posts: 213
New update is available.

Changes:
Quote:
lib:
- Removed SmoothLevels.
- Added "blah" - a new sharpening function.

plugins:
- Updated MaskTools 2 and FFmpegSource2.
- Added SmoothAdjust.
- Added MedianBlur (required for "blah").

Templates:
- Changed SmoothLevels.
- Added SmoothCurve and SmoothTweak.
- Fixed GradFun2DBMod (works now with mod4 resolutions).
Archimedes is offline   Reply With Quote
Old 9th June 2010, 14:53   #57  |  Link
Archimedes
Registered User
 
Join Date: Apr 2005
Posts: 213
Quote:
Originally Posted by Terka View Post
eg median could be useful when eg taking a picture of building and want to remove people in the front.
There are many other scenarios, where multiple images can help, like denoising and so on. My problem was, i always got blurred images, when using temporal informations in a script.

May be, the "motion" between the shots was to big.

Last edited by Archimedes; 9th June 2010 at 14:56.
Archimedes is offline   Reply With Quote
Old 10th June 2010, 00:07   #58  |  Link
Heaud
Registered User
 
Join Date: Apr 2008
Posts: 58
The new change to the gradfun2dbmod works fine, no more mod4 errors. One problem I have with it is that there is a loss of pixels. Is there any way to prevent that?
Heaud is offline   Reply With Quote
Old 10th June 2010, 11:44   #59  |  Link
Archimedes
Registered User
 
Join Date: Apr 2005
Posts: 213
Adding (black) borders to an image before filtering and cropping the added borders afterwards is not always a good idea (depends on the filter), so i generally crop the needles pixels at the right and/or bottom side, if needed.

If the missing pixels are a problem for you, just add borders before filtering and crop the added borders afterwards.

Example:
Code:
# clip is RGB32 or (double sized) YV12

m = 4 # must be a power of 2, when clip is YV12
right = Width % m == 0 ? 0 : m - Width % m
bottom = Height % m == 0 ? 0 : m - Height % m

AddBorders(0, 0, right, bottom)

# Filter()

Crop(0, 0, -right, -bottom)

Last edited by Archimedes; 10th June 2010 at 12:09.
Archimedes is offline   Reply With Quote
Old 11th June 2010, 00:42   #60  |  Link
Heaud
Registered User
 
Join Date: Apr 2008
Posts: 58
The script is giving out odd numbers for cropping (if the mod4 remainer is an odd number) and that's causing trouble with cropping. I am not so experienced with scripting so I ask, is there a way to get the right and bottom variables to force even numbers?
Heaud is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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 18:45.


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