jenkins-bot has submitted this change and it was merged.
Change subject: Add a gradient to FancyCaptcha
......................................................................
Add a gradient to FancyCaptcha
This defeats naive thresholding, giving Tesseract break rate of 0 out of
1000, even if a sensible threshold value is hand-chosen. Reduced the
text value and noise to make room for the gradient, but kept an SNR of
1.3, as before, which provides good legibility.
Obviously the gradient can be removed with custom preprocessing -- the
point of these changes is to raise the bar from "unconfigured Tessearct"
to "some small amount of developer effort".
Change-Id: I30ebc904ca59bf29a2aa812f881a077a13493e68
---
M captcha.py
1 file changed, 4 insertions(+), 3 deletions(-)
Approvals:
Ori.livneh: Looks good to me, approved
jenkins-bot: Verified
diff --git a/captcha.py b/captcha.py
index 22ecd36..222dfb9 100644
--- a/captcha.py
+++ b/captcha.py
@@ -111,12 +111,13 @@
data = noise.load()
for x in range(nsize[0]):
for y in range(nsize[1]):
- r = random.randint(0, 100)
- data[x, y] = r
+ r = random.randint(0, 65)
+ gradient = 70 * x / nsize[0]
+ data[x, y] = r + gradient
# Turn speckles into blobs
noise = noise.resize(im.size, Image.BILINEAR)
# Add to the image
- im = ImageMath.eval('convert(convert(a, "L") / 2 + b, "RGB")', a=im,
b=noise)
+ im = ImageMath.eval('convert(convert(a, "L") / 3 + b, "RGB")', a=im,
b=noise)
# and turn into black on white
im = ImageOps.invert(im)
--
To view, visit https://gerrit.wikimedia.org/r/163072
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I30ebc904ca59bf29a2aa812f881a077a13493e68
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/ConfirmEdit
Gerrit-Branch: master
Gerrit-Owner: Tim Starling <[email protected]>
Gerrit-Reviewer: Ori.livneh <[email protected]>
Gerrit-Reviewer: Tim Starling <[email protected]>
Gerrit-Reviewer: jenkins-bot <>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits