Closed Purfview closed 2 years ago
Need more info, because I'm quite unfamiliar - never used - with hysteresis. For example I didn't know that it has anything with corner connections. So because I'm dummy, and do not understand the request, other examples needed for me:
This example should answer your questions:
mask1:
mask2:
maskH (result of hysteresis / mask1 grows into -> mask2 / result not good for me):
Expected result if the corner connections are ignored:
Script:
mask1=ImageReader(file="D:\mask1.png", pixel_type="Y8")
mask2=ImageReader(file="D:\mask2.png", pixel_type="Y8")
maskH=mask1.mt_hysteresis(mask2)
Stackvertical(mask1, mask2.AddBorders(0,2,0,0,$FFFFFF), maskH.AddBorders(0,2,0,0,$FFFFFF))
Forgot one scenario:
mask2:
In expected result that bottom square would disappear.
That's a good idea.
Request registered, I busy with other projects at the moment, pls. ping me if no progress is made in a month, thanks :)
Request registered, I busy with other projects at the moment, pls. ping me if no progress is made in a month, thanks :)
Ping, ping... :)
Yikes! It's time to remember :)
Good news, I'm seeing the expected output in my tests. An additional parameter needed, perhaps 'corners'=true (default) and false for the new working mode? Or a better name?
Nice, no difference for me.
Pls. check v30, if it is O.K. for you as well, then I release it. https://drive.google.com/uc?export=download&id=1VjitVTdJNRw1mYFSJ5Ch3U30PGy3EZhX
It works as expected, just that corners=false is default in v30, should be other way around.
Thanks, next try pls https://drive.google.com/uc?export=download&id=1xAUPCatE4G8MkEaKMSrSP79XR5_sXOL2
Now default is correct. I did some benchmarks, v30.test2 is faster than v30.test1, but it's ~10% slower than v29:
v29 ("corners=true") 4560
v30.test1 corners=false 4084 v30.test1 corners=true 3980
v30.test2 corners=false 4333 v30.test2 corners=true 4070
Nothing has been changed in between. Since v29 Visual Studio 2019 got some months older. Since test1 there has been zero changes. Are you testing with the same type of dlls? (xp/nonxp/clang?) version? EDIT: Anyway, I've rearranged some lines, and the new build regained speed of v29 for corners=true case. I'm gonna upload a new set of dlls (build process of all versions takes ~25-30 minutes on my i7)
Strange, I ran dozens of times, results fluctuated around ~0.5%.
AVSMeter 3.0.7.0 (x86) AviSynth+ 3.7.1 (r3556, master, i386) dlls from "x86" folder CPU supports AVX (no AVX2)
mask1:
mask2:
mask1=ImageReader(file="D:\mask1.png", pixel_type="Y8").loop(100)
mask2=ImageReader(file="D:\mask2.png", pixel_type="Y8").loop(100)
maskH=mask1.mt_hysteresis(mask2, corners=true)
maskH
New v30 build https://drive.google.com/uc?export=download&id=1-qYyGEqJci2RmDl5MLymkLZv07-dZuJE EDIT: there is no SIMD acceleration inside. I was testing x64
Nice rearrangement, now it's even faster than v29:
v29 ("corners=true") 4560
v30.test1 corners=false 4084 v30.test1 corners=true 3980
v30.test2 corners=false 4333 v30.test2 corners=true 4070
v30.test3 corners=false 4854 v30.test3 corners=true 4680
Thank you. Now I need to remember where and when I needed it and test it in the real world. :)
Would it be possible to make hysteresis2 func which would ignore the corner connections?
For example a mask with a single square wouldn't grow into the both squares: