# Watershed - How to set minima of gradient map as seeds ?

Hello,

I have a gradient map of an image obtained via convolution with the x and y sobel masks. I'd like to set the minimum points as the seed for the watershed segmentation.

Am I doing it correctly / efficiently if I scan the entire image with a 3x3 window and set the center as the seed if it happens to be the minimum ? Is there an OpenCV function that does this ?

Matlab's watershed function automatically sets the seed points.

This is my watershed result on Matlab

and on opencv

how do i make the result look more like the one i obtain on matlab ? This was the result of the watershed that I was taught. It doesnt look like the one i obtained from opencv. Does anyone have a watershed code that i can use that will give me the same result like matlab ?