Created
April 18, 2018 22:25
-
-
Save nibalizer/c7b0b8c7d594a148bf121e78c7d9f403 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# python test_for_black_bar.py 06da390c-606f-4adf-961d-444968ced5af_5.png debug/aeee37b5-28f6-4be7-af2e-9cafb763072f_3.png $(ls -d -1 debug/* | sort -R | tail -n 1000) | |
from PIL import Image | |
import sys | |
import math | |
for _file in sys.argv[1:]: | |
im = Image.open(_file).convert('L') | |
#print im.format, im.size, im.mode | |
px = im.load() | |
left = px[15, 9] | |
center = px[16,9] | |
right = px[17,9] | |
#print "left %s, center %s, right %s" % (left, center, right) | |
# values are low (dark) to high (light) so a high, low, high sequence | |
# of pixels is what a line looks like | |
# if left and right are within 10% | |
# AND | |
# if center is 25% less than left and right | |
# that looks like a line | |
if 0.90 * right < left < 1.10 * right: | |
if center < 0.75 * right: | |
print "Possible 'joined' photo %s" % _file | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment