2

I am taking pictures using the OpenCV from my webcam, and after I have identified the face, I save the face image using a cv2.imwrite in a folder in my computer.

Now, my question is how can I save the images in path on another computer?

I mean, for example, using FTP, I can directly add another path to storing the images to cv2.imwrite and put them in the another computer?

Martin Prikryl
  • 188,800
  • 56
  • 490
  • 992
Mkg Rty
  • 39
  • 1
  • 4

1 Answers1

2

You need to use cv2.imencode to store the image to memory:

retval, buffer = cv2.imencode('.jpg', image)

Then upload the buffer:

from ftplib import FTP
from io import BytesIO

ftp = FTP('ftp.example.com')
ftp.login('username', 'password')

flo = BytesIO(buffer)
ftp.storbinary('STOR test.jpg', flo)
Martin Prikryl
  • 188,800
  • 56
  • 490
  • 992