Пример #1
0
def unify_localLum():
    ## template image
    templateImg = "../white_box2"
    ## load template image to array
    templateImg_mat = image_to_array(templateImg)

    ## masking
    mask43_fname = "../mask_ShLi_43"  # standard: within shadow, light check
    mask35_fname = "../mask_PlDa_35"  # comparison dark: outside shadow, dark check

    ## load mask images to array
    mask43 = image_to_array(mask43_fname)
    mask35 = image_to_array(mask35_fname)

    ## set entire checks with values read from center coordinates of each target check
    # S, check 43 : position=(428,585)
    # CD, check 35 : position=(337,442)
    # CL, check 32 : position=(477,435)
    # CDD, check 26 : position= (294,306)
    # CDD, check 24 : position= (383,295)
    templateImg_mat[mask43 != 0] = templateImg_mat[428, 585]
    templateImg_mat[mask35 != 0] = templateImg_mat[428, 585]

    # save the rendered image
    array_to_image(templateImg_mat, "../renTemplate", "png")
Пример #2
0
def unify_localLum(a):
    ## template image
    templateImg = "../template"
    ## load template image to array
    templateImg_mat = image_to_array(templateImg)

    ## masking
    mask43_fname = "../mask_ShLi_43"  # standard: within shadow, light check
    mask35_fname = "../mask_PlDa_35"  # comparison dark: outside shadow, dark check

    ## load mask images to array
    mask43 = image_to_array(mask43_fname)
    mask35 = image_to_array(mask35_fname)

    ## set entire checks with values read from center coordinates of each target check
    # S, check 43 : position=(215,292)
    # CD, check 35 : position=(170,220)
    # CL, check 32 : position=(239,219)
    # CDD, check 26 : position= (148,151)
    # CDD, check 24 : position= (191,146)
    templateImg_mat[mask43 != 0] = templateImg_mat[215, 292]
    templateImg_mat[mask35 != 0] = templateImg_mat[170, 220]

    # 0 for dark comparison, 1 for light comarison
    if a == 1:
        mask32_fname = "../mask_ShLi_32"  # block1 reference light: within shadow, light check
        mask32 = image_to_array(mask32_fname)
        templateImg_mat[mask32 != 0] = templateImg_mat[239, 219]
    if a == 0:
        mask24_fname = "../mask_PlDa_24"  # block2 reference dark: outside shadow, dark check (near the shadow)
        mask24 = image_to_array(mask24_fname)
        templateImg_mat[mask24 != 0] = templateImg_mat[191, 146]
        # ~ mask26_fname = '../mask_PlDa_26' # block2 reference dark: outside shadow, dark check (by the upper edge)
        # ~ mask26 = image_to_array(mask26_fname)
        # ~ templateImg_mat[mask26 != 0] = templateImg_mat[148,151]

        # save the rendered image
    array_to_image(templateImg_mat, "../renTemplate", "png")