hypso.classification.WaterDetection.waterdetect.Image module

class hypso.classification.WaterDetection.waterdetect.Image.DWImageClustering(bands, bands_keys, invalid_mask, config, glint_processor=None)

Bases: object

Parameters:

config (DWConfig) –

apply_canny_treshold()
apply_cluster(data)

Apply the cluster algorithm to the data. Number of cluster is in self.best_k :param data: data to be clustered :return: Vector with the labels

apply_clustering()
static apply_mlp(data, clusters_labels, clusters_data)

Apply Multilayer Perceptron classifier to classify data :param data: new data to be classified :param clusters_labels: labels for the reference data :param clusters_data: reference data :return: labels for the new data

static apply_naive_bayes(data, clusters_labels, clusters_data)

Apply Naive Bayes classifier to classify data :param data: new data to be classified :param clusters_labels: labels for the reference data :param clusters_data: reference data :return: labels for the new data

apply_otsu_treshold()
static apply_svm(data, clusters_labels, clusters_data)

Apply Support Vector Machine to classify data :param data: new data to be classified :param clusters_labels: labels for the reference data :param clusters_data: reference data :return: labels for the new data

bands_to_columns()

Convert self.bands to a column type matrix where each band is a column It follows the order of the keys ordered :return: column type matrix

calc_clusters_params(data, clusters_labels)

Calculate parameters for each encountered cluster. Mean, Variance, Std-dev :param data: Clustered data :param clusters_labels: Labels for the data :return: List with cluster statistics

check_necessary_bands(bands, bands_keys, invalid_mask)

Check if the bands_keys combination for the clustering algorithm are available in bands and if they all have the same shape :param invalid_mask: array mask with the invalid pixels :param bands: image bands available :param bands_keys: bands combination :return: bands and bands_keys

create_matrice_cluster(indices_array)

Recreates the matrix with the original shape with the cluster labels for each pixel :param indices_array: position of the clustered pixels in the matrix :return: clustered image (0-no data, 1-water, 2, 3, … - other)

create_product_name()
detect_cluster(param, logic, band1, band2=None)

Detects a cluster according to a specific metrics :param param: Which parameter to search (mean, std-dev, variance, …) :param logic: Max or Min :param band1: The band related to the parameter :param band2: :return: Cluster object that satisfies the logic

find_best_k(data)

Find the best number of clusters according to an metrics. :param data: data to be tested :return: number of clusters

get_cluster_param(clusters_params, k, param, band)
get_necessary_bands()

Check the config file and all the parametrization to return a set of bands needed to run the algorithm

identify_water_cluster()

Finds the water cluster within all the clusters. It can be done using MNDWI, MBWI or Mir2 bands :return: water cluster object

index_of_key(key)
property product_name
run_detect_water(config=None)

Runs the detect_water function :param config: Options dictionary for the processing :return: clustered matrix where 1= water

separate_high_low_mndwi()
split_data_by_bands(data, selected_keys)

Gets data in column format (each band is a column) and returns only the desired bands :param data: data in column format :param selected_keys: bands keys to be extracted :return: data in column format only with the selected bands

supervised_classification(data, train_data, clusters_labels)

Applies a machine learning supervised classification :param data: new data to be classified :param train_data: reference data :param clusters_labels: labels for the reference data :return: labels for the new data

verify_cluster(clusters_params, k)