Skip to content
This repository has been archived by the owner on Sep 29, 2024. It is now read-only.

Commit

Permalink
ok with cleans... size.
Browse files Browse the repository at this point in the history
however, either cleansm, cleanst have upix ratio shrinken from original.
  • Loading branch information
bitsofcotton committed Apr 11, 2024
1 parent 4a19a1e commit 7b364fe
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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... .

12 changes: 9 additions & 3 deletions test.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"])

0 comments on commit 7b364fe

Please sign in to comment.