Log in

View Full Version : Need help stacking histograms


novablue
13th March 2023, 21:27
Hello, i want to stack the following histograms to the right side of the video:

Histogram(Mode="Levels")
Histogram(Mode="Color")
Histogram(Mode="Classic")

I am not very good with Avisynth, i tried StackHorizontal() and all sorts of commands but i am just making a mess of it. Here is a demonstration i made in Photoshop how i would like it to look:

https://imgur.com/nVFe49v

It would be much appreciated if someone could help me out with an example script.

FranceBB
13th March 2023, 22:46
And just like magic...

https://i.imgur.com/3PA4PJy.png


use it by calling Novablue() no argument.



Function novablue(clip clp) {
clp

x=Width()
y=Height()
picture=last

levels=Histogram(picture, Mode="Levels").Crop(x, 0, -0, -0)
color=Histogram(picture, Mode="Color").Crop(x, 0, -0, -0)
classic=Histogram(picture, Mode="Classic").Crop(x, 0, -0, -0)

StackVertical(levels, color, classic)
a=Width()
b=Height()
PointResize(a, y)
graph=last

StackHorizontal(picture, graph)

return Last
}



p.s perhaps you'll also find my (and StainlessS') Videotek() (https://github.com/FranceBB/VideoTek/) interesting.


Cheers,
Frank

Reel.Deel
13th March 2023, 23:44
...
levels=Histogram(picture, Mode="Levels").Crop(x, 0, -0, -0)
...



Histogram has the keepsource parameter, when false it only returns the histogram.

Edit:

@novablue, if you don't mind borders, you can use this script.

ColorBarsHD() # your source

src = last
level = Histogram(mode="levels", keepsource=false)
color = Histogram(mode="color", keepsource=false)
histo = Histogram(mode="histogram", keepsource=false)
stack = StackVertical(level, color, histo)

StackHorizontal(AddBorders(src,0,0,0,512), stack)

FranceBB
14th March 2023, 00:28
Histogram has the keepsource parameter, when false it only returns the histogram.

You're absolutely right!
That extra crop could have been avoided!
This is what happens when I try to help people in the middle of the night (yep, it's night over here) XD
Oh, insomnia... my enemy...

novablue
14th March 2023, 03:42
Thanks this has been all very helpful!