An Automated Approach of Shoreline Detection Applied to Digital Videos using Data Mining

This study aims to detect a shoreline location and its changes automatically in the temporal resolution. This approach is implemented on the coastal video monitoring system applications. The proposed method applied data mining by using two main systems-a training system using classification and shoreline detection systems with Self-Organizing Map (SOM) and K-Nearest Neighbor (K-NN) algorithms. The training system performs feature texture extraction using agray-level co-occurrence matrix and the results are stored to classification process. The detection system has five processing stages: contrast stretching preprocessing and morphological contrast enhancement, SOM clustering, morphological operations, feature extraction and K-NN classification and detection shoreline. Preprocessing was used to improve the video image contrast and reliability. SOM algorithm in segmenting objects in the onshore video images. Morphological operations were applied to eliminate noise on the objects that were not needed in the spatial domain. The segmentation results of video frames classified by K-NN. The aim is to provide the class labels on each region segmentation results, namely, sea label, land label and sky label. The determination of the shoreline is done by scanning the neighboring pixels from the edge of land class label after binary image transformation. The shoreline change detection was performed by comparing the position of existing shoreline and shoreline position in the reference video frame. A Receiver Operating Characteristic (ROC) curve was used to evaluate the performance of shoreline detection systems. The results showed that the combination of SOM and K-NN was able to detect shoreline and its changes accurately.


INTRODUCTION
Shoreline, the contact zone between ocean and land, has changed over time due to the cross-shore movement of sediments along the shore and the dynamic nature of the water surface.The dynamic changes of the shoreline may cause erosion of the beach bodies (abrasion) and the addition of beach bodies (accretion), which can damage the coastal environment.Therefore, monitoring the position of the shoreline is a very significant issue given the socio-economic value and high population density along shore areas (Goncalves et al., 2012;Huisman et al., 2011).
Beach morphology changes in different spatial and temporal scales.Therefore, intensive monitoring schemes are required (Rigos et al., 2014).Traditionally, shoreline studies have been based on field measurements of waves, currents, sediment transport and morphological changes.This scheme can provide essential information concerning the shoreline in temporal resolution but it has limitations in spatial resolution.Moreover, some logistical difficulties, such as high cost and difficulty of the survey when the weather conditions are bad, exist in this scheme (Rijn, 2007).Another method is remote sensing by using satellites or aircraft fitted with remote-sensing systems with active and passive sensors to describe the dynamics of the nearshore area.This method offers a good spatial-temporal resolution, but these observations are relatively expensive and the visibility is not extensive.
Some of the difficulties mentioned above can be solved using video-based remote-sensing systems (Almar et al., 2012).Video monitoring system provides information in data per second in the time scale and spatial scales from meters to kilometers.The emergence of devices based network cameras, allowing the spatial scale can be expanded.This is done by installing cameras scattered along the coast and is integrated in a computer network.
Currently, many studies on shoreline estimate use data from digital video sources.Video-detected shoreline is generally estimated using several methods among: • Shore Line Intensity Maximum (SLIM) • Pixel Intensity Clustering (PIC) • Artificial Neural Network (ANN) • Channel Color Divergence (CCD) SLIM method defines as cross-shore shoreline position at which wave breaking is maximized, which corresponds to maximum pixel intensity in close to the shore (Plant et al., 2007).CCD method is based on red, green and blue channels whose values are similar to the white sand on the shore but have different values in water (Turner et al., 2000).The shoreline is defined on each cross-shore transect where divergence between color channels exceeds a threshold.A technique was developed by PIC (Aarninkhof et al., 2003) that uses both color and grayscale intensity information.The ANN models use neural networks to differentiate wet pixels from dry pixels by using the RGB channel as an input (Rigos et al., 2014;Kingston et al., 2000).The number of proposed methods showed that the robust shoreline detection procedures have many challenges due to the variety of intra-annual environmental, hydrodynamic and morphological conditions in the coastal zone.
In an effort to develop a system that provides remote sensing-based digital videos, this study has built shoreline detection systems using data mining techniques.Detection of shorelines is done by segmentation of shore objects in the video frame, followed by the classification of these objects.The objects on the shore on a video frame are separated according to the similarity of pixels and the process of object recognition would categorize objects into objects land, sea and sky.When an object is recognized as the land, then the scanning process is carried out to obtain the pixels in the object marked as land that has pixels neighboring the sea objects.The pixels on the land label that has neighboring pixels with sea label is shoreline.This study applied SOM algorithms in the process of clustering and K-NN algorithm in the classification process.
SOM algorithm has been known as a reliable clustering method and has been applied in a wide range of applications (Kohonen, 2013;Ortiz et al., 2013).SOM-ANN training uses a technique that is based on winner take all, where only the winner neurons willrenewed its weight.Although SOM is based on ANN, itdoes not use the class target value, so that no classes are defined for each data.
As a classifier algorithm, the K-NN algorithm has advantages when used for the election of large data compared with other classification methods (Jain et al., 2000).K-NN algorithms perform classification based on the proximity (distance) of the data with other data, which is the shortest distance from a sample to the test sample.With this technique, the K-NN algorithm is able to fully exploit the spatial correlation between adjacent data (Huang et al., 2016).This technique is needed for the classification of land, sky and sea objects on ashore line image.
In this study, an automatic shoreline detection in the video monitoring system of shoreline change was explained.The proposed methods comprise five modules.The first module formed preprocessing mechanisms to improve the shoreline image quality.The clustering process which segmenting objects that based on color feature similarity by getting rid of color feature of pixels, itwas performed in the second module.The quality of segmentation improved by removing noise usingthe morphology algorithm was done in module three.Feature extraction and object classification was performed in module four.Moreover, module five provides the shoreline extraction.For the classification mechanism, this study uses a classification training method for a shore area.

MATERIALS AND METHODS
In this study, a video monitoring system to track shoreline changes using data mining techniques has been developed.The dataset video that was used was shore area monitoring dataset of Egmond, Netherlands that was downloaded from the website Deltares Argus Archive (Argus, 2015).The video was an image combination that proceeded sequentially in time with a certain speed.The images that formed the video were called frames.Moreover, the image recitation speed was called frame rate and has a unit of frame per second (Widyantara, 2015).The video frame of the Egmondshore area was an input that was processed in the system so that the position shoreline could be shown automatically.A flow analysis of the video monitoring system concerning the shoreline change is shown in Fig. 1.

Preprocessing:
The video frames were obtained from the process of monitoring the activity of the coastline, is a color image with sunlight effect compositions that vary according to the acquisition time.The effect of sunlight varies in shore areas and this becomes a problem when separating objects during the segmentation process (Widyantara et al., 2016).Therefore, an image enhancement mechanism is required to improve the graphical display of the video frames prior to the segmentation process.
Image enhancement is accentuated or sharpening elements of an image such as edge, boundaries or contrast levels that it creates a useful graphic display of the image.Image enhancement does not fix or improve Fig. 1: Research method the quality of information and data that already exists in the image.Nevertheless, image enhancement increase the dynamic range of desired elements in the image so that the elements can be noticed or seen clearly.Image enhancement includes functions such as contrast manipulation, noise reduction, edge crispening and sharpening, interpolation and image magnification.The selection of techniques to be used must also consider the characteristics of the video image that needs to be processed.This study usesa technique based on contrast manipulation, which is a combination of contrast stretching and morphological contrast enhancement techniques, to increase the contrast of video frames.The goal is to enable the process of segmentation to cluster objects in the video frames.

Contrast stretching:
The contrast improvement of video frames using contrast stretching can be done on the original image, which means that this process only depends on the value of intensity (gray level) of a pixel and is not dependent on other pixels around it.Contrast stretching will sharpen the elements in the image by increasing the dynamics of gray level.
In contrast stretching, each pixel in the image is transformed by: . (1) where, u(i,j) and o(i,j) are the pixels before and aftertransformed on the coordinate (i, j), c and dare the maximum and minimum values of pixels on the input image and L is the maximum value of gray.If the pixel value is less than zero, then it will be zero.Moreover, if the value is greater than L−1, then it will be L−1 (Al-Amri, 2011).

Morphological contrast enhancement:
The objective of morphological contrast enhancement is to clarify the objects in the video frames obtained from the monitoring of coastal areas.This technique can overcome the influence of sunlight (illumination); thus, the quality of image segmentation can be improved (Widyantara et al., 2016).Morphological contrast enhancement is applied using morphology operation, namely, top-hat and bottom-hat transformation (Hassanpour et al., 2015).
Top-hat transformation is a morphological operation that extracts the bright areas on the video frame using structure elements.
Conversely, bottom-hat transformation extracts the dark areas.Both morphology operationsare given as: Further more, the video frame with new contrast is obtained by summing the video frame with the results of a top-hat transformation.To optimize the contrast, the sum of video frames with the results of the top-hat transformationthen substracted to the results of the bottom-hat transformation.This process can reduce dark areas in the video frame.Mathematically, this process is given by: SOM: SOM algorithm separates objectsin the video frames based on similarity features in the color of the pixel, that is, the color index of the Red (R), Green (G) and Blue (B).Further more, SOM segments the color index by estimating the proximity to the center pixel cluster.The SOM algorithm used for segmenting the video frame is shown in Algorithm 1 (Kohonen, 2013).SOM is a form of unsupervised ANN topology, where the training process does not require supervision (target output).SOM is used for clustering the data based on the features of the data.Color image segmentation results using the SOM algorithm can produce a human perceptual segmentation approach.
Morphological operation: Morphological operation is used to optimize the segmentation result by eliminating noise on the objects that are not needed.Basic operations performed on the morphology are dilation and erosion.This operation is the basis for making a variety of morphological operations that are very useful for processing video frames.
Dilation: Dilation process is done by comparing each pixel on the input video frame with a central value of structuring element.This is done by superimposing structuring element with the video frame, so that the center of structuring element is to be right with the pixel position of the video frame.If an object (image input) is expressed by A, structuring element are expressed by B and B x is stated as translational B such that B lies in the center of x, then the dilation operation A to B can be expressed by: Algorithm 1: SOM Algorithm 1. Initialization a. Weight, w ji b.Initial learning rate, learning function, dan number of iteration.c.Number of cluster.2. As long as the maximum number of iterations has not been reached, do steps 3-7 3.For each input vector x (feature RGB), do steps 4-4.Calculate all j with: 5. Dj = ∑ ‫ݓ(‬ − ‫ݓ‬ ) 2 ;i = 1, 2, ...., N 6.Determine the index j such that the minimum D j 7.For each unit j around J, modification of weight with: 8. w ji (new) = w ji (old) + η (x i -w ji (old)) 9. Modifications learning rate Erosion: The erosion process is the opposite of dilation.If the dilation process produces large object, then the the reverse, the erosion processes will produce narrowed objects.The hole in the object will appear enlarged due to narrowing of the object boundary.Erosion operation is given by: Gray-Level Co-occurrence Matrix (GLCM): GLCM is included in statistical methods where the statistical calculations use gray degrees distribution (histogram).GLCM statistics is a popular method in the image texture feature extraction.Based on co-occurrence matrix, Haralick et al. (1973) defined fourteen texture features that were measured from a probability matrix to extract the characteristics of remote-sensing image texture.In this study, GLCM is used for texture features extraction of segmentation results.Texture features were used to identify areas (classification) with values of land, sea and sky labels.Texture features used were entropy, energy, contrast and homogeneity and are defined as (Zayed and Elnemr, 2015): ( , )ln ( , ) ) where, p d = The normalized symmetric GLCM p d (i,j) = The (i,j)th element of the nomalized GLCM K-NN: K-NN is an object classification method based on proximity (distance) of the data with other data.In the classification, there is a training system to assist in the classification.Training process on the K-NN method is done by storing the feature of vector images with a specified label (Kim et al., 2012).K-NN classification can perform well on image classification with texture features.K-NN classification algorithm is shown in Algorithm 2. In this study, Euclidean distance is used to measure the distance between test data and training data objects.

Algorithm 2: K-NN classification algorithm:
1. Z = (x',y'),s the test data as a function of a vector x' and the class label is unknown (y') 2. Calculate the distance d(x',x), which is the distance between the test data (Z) to each vector training data, store it in D. 3. Select D 2 ⊆ D, that is K-NNs of Z 4. Calculate the class: Shoreline extraction: In this study, the shoreline extraction process was performed using land label scanning on the results obtained after K-NN classification.Scanning of labels made against neighboring pixels ofthe image of the label area of land.
If the neighboring pixels were not members of the land label, then the pixels are marked as pixels of the shoreline.A collection of pixels that were marked as pixels of the shoreline will form shoreline areas.

RESULTS AND DISCUSSION
The detection of the shoreline position during video frame monitoring coastal areas using data mining techniques has been applied in this study using Matlab R2014a.Figure 2 shows that the shoreline position was successfully determined using the video frame monitoring shoreline system.The system consists of several sub-processes including training systems, preprocessing, image segmentation, morphological operations, classification and determination of shoreline position.
Training system: Figure 3 shows training processes for training data using K-NN classification.In the training system, texture feature extraction is performed using GLCM.Texture is stored with a label that has been determined using a. csv file that will be used in the classification process.Figure 4 shows samples of the training data using the K-NN classification training system.
Preprocessing: In this process, video frame enhancement is done using contrast stretching and morphological contrast stretching so that the color in the video frame is sharper and the influence of illumination is reduced on the frame contrast stretching operation.The results of preprocessing a video frame are shown in  In the SOM segmentation, feature values of RGB should be normalized.The aim is that values of feature has an uniform range of minimum and maximum values.After the process of normalization, the segmentation mechanism using SOM was conducted with several attribute values, i.e., the number of clusters is 3, the maximum number of iterations is 100, the learning rate is 0.5, the learning function is 0.2 and the initialization of the initial weight is randomly determined according to the number of clusters.Determination of the attribute values is based on a series of experiments that can maximize the performance of the SOM algorithm.The segmentation process using SOM is shown in Algorithm 3, while the segmentation results are shown in Fig. 6.
The performance evaluation of the SOM algorithm in segmenting the video frame on a shoreline detection system is determined by searching an index value validation, using the silhouette coefficient (Rousseeuw, 1987).The measurements are carried out against three randomized trial data.
Table 1 shows that the quality of the segmentation generated by the SOM algorithm is good, which is entered in the category of reasonable cluster.It has been shown that the application of preprocessing techniques using contrast stretching and morphological contrast enhancement can help the SOM-based segmentation process for segmenting objects in the video frames.Preliminary research has been done also shows that the application of techniques based on morphological contrast enhancement is able to indicate the degree of ownership of the objects in the cluster approach 1 (reasonable).The values of silhouette has a range of -1 to 1, where the value is close to 1 have a better quality cluster.This means that the contrast manipulationbased techniques can support the process of segmentation (Widyantara et al., 2016).K-NN algorithm testing is done by calculating the area under the curve (AUC) on the ROC curve (Han et al., 2011).ROC curves are presented on the basis of the results of testing of each class label a with confusion matrix.Each class was tested three times, with a set of 30 testing data.The classification is evaluated by analyzing the accuracy, sensitivity, specificity and false positive rate.The results of the confusion matrix test in each class are presented on the ROC curve.As shown in Table 2 and Fig. 8, in general, the classification of sea, land and sky labels can be performed well by using the K-NN algorithm.This is evidenced by the AUC value that is at an average value of sensitivity approaches a value of 1, each of 0.94 to sea label, 0.82 to land label and 0.84 to sky label.In data mining, AUC value range is from 0.5 up to 1.In the AUC value of 0.9 up to 1, said that the quality classification is unbelievably good and at a value from 0.8 to 0.89 classification quality is good (Gorunescu, 2011).

Shoreline detection:
In the process of determining shorelines, the neighboring pixels were scanned from the edge of the land areas using binary image transformation.Scanning was performed from the right side in Fig. 9.If the neighboring pixels had a value of approximately zero, then the pixel was given a value of one as a shoreline sign.
To determine the change of shoreline, shoreline position comparisons are needed between video frames.This study uses the shoreline position in a reference frame as the reference position.Furthermore, this reference position compared to the position of the shoreline in the other video frame.The results of the comparison will be displayed in a video frame reconstruction (Fig. 10).The shoreline found is provided in red, the shoreline of the reference frame is in purple and the area of the shoreline change is in pink.
The information of the distance between video frame inputs and reference frames denotes the number of pixels in the range of marked areas.

CONCLUSION
The implementation of data mining techniques for detecting the shoreline location by using frame-byframe video monitoring of shore areas has been performed.The proposed system comprises a classification training system for a shore area and has a shoreline detection system that is based on SOM and K-NN algorithms.This system can automatically detect the position of the shoreline in the video frame.It can also display information concerning shoreline alteration based on the reference frame.The distance information concerning the changes in a shoreline is in pixels.
Further research is needed to change the video frame to the map domain using the rectification technique so that the distance measurement can be performed using scaling techniques.

Morphology operation :
Application of morphology operation is to reduce the set of small pixels on the results of segmentation that can affect the performance of the classification of the shore area.As shown in Fig. 7, morphological operations are able to optimize the segmentation results generated by SOM.The application of the morphology operation carried out at several stages of the process, namely, a binary image transformation, opening, closing and imfill.The stages of implementing techniques of morphology operation are shown in Algorithm 4. The final results of the morphology operation are then used as a reference matrix to optimize the segmentation results for the classification process.Algorithm 4: Morphology operation: 1. Binary image transformation BW1 = im2 bw (segmentation result) 2. Opening operation BWao = bwareaopen(BW1) 3. Closing operation closeBWao = imclose (BWao,nhood); 4. Filtering Operation rough Mask = imfill (close BWao,' holes'); K-NN Classification: KNN classification aims to provide a label class in each region segmentation results of SOM.This study has used three class labels, namely, sea, land and sky.In this study, the classification process is carried out in three main stages, namely, the extraction of features, trainning of dataset and classification of K-NN.The implementation details of each stage is shown in Algorithm 5.

Algorithm 5 :
Classification process: Training Data: Input: Sample Data, Label Output: Training Data

Fig. 9 :Fig. 10 :
Fig. 9: Determining shoreline position process on frame 1 and frame 2: (a) and (e) areas with land label, (b) and (f) transformation results of binary images, (c) and (g) scanning neighboring pixels and (d) and (h) shoreline on a video frame