47 lines
1.3 KiB
Python
47 lines
1.3 KiB
Python
|
|
|
||
|
|
import cv2
|
||
|
|
import os
|
||
|
|
import paramiko
|
||
|
|
|
||
|
|
LOCAL_PATH = f"/home/kepco/daooldns/KEPCO_AI_RBI_SIM/ENGINE/AI_ENGINE/DATA/ftp_data/local.jpg"
|
||
|
|
|
||
|
|
def bi_snap_shot():
|
||
|
|
# 10.20.10.99
|
||
|
|
# 192.168.39.20
|
||
|
|
rtsp = "rtsp://10.20.10.1:8554/cam/0/low"
|
||
|
|
rtsp = "rtsp://admin:admin1263!@10.20.10.99:554/onvif/media?profile=Profile2"
|
||
|
|
local_path = f"/home/kepco/daooldns/KEPCO_AI_RBI_SIM/ENGINE/AI_ENGINE/DATA/ftp_data/local.jpg"
|
||
|
|
|
||
|
|
if os.path.exists(local_path):
|
||
|
|
os.remove(local_path)
|
||
|
|
|
||
|
|
input_movie = cv2.VideoCapture(rtsp)
|
||
|
|
|
||
|
|
ret, frame = input_movie.read()
|
||
|
|
print(local_path)
|
||
|
|
cv2.imwrite(local_path,frame)
|
||
|
|
_bi_sftp_upload()
|
||
|
|
cv2.destroyAllWindows()
|
||
|
|
print(f"bi uploaded")
|
||
|
|
|
||
|
|
def _bi_sftp_upload():
|
||
|
|
try:
|
||
|
|
|
||
|
|
IP = "106.255.245.242"
|
||
|
|
transprot = paramiko.Transport((IP,2022))
|
||
|
|
transprot.connect(username = "kepri_if_user", password = "kepri!123")
|
||
|
|
sftp = paramiko.SFTPClient.from_transport(transprot)
|
||
|
|
|
||
|
|
remotepath = "/home/agics-dev/kepri_storage/rndpartners/" + os.sep + "remote" + '.jpg'
|
||
|
|
|
||
|
|
#sftp.put(LOCAL_PATH, remotepath)
|
||
|
|
|
||
|
|
sftp.close()
|
||
|
|
transprot.close()
|
||
|
|
|
||
|
|
return remotepath
|
||
|
|
except Exception as e:
|
||
|
|
return ""
|
||
|
|
|
||
|
|
if __name__ == '__main__':
|
||
|
|
bi_snap_shot()
|