Keep background fixed

I have checked many tutorials of watershed segmentation with opencv (e.g. OpenCV: Image Segmentation with Watershed Algorithm) and the usual pipeline is:

  1. define sure foreground
  2. define sure background
  3. define unknown region as the area that is neither foreground or background
  4. set markers to run watershed algorithm (label 0 for unknown, label 1 for background and labels 2…n for all the other markers)

In my application, the unknown region is not an area that could be either background or foreground, it can only be foreground. I know what is the area corresponding to the background, I just want the unknown region to be segmented as part of foreground.

However, as it currently stands, the algorithm treats the background label similarly to a foreground label and the area of the corresponding marker gets larger in the output.

I wonder if there is a function parameter for cv2.watershed that can take care of this setting.

I am using opencv-python version ‘4.6.0’

Thank you