Basic Image Data Analysis Using Python – Part 4

In this last part of basic image analysis, we’ll go through some of the following contents.Following contents is the reflection of my completed academic image processing course in the previous term..You can find the first three here:Part 1 | Part 2 | Part 3Now, lets get started!Ostu’s MethodThresholding is a very basic operation in image processing..This will redirect you to my homepage where we explained mathematics behind Otsu method.AlgorithmIf we incorporate a little math into that simple step-wise algorithm, such an explanation evolves:The Desired threshold corresponds to the maximum value of σ2b(t).  Nice but not Great. Otsu’s method exhibits the relatively good performance if the histogram can be assumed to have bimodal distribution and assumed to possess a deep and sharp valley between two peaks.So, now if the object area is small compared with the background area, the histogram no longer exhibits bimodality and if the variances of the object and the background intensities are large compared to the mean difference, or the image is severely corrupted by additive noise, the sharp valley of the gray level histogram is degraded.As a result, the possibly incorrect threshold determined by Otsu’s method results in the segmentation error. But we can further improve Otsu’s method.k-means clustering is a method of vector quantization, originally from signal processing, that is popular for cluster analysis in data mining.In Otsu thresholding, we found the threshold which minimized the intra-segment pixel variance. So, rather than looking for a threshold from a gray level image, we can look for clusters in color space, and by doing so we end up with the K-means clustering technique. For clustering the image, we need to convert it into a two-dimensional array. Next, we use scikit-learn’s cluster method to create clusters. We pass n_clusters as 5 to form five clusters. The clusters appear in the resulting image, dividing it into five parts with distinct colors.The clustering number 5 was chosen heuristically for this demonstration. One can change the number of clusters to visually validate image with different colors and decide that closely matches the required number of clusters. Once the clusters are formed, we can recreate the image with the cluster centers and labels to display the image with grouped patterns.Hough Transform Hough Transform is a popular technique to detect any shape if we can represent that shape in mathematical form. It can detect the shape even if it is broken or distorted a little bit. We won’t go too deeper to analyze the mechanism of Hough transform rather than giving intuitive mathematical description before implementing it on code and also provide some resource to understand it more in details.Mathematical Formulation of Hough Transform. This will redirect you to my homepage where we explained mathematics behind Hough Transform method. Algorithm Edge detection is an image processing technique for finding the boundaries of objects within images. It works by detecting discontinuities in brightness. Common edge detection algorithms includeHere, We’ll cover one of the most popular methods, which is the Canny Edge Detection.Canny Edge DetectionA multi-stage edge detection operation capable of detecting a wide range of edges in images. Now, the Process of Canny edge detection algorithm can be broken down into 5 different steps:Let’s understand each of them intuitively. For a more comprehensive overview, please check the given link at the end of this article. However, this article is already becoming too big, so we decide not to provide the full implementation of code here rather than giving an intuitive overview of an algorithm of that code. But one can skip and jump to the repo for the code :)The process of Canny Edge Detection.. More details

Leave a Reply