gpu::meanShiftSegmentation - Parameters?

asked 2016-02-16 12:21:34 -0600

zvonimirb gravatar image

I've been trying to use gpu::meanShiftSegmentation to segment an image into a small number of clusters. My end goal of this would be to get results similar to this matlab code so i could use the OutputMat to find objects that have HUE and SATURATION values that stand out from the rest.

Currently, i'm working on a test image of 240x320px, and trying some of the following parameters:

gpu::meanShiftSegmentation(InputMat, OutputMat, 80, 80, 3)

TermCriteria criteria(CV_TERMCRIT_EPS, 0, 0.8)
gpu::meanShiftSegmentation(InputMat, OutputMat, 80, 80, 3, criteria)

But the number of different segments I am getting in the result image is way to high for such a small input image, 1000+ different segments meaning 1000+ different clusters. The problem is that I don't really understand how the parameters work so I am unable to tweak them to get the results I am looking for.

Can anyone help me understand how "Spatial window radius", "Color window radius" and "criteria" work? I understand that larger numbers give a smaller number of segments, but I'm unable to get a small enough number of clusters (5-6 for this image) without losing my region of interest.

edit retag flag offensive close merge delete