How do I write a code for given formula?
1 visualizzazione (ultimi 30 giorni)
Mostra commenti meno recenti
This is done through k-Means clustering and binarization to derive a binary classification of each parcel for cropland and non-cropland pixels. This process results in 2 clusters per parcel object for which the mean values are calculated. Herein, a threshold for pixels higher than 0.4 was defined for the derivation of CAF:
𝐶𝐴𝐹 = Σ𝑝 > 0 . 4 / Σ𝑝
where Σp is the sum of all pixels and Σ𝑝 > 0 . 4 the sum of pixels which are located within the cluster with a mean NDVI higher than 0.4.
I would be highly obliged for kind cooperation.
Dave
0 Commenti
Risposte (1)
Image Analyst
il 14 Mar 2024
I feel that kmeans is not a good method in your situation. kmeans is good when you know that you have the required number of clusters. If you don't, then it will force you to because that's how it works. So if you have a parcel with the vast majority (or all) of it being either cropland or non-cropland, you are forcing it to have two clusters even when there is really only one cluster. So for this reason, kmeans is not robust or reliable across the entire range of data from 0% (only one cluster present) to half and half (both clusters present) to 100% (of one cluster only).
You are better off using a "fixed" model that you have trained it on what is cropland and what is noncropland. If it's a simple as cropland is green and non-cropland is any other color, then you can simply do color segmentation with the ColorThresholder tool on the Apps tab of the tool ribbon.
If it's more complicated than that (multiple classes of cropland colors and "dirt" colors) then you can use discriminant analysis. I'm attaching a demo for that. You train a model by tracing regions of known classes, then you can apply it to any new/arbitrary data to estimate what class each pixel might be.
For further references see VisionBibiography
2 Commenti
Image Analyst
il 14 Mar 2024
Modificato: Image Analyst
il 14 Mar 2024
If you don't want to use supervised training, like discriminant analysis or deep learning, and insist on unsupervised training, like kmeans, then you will have to be willing to accept very wrong classification estimates for shapes/regions that are mostly cropland, or mostly non-cropland.
If you know every shape/region has a good amount of both cropland and non-cropland pixels in it, then you can use kmeans but I doubt this will be the case.
Assuming you want to use this method (that I'm recommending against), what do you want to do with the classification information? Get the area of each class?
Vedere anche
Categorie
Scopri di più su Classification in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!