# 測試 1. 修改為能正確上傳的方式 2. 將程式修改為可以傳入任意數量的鏡頭 ``` import cv2 import shutil c1 = cv2.VideoCapture("1.mp4") c2 = cv2.VideoCapture("2.mp4") c3 = cv2.VideoCapture("3.mp4") c4 = cv2.VideoCapture("4.mp4") ret1, imgtmp1 = c1.read() ret2, imgtmp2 = c2.read() ret3, imgtmp3 = c3.read() ret4, imgtmp4 = c4.read() flielsit1 = [] flielsit2 = [] flielsit3 = [] flielsit4 = [] datasit1 = [] datasit2 = [] datasit3 = [] datasit4 = [] count = 0 while ret1 and ret2 and ret3 and ret4: cv2.imwrite("tmp1.jpg",imgtmp1) cv2.imwrite("tmp1.jpg",imgtmp1) cv2.imwrite("tmp1.jpg",imgtmp1) cv2.imwrite("tmp1.jpg",imgtmp1) data1 = callapi("tmp1.jpg") data1 = callapi("tmp2.jpg") data1 = callapi("tmp3.jpg") data1 = callapi("tmp4.jpg") if len(data1) == 3 and len(data1) == 3 and len(data1) == 3 and len(data1) == 3: shutil.copyfile("tmp1.jpg", str(count)+".jpg") flielsit1.append(str(count)+".jpg") count+=1 shutil.copyfile("tmp1.jpg", str(count)+".jpg") flielsit2.append(str(count)+".jpg") count+=1 shutil.copyfile("tmp1.jpg", str(count)+".jpg") flielsit3.append(str(count)+".jpg") count+=1 shutil.copyfile("tmp1.jpg", str(count)+".jpg") flielsit4.append(str(count)+".jpg") count+=1 datasit1.append(data1) datasit2.append(data2) datasit3.append(data3) datasit4.append(data4) t1=addtask("name",23,flielsit1) t2=addtask("name",23,flielsit2) t3=addtask("name",23,flielsit3) t4=addtask("name",23,flielsit4) annotations = t1.get_annotations() for item in datasit1: left = int((x - (w/2))*W) right = int((x + (w/2))*W) top = int((y - (h/2))*H) bottom = int((y + (h/2))*H) annotations.shapes.insert(len(annotations.shapes),{"frame":frameid,"label_id":uploadlab[name], "points":[left,top,right,bottom],'source':'manual',"type":"rectangle"}) ```