Machine Vision

cancel
Showing results for 
Search instead for 
Did you mean: 

Does anyone know how to implement "Mean Shift" in LabVIEW?

Hi,

Is there any LabVIEW built-in vi to do the task of mean shift algorithm? Do not ask me use in what application, I just wish to know how the actually running of this algorithm.. Or someone has example regarding this issue? thx..
0 Kudos
Message 1 of 8
(4,626 Views)
Hi liaw82

Do you mean moving average ?

Do you want to do that on an image or on a signal
It would be nice if you take the time to rate this answer
http://www.machinevision.ch
0 Kudos
Message 2 of 8
(4,610 Views)
Hi Doc,

What I understand is mean shift is an iterative process and it will find the mode of the set of data by shifting the mean or average. I wish to use it in image processing.. Do you have any idea that can perform this? thx..
0 Kudos
Message 3 of 8
(4,595 Views)
Hello liaw82,

Unfortunately, Vision does not have a built-in VI to accomplish a mean shift. Most of the Vision VIs are designed to process a single image. However, you should be able to using existing VIs (such as IMAQ Quantify and IMAQ Centroid) to build your own VI that implements a mean shift algorithm.

Best Regards,

Jesse D.
Applications Engineering
National Instruments
0 Kudos
Message 4 of 8
(4,573 Views)
Well for me there ise a way for doing a mean shift algorithm.

You can use a filter like this, and apply it with "Imaq Convolute" :

1 1 1
1 1 1
1 1 1

Of course this is for a 3x3 window for averaging

or any size for a larger window. Note that it must be odd numbered size
It would be nice if you take the time to rate this answer
http://www.machinevision.ch
0 Kudos
Message 5 of 8
(4,559 Views)
thx Jesse D & Doc,

For Jesse 😧 I tried to use IMAQ Quantify to find the mean value within a ROI but the answer given to me looked not accurate..

For Doc: Can I say in this way? I use the kernel of all 1s in 3x3 matrix and apply with convolute vi within a ROI, then I use the IMAQ Centroid to get the mean position within the ROI, later the same procedure is performed in the next video frame.. Is this the mean shift algorithm? Or I miss out any additional step in between?

Thx for you two again...
0 Kudos
Message 6 of 8
(4,552 Views)
Sorry my answer was not adequate : what I proposed is a moving average of size 3 in both directions.

What you want is an algorithm that will move your particle in the center of the picture. Am I correct ?
It would be nice if you take the time to rate this answer
http://www.machinevision.ch
Message 7 of 8
(4,539 Views)
Hi Doc,

If I use size 3 window
1 1 1
1 1 1
1 1 1

to convolute within the ROI, it will only average the picture inside the ROI rite? What does it to do with mean shift? I wish to track a moving object, whereby a ROI will indicate the object that is being tracked. At first I relied on the IMAQ Centroid vi to find the centroid position within the ROI and track the object by following the new centroid at each frame. Nevertheless, the result can be affected by outlier even though it still can track. I found some literatures that most of the people used mean shift as the fundamental method to track whatever they want. I knew mean shift uses kernel and weight to compute until it converges at one point which is the exact centroid that I want in order to track an object without being lied by outlier (I guess due to the help of kernel and weight).

Is it clear enough of why I wish to implement mean shift? thx alot!!
0 Kudos
Message 8 of 8
(4,518 Views)