Hi, pratik i m new to matlab, just wanted to know suppose if I have a complete folder of image dataset having roughly 200 image. then in that how can use this code to segment the image using k-means
Hii I have made a code as you want you can find it here drive.google.com/file/d/1P2-_r--0UH2t54QAn2xE83IMj4HI2OAK/view?usp=sharing Here first the code will ask to select a folder where all the images are present and then it will run the k-means algorithm on it. I have used the inbuilt k-means function here as it is much faster than my implementation. Hope that helps. This will only work if all your images are of the same size.
Hi! First of all thank you a lot for the video! It was really clear and easily understandable! I would like to ask you, if you want to tune the parameters, in kmeans is the number of clusters that you chose. In which part of the algorithm you do that? Thank you in advance
Thank you so much for the feedback . So to answer your question the k is the parameter that you are asking for. So I have kept it as a user input but you can remove the input line and put the value that you want there.
@@pratikian Thank you so much for your quick response! Actually I was asking if its possible to describe or make a video about how in matlab and on images we can apply the silhouette or the elbow technique in order to choose the correct number of clusters! Thank you in advance!!
Sorry for a late response I will try to make a video on that mean while you can look at this link in.mathworks.com/matlabcentral/answers/376063-how-to-find-optimal-k-from-k-means-clustering-by-using-elbow-method
So this data can be compared to the data that we get from a color image that also has 3 dimentions. You can pass this data matrix directly to the inbuilt kmeans matlab function. For more information on the function look at this link www.mathworks.com/help/stats/kmeans.html
Yes you are right we can also use the CIELab space. I have used the CIELab space for the next video in which I have explained the SLIC segmentation method.
So for grayscale image you will have the vector of only 1 column. You can directly use the matlab command reshape. Also you can use the inbuilt command kmeans to segment your image.