roi_size = (ix - 5), (iy - 5)
roi = np.zeros(roi_size, dtype=np.uint8)
roi1 = roi + 1
roi_contour, roi_heirarchy = cv2.findContours(roi1, cv2.RETR_TREE, cv2.CHAIN_APPROX_NONE)
cv2.drawContours(roi_background, roi_contour[0], -1, (255, 0, 0), 5)
if adjust == True:
if (x_adj > 0 and w_adj > 0) or (y_adj > 0 and h_adj > 0) or (x_adj < 0 or y_adj < 0):
fatal_error("Adjusted ROI position is out of frame, this will cause problems in detecting objects")
After Change
roi_size = (ix - 5), (iy - 5)
roi = np.zeros(roi_size, dtype=np.uint8)
roi1 = roi + 1
roi_contour, roi_heirarchy = cv2.findContours(roi1, cv2.RETR_TREE, cv2.CHAIN_APPROX_NONE)[-2:]
cv2.drawContours(roi_background, roi_contour[0], -1, (255, 0, 0), 5)
if adjust == True:
if (x_adj > 0 and w_adj > 0) or (y_adj > 0 and h_adj > 0) or (x_adj < 0 or y_adj < 0):
fatal_error("Adjusted ROI position is out of frame, this will cause problems in detecting objects")