Skip to content

Commit

Permalink
feat: implemented frame rotation again
Browse files Browse the repository at this point in the history
  • Loading branch information
ShyAssassin committed Nov 12, 2023
1 parent 66c50bb commit 7617abe
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions TrackingBackend/app/processes/camera.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,10 @@ def preprocess_frame(self, frame: MatLike) -> MatLike:
if self.config.flip_y_axis:
frame = cv2.flip(frame, 1)

row, col, _ = frame.shape
matrix = cv2.getRotationMatrix2D((col / 2, row / 2), self.config.rotation_angle, 1)
frame = cv2.warpAffine(frame, matrix, (col, row), borderMode=cv2.BORDER_CONSTANT, borderValue=(255, 255, 255))

# TODO: send frame to frontend before cropping, so the user can more easily adjust the roi
roi = [self.config.roi_x, self.config.roi_y, self.config.roi_w, self.config.roi_h]
if roi != [0, 0, 0, 0]:
Expand Down

0 comments on commit 7617abe

Please sign in to comment.