From 7b364fe097326ed67c352f51742b054fde2b7c05 Mon Sep 17 00:00:00 2001 From: bitsofcotton <22259589+bitsofcotton@users.noreply.github.com> Date: Thu, 11 Apr 2024 19:01:19 +0900 Subject: [PATCH] ok with cleans... size. however, either cleansm, cleanst have upix ratio shrinken from original. --- README.md | 1 + test.py | 12 +++++++++--- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 74a71cd8..f144a95e 100644 --- a/README.md +++ b/README.md @@ -79,4 +79,5 @@ Searching the Internet more... 2024/04/07 compatible with latest ddpmopt, it's obscure cleans size, so do half of the size. 2024/04/09 fix lieonn some functions, merge from ddpmopt. 2024/04/10 fit ddpmopt/README.md's function entropy size with cleans... command. +2024/04/11 make around .95 probability on best case with cleans... . diff --git a/test.py b/test.py index 1b79f2dd..32a41836 100644 --- a/test.py +++ b/test.py @@ -192,17 +192,23 @@ upix = pow(19683 / 8., .5) upixr = upix / pow(w * h, .5) sz = str(int(upixr * w) + 1) + "x" + str(int(upixr * h) + 1) + # N.B. + # refering en.wikipedia.org/wiki/Condorcet's-jury-theorem + # n ~ 11 to get .95 from 2/3 probability. + # This is enough if it's from probability based concerns. + # However, in deterministic meaning, we might use cj == upix as well. + cj = int(pow(11, .5) + 1) # Thanks: # R.B. https://www.imagemagick.org/Usage/filter/nicolas/#downsample # From googling, via https://qiita.com/yoya/items/b1590de289b623f18639 . if(argv[2][- 1] == "q"): subprocess.call(["convert", line, "-filter", "LanczosRadius", "-distort", "Resize", sz, "-despeckle", "+sigmoidal-contrast", "7.5", "-filter", "LanczosRadius", "-distort", "Resize", str(w) + "x" + str(h) + "!", "-sigmoidal-contrast", "7.5", root + "-cleansq.png"]) elif(argv[2][- 1] == "l"): - subprocess.call(["convert", line, "+sigmoidal-contrast", "7.5", "-filter", "LanczosRadius", "-distort", "Resize", str(int(upix * upixr * w + 1)) + "x" + str(int(upix * upixr * h + 1)), "-sigmoidal-contrast", "7.5", root + "-cleansl.png"]) + subprocess.call(["convert", line, "+sigmoidal-contrast", "7.5", "-filter", "LanczosRadius", "-distort", "Resize", str(int(cj * upixr * w + 1)) + "x" + str(int(cj * upixr * h + 1)), "-sigmoidal-contrast", "7.5", root + "-cleansl.png"]) elif(argv[2][- 1] == "m"): - subprocess.call(["convert", line, "+sigmoidal-contrast", "7.5", "-resize", str(int(upix * upixr * w) + 1) + "x" + str(int(upixr * h) + 1) + "!", "-sigmoidal-contrast", "7.5", root + "-cleansm.png"]) + subprocess.call(["convert", line, "+sigmoidal-contrast", "7.5", "-resize", str(int(cj * cj * upixr * w) + 1) + "x" + str(int(upixr * h) + 1) + "!", "-sigmoidal-contrast", "7.5", root + "-cleansm.png"]) elif(argv[2][- 1] == "t"): - subprocess.call(["convert", line, "-resize", str(int(w / upix)) + "x" + str(h) + "!", "-despeckle", "-equalize", "-despeckle", root + "-cleanst.png"]) + subprocess.call(["convert", line, "-resize", str(int(w / cj / cj)) + "x" + str(h) + "!", "-despeckle", "-equalize", "-despeckle", root + "-cleanst.png"]) else: subprocess.call(["convert", line, "-filter", "LanczosRadius", "-distort", "Resize", sz, "-despeckle", "-equalize", "-despeckle", root + "-cleans.png"])