I’m using paramiko to establish a connection, and run an existing script called grabber.py on a Raspberry pi module to capture the images continuously. Now my problem is that: sometimes the getImage function tries to read the image, while the grabber.py script is writing the image to raspberry pi module at the same time. How […]
- Tags $username, 768) cap = cv2.VideoCapture(0) cap.set(cv2.CAP_PROP_FRAME_WIDTH, and run an existing script called grabber.py on a Raspberry pi module to capture the images continuously. Now my problem is that: sometimes, but the problem still when I try to getImage more than once, cmd_to_execute, command to be excuted on the Raspberry pi. @param: keyfilename, even with delay 1.5 seconds between two calls of the function. grabber script import cv2 from time import sleep resolution = (1024, frame = cap.read() cv2.imwrite('/home/pi1/vision/image.jpg', frame) cap.release() Remote machine code class communicator(): def __init__(self, host, host address 192.168.0.40, I'm using paramiko to establish a connection, integer. """ self.host = host self.username = username self.password = password self.port = p, keyfilename=None): """ Function: commander, localPath, localPath+'image.jpg') self.commander('sudo rm vision/image.jpg') sftp.close() transport.close() # print('Up, PASSWORD, password = self.password) sftp = paramiko.SFTPClient.from_transport(transport) sftp.get(remotePath, password = self.password) ssh_stdin, pkey=k) ssh_stdin, port=22): """ Class communicator: Read images remotely. --- Parameters: @param: host, remotePath='vision/image.jpg'): """ Function: getImage, resolution[0]) # max: 2592 cap.set(cv2.CAP_PROP_FRAME_HEIGHT, resolution[1]) # max: 1944 status, self.port)) transport.connect(username = self.username, ssh key file name. --- @return: None. """ if(keyfilename is None): ssh = paramiko.SSHClient(), ssh_stderr = ssh.exec_command(cmd_to_execute) channel = ssh_stdout.channel status = channel.recv_exit_status(), ssh_stdout, string, thanks for @MartinPrikryl for his note, the password. @param: port, the path to the destination folder. @param: remotePath, the path to the image on the Pi. --- @return: None. """ transport = paramiko.Transport((self.host, the username. @param: password, to copy the image from the Raspberry pi to a localPath in PC. --- Parameters: @param: localPath, to send commands to the Raspberry pi. --- Parameters: @param: cmd_to_execute, username = self.username, username=USER, while the grabber.py script is writing the image to raspberry pi module at the same time. How can I get my image correctly while I'm calling, www.something.org @param: username