Prof. Dr. Jakob Beetz

Elif Akbas | Mohammed Albaaj

for filename in glob.glob(os.path.join(folder_path + '/Input-Set/', '*')):

sharpness = np.average(gnorm)

brightness = sum([R, G, B]) / 3  ##0 is dark (black) and 255 is bright (white)

width, height = im.size

img_log = (np.log(blur + 1) / (np.log(1 + np.max(blur)))) * int(brightnessItr / 2 )

gray = cv2.cvtColor(enhanced_image, cv2.COLOR_BGR2GRAY)

blur = cv2.blur(gray, (9, 9))

# Image smoothing: bilateral filter

bilateral = cv2.bilateralFilter(img_log, int(sharpnessItr) , int(sharpnessItr) * 5, int(sharpnessItr) * 5)

 

# Canny Edge Detection

edges = cv2.Canny(bilateral, int(sharpnessItr) , int(sharpnessItr) * 2 )

 

# Morphological Closing Operator

kernel = np.ones((int(100 / brightnessItr), 4), np.uint8)

closing = cv2.morphologyEx(edges, cv2.MORPH_CLOSE, kernel)

15.PNG

    for sharpnessItr in np.linspace(sharpness*50/100, sharpness*150/100, num=4):

      for brightnessItr in np.linspace(brightness*50/100, brightness*200/100, num=4):

m, s = compare_images(cv2.cvtColor(img, cv2.COLOR_BGR2GRAY),

cv2.cvtColor(featuredImg, cv2.COLOR_BGR2GRAY), "Original vs. Crack")