윤영준 윤영준 11-11
final commit ( added testing suites )
@7a64f89a74e94989bbd5d6a6670b75814a9482ae
ITS/api.py
--- ITS/api.py
+++ ITS/api.py
@@ -84,7 +84,7 @@
                 # df.to_csv(f"result/pohang/listofcctv_포항_{x}_{y}.csv", index=False)
             time.sleep(1)
             print(f"{i}, {j}")
-    all_data_df.to_csv(f"ITS/list/{xmin}_{xmax}_y{ymin}_{ymax}.csv")
+    all_data_df.to_csv(f"ITS/list/{xmin}_{xmax}_y{ymin}_{ymax}_its.csv")
     return all_data_df
 
 def get_jpeg(url):
@@ -96,6 +96,6 @@
 
 
 if __name__ == "__main__":
-    df = gather_cctv_list(125, 130, 33, 39, 2, "ex", 1)
+    df = gather_cctv_list(128.074392720, 130.909268695, 35.635147801,37.497349441, 2, "its", 1)
     pass
     # get_jpeg("http://cctvsec.ktict.co.kr:8090/74236/IM2NQs4/uHZcgnvJo3V/mjo3tswwgUj87kpcYZfR/BPxaQ4lk9agnl8ARIB9lhlgOD87VBx6RDHFl423kLkqHQ==")
(파일 끝에 줄바꿈 문자 없음)
ITS/api_list_gatherer.py
--- ITS/api_list_gatherer.py
+++ ITS/api_list_gatherer.py
@@ -111,4 +111,4 @@
         df = gather_cctv_list(x-delta,x+delta, y-delta, y+delta, 1, ty, 1)
         all_data_df = pd.concat((all_data_df,df), ignore_index=True)
     # df = gather_cctv_list(127, 130, 33, 39, 8, "its", 1)
-    all_data_df.to_csv("cctv_data.csv")
(파일 끝에 줄바꿈 문자 없음)
+    all_data_df.to_csv("cctv_data_old.csv")
(파일 끝에 줄바꿈 문자 없음)
 
ITS/cctv_data.csv (added)
+++ ITS/cctv_data.csv
@@ -0,0 +1,17 @@
+,roadsectionid,coordx,coordy,cctvresolution,filecreatetime,cctvtype,cctvformat,cctvname,cctvurl
+0,,129.2005,35.921825,,,1,HLS,[국도20호선] 검단산업단지,http://cctvsec.ktict.co.kr/71187/bWDrL7fpStZDeDZgCybpJH8gagWJOynbaA/l91ExpmUPKzc3bCsHJtIblDkzG3TfzYDsbNJ7zAQ90+zWILAitFHTEDoXZSOrzc2TRBV36hw=
+1,,129.22647,35.934418,,,1,HLS,[국도20호선] 사방교차로,http://cctvsec.ktict.co.kr/72512/t01+nKA14+X2qGEfUc0SO2WSOj3cPeKShgxB1TCkjNrFrv037BHl3V3nxo7jZxY4qq6hPbgWYVsQhFIo3L4nNOpujyf5mdvuklodth2GKZ4=
+2,,129.247434,35.938131,,,1,HLS,[국도 7호선] 북경주IC,http://cctvsec.ktict.co.kr/4073/M268AufmeBDH3b3SZmNTDa9UJ7zNcXbaVlcbc4+TR5Lw7zjgzzX4VAdWgag81qMmYhudzDfyf9JCMlam0TICo+wuirDs0CgKWuuwaj9mwIE=
+3,,129.2471,35.93833,,,1,HLS,[국도20호선] 북경주IC,http://cctvsec.ktict.co.kr/72514/0MKsoRYUhMJ0i6Pj5VMsgGy0nnKlMrPL0zzGW9YVXbH6tUx6xxhbtodyXUUyz74/o7boIps3/GOvgYkJxgE6gysFpQqxlsmsiQfuZvpcz9w=
+4,,129.2708,35.94363,,,1,HLS,[국도20호선] 천북산업단지,http://cctvsec.ktict.co.kr/72516/L2d9HFtI4iTlsZYWEy5F78R0ORKHtqHhAYQXMNNkOZRzdpkc2nS9AHsdlRdWOdRiuROpJ3V5NwupuvGfBphyMER3gD6yD8j0dk9InwUrG+E=
+5,,129.29959,35.95008,,,1,HLS,[국도20호선] 왕신교차로,http://cctvsec.ktict.co.kr/75062/olvEosseU5qRSg20E6KMb9KQLYgkME2rO9ZaEViSp87qoQYaDBQmvOfyUQFjyzl2TvOpiqeN3xzA4iagFMFCsGCOx9kOufTF69kNBcTosOA=
+6,,129.24908,35.97815,,,1,HLS,[국도7호선] 경주 강동과적검문소 부근,http://cctvsec.ktict.co.kr/72945/sUVhkrW9EegZT00WzWEblFw2Ynolb0ElVvKJo5QsJRzN+m3iG0XKn468y0yKzBC7F0vkNr6blidyV8lj5UZgcWzaR7hMCVlAzlDK2AfejM4=
+7,,129.269177,35.983341,,,1,HLS,[국도 7호선] 강동IC,http://cctvsec.ktict.co.kr/4071/eCDLzCcOb35K6wou65+nYTCoaPVNPYEy29J3kEbgNROqEuQSrmATulzDlFpWx6TN01gMzDNAN8LyFvqh3iKGTg/7iTYTJima20V5mE8AiaY=
+8,,129.253539,35.985587,,,1,HLS,[국도 7호선] 이제테크,http://cctvsec.ktict.co.kr/4460/Xr9+OT8IDnVd3oQUlaDZA3lOt2s5g+ywaS+YcJx3odTqmjeGYYS0CwqT009FfDKtYNEhYevoL/Q/FhyiyZHhzMx0qkRF3Tb5zrv+WIQUW3w=
+9,,129.255853,35.988625,,,1,HLS,[국도 28호선] 인동삼거리,http://cctvsec.ktict.co.kr/5562/M0OpafuK8Rfe6cmxqH8YDT+kOGJ7ar9CACnZWQ5CarFbYgZAzXznW4rWZ9kA9joP/YN2skKgjMH9i481UOQ4XsicIgjQyY2kyW3e/vsTxxg=
+10,,129.281389,35.991812,,,1,HLS,[국도 28호선] 유금IC,http://cctvsec.ktict.co.kr/4119/Fe3O/UIJ/0/CFersxMGgjIcBQrsqE+QycVYsNFOJUzdjom+H/VQHtM7T+q/p3gJO6mXY/ismWLgKc/edZUJvWBKuh5qsg3HqorQI8nZjKCU=
+11,,129.2347,35.99271,,,1,HLS,[국도28호선] 안강교차로,http://cctvsec.ktict.co.kr/75045/hdWQ0L0qdextPv3KvTaxci4gcz/l3OyWVeH47bqgXu3pgrvkFMeXcm8Vf+4T/ODT/TXIGM6n10du/1/o2wmVQ5PUs2WDz6KPER7UaRQ0PLU=
+12,,129.228436,35.998511,,,1,HLS,[국도 28호선] 안강IC,http://cctvsec.ktict.co.kr/5563/QVqzfXSeaD53r4lCGfnSOuHMML6jMqbBTwODdwZxwlcNVIoFRf6ByrMKZXGfgv99LlTNOYj5rDdpOfsCO24QhO05M+zvElXlJurEKnAhj3s=
+13,,129.284657,36.016126,,,1,HLS,[국도 28호선] 위덕대학교 앞 삼거리,http://cctvsec.ktict.co.kr/4436/ya0JdV0uiCaqQ+lxSMDRG8PqKWq8vL9MuwjMfnRdIKL1PBWaPO/9d9CCcfF/8GTi2q8yJX78iuKL0yaPOKKLKfQedbCMUNOrKeQSt0LTPG0=
+14,,129.293598,36.025038,,,1,HLS,[국도 28호선] 학전보건소 앞 교차로,http://cctvsec.ktict.co.kr/4434/S5CcFQ6maa0k5VCmIMdKf6yhgKzvCsGDv82B/Wo1BAHerYK7aiJkJrh1KPqc2hccABUGoir2OsnZJi72m/aqR/Fw0xgUftEfd6H3qP3R21I=
+15,,129.293598,36.025038,,,1,HLS,[시연용] 침수구간,http://takensofttesting.iptime.org:54127(파일 끝에 줄바꿈 문자 없음)
config_files/cctv_list.csv
--- config_files/cctv_list.csv
+++ config_files/cctv_list.csv
@@ -1,12 +1,18 @@
-roadsectionid,coordx,coordy,cctvresolution,filecreatetime,cctvtype,cctvformat,cctvname,cctvurl
-,129.245312,35.920346,,,1,HLS,[국도 7호선] 모아초교,http://cctvsec.ktict.co.kr/4463/6SqphQj32sxeB2nYIMerulhkk0HdDKP/aSEgp7hHbUY9iwTDb+UQZfTbag9pXmM/yo3a7l1usm64GwBH77/SCVEel3JF3g9BZDc+ws1es2w=
-,129.2005,35.921825,,,1,HLS,[국도20호선] 검단산업단지,http://cctvsec.ktict.co.kr/71187/bWDrL7fpStZDeDZgCybpJH8gagWJOynbaA/l91ExpmUPKzc3bCsHJtIblDkzG3TfmkwkLj7+PPdYAHSYBXxem4SZJpaAYFU0CtDtr5rz7DY=
-,128.06396,36.047108,,,1,HLS,[국도3호선] 송죽교차로,http://cctvsec.ktict.co.kr/71208/Z9Acztz6CYwzuUXQFreRR0Kdewba8Ml4CNxR0Jsp9uSCWmvL9W/BO1w2XIPxtxs9kn58qVvtHREs6vU305JaRa40F1m/P6f13gpiz9C+46M=
-,128.2671,35.91457,,,1,HLS,[국도33호선] 대흥교차로,http://cctvsec.ktict.co.kr/72593/mTZfGWopuLSKGZsBABx2whdCW4FLmBl6wi4dCvp0MxMpKF6c6ydtf40G8dVXQcAGlDug1DIE/E4MVUyoa3UuD18aYxP6ZCMD5zISEiDxXTQ=
-,129.378721,36.310334,,,1,HLS,[국도 7호선] 영덕 구계휴게소,http://cctvsec.ktict.co.kr/4459/kAgktFah0VAtMosKMfrJ13d7CBLAa5+M1xhiLgsypRh5NDDIqY0Y7Z2+hkF88PZUhL1uFJTYshn/Afc4FCS67iWpGfxUOoNU8b0ul3flW8c=
-,129.37762,36.318485,,,1,HLS,"[국도7호선] 영덕 영덕구계항부근(마을주민,해안가)",http://cctvsec.ktict.co.kr/72957/LkVa3bIbXIBudmzokRTyNtAbqEoZCk+DHRZ8i6cs+rL6QIEM7Fv1N+wfJPjSFQOEmn+Sklz5M3zqnjyiuo6lcPORJsjpyig6wn11ZeH+h44=
-,129.381293,36.339985,,,1,HLS,[국도 7호선] 오션뷰C.C 앞 삼거리,http://cctvsec.ktict.co.kr/4475/0lZW6kXydguhfnjHZgPeVWi/UKIYrPrUGPfVDyXcGXynS/XFEaXHTYGgmLHdj6QwF1AcHSd6JRZnW+/Ecw30OL/L63URGEp3X/DJqKRrzR0=
-,129.3459,36.11983,,,1,HLS,[국도7호선] 곡강교,http://cctvsec.ktict.co.kr/71249/YZj8q/z+rpoz8wHUZGst7oMp01rLXrsqhKDnbcKcndono98hK4v5LXE3UumA35GOUC3vxTXsvCBdemtPt60aNJsGUbr+NNiMFUZXDoNutF8=
-,129.193728,35.762614,,,1,HLS,[국도7호선] 부지교차로,http://cctvsec.ktict.co.kr/72311/kdgcZLCWMjfPL2B06+sReFWMMB+6gW6i1XePhxb0jT/S3jhoQGFbl4nM8fnNunVxbfcv+gtwwve5/Alut8ExIXo8I9h3kV5tNjcqr2ai8d4=
-,129.200930555555,35.772125,,,1,HLS,[국도 35호선] 용장교,http://cctvsec.ktict.co.kr/5569/7Wk7xI0iDot4My7wDolq5X3jnW9Pgsp7eqT4fmbF1G1dWh248yZuO0r6DZGPJc0lFupmPdL6nCMDyuYljTRHmm7FxLfEMZ9OOKcycSLyHIk=
-,128.03166,36.011665,,,1,HLS,[국도3호선] 방산교,http://cctvsec.ktict.co.kr/72618/tJq3wZnEySy1HdQLbvzJhD6i+QrqP0HIopbzDMD/h21V/QmMVP26YJUOZsU9WnMsSrPMHfzgTP54irzJjPv+4kCcFJuqvRM63JNFmolU2tE=
+,roadsectionid,coordx,coordy,cctvresolution,filecreatetime,cctvtype,cctvformat,cctvname,cctvurl
+0,,129.2005,35.921825,,,1,HLS,[국도20호선] 검단산업단지,http://cctvsec.ktict.co.kr/71187/bWDrL7fpStZDeDZgCybpJH8gagWJOynbaA/l91ExpmUPKzc3bCsHJtIblDkzG3TfzYDsbNJ7zAQ90+zWILAitFHTEDoXZSOrzc2TRBV36hw=
+1,,129.22647,35.934418,,,1,HLS,[국도20호선] 사방교차로,http://cctvsec.ktict.co.kr/72512/t01+nKA14+X2qGEfUc0SO2WSOj3cPeKShgxB1TCkjNrFrv037BHl3V3nxo7jZxY4qq6hPbgWYVsQhFIo3L4nNOpujyf5mdvuklodth2GKZ4=
+2,,129.247434,35.938131,,,1,HLS,[국도 7호선] 북경주IC,http://cctvsec.ktict.co.kr/4073/M268AufmeBDH3b3SZmNTDa9UJ7zNcXbaVlcbc4+TR5Lw7zjgzzX4VAdWgag81qMmYhudzDfyf9JCMlam0TICo+wuirDs0CgKWuuwaj9mwIE=
+3,,129.2471,35.93833,,,1,HLS,[국도20호선] 북경주IC,http://cctvsec.ktict.co.kr/72514/0MKsoRYUhMJ0i6Pj5VMsgGy0nnKlMrPL0zzGW9YVXbH6tUx6xxhbtodyXUUyz74/o7boIps3/GOvgYkJxgE6gysFpQqxlsmsiQfuZvpcz9w=
+4,,129.2708,35.94363,,,1,HLS,[국도20호선] 천북산업단지,http://cctvsec.ktict.co.kr/72516/L2d9HFtI4iTlsZYWEy5F78R0ORKHtqHhAYQXMNNkOZRzdpkc2nS9AHsdlRdWOdRiuROpJ3V5NwupuvGfBphyMER3gD6yD8j0dk9InwUrG+E=
+5,,129.29959,35.95008,,,1,HLS,[국도20호선] 왕신교차로,http://cctvsec.ktict.co.kr/75062/olvEosseU5qRSg20E6KMb9KQLYgkME2rO9ZaEViSp87qoQYaDBQmvOfyUQFjyzl2TvOpiqeN3xzA4iagFMFCsGCOx9kOufTF69kNBcTosOA=
+6,,129.24908,35.97815,,,1,HLS,[국도7호선] 경주 강동과적검문소 부근,http://cctvsec.ktict.co.kr/72945/sUVhkrW9EegZT00WzWEblFw2Ynolb0ElVvKJo5QsJRzN+m3iG0XKn468y0yKzBC7F0vkNr6blidyV8lj5UZgcWzaR7hMCVlAzlDK2AfejM4=
+7,,129.269177,35.983341,,,1,HLS,[국도 7호선] 강동IC,http://cctvsec.ktict.co.kr/4071/eCDLzCcOb35K6wou65+nYTCoaPVNPYEy29J3kEbgNROqEuQSrmATulzDlFpWx6TN01gMzDNAN8LyFvqh3iKGTg/7iTYTJima20V5mE8AiaY=
+8,,129.255853,35.988625,,,1,HLS,[국도 28호선] 인동삼거리,http://cctvsec.ktict.co.kr/5562/M0OpafuK8Rfe6cmxqH8YDT+kOGJ7ar9CACnZWQ5CarFbYgZAzXznW4rWZ9kA9joP/YN2skKgjMH9i481UOQ4XsicIgjQyY2kyW3e/vsTxxg=
+9,,129.281389,35.991812,,,1,HLS,[국도 28호선] 유금IC,http://cctvsec.ktict.co.kr/4119/Fe3O/UIJ/0/CFersxMGgjIcBQrsqE+QycVYsNFOJUzdjom+H/VQHtM7T+q/p3gJO6mXY/ismWLgKc/edZUJvWBKuh5qsg3HqorQI8nZjKCU=
+10,,129.2347,35.99271,,,1,HLS,[국도28호선] 안강교차로,http://cctvsec.ktict.co.kr/75045/hdWQ0L0qdextPv3KvTaxci4gcz/l3OyWVeH47bqgXu3pgrvkFMeXcm8Vf+4T/ODT/TXIGM6n10du/1/o2wmVQ5PUs2WDz6KPER7UaRQ0PLU=
+11,,129.228436,35.998511,,,1,HLS,[국도 28호선] 안강IC,http://cctvsec.ktict.co.kr/5563/QVqzfXSeaD53r4lCGfnSOuHMML6jMqbBTwODdwZxwlcNVIoFRf6ByrMKZXGfgv99LlTNOYj5rDdpOfsCO24QhO05M+zvElXlJurEKnAhj3s=
+12,,129.284657,36.016126,,,1,HLS,[국도 28호선] 위덕대학교 앞 삼거리,http://cctvsec.ktict.co.kr/4436/ya0JdV0uiCaqQ+lxSMDRG8PqKWq8vL9MuwjMfnRdIKL1PBWaPO/9d9CCcfF/8GTi2q8yJX78iuKL0yaPOKKLKfQedbCMUNOrKeQSt0LTPG0=
+13,,129.293598,36.025038,,,1,HLS,[국도 28호선] 학전보건소 앞 교차로,http://cctvsec.ktict.co.kr/4434/S5CcFQ6maa0k5VCmIMdKf6yhgKzvCsGDv82B/Wo1BAHerYK7aiJkJrh1KPqc2hccABUGoir2OsnZJi72m/aqR/Fw0xgUftEfd6H3qP3R21I=
+14,,129.253539,35.985587,,,1,HLS,[국도 7호선] 이제테크,http://cctvsec.ktict.co.kr/4460/Xr9+OT8IDnVd3oQUlaDZA3lOt2s5g+ywaS+YcJx3odTqmjeGYYS0CwqT009FfDKtFgV6olzg/psZgALZ323EbzifPbYXpu9ykHWFxrvfiFU=
+15,,129.255853,35.988625,,,1,HLS,[국도 28호선] 인동삼거리,http://cctvsec.ktict.co.kr/5562/M0OpafuK8Rfe6cmxqH8YDT+kOGJ7ar9CACnZWQ5CarFbYgZAzXznW4rWZ9kA9joPAzR9/9ysDMzUxjFRa5U0ReMp9+7oogtA3cKDi6vUDRs=
+16,,128.731178,35.789061,,,1,HLS,[국도25호선] 협석교,http://cctvsec.ktict.co.kr/74022/hHOIJ9u/upxrPh+MUCp/g1QO+AX5Ml22KZMIeYARDDFErSactLSf8sM+UwRqybIUhZiM34aH+vm77QLuaXEznuT2Hynw0Y46cNWZ2tqR/T0=
 
hls_streaming_collect_cctvs.py (added)
+++ hls_streaming_collect_cctvs.py
@@ -0,0 +1,39 @@
+from ITS.api import gather_cctv_list
+from hls_streaming.hls import FrameCapturer
+from time import sleep
+import threading
+from time import sleep
+import pandas as pd
+
+def manage_capturer():
+    # cctv_list1 = pd.read_csv("ITS/list/125_130_y33_39.csv")
+    cctv_list = pd.read_csv("ITS/list/128.07439272_130.909268695_y35.635147801_37.497349441_its.csv")
+    # cctv_list = pd.concat((cctv_list1, cctv_list2))
+
+    cctv_list = cctv_list.sample(frac=1).reset_index(drop=True)
+
+    cctv_list_name = cctv_list['cctvname']
+    cctv_list_url = cctv_list['cctvurl']
+
+    for (name, url) in zip(cctv_list_name, cctv_list_url):
+        try:
+            frame_cap = FrameCapturer(url, name, "_", "_")
+            frame_cap.start()
+            sleep(50)
+            frame_cap.stop()
+            sleep(60)
+        except:
+            continue
+
+
+# Create threads for the first 10 capturers (assuming there are at least 10)
+threads = [threading.Thread(target=manage_capturer) for _ in range(3)]
+
+# Start all threads
+for thread in threads:
+    thread.start()
+    sleep(1)
+
+# Wait for all threads to finish
+for thread in threads:
+    thread.join()(파일 끝에 줄바꿈 문자 없음)
run_image_anal_backend.sh
--- run_image_anal_backend.sh
+++ run_image_anal_backend.sh
@@ -6,26 +6,33 @@
 PYTHONPATH="/home/juni/PycharmProjects/segmentation_overlapping"
 
 # Start multiple Python processes in the background
-python streaming_process.py --cctv_num 0 &
-pids+=($!)
-sleep 1
-python streaming_process.py --cctv_num 1 &
-pids+=($!)
-sleep 1
+#python streaming_process.py --cctv_num 0 &
+#pids+=($!)
+#sleep 5
+#python streaming_process.py --cctv_num 1 &
+#pids+=($!)
+#sleep 5
 python streaming_process.py --cctv_num 2 &
 pids+=($!)
-sleep 1
-python streaming_process.py --cctv_num 3 &
+sleep 5
+#python streaming_process.py --cctv_num 3 &
+#pids+=($!)
+#sleep 30
+#python streaming_process.py --cctv_num 4 &
+#pids+=($!)
+#sleep 30
+python streaming_process.py --cctv_num 14 &
 pids+=($!)
 sleep 1
-python streaming_process.py --cctv_num 4 &
-pids+=($!)
-sleep 1
-python streaming_process.py --cctv_num 5 &
-pids+=($!)
-sleep 1
-python streaming_process.py --cctv_num 6 &
-pids+=($!)
+#python streaming_process.py --cctv_num 15 &
+#pids+=($!)
+#sleep 1
+#python streaming_process.py --cctv_num 8 &
+#pids+=($!)
+#sleep 30
+#python streaming_process.py --cctv_num 13 &
+#pids+=($!)
+
 
 #python test.py
 #python inference_endpoint.py
streaming_process.py
--- streaming_process.py
+++ streaming_process.py
@@ -17,6 +17,7 @@
             xmax=lat + lat_lon_interval, ymax=lon + lat_lon_interval,
             intervals=1, roadType="its", cctvType=1
         )
+        print(api_result.loc[0]["cctvurl"])
         return api_result.loc[0]["cctvurl"]
 
     args = argparse.ArgumentParser()
@@ -39,6 +40,7 @@
 
     cctv_info = pd.read_csv("config_files/cctv_list.csv")
     cctv_info = cctv_info.iloc[cctv_ind]
+    print(cctv_info)
 
     lat = cctv_info["coordx"]
     lon = cctv_info["coordy"]
 
streaming_process_flood_demonstration.py (added)
+++ streaming_process_flood_demonstration.py
@@ -0,0 +1,66 @@
+# This script only works if this is the main process.
+# This script must be executed with bash script that is located in the root directory of this project
+# This is by design, and is a way to circumvent GIL of python, because the server needs to handle multiple video streaming at once.
+
+if __name__ == "__main__":
+    from ITS.api import gather_cctv_list
+    from hls_streaming.hls import FrameCapturer
+
+    import argparse
+    import pandas as pd
+    import time
+
+
+    def refresh_hls_address(lat, lon, lat_lon_interval=0.0001):
+        api_result = gather_cctv_list(
+            xmin=lat - lat_lon_interval, ymin=lon - lat_lon_interval,
+            xmax=lat + lat_lon_interval, ymax=lon + lat_lon_interval,
+            intervals=1, roadType="its", cctvType=1
+        )
+        print(api_result.loc[0]["cctvurl"])
+        return api_result.loc[0]["cctvurl"]
+
+    args = argparse.ArgumentParser()
+    args.add_argument("--cctv_num", type=int,
+                      help="Index number of cctv, to view or edit the list of cctv, see cctv_list.csv")
+    args.add_argument("--interval", type=float, default=5,
+                      help="Interval of frame extract of the process, unit is second, default is 5 seconds")
+    args.add_argument("--video_buffer", type=float, default=15,
+                      help="How may seconds of video frame buffer will be there, "
+                           "default value is 15 seconds, which matches ITS video streaming packet response interval")
+
+    args = args.parse_args()
+
+    # This is a must, because if you refer to variables inside args directly,
+    #  when ERROR happens out of that variables or related, python can not
+    #  direct you to where it happens and instead unintelligible garbage
+    cctv_ind = args.cctv_num
+    frame_extract_interval = args.interval
+    video_buffer = args.video_buffer
+
+    cctv_info = pd.read_csv("config_files/cctv_list.csv")
+    cctv_info = cctv_info.iloc[cctv_ind]
+    print(cctv_info)
+
+
+    lat = 37.127277
+    lon = 127.067114
+    name = "[국도1] 평택 갈곶리삼거리"
+    if name.find("국도"):
+        roadtype = 'its'
+    else:
+        roadtype = 'ex'
+
+    # initiate ITS CCTV streaming via hls
+    while True:
+
+        # cctv_url = refresh_hls_address(lat, lon, )
+        cctv_url = "http://takensofttesting.iptime.org:54127/hls/playlist.m3u8"
+        print(name)
+        hls_streaming = FrameCapturer(cctv_url, name, lat, lon, frame_extract_interval, video_buffer, 300, "Asia/Seoul",
+                                      endpoint= "http://localhost:12345/cctv/infer")
+        hls_streaming.start()
+
+        time.sleep(60000)
+
+        hls_streaming.stop()
streaming_url_updator.py
--- streaming_url_updator.py
+++ streaming_url_updator.py
@@ -11,7 +11,7 @@
 from apscheduler.triggers.interval import IntervalTrigger
 
 
-API_ENDPOINT = "http://165.229.169.148:8080/EquipmentUrlChanger.json"
+API_ENDPOINT = "http://165.229.169.113:30213/EquipmentUrlChanger.json"
 
 app = Flask(__name__)
 print("ITS API Updater START")
@@ -52,6 +52,8 @@
     #, ensure_ascii=False) # the server in question is not using UTF-8, change it when it does.
     response = requests.post(API_ENDPOINT, headers=headers, data=payload)
     print_request(response)
+    print("new url sented!")
+
 
 url_list_sender()
 scheduler = BackgroundScheduler()
testing.html
--- testing.html
+++ testing.html
@@ -7,9 +7,6 @@
     <style>
         body {
             font-family: Arial, sans-serif;
-            display: flex;
-            flex-direction: column;
-            height: 100vh;
             margin: 0;
         }
         .header {
@@ -22,29 +19,36 @@
             top: 0;
             z-index: 1;
         }
+        #buttonContainer {
+            position: fixed;
+            top: 105px; /* Just below the header */
+            width: 100%;
+            display: flex;
+            justify-content: center;
+            z-index: 2; /* Ensure it appears above other content */
+            background-color: white; /* Make the background white to cover content when scrolling */
+            padding: 10px;
+        }
+        #processButton, #clearButton, #imageInput {
+            background-color: #1E4E90;
+            color: white;
+            border: none;
+            padding: 10px 20px;
+            font-size: 16px;
+            cursor: pointer;
+            margin: 0 10px; /* Add margin between buttons */
+        }
+        #processButton:hover, #clearButton:hover {
+            background-color: #163a6e;
+        }
         .container {
             text-align: center;
-            margin-top: 100px; /* .header의 높이 만큼 여백 추가 */
+            margin-top: 150px; /* Add margin to push content below the fixed buttons */
         }
         #preview img {
             max-width: 100%;
             height: auto;
             margin-top: 20px;
-        }
-        #processButton {
-            background-color: #1E4E90;
-            color: white;
-            border: none;
-            padding: 10px 20px;
-            text-align: center;
-            text-decoration: none;
-            display: inline-block;
-            font-size: 16px;
-            margin-top: 20px;
-            cursor: pointer;
-        }
-        #processButton:hover {
-            background-color: #1E4E90;
         }
         #copyright {
             background-color: #f1f1f1;
@@ -59,8 +63,8 @@
             justify-content: center;
             height: 100vh;
         }
-        #messageContainer div{
-            margin-top:30px;
+        #messageContainer div {
+            margin-top: 30px;
         }
     </style>
 </head>
@@ -68,12 +72,17 @@
     <div class="header">
         <h1>침수감지모델 테스트도구</h1>
     </div>
-    <div class="container">
-        <div id="preview"></div>
+
+    <!-- Button Container (file input, process, clear) -->
+    <div id="buttonContainer">
         <input type="file" id="imageInput">
         <button id="processButton">이미지 처리</button>
-        <button id="clearButton">Clear</button> <!-- Clear 버튼 추가 -->
+        <button id="clearButton">Clear</button>
+    </div>
 
+    <!-- Content Area -->
+    <div class="container">
+        <div id="preview"></div>
     </div>
     <div id="messageContainer"></div>
 
@@ -85,36 +94,32 @@
         const fileInput = document.getElementById('imageInput');
         const processButton = document.getElementById('processButton');
         const preview = document.getElementById('preview');
-        const messageContainer = document.getElementById('messageContainer'); // 메시지를 담을 컨테이너 추가
+        const messageContainer = document.getElementById('messageContainer');
+        const clearButton = document.getElementById('clearButton');
 
         clearButton.addEventListener('click', function() {
-            // 메시지 컨테이너의 내용을 비움
             preview.innerHTML = '';
             messageContainer.innerHTML = '';
         });
+
         fileInput.addEventListener('change', function(event) {
             const file = event.target.files[0];
             const reader = new FileReader();
 
             reader.onloadend = function() {
-                // 이미지 미리보기를 생성하여 화면에 표시
                 const img = new Image();
                 img.src = reader.result;
-                img.style.width = '1080px'; // 미리보기 이미지의 너비 조절
-                preview.innerHTML = ''; // 이전 미리보기 삭제
-                preview.appendChild(img); // 새로운 미리보기 추가
+                img.style.width = '1080px';
+                preview.innerHTML = '';
+                preview.appendChild(img);
 
-                // 파일 정보를 기반으로 FormData를 생성하여 서버에 전송할 준비
                 const formData = new FormData();
-                formData.append('file', file); // 이미지 파일을 FormData에 추가
+                formData.append('file', file);
 
-                const LAT = "36.123"; // Replace with the actual latitude value
-                const LON = "123.123"; // Replace with the actual longitude value
-                const FILENAME = file.name; // Use the selected file's name as the filename
-                const FILE_TYPE = file.type; // Use the selected file's type as the file type
-
-                // 여기서 formData와 FILENAME, FILE_TYPE을 이용하여 서버에 요청을 보내면 됩니다.
-                // ...
+                const LAT = "36.123";
+                const LON = "123.123";
+                const FILENAME = file.name;
+                const FILE_TYPE = file.type;
             };
 
             if (file) {
@@ -126,44 +131,22 @@
             const file = fileInput.files[0];
 
             if (file) {
-
-                const LAT = "36.123"; // Replace with the actual latitude value
-                const LON = "123.123"; // Replace with the actual longitude value
-                const FILENAME = file.name; // Use the selected file's name as the filename
-                const FILE_TYPE = file.type; // Use the selected file's type as the file type
+                const LAT = "36.123";
+                const LON = "123.123";
+                const FILENAME = file.name;
+                const FILE_TYPE = file.type;
                 const formData = new FormData();
                 formData.append("data", JSON.stringify({ gps_x: LAT, gps_y: LON, filename: FILENAME, file_type: FILE_TYPE }));
                 const previewBlob = await fetch(preview.querySelector('img').src).then(res => res.blob());
-                formData.append('file', previewBlob, FILENAME); // Blob 객체와 원래 파일 이름을 전송
-            
-            
+                formData.append('file', previewBlob, FILENAME);
 
                 try {
-                    const URL = "http://127.0.0.1:12345/cctv/infer"; // Replace with the actual server URL
+                    const URL = "http://127.0.0.1:12345/cctv/infer";
                     const response = await fetch(URL, {
                         method: "POST",
                         body: formData
                     });
-            
-                    if (response.ok) {
-                        const data = await response.json();
-                        console.log(data); // 서버에서 받은 응답 처리
-            
-                        // data 객체에서 rain이 true인 경우 메시지 표시
-                        if (data.rain === true) {
-                            const message = document.createElement('div');
-                            message.textContent = '비 사진 감지되었습니다.';
-                            messageContainer.innerHTML = ''; // 기존 메시지 삭제
-                            messageContainer.appendChild(message); // 새로운 메시지 추가
-                        } else {
-                            const message = document.createElement('div');
-                            message.textContent = '일반 사진 감지되었습니다.';
-                            messageContainer.innerHTML = ''; // 기존 메시지 삭제
-                            messageContainer.appendChild(message); // 새로운 메시지 추가
-                        }
-                    } else {
-                        console.error("Error occurred while sending the request:", response.statusText);
-                    }
+
                 } catch (error) {
                     console.error("Error occurred:", error);
                 }
@@ -171,8 +154,6 @@
                 console.error("No file selected.");
             }
         });
-
-
     </script>
 </body>
-</html>
(파일 끝에 줄바꿈 문자 없음)
+</html>
yoloseg/inference_gpu_.py
--- yoloseg/inference_gpu_.py
+++ yoloseg/inference_gpu_.py
@@ -378,8 +378,8 @@
         # Show the processed frame
         # cv2.imshow('Processed Frame', resized_frame)
         # # Save the processed frame
-        # output_frame_path = os.path.join(output_dir, f"frame_{frame_count}.jpg")
-        # cv2.imwrite(output_frame_path, resized_frame)
+        output_frame_path = os.path.join(output_dir, f"frame_{frame_count}.jpg")
+        cv2.imwrite(output_frame_path, resized_frame)
 
         t2 = time.time()
         frame_time = t2 - t1
@@ -411,4 +411,4 @@
 if __name__ == "__main__":
     # test()
 
-    process_video("/home/juni/사진/flood/test_video.mp4", "./")
(파일 끝에 줄바꿈 문자 없음)
+    process_video("/home/juni/사진/flood/test_video.mp4", "/home/juni/사진/flood/infer/")
(파일 끝에 줄바꿈 문자 없음)
Add a comment
List