Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
if px >= hi:
thres[i][j] = strong
strongs.append((i, j))
elif px >= lo:
thres[i][j] = weak
return thres, strongs
if __name__ == '__main__':
from sys import argv
if len(argv) < 2:
print "Usage: python %s <img>" % argv[0]
exit()
im = array(Image.open(argv[1]))
im = im[:, :, 0]
gim = gaussian(im)
grim, gphase = gradient(gim)
gmax = maximum(grim, gphase)
thres = thresholding(gmax)
gray()
subplot(1, 2, 1)
imshow(im)
axis('off')
title('Original')
subplot(1, 2, 2)
imshow(thres[0])
axis('off')
title('Double thresholding')
show()
gmax[i][j] = det[i][j]
# 135 degrees
if (phase[i][j] >= 112.5 and phase[i][j] < 157.5) or (phase[i][j] >= 292.5 and phase[i][j] < 337.5):
if det[i][j] >= det[i - 1][j - 1] and det[i][j] >= det[i + 1][j + 1]:
gmax[i][j] = det[i][j]
return gmax
if __name__ == '__main__':
from sys import argv
if len(argv) < 2:
print "Usage: python %s <img>" % argv[0]
exit()
im = array(Image.open(argv[1]))
im = im[:, :, 0]
gim = gaussian(im)
grim, gphase = gradient(gim)
gmax = maximum(grim, gphase)
gray()
subplot(2, 2, 1)
imshow(im)
axis('off')
title('Original')
subplot(2, 2, 2)
imshow(gim)
axis('off')
title('Gaussian')
subplot(2, 2, 3)
imshow(grim)
def output(cursor, by_binary_list, whitelist_avg, blacklist_avg):
""" Print out a report for the output of malfunction
cursor - database cursor
by_binary_list - list of strong matching binaries
whitelist_avg - the whitelist score
blacklist_avg - the blacklist score"""
score = whitelist_avg - blacklist_avg
print("Whitelist Average: " + str(whitelist_avg))
print("Blacklist Average: " + str(blacklist_avg))
print(" Score: " + str(score))
gradient.gradient(score)
possible_filenames = []
possible_authors = []
comments = []
for binary_id in by_binary_list:
cursor.execute("SELECT author,filenames,comment FROM "
"binaries WHERE binaryID=?", (binary_id, ))
binary_entry = cursor.fetchone()
if binary_entry[0] not in possible_authors and binary_entry[0]:
possible_authors.append(binary_entry[0])
if binary_entry[1] not in possible_filenames and binary_entry[1]:
possible_filenames.append(binary_entry[1])
if binary_entry[2] not in comments and binary_entry[2]:
comments.append(binary_entry[2])
if possible_authors:
print("***Possible Authors of this binary***")