Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade OpenCV version #557

Merged
merged 2 commits into from
Dec 21, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions peekingduck/pipeline/nodes/draw/utils/bbox.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ def draw_bboxes(

def _draw_bbox(
frame: np.ndarray,
bbox: List[float],
bbox: np.ndarray,
image_size: Tuple[int, int],
colour: Tuple[int, int, int],
bbox_label: str = None,
Expand Down Expand Up @@ -108,7 +108,7 @@ def _draw_label(
cv2.rectangle(
frame,
(top_left[0], top_left[1]),
(int(top_left[0] + text_width), int(top_left[1] - text_height - baseline)),
(top_left[0] + text_width, top_left[1] - text_height - baseline),
bg_colour,
FILLED,
)
Expand All @@ -118,7 +118,7 @@ def _draw_label(
cv2.putText(
frame,
bbox_label,
(top_left[0], int(top_left[1] - 6)),
(top_left[0], top_left[1] - 6),
FONT_HERSHEY_SIMPLEX,
NORMAL_FONTSCALE,
text_colour,
Expand All @@ -129,15 +129,15 @@ def _draw_label(

def draw_tags(
frame: np.ndarray,
bboxes: List[List[float]],
bboxes: np.ndarray,
tags: List[str],
colour: Tuple[int, int, int],
) -> None:
"""Draw tags above bboxes.

Args:
frame (np.array): image of current frame
bboxes (List[List[float]]): bounding box coordinates
frame (np.ndarray): image of current frame
bboxes (np.ndarray): bounding box coordinates
tags (List[string]): tag associated with bounding box
color (Tuple[int, int, int]): color of text
"""
Expand All @@ -162,7 +162,7 @@ def _draw_tag(
)
bbox_width = btm_right[0] - top_left[0]
offset = int((bbox_width - text_width) / 2)
position = (int(top_left[0] + offset), int(top_left[1] - baseline))
position = (top_left[0] + offset, top_left[1] - baseline)
cv2.putText(
frame, tag, position, FONT_HERSHEY_SIMPLEX, NORMAL_FONTSCALE, colour, VERY_THICK
)
Expand Down
2 changes: 1 addition & 1 deletion peekingduck/pipeline/nodes/draw/utils/general.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,4 +59,4 @@ def project_points_onto_original_image(
projected_points[:, 0] *= width
projected_points[:, 1] *= height

return projected_points
return np.round(projected_points).astype(int)
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
colorama == 0.4.4
numpy == 1.17.3
opencv-python == 4.1.2.30
opencv-python >= 4.5.2.54
pyyaml >= 5.3.1
requests == 2.24.0
tensorflow == 2.2.0
Expand Down
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ install_requires =
pyyaml >= 5.3
click == 7.1.2
requests == 2.24
opencv-python == 4.1.2.30
opencv-python >= 4.5.2.54
tensorflow >= 2.2
numpy >= 1.17.3
tqdm == 4.45.0
Expand Down