Borrar filtros
Borrar filtros

Extract Specific part of image every time using kmean (without shuffle its position)

1 visualización (últimos 30 días)
Hello Everyone
I have download "Plant Analysis" project from https://www.mathworks.com/matlabcentral/fileexchange/50624-plant-disease-classification. When I run this project, position of image cluster (the class numbers) changes every time.
Actually what I am trying to do to extract only the "green Healthy" part of leaf (like Cluster 3 and Cluster 2 in the second image) every time when I run this project.
After long search on internet I have found that kmean use some random value that's why it happens. And soon I have found its solution by Writing "rng(1)" at the top of code. and every time the same image come on its same place like this
But the problem is that when I give it another image, the green healthy part cluster should class #2(Cluster 2) but unfortunately it was not.
So my question is, when I give sequence of images in this code and select lets say "segmented_images{1}" how I make sure that I selected the green healthy leaf image? Any suggestion or code modification please.
Sorry for my bad English.
I am using Matlab 2013a.

Respuesta aceptada

Image Analyst
Image Analyst el 31 de Mzo. de 2017
I've said it several times before but I guess you didn't see that, so I'll say it again. kmeans is not a good algorithm for color segmentation. When people see multiple colors in an image they immediately think "kmeans". It's kind of like when novices see some object on a uniform background and think that the first step should be edge detection, even though it's not. Just because you see two or 3 colors doesn't mean that kmeans is a good method. It's not. You'd be better off using K-Nearest Neighbors with known reference colors, but even that is not that great. Anyone could tell you how to make sure green is class 2 and yellowish green is class 3 (in fact I already did if you read it carefully), but why do that when it's not the right approach?
You're better off using an x-rite Color Checker chart in your field of view and converting your images to LAB or HSV color space and look for colors that are not green and have a high Delta E (color difference) between your pixels and the color(s) of healthy plants. One of the many advantages of doing that is that it will be independent of the light level or exposure time so it will work no matter what the brightness of the image is - something kmeans can't do. It will also work no matter how much disease is on the leaf - anything from 0% to 100%. kmeans() can't do that, can it? No, it will always find a cluster it calls disease regardless if there is any there or not, because you told it to - you forced it to.

Más respuestas (1)

waqar ismail
waqar ismail el 4 de Feb. de 2018
if u are using matlab then matlab color segmentation app will help you more then k means

Categorías

Más información sobre Agriculture en Help Center y File Exchange.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by