Backend Server
Overview
Flask is used as the backend server for creating APIs and processing videos on backend.
APIs
-
/api:- Type : GET, POST
- Input : None
- Purpose : Render flask home
- Output : Flask home HTML
-
/api/postvideo:- Type : POST
- Input : Video File
- Purpose : To save video file recieved from front end
- Output : Success/Error Status
-
/api/getframe/filename:- Type : GET
- Input : Video file name
- Purpose : To send frame of video to frontend
- Output : Frame of vide
-
/api/postparameters:- Type : POST
- Input : Parameters corresponding to different violation principles
- Purpose : To send parameters to backend which will be used in processing
- Output : Success/Error Status
-
/api/imageslist/feature:- Type : GET
- Input : Featue Type
- Purpose : Depending on feature selected, return list of images corresponding to that feature
- Output : List of images which can later be retrieved by frontend
-
/api/getimage:- Type : Get
- Input : None
- Purpose : Return a sample iamge
- Output : Sample Image
-
/api/getvideo/feature:- Type : GET
- Input : Feature Type
- Purpose : Get partial response of video in chunks
- Output : Partial Response
Functions
-
cleanMedia():- Input : None
- Purpose : To clean all the media files from previous processing
- Output : None
-
createDirectories():- Input : None
- Purpose : To create feature directories for runtime purposes
- Output : None
Modules
-
video_stream- In house implemented video streaming server.
- Instead of returning entire video at once, it is returned in chunks which are rendered on browser
-
cv2:- Opencv helps in retrieving frame from a video which user can draw on