MATLAB Answers

Makrim
0

K-nearest neighbors in segmentation of gray image

Asked by Makrim
on 31 Mar 2014
Latest activity Commented on by Makrim
on 8 Apr 2014
Hi ,
I need help to implement k-nearest neighbors algorithm to segment a gray image.
I dispose of a Training image, and the original image to be segmented. But I don't have the knn algorithm to use it. KnnSearch corresponds to what I am looking to implement but I have Matlab r2009b thus it is not implemented.
please do you have the knn matlab code for 2 dimensionnal images ?

  0 Comments

Sign in to comment.

1 Answer

Answer by Image Analyst
on 31 Mar 2014

Do you mean like a knn filter for denoising where you replace a pixel by the mean of the brightest or darkest N values? If so, you can do that all with a few calls imfilter() or conv2() if you're clever about it.

  3 Comments

no, that's not what I mean. I would like to use knn as supervised classifier, to classify pixels of an image based on training data
What do the axes of your classes represent?

Sign in to comment.