I want to perform an oversegmentation of image using watershed method. Reading documentation, I'd need to use findContour and drawContour function to create marker. How can I use that?
This is my current code,
import cv2
import numpy as np
im=cv2.imread('balls.jpg')
marker=np.zeros(im.shape[:2])
marker[::30,::30]=200
marker=np.int32(marker)
cv2.watershed(im,marker)
out=cv2.convertScaleAbs(marker)
cv2.namedWindow('Out')
cv2.imshow('Out', out)
cv2.waitKey()
P/S: There's another question on this, but they used other approach(based on foreground and background. I want to use contours instead).
This is my goal: produce an oversegmetnation of image:
Input image can be downloaded from here: http://decsai.ugr.es/~javier/denoise/peppers256.png