This project is a FastAPI backend and React frontend that displays real-time object detections on a video feed using Server-Sent Events (SSE) and ROS for image processing.
- Live streaming of object detections via SSE
- Bounding boxes drawn on a canvas over a video feed
- Displays class and confidence score for each detected object
- Integrates with ROS to receive image data from
/zed2i/zed_node/rgb/image_rect_color
- Python 3
- FastAPI
- ROS Noetic
- OpenCV (
cv2) cv_bridgefor converting ROS imagesuvicornfor running the server
- A React app configured to connect to
http://localhost:8000
-
Ensure ROS is running and set up your environment:
source /opt/ros/noetic/setup.bash -
Start the FastAPI server:
python3 API.py
- Navigate to your React project and install dependencies:
npm install
- Start the React development server:
npm start
Ensure the rosbag and the FastAPI server is running inside the docker container of Hydrus. Open 'http://127.0.0.1:8000/detections/stream' and 'http://127.0.0.1:8000/video_feed'
GET /video_feed: Provides a real-time video feed from the ROS image topic.GET /detections/stream: Streams real-time object detection data via SSE.
- No detections appearing? Ensure ROS is publishing images and
run_detection_pipelines()is working. - Video feed not displaying? Check
http://127.0.0.1:8000/video_feedandrosbagis playing. - CORS issues? Ensure FastAPI is allowing connections from
http://localhost:3000.
