From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

kl3m3n's blog

Community Browser
cancel
Showing results for 
Search instead for 
Did you mean: 

Color image segmentation based on K-means clustering using LabVIEW Machine Learning Toolkit

Klemen
Active Participant

Hello everybody,

this post is a Labview code example on how perform image segmentation using the K-means clustering algorithm from the Labview Machine Learning Toolkit. This excellent and useful toolkit can be found here:

https://decibel.ni.com/content/docs/DOC-19328

I have used the Matlab example as a reference for the segmentation, which can be found here:

http://www.mathworks.com/help/images/examples/color-based-segmentation-using-k-means-clustering.html

The objects in the image were separated into three clusters. The results for Matlab and Labview implementation are shown below.

                                Matlab                                                           Labview

KMeansSegmentationExample_04.png  1.png

KMeansSegmentationExample_05.png  2.png

KMeansSegmentationExample_03.png  3.png

Some variation can be seen between the examples, so some further testing needs to be performed in order to pinpoint the discrepancies. But in any case, fairly good segmentation results can be achieved. Below are some examples:

test1.png

test2.png

test3.png

test4.png

or the background:

test5.png

The Labview code is in the attachment (saved for Labview 2013). Eventhough my contribution is not great (majority of the credit goes to the Labview Machine Learning Toolkit), I hope this helps someone somewhere along the way...

Best regards,

K


https://decibel.ni.com/content/blogs/kl3m3n



"Kudos: Users may give one another Kudos on the forums for posts that they found particularly helpful or insightful."
Comments