mirror of
https://github.com/TheAlgorithms/Python.git
synced 2024-11-23 21:11:08 +00:00
[mypy] annotate computer_vision
(#5571)
This commit is contained in:
parent
00a67010e8
commit
aaaa175b66
|
@ -21,11 +21,11 @@ class Harris_Corner:
|
||||||
else:
|
else:
|
||||||
raise ValueError("invalid k value")
|
raise ValueError("invalid k value")
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self) -> str:
|
||||||
|
|
||||||
return f"Harris Corner detection with k : {self.k}"
|
return f"Harris Corner detection with k : {self.k}"
|
||||||
|
|
||||||
def detect(self, img_path: str):
|
def detect(self, img_path: str) -> tuple[cv2.Mat, list[list[int]]]:
|
||||||
|
|
||||||
"""
|
"""
|
||||||
Returns the image with corners identified
|
Returns the image with corners identified
|
||||||
|
@ -35,7 +35,7 @@ class Harris_Corner:
|
||||||
|
|
||||||
img = cv2.imread(img_path, 0)
|
img = cv2.imread(img_path, 0)
|
||||||
h, w = img.shape
|
h, w = img.shape
|
||||||
corner_list = []
|
corner_list: list[list[int]] = []
|
||||||
color_img = img.copy()
|
color_img = img.copy()
|
||||||
color_img = cv2.cvtColor(color_img, cv2.COLOR_GRAY2RGB)
|
color_img = cv2.cvtColor(color_img, cv2.COLOR_GRAY2RGB)
|
||||||
dy, dx = np.gradient(img)
|
dy, dx = np.gradient(img)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user