I am trying to implement segmentation on an image. after a difference of Gaussians Process and applying weights to my edges I want to go through edge linking by local processing. I have seen this example with the van on multiple tutorials. I tried the second "real time" simplification.

what I do not understand is:

• do I implement this algorithm on the gradient of the original image or the weighted edgels (I have tried both and got squat)?
• If not. How can I use the gradient to implement an algorithm that will help me link the edgels?

This is) the image I am working with.

This is the weighted DOG output.

This is what I got from creating the g function from the original image and after filling gaps vertically

and horizontally I got this.

I am following the same thresholds as in the example.

This is a code snippet of my "gap filling":

        k=25