Skip to content

Commit 41ffeed

Browse files
authored
Update app.py
1 parent 8ba5525 commit 41ffeed

File tree

1 file changed

+35
-1
lines changed

1 file changed

+35
-1
lines changed

app.py

+35-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
import cv2
44
from ultralytics import YOLO
55

6-
model = YOLO('yolov8s.pt')
6+
model = YOLO('model.pt')
77
print(model.names)
88
webcamera = cv2.VideoCapture(0)
99
# webcamera.set(cv2.CAP_PROP_FRAME_WIDTH, 1920)
@@ -22,3 +22,37 @@
2222
webcamera.release()
2323
cv2.destroyAllWindows()
2424

25+
# For Realsense camera
26+
# def initialize_realsense():
27+
# import pyrealsense2 as rs
28+
# pipeline = rs.pipeline()
29+
# camera_aconfig = rs.config()
30+
# camera_aconfig.enable_stream(rs.stream.depth, *config.DEPTH_CAMERA_RESOLUTION, rs.format.z16, config.DEPTH_CAMERA_FPS)
31+
# camera_aconfig.enable_stream(rs.stream.color, *config.COLOR_CAMERA_RESOLUTION, rs.format.bgr8, config.COLOR_CAMERA_FPS)
32+
# pipeline.start(camera_aconfig)
33+
# return pipeline
34+
# try:
35+
# # Try to initialize RealSense Camera
36+
# camera = initialize_realsense()
37+
# get_frame = get_frame_realsense
38+
# except Exception as e:
39+
# print("RealSense camera not found, using default webcam.")
40+
# camera = initialize_webcam()
41+
# get_frame = get_frame_webcam
42+
43+
# Function to get frames from RealSense
44+
# def get_frame_realsense(pipeline):
45+
# import pyrealsense2 as rs
46+
# frames = pipeline.wait_for_frames()
47+
# depth_frame = frames.get_depth_frame()
48+
# color_frame = frames.get_color_frame()
49+
# if not depth_frame or not color_frame:
50+
# return None, None
51+
# depth_image = np.asanyarray(depth_frame.get_data())
52+
# color_image = np.asanyarray(color_frame.get_data())
53+
# return depth_image, color_image
54+
55+
# # Function to get frame from webcam
56+
# def get_frame_webcam(cap):
57+
# ret, frame = cap.read()
58+
# return None, frame if ret else None

0 commit comments

Comments
 (0)