Exemple #1
0
    print("|\tProcessing " + image_file + '....')


    img = cv2.imread(image_file)
    # resize image
    scale_percent = 12
    width = int(img.shape[1] * scale_percent / 100)
    height = int(img.shape[0] * scale_percent / 100)
    dim = (width, height)
    img = cv2.resize(img, dim, interpolation=cv2.INTER_AREA)
    print("|Image size H " + str(img.shape[0]) + " | W " + str(img.shape[1]))
    print("|-------------------------------------------------------|")


    img_detect_divs = img.copy()
    divs_of_page = image_process.find_main_divs(img_detect_divs)
    cv2.imshow('Divs of page', divs_of_page[0]['IMAGE'])
    div_data = divs_of_page[0]['DIV_DATA']
    print("|-------------------------------------------------------|")

    img_detect_para = img.copy()
    paras_of_page = image_process.find_paras(img_detect_para)
    cv2.imshow('Paras of page', paras_of_page[0]['IMAGE'])
    para_data = paras_of_page[0]['PARA_DATA']
    print("|-------------------------------------------------------|")

    img_detect_images = img.copy()
    image_of_page = image_process.find_images(img_detect_images)
    cv2.imshow('Images of page', image_of_page[0]['IMAGE'])
    image_data = image_of_page[0]['IMAGE_DATA']
    print("|-------------------------------------------------------|")