윤영준 윤영준 05-20
stream_reciever 테스트 완료, inference 기능 추가 및 후처리단 연계가 다음 단계.
@675d5d86cfc2f2c1260613bb9d796131634acb10
hls_streaming/hls.py
--- hls_streaming/hls.py
+++ hls_streaming/hls.py
@@ -85,7 +85,7 @@
                             frame_name = f"captured_frame_{self.captured_frame_count}.jpg"
                             img_binary = cv2.imencode('.png', self.current_frame)
                             img_binary = img_binary[1].tobytes()
-                            self.send_image_to_server(img_binary, self.endpoint)
+                            self.send_image_to_server(img_binary)
                             cv2.imwrite(f'hls_streaming/captured_frame_/{datetime.now()}_{frame_name}', self.current_frame)
                             self.last_capture_time = current_time
                             print(f"Captured {frame_name} at time: {current_time - self.start_time:.2f}s")
@@ -93,7 +93,7 @@
 
             time.sleep(0.1)
 
-    def send_image_to_server(self, image, endpoint, image_type="png"):
+    def send_image_to_server(self, image, image_type="png"):
         time_sent = datetime.now(self.time_zone).strftime("yyyy-MM-dd'T'HH:mm:ss'Z'")
         header = {
             'Content-Type': f'image/{image_type}',
@@ -112,7 +112,7 @@
                         }
             )
             header["Content-Type"] = multipart_data.content_type
-            response = session.post(endpoint, headers=header, data=multipart_data)
+            response = session.post(self.endpoint, headers=header, data=multipart_data)
 
         except Exception as e:
             print(e)
hls_streaming/streaming_process.py
--- hls_streaming/streaming_process.py
+++ hls_streaming/streaming_process.py
@@ -7,9 +7,9 @@
     import os
 
     load_dotenv()
-    print("PYTHONPATH:", os.getenv("PYTHONPATH"))
-    print("_____")
-    print(os.path.dirname(os.path.abspath(__file__)))
+    # print("PYTHONPATH:", os.getenv("PYTHONPATH"))
+    # print("_____")
+    # print(os.path.dirname(os.path.abspath(__file__)))
     from ITS.api import gather_cctv_list
     from hls_streaming.hls import FrameCapturer
 
@@ -18,7 +18,7 @@
     import time
 
 
-    def refresh_hls_address(lat, lon, lat_lon_interval=0.00001):
+    def refresh_hls_address(lat, lon, lat_lon_interval=0.000001):
         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,
run_image_anal_backend.sh
--- run_image_anal_backend.sh
+++ run_image_anal_backend.sh
@@ -3,10 +3,15 @@
 # Array to hold the process IDs
 declare -a pids
 
+PYTHONPATH="/home/juni/PycharmProjects/segmentation_overlapping"
+
 # Start multiple Python processes in the background
-python hls_streaming/hls.py &
+python hls_streaming/hls.py --cctv_num 0 &
 pids+=($!)
-python hls_streaming/hls.py &
+python hls_streaming/hls.py --cctv_num 1 &
+pids+=($!)
+
+python test.py
 pids+=($!)
 
 # Function to kill all processes
test.py
--- test.py
+++ test.py
@@ -47,7 +47,7 @@
         filename = f"{timestamp}_{cctv_info}.png"
         image_path = os.path.join(IMAGE_DIR, filename)
         image.save(image_path)
-
+        print("successful")
         return {"message": f"Image {filename} uploaded successfully!"}
 
 if __name__ == '__main__':
Add a comment
List