Adjusting sharpness calc
This commit is contained in:
@@ -392,11 +392,15 @@ def append_sharpness(sqlfile):
|
||||
def get_sharpness(filename):
|
||||
""" Difference in X, Difference in Y, get smaller diff = smaller sharpness.
|
||||
May change if bugs found.. """
|
||||
small_args="convert ( -define jpeg:size=1024x1024 -resize 1024x1024! -colorspace gray XXX -normalize -equalize ) \
|
||||
|
||||
# Resize to 1024 smaller axis, crop with golden ratio
|
||||
# grayscale and equalize histogram. calculate difference between x neighbor
|
||||
# and y neigbor. smaller difference = less sharp.
|
||||
small_args="convert ( -define jpeg:size=2048x2048 -resize 1024^ -gravity center -crop 62%x62%+0+0 -colorspace gray XXX -equalize ) \
|
||||
( -clone 0 ( -clone 0 -roll +1+0 ) -compose Difference -composite -shave 1x1 ) \
|
||||
( -clone 0 ( -clone 0 -roll +0+1 ) -compose Difference -composite -shave 1x1 ) \
|
||||
-delete 0 -compose Darken -composite -format %[fx:mean*1000] info:".split(" ")
|
||||
small_args[8]=filename+'[0]'
|
||||
small_args[12]=filename+'[0]'
|
||||
p=subprocess.Popen(small_args,stdout=subprocess.PIPE)
|
||||
sharpness, err = p.communicate()
|
||||
return float(sharpness.strip())
|
||||
|
||||
Reference in New Issue
Block a user