Getting large number of small files (images) from FTP using python -


i have following problem solve:

camera takes picture 3 times second , saves on ftp server. access ftp server using python, download images , further processing using opencv. wouldn't challenge if system work offline, achieve online processing i.e. want download files such rate able live processing (or @ least live preview start).

currently downloading 1 file takes 1 second or more. files small (50 kb) , guess issue here overhead caused downloading files 1 one. there way download e.g. 10 or 100 files ftp @ once? introduce delay processing, better fluency. there maybe other solution problem?

the code have far:

from ftplib import ftp stringio import stringio import numpy np import cv2  ftp = ftp("ftp.name") ftp.login("login", "passwd") ftp.cwd("camera") #getting listing ls = [] ftp.retrlines('mlsd', ls.append)  entry in ls:     prop = entry.split(";")      #skip if directory     if prop[0].split("=")[1] == "dir":         continue      #getting file     r = stringio()     ftp.retrbinary('retr' + filename, r.write) #filename starts space character      nparr = np.fromstring(r.getvalue(), np.uint8)     img_np = cv2.imdecode(nparr, cv2.imread_color)      cv2.imshow("image", img_np)     cv2.waitkey(1) 


Comments

Popular posts from this blog

sql server - Cannot query correctly (MSSQL - PHP - JSON) -

php - trouble displaying mysqli database results in correct order -

C++ Linked List -