Skip to content

Commit

Permalink
Flake8 fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Th3NiKo committed Oct 17, 2022
1 parent 4642e84 commit 740bbe9
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 6 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
__pycache__
__pycache__
.vscode
4 changes: 3 additions & 1 deletion video_heatmap.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
import vision
import arguments_parser


def main():
"""
Whole heatmap pipeline creation.
Expand Down Expand Up @@ -50,7 +51,7 @@ def main():

erodated_image = vision.apply_morph(background_filter,
morph_type=cv2.MORPH_ERODE,
kernel_size=(5,5))
kernel_size=(5, 5))
accumulated_image = vision.add_images(accumulated_image, erodated_image)
normalized_image = vision.normalize_image(accumulated_image)
heatmap_image = vision.apply_heatmap_colors(normalized_image)
Expand All @@ -70,5 +71,6 @@ def main():
capture.release()
cv2.destroyAllWindows()


if __name__ == '__main__':
main()
7 changes: 3 additions & 4 deletions vision.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

def apply_morph(image: np.ndarray,
morph_type=cv2.MORPH_CLOSE,
kernel_size: Tuple[int, int] = (3,3),
kernel_size: Tuple[int, int] = (3, 3),
make_gaussian: bool = True):
"""
Apply opencv morphological operation to image and return it.
Expand All @@ -27,11 +27,11 @@ def apply_morph(image: np.ndarray,
"""
kernel = cv2.getStructuringElement(cv2.MORPH_RECT, kernel_size)
if make_gaussian:
image = cv2.GaussianBlur(image,(3,3),0)
image = cv2.GaussianBlur(image, (3, 3), 0)
return cv2.morphologyEx(image, morph_type, kernel)


def add_images(image1: np.ndarray,
def add_images(image1: np.ndarray,
image2: np.ndarray) -> np.ndarray:
"""
Add two images together. Colors values can be bigger then 255 restriction.
Expand Down Expand Up @@ -88,4 +88,3 @@ def superimpose(image1: np.ndarray,
"""

return cv2.addWeighted(image1, alpha, image2, 1 - alpha, 0.0)

0 comments on commit 740bbe9

Please sign in to comment.