import xlrd
import cv2
from three_color import handle_from_url


def read_excel():
    data = xlrd.open_workbook('20190522上衣测试.xlsx')
    table = data.sheets()[0]
    nrows = table.nrows
    for i in range(nrows):
        url = table.row_values(i)[1]
        path = url.split('/')[-1]
        path = path.split('-')[0]
        print(path)
        img = handle_from_url(url)
        cv2.imwrite('/test/' + path, img)


if __name__ == '__main__':
    read_excel()
