HistogramAdjust

From Avisynth wiki
(Difference between revisions)
Jump to: navigation, search
m (Requirements: AviSynth 2.6)
(Updates)
Line 3: Line 3:
  
 
{{Filter3
 
{{Filter3
|1=<!-- author -->[http://www.avisynth.nl/users/vcmohan/ V.C.Mohan]
+
|[http://www.avisynth.nl/users/vcmohan/ V.C.Mohan]
|2=<!-- version -->1.0.0.0.0
+
|25 Aug 2017
|3=<!-- download 2.5.8 version URL -->2.5.8 version[http://www.avisynth.nl/users/vcmohan/HistogramAdjust/HistogramAdjust.zip HistogramAdjust] 2.6.0 alpha5 version URL -->[http://www.avisynth.nl/users/vcmohan/HistogramAdjust/HistogramAdjust_2_6.zip HistogramAdjust]
+
|[http://www.avisynth.nl/users/vcmohan/modPlus/modPlus.7z modPlus.7z]
 
|4=<!-- category -->External filters
 
|4=<!-- category -->External filters
|5=<!-- license -->[http://www.gnu.org/licenses/gpl-2.0.txt GPLv2]
+
|5=<!-- license -->[https://www.gnu.org/licenses/gpl-2.0.txt GPLv2]
|6=<!-- discussion URL -->[http://forum.doom9.org/showthread.php?p=719889#post719889 HistogramAdjust  plugin]}}
+
|6=<!-- discussion URL -->[https://forum.doom9.org/showthread.php?p=719889#post719889 HistogramAdjust  plugin]}}
  
 
<br>
 
<br>
 
== Description ==
 
== Description ==
<!-- a one-sentence description -->
+
<!---->
H and a full description is at [http://www.avisynth.nl/users/vcmohan/HistogramAdjust/HistogramAdjust.html click me].
+
 
<br>
+
This function adjusts the histogram of a frame by either equalizing it or by matching with histogram of another image, or with given histogram table of values.
 +
 
 +
The function accepts RGB, YUY2 and Planar color formats. Clip to be processed and to be used for matching need not have identical color formats and dimensions. For example processing clip can be YV12 , 720 X 480 pixels while matching clip is YUY2, 256 X 16 pixels. However their bit depths must be same.
 +
 
 +
If matching with given table values, then matching clip need not be specified. The second parameter is a table of integer pairs.Each pair consists of Luma ( intensity)value and the second number is %population (type = 3) or %cummulative population (type = 4) at this value.The table is normalized by the function and so approximate values are OK. Not more than 25 pairs can be specified. It will be possible to input by table any desired histogram shape. The plugin linearly interpolates and extrapolates to construct a full normalized histogram from these values. In case of RGB input the selected color histogram is tweaked ( in case all 3 color components of RGB input are to be tweaked the function may be invoked in the script 3 times). For other formats only Y value histogram is tweaked.
 
<br>
 
<br>
 
== Requirements ==
 
== Requirements ==
* <!-- Avisynth version -->AviSynth 2.5.8 or [http://sourceforge.net/projects/avisynth2/ 2.6.0] or greater
+
* AviSynth+ r2347 or greater  
* <!-- source video: progressive  
+
* source video: progressive  
* <!-- color formats -->Supported color formats:  [[YUY2]], [[YV12]], <span style="color:red">*</span>[[YV16]], <span style="color:red">*</span>[[YV24]], <span style="color:red">*</span>[[YV411]], <span style="color:red">*</span>[[Y8]]
+
* color formats -->Supported color formats:  [[YUY2]], [[YV12]],[[YV16]], [[YV24]], [[YV411]], [[Y8]]
: <span style="color:red">*</span> Not available in AviSynth 2.5.8.
+
* <!-- CPU/GPU -->
+
* <!-- binaries -->
+
* <!-- dependent plugins -->
+
<br>
+
"ci*[type]s[table]b[mclip]c[mf]i[window]b[w]i[h]i[limit]i"
+
  
 
== [[Script variables|Syntax and Parameters]] ==
 
== [[Script variables|Syntax and Parameters]] ==
Line 66: Line 64:
  
 
== Examples ==
 
== Examples ==
<!-- example code block: 1st char in each line = space -->
+
 
## This is some example code to blur  an image.
+
:Usage examples:-
imagereader("C:\..........jpg", end = 10)
+
 
a = avisource("C;\..........avi").converttoYUY2()
+
::TweakHist()
converttoyv16()
+
::TweakHist(c, type=2, mclip=mm, mf=26)
# HistogramAdjust matching with given table
+
::TweakHist(c, 15, 2, 30, 12, 50, 33, 90, 12, 150, 35, 200, 10, type=3, limit=50)
m1=HistogramAdjust(1,250,100,570,200,0,type="match",table=true, window=false,w=259,h=255)
+
::TweakHist(20, 1, 150, 100, 255, 110, type=4, limit=70)  
# matching with an image on a frame of another clip
+
:RGB input. Repeated for each color
h2 = HistogramAdjust(type="match",table=false, mclip=a ,mf=1)
+
::TweakHist(limit = 70, rgb = 0)
# Histogram equalization
+
::TweakHist(limit = 70, rgb = 1)
HistogramAdjust()
+
::TweakHist(limit = 50, rgb = 2)
# equalization with limit
+
 
h1 = HistogramAdjust( limit = 80)
+
 
<br>
 
<br>
 
-----------------------------------------------
 
-----------------------------------------------
 
'''Back to [[External_filters|External Filters]] &larr;'''
 
'''Back to [[External_filters|External Filters]] &larr;'''

Revision as of 06:39, 23 April 2018


Abstract
Author V.C.Mohan
Version 25 Aug 2017
Download modPlus.7z
Category External filters
License GPLv2
Discussion HistogramAdjust plugin


Contents

Description

This function adjusts the histogram of a frame by either equalizing it or by matching with histogram of another image, or with given histogram table of values.

The function accepts RGB, YUY2 and Planar color formats. Clip to be processed and to be used for matching need not have identical color formats and dimensions. For example processing clip can be YV12 , 720 X 480 pixels while matching clip is YUY2, 256 X 16 pixels. However their bit depths must be same.

If matching with given table values, then matching clip need not be specified. The second parameter is a table of integer pairs.Each pair consists of Luma ( intensity)value and the second number is %population (type = 3) or %cummulative population (type = 4) at this value.The table is normalized by the function and so approximate values are OK. Not more than 25 pairs can be specified. It will be possible to input by table any desired histogram shape. The plugin linearly interpolates and extrapolates to construct a full normalized histogram from these values. In case of RGB input the selected color histogram is tweaked ( in case all 3 color components of RGB input are to be tweaked the function may be invoked in the script 3 times). For other formats only Y value histogram is tweaked.

Requirements

  • AviSynth+ r2347 or greater
  • source video: progressive
  • color formats -->Supported color formats: YUY2, YV12,YV16, YV24, YV411, Y8

Syntax and Parameters

HistogramAdjust(clip, int array "", string "type", bool "table ",clip mclip",int mf",bool window",int w",int h",int limit")


clip   =
Input clip.


  int array =
table of luma and population pairs in case table is true .


type  string = "equal"
"equal" or "match"


table  bool = false
Whether table of values are specified for matching Histogram.


mclip  clip = clip
Clip with which input clip histogram is to be matched .


mf  int = 0
frame number of mclip with which clip histogram is to be matched .


window  bool = false
Whether windowed equalization is to be done .


w  int = frame width/4
If window is true, width of window (odd number) to be used.


h  int = frame height/4
If window is true, height of window (odd number) to be used.


limit  int = 100
percentage of deviation from original value of luma to be allowed .




Examples

Usage examples:-
TweakHist()
TweakHist(c, type=2, mclip=mm, mf=26)
TweakHist(c, 15, 2, 30, 12, 50, 33, 90, 12, 150, 35, 200, 10, type=3, limit=50)
TweakHist(20, 1, 150, 100, 255, 110, type=4, limit=70)
RGB input. Repeated for each color
TweakHist(limit = 70, rgb = 0)
TweakHist(limit = 70, rgb = 1)
TweakHist(limit = 50, rgb = 2)



Back to External Filters

Personal tools