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(1, nrows+1):
        url = table.row_values(i)[1]
        tag = table.row_values(i)[2]
        path = url.split('/')[-1]
        path = path.split('-')[0]
        path = tag + '_' + path
        print(path)
        img = handle_from_url(url)
        cv2.imwrite('tem/' + path, img)


if __name__ == '__main__':
    read_excel()
