示例#1
0
def otsu_grid_search(roi, image, result_points, limbs, **kwargs):
    """
    Algorithm based on sorting parameters of otsu, return processed image and skin score

    Input:
        roi (cropped image)
        image (original image)
        result_points (array of points - contour)
        limbs (array of face limbs coordinates)
    """

    threshs = [190, 200, 210]
    roi = cv2.cvtColor(roi, cv2.COLOR_BGR2GRAY)

    alpha = contrast_val(roi)
    roi = change_constrast(roi, alpha=alpha, beta=-70.0)

    #roi = get_blur(roi, 3)

    key_points = grid_otsu(roi, threshs, delta=2, **kwargs)
    key_points = kpproc.delete_unused_keypoints(roi, key_points, result_points, limbs)
    key_points = kpproc.delete_repeating_points(key_points)

    score = 0.0
    score = kpproc.get_score(image, key_points)
    result_image = draw_circles(image, key_points)

    return result_image, score
示例#2
0
def mono_search(roi, image, result_points, limbs, **kwargs):
    """
    Algorithm based on simple sift and otsu, return processed image and skin score

    Input:
        roi (cropped image)
        image (original image)
        result_points (array of points - contour)
        limbs (array of face limbs coordinates)
        kwargs (otsu parameters)
    """

    roi = cv2.cvtColor(roi, cv2.COLOR_BGR2GRAY)

    alpha = contrast_val(roi)
    roi = change_constrast(roi, alpha=alpha, beta=-70.0)

    #roi = get_blur(roi, 3)

    roi = get_otsu(roi, **kwargs)

    key_points = sift(roi, contrast_threshold=0.035, edge_threshold=5, sigma=1.0)
    key_points = kpproc.delete_unused_keypoints(roi, key_points, result_points, limbs)
    key_points = kpproc.delete_repeating_points(key_points)

    score = 0.0
    score = kpproc.get_score(image, key_points)
    result_image = draw_circles(image, key_points)

    #result_image = roi
    #score = 0

    return result_image, score
示例#3
0
def sift_grid_search(roi, image, result_points, limbs, **kwargs):
    """
    Algorithm based on sorting parameters of sift, return processed image and skin score

    Input:
        roi (cropped image)
        image (original image)
        result_points (array of points - contour)
        limbs (array of face limbs coordinates)
        kwargs (otsu parameters)
    """

    roi = cv2.cvtColor(roi, cv2.COLOR_BGR2GRAY)

    alpha = contrast_val(roi)

    roi = change_constrast(roi, alpha=alpha, beta=-80.0)

    roi_non_contrast = roi
    roi = get_blur(roi, 3)
    roi = get_otsu(roi, **kwargs)

    contrast_thresholds = [0.02, 0.025]
    edge_thresholds = [5]
    sigmas = [1.2, 1.4]

    key_points1 = grid_sift(roi, contrast_thresholds, edge_thresholds, sigmas, delta=3)
    #key_points2 = sift(roi_non_contrast, contrast_threshold=0.035, edge_threshold=5, sigma=1.0)

    key_points1 = kpproc.delete_unused_keypoints(roi, key_points1, result_points, limbs)
    #key_points2 = kpproc.delete_unused_keypoints(roi_non_contrast, key_points2, result_points, limbs)

    #key_points2 = kpproc.combine_points(key_points1, key_points2)
    #key_points1 = key_points1 + key_points2

    key_points1 = kpproc.delete_repeating_points(key_points1)

    score = 0.0
    score = kpproc.get_score(image, key_points1)
    result_image = draw_circles(image, key_points1)

    #score = 0
    #result_image = roi

    return result_image, score, key_points1