Commit 2e62281c authored by 任婷婷's avatar 任婷婷

fix

parent d795fdb9
import xlrd import xlrd
import cv2 import cv2
from three_color import handle_from_url import os
from demo.three_color import handle_from_url, handle_from_path
def read_excel(): def read_excel():
data = xlrd.open_workbook('20190522上衣测试.xlsx') data = xlrd.open_workbook('20190515衣服测试链接.xlsx')
table = data.sheets()[0] table = data.sheets()[0]
nrows = table.nrows nrows = table.nrows
for i in range(1, nrows+1): for i in range(1, nrows+1):
url = table.row_values(i)[1] url = table.row_values(i)[0]
tag = table.row_values(i)[2] tag = table.row_values(i)[1]
path = url.split('/')[-1] path = url.split('/')[-1]
path = path.split('-')[0] path = path.split('-')[0]
path = tag + '_' + path path = str(tag) + '_' + path
print(path) print(path)
img = handle_from_url(url) img = handle_from_url(url)
cv2.imwrite('tem/' + path, img) cv2.imwrite('tem/' + path, img)
def read_path():
path = '/srv/apps/fashionbase/infer/0515_test_img/'
rs = os.listdir(path)
for r in rs:
if r == 'deal':
continue
source_path = path + r
print(source_path)
img = handle_from_path(source_path)
store_path = '/srv/apps/fashionbase/infer/0515_test_img/deal/' + r
cv2.imwrite(store_path, img)
if __name__ == '__main__': if __name__ == '__main__':
read_excel() #read_excel()
read_path()
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment