OpenCV and NPP watershed return completely different outputs

Hi everyone,

So I have a computer vision program made with opencv, cuda and NPP.

The complete program works on the watershed algorithm (made with opencv), but the algorithm slows the speed by 15 fps, so I tried to run the watershed algorithm on the GPU using NPP. I managed to get the NPP watershed working, but it behaves completely different than the opencv watershed.

I use watershed to separate touching apples into the correct amount of contours (1 per apple). Below you can see the output of the Opencv and NPP watershed.

output NPP:

output opencv:

As seen in the images, opencv nicely separates the touching apples quite nicely, but the NPP watershed does not. NPP just groups colours together that roughly have the same gray-value.

Is it possible to get roughly the same output using NPP as with opencv? If so, I would love to know!

Also, NPP watershed seems to be VERY slow when receiving an image with a lot of black in it. If anybody knows why, let me know!

Thanks!

1 Like