Skip to content

Commit

Permalink
Change opening iterations value
Browse files Browse the repository at this point in the history
  • Loading branch information
yiannisha committed Apr 24, 2024
1 parent 588126d commit dd97f5c
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions cv_bottle_detection/detector.py
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ def detect_package(self, img: np.array, _preproc: bool = True, _return_modified:
gray = cv2.cvtColor(new_img, cv2.COLOR_BGR2GRAY)
th, dst = cv2.threshold(gray, 0, 255, cv2.THRESH_BINARY + cv2.THRESH_OTSU)
contours, hierarchy = cv2.findContours(dst, cv2.RETR_TREE, cv2.CHAIN_APPROX_SIMPLE)

dv = self.padding['bottom'] - self.padding['top']
dh = self.padding['right'] - self.padding['left']

Expand Down Expand Up @@ -281,7 +281,7 @@ def detect_bottles(self, img: np.array, _preproc: bool = True, _return_bboxes=Fa

# opening
kernel = np.ones((3, 3), np.uint8)
dst = cv2.morphologyEx(dst, cv2.MORPH_OPEN, kernel, iterations=18)
dst = cv2.morphologyEx(dst, cv2.MORPH_OPEN, kernel, iterations=17)

img = dst

Expand Down

0 comments on commit dd97f5c

Please sign in to comment.