Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

I think an easy way would be to smooth the image iteratively with a one-pixel diameter kernel, and only for the non-zero pixels.

Pseudocode:

repeat:
    for each pixel>0
        for each neighbor=0
            neighbor=pixel*0.8

Like this, you will have a small valley even between close points, but sometimes the transition won't be smooth.

Another way would be to create a gaussian blurred image and another image where you interpolate all the points (using for example a Delaunay triangulation). Then, for each pixel take the lower value.

gauss=gaussianblur(points,sigma)
delaunay=triangulate(points)
result=min(gauss, dealunay)

The disadvantage of this approach is that the triangulation isn't implemented in OpenCV (you have to do it yourself), and in some cases you can get artifacts.