python - opencv program data to a excel sheet -


i doing project on image filtering colours using opencv python on osx. have made functioning program when finds object of specific color, prints message in terminal says "found box" , pixel size in frame.

my question when try write data in excel sheet using xlwrt, prints out size of pixel, overwritten in same cell. rather pixel size values appear in column set pixel.

here part of program

  kernel = np.ones((31,31),np.uint8);   opening=cv2.morphologyex(mask,cv2.morph_open,kernel,0);   kernel = np.ones((17,17),np.uint8);   dilation=cv2.dilate(opening,kernel,iterations=2);   opening=cv2.morphologyex(mask,cv2.morph_open,kernel,2);   edges = cv2.canny(mask,100,255)   contours,hierarchy=cv2.findcontours(opening,1,cv2.chain_approx_simple);   res = cv2.bitwise_and(frame,frame, mask= dilation)   #contours=np.zeros(mask.shape,np.uint8);   areas = [cv2.contourarea(c) c in contours]   ar = 0.0   = 0    book = xlwt.workbook(encoding="utf-8")    sheet1 = book.add_sheet("sheet 1", cell_overwrite_ok=false)    sheet1.write(0, 0, "frame")   sheet1.write(0, 1, "pixel")    list1 = [0]    in areas:     print(a);     += 1     ar=float(a)     list1.append(ar)     sheet1.write(i,0,ar)     book.save("/users/canogerardo55/desktop/trial.xls")     if (a>10000):         print("found box");         break; 


Comments

Popular posts from this blog

c++ - Difference between pre and post decrement in recursive function argument -

php - Nothing but 'run(); ' when browsing to my local project, how do I fix this? -

php - How can I echo out this array? -