logo Sign In

Post #1013314

Author
nightstalkerpoet
Parent topic
Avisynth Scripter/Programmer wanted for Mode Average Plugin
Link to post in topic
https://originaltrilogy.com/post/id/1013314/action/topic#1013314
Date created
26-Nov-2016, 3:19 PM

Just a concept for a mode average plugin - I’ve always thought this would provide better results than a median average, but have never been able to find one and am unsure how to write avisynth plugins - I’m willing to learn but it would take me a while and I think this would be worth someone with more experience compiling quickly.

So, conceptually you’d have a 5 capture average (though with this setup, you would be able to use up to 13 captures. In the case of all different pixel values, even numbers of captures would find the mean of the middle two values, while odd numbers would find the median.)

Finding the mode of each pixel value, A(Pixel Value) corresponds with N(Number of clips with that pixel value), B corresponds with O, C with P, D with Q, E with R.

Initial values are N=1, O=0, P=0, Q=0, R=0 (S,T,U,V,W,X,Y,Z all = 0)

If B=A, N=N+1. If B doesn’t equal A, O=O+1. Check if C exists. If so, go to next line. If not, check if N=O(letter). If so, find the mean of A and B. Otherwise, go to next function.

If C=A, N=N+1. If not, check if C=B. If C=B, O=O+1. If C doesn’t equal B, P=P+1. Check if D exists. If so, go to next line. If not, check if N=O=P. If so, find the median of A,B, and C. Otherwise, go to next function.

If D=A, N=N+1. If not, check if D=B. If D=B, O=O+1. If not, check if D=C. If D=C, P=P+1. If not, Q=Q+1. Check if E exists. If so, go to next line. If not, check if N=O=P=Q. If so, remove the highest and lowest of A-D, and find the mean of the two middle values. Otherwise, go to the next function.

If E=A, N=N+1. If not, check if E=B. If E=B, O=O+1. If not, check if E=C. If E=C, P=P+1. If not, check if E=D. If E=D, Q=Q+1. If not, R=R+1. Check if F exists. If so, go to the next line. If not, check if N=O=P=Q=R. If so, find the median of A-E. Otherwise, go to next function.

SECOND FUNCTION:
Find highest value of N-Z. Select the corresponding pixel value A-M, and report that as the selected pixel value.

Next pixel.

Any thoughts or interest?