<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>http://vista.su.domains/psych221wiki/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Sisira2</id>
	<title>Psych 221 Image Systems Engineering - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="http://vista.su.domains/psych221wiki/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Sisira2"/>
	<link rel="alternate" type="text/html" href="http://vista.su.domains/psych221wiki/index.php?title=Special:Contributions/Sisira2"/>
	<updated>2026-07-12T05:00:26Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.45.3</generator>
	<entry>
		<id>http://vista.su.domains/psych221wiki/index.php?title=Smart_Cluster_Selection_for_CIELAB_Color_Segmentation&amp;diff=146066</id>
		<title>Smart Cluster Selection for CIELAB Color Segmentation</title>
		<link rel="alternate" type="text/html" href="http://vista.su.domains/psych221wiki/index.php?title=Smart_Cluster_Selection_for_CIELAB_Color_Segmentation&amp;diff=146066"/>
		<updated>2025-12-13T07:14:23Z</updated>

		<summary type="html">&lt;p&gt;Sisira2: /* References */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction ==&lt;br /&gt;
Image segmentation is a fundamental step in many computer vision applications because it allows algorithms to separate meaningful regions, identify objects, and reduce the complexity of visual scenes. Color is one of the most informative cues for distinguishing visual elements, which is why color-based segmentation methods are commonly used. In particular, clustering techniques group pixels that have similar color characteristics, making them effective for isolating regions with shared appearance.&lt;br /&gt;
&lt;br /&gt;
Color-based segmentation is especially important in applications such as remote sensing, where large images often contain regions like vegetation, water, and urban areas that are best distinguished by color. Accurate segmentation in these settings supports tasks such as land cover analysis, environmental monitoring, and change detection, making efficient color segmentation a practical requirement.&lt;br /&gt;
&lt;br /&gt;
A major challenge in color-based segmentation is determining the appropriate number of color clusters for a given image. If too few clusters are chosen, under-segmentation occurs and important details may be merged. If too many clusters are used, over-segmentation can occur, where noise or small variations form meaningless regions. Common techniques such as the Elbow Method and the Gap Statistic estimate the number of clusters by repeatedly running clustering algorithms like K-Means with different values of k. While effective, these methods are computationally expensive for high-resolution images or large datasets and are often unsuitable for real-time use.&lt;br /&gt;
&lt;br /&gt;
This project proposes an alternative approach that estimates the ideal number of color clusters directly from the statistical properties of the image. By analyzing lightness variation, chromatic distributions, and color histograms in the CIELAB color space, the method aims to infer the number of meaningful color groups without testing many cluster values, resulting in a faster and more scalable solution.&lt;br /&gt;
&lt;br /&gt;
== Background ==&lt;br /&gt;
Color-based image segmentation is widely used in computer vision because color provides a strong and intuitive cue for separating different regions in an image. Many real-world images contain objects or areas that are more easily distinguished by color than by shape or texture, especially in scenes with complex structure or uneven lighting. By grouping pixels with similar color properties, segmentation methods can reduce image complexity and make later processing steps more efficient.&lt;br /&gt;
&lt;br /&gt;
To make color comparisons meaningful, pixel values are often represented in a perceptual color space rather than directly in RGB. The CIELAB color space is commonly used because it separates lightness from chromatic information, allowing brightness changes to be handled independently from color differences. This is important in practical settings where illumination varies across the image. In addition, CIELAB is approximately perceptually uniform, meaning that distances in the space align reasonably well with how humans perceive color differences. For this reason, simple distance measures in CIELAB are effective for clustering and segmentation tasks.&lt;br /&gt;
&lt;br /&gt;
Many existing segmentation methods rely on statistical information derived from color distributions. Techniques such as K-Means, Mean Shift, and Gaussian Mixture Models group pixels based on similarity, often using histogram information to capture how colors are distributed across an image. Color histograms, in particular, provide a compact summary of lightness and chromatic variation. Peaks in these histograms often correspond to dominant colors or distinct regions, making histogram structure a useful indicator of image complexity.&lt;br /&gt;
&lt;br /&gt;
A key challenge in clustering-based segmentation is selecting the number of clusters. Traditional approaches such as the Elbow Method and the Gap Statistic estimate this number by repeatedly running clustering algorithms with different settings and comparing the results. While these methods are well established, their reliance on multiple clustering runs makes them computationally expensive, especially for high-resolution images or large collections of data.&lt;br /&gt;
&lt;br /&gt;
The ideas behind perceptual color spaces, histogram analysis, and cluster estimation motivate the approach taken in this project. Instead of repeatedly applying clustering algorithms, this work explores whether the number of meaningful color regions can be inferred directly from image statistics in the CIELAB space. By analyzing lightness variation, chromatic spread, and histogram structure, the proposed method aims to estimate the appropriate number of color clusters efficiently, reducing computation while still supporting reliable image segmentation.&lt;br /&gt;
&lt;br /&gt;
== Methods ==&lt;br /&gt;
&lt;br /&gt;
=== Proposed Method ===&lt;br /&gt;
The proposed method consists of three main stages. First, the input image is converted from the three-channel RGB color space to the CIELAB (Lab*) color space. Separate histograms are then extracted for the &amp;lt;math&amp;gt;L&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;a&amp;lt;/math&amp;gt;, and &amp;lt;math&amp;gt;b&amp;lt;/math&amp;gt; channels. Second, two statistical parameters are computed from each histogram: the standard deviation and the number of local maxima. These values describe the distribution and structure of lightness and color information in the image. Finally, the optimal number of color clusters is estimated using the CIELAB Color Segment Estimation (CCSE) function, defined as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt; &amp;lt;math&amp;gt; k = \left\lfloor \ln\left(\frac{\sigma_L}{n_L}\right) \right\rfloor \cdot \max(n_a, n_b) + \min(n_a, n_b) &amp;lt;/math&amp;gt; &amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In this equation, &amp;lt;math&amp;gt;\sigma_L&amp;lt;/math&amp;gt; denotes the standard deviation of the &amp;lt;math&amp;gt;L&amp;lt;/math&amp;gt;-channel histogram, while &amp;lt;math&amp;gt;n_L&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;n_a&amp;lt;/math&amp;gt;, and &amp;lt;math&amp;gt;n_b&amp;lt;/math&amp;gt; represent the number of local maxima detected in the &amp;lt;math&amp;gt;L&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;a&amp;lt;/math&amp;gt;, and &amp;lt;math&amp;gt;b&amp;lt;/math&amp;gt; histograms, respectively. The term &amp;lt;math&amp;gt;\max(n_a, n_b)&amp;lt;/math&amp;gt; selects the channel with the strongest chromatic variation, while &amp;lt;math&amp;gt;\min(n_a, n_b)&amp;lt;/math&amp;gt; represents the weaker chromatic channel. A complete overview of the method is illustrated in the processing pipeline shown in Figure 3. It should be noted that this method requires input images to be in standard three-channel RGB format.&lt;br /&gt;
&lt;br /&gt;
=== Color Histogram ===&lt;br /&gt;
Color information in an image can be described using several types of descriptors, such as color histograms, color correlograms, color coherence vectors, and color moments. Among these options, the color histogram is one of the most commonly used representations because it is simple to compute and effective at capturing overall color content, especially when an image has a distinct color distribution compared to others in a dataset.&lt;br /&gt;
&lt;br /&gt;
In the proposed method, information is extracted from the &amp;lt;math&amp;gt;L&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;a&amp;lt;/math&amp;gt;, and &amp;lt;math&amp;gt;b&amp;lt;/math&amp;gt; histograms by analyzing their standard deviations and the number of local maxima. These measurements describe important properties of the image and provide the motivation for the design of the CCSE function:&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;Lightness distribution&#039;&#039;&#039;: The standard deviation of the &amp;lt;math&amp;gt;L&amp;lt;/math&amp;gt;-channel histogram indicates the range of lightness values in the image. A larger standard deviation corresponds to a wider spread of brightness levels, while a smaller value suggests more uniform lighting.&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;Color distribution&#039;&#039;&#039;: The standard deviations of the &amp;lt;math&amp;gt;a&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;b&amp;lt;/math&amp;gt; histograms reflect the diversity of chromatic content. Higher values indicate a broader range of colors, whereas lower values suggest limited color variation.&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;Peak separability&#039;&#039;&#039;: The number of local maxima in the &amp;lt;math&amp;gt;L&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;a&amp;lt;/math&amp;gt;, and &amp;lt;math&amp;gt;b&amp;lt;/math&amp;gt; histograms indicates how well different lightness and color levels are separated. More local maxima imply clearly distinguishable color or intensity regions, while fewer maxima suggest more clustered values.&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;Image complexity&#039;&#039;&#039;: Taken together, the standard deviations and local maxima across all three channels provide an estimate of overall image complexity. Images with larger histogram spreads and more peaks are considered more complex, while images with fewer peaks and narrower distributions are simpler.&lt;br /&gt;
&lt;br /&gt;
Overall, histogram analysis offers a compact yet informative description of an image’s lightness and color structure, which is valuable for segmentation and object recognition tasks.&lt;br /&gt;
&lt;br /&gt;
=== CCSE Function ===&lt;br /&gt;
The term &amp;lt;math&amp;gt;\left\lfloor \ln\left(\frac{\sigma_L}{n_L}\right) \right\rfloor&amp;lt;/math&amp;gt; computes the logarithm of the ratio between the standard deviation of the &amp;lt;math&amp;gt;L&amp;lt;/math&amp;gt;-channel histogram and the number of its local maxima. This ratio reflects the balance between the spread of lightness values and the separability of different lightness levels in the image. Applying the logarithm helps normalize the scale of the values and reduces sensitivity to extreme cases. The floor operation ensures that the resulting estimate of the number of clusters remains an integer. This formulation also prevents the estimated number of clusters from becoming too small when an image contains colors with very similar hues and limited lightness variation.&lt;br /&gt;
&lt;br /&gt;
Multiplying this term by &amp;lt;math&amp;gt;\max(n_a, n_b)&amp;lt;/math&amp;gt; emphasizes the chromatic channel with the greater number of distinct peaks, which typically corresponds to the dominant source of color variation in the image. Using only the weaker chromatic channel could lead to an underestimation of the required number of color segments.&lt;br /&gt;
&lt;br /&gt;
Finally, adding &amp;lt;math&amp;gt;\min(n_a, n_b)&amp;lt;/math&amp;gt; ensures that information from the less dominant chromatic channel is still taken into account. While the channel with stronger variation plays a more important role, incorporating the weaker channel leads to a more balanced and accurate estimation of the number of color clusters.&lt;br /&gt;
&lt;br /&gt;
=== Time Complexity ===&lt;br /&gt;
&lt;br /&gt;
The time complexity of the function is determined by analyzing each of its main steps. Since the color histograms contain at most 256 bins, operations such as finding local maxima can be treated as constant time. Assigning the image variable takes constant time, while converting the image from RGB to CIELAB requires linear time with respect to the total number of pixels, denoted by &amp;lt;math&amp;gt;N&amp;lt;/math&amp;gt;. Histogram computation also has linear time complexity because each pixel contributes once. Peak detection remains constant time due to the fixed histogram size. The loop used in the function has a worst-case time complexity of &amp;lt;math&amp;gt;O(N)&amp;lt;/math&amp;gt;, and the final computation used to estimate the number of clusters takes constant time. Overall, the operations that depend on image size scale linearly with the number of pixels. Therefore, the total time complexity of the function is &amp;lt;math&amp;gt;O(N)&amp;lt;/math&amp;gt;, where &amp;lt;math&amp;gt;N&amp;lt;/math&amp;gt; is the number of pixels in the image.&lt;br /&gt;
&lt;br /&gt;
== Results ==&lt;br /&gt;
&lt;br /&gt;
=== Visual Validation ===&lt;br /&gt;
&lt;br /&gt;
The first part of the evaluation focuses on visual validation, which allows us to directly compare the segmentation results produced by the CCSE algorithm with those from the Elbow Method and the Gap Statistic Method. To ensure a fair comparison, all methods are tested under the same conditions. Since the Elbow and Gap methods require evaluating a range of cluster values, we set a maximum number of clusters of 𝐾max = 20 for all images.&lt;br /&gt;
&lt;br /&gt;
After estimating the optimal number of clusters using each method, the images are segmented accordingly and visually inspected. The comparison focuses on how well each method captures dominant color regions, object boundaries, and overall segmentation smoothness. The results show that the segmentations produced by CCSE are visually very similar to those obtained using the Elbow and Gap methods. This indicates that CCSE successfully captures the main color structures of the images.&lt;br /&gt;
&lt;br /&gt;
Overall, this visual validation demonstrates that CCSE can achieve segmentation quality comparable to established methods, while avoiding the repeated clustering steps required by the Elbow and Gap approaches.&lt;br /&gt;
&lt;br /&gt;
[[File:visualvalidation.png|center|frameless|400px]]&lt;br /&gt;
&lt;br /&gt;
=== Quantitative Validation ===&lt;br /&gt;
&lt;br /&gt;
Quantitative validation is performed using &#039;&#039;&#039;Color Reconstruction Error-based Segmentation Evaluation (CRESE)&#039;&#039;&#039;. This metric evaluates how accurately a segmented image reconstructs the original image in terms of color. It computes the sum of color differences between each pixel’s original color and the average color of the cluster to which the pixel is assigned. A lower reconstruction error indicates better segmentation performance and a more accurate estimate of the number of color clusters.&lt;br /&gt;
&lt;br /&gt;
Let &amp;lt;math&amp;gt;O \in \mathbb{R}^{H \times W \times 3}&amp;lt;/math&amp;gt; denote the original image, and let &amp;lt;math&amp;gt;S \in \mathbb{R}^{H \times W \times 3}&amp;lt;/math&amp;gt; denote the segmented image, where each pixel is replaced by the average color of its assigned cluster. Let&lt;br /&gt;
&amp;lt;math&amp;gt;C = {c_1, c_2, \dots, c_n}&amp;lt;/math&amp;gt; be the set of unique cluster colors in &amp;lt;math&amp;gt;S&amp;lt;/math&amp;gt;, where &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; is the number of clusters. For each cluster color &amp;lt;math&amp;gt;c_i&amp;lt;/math&amp;gt;, a binary mask &amp;lt;math&amp;gt;M_i \in {0,1}^{H \times W}&amp;lt;/math&amp;gt; is defined to indicate pixel membership.&lt;br /&gt;
&lt;br /&gt;
The total color reconstruction error &amp;lt;math&amp;gt;E&amp;lt;/math&amp;gt; is computed as follows:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt; &amp;lt;math&amp;gt; E = \sum_{i=1}^{n} \sum_{h=1}^{H} \sum_{w=1}^{W} M_i(h,w)\,\left\| O(h,w) - c_i \right\|_2 &amp;lt;/math&amp;gt; &amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The ||*|| shows the Euclidean distance between color vectors. In this evaluation, the color reconstruction error is computed using the Euclidean distance between color vectors in the CIELAB color space. Both the original image &amp;lt;math&amp;gt;O&amp;lt;/math&amp;gt; and the cluster representative colors &amp;lt;math&amp;gt;c_i&amp;lt;/math&amp;gt; are first converted from RGB to CIELAB before the distance is computed. This choice is motivated by the perceptual properties of the CIELAB color space, which is designed so that Euclidean distances correspond approximately to perceived color differences. As a result, Euclidean distance in CIELAB provides a meaningful and interpretable measure of how well the segmented image preserves the original colors.&lt;br /&gt;
&lt;br /&gt;
Although perceptual color difference metrics such as &amp;lt;math&amp;gt;\Delta E&amp;lt;/math&amp;gt; are commonly used for precise color comparison, Euclidean distance in CIELAB offers a computationally efficient alternative while remaining perceptually relevant. Since CRESE is used to compare relative segmentation performance across methods rather than to measure absolute perceptual color error, this simplified distance metric is sufficient for evaluation purposes. In contrast, computing reconstruction error directly in RGB space would be less appropriate, as Euclidean distances in RGB do not correspond well to human color perception and are sensitive to illumination variations.&lt;br /&gt;
&lt;br /&gt;
To enable comparison across images of different sizes, the error is normalized and expressed as a percentage:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt; &amp;lt;math&amp;gt; E_{\text{normalized}} = \frac{E}{H \cdot W \cdot 255 \cdot \sqrt{3}} \times 100 &amp;lt;/math&amp;gt; &amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
During experimentation, contrast enhancement was observed to increase the estimated number of clusters. Since contrast enhancement has constant-time complexity, it does not affect the computational cost of the CRESE evaluation. Using this metric, validation curves of normalized reconstruction error versus the number of clusters &amp;lt;math&amp;gt;k&amp;lt;/math&amp;gt; are generated for both original and contrast-enhanced images.&lt;br /&gt;
&lt;br /&gt;
[[Image:quantitativevalidation.png|center|frameless|700px]]&lt;br /&gt;
&lt;br /&gt;
=== Efficiency Validation ===&lt;br /&gt;
&lt;br /&gt;
This section evaluates the computation time of the CCSE algorithm and compares it with the Elbow Method and the Gap Statistic Method in the context of image segmentation. While earlier sections focused on segmentation accuracy, the goal here is to understand how efficiently each method performs as image size increases.&lt;br /&gt;
&lt;br /&gt;
A high resolution beach image with a size of 3840 × 2160 pixels is used as the test image. The image is not contrast enhanced so that computation time is affected only by image size and not by additional preprocessing. To analyze scalability, resized versions of the image are created while preserving the original aspect ratio. The image is scaled to 10%, 25%, 33%, 50%, and 75% of its original dimensions, resulting in a range of images with different pixel counts.&lt;br /&gt;
&lt;br /&gt;
To ensure a fair comparison, the maximum number of clusters is fixed at &amp;lt;math&amp;gt;K_{\max} = 20&amp;lt;/math&amp;gt; for both the Elbow Method and the Gap Statistic Method. For each resized image, the time required by each algorithm to estimate the optimal number of clusters is measured. These measurements allow us to observe how computation time changes as image resolution increases.&lt;br /&gt;
&lt;br /&gt;
By comparing the computation times across all image sizes, we can evaluate the efficiency and scalability of each method. This analysis helps determine which approach is more suitable for real world applications where image sizes may vary significantly. The results also highlight the ability of the CCSE algorithm to handle larger images efficiently while still producing reliable cluster estimates.&lt;br /&gt;
&lt;br /&gt;
[[Image:compvalidation.png|center|frameless|400px]]&lt;br /&gt;
&lt;br /&gt;
=== Sensitivity Validation ===&lt;br /&gt;
&lt;br /&gt;
Sensitivity analysis is used to evaluate how stable each clustering method is when its input parameters change. A method that is less sensitive to parameter variation is considered more robust because it produces more consistent results under different settings.&lt;br /&gt;
&lt;br /&gt;
In this study, sensitivity is evaluated for all three methods. For the Elbow Method and the Gap Statistic Method, sensitivity is tested by changing the maximum number of clusters, &amp;lt;math&amp;gt;K_{\max}&amp;lt;/math&amp;gt;. For the CCSE algorithm, sensitivity is examined by varying the distance parameter &amp;lt;math&amp;gt;D&amp;lt;/math&amp;gt;, which controls how histogram peaks are grouped when estimating the number of clusters.&lt;br /&gt;
&lt;br /&gt;
To ensure a fair comparison, the same parameter range is used for all methods. The value of &amp;lt;math&amp;gt;D&amp;lt;/math&amp;gt; for CCSE is set equal to &amp;lt;math&amp;gt;K_{\max}&amp;lt;/math&amp;gt; for the Elbow and Gap methods. Both parameters are varied from 5 to 40, using an increment of 5. For each parameter value, the estimated number of clusters is recorded and compared.&lt;br /&gt;
&lt;br /&gt;
[[Image:sensitivityvalidaiton.png|center|frameless|400px]]&lt;br /&gt;
&lt;br /&gt;
The Gap Statistic Method shows a nearly linear increase in the estimated number of clusters as &amp;lt;math&amp;gt;K_{\max}&amp;lt;/math&amp;gt; increases. This behavior indicates a high sensitivity to the chosen maximum value, meaning the estimated result depends strongly on the input parameter.&lt;br /&gt;
&lt;br /&gt;
The Elbow Method shows a non linear trend and is slightly less sensitive than the Gap Statistic Method. However, the estimated number of clusters still changes noticeably as &amp;lt;math&amp;gt;K_{\max}&amp;lt;/math&amp;gt; increases, which suggests that the method remains dependent on the selected parameter range.&lt;br /&gt;
&lt;br /&gt;
In contrast, the CCSE algorithm produces more stable estimates as the distance parameter &amp;lt;math&amp;gt;D&amp;lt;/math&amp;gt; increases. While the estimated number of clusters decreases gradually, the change is smoother and more controlled compared to the other methods. This indicates lower sensitivity to parameter variation.&lt;br /&gt;
&lt;br /&gt;
Overall, the CCSE algorithm demonstrates the highest robustness among the three methods. Its reduced sensitivity to parameter changes allows it to produce more consistent cluster estimates across a wide range of settings, making it more reliable for practical image segmentation tasks.&lt;br /&gt;
&lt;br /&gt;
== Conclusion ==&lt;br /&gt;
&lt;br /&gt;
From the results presented above, it can be concluded that the proposed CCSE algorithm performs well across several important aspects of image segmentation, including segmentation quality, computation time, and robustness. Visual inspection shows that the segmented images produced using CCSE are similar to those generated by the Elbow Method and the Gap Statistic, indicating that CCSE is able to capture the main color structure of the images.&lt;br /&gt;
&lt;br /&gt;
Quantitative evaluation using the CRESE metric further supports these observations. For both original and contrast-enhanced images, the reconstruction errors produced by CCSE are comparable to those of the other methods. This shows that CCSE can estimate a reasonable number of color clusters even when image contrast changes.&lt;br /&gt;
&lt;br /&gt;
In terms of efficiency, CCSE clearly outperforms the Elbow and Gap Statistic methods. Its computation time increases very little as image size grows, making it suitable for high-resolution images and large datasets. In addition, CCSE shows stable behavior across different parameter settings, which indicates good robustness.&lt;br /&gt;
&lt;br /&gt;
Overall, the CCSE algorithm provides a practical and reliable approach for estimating the number of color clusters in image segmentation, offering a good balance between accuracy, speed, and stability.&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
[1] Kim, D. W., S. J. Jeong, W. S. Lee, H. Yun, and Y. S. Chung. “Growth Monitoring of Field-Grown Onion and Garlic by CIE L*a*b* Color Space and Region-Based Crop Segmentation of UAV RGB Images.” &#039;&#039;Precision Agriculture&#039;&#039;, 2023, Springer.&lt;br /&gt;
&lt;br /&gt;
[2]  Abdelsadek, D. A., M. N. Al-Berry, H. M. Ebied, et al. “Impact of Using Different Color Spaces on Image Segmentation.” &#039;&#039;Proceedings of the International Conference on Advanced Computing&#039;&#039;, 2022, Springer.&lt;br /&gt;
&lt;br /&gt;
[3]  Permadi, V. A., S. P. Tahalea, and R. P. Agusdin. “K-Means and Elbow Method for Cluster Analysis of Elementary School Data.” &#039;&#039;Progres Pendidikan&#039;&#039;, 2023.&lt;br /&gt;
&lt;br /&gt;
[4]  Herdiana, I., M. A. Kamal, and M. N. Estri. “A More Precise Elbow Method for Optimum K-Means Clustering.” &#039;&#039;arXiv&#039;&#039;, arXiv:2502.00851, 2025.&lt;br /&gt;
&lt;br /&gt;
[5]  Khan, I. K., H. Daud, N. Zainuddin, et al. “Standardizing Reference Data in Gap Statistic for Selection of Optimal Number of Clusters in K-Means Algorithm.” &#039;&#039;Alexandria Engineering Journal&#039;&#039;, 2025, Elsevier.&lt;br /&gt;
&lt;br /&gt;
[6]  Cinko, U. O., and B. Becerir. “Computing Characteristics of Color Difference Formulas for Regular Coordinate Changes in CIELAB Color Space.” &#039;&#039;Textile Research Journal&#039;&#039;, 2025.&lt;br /&gt;
&lt;br /&gt;
[7]  Jain, Y., V. Saxena, and S. Mittal. “Ensembling Deep Learning and CIELAB Color Space Model for Fire Detection from UAV Images.” &#039;&#039;Proceedings of the Second International Conference on Artificial Intelligence Applications&#039;&#039;, 2022, ACM.&lt;br /&gt;
&lt;br /&gt;
== Appendix 1 ==&lt;br /&gt;
&lt;br /&gt;
link to code: https://drive.google.com/drive/folders/1kJ1jRgtYwjPT1HOiSKBag3t2gvJKGu8J?usp=drive_link&lt;/div&gt;</summary>
		<author><name>Sisira2</name></author>
	</entry>
	<entry>
		<id>http://vista.su.domains/psych221wiki/index.php?title=Smart_Cluster_Selection_for_CIELAB_Color_Segmentation&amp;diff=146055</id>
		<title>Smart Cluster Selection for CIELAB Color Segmentation</title>
		<link rel="alternate" type="text/html" href="http://vista.su.domains/psych221wiki/index.php?title=Smart_Cluster_Selection_for_CIELAB_Color_Segmentation&amp;diff=146055"/>
		<updated>2025-12-13T07:02:59Z</updated>

		<summary type="html">&lt;p&gt;Sisira2: /* Methods */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction ==&lt;br /&gt;
Image segmentation is a fundamental step in many computer vision applications because it allows algorithms to separate meaningful regions, identify objects, and reduce the complexity of visual scenes. Color is one of the most informative cues for distinguishing visual elements, which is why color-based segmentation methods are commonly used. In particular, clustering techniques group pixels that have similar color characteristics, making them effective for isolating regions with shared appearance.&lt;br /&gt;
&lt;br /&gt;
Color-based segmentation is especially important in applications such as remote sensing, where large images often contain regions like vegetation, water, and urban areas that are best distinguished by color. Accurate segmentation in these settings supports tasks such as land cover analysis, environmental monitoring, and change detection, making efficient color segmentation a practical requirement.&lt;br /&gt;
&lt;br /&gt;
A major challenge in color-based segmentation is determining the appropriate number of color clusters for a given image. If too few clusters are chosen, under-segmentation occurs and important details may be merged. If too many clusters are used, over-segmentation can occur, where noise or small variations form meaningless regions. Common techniques such as the Elbow Method and the Gap Statistic estimate the number of clusters by repeatedly running clustering algorithms like K-Means with different values of k. While effective, these methods are computationally expensive for high-resolution images or large datasets and are often unsuitable for real-time use.&lt;br /&gt;
&lt;br /&gt;
This project proposes an alternative approach that estimates the ideal number of color clusters directly from the statistical properties of the image. By analyzing lightness variation, chromatic distributions, and color histograms in the CIELAB color space, the method aims to infer the number of meaningful color groups without testing many cluster values, resulting in a faster and more scalable solution.&lt;br /&gt;
&lt;br /&gt;
== Background ==&lt;br /&gt;
Color-based image segmentation is widely used in computer vision because color provides a strong and intuitive cue for separating different regions in an image. Many real-world images contain objects or areas that are more easily distinguished by color than by shape or texture, especially in scenes with complex structure or uneven lighting. By grouping pixels with similar color properties, segmentation methods can reduce image complexity and make later processing steps more efficient.&lt;br /&gt;
&lt;br /&gt;
To make color comparisons meaningful, pixel values are often represented in a perceptual color space rather than directly in RGB. The CIELAB color space is commonly used because it separates lightness from chromatic information, allowing brightness changes to be handled independently from color differences. This is important in practical settings where illumination varies across the image. In addition, CIELAB is approximately perceptually uniform, meaning that distances in the space align reasonably well with how humans perceive color differences. For this reason, simple distance measures in CIELAB are effective for clustering and segmentation tasks.&lt;br /&gt;
&lt;br /&gt;
Many existing segmentation methods rely on statistical information derived from color distributions. Techniques such as K-Means, Mean Shift, and Gaussian Mixture Models group pixels based on similarity, often using histogram information to capture how colors are distributed across an image. Color histograms, in particular, provide a compact summary of lightness and chromatic variation. Peaks in these histograms often correspond to dominant colors or distinct regions, making histogram structure a useful indicator of image complexity.&lt;br /&gt;
&lt;br /&gt;
A key challenge in clustering-based segmentation is selecting the number of clusters. Traditional approaches such as the Elbow Method and the Gap Statistic estimate this number by repeatedly running clustering algorithms with different settings and comparing the results. While these methods are well established, their reliance on multiple clustering runs makes them computationally expensive, especially for high-resolution images or large collections of data.&lt;br /&gt;
&lt;br /&gt;
The ideas behind perceptual color spaces, histogram analysis, and cluster estimation motivate the approach taken in this project. Instead of repeatedly applying clustering algorithms, this work explores whether the number of meaningful color regions can be inferred directly from image statistics in the CIELAB space. By analyzing lightness variation, chromatic spread, and histogram structure, the proposed method aims to estimate the appropriate number of color clusters efficiently, reducing computation while still supporting reliable image segmentation.&lt;br /&gt;
&lt;br /&gt;
== Methods ==&lt;br /&gt;
&lt;br /&gt;
=== Proposed Method ===&lt;br /&gt;
The proposed method consists of three main stages. First, the input image is converted from the three-channel RGB color space to the CIELAB (Lab*) color space. Separate histograms are then extracted for the &amp;lt;math&amp;gt;L&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;a&amp;lt;/math&amp;gt;, and &amp;lt;math&amp;gt;b&amp;lt;/math&amp;gt; channels. Second, two statistical parameters are computed from each histogram: the standard deviation and the number of local maxima. These values describe the distribution and structure of lightness and color information in the image. Finally, the optimal number of color clusters is estimated using the CIELAB Color Segment Estimation (CCSE) function, defined as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt; &amp;lt;math&amp;gt; k = \left\lfloor \ln\left(\frac{\sigma_L}{n_L}\right) \right\rfloor \cdot \max(n_a, n_b) + \min(n_a, n_b) &amp;lt;/math&amp;gt; &amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In this equation, &amp;lt;math&amp;gt;\sigma_L&amp;lt;/math&amp;gt; denotes the standard deviation of the &amp;lt;math&amp;gt;L&amp;lt;/math&amp;gt;-channel histogram, while &amp;lt;math&amp;gt;n_L&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;n_a&amp;lt;/math&amp;gt;, and &amp;lt;math&amp;gt;n_b&amp;lt;/math&amp;gt; represent the number of local maxima detected in the &amp;lt;math&amp;gt;L&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;a&amp;lt;/math&amp;gt;, and &amp;lt;math&amp;gt;b&amp;lt;/math&amp;gt; histograms, respectively. The term &amp;lt;math&amp;gt;\max(n_a, n_b)&amp;lt;/math&amp;gt; selects the channel with the strongest chromatic variation, while &amp;lt;math&amp;gt;\min(n_a, n_b)&amp;lt;/math&amp;gt; represents the weaker chromatic channel. A complete overview of the method is illustrated in the processing pipeline shown in Figure 3. It should be noted that this method requires input images to be in standard three-channel RGB format.&lt;br /&gt;
&lt;br /&gt;
=== Color Histogram ===&lt;br /&gt;
Color information in an image can be described using several types of descriptors, such as color histograms, color correlograms, color coherence vectors, and color moments. Among these options, the color histogram is one of the most commonly used representations because it is simple to compute and effective at capturing overall color content, especially when an image has a distinct color distribution compared to others in a dataset.&lt;br /&gt;
&lt;br /&gt;
In the proposed method, information is extracted from the &amp;lt;math&amp;gt;L&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;a&amp;lt;/math&amp;gt;, and &amp;lt;math&amp;gt;b&amp;lt;/math&amp;gt; histograms by analyzing their standard deviations and the number of local maxima. These measurements describe important properties of the image and provide the motivation for the design of the CCSE function:&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;Lightness distribution&#039;&#039;&#039;: The standard deviation of the &amp;lt;math&amp;gt;L&amp;lt;/math&amp;gt;-channel histogram indicates the range of lightness values in the image. A larger standard deviation corresponds to a wider spread of brightness levels, while a smaller value suggests more uniform lighting.&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;Color distribution&#039;&#039;&#039;: The standard deviations of the &amp;lt;math&amp;gt;a&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;b&amp;lt;/math&amp;gt; histograms reflect the diversity of chromatic content. Higher values indicate a broader range of colors, whereas lower values suggest limited color variation.&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;Peak separability&#039;&#039;&#039;: The number of local maxima in the &amp;lt;math&amp;gt;L&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;a&amp;lt;/math&amp;gt;, and &amp;lt;math&amp;gt;b&amp;lt;/math&amp;gt; histograms indicates how well different lightness and color levels are separated. More local maxima imply clearly distinguishable color or intensity regions, while fewer maxima suggest more clustered values.&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;Image complexity&#039;&#039;&#039;: Taken together, the standard deviations and local maxima across all three channels provide an estimate of overall image complexity. Images with larger histogram spreads and more peaks are considered more complex, while images with fewer peaks and narrower distributions are simpler.&lt;br /&gt;
&lt;br /&gt;
Overall, histogram analysis offers a compact yet informative description of an image’s lightness and color structure, which is valuable for segmentation and object recognition tasks.&lt;br /&gt;
&lt;br /&gt;
=== CCSE Function ===&lt;br /&gt;
The term &amp;lt;math&amp;gt;\left\lfloor \ln\left(\frac{\sigma_L}{n_L}\right) \right\rfloor&amp;lt;/math&amp;gt; computes the logarithm of the ratio between the standard deviation of the &amp;lt;math&amp;gt;L&amp;lt;/math&amp;gt;-channel histogram and the number of its local maxima. This ratio reflects the balance between the spread of lightness values and the separability of different lightness levels in the image. Applying the logarithm helps normalize the scale of the values and reduces sensitivity to extreme cases. The floor operation ensures that the resulting estimate of the number of clusters remains an integer. This formulation also prevents the estimated number of clusters from becoming too small when an image contains colors with very similar hues and limited lightness variation.&lt;br /&gt;
&lt;br /&gt;
Multiplying this term by &amp;lt;math&amp;gt;\max(n_a, n_b)&amp;lt;/math&amp;gt; emphasizes the chromatic channel with the greater number of distinct peaks, which typically corresponds to the dominant source of color variation in the image. Using only the weaker chromatic channel could lead to an underestimation of the required number of color segments.&lt;br /&gt;
&lt;br /&gt;
Finally, adding &amp;lt;math&amp;gt;\min(n_a, n_b)&amp;lt;/math&amp;gt; ensures that information from the less dominant chromatic channel is still taken into account. While the channel with stronger variation plays a more important role, incorporating the weaker channel leads to a more balanced and accurate estimation of the number of color clusters.&lt;br /&gt;
&lt;br /&gt;
=== Time Complexity ===&lt;br /&gt;
&lt;br /&gt;
The time complexity of the function is determined by analyzing each of its main steps. Since the color histograms contain at most 256 bins, operations such as finding local maxima can be treated as constant time. Assigning the image variable takes constant time, while converting the image from RGB to CIELAB requires linear time with respect to the total number of pixels, denoted by &amp;lt;math&amp;gt;N&amp;lt;/math&amp;gt;. Histogram computation also has linear time complexity because each pixel contributes once. Peak detection remains constant time due to the fixed histogram size. The loop used in the function has a worst-case time complexity of &amp;lt;math&amp;gt;O(N)&amp;lt;/math&amp;gt;, and the final computation used to estimate the number of clusters takes constant time. Overall, the operations that depend on image size scale linearly with the number of pixels. Therefore, the total time complexity of the function is &amp;lt;math&amp;gt;O(N)&amp;lt;/math&amp;gt;, where &amp;lt;math&amp;gt;N&amp;lt;/math&amp;gt; is the number of pixels in the image.&lt;br /&gt;
&lt;br /&gt;
== Results ==&lt;br /&gt;
&lt;br /&gt;
=== Visual Validation ===&lt;br /&gt;
&lt;br /&gt;
The first part of the evaluation focuses on visual validation, which allows us to directly compare the segmentation results produced by the CCSE algorithm with those from the Elbow Method and the Gap Statistic Method. To ensure a fair comparison, all methods are tested under the same conditions. Since the Elbow and Gap methods require evaluating a range of cluster values, we set a maximum number of clusters of 𝐾max = 20 for all images.&lt;br /&gt;
&lt;br /&gt;
After estimating the optimal number of clusters using each method, the images are segmented accordingly and visually inspected. The comparison focuses on how well each method captures dominant color regions, object boundaries, and overall segmentation smoothness. The results show that the segmentations produced by CCSE are visually very similar to those obtained using the Elbow and Gap methods. This indicates that CCSE successfully captures the main color structures of the images.&lt;br /&gt;
&lt;br /&gt;
Overall, this visual validation demonstrates that CCSE can achieve segmentation quality comparable to established methods, while avoiding the repeated clustering steps required by the Elbow and Gap approaches.&lt;br /&gt;
&lt;br /&gt;
[[File:visualvalidation.png|center|frameless|400px]]&lt;br /&gt;
&lt;br /&gt;
=== Quantitative Validation ===&lt;br /&gt;
&lt;br /&gt;
Quantitative validation is performed using &#039;&#039;&#039;Color Reconstruction Error-based Segmentation Evaluation (CRESE)&#039;&#039;&#039;. This metric evaluates how accurately a segmented image reconstructs the original image in terms of color. It computes the sum of color differences between each pixel’s original color and the average color of the cluster to which the pixel is assigned. A lower reconstruction error indicates better segmentation performance and a more accurate estimate of the number of color clusters.&lt;br /&gt;
&lt;br /&gt;
Let &amp;lt;math&amp;gt;O \in \mathbb{R}^{H \times W \times 3}&amp;lt;/math&amp;gt; denote the original image, and let &amp;lt;math&amp;gt;S \in \mathbb{R}^{H \times W \times 3}&amp;lt;/math&amp;gt; denote the segmented image, where each pixel is replaced by the average color of its assigned cluster. Let&lt;br /&gt;
&amp;lt;math&amp;gt;C = {c_1, c_2, \dots, c_n}&amp;lt;/math&amp;gt; be the set of unique cluster colors in &amp;lt;math&amp;gt;S&amp;lt;/math&amp;gt;, where &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; is the number of clusters. For each cluster color &amp;lt;math&amp;gt;c_i&amp;lt;/math&amp;gt;, a binary mask &amp;lt;math&amp;gt;M_i \in {0,1}^{H \times W}&amp;lt;/math&amp;gt; is defined to indicate pixel membership.&lt;br /&gt;
&lt;br /&gt;
The total color reconstruction error &amp;lt;math&amp;gt;E&amp;lt;/math&amp;gt; is computed as follows:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt; &amp;lt;math&amp;gt; E = \sum_{i=1}^{n} \sum_{h=1}^{H} \sum_{w=1}^{W} M_i(h,w)\,\left\| O(h,w) - c_i \right\|_2 &amp;lt;/math&amp;gt; &amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The ||*|| shows the Euclidean distance between color vectors. In this evaluation, the color reconstruction error is computed using the Euclidean distance between color vectors in the CIELAB color space. Both the original image &amp;lt;math&amp;gt;O&amp;lt;/math&amp;gt; and the cluster representative colors &amp;lt;math&amp;gt;c_i&amp;lt;/math&amp;gt; are first converted from RGB to CIELAB before the distance is computed. This choice is motivated by the perceptual properties of the CIELAB color space, which is designed so that Euclidean distances correspond approximately to perceived color differences. As a result, Euclidean distance in CIELAB provides a meaningful and interpretable measure of how well the segmented image preserves the original colors.&lt;br /&gt;
&lt;br /&gt;
Although perceptual color difference metrics such as &amp;lt;math&amp;gt;\Delta E&amp;lt;/math&amp;gt; are commonly used for precise color comparison, Euclidean distance in CIELAB offers a computationally efficient alternative while remaining perceptually relevant. Since CRESE is used to compare relative segmentation performance across methods rather than to measure absolute perceptual color error, this simplified distance metric is sufficient for evaluation purposes. In contrast, computing reconstruction error directly in RGB space would be less appropriate, as Euclidean distances in RGB do not correspond well to human color perception and are sensitive to illumination variations.&lt;br /&gt;
&lt;br /&gt;
To enable comparison across images of different sizes, the error is normalized and expressed as a percentage:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt; &amp;lt;math&amp;gt; E_{\text{normalized}} = \frac{E}{H \cdot W \cdot 255 \cdot \sqrt{3}} \times 100 &amp;lt;/math&amp;gt; &amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
During experimentation, contrast enhancement was observed to increase the estimated number of clusters. Since contrast enhancement has constant-time complexity, it does not affect the computational cost of the CRESE evaluation. Using this metric, validation curves of normalized reconstruction error versus the number of clusters &amp;lt;math&amp;gt;k&amp;lt;/math&amp;gt; are generated for both original and contrast-enhanced images.&lt;br /&gt;
&lt;br /&gt;
[[Image:quantitativevalidation.png|center|frameless|700px]]&lt;br /&gt;
&lt;br /&gt;
=== Efficiency Validation ===&lt;br /&gt;
&lt;br /&gt;
This section evaluates the computation time of the CCSE algorithm and compares it with the Elbow Method and the Gap Statistic Method in the context of image segmentation. While earlier sections focused on segmentation accuracy, the goal here is to understand how efficiently each method performs as image size increases.&lt;br /&gt;
&lt;br /&gt;
A high resolution beach image with a size of 3840 × 2160 pixels is used as the test image. The image is not contrast enhanced so that computation time is affected only by image size and not by additional preprocessing. To analyze scalability, resized versions of the image are created while preserving the original aspect ratio. The image is scaled to 10%, 25%, 33%, 50%, and 75% of its original dimensions, resulting in a range of images with different pixel counts.&lt;br /&gt;
&lt;br /&gt;
To ensure a fair comparison, the maximum number of clusters is fixed at &amp;lt;math&amp;gt;K_{\max} = 20&amp;lt;/math&amp;gt; for both the Elbow Method and the Gap Statistic Method. For each resized image, the time required by each algorithm to estimate the optimal number of clusters is measured. These measurements allow us to observe how computation time changes as image resolution increases.&lt;br /&gt;
&lt;br /&gt;
By comparing the computation times across all image sizes, we can evaluate the efficiency and scalability of each method. This analysis helps determine which approach is more suitable for real world applications where image sizes may vary significantly. The results also highlight the ability of the CCSE algorithm to handle larger images efficiently while still producing reliable cluster estimates.&lt;br /&gt;
&lt;br /&gt;
[[Image:compvalidation.png|center|frameless|400px]]&lt;br /&gt;
&lt;br /&gt;
=== Sensitivity Validation ===&lt;br /&gt;
&lt;br /&gt;
Sensitivity analysis is used to evaluate how stable each clustering method is when its input parameters change. A method that is less sensitive to parameter variation is considered more robust because it produces more consistent results under different settings.&lt;br /&gt;
&lt;br /&gt;
In this study, sensitivity is evaluated for all three methods. For the Elbow Method and the Gap Statistic Method, sensitivity is tested by changing the maximum number of clusters, &amp;lt;math&amp;gt;K_{\max}&amp;lt;/math&amp;gt;. For the CCSE algorithm, sensitivity is examined by varying the distance parameter &amp;lt;math&amp;gt;D&amp;lt;/math&amp;gt;, which controls how histogram peaks are grouped when estimating the number of clusters.&lt;br /&gt;
&lt;br /&gt;
To ensure a fair comparison, the same parameter range is used for all methods. The value of &amp;lt;math&amp;gt;D&amp;lt;/math&amp;gt; for CCSE is set equal to &amp;lt;math&amp;gt;K_{\max}&amp;lt;/math&amp;gt; for the Elbow and Gap methods. Both parameters are varied from 5 to 40, using an increment of 5. For each parameter value, the estimated number of clusters is recorded and compared.&lt;br /&gt;
&lt;br /&gt;
[[Image:sensitivityvalidaiton.png|center|frameless|400px]]&lt;br /&gt;
&lt;br /&gt;
The Gap Statistic Method shows a nearly linear increase in the estimated number of clusters as &amp;lt;math&amp;gt;K_{\max}&amp;lt;/math&amp;gt; increases. This behavior indicates a high sensitivity to the chosen maximum value, meaning the estimated result depends strongly on the input parameter.&lt;br /&gt;
&lt;br /&gt;
The Elbow Method shows a non linear trend and is slightly less sensitive than the Gap Statistic Method. However, the estimated number of clusters still changes noticeably as &amp;lt;math&amp;gt;K_{\max}&amp;lt;/math&amp;gt; increases, which suggests that the method remains dependent on the selected parameter range.&lt;br /&gt;
&lt;br /&gt;
In contrast, the CCSE algorithm produces more stable estimates as the distance parameter &amp;lt;math&amp;gt;D&amp;lt;/math&amp;gt; increases. While the estimated number of clusters decreases gradually, the change is smoother and more controlled compared to the other methods. This indicates lower sensitivity to parameter variation.&lt;br /&gt;
&lt;br /&gt;
Overall, the CCSE algorithm demonstrates the highest robustness among the three methods. Its reduced sensitivity to parameter changes allows it to produce more consistent cluster estimates across a wide range of settings, making it more reliable for practical image segmentation tasks.&lt;br /&gt;
&lt;br /&gt;
== Conclusion ==&lt;br /&gt;
&lt;br /&gt;
From the results presented above, it can be concluded that the proposed CCSE algorithm performs well across several important aspects of image segmentation, including segmentation quality, computation time, and robustness. Visual inspection shows that the segmented images produced using CCSE are similar to those generated by the Elbow Method and the Gap Statistic, indicating that CCSE is able to capture the main color structure of the images.&lt;br /&gt;
&lt;br /&gt;
Quantitative evaluation using the CRESE metric further supports these observations. For both original and contrast-enhanced images, the reconstruction errors produced by CCSE are comparable to those of the other methods. This shows that CCSE can estimate a reasonable number of color clusters even when image contrast changes.&lt;br /&gt;
&lt;br /&gt;
In terms of efficiency, CCSE clearly outperforms the Elbow and Gap Statistic methods. Its computation time increases very little as image size grows, making it suitable for high-resolution images and large datasets. In addition, CCSE shows stable behavior across different parameter settings, which indicates good robustness.&lt;br /&gt;
&lt;br /&gt;
Overall, the CCSE algorithm provides a practical and reliable approach for estimating the number of color clusters in image segmentation, offering a good balance between accuracy, speed, and stability.&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
== Appendix 1 ==&lt;br /&gt;
&lt;br /&gt;
link to code: https://drive.google.com/drive/folders/1kJ1jRgtYwjPT1HOiSKBag3t2gvJKGu8J?usp=drive_link&lt;/div&gt;</summary>
		<author><name>Sisira2</name></author>
	</entry>
	<entry>
		<id>http://vista.su.domains/psych221wiki/index.php?title=Smart_Cluster_Selection_for_CIELAB_Color_Segmentation&amp;diff=146048</id>
		<title>Smart Cluster Selection for CIELAB Color Segmentation</title>
		<link rel="alternate" type="text/html" href="http://vista.su.domains/psych221wiki/index.php?title=Smart_Cluster_Selection_for_CIELAB_Color_Segmentation&amp;diff=146048"/>
		<updated>2025-12-13T06:58:14Z</updated>

		<summary type="html">&lt;p&gt;Sisira2: /* Quantitative Validation */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction ==&lt;br /&gt;
Image segmentation is a fundamental step in many computer vision applications because it allows algorithms to separate meaningful regions, identify objects, and reduce the complexity of visual scenes. Color is one of the most informative cues for distinguishing visual elements, which is why color-based segmentation methods are commonly used. In particular, clustering techniques group pixels that have similar color characteristics, making them effective for isolating regions with shared appearance.&lt;br /&gt;
&lt;br /&gt;
Color-based segmentation is especially important in applications such as remote sensing, where large images often contain regions like vegetation, water, and urban areas that are best distinguished by color. Accurate segmentation in these settings supports tasks such as land cover analysis, environmental monitoring, and change detection, making efficient color segmentation a practical requirement.&lt;br /&gt;
&lt;br /&gt;
A major challenge in color-based segmentation is determining the appropriate number of color clusters for a given image. If too few clusters are chosen, under-segmentation occurs and important details may be merged. If too many clusters are used, over-segmentation can occur, where noise or small variations form meaningless regions. Common techniques such as the Elbow Method and the Gap Statistic estimate the number of clusters by repeatedly running clustering algorithms like K-Means with different values of k. While effective, these methods are computationally expensive for high-resolution images or large datasets and are often unsuitable for real-time use.&lt;br /&gt;
&lt;br /&gt;
This project proposes an alternative approach that estimates the ideal number of color clusters directly from the statistical properties of the image. By analyzing lightness variation, chromatic distributions, and color histograms in the CIELAB color space, the method aims to infer the number of meaningful color groups without testing many cluster values, resulting in a faster and more scalable solution.&lt;br /&gt;
&lt;br /&gt;
== Background ==&lt;br /&gt;
Color-based image segmentation is widely used in computer vision because color provides a strong and intuitive cue for separating different regions in an image. Many real-world images contain objects or areas that are more easily distinguished by color than by shape or texture, especially in scenes with complex structure or uneven lighting. By grouping pixels with similar color properties, segmentation methods can reduce image complexity and make later processing steps more efficient.&lt;br /&gt;
&lt;br /&gt;
To make color comparisons meaningful, pixel values are often represented in a perceptual color space rather than directly in RGB. The CIELAB color space is commonly used because it separates lightness from chromatic information, allowing brightness changes to be handled independently from color differences. This is important in practical settings where illumination varies across the image. In addition, CIELAB is approximately perceptually uniform, meaning that distances in the space align reasonably well with how humans perceive color differences. For this reason, simple distance measures in CIELAB are effective for clustering and segmentation tasks.&lt;br /&gt;
&lt;br /&gt;
Many existing segmentation methods rely on statistical information derived from color distributions. Techniques such as K-Means, Mean Shift, and Gaussian Mixture Models group pixels based on similarity, often using histogram information to capture how colors are distributed across an image. Color histograms, in particular, provide a compact summary of lightness and chromatic variation. Peaks in these histograms often correspond to dominant colors or distinct regions, making histogram structure a useful indicator of image complexity.&lt;br /&gt;
&lt;br /&gt;
A key challenge in clustering-based segmentation is selecting the number of clusters. Traditional approaches such as the Elbow Method and the Gap Statistic estimate this number by repeatedly running clustering algorithms with different settings and comparing the results. While these methods are well established, their reliance on multiple clustering runs makes them computationally expensive, especially for high-resolution images or large collections of data.&lt;br /&gt;
&lt;br /&gt;
The ideas behind perceptual color spaces, histogram analysis, and cluster estimation motivate the approach taken in this project. Instead of repeatedly applying clustering algorithms, this work explores whether the number of meaningful color regions can be inferred directly from image statistics in the CIELAB space. By analyzing lightness variation, chromatic spread, and histogram structure, the proposed method aims to estimate the appropriate number of color clusters efficiently, reducing computation while still supporting reliable image segmentation.&lt;br /&gt;
&lt;br /&gt;
== Methods ==&lt;br /&gt;
&lt;br /&gt;
=== Proposed Method ===&lt;br /&gt;
The proposed method consists of three main stages. First, the input image is converted from the three-channel RGB color space to the CIELAB (Lab*) color space. Separate histograms are then extracted for the &amp;lt;math&amp;gt;L&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;a&amp;lt;/math&amp;gt;, and &amp;lt;math&amp;gt;b&amp;lt;/math&amp;gt; channels. Second, two statistical parameters are computed from each histogram: the standard deviation and the number of local maxima. These values describe the distribution and structure of lightness and color information in the image. Finally, the optimal number of color clusters is estimated using the CIELAB Color Segment Estimation (CCSE) function, defined as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt; &amp;lt;math&amp;gt; k = \left\lfloor \ln\left(\frac{\sigma_L}{n_L}\right) \right\rfloor \cdot \max(n_a, n_b) + \min(n_a, n_b) &amp;lt;/math&amp;gt; &amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In this equation, &amp;lt;math&amp;gt;\sigma_L&amp;lt;/math&amp;gt; denotes the standard deviation of the &amp;lt;math&amp;gt;L&amp;lt;/math&amp;gt;-channel histogram, while &amp;lt;math&amp;gt;n_L&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;n_a&amp;lt;/math&amp;gt;, and &amp;lt;math&amp;gt;n_b&amp;lt;/math&amp;gt; represent the number of local maxima detected in the &amp;lt;math&amp;gt;L&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;a&amp;lt;/math&amp;gt;, and &amp;lt;math&amp;gt;b&amp;lt;/math&amp;gt; histograms, respectively. The term &amp;lt;math&amp;gt;\max(n_a, n_b)&amp;lt;/math&amp;gt; selects the channel with the strongest chromatic variation, while &amp;lt;math&amp;gt;\min(n_a, n_b)&amp;lt;/math&amp;gt; represents the weaker chromatic channel. A complete overview of the method is illustrated in the processing pipeline shown in Figure 3. It should be noted that this method requires input images to be in standard three-channel RGB format.&lt;br /&gt;
&lt;br /&gt;
=== Color Histogram ===&lt;br /&gt;
Color information in an image can be described using several types of descriptors, such as color histograms, color correlograms, color coherence vectors, and color moments. Among these options, the color histogram is one of the most commonly used representations because it is simple to compute and effective at capturing overall color content, especially when an image has a distinct color distribution compared to others in a dataset.&lt;br /&gt;
&lt;br /&gt;
In the proposed method, information is extracted from the &amp;lt;math&amp;gt;L&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;a&amp;lt;/math&amp;gt;, and &amp;lt;math&amp;gt;b&amp;lt;/math&amp;gt; histograms by analyzing their standard deviations and the number of local maxima. These measurements describe important properties of the image and provide the motivation for the design of the CCSE function:&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;Lightness distribution&#039;&#039;&#039;: The standard deviation of the &amp;lt;math&amp;gt;L&amp;lt;/math&amp;gt;-channel histogram indicates the range of lightness values in the image. A larger standard deviation corresponds to a wider spread of brightness levels, while a smaller value suggests more uniform lighting.&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;Color distribution&#039;&#039;&#039;: The standard deviations of the &amp;lt;math&amp;gt;a&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;b&amp;lt;/math&amp;gt; histograms reflect the diversity of chromatic content. Higher values indicate a broader range of colors, whereas lower values suggest limited color variation.&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;Peak separability&#039;&#039;&#039;: The number of local maxima in the &amp;lt;math&amp;gt;L&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;a&amp;lt;/math&amp;gt;, and &amp;lt;math&amp;gt;b&amp;lt;/math&amp;gt; histograms indicates how well different lightness and color levels are separated. More local maxima imply clearly distinguishable color or intensity regions, while fewer maxima suggest more clustered values.&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;Image complexity&#039;&#039;&#039;: Taken together, the standard deviations and local maxima across all three channels provide an estimate of overall image complexity. Images with larger histogram spreads and more peaks are considered more complex, while images with fewer peaks and narrower distributions are simpler.&lt;br /&gt;
&lt;br /&gt;
Overall, histogram analysis offers a compact yet informative description of an image’s lightness and color structure, which is valuable for segmentation and object recognition tasks.&lt;br /&gt;
&lt;br /&gt;
=== CCSE Function ===&lt;br /&gt;
The term &amp;lt;math&amp;gt;\left\lfloor \ln\left(\frac{\sigma_L}{n_L}\right) \right\rfloor&amp;lt;/math&amp;gt; computes the logarithm of the ratio between the standard deviation of the &amp;lt;math&amp;gt;L&amp;lt;/math&amp;gt;-channel histogram and the number of its local maxima. This ratio reflects the balance between the spread of lightness values and the separability of different lightness levels in the image. Applying the logarithm helps normalize the scale of the values and reduces sensitivity to extreme cases. The floor operation ensures that the resulting estimate of the number of clusters remains an integer. This formulation also prevents the estimated number of clusters from becoming too small when an image contains colors with very similar hues and limited lightness variation.&lt;br /&gt;
&lt;br /&gt;
Multiplying this term by &amp;lt;math&amp;gt;\max(n_a, n_b)&amp;lt;/math&amp;gt; emphasizes the chromatic channel with the greater number of distinct peaks, which typically corresponds to the dominant source of color variation in the image. Using only the weaker chromatic channel could lead to an underestimation of the required number of color segments.&lt;br /&gt;
&lt;br /&gt;
Finally, adding &amp;lt;math&amp;gt;\min(n_a, n_b)&amp;lt;/math&amp;gt; ensures that information from the less dominant chromatic channel is still taken into account. While the channel with stronger variation plays a more important role, incorporating the weaker channel leads to a more balanced and accurate estimation of the number of color clusters.&lt;br /&gt;
&lt;br /&gt;
== Results ==&lt;br /&gt;
&lt;br /&gt;
=== Visual Validation ===&lt;br /&gt;
&lt;br /&gt;
The first part of the evaluation focuses on visual validation, which allows us to directly compare the segmentation results produced by the CCSE algorithm with those from the Elbow Method and the Gap Statistic Method. To ensure a fair comparison, all methods are tested under the same conditions. Since the Elbow and Gap methods require evaluating a range of cluster values, we set a maximum number of clusters of 𝐾max = 20 for all images.&lt;br /&gt;
&lt;br /&gt;
After estimating the optimal number of clusters using each method, the images are segmented accordingly and visually inspected. The comparison focuses on how well each method captures dominant color regions, object boundaries, and overall segmentation smoothness. The results show that the segmentations produced by CCSE are visually very similar to those obtained using the Elbow and Gap methods. This indicates that CCSE successfully captures the main color structures of the images.&lt;br /&gt;
&lt;br /&gt;
Overall, this visual validation demonstrates that CCSE can achieve segmentation quality comparable to established methods, while avoiding the repeated clustering steps required by the Elbow and Gap approaches.&lt;br /&gt;
&lt;br /&gt;
[[File:visualvalidation.png|center|frameless|400px]]&lt;br /&gt;
&lt;br /&gt;
=== Quantitative Validation ===&lt;br /&gt;
&lt;br /&gt;
Quantitative validation is performed using &#039;&#039;&#039;Color Reconstruction Error-based Segmentation Evaluation (CRESE)&#039;&#039;&#039;. This metric evaluates how accurately a segmented image reconstructs the original image in terms of color. It computes the sum of color differences between each pixel’s original color and the average color of the cluster to which the pixel is assigned. A lower reconstruction error indicates better segmentation performance and a more accurate estimate of the number of color clusters.&lt;br /&gt;
&lt;br /&gt;
Let &amp;lt;math&amp;gt;O \in \mathbb{R}^{H \times W \times 3}&amp;lt;/math&amp;gt; denote the original image, and let &amp;lt;math&amp;gt;S \in \mathbb{R}^{H \times W \times 3}&amp;lt;/math&amp;gt; denote the segmented image, where each pixel is replaced by the average color of its assigned cluster. Let&lt;br /&gt;
&amp;lt;math&amp;gt;C = {c_1, c_2, \dots, c_n}&amp;lt;/math&amp;gt; be the set of unique cluster colors in &amp;lt;math&amp;gt;S&amp;lt;/math&amp;gt;, where &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; is the number of clusters. For each cluster color &amp;lt;math&amp;gt;c_i&amp;lt;/math&amp;gt;, a binary mask &amp;lt;math&amp;gt;M_i \in {0,1}^{H \times W}&amp;lt;/math&amp;gt; is defined to indicate pixel membership.&lt;br /&gt;
&lt;br /&gt;
The total color reconstruction error &amp;lt;math&amp;gt;E&amp;lt;/math&amp;gt; is computed as follows:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt; &amp;lt;math&amp;gt; E = \sum_{i=1}^{n} \sum_{h=1}^{H} \sum_{w=1}^{W} M_i(h,w)\,\left\| O(h,w) - c_i \right\|_2 &amp;lt;/math&amp;gt; &amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The ||*|| shows the Euclidean distance between color vectors. In this evaluation, the color reconstruction error is computed using the Euclidean distance between color vectors in the CIELAB color space. Both the original image &amp;lt;math&amp;gt;O&amp;lt;/math&amp;gt; and the cluster representative colors &amp;lt;math&amp;gt;c_i&amp;lt;/math&amp;gt; are first converted from RGB to CIELAB before the distance is computed. This choice is motivated by the perceptual properties of the CIELAB color space, which is designed so that Euclidean distances correspond approximately to perceived color differences. As a result, Euclidean distance in CIELAB provides a meaningful and interpretable measure of how well the segmented image preserves the original colors.&lt;br /&gt;
&lt;br /&gt;
Although perceptual color difference metrics such as &amp;lt;math&amp;gt;\Delta E&amp;lt;/math&amp;gt; are commonly used for precise color comparison, Euclidean distance in CIELAB offers a computationally efficient alternative while remaining perceptually relevant. Since CRESE is used to compare relative segmentation performance across methods rather than to measure absolute perceptual color error, this simplified distance metric is sufficient for evaluation purposes. In contrast, computing reconstruction error directly in RGB space would be less appropriate, as Euclidean distances in RGB do not correspond well to human color perception and are sensitive to illumination variations.&lt;br /&gt;
&lt;br /&gt;
To enable comparison across images of different sizes, the error is normalized and expressed as a percentage:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt; &amp;lt;math&amp;gt; E_{\text{normalized}} = \frac{E}{H \cdot W \cdot 255 \cdot \sqrt{3}} \times 100 &amp;lt;/math&amp;gt; &amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
During experimentation, contrast enhancement was observed to increase the estimated number of clusters. Since contrast enhancement has constant-time complexity, it does not affect the computational cost of the CRESE evaluation. Using this metric, validation curves of normalized reconstruction error versus the number of clusters &amp;lt;math&amp;gt;k&amp;lt;/math&amp;gt; are generated for both original and contrast-enhanced images.&lt;br /&gt;
&lt;br /&gt;
[[Image:quantitativevalidation.png|center|frameless|700px]]&lt;br /&gt;
&lt;br /&gt;
=== Efficiency Validation ===&lt;br /&gt;
&lt;br /&gt;
This section evaluates the computation time of the CCSE algorithm and compares it with the Elbow Method and the Gap Statistic Method in the context of image segmentation. While earlier sections focused on segmentation accuracy, the goal here is to understand how efficiently each method performs as image size increases.&lt;br /&gt;
&lt;br /&gt;
A high resolution beach image with a size of 3840 × 2160 pixels is used as the test image. The image is not contrast enhanced so that computation time is affected only by image size and not by additional preprocessing. To analyze scalability, resized versions of the image are created while preserving the original aspect ratio. The image is scaled to 10%, 25%, 33%, 50%, and 75% of its original dimensions, resulting in a range of images with different pixel counts.&lt;br /&gt;
&lt;br /&gt;
To ensure a fair comparison, the maximum number of clusters is fixed at &amp;lt;math&amp;gt;K_{\max} = 20&amp;lt;/math&amp;gt; for both the Elbow Method and the Gap Statistic Method. For each resized image, the time required by each algorithm to estimate the optimal number of clusters is measured. These measurements allow us to observe how computation time changes as image resolution increases.&lt;br /&gt;
&lt;br /&gt;
By comparing the computation times across all image sizes, we can evaluate the efficiency and scalability of each method. This analysis helps determine which approach is more suitable for real world applications where image sizes may vary significantly. The results also highlight the ability of the CCSE algorithm to handle larger images efficiently while still producing reliable cluster estimates.&lt;br /&gt;
&lt;br /&gt;
[[Image:compvalidation.png|center|frameless|400px]]&lt;br /&gt;
&lt;br /&gt;
=== Sensitivity Validation ===&lt;br /&gt;
&lt;br /&gt;
Sensitivity analysis is used to evaluate how stable each clustering method is when its input parameters change. A method that is less sensitive to parameter variation is considered more robust because it produces more consistent results under different settings.&lt;br /&gt;
&lt;br /&gt;
In this study, sensitivity is evaluated for all three methods. For the Elbow Method and the Gap Statistic Method, sensitivity is tested by changing the maximum number of clusters, &amp;lt;math&amp;gt;K_{\max}&amp;lt;/math&amp;gt;. For the CCSE algorithm, sensitivity is examined by varying the distance parameter &amp;lt;math&amp;gt;D&amp;lt;/math&amp;gt;, which controls how histogram peaks are grouped when estimating the number of clusters.&lt;br /&gt;
&lt;br /&gt;
To ensure a fair comparison, the same parameter range is used for all methods. The value of &amp;lt;math&amp;gt;D&amp;lt;/math&amp;gt; for CCSE is set equal to &amp;lt;math&amp;gt;K_{\max}&amp;lt;/math&amp;gt; for the Elbow and Gap methods. Both parameters are varied from 5 to 40, using an increment of 5. For each parameter value, the estimated number of clusters is recorded and compared.&lt;br /&gt;
&lt;br /&gt;
[[Image:sensitivityvalidaiton.png|center|frameless|400px]]&lt;br /&gt;
&lt;br /&gt;
The Gap Statistic Method shows a nearly linear increase in the estimated number of clusters as &amp;lt;math&amp;gt;K_{\max}&amp;lt;/math&amp;gt; increases. This behavior indicates a high sensitivity to the chosen maximum value, meaning the estimated result depends strongly on the input parameter.&lt;br /&gt;
&lt;br /&gt;
The Elbow Method shows a non linear trend and is slightly less sensitive than the Gap Statistic Method. However, the estimated number of clusters still changes noticeably as &amp;lt;math&amp;gt;K_{\max}&amp;lt;/math&amp;gt; increases, which suggests that the method remains dependent on the selected parameter range.&lt;br /&gt;
&lt;br /&gt;
In contrast, the CCSE algorithm produces more stable estimates as the distance parameter &amp;lt;math&amp;gt;D&amp;lt;/math&amp;gt; increases. While the estimated number of clusters decreases gradually, the change is smoother and more controlled compared to the other methods. This indicates lower sensitivity to parameter variation.&lt;br /&gt;
&lt;br /&gt;
Overall, the CCSE algorithm demonstrates the highest robustness among the three methods. Its reduced sensitivity to parameter changes allows it to produce more consistent cluster estimates across a wide range of settings, making it more reliable for practical image segmentation tasks.&lt;br /&gt;
&lt;br /&gt;
== Conclusion ==&lt;br /&gt;
&lt;br /&gt;
From the results presented above, it can be concluded that the proposed CCSE algorithm performs well across several important aspects of image segmentation, including segmentation quality, computation time, and robustness. Visual inspection shows that the segmented images produced using CCSE are similar to those generated by the Elbow Method and the Gap Statistic, indicating that CCSE is able to capture the main color structure of the images.&lt;br /&gt;
&lt;br /&gt;
Quantitative evaluation using the CRESE metric further supports these observations. For both original and contrast-enhanced images, the reconstruction errors produced by CCSE are comparable to those of the other methods. This shows that CCSE can estimate a reasonable number of color clusters even when image contrast changes.&lt;br /&gt;
&lt;br /&gt;
In terms of efficiency, CCSE clearly outperforms the Elbow and Gap Statistic methods. Its computation time increases very little as image size grows, making it suitable for high-resolution images and large datasets. In addition, CCSE shows stable behavior across different parameter settings, which indicates good robustness.&lt;br /&gt;
&lt;br /&gt;
Overall, the CCSE algorithm provides a practical and reliable approach for estimating the number of color clusters in image segmentation, offering a good balance between accuracy, speed, and stability.&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
== Appendix 1 ==&lt;br /&gt;
&lt;br /&gt;
link to code: https://drive.google.com/drive/folders/1kJ1jRgtYwjPT1HOiSKBag3t2gvJKGu8J?usp=drive_link&lt;/div&gt;</summary>
		<author><name>Sisira2</name></author>
	</entry>
	<entry>
		<id>http://vista.su.domains/psych221wiki/index.php?title=Smart_Cluster_Selection_for_CIELAB_Color_Segmentation&amp;diff=146044</id>
		<title>Smart Cluster Selection for CIELAB Color Segmentation</title>
		<link rel="alternate" type="text/html" href="http://vista.su.domains/psych221wiki/index.php?title=Smart_Cluster_Selection_for_CIELAB_Color_Segmentation&amp;diff=146044"/>
		<updated>2025-12-13T06:53:20Z</updated>

		<summary type="html">&lt;p&gt;Sisira2: /* Quantitative Validation */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction ==&lt;br /&gt;
Image segmentation is a fundamental step in many computer vision applications because it allows algorithms to separate meaningful regions, identify objects, and reduce the complexity of visual scenes. Color is one of the most informative cues for distinguishing visual elements, which is why color-based segmentation methods are commonly used. In particular, clustering techniques group pixels that have similar color characteristics, making them effective for isolating regions with shared appearance.&lt;br /&gt;
&lt;br /&gt;
Color-based segmentation is especially important in applications such as remote sensing, where large images often contain regions like vegetation, water, and urban areas that are best distinguished by color. Accurate segmentation in these settings supports tasks such as land cover analysis, environmental monitoring, and change detection, making efficient color segmentation a practical requirement.&lt;br /&gt;
&lt;br /&gt;
A major challenge in color-based segmentation is determining the appropriate number of color clusters for a given image. If too few clusters are chosen, under-segmentation occurs and important details may be merged. If too many clusters are used, over-segmentation can occur, where noise or small variations form meaningless regions. Common techniques such as the Elbow Method and the Gap Statistic estimate the number of clusters by repeatedly running clustering algorithms like K-Means with different values of k. While effective, these methods are computationally expensive for high-resolution images or large datasets and are often unsuitable for real-time use.&lt;br /&gt;
&lt;br /&gt;
This project proposes an alternative approach that estimates the ideal number of color clusters directly from the statistical properties of the image. By analyzing lightness variation, chromatic distributions, and color histograms in the CIELAB color space, the method aims to infer the number of meaningful color groups without testing many cluster values, resulting in a faster and more scalable solution.&lt;br /&gt;
&lt;br /&gt;
== Background ==&lt;br /&gt;
Color-based image segmentation is widely used in computer vision because color provides a strong and intuitive cue for separating different regions in an image. Many real-world images contain objects or areas that are more easily distinguished by color than by shape or texture, especially in scenes with complex structure or uneven lighting. By grouping pixels with similar color properties, segmentation methods can reduce image complexity and make later processing steps more efficient.&lt;br /&gt;
&lt;br /&gt;
To make color comparisons meaningful, pixel values are often represented in a perceptual color space rather than directly in RGB. The CIELAB color space is commonly used because it separates lightness from chromatic information, allowing brightness changes to be handled independently from color differences. This is important in practical settings where illumination varies across the image. In addition, CIELAB is approximately perceptually uniform, meaning that distances in the space align reasonably well with how humans perceive color differences. For this reason, simple distance measures in CIELAB are effective for clustering and segmentation tasks.&lt;br /&gt;
&lt;br /&gt;
Many existing segmentation methods rely on statistical information derived from color distributions. Techniques such as K-Means, Mean Shift, and Gaussian Mixture Models group pixels based on similarity, often using histogram information to capture how colors are distributed across an image. Color histograms, in particular, provide a compact summary of lightness and chromatic variation. Peaks in these histograms often correspond to dominant colors or distinct regions, making histogram structure a useful indicator of image complexity.&lt;br /&gt;
&lt;br /&gt;
A key challenge in clustering-based segmentation is selecting the number of clusters. Traditional approaches such as the Elbow Method and the Gap Statistic estimate this number by repeatedly running clustering algorithms with different settings and comparing the results. While these methods are well established, their reliance on multiple clustering runs makes them computationally expensive, especially for high-resolution images or large collections of data.&lt;br /&gt;
&lt;br /&gt;
The ideas behind perceptual color spaces, histogram analysis, and cluster estimation motivate the approach taken in this project. Instead of repeatedly applying clustering algorithms, this work explores whether the number of meaningful color regions can be inferred directly from image statistics in the CIELAB space. By analyzing lightness variation, chromatic spread, and histogram structure, the proposed method aims to estimate the appropriate number of color clusters efficiently, reducing computation while still supporting reliable image segmentation.&lt;br /&gt;
&lt;br /&gt;
== Methods ==&lt;br /&gt;
&lt;br /&gt;
=== Proposed Method ===&lt;br /&gt;
The proposed method consists of three main stages. First, the input image is converted from the three-channel RGB color space to the CIELAB (Lab*) color space. Separate histograms are then extracted for the &amp;lt;math&amp;gt;L&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;a&amp;lt;/math&amp;gt;, and &amp;lt;math&amp;gt;b&amp;lt;/math&amp;gt; channels. Second, two statistical parameters are computed from each histogram: the standard deviation and the number of local maxima. These values describe the distribution and structure of lightness and color information in the image. Finally, the optimal number of color clusters is estimated using the CIELAB Color Segment Estimation (CCSE) function, defined as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt; &amp;lt;math&amp;gt; k = \left\lfloor \ln\left(\frac{\sigma_L}{n_L}\right) \right\rfloor \cdot \max(n_a, n_b) + \min(n_a, n_b) &amp;lt;/math&amp;gt; &amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In this equation, &amp;lt;math&amp;gt;\sigma_L&amp;lt;/math&amp;gt; denotes the standard deviation of the &amp;lt;math&amp;gt;L&amp;lt;/math&amp;gt;-channel histogram, while &amp;lt;math&amp;gt;n_L&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;n_a&amp;lt;/math&amp;gt;, and &amp;lt;math&amp;gt;n_b&amp;lt;/math&amp;gt; represent the number of local maxima detected in the &amp;lt;math&amp;gt;L&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;a&amp;lt;/math&amp;gt;, and &amp;lt;math&amp;gt;b&amp;lt;/math&amp;gt; histograms, respectively. The term &amp;lt;math&amp;gt;\max(n_a, n_b)&amp;lt;/math&amp;gt; selects the channel with the strongest chromatic variation, while &amp;lt;math&amp;gt;\min(n_a, n_b)&amp;lt;/math&amp;gt; represents the weaker chromatic channel. A complete overview of the method is illustrated in the processing pipeline shown in Figure 3. It should be noted that this method requires input images to be in standard three-channel RGB format.&lt;br /&gt;
&lt;br /&gt;
=== Color Histogram ===&lt;br /&gt;
Color information in an image can be described using several types of descriptors, such as color histograms, color correlograms, color coherence vectors, and color moments. Among these options, the color histogram is one of the most commonly used representations because it is simple to compute and effective at capturing overall color content, especially when an image has a distinct color distribution compared to others in a dataset.&lt;br /&gt;
&lt;br /&gt;
In the proposed method, information is extracted from the &amp;lt;math&amp;gt;L&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;a&amp;lt;/math&amp;gt;, and &amp;lt;math&amp;gt;b&amp;lt;/math&amp;gt; histograms by analyzing their standard deviations and the number of local maxima. These measurements describe important properties of the image and provide the motivation for the design of the CCSE function:&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;Lightness distribution&#039;&#039;&#039;: The standard deviation of the &amp;lt;math&amp;gt;L&amp;lt;/math&amp;gt;-channel histogram indicates the range of lightness values in the image. A larger standard deviation corresponds to a wider spread of brightness levels, while a smaller value suggests more uniform lighting.&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;Color distribution&#039;&#039;&#039;: The standard deviations of the &amp;lt;math&amp;gt;a&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;b&amp;lt;/math&amp;gt; histograms reflect the diversity of chromatic content. Higher values indicate a broader range of colors, whereas lower values suggest limited color variation.&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;Peak separability&#039;&#039;&#039;: The number of local maxima in the &amp;lt;math&amp;gt;L&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;a&amp;lt;/math&amp;gt;, and &amp;lt;math&amp;gt;b&amp;lt;/math&amp;gt; histograms indicates how well different lightness and color levels are separated. More local maxima imply clearly distinguishable color or intensity regions, while fewer maxima suggest more clustered values.&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;Image complexity&#039;&#039;&#039;: Taken together, the standard deviations and local maxima across all three channels provide an estimate of overall image complexity. Images with larger histogram spreads and more peaks are considered more complex, while images with fewer peaks and narrower distributions are simpler.&lt;br /&gt;
&lt;br /&gt;
Overall, histogram analysis offers a compact yet informative description of an image’s lightness and color structure, which is valuable for segmentation and object recognition tasks.&lt;br /&gt;
&lt;br /&gt;
=== CCSE Function ===&lt;br /&gt;
The term &amp;lt;math&amp;gt;\left\lfloor \ln\left(\frac{\sigma_L}{n_L}\right) \right\rfloor&amp;lt;/math&amp;gt; computes the logarithm of the ratio between the standard deviation of the &amp;lt;math&amp;gt;L&amp;lt;/math&amp;gt;-channel histogram and the number of its local maxima. This ratio reflects the balance between the spread of lightness values and the separability of different lightness levels in the image. Applying the logarithm helps normalize the scale of the values and reduces sensitivity to extreme cases. The floor operation ensures that the resulting estimate of the number of clusters remains an integer. This formulation also prevents the estimated number of clusters from becoming too small when an image contains colors with very similar hues and limited lightness variation.&lt;br /&gt;
&lt;br /&gt;
Multiplying this term by &amp;lt;math&amp;gt;\max(n_a, n_b)&amp;lt;/math&amp;gt; emphasizes the chromatic channel with the greater number of distinct peaks, which typically corresponds to the dominant source of color variation in the image. Using only the weaker chromatic channel could lead to an underestimation of the required number of color segments.&lt;br /&gt;
&lt;br /&gt;
Finally, adding &amp;lt;math&amp;gt;\min(n_a, n_b)&amp;lt;/math&amp;gt; ensures that information from the less dominant chromatic channel is still taken into account. While the channel with stronger variation plays a more important role, incorporating the weaker channel leads to a more balanced and accurate estimation of the number of color clusters.&lt;br /&gt;
&lt;br /&gt;
== Results ==&lt;br /&gt;
&lt;br /&gt;
=== Visual Validation ===&lt;br /&gt;
&lt;br /&gt;
The first part of the evaluation focuses on visual validation, which allows us to directly compare the segmentation results produced by the CCSE algorithm with those from the Elbow Method and the Gap Statistic Method. To ensure a fair comparison, all methods are tested under the same conditions. Since the Elbow and Gap methods require evaluating a range of cluster values, we set a maximum number of clusters of 𝐾max = 20 for all images.&lt;br /&gt;
&lt;br /&gt;
After estimating the optimal number of clusters using each method, the images are segmented accordingly and visually inspected. The comparison focuses on how well each method captures dominant color regions, object boundaries, and overall segmentation smoothness. The results show that the segmentations produced by CCSE are visually very similar to those obtained using the Elbow and Gap methods. This indicates that CCSE successfully captures the main color structures of the images.&lt;br /&gt;
&lt;br /&gt;
Overall, this visual validation demonstrates that CCSE can achieve segmentation quality comparable to established methods, while avoiding the repeated clustering steps required by the Elbow and Gap approaches.&lt;br /&gt;
&lt;br /&gt;
[[File:visualvalidation.png|center|frameless|400px]]&lt;br /&gt;
&lt;br /&gt;
=== Quantitative Validation ===&lt;br /&gt;
&lt;br /&gt;
Quantitative validation is performed using &#039;&#039;&#039;Color Reconstruction Error-based Segmentation Evaluation (CRESE)&#039;&#039;&#039;. This metric evaluates how accurately a segmented image reconstructs the original image in terms of color. It computes the sum of color differences between each pixel’s original color and the average color of the cluster to which the pixel is assigned. A lower reconstruction error indicates better segmentation performance and a more accurate estimate of the number of color clusters.&lt;br /&gt;
&lt;br /&gt;
Let &amp;lt;math&amp;gt;O \in \mathbb{R}^{H \times W \times 3}&amp;lt;/math&amp;gt; denote the original image, and let &amp;lt;math&amp;gt;S \in \mathbb{R}^{H \times W \times 3}&amp;lt;/math&amp;gt; denote the segmented image, where each pixel is replaced by the average color of its assigned cluster. Let&lt;br /&gt;
&amp;lt;math&amp;gt;C = {c_1, c_2, \dots, c_n}&amp;lt;/math&amp;gt; be the set of unique cluster colors in &amp;lt;math&amp;gt;S&amp;lt;/math&amp;gt;, where &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; is the number of clusters. For each cluster color &amp;lt;math&amp;gt;c_i&amp;lt;/math&amp;gt;, a binary mask &amp;lt;math&amp;gt;M_i \in {0,1}^{H \times W}&amp;lt;/math&amp;gt; is defined to indicate pixel membership.&lt;br /&gt;
&lt;br /&gt;
The total color reconstruction error &amp;lt;math&amp;gt;E&amp;lt;/math&amp;gt; is computed as follows:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt; &amp;lt;math&amp;gt; E = \sum_{i=1}^{n} \sum_{h=1}^{H} \sum_{w=1}^{W} M_i(h,w)\,\left\| O(h,w) - c_i \right\|_2 &amp;lt;/math&amp;gt; (&amp;lt;math&amp;gt;|\cdot|_2&amp;lt;/math&amp;gt; shows the Euclidean distance between color vectors) &amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In this evaluation, the color reconstruction error is computed using the Euclidean distance between color vectors in the CIELAB color space. Both the original image &amp;lt;math&amp;gt;O&amp;lt;/math&amp;gt; and the cluster representative colors &amp;lt;math&amp;gt;c_i&amp;lt;/math&amp;gt; are first converted from RGB to CIELAB before the distance is computed. This choice is motivated by the perceptual properties of the CIELAB color space, which is designed so that Euclidean distances correspond approximately to perceived color differences. As a result, Euclidean distance in CIELAB provides a meaningful and interpretable measure of how well the segmented image preserves the original colors.&lt;br /&gt;
&lt;br /&gt;
Although perceptual color difference metrics such as &amp;lt;math&amp;gt;\Delta E&amp;lt;/math&amp;gt; are commonly used for precise color comparison, Euclidean distance in CIELAB offers a computationally efficient alternative while remaining perceptually relevant. Since CRESE is used to compare relative segmentation performance across methods rather than to measure absolute perceptual color error, this simplified distance metric is sufficient for evaluation purposes. In contrast, computing reconstruction error directly in RGB space would be less appropriate, as Euclidean distances in RGB do not correspond well to human color perception and are sensitive to illumination variations.&lt;br /&gt;
&lt;br /&gt;
To enable comparison across images of different sizes, the error is normalized and expressed as a percentage:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt; &amp;lt;math&amp;gt; E_{\text{normalized}} = \frac{E}{H \cdot W \cdot 255 \cdot \sqrt{3}} \times 100 &amp;lt;/math&amp;gt; &amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
During experimentation, contrast enhancement was observed to increase the estimated number of clusters. Since contrast enhancement has constant-time complexity, it does not affect the computational cost of the CRESE evaluation. Using this metric, validation curves of normalized reconstruction error versus the number of clusters &amp;lt;math&amp;gt;k&amp;lt;/math&amp;gt; are generated for both original and contrast-enhanced images.&lt;br /&gt;
&lt;br /&gt;
[[Image:quantitativevalidation.png|center|frameless|700px]]&lt;br /&gt;
&lt;br /&gt;
=== Efficiency Validation ===&lt;br /&gt;
&lt;br /&gt;
This section evaluates the computation time of the CCSE algorithm and compares it with the Elbow Method and the Gap Statistic Method in the context of image segmentation. While earlier sections focused on segmentation accuracy, the goal here is to understand how efficiently each method performs as image size increases.&lt;br /&gt;
&lt;br /&gt;
A high resolution beach image with a size of 3840 × 2160 pixels is used as the test image. The image is not contrast enhanced so that computation time is affected only by image size and not by additional preprocessing. To analyze scalability, resized versions of the image are created while preserving the original aspect ratio. The image is scaled to 10%, 25%, 33%, 50%, and 75% of its original dimensions, resulting in a range of images with different pixel counts.&lt;br /&gt;
&lt;br /&gt;
To ensure a fair comparison, the maximum number of clusters is fixed at &amp;lt;math&amp;gt;K_{\max} = 20&amp;lt;/math&amp;gt; for both the Elbow Method and the Gap Statistic Method. For each resized image, the time required by each algorithm to estimate the optimal number of clusters is measured. These measurements allow us to observe how computation time changes as image resolution increases.&lt;br /&gt;
&lt;br /&gt;
By comparing the computation times across all image sizes, we can evaluate the efficiency and scalability of each method. This analysis helps determine which approach is more suitable for real world applications where image sizes may vary significantly. The results also highlight the ability of the CCSE algorithm to handle larger images efficiently while still producing reliable cluster estimates.&lt;br /&gt;
&lt;br /&gt;
[[Image:compvalidation.png|center|frameless|400px]]&lt;br /&gt;
&lt;br /&gt;
=== Sensitivity Validation ===&lt;br /&gt;
&lt;br /&gt;
Sensitivity analysis is used to evaluate how stable each clustering method is when its input parameters change. A method that is less sensitive to parameter variation is considered more robust because it produces more consistent results under different settings.&lt;br /&gt;
&lt;br /&gt;
In this study, sensitivity is evaluated for all three methods. For the Elbow Method and the Gap Statistic Method, sensitivity is tested by changing the maximum number of clusters, &amp;lt;math&amp;gt;K_{\max}&amp;lt;/math&amp;gt;. For the CCSE algorithm, sensitivity is examined by varying the distance parameter &amp;lt;math&amp;gt;D&amp;lt;/math&amp;gt;, which controls how histogram peaks are grouped when estimating the number of clusters.&lt;br /&gt;
&lt;br /&gt;
To ensure a fair comparison, the same parameter range is used for all methods. The value of &amp;lt;math&amp;gt;D&amp;lt;/math&amp;gt; for CCSE is set equal to &amp;lt;math&amp;gt;K_{\max}&amp;lt;/math&amp;gt; for the Elbow and Gap methods. Both parameters are varied from 5 to 40, using an increment of 5. For each parameter value, the estimated number of clusters is recorded and compared.&lt;br /&gt;
&lt;br /&gt;
[[Image:sensitivityvalidaiton.png|center|frameless|400px]]&lt;br /&gt;
&lt;br /&gt;
The Gap Statistic Method shows a nearly linear increase in the estimated number of clusters as &amp;lt;math&amp;gt;K_{\max}&amp;lt;/math&amp;gt; increases. This behavior indicates a high sensitivity to the chosen maximum value, meaning the estimated result depends strongly on the input parameter.&lt;br /&gt;
&lt;br /&gt;
The Elbow Method shows a non linear trend and is slightly less sensitive than the Gap Statistic Method. However, the estimated number of clusters still changes noticeably as &amp;lt;math&amp;gt;K_{\max}&amp;lt;/math&amp;gt; increases, which suggests that the method remains dependent on the selected parameter range.&lt;br /&gt;
&lt;br /&gt;
In contrast, the CCSE algorithm produces more stable estimates as the distance parameter &amp;lt;math&amp;gt;D&amp;lt;/math&amp;gt; increases. While the estimated number of clusters decreases gradually, the change is smoother and more controlled compared to the other methods. This indicates lower sensitivity to parameter variation.&lt;br /&gt;
&lt;br /&gt;
Overall, the CCSE algorithm demonstrates the highest robustness among the three methods. Its reduced sensitivity to parameter changes allows it to produce more consistent cluster estimates across a wide range of settings, making it more reliable for practical image segmentation tasks.&lt;br /&gt;
&lt;br /&gt;
== Conclusion ==&lt;br /&gt;
&lt;br /&gt;
From the results presented above, it can be concluded that the proposed CCSE algorithm performs well across several important aspects of image segmentation, including segmentation quality, computation time, and robustness. Visual inspection shows that the segmented images produced using CCSE are similar to those generated by the Elbow Method and the Gap Statistic, indicating that CCSE is able to capture the main color structure of the images.&lt;br /&gt;
&lt;br /&gt;
Quantitative evaluation using the CRESE metric further supports these observations. For both original and contrast-enhanced images, the reconstruction errors produced by CCSE are comparable to those of the other methods. This shows that CCSE can estimate a reasonable number of color clusters even when image contrast changes.&lt;br /&gt;
&lt;br /&gt;
In terms of efficiency, CCSE clearly outperforms the Elbow and Gap Statistic methods. Its computation time increases very little as image size grows, making it suitable for high-resolution images and large datasets. In addition, CCSE shows stable behavior across different parameter settings, which indicates good robustness.&lt;br /&gt;
&lt;br /&gt;
Overall, the CCSE algorithm provides a practical and reliable approach for estimating the number of color clusters in image segmentation, offering a good balance between accuracy, speed, and stability.&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
== Appendix 1 ==&lt;br /&gt;
&lt;br /&gt;
link to code: https://drive.google.com/drive/folders/1kJ1jRgtYwjPT1HOiSKBag3t2gvJKGu8J?usp=drive_link&lt;/div&gt;</summary>
		<author><name>Sisira2</name></author>
	</entry>
	<entry>
		<id>http://vista.su.domains/psych221wiki/index.php?title=Smart_Cluster_Selection_for_CIELAB_Color_Segmentation&amp;diff=146043</id>
		<title>Smart Cluster Selection for CIELAB Color Segmentation</title>
		<link rel="alternate" type="text/html" href="http://vista.su.domains/psych221wiki/index.php?title=Smart_Cluster_Selection_for_CIELAB_Color_Segmentation&amp;diff=146043"/>
		<updated>2025-12-13T06:52:37Z</updated>

		<summary type="html">&lt;p&gt;Sisira2: /* Quantitative Validation */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction ==&lt;br /&gt;
Image segmentation is a fundamental step in many computer vision applications because it allows algorithms to separate meaningful regions, identify objects, and reduce the complexity of visual scenes. Color is one of the most informative cues for distinguishing visual elements, which is why color-based segmentation methods are commonly used. In particular, clustering techniques group pixels that have similar color characteristics, making them effective for isolating regions with shared appearance.&lt;br /&gt;
&lt;br /&gt;
Color-based segmentation is especially important in applications such as remote sensing, where large images often contain regions like vegetation, water, and urban areas that are best distinguished by color. Accurate segmentation in these settings supports tasks such as land cover analysis, environmental monitoring, and change detection, making efficient color segmentation a practical requirement.&lt;br /&gt;
&lt;br /&gt;
A major challenge in color-based segmentation is determining the appropriate number of color clusters for a given image. If too few clusters are chosen, under-segmentation occurs and important details may be merged. If too many clusters are used, over-segmentation can occur, where noise or small variations form meaningless regions. Common techniques such as the Elbow Method and the Gap Statistic estimate the number of clusters by repeatedly running clustering algorithms like K-Means with different values of k. While effective, these methods are computationally expensive for high-resolution images or large datasets and are often unsuitable for real-time use.&lt;br /&gt;
&lt;br /&gt;
This project proposes an alternative approach that estimates the ideal number of color clusters directly from the statistical properties of the image. By analyzing lightness variation, chromatic distributions, and color histograms in the CIELAB color space, the method aims to infer the number of meaningful color groups without testing many cluster values, resulting in a faster and more scalable solution.&lt;br /&gt;
&lt;br /&gt;
== Background ==&lt;br /&gt;
Color-based image segmentation is widely used in computer vision because color provides a strong and intuitive cue for separating different regions in an image. Many real-world images contain objects or areas that are more easily distinguished by color than by shape or texture, especially in scenes with complex structure or uneven lighting. By grouping pixels with similar color properties, segmentation methods can reduce image complexity and make later processing steps more efficient.&lt;br /&gt;
&lt;br /&gt;
To make color comparisons meaningful, pixel values are often represented in a perceptual color space rather than directly in RGB. The CIELAB color space is commonly used because it separates lightness from chromatic information, allowing brightness changes to be handled independently from color differences. This is important in practical settings where illumination varies across the image. In addition, CIELAB is approximately perceptually uniform, meaning that distances in the space align reasonably well with how humans perceive color differences. For this reason, simple distance measures in CIELAB are effective for clustering and segmentation tasks.&lt;br /&gt;
&lt;br /&gt;
Many existing segmentation methods rely on statistical information derived from color distributions. Techniques such as K-Means, Mean Shift, and Gaussian Mixture Models group pixels based on similarity, often using histogram information to capture how colors are distributed across an image. Color histograms, in particular, provide a compact summary of lightness and chromatic variation. Peaks in these histograms often correspond to dominant colors or distinct regions, making histogram structure a useful indicator of image complexity.&lt;br /&gt;
&lt;br /&gt;
A key challenge in clustering-based segmentation is selecting the number of clusters. Traditional approaches such as the Elbow Method and the Gap Statistic estimate this number by repeatedly running clustering algorithms with different settings and comparing the results. While these methods are well established, their reliance on multiple clustering runs makes them computationally expensive, especially for high-resolution images or large collections of data.&lt;br /&gt;
&lt;br /&gt;
The ideas behind perceptual color spaces, histogram analysis, and cluster estimation motivate the approach taken in this project. Instead of repeatedly applying clustering algorithms, this work explores whether the number of meaningful color regions can be inferred directly from image statistics in the CIELAB space. By analyzing lightness variation, chromatic spread, and histogram structure, the proposed method aims to estimate the appropriate number of color clusters efficiently, reducing computation while still supporting reliable image segmentation.&lt;br /&gt;
&lt;br /&gt;
== Methods ==&lt;br /&gt;
&lt;br /&gt;
=== Proposed Method ===&lt;br /&gt;
The proposed method consists of three main stages. First, the input image is converted from the three-channel RGB color space to the CIELAB (Lab*) color space. Separate histograms are then extracted for the &amp;lt;math&amp;gt;L&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;a&amp;lt;/math&amp;gt;, and &amp;lt;math&amp;gt;b&amp;lt;/math&amp;gt; channels. Second, two statistical parameters are computed from each histogram: the standard deviation and the number of local maxima. These values describe the distribution and structure of lightness and color information in the image. Finally, the optimal number of color clusters is estimated using the CIELAB Color Segment Estimation (CCSE) function, defined as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt; &amp;lt;math&amp;gt; k = \left\lfloor \ln\left(\frac{\sigma_L}{n_L}\right) \right\rfloor \cdot \max(n_a, n_b) + \min(n_a, n_b) &amp;lt;/math&amp;gt; &amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In this equation, &amp;lt;math&amp;gt;\sigma_L&amp;lt;/math&amp;gt; denotes the standard deviation of the &amp;lt;math&amp;gt;L&amp;lt;/math&amp;gt;-channel histogram, while &amp;lt;math&amp;gt;n_L&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;n_a&amp;lt;/math&amp;gt;, and &amp;lt;math&amp;gt;n_b&amp;lt;/math&amp;gt; represent the number of local maxima detected in the &amp;lt;math&amp;gt;L&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;a&amp;lt;/math&amp;gt;, and &amp;lt;math&amp;gt;b&amp;lt;/math&amp;gt; histograms, respectively. The term &amp;lt;math&amp;gt;\max(n_a, n_b)&amp;lt;/math&amp;gt; selects the channel with the strongest chromatic variation, while &amp;lt;math&amp;gt;\min(n_a, n_b)&amp;lt;/math&amp;gt; represents the weaker chromatic channel. A complete overview of the method is illustrated in the processing pipeline shown in Figure 3. It should be noted that this method requires input images to be in standard three-channel RGB format.&lt;br /&gt;
&lt;br /&gt;
=== Color Histogram ===&lt;br /&gt;
Color information in an image can be described using several types of descriptors, such as color histograms, color correlograms, color coherence vectors, and color moments. Among these options, the color histogram is one of the most commonly used representations because it is simple to compute and effective at capturing overall color content, especially when an image has a distinct color distribution compared to others in a dataset.&lt;br /&gt;
&lt;br /&gt;
In the proposed method, information is extracted from the &amp;lt;math&amp;gt;L&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;a&amp;lt;/math&amp;gt;, and &amp;lt;math&amp;gt;b&amp;lt;/math&amp;gt; histograms by analyzing their standard deviations and the number of local maxima. These measurements describe important properties of the image and provide the motivation for the design of the CCSE function:&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;Lightness distribution&#039;&#039;&#039;: The standard deviation of the &amp;lt;math&amp;gt;L&amp;lt;/math&amp;gt;-channel histogram indicates the range of lightness values in the image. A larger standard deviation corresponds to a wider spread of brightness levels, while a smaller value suggests more uniform lighting.&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;Color distribution&#039;&#039;&#039;: The standard deviations of the &amp;lt;math&amp;gt;a&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;b&amp;lt;/math&amp;gt; histograms reflect the diversity of chromatic content. Higher values indicate a broader range of colors, whereas lower values suggest limited color variation.&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;Peak separability&#039;&#039;&#039;: The number of local maxima in the &amp;lt;math&amp;gt;L&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;a&amp;lt;/math&amp;gt;, and &amp;lt;math&amp;gt;b&amp;lt;/math&amp;gt; histograms indicates how well different lightness and color levels are separated. More local maxima imply clearly distinguishable color or intensity regions, while fewer maxima suggest more clustered values.&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;Image complexity&#039;&#039;&#039;: Taken together, the standard deviations and local maxima across all three channels provide an estimate of overall image complexity. Images with larger histogram spreads and more peaks are considered more complex, while images with fewer peaks and narrower distributions are simpler.&lt;br /&gt;
&lt;br /&gt;
Overall, histogram analysis offers a compact yet informative description of an image’s lightness and color structure, which is valuable for segmentation and object recognition tasks.&lt;br /&gt;
&lt;br /&gt;
=== CCSE Function ===&lt;br /&gt;
The term &amp;lt;math&amp;gt;\left\lfloor \ln\left(\frac{\sigma_L}{n_L}\right) \right\rfloor&amp;lt;/math&amp;gt; computes the logarithm of the ratio between the standard deviation of the &amp;lt;math&amp;gt;L&amp;lt;/math&amp;gt;-channel histogram and the number of its local maxima. This ratio reflects the balance between the spread of lightness values and the separability of different lightness levels in the image. Applying the logarithm helps normalize the scale of the values and reduces sensitivity to extreme cases. The floor operation ensures that the resulting estimate of the number of clusters remains an integer. This formulation also prevents the estimated number of clusters from becoming too small when an image contains colors with very similar hues and limited lightness variation.&lt;br /&gt;
&lt;br /&gt;
Multiplying this term by &amp;lt;math&amp;gt;\max(n_a, n_b)&amp;lt;/math&amp;gt; emphasizes the chromatic channel with the greater number of distinct peaks, which typically corresponds to the dominant source of color variation in the image. Using only the weaker chromatic channel could lead to an underestimation of the required number of color segments.&lt;br /&gt;
&lt;br /&gt;
Finally, adding &amp;lt;math&amp;gt;\min(n_a, n_b)&amp;lt;/math&amp;gt; ensures that information from the less dominant chromatic channel is still taken into account. While the channel with stronger variation plays a more important role, incorporating the weaker channel leads to a more balanced and accurate estimation of the number of color clusters.&lt;br /&gt;
&lt;br /&gt;
== Results ==&lt;br /&gt;
&lt;br /&gt;
=== Visual Validation ===&lt;br /&gt;
&lt;br /&gt;
The first part of the evaluation focuses on visual validation, which allows us to directly compare the segmentation results produced by the CCSE algorithm with those from the Elbow Method and the Gap Statistic Method. To ensure a fair comparison, all methods are tested under the same conditions. Since the Elbow and Gap methods require evaluating a range of cluster values, we set a maximum number of clusters of 𝐾max = 20 for all images.&lt;br /&gt;
&lt;br /&gt;
After estimating the optimal number of clusters using each method, the images are segmented accordingly and visually inspected. The comparison focuses on how well each method captures dominant color regions, object boundaries, and overall segmentation smoothness. The results show that the segmentations produced by CCSE are visually very similar to those obtained using the Elbow and Gap methods. This indicates that CCSE successfully captures the main color structures of the images.&lt;br /&gt;
&lt;br /&gt;
Overall, this visual validation demonstrates that CCSE can achieve segmentation quality comparable to established methods, while avoiding the repeated clustering steps required by the Elbow and Gap approaches.&lt;br /&gt;
&lt;br /&gt;
[[File:visualvalidation.png|center|frameless|400px]]&lt;br /&gt;
&lt;br /&gt;
=== Quantitative Validation ===&lt;br /&gt;
&lt;br /&gt;
Quantitative validation is performed using &#039;&#039;&#039;Color Reconstruction Error-based Segmentation Evaluation (CRESE)&#039;&#039;&#039;. This metric evaluates how accurately a segmented image reconstructs the original image in terms of color. It computes the sum of color differences between each pixel’s original color and the average color of the cluster to which the pixel is assigned. A lower reconstruction error indicates better segmentation performance and a more accurate estimate of the number of color clusters.&lt;br /&gt;
&lt;br /&gt;
Let &amp;lt;math&amp;gt;O \in \mathbb{R}^{H \times W \times 3}&amp;lt;/math&amp;gt; denote the original image, and let &amp;lt;math&amp;gt;S \in \mathbb{R}^{H \times W \times 3}&amp;lt;/math&amp;gt; denote the segmented image, where each pixel is replaced by the average color of its assigned cluster. Let&lt;br /&gt;
&amp;lt;math&amp;gt;C = {c_1, c_2, \dots, c_n}&amp;lt;/math&amp;gt; be the set of unique cluster colors in &amp;lt;math&amp;gt;S&amp;lt;/math&amp;gt;, where &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; is the number of clusters. For each cluster color &amp;lt;math&amp;gt;c_i&amp;lt;/math&amp;gt;, a binary mask &amp;lt;math&amp;gt;M_i \in {0,1}^{H \times W}&amp;lt;/math&amp;gt; is defined to indicate pixel membership.&lt;br /&gt;
&lt;br /&gt;
The total color reconstruction error &amp;lt;math&amp;gt;E&amp;lt;/math&amp;gt; is computed as follows:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt; &amp;lt;math&amp;gt; E = \sum_{i=1}^{n} \sum_{h=1}^{H} \sum_{w=1}^{W} M_i(h,w)\,\left\| O(h,w) - c_i \right\|_2 &amp;lt;/math&amp;gt; &amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;|\cdot|_2&amp;lt;/math&amp;gt; shows the Euclidean distance between color vectors. In this evaluation, the color reconstruction error is computed using the Euclidean distance between color vectors in the CIELAB color space. Both the original image &amp;lt;math&amp;gt;O&amp;lt;/math&amp;gt; and the cluster representative colors &amp;lt;math&amp;gt;c_i&amp;lt;/math&amp;gt; are first converted from RGB to CIELAB before the distance is computed. This choice is motivated by the perceptual properties of the CIELAB color space, which is designed so that Euclidean distances correspond approximately to perceived color differences. As a result, Euclidean distance in CIELAB provides a meaningful and interpretable measure of how well the segmented image preserves the original colors.&lt;br /&gt;
&lt;br /&gt;
Although perceptual color difference metrics such as &amp;lt;math&amp;gt;\Delta E&amp;lt;/math&amp;gt; are commonly used for precise color comparison, Euclidean distance in CIELAB offers a computationally efficient alternative while remaining perceptually relevant. Since CRESE is used to compare relative segmentation performance across methods rather than to measure absolute perceptual color error, this simplified distance metric is sufficient for evaluation purposes. In contrast, computing reconstruction error directly in RGB space would be less appropriate, as Euclidean distances in RGB do not correspond well to human color perception and are sensitive to illumination variations.&lt;br /&gt;
&lt;br /&gt;
To enable comparison across images of different sizes, the error is normalized and expressed as a percentage:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt; &amp;lt;math&amp;gt; E_{\text{normalized}} = \frac{E}{H \cdot W \cdot 255 \cdot \sqrt{3}} \times 100 &amp;lt;/math&amp;gt; &amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
During experimentation, contrast enhancement was observed to increase the estimated number of clusters. Since contrast enhancement has constant-time complexity, it does not affect the computational cost of the CRESE evaluation. Using this metric, validation curves of normalized reconstruction error versus the number of clusters &amp;lt;math&amp;gt;k&amp;lt;/math&amp;gt; are generated for both original and contrast-enhanced images.&lt;br /&gt;
&lt;br /&gt;
[[Image:quantitativevalidation.png|center|frameless|700px]]&lt;br /&gt;
&lt;br /&gt;
=== Efficiency Validation ===&lt;br /&gt;
&lt;br /&gt;
This section evaluates the computation time of the CCSE algorithm and compares it with the Elbow Method and the Gap Statistic Method in the context of image segmentation. While earlier sections focused on segmentation accuracy, the goal here is to understand how efficiently each method performs as image size increases.&lt;br /&gt;
&lt;br /&gt;
A high resolution beach image with a size of 3840 × 2160 pixels is used as the test image. The image is not contrast enhanced so that computation time is affected only by image size and not by additional preprocessing. To analyze scalability, resized versions of the image are created while preserving the original aspect ratio. The image is scaled to 10%, 25%, 33%, 50%, and 75% of its original dimensions, resulting in a range of images with different pixel counts.&lt;br /&gt;
&lt;br /&gt;
To ensure a fair comparison, the maximum number of clusters is fixed at &amp;lt;math&amp;gt;K_{\max} = 20&amp;lt;/math&amp;gt; for both the Elbow Method and the Gap Statistic Method. For each resized image, the time required by each algorithm to estimate the optimal number of clusters is measured. These measurements allow us to observe how computation time changes as image resolution increases.&lt;br /&gt;
&lt;br /&gt;
By comparing the computation times across all image sizes, we can evaluate the efficiency and scalability of each method. This analysis helps determine which approach is more suitable for real world applications where image sizes may vary significantly. The results also highlight the ability of the CCSE algorithm to handle larger images efficiently while still producing reliable cluster estimates.&lt;br /&gt;
&lt;br /&gt;
[[Image:compvalidation.png|center|frameless|400px]]&lt;br /&gt;
&lt;br /&gt;
=== Sensitivity Validation ===&lt;br /&gt;
&lt;br /&gt;
Sensitivity analysis is used to evaluate how stable each clustering method is when its input parameters change. A method that is less sensitive to parameter variation is considered more robust because it produces more consistent results under different settings.&lt;br /&gt;
&lt;br /&gt;
In this study, sensitivity is evaluated for all three methods. For the Elbow Method and the Gap Statistic Method, sensitivity is tested by changing the maximum number of clusters, &amp;lt;math&amp;gt;K_{\max}&amp;lt;/math&amp;gt;. For the CCSE algorithm, sensitivity is examined by varying the distance parameter &amp;lt;math&amp;gt;D&amp;lt;/math&amp;gt;, which controls how histogram peaks are grouped when estimating the number of clusters.&lt;br /&gt;
&lt;br /&gt;
To ensure a fair comparison, the same parameter range is used for all methods. The value of &amp;lt;math&amp;gt;D&amp;lt;/math&amp;gt; for CCSE is set equal to &amp;lt;math&amp;gt;K_{\max}&amp;lt;/math&amp;gt; for the Elbow and Gap methods. Both parameters are varied from 5 to 40, using an increment of 5. For each parameter value, the estimated number of clusters is recorded and compared.&lt;br /&gt;
&lt;br /&gt;
[[Image:sensitivityvalidaiton.png|center|frameless|400px]]&lt;br /&gt;
&lt;br /&gt;
The Gap Statistic Method shows a nearly linear increase in the estimated number of clusters as &amp;lt;math&amp;gt;K_{\max}&amp;lt;/math&amp;gt; increases. This behavior indicates a high sensitivity to the chosen maximum value, meaning the estimated result depends strongly on the input parameter.&lt;br /&gt;
&lt;br /&gt;
The Elbow Method shows a non linear trend and is slightly less sensitive than the Gap Statistic Method. However, the estimated number of clusters still changes noticeably as &amp;lt;math&amp;gt;K_{\max}&amp;lt;/math&amp;gt; increases, which suggests that the method remains dependent on the selected parameter range.&lt;br /&gt;
&lt;br /&gt;
In contrast, the CCSE algorithm produces more stable estimates as the distance parameter &amp;lt;math&amp;gt;D&amp;lt;/math&amp;gt; increases. While the estimated number of clusters decreases gradually, the change is smoother and more controlled compared to the other methods. This indicates lower sensitivity to parameter variation.&lt;br /&gt;
&lt;br /&gt;
Overall, the CCSE algorithm demonstrates the highest robustness among the three methods. Its reduced sensitivity to parameter changes allows it to produce more consistent cluster estimates across a wide range of settings, making it more reliable for practical image segmentation tasks.&lt;br /&gt;
&lt;br /&gt;
== Conclusion ==&lt;br /&gt;
&lt;br /&gt;
From the results presented above, it can be concluded that the proposed CCSE algorithm performs well across several important aspects of image segmentation, including segmentation quality, computation time, and robustness. Visual inspection shows that the segmented images produced using CCSE are similar to those generated by the Elbow Method and the Gap Statistic, indicating that CCSE is able to capture the main color structure of the images.&lt;br /&gt;
&lt;br /&gt;
Quantitative evaluation using the CRESE metric further supports these observations. For both original and contrast-enhanced images, the reconstruction errors produced by CCSE are comparable to those of the other methods. This shows that CCSE can estimate a reasonable number of color clusters even when image contrast changes.&lt;br /&gt;
&lt;br /&gt;
In terms of efficiency, CCSE clearly outperforms the Elbow and Gap Statistic methods. Its computation time increases very little as image size grows, making it suitable for high-resolution images and large datasets. In addition, CCSE shows stable behavior across different parameter settings, which indicates good robustness.&lt;br /&gt;
&lt;br /&gt;
Overall, the CCSE algorithm provides a practical and reliable approach for estimating the number of color clusters in image segmentation, offering a good balance between accuracy, speed, and stability.&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
== Appendix 1 ==&lt;br /&gt;
&lt;br /&gt;
link to code: https://drive.google.com/drive/folders/1kJ1jRgtYwjPT1HOiSKBag3t2gvJKGu8J?usp=drive_link&lt;/div&gt;</summary>
		<author><name>Sisira2</name></author>
	</entry>
	<entry>
		<id>http://vista.su.domains/psych221wiki/index.php?title=Smart_Cluster_Selection_for_CIELAB_Color_Segmentation&amp;diff=146041</id>
		<title>Smart Cluster Selection for CIELAB Color Segmentation</title>
		<link rel="alternate" type="text/html" href="http://vista.su.domains/psych221wiki/index.php?title=Smart_Cluster_Selection_for_CIELAB_Color_Segmentation&amp;diff=146041"/>
		<updated>2025-12-13T06:50:49Z</updated>

		<summary type="html">&lt;p&gt;Sisira2: /* Quantitative Validation */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction ==&lt;br /&gt;
Image segmentation is a fundamental step in many computer vision applications because it allows algorithms to separate meaningful regions, identify objects, and reduce the complexity of visual scenes. Color is one of the most informative cues for distinguishing visual elements, which is why color-based segmentation methods are commonly used. In particular, clustering techniques group pixels that have similar color characteristics, making them effective for isolating regions with shared appearance.&lt;br /&gt;
&lt;br /&gt;
Color-based segmentation is especially important in applications such as remote sensing, where large images often contain regions like vegetation, water, and urban areas that are best distinguished by color. Accurate segmentation in these settings supports tasks such as land cover analysis, environmental monitoring, and change detection, making efficient color segmentation a practical requirement.&lt;br /&gt;
&lt;br /&gt;
A major challenge in color-based segmentation is determining the appropriate number of color clusters for a given image. If too few clusters are chosen, under-segmentation occurs and important details may be merged. If too many clusters are used, over-segmentation can occur, where noise or small variations form meaningless regions. Common techniques such as the Elbow Method and the Gap Statistic estimate the number of clusters by repeatedly running clustering algorithms like K-Means with different values of k. While effective, these methods are computationally expensive for high-resolution images or large datasets and are often unsuitable for real-time use.&lt;br /&gt;
&lt;br /&gt;
This project proposes an alternative approach that estimates the ideal number of color clusters directly from the statistical properties of the image. By analyzing lightness variation, chromatic distributions, and color histograms in the CIELAB color space, the method aims to infer the number of meaningful color groups without testing many cluster values, resulting in a faster and more scalable solution.&lt;br /&gt;
&lt;br /&gt;
== Background ==&lt;br /&gt;
Color-based image segmentation is widely used in computer vision because color provides a strong and intuitive cue for separating different regions in an image. Many real-world images contain objects or areas that are more easily distinguished by color than by shape or texture, especially in scenes with complex structure or uneven lighting. By grouping pixels with similar color properties, segmentation methods can reduce image complexity and make later processing steps more efficient.&lt;br /&gt;
&lt;br /&gt;
To make color comparisons meaningful, pixel values are often represented in a perceptual color space rather than directly in RGB. The CIELAB color space is commonly used because it separates lightness from chromatic information, allowing brightness changes to be handled independently from color differences. This is important in practical settings where illumination varies across the image. In addition, CIELAB is approximately perceptually uniform, meaning that distances in the space align reasonably well with how humans perceive color differences. For this reason, simple distance measures in CIELAB are effective for clustering and segmentation tasks.&lt;br /&gt;
&lt;br /&gt;
Many existing segmentation methods rely on statistical information derived from color distributions. Techniques such as K-Means, Mean Shift, and Gaussian Mixture Models group pixels based on similarity, often using histogram information to capture how colors are distributed across an image. Color histograms, in particular, provide a compact summary of lightness and chromatic variation. Peaks in these histograms often correspond to dominant colors or distinct regions, making histogram structure a useful indicator of image complexity.&lt;br /&gt;
&lt;br /&gt;
A key challenge in clustering-based segmentation is selecting the number of clusters. Traditional approaches such as the Elbow Method and the Gap Statistic estimate this number by repeatedly running clustering algorithms with different settings and comparing the results. While these methods are well established, their reliance on multiple clustering runs makes them computationally expensive, especially for high-resolution images or large collections of data.&lt;br /&gt;
&lt;br /&gt;
The ideas behind perceptual color spaces, histogram analysis, and cluster estimation motivate the approach taken in this project. Instead of repeatedly applying clustering algorithms, this work explores whether the number of meaningful color regions can be inferred directly from image statistics in the CIELAB space. By analyzing lightness variation, chromatic spread, and histogram structure, the proposed method aims to estimate the appropriate number of color clusters efficiently, reducing computation while still supporting reliable image segmentation.&lt;br /&gt;
&lt;br /&gt;
== Methods ==&lt;br /&gt;
&lt;br /&gt;
=== Proposed Method ===&lt;br /&gt;
The proposed method consists of three main stages. First, the input image is converted from the three-channel RGB color space to the CIELAB (Lab*) color space. Separate histograms are then extracted for the &amp;lt;math&amp;gt;L&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;a&amp;lt;/math&amp;gt;, and &amp;lt;math&amp;gt;b&amp;lt;/math&amp;gt; channels. Second, two statistical parameters are computed from each histogram: the standard deviation and the number of local maxima. These values describe the distribution and structure of lightness and color information in the image. Finally, the optimal number of color clusters is estimated using the CIELAB Color Segment Estimation (CCSE) function, defined as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt; &amp;lt;math&amp;gt; k = \left\lfloor \ln\left(\frac{\sigma_L}{n_L}\right) \right\rfloor \cdot \max(n_a, n_b) + \min(n_a, n_b) &amp;lt;/math&amp;gt; &amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In this equation, &amp;lt;math&amp;gt;\sigma_L&amp;lt;/math&amp;gt; denotes the standard deviation of the &amp;lt;math&amp;gt;L&amp;lt;/math&amp;gt;-channel histogram, while &amp;lt;math&amp;gt;n_L&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;n_a&amp;lt;/math&amp;gt;, and &amp;lt;math&amp;gt;n_b&amp;lt;/math&amp;gt; represent the number of local maxima detected in the &amp;lt;math&amp;gt;L&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;a&amp;lt;/math&amp;gt;, and &amp;lt;math&amp;gt;b&amp;lt;/math&amp;gt; histograms, respectively. The term &amp;lt;math&amp;gt;\max(n_a, n_b)&amp;lt;/math&amp;gt; selects the channel with the strongest chromatic variation, while &amp;lt;math&amp;gt;\min(n_a, n_b)&amp;lt;/math&amp;gt; represents the weaker chromatic channel. A complete overview of the method is illustrated in the processing pipeline shown in Figure 3. It should be noted that this method requires input images to be in standard three-channel RGB format.&lt;br /&gt;
&lt;br /&gt;
=== Color Histogram ===&lt;br /&gt;
Color information in an image can be described using several types of descriptors, such as color histograms, color correlograms, color coherence vectors, and color moments. Among these options, the color histogram is one of the most commonly used representations because it is simple to compute and effective at capturing overall color content, especially when an image has a distinct color distribution compared to others in a dataset.&lt;br /&gt;
&lt;br /&gt;
In the proposed method, information is extracted from the &amp;lt;math&amp;gt;L&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;a&amp;lt;/math&amp;gt;, and &amp;lt;math&amp;gt;b&amp;lt;/math&amp;gt; histograms by analyzing their standard deviations and the number of local maxima. These measurements describe important properties of the image and provide the motivation for the design of the CCSE function:&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;Lightness distribution&#039;&#039;&#039;: The standard deviation of the &amp;lt;math&amp;gt;L&amp;lt;/math&amp;gt;-channel histogram indicates the range of lightness values in the image. A larger standard deviation corresponds to a wider spread of brightness levels, while a smaller value suggests more uniform lighting.&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;Color distribution&#039;&#039;&#039;: The standard deviations of the &amp;lt;math&amp;gt;a&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;b&amp;lt;/math&amp;gt; histograms reflect the diversity of chromatic content. Higher values indicate a broader range of colors, whereas lower values suggest limited color variation.&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;Peak separability&#039;&#039;&#039;: The number of local maxima in the &amp;lt;math&amp;gt;L&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;a&amp;lt;/math&amp;gt;, and &amp;lt;math&amp;gt;b&amp;lt;/math&amp;gt; histograms indicates how well different lightness and color levels are separated. More local maxima imply clearly distinguishable color or intensity regions, while fewer maxima suggest more clustered values.&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;Image complexity&#039;&#039;&#039;: Taken together, the standard deviations and local maxima across all three channels provide an estimate of overall image complexity. Images with larger histogram spreads and more peaks are considered more complex, while images with fewer peaks and narrower distributions are simpler.&lt;br /&gt;
&lt;br /&gt;
Overall, histogram analysis offers a compact yet informative description of an image’s lightness and color structure, which is valuable for segmentation and object recognition tasks.&lt;br /&gt;
&lt;br /&gt;
=== CCSE Function ===&lt;br /&gt;
The term &amp;lt;math&amp;gt;\left\lfloor \ln\left(\frac{\sigma_L}{n_L}\right) \right\rfloor&amp;lt;/math&amp;gt; computes the logarithm of the ratio between the standard deviation of the &amp;lt;math&amp;gt;L&amp;lt;/math&amp;gt;-channel histogram and the number of its local maxima. This ratio reflects the balance between the spread of lightness values and the separability of different lightness levels in the image. Applying the logarithm helps normalize the scale of the values and reduces sensitivity to extreme cases. The floor operation ensures that the resulting estimate of the number of clusters remains an integer. This formulation also prevents the estimated number of clusters from becoming too small when an image contains colors with very similar hues and limited lightness variation.&lt;br /&gt;
&lt;br /&gt;
Multiplying this term by &amp;lt;math&amp;gt;\max(n_a, n_b)&amp;lt;/math&amp;gt; emphasizes the chromatic channel with the greater number of distinct peaks, which typically corresponds to the dominant source of color variation in the image. Using only the weaker chromatic channel could lead to an underestimation of the required number of color segments.&lt;br /&gt;
&lt;br /&gt;
Finally, adding &amp;lt;math&amp;gt;\min(n_a, n_b)&amp;lt;/math&amp;gt; ensures that information from the less dominant chromatic channel is still taken into account. While the channel with stronger variation plays a more important role, incorporating the weaker channel leads to a more balanced and accurate estimation of the number of color clusters.&lt;br /&gt;
&lt;br /&gt;
== Results ==&lt;br /&gt;
&lt;br /&gt;
=== Visual Validation ===&lt;br /&gt;
&lt;br /&gt;
The first part of the evaluation focuses on visual validation, which allows us to directly compare the segmentation results produced by the CCSE algorithm with those from the Elbow Method and the Gap Statistic Method. To ensure a fair comparison, all methods are tested under the same conditions. Since the Elbow and Gap methods require evaluating a range of cluster values, we set a maximum number of clusters of 𝐾max = 20 for all images.&lt;br /&gt;
&lt;br /&gt;
After estimating the optimal number of clusters using each method, the images are segmented accordingly and visually inspected. The comparison focuses on how well each method captures dominant color regions, object boundaries, and overall segmentation smoothness. The results show that the segmentations produced by CCSE are visually very similar to those obtained using the Elbow and Gap methods. This indicates that CCSE successfully captures the main color structures of the images.&lt;br /&gt;
&lt;br /&gt;
Overall, this visual validation demonstrates that CCSE can achieve segmentation quality comparable to established methods, while avoiding the repeated clustering steps required by the Elbow and Gap approaches.&lt;br /&gt;
&lt;br /&gt;
[[File:visualvalidation.png|center|frameless|400px]]&lt;br /&gt;
&lt;br /&gt;
=== Quantitative Validation ===&lt;br /&gt;
&lt;br /&gt;
Quantitative validation is performed using &#039;&#039;&#039;Color Reconstruction Error-based Segmentation Evaluation (CRESE)&#039;&#039;&#039;. This metric evaluates how accurately a segmented image reconstructs the original image in terms of color. It computes the sum of color differences between each pixel’s original color and the average color of the cluster to which the pixel is assigned. A lower reconstruction error indicates better segmentation performance and a more accurate estimate of the number of color clusters.&lt;br /&gt;
&lt;br /&gt;
Let &amp;lt;math&amp;gt;O \in \mathbb{R}^{H \times W \times 3}&amp;lt;/math&amp;gt; denote the original image, and let &amp;lt;math&amp;gt;S \in \mathbb{R}^{H \times W \times 3}&amp;lt;/math&amp;gt; denote the segmented image, where each pixel is replaced by the average color of its assigned cluster. Let&lt;br /&gt;
&amp;lt;math&amp;gt;C = {c_1, c_2, \dots, c_n}&amp;lt;/math&amp;gt; be the set of unique cluster colors in &amp;lt;math&amp;gt;S&amp;lt;/math&amp;gt;, where &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; is the number of clusters. For each cluster color &amp;lt;math&amp;gt;c_i&amp;lt;/math&amp;gt;, a binary mask &amp;lt;math&amp;gt;M_i \in {0,1}^{H \times W}&amp;lt;/math&amp;gt; is defined to indicate pixel membership.&lt;br /&gt;
&lt;br /&gt;
The total color reconstruction error &amp;lt;math&amp;gt;E&amp;lt;/math&amp;gt; is computed as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt; &amp;lt;math&amp;gt; E = \sum_{i=1}^{n} \sum_{h=1}^{H} \sum_{w=1}^{W} M_i(h,w)\,\left\| O(h,w) - c_i \right\|_2 &amp;lt;/math&amp;gt; &amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where &amp;lt;math&amp;gt;|\cdot|_2&amp;lt;/math&amp;gt; denotes the Euclidean distance between color vectors. &lt;br /&gt;
To enable comparison across images of different sizes, the error is normalized and expressed as a percentage:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt; &amp;lt;math&amp;gt; E_{\text{normalized}} = \frac{E}{H \cdot W \cdot 255 \cdot \sqrt{3}} \times 100 &amp;lt;/math&amp;gt; &amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In this evaluation, the color reconstruction error is computed using the Euclidean distance between color vectors in the CIELAB color space. Both the original image &amp;lt;math&amp;gt;O&amp;lt;/math&amp;gt; and the cluster representative colors &amp;lt;math&amp;gt;c_i&amp;lt;/math&amp;gt; are first converted from RGB to CIELAB before the distance is computed. This choice is motivated by the perceptual properties of the CIELAB color space, which is designed so that Euclidean distances correspond approximately to perceived color differences. As a result, Euclidean distance in CIELAB provides a meaningful and interpretable measure of how well the segmented image preserves the original colors.&lt;br /&gt;
&lt;br /&gt;
Although perceptual color difference metrics such as &amp;lt;math&amp;gt;\Delta E&amp;lt;/math&amp;gt; are commonly used for precise color comparison, Euclidean distance in CIELAB offers a computationally efficient alternative while remaining perceptually relevant. Since CRESE is used to compare relative segmentation performance across methods rather than to measure absolute perceptual color error, this simplified distance metric is sufficient for evaluation purposes. In contrast, computing reconstruction error directly in RGB space would be less appropriate, as Euclidean distances in RGB do not correspond well to human color perception and are sensitive to illumination variations.&lt;br /&gt;
&lt;br /&gt;
During experimentation, contrast enhancement was observed to increase the estimated number of clusters. Since contrast enhancement has constant-time complexity, it does not affect the computational cost of the CRESE evaluation. Using this metric, validation curves of normalized reconstruction error versus the number of clusters &amp;lt;math&amp;gt;k&amp;lt;/math&amp;gt; are generated for both original and contrast-enhanced images.&lt;br /&gt;
&lt;br /&gt;
[[Image:quantitativevalidation.png|center|frameless|700px]]&lt;br /&gt;
&lt;br /&gt;
=== Efficiency Validation ===&lt;br /&gt;
&lt;br /&gt;
This section evaluates the computation time of the CCSE algorithm and compares it with the Elbow Method and the Gap Statistic Method in the context of image segmentation. While earlier sections focused on segmentation accuracy, the goal here is to understand how efficiently each method performs as image size increases.&lt;br /&gt;
&lt;br /&gt;
A high resolution beach image with a size of 3840 × 2160 pixels is used as the test image. The image is not contrast enhanced so that computation time is affected only by image size and not by additional preprocessing. To analyze scalability, resized versions of the image are created while preserving the original aspect ratio. The image is scaled to 10%, 25%, 33%, 50%, and 75% of its original dimensions, resulting in a range of images with different pixel counts.&lt;br /&gt;
&lt;br /&gt;
To ensure a fair comparison, the maximum number of clusters is fixed at &amp;lt;math&amp;gt;K_{\max} = 20&amp;lt;/math&amp;gt; for both the Elbow Method and the Gap Statistic Method. For each resized image, the time required by each algorithm to estimate the optimal number of clusters is measured. These measurements allow us to observe how computation time changes as image resolution increases.&lt;br /&gt;
&lt;br /&gt;
By comparing the computation times across all image sizes, we can evaluate the efficiency and scalability of each method. This analysis helps determine which approach is more suitable for real world applications where image sizes may vary significantly. The results also highlight the ability of the CCSE algorithm to handle larger images efficiently while still producing reliable cluster estimates.&lt;br /&gt;
&lt;br /&gt;
[[Image:compvalidation.png|center|frameless|400px]]&lt;br /&gt;
&lt;br /&gt;
=== Sensitivity Validation ===&lt;br /&gt;
&lt;br /&gt;
Sensitivity analysis is used to evaluate how stable each clustering method is when its input parameters change. A method that is less sensitive to parameter variation is considered more robust because it produces more consistent results under different settings.&lt;br /&gt;
&lt;br /&gt;
In this study, sensitivity is evaluated for all three methods. For the Elbow Method and the Gap Statistic Method, sensitivity is tested by changing the maximum number of clusters, &amp;lt;math&amp;gt;K_{\max}&amp;lt;/math&amp;gt;. For the CCSE algorithm, sensitivity is examined by varying the distance parameter &amp;lt;math&amp;gt;D&amp;lt;/math&amp;gt;, which controls how histogram peaks are grouped when estimating the number of clusters.&lt;br /&gt;
&lt;br /&gt;
To ensure a fair comparison, the same parameter range is used for all methods. The value of &amp;lt;math&amp;gt;D&amp;lt;/math&amp;gt; for CCSE is set equal to &amp;lt;math&amp;gt;K_{\max}&amp;lt;/math&amp;gt; for the Elbow and Gap methods. Both parameters are varied from 5 to 40, using an increment of 5. For each parameter value, the estimated number of clusters is recorded and compared.&lt;br /&gt;
&lt;br /&gt;
[[Image:sensitivityvalidaiton.png|center|frameless|400px]]&lt;br /&gt;
&lt;br /&gt;
The Gap Statistic Method shows a nearly linear increase in the estimated number of clusters as &amp;lt;math&amp;gt;K_{\max}&amp;lt;/math&amp;gt; increases. This behavior indicates a high sensitivity to the chosen maximum value, meaning the estimated result depends strongly on the input parameter.&lt;br /&gt;
&lt;br /&gt;
The Elbow Method shows a non linear trend and is slightly less sensitive than the Gap Statistic Method. However, the estimated number of clusters still changes noticeably as &amp;lt;math&amp;gt;K_{\max}&amp;lt;/math&amp;gt; increases, which suggests that the method remains dependent on the selected parameter range.&lt;br /&gt;
&lt;br /&gt;
In contrast, the CCSE algorithm produces more stable estimates as the distance parameter &amp;lt;math&amp;gt;D&amp;lt;/math&amp;gt; increases. While the estimated number of clusters decreases gradually, the change is smoother and more controlled compared to the other methods. This indicates lower sensitivity to parameter variation.&lt;br /&gt;
&lt;br /&gt;
Overall, the CCSE algorithm demonstrates the highest robustness among the three methods. Its reduced sensitivity to parameter changes allows it to produce more consistent cluster estimates across a wide range of settings, making it more reliable for practical image segmentation tasks.&lt;br /&gt;
&lt;br /&gt;
== Conclusion ==&lt;br /&gt;
&lt;br /&gt;
From the results presented above, it can be concluded that the proposed CCSE algorithm performs well across several important aspects of image segmentation, including segmentation quality, computation time, and robustness. Visual inspection shows that the segmented images produced using CCSE are similar to those generated by the Elbow Method and the Gap Statistic, indicating that CCSE is able to capture the main color structure of the images.&lt;br /&gt;
&lt;br /&gt;
Quantitative evaluation using the CRESE metric further supports these observations. For both original and contrast-enhanced images, the reconstruction errors produced by CCSE are comparable to those of the other methods. This shows that CCSE can estimate a reasonable number of color clusters even when image contrast changes.&lt;br /&gt;
&lt;br /&gt;
In terms of efficiency, CCSE clearly outperforms the Elbow and Gap Statistic methods. Its computation time increases very little as image size grows, making it suitable for high-resolution images and large datasets. In addition, CCSE shows stable behavior across different parameter settings, which indicates good robustness.&lt;br /&gt;
&lt;br /&gt;
Overall, the CCSE algorithm provides a practical and reliable approach for estimating the number of color clusters in image segmentation, offering a good balance between accuracy, speed, and stability.&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
== Appendix 1 ==&lt;br /&gt;
&lt;br /&gt;
link to code: https://drive.google.com/drive/folders/1kJ1jRgtYwjPT1HOiSKBag3t2gvJKGu8J?usp=drive_link&lt;/div&gt;</summary>
		<author><name>Sisira2</name></author>
	</entry>
	<entry>
		<id>http://vista.su.domains/psych221wiki/index.php?title=Smart_Cluster_Selection_for_CIELAB_Color_Segmentation&amp;diff=146037</id>
		<title>Smart Cluster Selection for CIELAB Color Segmentation</title>
		<link rel="alternate" type="text/html" href="http://vista.su.domains/psych221wiki/index.php?title=Smart_Cluster_Selection_for_CIELAB_Color_Segmentation&amp;diff=146037"/>
		<updated>2025-12-13T06:46:57Z</updated>

		<summary type="html">&lt;p&gt;Sisira2: /* Background */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction ==&lt;br /&gt;
Image segmentation is a fundamental step in many computer vision applications because it allows algorithms to separate meaningful regions, identify objects, and reduce the complexity of visual scenes. Color is one of the most informative cues for distinguishing visual elements, which is why color-based segmentation methods are commonly used. In particular, clustering techniques group pixels that have similar color characteristics, making them effective for isolating regions with shared appearance.&lt;br /&gt;
&lt;br /&gt;
Color-based segmentation is especially important in applications such as remote sensing, where large images often contain regions like vegetation, water, and urban areas that are best distinguished by color. Accurate segmentation in these settings supports tasks such as land cover analysis, environmental monitoring, and change detection, making efficient color segmentation a practical requirement.&lt;br /&gt;
&lt;br /&gt;
A major challenge in color-based segmentation is determining the appropriate number of color clusters for a given image. If too few clusters are chosen, under-segmentation occurs and important details may be merged. If too many clusters are used, over-segmentation can occur, where noise or small variations form meaningless regions. Common techniques such as the Elbow Method and the Gap Statistic estimate the number of clusters by repeatedly running clustering algorithms like K-Means with different values of k. While effective, these methods are computationally expensive for high-resolution images or large datasets and are often unsuitable for real-time use.&lt;br /&gt;
&lt;br /&gt;
This project proposes an alternative approach that estimates the ideal number of color clusters directly from the statistical properties of the image. By analyzing lightness variation, chromatic distributions, and color histograms in the CIELAB color space, the method aims to infer the number of meaningful color groups without testing many cluster values, resulting in a faster and more scalable solution.&lt;br /&gt;
&lt;br /&gt;
== Background ==&lt;br /&gt;
Color-based image segmentation is widely used in computer vision because color provides a strong and intuitive cue for separating different regions in an image. Many real-world images contain objects or areas that are more easily distinguished by color than by shape or texture, especially in scenes with complex structure or uneven lighting. By grouping pixels with similar color properties, segmentation methods can reduce image complexity and make later processing steps more efficient.&lt;br /&gt;
&lt;br /&gt;
To make color comparisons meaningful, pixel values are often represented in a perceptual color space rather than directly in RGB. The CIELAB color space is commonly used because it separates lightness from chromatic information, allowing brightness changes to be handled independently from color differences. This is important in practical settings where illumination varies across the image. In addition, CIELAB is approximately perceptually uniform, meaning that distances in the space align reasonably well with how humans perceive color differences. For this reason, simple distance measures in CIELAB are effective for clustering and segmentation tasks.&lt;br /&gt;
&lt;br /&gt;
Many existing segmentation methods rely on statistical information derived from color distributions. Techniques such as K-Means, Mean Shift, and Gaussian Mixture Models group pixels based on similarity, often using histogram information to capture how colors are distributed across an image. Color histograms, in particular, provide a compact summary of lightness and chromatic variation. Peaks in these histograms often correspond to dominant colors or distinct regions, making histogram structure a useful indicator of image complexity.&lt;br /&gt;
&lt;br /&gt;
A key challenge in clustering-based segmentation is selecting the number of clusters. Traditional approaches such as the Elbow Method and the Gap Statistic estimate this number by repeatedly running clustering algorithms with different settings and comparing the results. While these methods are well established, their reliance on multiple clustering runs makes them computationally expensive, especially for high-resolution images or large collections of data.&lt;br /&gt;
&lt;br /&gt;
The ideas behind perceptual color spaces, histogram analysis, and cluster estimation motivate the approach taken in this project. Instead of repeatedly applying clustering algorithms, this work explores whether the number of meaningful color regions can be inferred directly from image statistics in the CIELAB space. By analyzing lightness variation, chromatic spread, and histogram structure, the proposed method aims to estimate the appropriate number of color clusters efficiently, reducing computation while still supporting reliable image segmentation.&lt;br /&gt;
&lt;br /&gt;
== Methods ==&lt;br /&gt;
&lt;br /&gt;
=== Proposed Method ===&lt;br /&gt;
The proposed method consists of three main stages. First, the input image is converted from the three-channel RGB color space to the CIELAB (Lab*) color space. Separate histograms are then extracted for the &amp;lt;math&amp;gt;L&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;a&amp;lt;/math&amp;gt;, and &amp;lt;math&amp;gt;b&amp;lt;/math&amp;gt; channels. Second, two statistical parameters are computed from each histogram: the standard deviation and the number of local maxima. These values describe the distribution and structure of lightness and color information in the image. Finally, the optimal number of color clusters is estimated using the CIELAB Color Segment Estimation (CCSE) function, defined as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt; &amp;lt;math&amp;gt; k = \left\lfloor \ln\left(\frac{\sigma_L}{n_L}\right) \right\rfloor \cdot \max(n_a, n_b) + \min(n_a, n_b) &amp;lt;/math&amp;gt; &amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In this equation, &amp;lt;math&amp;gt;\sigma_L&amp;lt;/math&amp;gt; denotes the standard deviation of the &amp;lt;math&amp;gt;L&amp;lt;/math&amp;gt;-channel histogram, while &amp;lt;math&amp;gt;n_L&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;n_a&amp;lt;/math&amp;gt;, and &amp;lt;math&amp;gt;n_b&amp;lt;/math&amp;gt; represent the number of local maxima detected in the &amp;lt;math&amp;gt;L&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;a&amp;lt;/math&amp;gt;, and &amp;lt;math&amp;gt;b&amp;lt;/math&amp;gt; histograms, respectively. The term &amp;lt;math&amp;gt;\max(n_a, n_b)&amp;lt;/math&amp;gt; selects the channel with the strongest chromatic variation, while &amp;lt;math&amp;gt;\min(n_a, n_b)&amp;lt;/math&amp;gt; represents the weaker chromatic channel. A complete overview of the method is illustrated in the processing pipeline shown in Figure 3. It should be noted that this method requires input images to be in standard three-channel RGB format.&lt;br /&gt;
&lt;br /&gt;
=== Color Histogram ===&lt;br /&gt;
Color information in an image can be described using several types of descriptors, such as color histograms, color correlograms, color coherence vectors, and color moments. Among these options, the color histogram is one of the most commonly used representations because it is simple to compute and effective at capturing overall color content, especially when an image has a distinct color distribution compared to others in a dataset.&lt;br /&gt;
&lt;br /&gt;
In the proposed method, information is extracted from the &amp;lt;math&amp;gt;L&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;a&amp;lt;/math&amp;gt;, and &amp;lt;math&amp;gt;b&amp;lt;/math&amp;gt; histograms by analyzing their standard deviations and the number of local maxima. These measurements describe important properties of the image and provide the motivation for the design of the CCSE function:&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;Lightness distribution&#039;&#039;&#039;: The standard deviation of the &amp;lt;math&amp;gt;L&amp;lt;/math&amp;gt;-channel histogram indicates the range of lightness values in the image. A larger standard deviation corresponds to a wider spread of brightness levels, while a smaller value suggests more uniform lighting.&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;Color distribution&#039;&#039;&#039;: The standard deviations of the &amp;lt;math&amp;gt;a&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;b&amp;lt;/math&amp;gt; histograms reflect the diversity of chromatic content. Higher values indicate a broader range of colors, whereas lower values suggest limited color variation.&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;Peak separability&#039;&#039;&#039;: The number of local maxima in the &amp;lt;math&amp;gt;L&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;a&amp;lt;/math&amp;gt;, and &amp;lt;math&amp;gt;b&amp;lt;/math&amp;gt; histograms indicates how well different lightness and color levels are separated. More local maxima imply clearly distinguishable color or intensity regions, while fewer maxima suggest more clustered values.&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;Image complexity&#039;&#039;&#039;: Taken together, the standard deviations and local maxima across all three channels provide an estimate of overall image complexity. Images with larger histogram spreads and more peaks are considered more complex, while images with fewer peaks and narrower distributions are simpler.&lt;br /&gt;
&lt;br /&gt;
Overall, histogram analysis offers a compact yet informative description of an image’s lightness and color structure, which is valuable for segmentation and object recognition tasks.&lt;br /&gt;
&lt;br /&gt;
=== CCSE Function ===&lt;br /&gt;
The term &amp;lt;math&amp;gt;\left\lfloor \ln\left(\frac{\sigma_L}{n_L}\right) \right\rfloor&amp;lt;/math&amp;gt; computes the logarithm of the ratio between the standard deviation of the &amp;lt;math&amp;gt;L&amp;lt;/math&amp;gt;-channel histogram and the number of its local maxima. This ratio reflects the balance between the spread of lightness values and the separability of different lightness levels in the image. Applying the logarithm helps normalize the scale of the values and reduces sensitivity to extreme cases. The floor operation ensures that the resulting estimate of the number of clusters remains an integer. This formulation also prevents the estimated number of clusters from becoming too small when an image contains colors with very similar hues and limited lightness variation.&lt;br /&gt;
&lt;br /&gt;
Multiplying this term by &amp;lt;math&amp;gt;\max(n_a, n_b)&amp;lt;/math&amp;gt; emphasizes the chromatic channel with the greater number of distinct peaks, which typically corresponds to the dominant source of color variation in the image. Using only the weaker chromatic channel could lead to an underestimation of the required number of color segments.&lt;br /&gt;
&lt;br /&gt;
Finally, adding &amp;lt;math&amp;gt;\min(n_a, n_b)&amp;lt;/math&amp;gt; ensures that information from the less dominant chromatic channel is still taken into account. While the channel with stronger variation plays a more important role, incorporating the weaker channel leads to a more balanced and accurate estimation of the number of color clusters.&lt;br /&gt;
&lt;br /&gt;
== Results ==&lt;br /&gt;
&lt;br /&gt;
=== Visual Validation ===&lt;br /&gt;
&lt;br /&gt;
The first part of the evaluation focuses on visual validation, which allows us to directly compare the segmentation results produced by the CCSE algorithm with those from the Elbow Method and the Gap Statistic Method. To ensure a fair comparison, all methods are tested under the same conditions. Since the Elbow and Gap methods require evaluating a range of cluster values, we set a maximum number of clusters of 𝐾max = 20 for all images.&lt;br /&gt;
&lt;br /&gt;
After estimating the optimal number of clusters using each method, the images are segmented accordingly and visually inspected. The comparison focuses on how well each method captures dominant color regions, object boundaries, and overall segmentation smoothness. The results show that the segmentations produced by CCSE are visually very similar to those obtained using the Elbow and Gap methods. This indicates that CCSE successfully captures the main color structures of the images.&lt;br /&gt;
&lt;br /&gt;
Overall, this visual validation demonstrates that CCSE can achieve segmentation quality comparable to established methods, while avoiding the repeated clustering steps required by the Elbow and Gap approaches.&lt;br /&gt;
&lt;br /&gt;
[[File:visualvalidation.png|center|frameless|400px]]&lt;br /&gt;
&lt;br /&gt;
=== Quantitative Validation ===&lt;br /&gt;
&lt;br /&gt;
Quantitative validation is performed using &#039;&#039;&#039;Color Reconstruction Error-based Segmentation Evaluation (CRESE)&#039;&#039;&#039;. This metric evaluates how accurately a segmented image reconstructs the original image in terms of color. It computes the sum of color differences between each pixel’s original color and the average color of the cluster to which the pixel is assigned. A lower reconstruction error indicates better segmentation performance and a more accurate estimate of the number of color clusters.&lt;br /&gt;
&lt;br /&gt;
Let &amp;lt;math&amp;gt;O \in \mathbb{R}^{H \times W \times 3}&amp;lt;/math&amp;gt; denote the original image, and let &amp;lt;math&amp;gt;S \in \mathbb{R}^{H \times W \times 3}&amp;lt;/math&amp;gt; denote the segmented image, where each pixel is replaced by the average color of its assigned cluster. Let&lt;br /&gt;
&amp;lt;math&amp;gt;C = {c_1, c_2, \dots, c_n}&amp;lt;/math&amp;gt; be the set of unique cluster colors in &amp;lt;math&amp;gt;S&amp;lt;/math&amp;gt;, where &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; is the number of clusters. For each cluster color &amp;lt;math&amp;gt;c_i&amp;lt;/math&amp;gt;, a binary mask &amp;lt;math&amp;gt;M_i \in {0,1}^{H \times W}&amp;lt;/math&amp;gt; is defined to indicate pixel membership.&lt;br /&gt;
&lt;br /&gt;
The total color reconstruction error &amp;lt;math&amp;gt;E&amp;lt;/math&amp;gt; is computed as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt; &amp;lt;math&amp;gt; E = \sum_{i=1}^{n} \sum_{h=1}^{H} \sum_{w=1}^{W} M_i(h,w)\,\left\| O(h,w) - c_i \right\|_2 &amp;lt;/math&amp;gt; &amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where &amp;lt;math&amp;gt;|\cdot|_2&amp;lt;/math&amp;gt; denotes the Euclidean distance between color vectors. &lt;br /&gt;
To enable comparison across images of different sizes, the error is normalized and expressed as a percentage:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt; &amp;lt;math&amp;gt; E_{\text{normalized}} = \frac{E}{H \cdot W \cdot 255 \cdot \sqrt{3}} \times 100 &amp;lt;/math&amp;gt; &amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
During experimentation, contrast enhancement was observed to increase the estimated number of clusters. Since contrast enhancement has constant-time complexity, it does not affect the computational cost of the CRESE evaluation. Using this metric, validation curves of normalized reconstruction error versus the number of clusters &amp;lt;math&amp;gt;k&amp;lt;/math&amp;gt; are generated for both original and contrast-enhanced images.&lt;br /&gt;
&lt;br /&gt;
[[Image:quantitativevalidation.png|center|frameless|700px]]&lt;br /&gt;
&lt;br /&gt;
=== Efficiency Validation ===&lt;br /&gt;
&lt;br /&gt;
This section evaluates the computation time of the CCSE algorithm and compares it with the Elbow Method and the Gap Statistic Method in the context of image segmentation. While earlier sections focused on segmentation accuracy, the goal here is to understand how efficiently each method performs as image size increases.&lt;br /&gt;
&lt;br /&gt;
A high resolution beach image with a size of 3840 × 2160 pixels is used as the test image. The image is not contrast enhanced so that computation time is affected only by image size and not by additional preprocessing. To analyze scalability, resized versions of the image are created while preserving the original aspect ratio. The image is scaled to 10%, 25%, 33%, 50%, and 75% of its original dimensions, resulting in a range of images with different pixel counts.&lt;br /&gt;
&lt;br /&gt;
To ensure a fair comparison, the maximum number of clusters is fixed at &amp;lt;math&amp;gt;K_{\max} = 20&amp;lt;/math&amp;gt; for both the Elbow Method and the Gap Statistic Method. For each resized image, the time required by each algorithm to estimate the optimal number of clusters is measured. These measurements allow us to observe how computation time changes as image resolution increases.&lt;br /&gt;
&lt;br /&gt;
By comparing the computation times across all image sizes, we can evaluate the efficiency and scalability of each method. This analysis helps determine which approach is more suitable for real world applications where image sizes may vary significantly. The results also highlight the ability of the CCSE algorithm to handle larger images efficiently while still producing reliable cluster estimates.&lt;br /&gt;
&lt;br /&gt;
[[Image:compvalidation.png|center|frameless|400px]]&lt;br /&gt;
&lt;br /&gt;
=== Sensitivity Validation ===&lt;br /&gt;
&lt;br /&gt;
Sensitivity analysis is used to evaluate how stable each clustering method is when its input parameters change. A method that is less sensitive to parameter variation is considered more robust because it produces more consistent results under different settings.&lt;br /&gt;
&lt;br /&gt;
In this study, sensitivity is evaluated for all three methods. For the Elbow Method and the Gap Statistic Method, sensitivity is tested by changing the maximum number of clusters, &amp;lt;math&amp;gt;K_{\max}&amp;lt;/math&amp;gt;. For the CCSE algorithm, sensitivity is examined by varying the distance parameter &amp;lt;math&amp;gt;D&amp;lt;/math&amp;gt;, which controls how histogram peaks are grouped when estimating the number of clusters.&lt;br /&gt;
&lt;br /&gt;
To ensure a fair comparison, the same parameter range is used for all methods. The value of &amp;lt;math&amp;gt;D&amp;lt;/math&amp;gt; for CCSE is set equal to &amp;lt;math&amp;gt;K_{\max}&amp;lt;/math&amp;gt; for the Elbow and Gap methods. Both parameters are varied from 5 to 40, using an increment of 5. For each parameter value, the estimated number of clusters is recorded and compared.&lt;br /&gt;
&lt;br /&gt;
[[Image:sensitivityvalidaiton.png|center|frameless|400px]]&lt;br /&gt;
&lt;br /&gt;
The Gap Statistic Method shows a nearly linear increase in the estimated number of clusters as &amp;lt;math&amp;gt;K_{\max}&amp;lt;/math&amp;gt; increases. This behavior indicates a high sensitivity to the chosen maximum value, meaning the estimated result depends strongly on the input parameter.&lt;br /&gt;
&lt;br /&gt;
The Elbow Method shows a non linear trend and is slightly less sensitive than the Gap Statistic Method. However, the estimated number of clusters still changes noticeably as &amp;lt;math&amp;gt;K_{\max}&amp;lt;/math&amp;gt; increases, which suggests that the method remains dependent on the selected parameter range.&lt;br /&gt;
&lt;br /&gt;
In contrast, the CCSE algorithm produces more stable estimates as the distance parameter &amp;lt;math&amp;gt;D&amp;lt;/math&amp;gt; increases. While the estimated number of clusters decreases gradually, the change is smoother and more controlled compared to the other methods. This indicates lower sensitivity to parameter variation.&lt;br /&gt;
&lt;br /&gt;
Overall, the CCSE algorithm demonstrates the highest robustness among the three methods. Its reduced sensitivity to parameter changes allows it to produce more consistent cluster estimates across a wide range of settings, making it more reliable for practical image segmentation tasks.&lt;br /&gt;
&lt;br /&gt;
== Conclusion ==&lt;br /&gt;
&lt;br /&gt;
From the results presented above, it can be concluded that the proposed CCSE algorithm performs well across several important aspects of image segmentation, including segmentation quality, computation time, and robustness. Visual inspection shows that the segmented images produced using CCSE are similar to those generated by the Elbow Method and the Gap Statistic, indicating that CCSE is able to capture the main color structure of the images.&lt;br /&gt;
&lt;br /&gt;
Quantitative evaluation using the CRESE metric further supports these observations. For both original and contrast-enhanced images, the reconstruction errors produced by CCSE are comparable to those of the other methods. This shows that CCSE can estimate a reasonable number of color clusters even when image contrast changes.&lt;br /&gt;
&lt;br /&gt;
In terms of efficiency, CCSE clearly outperforms the Elbow and Gap Statistic methods. Its computation time increases very little as image size grows, making it suitable for high-resolution images and large datasets. In addition, CCSE shows stable behavior across different parameter settings, which indicates good robustness.&lt;br /&gt;
&lt;br /&gt;
Overall, the CCSE algorithm provides a practical and reliable approach for estimating the number of color clusters in image segmentation, offering a good balance between accuracy, speed, and stability.&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
== Appendix 1 ==&lt;br /&gt;
&lt;br /&gt;
link to code: https://drive.google.com/drive/folders/1kJ1jRgtYwjPT1HOiSKBag3t2gvJKGu8J?usp=drive_link&lt;/div&gt;</summary>
		<author><name>Sisira2</name></author>
	</entry>
	<entry>
		<id>http://vista.su.domains/psych221wiki/index.php?title=Smart_Cluster_Selection_for_CIELAB_Color_Segmentation&amp;diff=146035</id>
		<title>Smart Cluster Selection for CIELAB Color Segmentation</title>
		<link rel="alternate" type="text/html" href="http://vista.su.domains/psych221wiki/index.php?title=Smart_Cluster_Selection_for_CIELAB_Color_Segmentation&amp;diff=146035"/>
		<updated>2025-12-13T06:44:57Z</updated>

		<summary type="html">&lt;p&gt;Sisira2: /* Introduction */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction ==&lt;br /&gt;
Image segmentation is a fundamental step in many computer vision applications because it allows algorithms to separate meaningful regions, identify objects, and reduce the complexity of visual scenes. Color is one of the most informative cues for distinguishing visual elements, which is why color-based segmentation methods are commonly used. In particular, clustering techniques group pixels that have similar color characteristics, making them effective for isolating regions with shared appearance.&lt;br /&gt;
&lt;br /&gt;
Color-based segmentation is especially important in applications such as remote sensing, where large images often contain regions like vegetation, water, and urban areas that are best distinguished by color. Accurate segmentation in these settings supports tasks such as land cover analysis, environmental monitoring, and change detection, making efficient color segmentation a practical requirement.&lt;br /&gt;
&lt;br /&gt;
A major challenge in color-based segmentation is determining the appropriate number of color clusters for a given image. If too few clusters are chosen, under-segmentation occurs and important details may be merged. If too many clusters are used, over-segmentation can occur, where noise or small variations form meaningless regions. Common techniques such as the Elbow Method and the Gap Statistic estimate the number of clusters by repeatedly running clustering algorithms like K-Means with different values of k. While effective, these methods are computationally expensive for high-resolution images or large datasets and are often unsuitable for real-time use.&lt;br /&gt;
&lt;br /&gt;
This project proposes an alternative approach that estimates the ideal number of color clusters directly from the statistical properties of the image. By analyzing lightness variation, chromatic distributions, and color histograms in the CIELAB color space, the method aims to infer the number of meaningful color groups without testing many cluster values, resulting in a faster and more scalable solution.&lt;br /&gt;
&lt;br /&gt;
== Background ==&lt;br /&gt;
=== Color-Based Image Segmentation ===&lt;br /&gt;
&lt;br /&gt;
Color-based segmentation aims to partition an image into meaningful regions by grouping pixels with similar color properties. This approach relies on representing pixel values in a color space where numerical differences correspond to perceptual differences. One commonly used color space for this purpose is CIELAB (L*a*b*), which separates lightness from chromatic information. This separation allows brightness variations to be treated independently from color differences, which is especially useful in real-world images with varying illumination.&lt;br /&gt;
&lt;br /&gt;
CIELAB is designed to be approximately perceptually uniform, meaning that equal distances in the color space correspond to roughly equal perceived color differences. As a result, Euclidean distance in CIELAB provides a meaningful measure of color similarity. This property makes CIELAB well suited for clustering-based segmentation methods, color quantization, and visual analysis tasks.&lt;br /&gt;
&lt;br /&gt;
=== Statistical and Histogram-Based Methods ===&lt;br /&gt;
&lt;br /&gt;
Many image segmentation techniques rely on statistical summaries of color distributions to guide decision-making. These methods include edge-based approaches, region-growing techniques, and clustering algorithms such as K-Means, Mean Shift, and Gaussian Mixture Models. A common component across these approaches is the analysis of color histograms, which capture how frequently different color values occur in an image.&lt;br /&gt;
&lt;br /&gt;
Histogram analysis can reveal dominant color regions, transitions between areas, and the overall complexity of a scene. In particular, local maxima in color histograms are often interpreted as significant color groups or object components. By examining the number and prominence of these peaks, it is possible to gain insight into how many meaningful color regions may be present in an image without performing full segmentation.&lt;br /&gt;
&lt;br /&gt;
=== Estimating the Number of Clusters ===&lt;br /&gt;
&lt;br /&gt;
Determining the appropriate number of clusters is a long-standing problem in both image processing and unsupervised learning. Many traditional methods estimate the number of clusters by repeatedly running a clustering algorithm with different values and comparing the resulting performance. One influential contribution to this area is the prediction-based resampling approach proposed by Dudoit and Fridlyand, which evaluates cluster stability to estimate the number of meaningful groups in a dataset.&lt;br /&gt;
&lt;br /&gt;
Popular practical techniques such as the Elbow Method and the Gap Statistic follow similar ideas. The Elbow Method selects the number of clusters based on the point where improvements in clustering quality begin to diminish. The Gap Statistic compares clustering performance on real data against random data and selects the number of clusters that shows the largest improvement over chance. While effective, these methods require multiple clustering runs, which can be computationally expensive for large images or datasets.&lt;br /&gt;
&lt;br /&gt;
=== Motivation for Image-Derived Cluster Estimation ===&lt;br /&gt;
&lt;br /&gt;
The ideas underlying perceptual color spaces, histogram analysis, and cluster number estimation suggest that useful information about segmentation complexity is already embedded in the image itself. Rather than repeatedly running clustering algorithms, it may be possible to estimate the number of color clusters directly from image-derived statistics.&lt;br /&gt;
&lt;br /&gt;
This project builds on these foundations by analyzing perceptual lightness variation, chromatic spread, and histogram structure within the CIELAB color space. By combining these cues into a single formulation, the goal is to estimate the number of meaningful color clusters efficiently, reducing computational cost while maintaining reliable segmentation performance.&lt;br /&gt;
&lt;br /&gt;
== Methods ==&lt;br /&gt;
&lt;br /&gt;
=== Proposed Method ===&lt;br /&gt;
The proposed method consists of three main stages. First, the input image is converted from the three-channel RGB color space to the CIELAB (Lab*) color space. Separate histograms are then extracted for the &amp;lt;math&amp;gt;L&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;a&amp;lt;/math&amp;gt;, and &amp;lt;math&amp;gt;b&amp;lt;/math&amp;gt; channels. Second, two statistical parameters are computed from each histogram: the standard deviation and the number of local maxima. These values describe the distribution and structure of lightness and color information in the image. Finally, the optimal number of color clusters is estimated using the CIELAB Color Segment Estimation (CCSE) function, defined as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt; &amp;lt;math&amp;gt; k = \left\lfloor \ln\left(\frac{\sigma_L}{n_L}\right) \right\rfloor \cdot \max(n_a, n_b) + \min(n_a, n_b) &amp;lt;/math&amp;gt; &amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In this equation, &amp;lt;math&amp;gt;\sigma_L&amp;lt;/math&amp;gt; denotes the standard deviation of the &amp;lt;math&amp;gt;L&amp;lt;/math&amp;gt;-channel histogram, while &amp;lt;math&amp;gt;n_L&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;n_a&amp;lt;/math&amp;gt;, and &amp;lt;math&amp;gt;n_b&amp;lt;/math&amp;gt; represent the number of local maxima detected in the &amp;lt;math&amp;gt;L&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;a&amp;lt;/math&amp;gt;, and &amp;lt;math&amp;gt;b&amp;lt;/math&amp;gt; histograms, respectively. The term &amp;lt;math&amp;gt;\max(n_a, n_b)&amp;lt;/math&amp;gt; selects the channel with the strongest chromatic variation, while &amp;lt;math&amp;gt;\min(n_a, n_b)&amp;lt;/math&amp;gt; represents the weaker chromatic channel. A complete overview of the method is illustrated in the processing pipeline shown in Figure 3. It should be noted that this method requires input images to be in standard three-channel RGB format.&lt;br /&gt;
&lt;br /&gt;
=== Color Histogram ===&lt;br /&gt;
Color information in an image can be described using several types of descriptors, such as color histograms, color correlograms, color coherence vectors, and color moments. Among these options, the color histogram is one of the most commonly used representations because it is simple to compute and effective at capturing overall color content, especially when an image has a distinct color distribution compared to others in a dataset.&lt;br /&gt;
&lt;br /&gt;
In the proposed method, information is extracted from the &amp;lt;math&amp;gt;L&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;a&amp;lt;/math&amp;gt;, and &amp;lt;math&amp;gt;b&amp;lt;/math&amp;gt; histograms by analyzing their standard deviations and the number of local maxima. These measurements describe important properties of the image and provide the motivation for the design of the CCSE function:&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;Lightness distribution&#039;&#039;&#039;: The standard deviation of the &amp;lt;math&amp;gt;L&amp;lt;/math&amp;gt;-channel histogram indicates the range of lightness values in the image. A larger standard deviation corresponds to a wider spread of brightness levels, while a smaller value suggests more uniform lighting.&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;Color distribution&#039;&#039;&#039;: The standard deviations of the &amp;lt;math&amp;gt;a&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;b&amp;lt;/math&amp;gt; histograms reflect the diversity of chromatic content. Higher values indicate a broader range of colors, whereas lower values suggest limited color variation.&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;Peak separability&#039;&#039;&#039;: The number of local maxima in the &amp;lt;math&amp;gt;L&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;a&amp;lt;/math&amp;gt;, and &amp;lt;math&amp;gt;b&amp;lt;/math&amp;gt; histograms indicates how well different lightness and color levels are separated. More local maxima imply clearly distinguishable color or intensity regions, while fewer maxima suggest more clustered values.&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;Image complexity&#039;&#039;&#039;: Taken together, the standard deviations and local maxima across all three channels provide an estimate of overall image complexity. Images with larger histogram spreads and more peaks are considered more complex, while images with fewer peaks and narrower distributions are simpler.&lt;br /&gt;
&lt;br /&gt;
Overall, histogram analysis offers a compact yet informative description of an image’s lightness and color structure, which is valuable for segmentation and object recognition tasks.&lt;br /&gt;
&lt;br /&gt;
=== CCSE Function ===&lt;br /&gt;
The term &amp;lt;math&amp;gt;\left\lfloor \ln\left(\frac{\sigma_L}{n_L}\right) \right\rfloor&amp;lt;/math&amp;gt; computes the logarithm of the ratio between the standard deviation of the &amp;lt;math&amp;gt;L&amp;lt;/math&amp;gt;-channel histogram and the number of its local maxima. This ratio reflects the balance between the spread of lightness values and the separability of different lightness levels in the image. Applying the logarithm helps normalize the scale of the values and reduces sensitivity to extreme cases. The floor operation ensures that the resulting estimate of the number of clusters remains an integer. This formulation also prevents the estimated number of clusters from becoming too small when an image contains colors with very similar hues and limited lightness variation.&lt;br /&gt;
&lt;br /&gt;
Multiplying this term by &amp;lt;math&amp;gt;\max(n_a, n_b)&amp;lt;/math&amp;gt; emphasizes the chromatic channel with the greater number of distinct peaks, which typically corresponds to the dominant source of color variation in the image. Using only the weaker chromatic channel could lead to an underestimation of the required number of color segments.&lt;br /&gt;
&lt;br /&gt;
Finally, adding &amp;lt;math&amp;gt;\min(n_a, n_b)&amp;lt;/math&amp;gt; ensures that information from the less dominant chromatic channel is still taken into account. While the channel with stronger variation plays a more important role, incorporating the weaker channel leads to a more balanced and accurate estimation of the number of color clusters.&lt;br /&gt;
&lt;br /&gt;
== Results ==&lt;br /&gt;
&lt;br /&gt;
=== Visual Validation ===&lt;br /&gt;
&lt;br /&gt;
The first part of the evaluation focuses on visual validation, which allows us to directly compare the segmentation results produced by the CCSE algorithm with those from the Elbow Method and the Gap Statistic Method. To ensure a fair comparison, all methods are tested under the same conditions. Since the Elbow and Gap methods require evaluating a range of cluster values, we set a maximum number of clusters of 𝐾max = 20 for all images.&lt;br /&gt;
&lt;br /&gt;
After estimating the optimal number of clusters using each method, the images are segmented accordingly and visually inspected. The comparison focuses on how well each method captures dominant color regions, object boundaries, and overall segmentation smoothness. The results show that the segmentations produced by CCSE are visually very similar to those obtained using the Elbow and Gap methods. This indicates that CCSE successfully captures the main color structures of the images.&lt;br /&gt;
&lt;br /&gt;
Overall, this visual validation demonstrates that CCSE can achieve segmentation quality comparable to established methods, while avoiding the repeated clustering steps required by the Elbow and Gap approaches.&lt;br /&gt;
&lt;br /&gt;
[[File:visualvalidation.png|center|frameless|400px]]&lt;br /&gt;
&lt;br /&gt;
=== Quantitative Validation ===&lt;br /&gt;
&lt;br /&gt;
Quantitative validation is performed using &#039;&#039;&#039;Color Reconstruction Error-based Segmentation Evaluation (CRESE)&#039;&#039;&#039;. This metric evaluates how accurately a segmented image reconstructs the original image in terms of color. It computes the sum of color differences between each pixel’s original color and the average color of the cluster to which the pixel is assigned. A lower reconstruction error indicates better segmentation performance and a more accurate estimate of the number of color clusters.&lt;br /&gt;
&lt;br /&gt;
Let &amp;lt;math&amp;gt;O \in \mathbb{R}^{H \times W \times 3}&amp;lt;/math&amp;gt; denote the original image, and let &amp;lt;math&amp;gt;S \in \mathbb{R}^{H \times W \times 3}&amp;lt;/math&amp;gt; denote the segmented image, where each pixel is replaced by the average color of its assigned cluster. Let&lt;br /&gt;
&amp;lt;math&amp;gt;C = {c_1, c_2, \dots, c_n}&amp;lt;/math&amp;gt; be the set of unique cluster colors in &amp;lt;math&amp;gt;S&amp;lt;/math&amp;gt;, where &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; is the number of clusters. For each cluster color &amp;lt;math&amp;gt;c_i&amp;lt;/math&amp;gt;, a binary mask &amp;lt;math&amp;gt;M_i \in {0,1}^{H \times W}&amp;lt;/math&amp;gt; is defined to indicate pixel membership.&lt;br /&gt;
&lt;br /&gt;
The total color reconstruction error &amp;lt;math&amp;gt;E&amp;lt;/math&amp;gt; is computed as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt; &amp;lt;math&amp;gt; E = \sum_{i=1}^{n} \sum_{h=1}^{H} \sum_{w=1}^{W} M_i(h,w)\,\left\| O(h,w) - c_i \right\|_2 &amp;lt;/math&amp;gt; &amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where &amp;lt;math&amp;gt;|\cdot|_2&amp;lt;/math&amp;gt; denotes the Euclidean distance between color vectors. &lt;br /&gt;
To enable comparison across images of different sizes, the error is normalized and expressed as a percentage:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt; &amp;lt;math&amp;gt; E_{\text{normalized}} = \frac{E}{H \cdot W \cdot 255 \cdot \sqrt{3}} \times 100 &amp;lt;/math&amp;gt; &amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
During experimentation, contrast enhancement was observed to increase the estimated number of clusters. Since contrast enhancement has constant-time complexity, it does not affect the computational cost of the CRESE evaluation. Using this metric, validation curves of normalized reconstruction error versus the number of clusters &amp;lt;math&amp;gt;k&amp;lt;/math&amp;gt; are generated for both original and contrast-enhanced images.&lt;br /&gt;
&lt;br /&gt;
[[Image:quantitativevalidation.png|center|frameless|700px]]&lt;br /&gt;
&lt;br /&gt;
=== Efficiency Validation ===&lt;br /&gt;
&lt;br /&gt;
This section evaluates the computation time of the CCSE algorithm and compares it with the Elbow Method and the Gap Statistic Method in the context of image segmentation. While earlier sections focused on segmentation accuracy, the goal here is to understand how efficiently each method performs as image size increases.&lt;br /&gt;
&lt;br /&gt;
A high resolution beach image with a size of 3840 × 2160 pixels is used as the test image. The image is not contrast enhanced so that computation time is affected only by image size and not by additional preprocessing. To analyze scalability, resized versions of the image are created while preserving the original aspect ratio. The image is scaled to 10%, 25%, 33%, 50%, and 75% of its original dimensions, resulting in a range of images with different pixel counts.&lt;br /&gt;
&lt;br /&gt;
To ensure a fair comparison, the maximum number of clusters is fixed at &amp;lt;math&amp;gt;K_{\max} = 20&amp;lt;/math&amp;gt; for both the Elbow Method and the Gap Statistic Method. For each resized image, the time required by each algorithm to estimate the optimal number of clusters is measured. These measurements allow us to observe how computation time changes as image resolution increases.&lt;br /&gt;
&lt;br /&gt;
By comparing the computation times across all image sizes, we can evaluate the efficiency and scalability of each method. This analysis helps determine which approach is more suitable for real world applications where image sizes may vary significantly. The results also highlight the ability of the CCSE algorithm to handle larger images efficiently while still producing reliable cluster estimates.&lt;br /&gt;
&lt;br /&gt;
[[Image:compvalidation.png|center|frameless|400px]]&lt;br /&gt;
&lt;br /&gt;
=== Sensitivity Validation ===&lt;br /&gt;
&lt;br /&gt;
Sensitivity analysis is used to evaluate how stable each clustering method is when its input parameters change. A method that is less sensitive to parameter variation is considered more robust because it produces more consistent results under different settings.&lt;br /&gt;
&lt;br /&gt;
In this study, sensitivity is evaluated for all three methods. For the Elbow Method and the Gap Statistic Method, sensitivity is tested by changing the maximum number of clusters, &amp;lt;math&amp;gt;K_{\max}&amp;lt;/math&amp;gt;. For the CCSE algorithm, sensitivity is examined by varying the distance parameter &amp;lt;math&amp;gt;D&amp;lt;/math&amp;gt;, which controls how histogram peaks are grouped when estimating the number of clusters.&lt;br /&gt;
&lt;br /&gt;
To ensure a fair comparison, the same parameter range is used for all methods. The value of &amp;lt;math&amp;gt;D&amp;lt;/math&amp;gt; for CCSE is set equal to &amp;lt;math&amp;gt;K_{\max}&amp;lt;/math&amp;gt; for the Elbow and Gap methods. Both parameters are varied from 5 to 40, using an increment of 5. For each parameter value, the estimated number of clusters is recorded and compared.&lt;br /&gt;
&lt;br /&gt;
[[Image:sensitivityvalidaiton.png|center|frameless|400px]]&lt;br /&gt;
&lt;br /&gt;
The Gap Statistic Method shows a nearly linear increase in the estimated number of clusters as &amp;lt;math&amp;gt;K_{\max}&amp;lt;/math&amp;gt; increases. This behavior indicates a high sensitivity to the chosen maximum value, meaning the estimated result depends strongly on the input parameter.&lt;br /&gt;
&lt;br /&gt;
The Elbow Method shows a non linear trend and is slightly less sensitive than the Gap Statistic Method. However, the estimated number of clusters still changes noticeably as &amp;lt;math&amp;gt;K_{\max}&amp;lt;/math&amp;gt; increases, which suggests that the method remains dependent on the selected parameter range.&lt;br /&gt;
&lt;br /&gt;
In contrast, the CCSE algorithm produces more stable estimates as the distance parameter &amp;lt;math&amp;gt;D&amp;lt;/math&amp;gt; increases. While the estimated number of clusters decreases gradually, the change is smoother and more controlled compared to the other methods. This indicates lower sensitivity to parameter variation.&lt;br /&gt;
&lt;br /&gt;
Overall, the CCSE algorithm demonstrates the highest robustness among the three methods. Its reduced sensitivity to parameter changes allows it to produce more consistent cluster estimates across a wide range of settings, making it more reliable for practical image segmentation tasks.&lt;br /&gt;
&lt;br /&gt;
== Conclusion ==&lt;br /&gt;
&lt;br /&gt;
From the results presented above, it can be concluded that the proposed CCSE algorithm performs well across several important aspects of image segmentation, including segmentation quality, computation time, and robustness. Visual inspection shows that the segmented images produced using CCSE are similar to those generated by the Elbow Method and the Gap Statistic, indicating that CCSE is able to capture the main color structure of the images.&lt;br /&gt;
&lt;br /&gt;
Quantitative evaluation using the CRESE metric further supports these observations. For both original and contrast-enhanced images, the reconstruction errors produced by CCSE are comparable to those of the other methods. This shows that CCSE can estimate a reasonable number of color clusters even when image contrast changes.&lt;br /&gt;
&lt;br /&gt;
In terms of efficiency, CCSE clearly outperforms the Elbow and Gap Statistic methods. Its computation time increases very little as image size grows, making it suitable for high-resolution images and large datasets. In addition, CCSE shows stable behavior across different parameter settings, which indicates good robustness.&lt;br /&gt;
&lt;br /&gt;
Overall, the CCSE algorithm provides a practical and reliable approach for estimating the number of color clusters in image segmentation, offering a good balance between accuracy, speed, and stability.&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
== Appendix 1 ==&lt;br /&gt;
&lt;br /&gt;
link to code: https://drive.google.com/drive/folders/1kJ1jRgtYwjPT1HOiSKBag3t2gvJKGu8J?usp=drive_link&lt;/div&gt;</summary>
		<author><name>Sisira2</name></author>
	</entry>
	<entry>
		<id>http://vista.su.domains/psych221wiki/index.php?title=Smart_Cluster_Selection_for_CIELAB_Color_Segmentation&amp;diff=146031</id>
		<title>Smart Cluster Selection for CIELAB Color Segmentation</title>
		<link rel="alternate" type="text/html" href="http://vista.su.domains/psych221wiki/index.php?title=Smart_Cluster_Selection_for_CIELAB_Color_Segmentation&amp;diff=146031"/>
		<updated>2025-12-13T06:39:16Z</updated>

		<summary type="html">&lt;p&gt;Sisira2: /* Sensitivity Validation */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction ==&lt;br /&gt;
Image segmentation is a fundamental step in many computer vision applications because it allows algorithms to separate meaningful regions, identify objects, and reduce the complexity of visual scenes. Color is one of the most informative cues for distinguishing visual elements, which is why color-based segmentation methods are commonly used. In particular, clustering techniques group pixels that have similar color characteristics, making them effective for isolating regions with shared appearance. &lt;br /&gt;
&lt;br /&gt;
A major challenge in color-based segmentation is determining the appropriate number of color clusters for a given image. If too few clusters are chosen, under-segmentation occurs and important details may be merged into a single region. If too many clusters are used, over-segmentation can happen, causing noise or small variations in color to form separate, meaningless regions. In many practical settings, the number of clusters is selected manually or determined using methods that require extensive computation. Common techniques such as the Elbow Method and the Gap Statistic address this problem by repeatedly running clustering algorithms like K-Means while testing different numbers of clusters. Although effective, this repeated evaluation becomes computationally expensive for high-resolution images or large datasets. As a result, these methods are often unsuitable for real-time systems or applications that must process many images efficiently. &lt;br /&gt;
&lt;br /&gt;
This project proposes an alternative approach that estimates the ideal number of color clusters directly from the statistical properties of the image. Instead of testing many cluster counts, the method analyzes perceptual lightness variation, the distribution of chromatic information, and the shapes of color histograms in the CIELAB color space. By examining these characteristics, the approach aims to infer how many meaningful color groups are present in the image. The overall goal is to develop a faster and more scalable solution that maintains reliable segmentation performance while significantly reducing computational cost.&lt;br /&gt;
&lt;br /&gt;
== Background ==&lt;br /&gt;
=== Color-Based Image Segmentation ===&lt;br /&gt;
&lt;br /&gt;
Color-based segmentation aims to partition an image into meaningful regions by grouping pixels with similar color properties. This approach relies on representing pixel values in a color space where numerical differences correspond to perceptual differences. One commonly used color space for this purpose is CIELAB (L*a*b*), which separates lightness from chromatic information. This separation allows brightness variations to be treated independently from color differences, which is especially useful in real-world images with varying illumination.&lt;br /&gt;
&lt;br /&gt;
CIELAB is designed to be approximately perceptually uniform, meaning that equal distances in the color space correspond to roughly equal perceived color differences. As a result, Euclidean distance in CIELAB provides a meaningful measure of color similarity. This property makes CIELAB well suited for clustering-based segmentation methods, color quantization, and visual analysis tasks.&lt;br /&gt;
&lt;br /&gt;
=== Statistical and Histogram-Based Methods ===&lt;br /&gt;
&lt;br /&gt;
Many image segmentation techniques rely on statistical summaries of color distributions to guide decision-making. These methods include edge-based approaches, region-growing techniques, and clustering algorithms such as K-Means, Mean Shift, and Gaussian Mixture Models. A common component across these approaches is the analysis of color histograms, which capture how frequently different color values occur in an image.&lt;br /&gt;
&lt;br /&gt;
Histogram analysis can reveal dominant color regions, transitions between areas, and the overall complexity of a scene. In particular, local maxima in color histograms are often interpreted as significant color groups or object components. By examining the number and prominence of these peaks, it is possible to gain insight into how many meaningful color regions may be present in an image without performing full segmentation.&lt;br /&gt;
&lt;br /&gt;
=== Estimating the Number of Clusters ===&lt;br /&gt;
&lt;br /&gt;
Determining the appropriate number of clusters is a long-standing problem in both image processing and unsupervised learning. Many traditional methods estimate the number of clusters by repeatedly running a clustering algorithm with different values and comparing the resulting performance. One influential contribution to this area is the prediction-based resampling approach proposed by Dudoit and Fridlyand, which evaluates cluster stability to estimate the number of meaningful groups in a dataset.&lt;br /&gt;
&lt;br /&gt;
Popular practical techniques such as the Elbow Method and the Gap Statistic follow similar ideas. The Elbow Method selects the number of clusters based on the point where improvements in clustering quality begin to diminish. The Gap Statistic compares clustering performance on real data against random data and selects the number of clusters that shows the largest improvement over chance. While effective, these methods require multiple clustering runs, which can be computationally expensive for large images or datasets.&lt;br /&gt;
&lt;br /&gt;
=== Motivation for Image-Derived Cluster Estimation ===&lt;br /&gt;
&lt;br /&gt;
The ideas underlying perceptual color spaces, histogram analysis, and cluster number estimation suggest that useful information about segmentation complexity is already embedded in the image itself. Rather than repeatedly running clustering algorithms, it may be possible to estimate the number of color clusters directly from image-derived statistics.&lt;br /&gt;
&lt;br /&gt;
This project builds on these foundations by analyzing perceptual lightness variation, chromatic spread, and histogram structure within the CIELAB color space. By combining these cues into a single formulation, the goal is to estimate the number of meaningful color clusters efficiently, reducing computational cost while maintaining reliable segmentation performance.&lt;br /&gt;
&lt;br /&gt;
== Methods ==&lt;br /&gt;
&lt;br /&gt;
=== Proposed Method ===&lt;br /&gt;
The proposed method consists of three main stages. First, the input image is converted from the three-channel RGB color space to the CIELAB (Lab*) color space. Separate histograms are then extracted for the &amp;lt;math&amp;gt;L&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;a&amp;lt;/math&amp;gt;, and &amp;lt;math&amp;gt;b&amp;lt;/math&amp;gt; channels. Second, two statistical parameters are computed from each histogram: the standard deviation and the number of local maxima. These values describe the distribution and structure of lightness and color information in the image. Finally, the optimal number of color clusters is estimated using the CIELAB Color Segment Estimation (CCSE) function, defined as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt; &amp;lt;math&amp;gt; k = \left\lfloor \ln\left(\frac{\sigma_L}{n_L}\right) \right\rfloor \cdot \max(n_a, n_b) + \min(n_a, n_b) &amp;lt;/math&amp;gt; &amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In this equation, &amp;lt;math&amp;gt;\sigma_L&amp;lt;/math&amp;gt; denotes the standard deviation of the &amp;lt;math&amp;gt;L&amp;lt;/math&amp;gt;-channel histogram, while &amp;lt;math&amp;gt;n_L&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;n_a&amp;lt;/math&amp;gt;, and &amp;lt;math&amp;gt;n_b&amp;lt;/math&amp;gt; represent the number of local maxima detected in the &amp;lt;math&amp;gt;L&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;a&amp;lt;/math&amp;gt;, and &amp;lt;math&amp;gt;b&amp;lt;/math&amp;gt; histograms, respectively. The term &amp;lt;math&amp;gt;\max(n_a, n_b)&amp;lt;/math&amp;gt; selects the channel with the strongest chromatic variation, while &amp;lt;math&amp;gt;\min(n_a, n_b)&amp;lt;/math&amp;gt; represents the weaker chromatic channel. A complete overview of the method is illustrated in the processing pipeline shown in Figure 3. It should be noted that this method requires input images to be in standard three-channel RGB format.&lt;br /&gt;
&lt;br /&gt;
=== Color Histogram ===&lt;br /&gt;
Color information in an image can be described using several types of descriptors, such as color histograms, color correlograms, color coherence vectors, and color moments. Among these options, the color histogram is one of the most commonly used representations because it is simple to compute and effective at capturing overall color content, especially when an image has a distinct color distribution compared to others in a dataset.&lt;br /&gt;
&lt;br /&gt;
In the proposed method, information is extracted from the &amp;lt;math&amp;gt;L&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;a&amp;lt;/math&amp;gt;, and &amp;lt;math&amp;gt;b&amp;lt;/math&amp;gt; histograms by analyzing their standard deviations and the number of local maxima. These measurements describe important properties of the image and provide the motivation for the design of the CCSE function:&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;Lightness distribution&#039;&#039;&#039;: The standard deviation of the &amp;lt;math&amp;gt;L&amp;lt;/math&amp;gt;-channel histogram indicates the range of lightness values in the image. A larger standard deviation corresponds to a wider spread of brightness levels, while a smaller value suggests more uniform lighting.&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;Color distribution&#039;&#039;&#039;: The standard deviations of the &amp;lt;math&amp;gt;a&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;b&amp;lt;/math&amp;gt; histograms reflect the diversity of chromatic content. Higher values indicate a broader range of colors, whereas lower values suggest limited color variation.&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;Peak separability&#039;&#039;&#039;: The number of local maxima in the &amp;lt;math&amp;gt;L&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;a&amp;lt;/math&amp;gt;, and &amp;lt;math&amp;gt;b&amp;lt;/math&amp;gt; histograms indicates how well different lightness and color levels are separated. More local maxima imply clearly distinguishable color or intensity regions, while fewer maxima suggest more clustered values.&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;Image complexity&#039;&#039;&#039;: Taken together, the standard deviations and local maxima across all three channels provide an estimate of overall image complexity. Images with larger histogram spreads and more peaks are considered more complex, while images with fewer peaks and narrower distributions are simpler.&lt;br /&gt;
&lt;br /&gt;
Overall, histogram analysis offers a compact yet informative description of an image’s lightness and color structure, which is valuable for segmentation and object recognition tasks.&lt;br /&gt;
&lt;br /&gt;
=== CCSE Function ===&lt;br /&gt;
The term &amp;lt;math&amp;gt;\left\lfloor \ln\left(\frac{\sigma_L}{n_L}\right) \right\rfloor&amp;lt;/math&amp;gt; computes the logarithm of the ratio between the standard deviation of the &amp;lt;math&amp;gt;L&amp;lt;/math&amp;gt;-channel histogram and the number of its local maxima. This ratio reflects the balance between the spread of lightness values and the separability of different lightness levels in the image. Applying the logarithm helps normalize the scale of the values and reduces sensitivity to extreme cases. The floor operation ensures that the resulting estimate of the number of clusters remains an integer. This formulation also prevents the estimated number of clusters from becoming too small when an image contains colors with very similar hues and limited lightness variation.&lt;br /&gt;
&lt;br /&gt;
Multiplying this term by &amp;lt;math&amp;gt;\max(n_a, n_b)&amp;lt;/math&amp;gt; emphasizes the chromatic channel with the greater number of distinct peaks, which typically corresponds to the dominant source of color variation in the image. Using only the weaker chromatic channel could lead to an underestimation of the required number of color segments.&lt;br /&gt;
&lt;br /&gt;
Finally, adding &amp;lt;math&amp;gt;\min(n_a, n_b)&amp;lt;/math&amp;gt; ensures that information from the less dominant chromatic channel is still taken into account. While the channel with stronger variation plays a more important role, incorporating the weaker channel leads to a more balanced and accurate estimation of the number of color clusters.&lt;br /&gt;
&lt;br /&gt;
== Results ==&lt;br /&gt;
&lt;br /&gt;
=== Visual Validation ===&lt;br /&gt;
&lt;br /&gt;
The first part of the evaluation focuses on visual validation, which allows us to directly compare the segmentation results produced by the CCSE algorithm with those from the Elbow Method and the Gap Statistic Method. To ensure a fair comparison, all methods are tested under the same conditions. Since the Elbow and Gap methods require evaluating a range of cluster values, we set a maximum number of clusters of 𝐾max = 20 for all images.&lt;br /&gt;
&lt;br /&gt;
After estimating the optimal number of clusters using each method, the images are segmented accordingly and visually inspected. The comparison focuses on how well each method captures dominant color regions, object boundaries, and overall segmentation smoothness. The results show that the segmentations produced by CCSE are visually very similar to those obtained using the Elbow and Gap methods. This indicates that CCSE successfully captures the main color structures of the images.&lt;br /&gt;
&lt;br /&gt;
Overall, this visual validation demonstrates that CCSE can achieve segmentation quality comparable to established methods, while avoiding the repeated clustering steps required by the Elbow and Gap approaches.&lt;br /&gt;
&lt;br /&gt;
[[File:visualvalidation.png|center|frameless|400px]]&lt;br /&gt;
&lt;br /&gt;
=== Quantitative Validation ===&lt;br /&gt;
&lt;br /&gt;
Quantitative validation is performed using &#039;&#039;&#039;Color Reconstruction Error-based Segmentation Evaluation (CRESE)&#039;&#039;&#039;. This metric evaluates how accurately a segmented image reconstructs the original image in terms of color. It computes the sum of color differences between each pixel’s original color and the average color of the cluster to which the pixel is assigned. A lower reconstruction error indicates better segmentation performance and a more accurate estimate of the number of color clusters.&lt;br /&gt;
&lt;br /&gt;
Let &amp;lt;math&amp;gt;O \in \mathbb{R}^{H \times W \times 3}&amp;lt;/math&amp;gt; denote the original image, and let &amp;lt;math&amp;gt;S \in \mathbb{R}^{H \times W \times 3}&amp;lt;/math&amp;gt; denote the segmented image, where each pixel is replaced by the average color of its assigned cluster. Let&lt;br /&gt;
&amp;lt;math&amp;gt;C = {c_1, c_2, \dots, c_n}&amp;lt;/math&amp;gt; be the set of unique cluster colors in &amp;lt;math&amp;gt;S&amp;lt;/math&amp;gt;, where &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; is the number of clusters. For each cluster color &amp;lt;math&amp;gt;c_i&amp;lt;/math&amp;gt;, a binary mask &amp;lt;math&amp;gt;M_i \in {0,1}^{H \times W}&amp;lt;/math&amp;gt; is defined to indicate pixel membership.&lt;br /&gt;
&lt;br /&gt;
The total color reconstruction error &amp;lt;math&amp;gt;E&amp;lt;/math&amp;gt; is computed as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt; &amp;lt;math&amp;gt; E = \sum_{i=1}^{n} \sum_{h=1}^{H} \sum_{w=1}^{W} M_i(h,w)\,\left\| O(h,w) - c_i \right\|_2 &amp;lt;/math&amp;gt; &amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where &amp;lt;math&amp;gt;|\cdot|_2&amp;lt;/math&amp;gt; denotes the Euclidean distance between color vectors. &lt;br /&gt;
To enable comparison across images of different sizes, the error is normalized and expressed as a percentage:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt; &amp;lt;math&amp;gt; E_{\text{normalized}} = \frac{E}{H \cdot W \cdot 255 \cdot \sqrt{3}} \times 100 &amp;lt;/math&amp;gt; &amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
During experimentation, contrast enhancement was observed to increase the estimated number of clusters. Since contrast enhancement has constant-time complexity, it does not affect the computational cost of the CRESE evaluation. Using this metric, validation curves of normalized reconstruction error versus the number of clusters &amp;lt;math&amp;gt;k&amp;lt;/math&amp;gt; are generated for both original and contrast-enhanced images.&lt;br /&gt;
&lt;br /&gt;
[[Image:quantitativevalidation.png|center|frameless|700px]]&lt;br /&gt;
&lt;br /&gt;
=== Efficiency Validation ===&lt;br /&gt;
&lt;br /&gt;
This section evaluates the computation time of the CCSE algorithm and compares it with the Elbow Method and the Gap Statistic Method in the context of image segmentation. While earlier sections focused on segmentation accuracy, the goal here is to understand how efficiently each method performs as image size increases.&lt;br /&gt;
&lt;br /&gt;
A high resolution beach image with a size of 3840 × 2160 pixels is used as the test image. The image is not contrast enhanced so that computation time is affected only by image size and not by additional preprocessing. To analyze scalability, resized versions of the image are created while preserving the original aspect ratio. The image is scaled to 10%, 25%, 33%, 50%, and 75% of its original dimensions, resulting in a range of images with different pixel counts.&lt;br /&gt;
&lt;br /&gt;
To ensure a fair comparison, the maximum number of clusters is fixed at &amp;lt;math&amp;gt;K_{\max} = 20&amp;lt;/math&amp;gt; for both the Elbow Method and the Gap Statistic Method. For each resized image, the time required by each algorithm to estimate the optimal number of clusters is measured. These measurements allow us to observe how computation time changes as image resolution increases.&lt;br /&gt;
&lt;br /&gt;
By comparing the computation times across all image sizes, we can evaluate the efficiency and scalability of each method. This analysis helps determine which approach is more suitable for real world applications where image sizes may vary significantly. The results also highlight the ability of the CCSE algorithm to handle larger images efficiently while still producing reliable cluster estimates.&lt;br /&gt;
&lt;br /&gt;
[[Image:compvalidation.png|center|frameless|400px]]&lt;br /&gt;
&lt;br /&gt;
=== Sensitivity Validation ===&lt;br /&gt;
&lt;br /&gt;
Sensitivity analysis is used to evaluate how stable each clustering method is when its input parameters change. A method that is less sensitive to parameter variation is considered more robust because it produces more consistent results under different settings.&lt;br /&gt;
&lt;br /&gt;
In this study, sensitivity is evaluated for all three methods. For the Elbow Method and the Gap Statistic Method, sensitivity is tested by changing the maximum number of clusters, &amp;lt;math&amp;gt;K_{\max}&amp;lt;/math&amp;gt;. For the CCSE algorithm, sensitivity is examined by varying the distance parameter &amp;lt;math&amp;gt;D&amp;lt;/math&amp;gt;, which controls how histogram peaks are grouped when estimating the number of clusters.&lt;br /&gt;
&lt;br /&gt;
To ensure a fair comparison, the same parameter range is used for all methods. The value of &amp;lt;math&amp;gt;D&amp;lt;/math&amp;gt; for CCSE is set equal to &amp;lt;math&amp;gt;K_{\max}&amp;lt;/math&amp;gt; for the Elbow and Gap methods. Both parameters are varied from 5 to 40, using an increment of 5. For each parameter value, the estimated number of clusters is recorded and compared.&lt;br /&gt;
&lt;br /&gt;
[[Image:sensitivityvalidaiton.png|center|frameless|400px]]&lt;br /&gt;
&lt;br /&gt;
The Gap Statistic Method shows a nearly linear increase in the estimated number of clusters as &amp;lt;math&amp;gt;K_{\max}&amp;lt;/math&amp;gt; increases. This behavior indicates a high sensitivity to the chosen maximum value, meaning the estimated result depends strongly on the input parameter.&lt;br /&gt;
&lt;br /&gt;
The Elbow Method shows a non linear trend and is slightly less sensitive than the Gap Statistic Method. However, the estimated number of clusters still changes noticeably as &amp;lt;math&amp;gt;K_{\max}&amp;lt;/math&amp;gt; increases, which suggests that the method remains dependent on the selected parameter range.&lt;br /&gt;
&lt;br /&gt;
In contrast, the CCSE algorithm produces more stable estimates as the distance parameter &amp;lt;math&amp;gt;D&amp;lt;/math&amp;gt; increases. While the estimated number of clusters decreases gradually, the change is smoother and more controlled compared to the other methods. This indicates lower sensitivity to parameter variation.&lt;br /&gt;
&lt;br /&gt;
Overall, the CCSE algorithm demonstrates the highest robustness among the three methods. Its reduced sensitivity to parameter changes allows it to produce more consistent cluster estimates across a wide range of settings, making it more reliable for practical image segmentation tasks.&lt;br /&gt;
&lt;br /&gt;
== Conclusion ==&lt;br /&gt;
&lt;br /&gt;
From the results presented above, it can be concluded that the proposed CCSE algorithm performs well across several important aspects of image segmentation, including segmentation quality, computation time, and robustness. Visual inspection shows that the segmented images produced using CCSE are similar to those generated by the Elbow Method and the Gap Statistic, indicating that CCSE is able to capture the main color structure of the images.&lt;br /&gt;
&lt;br /&gt;
Quantitative evaluation using the CRESE metric further supports these observations. For both original and contrast-enhanced images, the reconstruction errors produced by CCSE are comparable to those of the other methods. This shows that CCSE can estimate a reasonable number of color clusters even when image contrast changes.&lt;br /&gt;
&lt;br /&gt;
In terms of efficiency, CCSE clearly outperforms the Elbow and Gap Statistic methods. Its computation time increases very little as image size grows, making it suitable for high-resolution images and large datasets. In addition, CCSE shows stable behavior across different parameter settings, which indicates good robustness.&lt;br /&gt;
&lt;br /&gt;
Overall, the CCSE algorithm provides a practical and reliable approach for estimating the number of color clusters in image segmentation, offering a good balance between accuracy, speed, and stability.&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
== Appendix 1 ==&lt;br /&gt;
&lt;br /&gt;
link to code: https://drive.google.com/drive/folders/1kJ1jRgtYwjPT1HOiSKBag3t2gvJKGu8J?usp=drive_link&lt;/div&gt;</summary>
		<author><name>Sisira2</name></author>
	</entry>
	<entry>
		<id>http://vista.su.domains/psych221wiki/index.php?title=Smart_Cluster_Selection_for_CIELAB_Color_Segmentation&amp;diff=146030</id>
		<title>Smart Cluster Selection for CIELAB Color Segmentation</title>
		<link rel="alternate" type="text/html" href="http://vista.su.domains/psych221wiki/index.php?title=Smart_Cluster_Selection_for_CIELAB_Color_Segmentation&amp;diff=146030"/>
		<updated>2025-12-13T06:38:17Z</updated>

		<summary type="html">&lt;p&gt;Sisira2: /* Efficiency Validation */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction ==&lt;br /&gt;
Image segmentation is a fundamental step in many computer vision applications because it allows algorithms to separate meaningful regions, identify objects, and reduce the complexity of visual scenes. Color is one of the most informative cues for distinguishing visual elements, which is why color-based segmentation methods are commonly used. In particular, clustering techniques group pixels that have similar color characteristics, making them effective for isolating regions with shared appearance. &lt;br /&gt;
&lt;br /&gt;
A major challenge in color-based segmentation is determining the appropriate number of color clusters for a given image. If too few clusters are chosen, under-segmentation occurs and important details may be merged into a single region. If too many clusters are used, over-segmentation can happen, causing noise or small variations in color to form separate, meaningless regions. In many practical settings, the number of clusters is selected manually or determined using methods that require extensive computation. Common techniques such as the Elbow Method and the Gap Statistic address this problem by repeatedly running clustering algorithms like K-Means while testing different numbers of clusters. Although effective, this repeated evaluation becomes computationally expensive for high-resolution images or large datasets. As a result, these methods are often unsuitable for real-time systems or applications that must process many images efficiently. &lt;br /&gt;
&lt;br /&gt;
This project proposes an alternative approach that estimates the ideal number of color clusters directly from the statistical properties of the image. Instead of testing many cluster counts, the method analyzes perceptual lightness variation, the distribution of chromatic information, and the shapes of color histograms in the CIELAB color space. By examining these characteristics, the approach aims to infer how many meaningful color groups are present in the image. The overall goal is to develop a faster and more scalable solution that maintains reliable segmentation performance while significantly reducing computational cost.&lt;br /&gt;
&lt;br /&gt;
== Background ==&lt;br /&gt;
=== Color-Based Image Segmentation ===&lt;br /&gt;
&lt;br /&gt;
Color-based segmentation aims to partition an image into meaningful regions by grouping pixels with similar color properties. This approach relies on representing pixel values in a color space where numerical differences correspond to perceptual differences. One commonly used color space for this purpose is CIELAB (L*a*b*), which separates lightness from chromatic information. This separation allows brightness variations to be treated independently from color differences, which is especially useful in real-world images with varying illumination.&lt;br /&gt;
&lt;br /&gt;
CIELAB is designed to be approximately perceptually uniform, meaning that equal distances in the color space correspond to roughly equal perceived color differences. As a result, Euclidean distance in CIELAB provides a meaningful measure of color similarity. This property makes CIELAB well suited for clustering-based segmentation methods, color quantization, and visual analysis tasks.&lt;br /&gt;
&lt;br /&gt;
=== Statistical and Histogram-Based Methods ===&lt;br /&gt;
&lt;br /&gt;
Many image segmentation techniques rely on statistical summaries of color distributions to guide decision-making. These methods include edge-based approaches, region-growing techniques, and clustering algorithms such as K-Means, Mean Shift, and Gaussian Mixture Models. A common component across these approaches is the analysis of color histograms, which capture how frequently different color values occur in an image.&lt;br /&gt;
&lt;br /&gt;
Histogram analysis can reveal dominant color regions, transitions between areas, and the overall complexity of a scene. In particular, local maxima in color histograms are often interpreted as significant color groups or object components. By examining the number and prominence of these peaks, it is possible to gain insight into how many meaningful color regions may be present in an image without performing full segmentation.&lt;br /&gt;
&lt;br /&gt;
=== Estimating the Number of Clusters ===&lt;br /&gt;
&lt;br /&gt;
Determining the appropriate number of clusters is a long-standing problem in both image processing and unsupervised learning. Many traditional methods estimate the number of clusters by repeatedly running a clustering algorithm with different values and comparing the resulting performance. One influential contribution to this area is the prediction-based resampling approach proposed by Dudoit and Fridlyand, which evaluates cluster stability to estimate the number of meaningful groups in a dataset.&lt;br /&gt;
&lt;br /&gt;
Popular practical techniques such as the Elbow Method and the Gap Statistic follow similar ideas. The Elbow Method selects the number of clusters based on the point where improvements in clustering quality begin to diminish. The Gap Statistic compares clustering performance on real data against random data and selects the number of clusters that shows the largest improvement over chance. While effective, these methods require multiple clustering runs, which can be computationally expensive for large images or datasets.&lt;br /&gt;
&lt;br /&gt;
=== Motivation for Image-Derived Cluster Estimation ===&lt;br /&gt;
&lt;br /&gt;
The ideas underlying perceptual color spaces, histogram analysis, and cluster number estimation suggest that useful information about segmentation complexity is already embedded in the image itself. Rather than repeatedly running clustering algorithms, it may be possible to estimate the number of color clusters directly from image-derived statistics.&lt;br /&gt;
&lt;br /&gt;
This project builds on these foundations by analyzing perceptual lightness variation, chromatic spread, and histogram structure within the CIELAB color space. By combining these cues into a single formulation, the goal is to estimate the number of meaningful color clusters efficiently, reducing computational cost while maintaining reliable segmentation performance.&lt;br /&gt;
&lt;br /&gt;
== Methods ==&lt;br /&gt;
&lt;br /&gt;
=== Proposed Method ===&lt;br /&gt;
The proposed method consists of three main stages. First, the input image is converted from the three-channel RGB color space to the CIELAB (Lab*) color space. Separate histograms are then extracted for the &amp;lt;math&amp;gt;L&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;a&amp;lt;/math&amp;gt;, and &amp;lt;math&amp;gt;b&amp;lt;/math&amp;gt; channels. Second, two statistical parameters are computed from each histogram: the standard deviation and the number of local maxima. These values describe the distribution and structure of lightness and color information in the image. Finally, the optimal number of color clusters is estimated using the CIELAB Color Segment Estimation (CCSE) function, defined as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt; &amp;lt;math&amp;gt; k = \left\lfloor \ln\left(\frac{\sigma_L}{n_L}\right) \right\rfloor \cdot \max(n_a, n_b) + \min(n_a, n_b) &amp;lt;/math&amp;gt; &amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In this equation, &amp;lt;math&amp;gt;\sigma_L&amp;lt;/math&amp;gt; denotes the standard deviation of the &amp;lt;math&amp;gt;L&amp;lt;/math&amp;gt;-channel histogram, while &amp;lt;math&amp;gt;n_L&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;n_a&amp;lt;/math&amp;gt;, and &amp;lt;math&amp;gt;n_b&amp;lt;/math&amp;gt; represent the number of local maxima detected in the &amp;lt;math&amp;gt;L&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;a&amp;lt;/math&amp;gt;, and &amp;lt;math&amp;gt;b&amp;lt;/math&amp;gt; histograms, respectively. The term &amp;lt;math&amp;gt;\max(n_a, n_b)&amp;lt;/math&amp;gt; selects the channel with the strongest chromatic variation, while &amp;lt;math&amp;gt;\min(n_a, n_b)&amp;lt;/math&amp;gt; represents the weaker chromatic channel. A complete overview of the method is illustrated in the processing pipeline shown in Figure 3. It should be noted that this method requires input images to be in standard three-channel RGB format.&lt;br /&gt;
&lt;br /&gt;
=== Color Histogram ===&lt;br /&gt;
Color information in an image can be described using several types of descriptors, such as color histograms, color correlograms, color coherence vectors, and color moments. Among these options, the color histogram is one of the most commonly used representations because it is simple to compute and effective at capturing overall color content, especially when an image has a distinct color distribution compared to others in a dataset.&lt;br /&gt;
&lt;br /&gt;
In the proposed method, information is extracted from the &amp;lt;math&amp;gt;L&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;a&amp;lt;/math&amp;gt;, and &amp;lt;math&amp;gt;b&amp;lt;/math&amp;gt; histograms by analyzing their standard deviations and the number of local maxima. These measurements describe important properties of the image and provide the motivation for the design of the CCSE function:&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;Lightness distribution&#039;&#039;&#039;: The standard deviation of the &amp;lt;math&amp;gt;L&amp;lt;/math&amp;gt;-channel histogram indicates the range of lightness values in the image. A larger standard deviation corresponds to a wider spread of brightness levels, while a smaller value suggests more uniform lighting.&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;Color distribution&#039;&#039;&#039;: The standard deviations of the &amp;lt;math&amp;gt;a&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;b&amp;lt;/math&amp;gt; histograms reflect the diversity of chromatic content. Higher values indicate a broader range of colors, whereas lower values suggest limited color variation.&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;Peak separability&#039;&#039;&#039;: The number of local maxima in the &amp;lt;math&amp;gt;L&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;a&amp;lt;/math&amp;gt;, and &amp;lt;math&amp;gt;b&amp;lt;/math&amp;gt; histograms indicates how well different lightness and color levels are separated. More local maxima imply clearly distinguishable color or intensity regions, while fewer maxima suggest more clustered values.&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;Image complexity&#039;&#039;&#039;: Taken together, the standard deviations and local maxima across all three channels provide an estimate of overall image complexity. Images with larger histogram spreads and more peaks are considered more complex, while images with fewer peaks and narrower distributions are simpler.&lt;br /&gt;
&lt;br /&gt;
Overall, histogram analysis offers a compact yet informative description of an image’s lightness and color structure, which is valuable for segmentation and object recognition tasks.&lt;br /&gt;
&lt;br /&gt;
=== CCSE Function ===&lt;br /&gt;
The term &amp;lt;math&amp;gt;\left\lfloor \ln\left(\frac{\sigma_L}{n_L}\right) \right\rfloor&amp;lt;/math&amp;gt; computes the logarithm of the ratio between the standard deviation of the &amp;lt;math&amp;gt;L&amp;lt;/math&amp;gt;-channel histogram and the number of its local maxima. This ratio reflects the balance between the spread of lightness values and the separability of different lightness levels in the image. Applying the logarithm helps normalize the scale of the values and reduces sensitivity to extreme cases. The floor operation ensures that the resulting estimate of the number of clusters remains an integer. This formulation also prevents the estimated number of clusters from becoming too small when an image contains colors with very similar hues and limited lightness variation.&lt;br /&gt;
&lt;br /&gt;
Multiplying this term by &amp;lt;math&amp;gt;\max(n_a, n_b)&amp;lt;/math&amp;gt; emphasizes the chromatic channel with the greater number of distinct peaks, which typically corresponds to the dominant source of color variation in the image. Using only the weaker chromatic channel could lead to an underestimation of the required number of color segments.&lt;br /&gt;
&lt;br /&gt;
Finally, adding &amp;lt;math&amp;gt;\min(n_a, n_b)&amp;lt;/math&amp;gt; ensures that information from the less dominant chromatic channel is still taken into account. While the channel with stronger variation plays a more important role, incorporating the weaker channel leads to a more balanced and accurate estimation of the number of color clusters.&lt;br /&gt;
&lt;br /&gt;
== Results ==&lt;br /&gt;
&lt;br /&gt;
=== Visual Validation ===&lt;br /&gt;
&lt;br /&gt;
The first part of the evaluation focuses on visual validation, which allows us to directly compare the segmentation results produced by the CCSE algorithm with those from the Elbow Method and the Gap Statistic Method. To ensure a fair comparison, all methods are tested under the same conditions. Since the Elbow and Gap methods require evaluating a range of cluster values, we set a maximum number of clusters of 𝐾max = 20 for all images.&lt;br /&gt;
&lt;br /&gt;
After estimating the optimal number of clusters using each method, the images are segmented accordingly and visually inspected. The comparison focuses on how well each method captures dominant color regions, object boundaries, and overall segmentation smoothness. The results show that the segmentations produced by CCSE are visually very similar to those obtained using the Elbow and Gap methods. This indicates that CCSE successfully captures the main color structures of the images.&lt;br /&gt;
&lt;br /&gt;
Overall, this visual validation demonstrates that CCSE can achieve segmentation quality comparable to established methods, while avoiding the repeated clustering steps required by the Elbow and Gap approaches.&lt;br /&gt;
&lt;br /&gt;
[[File:visualvalidation.png|center|frameless|400px]]&lt;br /&gt;
&lt;br /&gt;
=== Quantitative Validation ===&lt;br /&gt;
&lt;br /&gt;
Quantitative validation is performed using &#039;&#039;&#039;Color Reconstruction Error-based Segmentation Evaluation (CRESE)&#039;&#039;&#039;. This metric evaluates how accurately a segmented image reconstructs the original image in terms of color. It computes the sum of color differences between each pixel’s original color and the average color of the cluster to which the pixel is assigned. A lower reconstruction error indicates better segmentation performance and a more accurate estimate of the number of color clusters.&lt;br /&gt;
&lt;br /&gt;
Let &amp;lt;math&amp;gt;O \in \mathbb{R}^{H \times W \times 3}&amp;lt;/math&amp;gt; denote the original image, and let &amp;lt;math&amp;gt;S \in \mathbb{R}^{H \times W \times 3}&amp;lt;/math&amp;gt; denote the segmented image, where each pixel is replaced by the average color of its assigned cluster. Let&lt;br /&gt;
&amp;lt;math&amp;gt;C = {c_1, c_2, \dots, c_n}&amp;lt;/math&amp;gt; be the set of unique cluster colors in &amp;lt;math&amp;gt;S&amp;lt;/math&amp;gt;, where &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; is the number of clusters. For each cluster color &amp;lt;math&amp;gt;c_i&amp;lt;/math&amp;gt;, a binary mask &amp;lt;math&amp;gt;M_i \in {0,1}^{H \times W}&amp;lt;/math&amp;gt; is defined to indicate pixel membership.&lt;br /&gt;
&lt;br /&gt;
The total color reconstruction error &amp;lt;math&amp;gt;E&amp;lt;/math&amp;gt; is computed as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt; &amp;lt;math&amp;gt; E = \sum_{i=1}^{n} \sum_{h=1}^{H} \sum_{w=1}^{W} M_i(h,w)\,\left\| O(h,w) - c_i \right\|_2 &amp;lt;/math&amp;gt; &amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where &amp;lt;math&amp;gt;|\cdot|_2&amp;lt;/math&amp;gt; denotes the Euclidean distance between color vectors. &lt;br /&gt;
To enable comparison across images of different sizes, the error is normalized and expressed as a percentage:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt; &amp;lt;math&amp;gt; E_{\text{normalized}} = \frac{E}{H \cdot W \cdot 255 \cdot \sqrt{3}} \times 100 &amp;lt;/math&amp;gt; &amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
During experimentation, contrast enhancement was observed to increase the estimated number of clusters. Since contrast enhancement has constant-time complexity, it does not affect the computational cost of the CRESE evaluation. Using this metric, validation curves of normalized reconstruction error versus the number of clusters &amp;lt;math&amp;gt;k&amp;lt;/math&amp;gt; are generated for both original and contrast-enhanced images.&lt;br /&gt;
&lt;br /&gt;
[[Image:quantitativevalidation.png|center|frameless|700px]]&lt;br /&gt;
&lt;br /&gt;
=== Efficiency Validation ===&lt;br /&gt;
&lt;br /&gt;
This section evaluates the computation time of the CCSE algorithm and compares it with the Elbow Method and the Gap Statistic Method in the context of image segmentation. While earlier sections focused on segmentation accuracy, the goal here is to understand how efficiently each method performs as image size increases.&lt;br /&gt;
&lt;br /&gt;
A high resolution beach image with a size of 3840 × 2160 pixels is used as the test image. The image is not contrast enhanced so that computation time is affected only by image size and not by additional preprocessing. To analyze scalability, resized versions of the image are created while preserving the original aspect ratio. The image is scaled to 10%, 25%, 33%, 50%, and 75% of its original dimensions, resulting in a range of images with different pixel counts.&lt;br /&gt;
&lt;br /&gt;
To ensure a fair comparison, the maximum number of clusters is fixed at &amp;lt;math&amp;gt;K_{\max} = 20&amp;lt;/math&amp;gt; for both the Elbow Method and the Gap Statistic Method. For each resized image, the time required by each algorithm to estimate the optimal number of clusters is measured. These measurements allow us to observe how computation time changes as image resolution increases.&lt;br /&gt;
&lt;br /&gt;
By comparing the computation times across all image sizes, we can evaluate the efficiency and scalability of each method. This analysis helps determine which approach is more suitable for real world applications where image sizes may vary significantly. The results also highlight the ability of the CCSE algorithm to handle larger images efficiently while still producing reliable cluster estimates.&lt;br /&gt;
&lt;br /&gt;
[[Image:compvalidation.png|center|frameless|400px]]&lt;br /&gt;
&lt;br /&gt;
=== Sensitivity Validation ===&lt;br /&gt;
&lt;br /&gt;
Sensitivity analysis is used to evaluate how stable each clustering method is when its input parameters change. A method that is less sensitive to parameter variation is considered more robust because it produces more consistent results under different settings.&lt;br /&gt;
&lt;br /&gt;
In this study, sensitivity is evaluated for all three methods. For the Elbow Method and the Gap Statistic Method, sensitivity is tested by changing the maximum number of clusters, &amp;lt;math&amp;gt;K_{\max}&amp;lt;/math&amp;gt;. For the CCSE algorithm, sensitivity is examined by varying the distance parameter &amp;lt;math&amp;gt;D&amp;lt;/math&amp;gt;, which controls how histogram peaks are grouped when estimating the number of clusters.&lt;br /&gt;
&lt;br /&gt;
To ensure a fair comparison, the same parameter range is used for all methods. The value of &amp;lt;math&amp;gt;D&amp;lt;/math&amp;gt; for CCSE is set equal to &amp;lt;math&amp;gt;K_{\max}&amp;lt;/math&amp;gt; for the Elbow and Gap methods. Both parameters are varied from 5 to 40, using an increment of 5. For each parameter value, the estimated number of clusters is recorded and compared.&lt;br /&gt;
&lt;br /&gt;
[[Image:placeholder.png]]&lt;br /&gt;
&lt;br /&gt;
The Gap Statistic Method shows a nearly linear increase in the estimated number of clusters as &amp;lt;math&amp;gt;K_{\max}&amp;lt;/math&amp;gt; increases. This behavior indicates a high sensitivity to the chosen maximum value, meaning the estimated result depends strongly on the input parameter.&lt;br /&gt;
&lt;br /&gt;
The Elbow Method shows a non linear trend and is slightly less sensitive than the Gap Statistic Method. However, the estimated number of clusters still changes noticeably as &amp;lt;math&amp;gt;K_{\max}&amp;lt;/math&amp;gt; increases, which suggests that the method remains dependent on the selected parameter range.&lt;br /&gt;
&lt;br /&gt;
In contrast, the CCSE algorithm produces more stable estimates as the distance parameter &amp;lt;math&amp;gt;D&amp;lt;/math&amp;gt; increases. While the estimated number of clusters decreases gradually, the change is smoother and more controlled compared to the other methods. This indicates lower sensitivity to parameter variation.&lt;br /&gt;
&lt;br /&gt;
Overall, the CCSE algorithm demonstrates the highest robustness among the three methods. Its reduced sensitivity to parameter changes allows it to produce more consistent cluster estimates across a wide range of settings, making it more reliable for practical image segmentation tasks.&lt;br /&gt;
&lt;br /&gt;
== Conclusion ==&lt;br /&gt;
&lt;br /&gt;
From the results presented above, it can be concluded that the proposed CCSE algorithm performs well across several important aspects of image segmentation, including segmentation quality, computation time, and robustness. Visual inspection shows that the segmented images produced using CCSE are similar to those generated by the Elbow Method and the Gap Statistic, indicating that CCSE is able to capture the main color structure of the images.&lt;br /&gt;
&lt;br /&gt;
Quantitative evaluation using the CRESE metric further supports these observations. For both original and contrast-enhanced images, the reconstruction errors produced by CCSE are comparable to those of the other methods. This shows that CCSE can estimate a reasonable number of color clusters even when image contrast changes.&lt;br /&gt;
&lt;br /&gt;
In terms of efficiency, CCSE clearly outperforms the Elbow and Gap Statistic methods. Its computation time increases very little as image size grows, making it suitable for high-resolution images and large datasets. In addition, CCSE shows stable behavior across different parameter settings, which indicates good robustness.&lt;br /&gt;
&lt;br /&gt;
Overall, the CCSE algorithm provides a practical and reliable approach for estimating the number of color clusters in image segmentation, offering a good balance between accuracy, speed, and stability.&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
== Appendix 1 ==&lt;br /&gt;
&lt;br /&gt;
link to code: https://drive.google.com/drive/folders/1kJ1jRgtYwjPT1HOiSKBag3t2gvJKGu8J?usp=drive_link&lt;/div&gt;</summary>
		<author><name>Sisira2</name></author>
	</entry>
	<entry>
		<id>http://vista.su.domains/psych221wiki/index.php?title=Smart_Cluster_Selection_for_CIELAB_Color_Segmentation&amp;diff=146029</id>
		<title>Smart Cluster Selection for CIELAB Color Segmentation</title>
		<link rel="alternate" type="text/html" href="http://vista.su.domains/psych221wiki/index.php?title=Smart_Cluster_Selection_for_CIELAB_Color_Segmentation&amp;diff=146029"/>
		<updated>2025-12-13T06:37:26Z</updated>

		<summary type="html">&lt;p&gt;Sisira2: /* Visual Validation */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction ==&lt;br /&gt;
Image segmentation is a fundamental step in many computer vision applications because it allows algorithms to separate meaningful regions, identify objects, and reduce the complexity of visual scenes. Color is one of the most informative cues for distinguishing visual elements, which is why color-based segmentation methods are commonly used. In particular, clustering techniques group pixels that have similar color characteristics, making them effective for isolating regions with shared appearance. &lt;br /&gt;
&lt;br /&gt;
A major challenge in color-based segmentation is determining the appropriate number of color clusters for a given image. If too few clusters are chosen, under-segmentation occurs and important details may be merged into a single region. If too many clusters are used, over-segmentation can happen, causing noise or small variations in color to form separate, meaningless regions. In many practical settings, the number of clusters is selected manually or determined using methods that require extensive computation. Common techniques such as the Elbow Method and the Gap Statistic address this problem by repeatedly running clustering algorithms like K-Means while testing different numbers of clusters. Although effective, this repeated evaluation becomes computationally expensive for high-resolution images or large datasets. As a result, these methods are often unsuitable for real-time systems or applications that must process many images efficiently. &lt;br /&gt;
&lt;br /&gt;
This project proposes an alternative approach that estimates the ideal number of color clusters directly from the statistical properties of the image. Instead of testing many cluster counts, the method analyzes perceptual lightness variation, the distribution of chromatic information, and the shapes of color histograms in the CIELAB color space. By examining these characteristics, the approach aims to infer how many meaningful color groups are present in the image. The overall goal is to develop a faster and more scalable solution that maintains reliable segmentation performance while significantly reducing computational cost.&lt;br /&gt;
&lt;br /&gt;
== Background ==&lt;br /&gt;
=== Color-Based Image Segmentation ===&lt;br /&gt;
&lt;br /&gt;
Color-based segmentation aims to partition an image into meaningful regions by grouping pixels with similar color properties. This approach relies on representing pixel values in a color space where numerical differences correspond to perceptual differences. One commonly used color space for this purpose is CIELAB (L*a*b*), which separates lightness from chromatic information. This separation allows brightness variations to be treated independently from color differences, which is especially useful in real-world images with varying illumination.&lt;br /&gt;
&lt;br /&gt;
CIELAB is designed to be approximately perceptually uniform, meaning that equal distances in the color space correspond to roughly equal perceived color differences. As a result, Euclidean distance in CIELAB provides a meaningful measure of color similarity. This property makes CIELAB well suited for clustering-based segmentation methods, color quantization, and visual analysis tasks.&lt;br /&gt;
&lt;br /&gt;
=== Statistical and Histogram-Based Methods ===&lt;br /&gt;
&lt;br /&gt;
Many image segmentation techniques rely on statistical summaries of color distributions to guide decision-making. These methods include edge-based approaches, region-growing techniques, and clustering algorithms such as K-Means, Mean Shift, and Gaussian Mixture Models. A common component across these approaches is the analysis of color histograms, which capture how frequently different color values occur in an image.&lt;br /&gt;
&lt;br /&gt;
Histogram analysis can reveal dominant color regions, transitions between areas, and the overall complexity of a scene. In particular, local maxima in color histograms are often interpreted as significant color groups or object components. By examining the number and prominence of these peaks, it is possible to gain insight into how many meaningful color regions may be present in an image without performing full segmentation.&lt;br /&gt;
&lt;br /&gt;
=== Estimating the Number of Clusters ===&lt;br /&gt;
&lt;br /&gt;
Determining the appropriate number of clusters is a long-standing problem in both image processing and unsupervised learning. Many traditional methods estimate the number of clusters by repeatedly running a clustering algorithm with different values and comparing the resulting performance. One influential contribution to this area is the prediction-based resampling approach proposed by Dudoit and Fridlyand, which evaluates cluster stability to estimate the number of meaningful groups in a dataset.&lt;br /&gt;
&lt;br /&gt;
Popular practical techniques such as the Elbow Method and the Gap Statistic follow similar ideas. The Elbow Method selects the number of clusters based on the point where improvements in clustering quality begin to diminish. The Gap Statistic compares clustering performance on real data against random data and selects the number of clusters that shows the largest improvement over chance. While effective, these methods require multiple clustering runs, which can be computationally expensive for large images or datasets.&lt;br /&gt;
&lt;br /&gt;
=== Motivation for Image-Derived Cluster Estimation ===&lt;br /&gt;
&lt;br /&gt;
The ideas underlying perceptual color spaces, histogram analysis, and cluster number estimation suggest that useful information about segmentation complexity is already embedded in the image itself. Rather than repeatedly running clustering algorithms, it may be possible to estimate the number of color clusters directly from image-derived statistics.&lt;br /&gt;
&lt;br /&gt;
This project builds on these foundations by analyzing perceptual lightness variation, chromatic spread, and histogram structure within the CIELAB color space. By combining these cues into a single formulation, the goal is to estimate the number of meaningful color clusters efficiently, reducing computational cost while maintaining reliable segmentation performance.&lt;br /&gt;
&lt;br /&gt;
== Methods ==&lt;br /&gt;
&lt;br /&gt;
=== Proposed Method ===&lt;br /&gt;
The proposed method consists of three main stages. First, the input image is converted from the three-channel RGB color space to the CIELAB (Lab*) color space. Separate histograms are then extracted for the &amp;lt;math&amp;gt;L&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;a&amp;lt;/math&amp;gt;, and &amp;lt;math&amp;gt;b&amp;lt;/math&amp;gt; channels. Second, two statistical parameters are computed from each histogram: the standard deviation and the number of local maxima. These values describe the distribution and structure of lightness and color information in the image. Finally, the optimal number of color clusters is estimated using the CIELAB Color Segment Estimation (CCSE) function, defined as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt; &amp;lt;math&amp;gt; k = \left\lfloor \ln\left(\frac{\sigma_L}{n_L}\right) \right\rfloor \cdot \max(n_a, n_b) + \min(n_a, n_b) &amp;lt;/math&amp;gt; &amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In this equation, &amp;lt;math&amp;gt;\sigma_L&amp;lt;/math&amp;gt; denotes the standard deviation of the &amp;lt;math&amp;gt;L&amp;lt;/math&amp;gt;-channel histogram, while &amp;lt;math&amp;gt;n_L&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;n_a&amp;lt;/math&amp;gt;, and &amp;lt;math&amp;gt;n_b&amp;lt;/math&amp;gt; represent the number of local maxima detected in the &amp;lt;math&amp;gt;L&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;a&amp;lt;/math&amp;gt;, and &amp;lt;math&amp;gt;b&amp;lt;/math&amp;gt; histograms, respectively. The term &amp;lt;math&amp;gt;\max(n_a, n_b)&amp;lt;/math&amp;gt; selects the channel with the strongest chromatic variation, while &amp;lt;math&amp;gt;\min(n_a, n_b)&amp;lt;/math&amp;gt; represents the weaker chromatic channel. A complete overview of the method is illustrated in the processing pipeline shown in Figure 3. It should be noted that this method requires input images to be in standard three-channel RGB format.&lt;br /&gt;
&lt;br /&gt;
=== Color Histogram ===&lt;br /&gt;
Color information in an image can be described using several types of descriptors, such as color histograms, color correlograms, color coherence vectors, and color moments. Among these options, the color histogram is one of the most commonly used representations because it is simple to compute and effective at capturing overall color content, especially when an image has a distinct color distribution compared to others in a dataset.&lt;br /&gt;
&lt;br /&gt;
In the proposed method, information is extracted from the &amp;lt;math&amp;gt;L&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;a&amp;lt;/math&amp;gt;, and &amp;lt;math&amp;gt;b&amp;lt;/math&amp;gt; histograms by analyzing their standard deviations and the number of local maxima. These measurements describe important properties of the image and provide the motivation for the design of the CCSE function:&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;Lightness distribution&#039;&#039;&#039;: The standard deviation of the &amp;lt;math&amp;gt;L&amp;lt;/math&amp;gt;-channel histogram indicates the range of lightness values in the image. A larger standard deviation corresponds to a wider spread of brightness levels, while a smaller value suggests more uniform lighting.&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;Color distribution&#039;&#039;&#039;: The standard deviations of the &amp;lt;math&amp;gt;a&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;b&amp;lt;/math&amp;gt; histograms reflect the diversity of chromatic content. Higher values indicate a broader range of colors, whereas lower values suggest limited color variation.&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;Peak separability&#039;&#039;&#039;: The number of local maxima in the &amp;lt;math&amp;gt;L&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;a&amp;lt;/math&amp;gt;, and &amp;lt;math&amp;gt;b&amp;lt;/math&amp;gt; histograms indicates how well different lightness and color levels are separated. More local maxima imply clearly distinguishable color or intensity regions, while fewer maxima suggest more clustered values.&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;Image complexity&#039;&#039;&#039;: Taken together, the standard deviations and local maxima across all three channels provide an estimate of overall image complexity. Images with larger histogram spreads and more peaks are considered more complex, while images with fewer peaks and narrower distributions are simpler.&lt;br /&gt;
&lt;br /&gt;
Overall, histogram analysis offers a compact yet informative description of an image’s lightness and color structure, which is valuable for segmentation and object recognition tasks.&lt;br /&gt;
&lt;br /&gt;
=== CCSE Function ===&lt;br /&gt;
The term &amp;lt;math&amp;gt;\left\lfloor \ln\left(\frac{\sigma_L}{n_L}\right) \right\rfloor&amp;lt;/math&amp;gt; computes the logarithm of the ratio between the standard deviation of the &amp;lt;math&amp;gt;L&amp;lt;/math&amp;gt;-channel histogram and the number of its local maxima. This ratio reflects the balance between the spread of lightness values and the separability of different lightness levels in the image. Applying the logarithm helps normalize the scale of the values and reduces sensitivity to extreme cases. The floor operation ensures that the resulting estimate of the number of clusters remains an integer. This formulation also prevents the estimated number of clusters from becoming too small when an image contains colors with very similar hues and limited lightness variation.&lt;br /&gt;
&lt;br /&gt;
Multiplying this term by &amp;lt;math&amp;gt;\max(n_a, n_b)&amp;lt;/math&amp;gt; emphasizes the chromatic channel with the greater number of distinct peaks, which typically corresponds to the dominant source of color variation in the image. Using only the weaker chromatic channel could lead to an underestimation of the required number of color segments.&lt;br /&gt;
&lt;br /&gt;
Finally, adding &amp;lt;math&amp;gt;\min(n_a, n_b)&amp;lt;/math&amp;gt; ensures that information from the less dominant chromatic channel is still taken into account. While the channel with stronger variation plays a more important role, incorporating the weaker channel leads to a more balanced and accurate estimation of the number of color clusters.&lt;br /&gt;
&lt;br /&gt;
== Results ==&lt;br /&gt;
&lt;br /&gt;
=== Visual Validation ===&lt;br /&gt;
&lt;br /&gt;
The first part of the evaluation focuses on visual validation, which allows us to directly compare the segmentation results produced by the CCSE algorithm with those from the Elbow Method and the Gap Statistic Method. To ensure a fair comparison, all methods are tested under the same conditions. Since the Elbow and Gap methods require evaluating a range of cluster values, we set a maximum number of clusters of 𝐾max = 20 for all images.&lt;br /&gt;
&lt;br /&gt;
After estimating the optimal number of clusters using each method, the images are segmented accordingly and visually inspected. The comparison focuses on how well each method captures dominant color regions, object boundaries, and overall segmentation smoothness. The results show that the segmentations produced by CCSE are visually very similar to those obtained using the Elbow and Gap methods. This indicates that CCSE successfully captures the main color structures of the images.&lt;br /&gt;
&lt;br /&gt;
Overall, this visual validation demonstrates that CCSE can achieve segmentation quality comparable to established methods, while avoiding the repeated clustering steps required by the Elbow and Gap approaches.&lt;br /&gt;
&lt;br /&gt;
[[File:visualvalidation.png|center|frameless|400px]]&lt;br /&gt;
&lt;br /&gt;
=== Quantitative Validation ===&lt;br /&gt;
&lt;br /&gt;
Quantitative validation is performed using &#039;&#039;&#039;Color Reconstruction Error-based Segmentation Evaluation (CRESE)&#039;&#039;&#039;. This metric evaluates how accurately a segmented image reconstructs the original image in terms of color. It computes the sum of color differences between each pixel’s original color and the average color of the cluster to which the pixel is assigned. A lower reconstruction error indicates better segmentation performance and a more accurate estimate of the number of color clusters.&lt;br /&gt;
&lt;br /&gt;
Let &amp;lt;math&amp;gt;O \in \mathbb{R}^{H \times W \times 3}&amp;lt;/math&amp;gt; denote the original image, and let &amp;lt;math&amp;gt;S \in \mathbb{R}^{H \times W \times 3}&amp;lt;/math&amp;gt; denote the segmented image, where each pixel is replaced by the average color of its assigned cluster. Let&lt;br /&gt;
&amp;lt;math&amp;gt;C = {c_1, c_2, \dots, c_n}&amp;lt;/math&amp;gt; be the set of unique cluster colors in &amp;lt;math&amp;gt;S&amp;lt;/math&amp;gt;, where &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; is the number of clusters. For each cluster color &amp;lt;math&amp;gt;c_i&amp;lt;/math&amp;gt;, a binary mask &amp;lt;math&amp;gt;M_i \in {0,1}^{H \times W}&amp;lt;/math&amp;gt; is defined to indicate pixel membership.&lt;br /&gt;
&lt;br /&gt;
The total color reconstruction error &amp;lt;math&amp;gt;E&amp;lt;/math&amp;gt; is computed as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt; &amp;lt;math&amp;gt; E = \sum_{i=1}^{n} \sum_{h=1}^{H} \sum_{w=1}^{W} M_i(h,w)\,\left\| O(h,w) - c_i \right\|_2 &amp;lt;/math&amp;gt; &amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where &amp;lt;math&amp;gt;|\cdot|_2&amp;lt;/math&amp;gt; denotes the Euclidean distance between color vectors. &lt;br /&gt;
To enable comparison across images of different sizes, the error is normalized and expressed as a percentage:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt; &amp;lt;math&amp;gt; E_{\text{normalized}} = \frac{E}{H \cdot W \cdot 255 \cdot \sqrt{3}} \times 100 &amp;lt;/math&amp;gt; &amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
During experimentation, contrast enhancement was observed to increase the estimated number of clusters. Since contrast enhancement has constant-time complexity, it does not affect the computational cost of the CRESE evaluation. Using this metric, validation curves of normalized reconstruction error versus the number of clusters &amp;lt;math&amp;gt;k&amp;lt;/math&amp;gt; are generated for both original and contrast-enhanced images.&lt;br /&gt;
&lt;br /&gt;
[[Image:quantitativevalidation.png|center|frameless|700px]]&lt;br /&gt;
&lt;br /&gt;
=== Efficiency Validation ===&lt;br /&gt;
&lt;br /&gt;
This section evaluates the computation time of the CCSE algorithm and compares it with the Elbow Method and the Gap Statistic Method in the context of image segmentation. While earlier sections focused on segmentation accuracy, the goal here is to understand how efficiently each method performs as image size increases.&lt;br /&gt;
&lt;br /&gt;
A high resolution beach image with a size of 3840 × 2160 pixels is used as the test image. The image is not contrast enhanced so that computation time is affected only by image size and not by additional preprocessing. To analyze scalability, resized versions of the image are created while preserving the original aspect ratio. The image is scaled to 10%, 25%, 33%, 50%, and 75% of its original dimensions, resulting in a range of images with different pixel counts.&lt;br /&gt;
&lt;br /&gt;
To ensure a fair comparison, the maximum number of clusters is fixed at &amp;lt;math&amp;gt;K_{\max} = 20&amp;lt;/math&amp;gt; for both the Elbow Method and the Gap Statistic Method. For each resized image, the time required by each algorithm to estimate the optimal number of clusters is measured. These measurements allow us to observe how computation time changes as image resolution increases.&lt;br /&gt;
&lt;br /&gt;
By comparing the computation times across all image sizes, we can evaluate the efficiency and scalability of each method. This analysis helps determine which approach is more suitable for real world applications where image sizes may vary significantly. The results also highlight the ability of the CCSE algorithm to handle larger images efficiently while still producing reliable cluster estimates.&lt;br /&gt;
&lt;br /&gt;
[[Image:placeholder.png]]&lt;br /&gt;
&lt;br /&gt;
=== Sensitivity Validation ===&lt;br /&gt;
&lt;br /&gt;
Sensitivity analysis is used to evaluate how stable each clustering method is when its input parameters change. A method that is less sensitive to parameter variation is considered more robust because it produces more consistent results under different settings.&lt;br /&gt;
&lt;br /&gt;
In this study, sensitivity is evaluated for all three methods. For the Elbow Method and the Gap Statistic Method, sensitivity is tested by changing the maximum number of clusters, &amp;lt;math&amp;gt;K_{\max}&amp;lt;/math&amp;gt;. For the CCSE algorithm, sensitivity is examined by varying the distance parameter &amp;lt;math&amp;gt;D&amp;lt;/math&amp;gt;, which controls how histogram peaks are grouped when estimating the number of clusters.&lt;br /&gt;
&lt;br /&gt;
To ensure a fair comparison, the same parameter range is used for all methods. The value of &amp;lt;math&amp;gt;D&amp;lt;/math&amp;gt; for CCSE is set equal to &amp;lt;math&amp;gt;K_{\max}&amp;lt;/math&amp;gt; for the Elbow and Gap methods. Both parameters are varied from 5 to 40, using an increment of 5. For each parameter value, the estimated number of clusters is recorded and compared.&lt;br /&gt;
&lt;br /&gt;
[[Image:placeholder.png]]&lt;br /&gt;
&lt;br /&gt;
The Gap Statistic Method shows a nearly linear increase in the estimated number of clusters as &amp;lt;math&amp;gt;K_{\max}&amp;lt;/math&amp;gt; increases. This behavior indicates a high sensitivity to the chosen maximum value, meaning the estimated result depends strongly on the input parameter.&lt;br /&gt;
&lt;br /&gt;
The Elbow Method shows a non linear trend and is slightly less sensitive than the Gap Statistic Method. However, the estimated number of clusters still changes noticeably as &amp;lt;math&amp;gt;K_{\max}&amp;lt;/math&amp;gt; increases, which suggests that the method remains dependent on the selected parameter range.&lt;br /&gt;
&lt;br /&gt;
In contrast, the CCSE algorithm produces more stable estimates as the distance parameter &amp;lt;math&amp;gt;D&amp;lt;/math&amp;gt; increases. While the estimated number of clusters decreases gradually, the change is smoother and more controlled compared to the other methods. This indicates lower sensitivity to parameter variation.&lt;br /&gt;
&lt;br /&gt;
Overall, the CCSE algorithm demonstrates the highest robustness among the three methods. Its reduced sensitivity to parameter changes allows it to produce more consistent cluster estimates across a wide range of settings, making it more reliable for practical image segmentation tasks.&lt;br /&gt;
&lt;br /&gt;
== Conclusion ==&lt;br /&gt;
&lt;br /&gt;
From the results presented above, it can be concluded that the proposed CCSE algorithm performs well across several important aspects of image segmentation, including segmentation quality, computation time, and robustness. Visual inspection shows that the segmented images produced using CCSE are similar to those generated by the Elbow Method and the Gap Statistic, indicating that CCSE is able to capture the main color structure of the images.&lt;br /&gt;
&lt;br /&gt;
Quantitative evaluation using the CRESE metric further supports these observations. For both original and contrast-enhanced images, the reconstruction errors produced by CCSE are comparable to those of the other methods. This shows that CCSE can estimate a reasonable number of color clusters even when image contrast changes.&lt;br /&gt;
&lt;br /&gt;
In terms of efficiency, CCSE clearly outperforms the Elbow and Gap Statistic methods. Its computation time increases very little as image size grows, making it suitable for high-resolution images and large datasets. In addition, CCSE shows stable behavior across different parameter settings, which indicates good robustness.&lt;br /&gt;
&lt;br /&gt;
Overall, the CCSE algorithm provides a practical and reliable approach for estimating the number of color clusters in image segmentation, offering a good balance between accuracy, speed, and stability.&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
== Appendix 1 ==&lt;br /&gt;
&lt;br /&gt;
link to code: https://drive.google.com/drive/folders/1kJ1jRgtYwjPT1HOiSKBag3t2gvJKGu8J?usp=drive_link&lt;/div&gt;</summary>
		<author><name>Sisira2</name></author>
	</entry>
	<entry>
		<id>http://vista.su.domains/psych221wiki/index.php?title=Smart_Cluster_Selection_for_CIELAB_Color_Segmentation&amp;diff=146028</id>
		<title>Smart Cluster Selection for CIELAB Color Segmentation</title>
		<link rel="alternate" type="text/html" href="http://vista.su.domains/psych221wiki/index.php?title=Smart_Cluster_Selection_for_CIELAB_Color_Segmentation&amp;diff=146028"/>
		<updated>2025-12-13T06:36:43Z</updated>

		<summary type="html">&lt;p&gt;Sisira2: /* Quantitative Validation */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction ==&lt;br /&gt;
Image segmentation is a fundamental step in many computer vision applications because it allows algorithms to separate meaningful regions, identify objects, and reduce the complexity of visual scenes. Color is one of the most informative cues for distinguishing visual elements, which is why color-based segmentation methods are commonly used. In particular, clustering techniques group pixels that have similar color characteristics, making them effective for isolating regions with shared appearance. &lt;br /&gt;
&lt;br /&gt;
A major challenge in color-based segmentation is determining the appropriate number of color clusters for a given image. If too few clusters are chosen, under-segmentation occurs and important details may be merged into a single region. If too many clusters are used, over-segmentation can happen, causing noise or small variations in color to form separate, meaningless regions. In many practical settings, the number of clusters is selected manually or determined using methods that require extensive computation. Common techniques such as the Elbow Method and the Gap Statistic address this problem by repeatedly running clustering algorithms like K-Means while testing different numbers of clusters. Although effective, this repeated evaluation becomes computationally expensive for high-resolution images or large datasets. As a result, these methods are often unsuitable for real-time systems or applications that must process many images efficiently. &lt;br /&gt;
&lt;br /&gt;
This project proposes an alternative approach that estimates the ideal number of color clusters directly from the statistical properties of the image. Instead of testing many cluster counts, the method analyzes perceptual lightness variation, the distribution of chromatic information, and the shapes of color histograms in the CIELAB color space. By examining these characteristics, the approach aims to infer how many meaningful color groups are present in the image. The overall goal is to develop a faster and more scalable solution that maintains reliable segmentation performance while significantly reducing computational cost.&lt;br /&gt;
&lt;br /&gt;
== Background ==&lt;br /&gt;
=== Color-Based Image Segmentation ===&lt;br /&gt;
&lt;br /&gt;
Color-based segmentation aims to partition an image into meaningful regions by grouping pixels with similar color properties. This approach relies on representing pixel values in a color space where numerical differences correspond to perceptual differences. One commonly used color space for this purpose is CIELAB (L*a*b*), which separates lightness from chromatic information. This separation allows brightness variations to be treated independently from color differences, which is especially useful in real-world images with varying illumination.&lt;br /&gt;
&lt;br /&gt;
CIELAB is designed to be approximately perceptually uniform, meaning that equal distances in the color space correspond to roughly equal perceived color differences. As a result, Euclidean distance in CIELAB provides a meaningful measure of color similarity. This property makes CIELAB well suited for clustering-based segmentation methods, color quantization, and visual analysis tasks.&lt;br /&gt;
&lt;br /&gt;
=== Statistical and Histogram-Based Methods ===&lt;br /&gt;
&lt;br /&gt;
Many image segmentation techniques rely on statistical summaries of color distributions to guide decision-making. These methods include edge-based approaches, region-growing techniques, and clustering algorithms such as K-Means, Mean Shift, and Gaussian Mixture Models. A common component across these approaches is the analysis of color histograms, which capture how frequently different color values occur in an image.&lt;br /&gt;
&lt;br /&gt;
Histogram analysis can reveal dominant color regions, transitions between areas, and the overall complexity of a scene. In particular, local maxima in color histograms are often interpreted as significant color groups or object components. By examining the number and prominence of these peaks, it is possible to gain insight into how many meaningful color regions may be present in an image without performing full segmentation.&lt;br /&gt;
&lt;br /&gt;
=== Estimating the Number of Clusters ===&lt;br /&gt;
&lt;br /&gt;
Determining the appropriate number of clusters is a long-standing problem in both image processing and unsupervised learning. Many traditional methods estimate the number of clusters by repeatedly running a clustering algorithm with different values and comparing the resulting performance. One influential contribution to this area is the prediction-based resampling approach proposed by Dudoit and Fridlyand, which evaluates cluster stability to estimate the number of meaningful groups in a dataset.&lt;br /&gt;
&lt;br /&gt;
Popular practical techniques such as the Elbow Method and the Gap Statistic follow similar ideas. The Elbow Method selects the number of clusters based on the point where improvements in clustering quality begin to diminish. The Gap Statistic compares clustering performance on real data against random data and selects the number of clusters that shows the largest improvement over chance. While effective, these methods require multiple clustering runs, which can be computationally expensive for large images or datasets.&lt;br /&gt;
&lt;br /&gt;
=== Motivation for Image-Derived Cluster Estimation ===&lt;br /&gt;
&lt;br /&gt;
The ideas underlying perceptual color spaces, histogram analysis, and cluster number estimation suggest that useful information about segmentation complexity is already embedded in the image itself. Rather than repeatedly running clustering algorithms, it may be possible to estimate the number of color clusters directly from image-derived statistics.&lt;br /&gt;
&lt;br /&gt;
This project builds on these foundations by analyzing perceptual lightness variation, chromatic spread, and histogram structure within the CIELAB color space. By combining these cues into a single formulation, the goal is to estimate the number of meaningful color clusters efficiently, reducing computational cost while maintaining reliable segmentation performance.&lt;br /&gt;
&lt;br /&gt;
== Methods ==&lt;br /&gt;
&lt;br /&gt;
=== Proposed Method ===&lt;br /&gt;
The proposed method consists of three main stages. First, the input image is converted from the three-channel RGB color space to the CIELAB (Lab*) color space. Separate histograms are then extracted for the &amp;lt;math&amp;gt;L&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;a&amp;lt;/math&amp;gt;, and &amp;lt;math&amp;gt;b&amp;lt;/math&amp;gt; channels. Second, two statistical parameters are computed from each histogram: the standard deviation and the number of local maxima. These values describe the distribution and structure of lightness and color information in the image. Finally, the optimal number of color clusters is estimated using the CIELAB Color Segment Estimation (CCSE) function, defined as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt; &amp;lt;math&amp;gt; k = \left\lfloor \ln\left(\frac{\sigma_L}{n_L}\right) \right\rfloor \cdot \max(n_a, n_b) + \min(n_a, n_b) &amp;lt;/math&amp;gt; &amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In this equation, &amp;lt;math&amp;gt;\sigma_L&amp;lt;/math&amp;gt; denotes the standard deviation of the &amp;lt;math&amp;gt;L&amp;lt;/math&amp;gt;-channel histogram, while &amp;lt;math&amp;gt;n_L&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;n_a&amp;lt;/math&amp;gt;, and &amp;lt;math&amp;gt;n_b&amp;lt;/math&amp;gt; represent the number of local maxima detected in the &amp;lt;math&amp;gt;L&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;a&amp;lt;/math&amp;gt;, and &amp;lt;math&amp;gt;b&amp;lt;/math&amp;gt; histograms, respectively. The term &amp;lt;math&amp;gt;\max(n_a, n_b)&amp;lt;/math&amp;gt; selects the channel with the strongest chromatic variation, while &amp;lt;math&amp;gt;\min(n_a, n_b)&amp;lt;/math&amp;gt; represents the weaker chromatic channel. A complete overview of the method is illustrated in the processing pipeline shown in Figure 3. It should be noted that this method requires input images to be in standard three-channel RGB format.&lt;br /&gt;
&lt;br /&gt;
=== Color Histogram ===&lt;br /&gt;
Color information in an image can be described using several types of descriptors, such as color histograms, color correlograms, color coherence vectors, and color moments. Among these options, the color histogram is one of the most commonly used representations because it is simple to compute and effective at capturing overall color content, especially when an image has a distinct color distribution compared to others in a dataset.&lt;br /&gt;
&lt;br /&gt;
In the proposed method, information is extracted from the &amp;lt;math&amp;gt;L&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;a&amp;lt;/math&amp;gt;, and &amp;lt;math&amp;gt;b&amp;lt;/math&amp;gt; histograms by analyzing their standard deviations and the number of local maxima. These measurements describe important properties of the image and provide the motivation for the design of the CCSE function:&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;Lightness distribution&#039;&#039;&#039;: The standard deviation of the &amp;lt;math&amp;gt;L&amp;lt;/math&amp;gt;-channel histogram indicates the range of lightness values in the image. A larger standard deviation corresponds to a wider spread of brightness levels, while a smaller value suggests more uniform lighting.&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;Color distribution&#039;&#039;&#039;: The standard deviations of the &amp;lt;math&amp;gt;a&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;b&amp;lt;/math&amp;gt; histograms reflect the diversity of chromatic content. Higher values indicate a broader range of colors, whereas lower values suggest limited color variation.&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;Peak separability&#039;&#039;&#039;: The number of local maxima in the &amp;lt;math&amp;gt;L&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;a&amp;lt;/math&amp;gt;, and &amp;lt;math&amp;gt;b&amp;lt;/math&amp;gt; histograms indicates how well different lightness and color levels are separated. More local maxima imply clearly distinguishable color or intensity regions, while fewer maxima suggest more clustered values.&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;Image complexity&#039;&#039;&#039;: Taken together, the standard deviations and local maxima across all three channels provide an estimate of overall image complexity. Images with larger histogram spreads and more peaks are considered more complex, while images with fewer peaks and narrower distributions are simpler.&lt;br /&gt;
&lt;br /&gt;
Overall, histogram analysis offers a compact yet informative description of an image’s lightness and color structure, which is valuable for segmentation and object recognition tasks.&lt;br /&gt;
&lt;br /&gt;
=== CCSE Function ===&lt;br /&gt;
The term &amp;lt;math&amp;gt;\left\lfloor \ln\left(\frac{\sigma_L}{n_L}\right) \right\rfloor&amp;lt;/math&amp;gt; computes the logarithm of the ratio between the standard deviation of the &amp;lt;math&amp;gt;L&amp;lt;/math&amp;gt;-channel histogram and the number of its local maxima. This ratio reflects the balance between the spread of lightness values and the separability of different lightness levels in the image. Applying the logarithm helps normalize the scale of the values and reduces sensitivity to extreme cases. The floor operation ensures that the resulting estimate of the number of clusters remains an integer. This formulation also prevents the estimated number of clusters from becoming too small when an image contains colors with very similar hues and limited lightness variation.&lt;br /&gt;
&lt;br /&gt;
Multiplying this term by &amp;lt;math&amp;gt;\max(n_a, n_b)&amp;lt;/math&amp;gt; emphasizes the chromatic channel with the greater number of distinct peaks, which typically corresponds to the dominant source of color variation in the image. Using only the weaker chromatic channel could lead to an underestimation of the required number of color segments.&lt;br /&gt;
&lt;br /&gt;
Finally, adding &amp;lt;math&amp;gt;\min(n_a, n_b)&amp;lt;/math&amp;gt; ensures that information from the less dominant chromatic channel is still taken into account. While the channel with stronger variation plays a more important role, incorporating the weaker channel leads to a more balanced and accurate estimation of the number of color clusters.&lt;br /&gt;
&lt;br /&gt;
== Results ==&lt;br /&gt;
&lt;br /&gt;
=== Visual Validation ===&lt;br /&gt;
&lt;br /&gt;
The first part of the evaluation focuses on visual validation, which allows us to directly compare the segmentation results produced by the CCSE algorithm with those from the Elbow Method and the Gap Statistic Method. To ensure a fair comparison, all methods are tested under the same conditions. Since the Elbow and Gap methods require evaluating a range of cluster values, we set a maximum number of clusters of 𝐾max = 20 for all images.&lt;br /&gt;
&lt;br /&gt;
After estimating the optimal number of clusters using each method, the images are segmented accordingly and visually inspected. The comparison focuses on how well each method captures dominant color regions, object boundaries, and overall segmentation smoothness. The results show that the segmentations produced by CCSE are visually very similar to those obtained using the Elbow and Gap methods. This indicates that CCSE successfully captures the main color structures of the images.&lt;br /&gt;
&lt;br /&gt;
Overall, this visual validation demonstrates that CCSE can achieve segmentation quality comparable to established methods, while avoiding the repeated clustering steps required by the Elbow and Gap approaches.&lt;br /&gt;
&lt;br /&gt;
[[File:visualvalidation.png|caption]]&lt;br /&gt;
&lt;br /&gt;
=== Quantitative Validation ===&lt;br /&gt;
&lt;br /&gt;
Quantitative validation is performed using &#039;&#039;&#039;Color Reconstruction Error-based Segmentation Evaluation (CRESE)&#039;&#039;&#039;. This metric evaluates how accurately a segmented image reconstructs the original image in terms of color. It computes the sum of color differences between each pixel’s original color and the average color of the cluster to which the pixel is assigned. A lower reconstruction error indicates better segmentation performance and a more accurate estimate of the number of color clusters.&lt;br /&gt;
&lt;br /&gt;
Let &amp;lt;math&amp;gt;O \in \mathbb{R}^{H \times W \times 3}&amp;lt;/math&amp;gt; denote the original image, and let &amp;lt;math&amp;gt;S \in \mathbb{R}^{H \times W \times 3}&amp;lt;/math&amp;gt; denote the segmented image, where each pixel is replaced by the average color of its assigned cluster. Let&lt;br /&gt;
&amp;lt;math&amp;gt;C = {c_1, c_2, \dots, c_n}&amp;lt;/math&amp;gt; be the set of unique cluster colors in &amp;lt;math&amp;gt;S&amp;lt;/math&amp;gt;, where &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; is the number of clusters. For each cluster color &amp;lt;math&amp;gt;c_i&amp;lt;/math&amp;gt;, a binary mask &amp;lt;math&amp;gt;M_i \in {0,1}^{H \times W}&amp;lt;/math&amp;gt; is defined to indicate pixel membership.&lt;br /&gt;
&lt;br /&gt;
The total color reconstruction error &amp;lt;math&amp;gt;E&amp;lt;/math&amp;gt; is computed as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt; &amp;lt;math&amp;gt; E = \sum_{i=1}^{n} \sum_{h=1}^{H} \sum_{w=1}^{W} M_i(h,w)\,\left\| O(h,w) - c_i \right\|_2 &amp;lt;/math&amp;gt; &amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where &amp;lt;math&amp;gt;|\cdot|_2&amp;lt;/math&amp;gt; denotes the Euclidean distance between color vectors. &lt;br /&gt;
To enable comparison across images of different sizes, the error is normalized and expressed as a percentage:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt; &amp;lt;math&amp;gt; E_{\text{normalized}} = \frac{E}{H \cdot W \cdot 255 \cdot \sqrt{3}} \times 100 &amp;lt;/math&amp;gt; &amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
During experimentation, contrast enhancement was observed to increase the estimated number of clusters. Since contrast enhancement has constant-time complexity, it does not affect the computational cost of the CRESE evaluation. Using this metric, validation curves of normalized reconstruction error versus the number of clusters &amp;lt;math&amp;gt;k&amp;lt;/math&amp;gt; are generated for both original and contrast-enhanced images.&lt;br /&gt;
&lt;br /&gt;
[[Image:quantitativevalidation.png|center|frameless|700px]]&lt;br /&gt;
&lt;br /&gt;
=== Efficiency Validation ===&lt;br /&gt;
&lt;br /&gt;
This section evaluates the computation time of the CCSE algorithm and compares it with the Elbow Method and the Gap Statistic Method in the context of image segmentation. While earlier sections focused on segmentation accuracy, the goal here is to understand how efficiently each method performs as image size increases.&lt;br /&gt;
&lt;br /&gt;
A high resolution beach image with a size of 3840 × 2160 pixels is used as the test image. The image is not contrast enhanced so that computation time is affected only by image size and not by additional preprocessing. To analyze scalability, resized versions of the image are created while preserving the original aspect ratio. The image is scaled to 10%, 25%, 33%, 50%, and 75% of its original dimensions, resulting in a range of images with different pixel counts.&lt;br /&gt;
&lt;br /&gt;
To ensure a fair comparison, the maximum number of clusters is fixed at &amp;lt;math&amp;gt;K_{\max} = 20&amp;lt;/math&amp;gt; for both the Elbow Method and the Gap Statistic Method. For each resized image, the time required by each algorithm to estimate the optimal number of clusters is measured. These measurements allow us to observe how computation time changes as image resolution increases.&lt;br /&gt;
&lt;br /&gt;
By comparing the computation times across all image sizes, we can evaluate the efficiency and scalability of each method. This analysis helps determine which approach is more suitable for real world applications where image sizes may vary significantly. The results also highlight the ability of the CCSE algorithm to handle larger images efficiently while still producing reliable cluster estimates.&lt;br /&gt;
&lt;br /&gt;
[[Image:placeholder.png]]&lt;br /&gt;
&lt;br /&gt;
=== Sensitivity Validation ===&lt;br /&gt;
&lt;br /&gt;
Sensitivity analysis is used to evaluate how stable each clustering method is when its input parameters change. A method that is less sensitive to parameter variation is considered more robust because it produces more consistent results under different settings.&lt;br /&gt;
&lt;br /&gt;
In this study, sensitivity is evaluated for all three methods. For the Elbow Method and the Gap Statistic Method, sensitivity is tested by changing the maximum number of clusters, &amp;lt;math&amp;gt;K_{\max}&amp;lt;/math&amp;gt;. For the CCSE algorithm, sensitivity is examined by varying the distance parameter &amp;lt;math&amp;gt;D&amp;lt;/math&amp;gt;, which controls how histogram peaks are grouped when estimating the number of clusters.&lt;br /&gt;
&lt;br /&gt;
To ensure a fair comparison, the same parameter range is used for all methods. The value of &amp;lt;math&amp;gt;D&amp;lt;/math&amp;gt; for CCSE is set equal to &amp;lt;math&amp;gt;K_{\max}&amp;lt;/math&amp;gt; for the Elbow and Gap methods. Both parameters are varied from 5 to 40, using an increment of 5. For each parameter value, the estimated number of clusters is recorded and compared.&lt;br /&gt;
&lt;br /&gt;
[[Image:placeholder.png]]&lt;br /&gt;
&lt;br /&gt;
The Gap Statistic Method shows a nearly linear increase in the estimated number of clusters as &amp;lt;math&amp;gt;K_{\max}&amp;lt;/math&amp;gt; increases. This behavior indicates a high sensitivity to the chosen maximum value, meaning the estimated result depends strongly on the input parameter.&lt;br /&gt;
&lt;br /&gt;
The Elbow Method shows a non linear trend and is slightly less sensitive than the Gap Statistic Method. However, the estimated number of clusters still changes noticeably as &amp;lt;math&amp;gt;K_{\max}&amp;lt;/math&amp;gt; increases, which suggests that the method remains dependent on the selected parameter range.&lt;br /&gt;
&lt;br /&gt;
In contrast, the CCSE algorithm produces more stable estimates as the distance parameter &amp;lt;math&amp;gt;D&amp;lt;/math&amp;gt; increases. While the estimated number of clusters decreases gradually, the change is smoother and more controlled compared to the other methods. This indicates lower sensitivity to parameter variation.&lt;br /&gt;
&lt;br /&gt;
Overall, the CCSE algorithm demonstrates the highest robustness among the three methods. Its reduced sensitivity to parameter changes allows it to produce more consistent cluster estimates across a wide range of settings, making it more reliable for practical image segmentation tasks.&lt;br /&gt;
&lt;br /&gt;
== Conclusion ==&lt;br /&gt;
&lt;br /&gt;
From the results presented above, it can be concluded that the proposed CCSE algorithm performs well across several important aspects of image segmentation, including segmentation quality, computation time, and robustness. Visual inspection shows that the segmented images produced using CCSE are similar to those generated by the Elbow Method and the Gap Statistic, indicating that CCSE is able to capture the main color structure of the images.&lt;br /&gt;
&lt;br /&gt;
Quantitative evaluation using the CRESE metric further supports these observations. For both original and contrast-enhanced images, the reconstruction errors produced by CCSE are comparable to those of the other methods. This shows that CCSE can estimate a reasonable number of color clusters even when image contrast changes.&lt;br /&gt;
&lt;br /&gt;
In terms of efficiency, CCSE clearly outperforms the Elbow and Gap Statistic methods. Its computation time increases very little as image size grows, making it suitable for high-resolution images and large datasets. In addition, CCSE shows stable behavior across different parameter settings, which indicates good robustness.&lt;br /&gt;
&lt;br /&gt;
Overall, the CCSE algorithm provides a practical and reliable approach for estimating the number of color clusters in image segmentation, offering a good balance between accuracy, speed, and stability.&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
== Appendix 1 ==&lt;br /&gt;
&lt;br /&gt;
link to code: https://drive.google.com/drive/folders/1kJ1jRgtYwjPT1HOiSKBag3t2gvJKGu8J?usp=drive_link&lt;/div&gt;</summary>
		<author><name>Sisira2</name></author>
	</entry>
	<entry>
		<id>http://vista.su.domains/psych221wiki/index.php?title=Smart_Cluster_Selection_for_CIELAB_Color_Segmentation&amp;diff=146027</id>
		<title>Smart Cluster Selection for CIELAB Color Segmentation</title>
		<link rel="alternate" type="text/html" href="http://vista.su.domains/psych221wiki/index.php?title=Smart_Cluster_Selection_for_CIELAB_Color_Segmentation&amp;diff=146027"/>
		<updated>2025-12-13T06:34:50Z</updated>

		<summary type="html">&lt;p&gt;Sisira2: /* Quantitative Validation */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction ==&lt;br /&gt;
Image segmentation is a fundamental step in many computer vision applications because it allows algorithms to separate meaningful regions, identify objects, and reduce the complexity of visual scenes. Color is one of the most informative cues for distinguishing visual elements, which is why color-based segmentation methods are commonly used. In particular, clustering techniques group pixels that have similar color characteristics, making them effective for isolating regions with shared appearance. &lt;br /&gt;
&lt;br /&gt;
A major challenge in color-based segmentation is determining the appropriate number of color clusters for a given image. If too few clusters are chosen, under-segmentation occurs and important details may be merged into a single region. If too many clusters are used, over-segmentation can happen, causing noise or small variations in color to form separate, meaningless regions. In many practical settings, the number of clusters is selected manually or determined using methods that require extensive computation. Common techniques such as the Elbow Method and the Gap Statistic address this problem by repeatedly running clustering algorithms like K-Means while testing different numbers of clusters. Although effective, this repeated evaluation becomes computationally expensive for high-resolution images or large datasets. As a result, these methods are often unsuitable for real-time systems or applications that must process many images efficiently. &lt;br /&gt;
&lt;br /&gt;
This project proposes an alternative approach that estimates the ideal number of color clusters directly from the statistical properties of the image. Instead of testing many cluster counts, the method analyzes perceptual lightness variation, the distribution of chromatic information, and the shapes of color histograms in the CIELAB color space. By examining these characteristics, the approach aims to infer how many meaningful color groups are present in the image. The overall goal is to develop a faster and more scalable solution that maintains reliable segmentation performance while significantly reducing computational cost.&lt;br /&gt;
&lt;br /&gt;
== Background ==&lt;br /&gt;
=== Color-Based Image Segmentation ===&lt;br /&gt;
&lt;br /&gt;
Color-based segmentation aims to partition an image into meaningful regions by grouping pixels with similar color properties. This approach relies on representing pixel values in a color space where numerical differences correspond to perceptual differences. One commonly used color space for this purpose is CIELAB (L*a*b*), which separates lightness from chromatic information. This separation allows brightness variations to be treated independently from color differences, which is especially useful in real-world images with varying illumination.&lt;br /&gt;
&lt;br /&gt;
CIELAB is designed to be approximately perceptually uniform, meaning that equal distances in the color space correspond to roughly equal perceived color differences. As a result, Euclidean distance in CIELAB provides a meaningful measure of color similarity. This property makes CIELAB well suited for clustering-based segmentation methods, color quantization, and visual analysis tasks.&lt;br /&gt;
&lt;br /&gt;
=== Statistical and Histogram-Based Methods ===&lt;br /&gt;
&lt;br /&gt;
Many image segmentation techniques rely on statistical summaries of color distributions to guide decision-making. These methods include edge-based approaches, region-growing techniques, and clustering algorithms such as K-Means, Mean Shift, and Gaussian Mixture Models. A common component across these approaches is the analysis of color histograms, which capture how frequently different color values occur in an image.&lt;br /&gt;
&lt;br /&gt;
Histogram analysis can reveal dominant color regions, transitions between areas, and the overall complexity of a scene. In particular, local maxima in color histograms are often interpreted as significant color groups or object components. By examining the number and prominence of these peaks, it is possible to gain insight into how many meaningful color regions may be present in an image without performing full segmentation.&lt;br /&gt;
&lt;br /&gt;
=== Estimating the Number of Clusters ===&lt;br /&gt;
&lt;br /&gt;
Determining the appropriate number of clusters is a long-standing problem in both image processing and unsupervised learning. Many traditional methods estimate the number of clusters by repeatedly running a clustering algorithm with different values and comparing the resulting performance. One influential contribution to this area is the prediction-based resampling approach proposed by Dudoit and Fridlyand, which evaluates cluster stability to estimate the number of meaningful groups in a dataset.&lt;br /&gt;
&lt;br /&gt;
Popular practical techniques such as the Elbow Method and the Gap Statistic follow similar ideas. The Elbow Method selects the number of clusters based on the point where improvements in clustering quality begin to diminish. The Gap Statistic compares clustering performance on real data against random data and selects the number of clusters that shows the largest improvement over chance. While effective, these methods require multiple clustering runs, which can be computationally expensive for large images or datasets.&lt;br /&gt;
&lt;br /&gt;
=== Motivation for Image-Derived Cluster Estimation ===&lt;br /&gt;
&lt;br /&gt;
The ideas underlying perceptual color spaces, histogram analysis, and cluster number estimation suggest that useful information about segmentation complexity is already embedded in the image itself. Rather than repeatedly running clustering algorithms, it may be possible to estimate the number of color clusters directly from image-derived statistics.&lt;br /&gt;
&lt;br /&gt;
This project builds on these foundations by analyzing perceptual lightness variation, chromatic spread, and histogram structure within the CIELAB color space. By combining these cues into a single formulation, the goal is to estimate the number of meaningful color clusters efficiently, reducing computational cost while maintaining reliable segmentation performance.&lt;br /&gt;
&lt;br /&gt;
== Methods ==&lt;br /&gt;
&lt;br /&gt;
=== Proposed Method ===&lt;br /&gt;
The proposed method consists of three main stages. First, the input image is converted from the three-channel RGB color space to the CIELAB (Lab*) color space. Separate histograms are then extracted for the &amp;lt;math&amp;gt;L&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;a&amp;lt;/math&amp;gt;, and &amp;lt;math&amp;gt;b&amp;lt;/math&amp;gt; channels. Second, two statistical parameters are computed from each histogram: the standard deviation and the number of local maxima. These values describe the distribution and structure of lightness and color information in the image. Finally, the optimal number of color clusters is estimated using the CIELAB Color Segment Estimation (CCSE) function, defined as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt; &amp;lt;math&amp;gt; k = \left\lfloor \ln\left(\frac{\sigma_L}{n_L}\right) \right\rfloor \cdot \max(n_a, n_b) + \min(n_a, n_b) &amp;lt;/math&amp;gt; &amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In this equation, &amp;lt;math&amp;gt;\sigma_L&amp;lt;/math&amp;gt; denotes the standard deviation of the &amp;lt;math&amp;gt;L&amp;lt;/math&amp;gt;-channel histogram, while &amp;lt;math&amp;gt;n_L&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;n_a&amp;lt;/math&amp;gt;, and &amp;lt;math&amp;gt;n_b&amp;lt;/math&amp;gt; represent the number of local maxima detected in the &amp;lt;math&amp;gt;L&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;a&amp;lt;/math&amp;gt;, and &amp;lt;math&amp;gt;b&amp;lt;/math&amp;gt; histograms, respectively. The term &amp;lt;math&amp;gt;\max(n_a, n_b)&amp;lt;/math&amp;gt; selects the channel with the strongest chromatic variation, while &amp;lt;math&amp;gt;\min(n_a, n_b)&amp;lt;/math&amp;gt; represents the weaker chromatic channel. A complete overview of the method is illustrated in the processing pipeline shown in Figure 3. It should be noted that this method requires input images to be in standard three-channel RGB format.&lt;br /&gt;
&lt;br /&gt;
=== Color Histogram ===&lt;br /&gt;
Color information in an image can be described using several types of descriptors, such as color histograms, color correlograms, color coherence vectors, and color moments. Among these options, the color histogram is one of the most commonly used representations because it is simple to compute and effective at capturing overall color content, especially when an image has a distinct color distribution compared to others in a dataset.&lt;br /&gt;
&lt;br /&gt;
In the proposed method, information is extracted from the &amp;lt;math&amp;gt;L&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;a&amp;lt;/math&amp;gt;, and &amp;lt;math&amp;gt;b&amp;lt;/math&amp;gt; histograms by analyzing their standard deviations and the number of local maxima. These measurements describe important properties of the image and provide the motivation for the design of the CCSE function:&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;Lightness distribution&#039;&#039;&#039;: The standard deviation of the &amp;lt;math&amp;gt;L&amp;lt;/math&amp;gt;-channel histogram indicates the range of lightness values in the image. A larger standard deviation corresponds to a wider spread of brightness levels, while a smaller value suggests more uniform lighting.&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;Color distribution&#039;&#039;&#039;: The standard deviations of the &amp;lt;math&amp;gt;a&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;b&amp;lt;/math&amp;gt; histograms reflect the diversity of chromatic content. Higher values indicate a broader range of colors, whereas lower values suggest limited color variation.&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;Peak separability&#039;&#039;&#039;: The number of local maxima in the &amp;lt;math&amp;gt;L&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;a&amp;lt;/math&amp;gt;, and &amp;lt;math&amp;gt;b&amp;lt;/math&amp;gt; histograms indicates how well different lightness and color levels are separated. More local maxima imply clearly distinguishable color or intensity regions, while fewer maxima suggest more clustered values.&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;Image complexity&#039;&#039;&#039;: Taken together, the standard deviations and local maxima across all three channels provide an estimate of overall image complexity. Images with larger histogram spreads and more peaks are considered more complex, while images with fewer peaks and narrower distributions are simpler.&lt;br /&gt;
&lt;br /&gt;
Overall, histogram analysis offers a compact yet informative description of an image’s lightness and color structure, which is valuable for segmentation and object recognition tasks.&lt;br /&gt;
&lt;br /&gt;
=== CCSE Function ===&lt;br /&gt;
The term &amp;lt;math&amp;gt;\left\lfloor \ln\left(\frac{\sigma_L}{n_L}\right) \right\rfloor&amp;lt;/math&amp;gt; computes the logarithm of the ratio between the standard deviation of the &amp;lt;math&amp;gt;L&amp;lt;/math&amp;gt;-channel histogram and the number of its local maxima. This ratio reflects the balance between the spread of lightness values and the separability of different lightness levels in the image. Applying the logarithm helps normalize the scale of the values and reduces sensitivity to extreme cases. The floor operation ensures that the resulting estimate of the number of clusters remains an integer. This formulation also prevents the estimated number of clusters from becoming too small when an image contains colors with very similar hues and limited lightness variation.&lt;br /&gt;
&lt;br /&gt;
Multiplying this term by &amp;lt;math&amp;gt;\max(n_a, n_b)&amp;lt;/math&amp;gt; emphasizes the chromatic channel with the greater number of distinct peaks, which typically corresponds to the dominant source of color variation in the image. Using only the weaker chromatic channel could lead to an underestimation of the required number of color segments.&lt;br /&gt;
&lt;br /&gt;
Finally, adding &amp;lt;math&amp;gt;\min(n_a, n_b)&amp;lt;/math&amp;gt; ensures that information from the less dominant chromatic channel is still taken into account. While the channel with stronger variation plays a more important role, incorporating the weaker channel leads to a more balanced and accurate estimation of the number of color clusters.&lt;br /&gt;
&lt;br /&gt;
== Results ==&lt;br /&gt;
&lt;br /&gt;
=== Visual Validation ===&lt;br /&gt;
&lt;br /&gt;
The first part of the evaluation focuses on visual validation, which allows us to directly compare the segmentation results produced by the CCSE algorithm with those from the Elbow Method and the Gap Statistic Method. To ensure a fair comparison, all methods are tested under the same conditions. Since the Elbow and Gap methods require evaluating a range of cluster values, we set a maximum number of clusters of 𝐾max = 20 for all images.&lt;br /&gt;
&lt;br /&gt;
After estimating the optimal number of clusters using each method, the images are segmented accordingly and visually inspected. The comparison focuses on how well each method captures dominant color regions, object boundaries, and overall segmentation smoothness. The results show that the segmentations produced by CCSE are visually very similar to those obtained using the Elbow and Gap methods. This indicates that CCSE successfully captures the main color structures of the images.&lt;br /&gt;
&lt;br /&gt;
Overall, this visual validation demonstrates that CCSE can achieve segmentation quality comparable to established methods, while avoiding the repeated clustering steps required by the Elbow and Gap approaches.&lt;br /&gt;
&lt;br /&gt;
[[File:visualvalidation.png|caption]]&lt;br /&gt;
&lt;br /&gt;
=== Quantitative Validation ===&lt;br /&gt;
&lt;br /&gt;
Quantitative validation is performed using &#039;&#039;&#039;Color Reconstruction Error-based Segmentation Evaluation (CRESE)&#039;&#039;&#039;. This metric evaluates how accurately a segmented image reconstructs the original image in terms of color. It computes the sum of color differences between each pixel’s original color and the average color of the cluster to which the pixel is assigned. A lower reconstruction error indicates better segmentation performance and a more accurate estimate of the number of color clusters.&lt;br /&gt;
&lt;br /&gt;
Let &amp;lt;math&amp;gt;O \in \mathbb{R}^{H \times W \times 3}&amp;lt;/math&amp;gt; denote the original image, and let &amp;lt;math&amp;gt;S \in \mathbb{R}^{H \times W \times 3}&amp;lt;/math&amp;gt; denote the segmented image, where each pixel is replaced by the average color of its assigned cluster. Let&lt;br /&gt;
&amp;lt;math&amp;gt;C = {c_1, c_2, \dots, c_n}&amp;lt;/math&amp;gt; be the set of unique cluster colors in &amp;lt;math&amp;gt;S&amp;lt;/math&amp;gt;, where &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; is the number of clusters. For each cluster color &amp;lt;math&amp;gt;c_i&amp;lt;/math&amp;gt;, a binary mask &amp;lt;math&amp;gt;M_i \in {0,1}^{H \times W}&amp;lt;/math&amp;gt; is defined to indicate pixel membership.&lt;br /&gt;
&lt;br /&gt;
The total color reconstruction error &amp;lt;math&amp;gt;E&amp;lt;/math&amp;gt; is computed as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt; &amp;lt;math&amp;gt; E = \sum_{i=1}^{n} \sum_{h=1}^{H} \sum_{w=1}^{W} M_i(h,w)\,\left\| O(h,w) - c_i \right\|_2 &amp;lt;/math&amp;gt; &amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where &amp;lt;math&amp;gt;|\cdot|_2&amp;lt;/math&amp;gt; denotes the Euclidean distance between color vectors. &lt;br /&gt;
To enable comparison across images of different sizes, the error is normalized and expressed as a percentage:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt; &amp;lt;math&amp;gt; E_{\text{normalized}} = \frac{E}{H \cdot W \cdot 255 \cdot \sqrt{3}} \times 100 &amp;lt;/math&amp;gt; &amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
During experimentation, contrast enhancement was observed to increase the estimated number of clusters. Since contrast enhancement has constant-time complexity, it does not affect the computational cost of the CRESE evaluation. Using this metric, validation curves of normalized reconstruction error versus the number of clusters &amp;lt;math&amp;gt;k&amp;lt;/math&amp;gt; are generated for both original and contrast-enhanced images.&lt;br /&gt;
&lt;br /&gt;
[[Image:quantitativevalidation.png|frameless|100px]]&lt;br /&gt;
&lt;br /&gt;
=== Efficiency Validation ===&lt;br /&gt;
&lt;br /&gt;
This section evaluates the computation time of the CCSE algorithm and compares it with the Elbow Method and the Gap Statistic Method in the context of image segmentation. While earlier sections focused on segmentation accuracy, the goal here is to understand how efficiently each method performs as image size increases.&lt;br /&gt;
&lt;br /&gt;
A high resolution beach image with a size of 3840 × 2160 pixels is used as the test image. The image is not contrast enhanced so that computation time is affected only by image size and not by additional preprocessing. To analyze scalability, resized versions of the image are created while preserving the original aspect ratio. The image is scaled to 10%, 25%, 33%, 50%, and 75% of its original dimensions, resulting in a range of images with different pixel counts.&lt;br /&gt;
&lt;br /&gt;
To ensure a fair comparison, the maximum number of clusters is fixed at &amp;lt;math&amp;gt;K_{\max} = 20&amp;lt;/math&amp;gt; for both the Elbow Method and the Gap Statistic Method. For each resized image, the time required by each algorithm to estimate the optimal number of clusters is measured. These measurements allow us to observe how computation time changes as image resolution increases.&lt;br /&gt;
&lt;br /&gt;
By comparing the computation times across all image sizes, we can evaluate the efficiency and scalability of each method. This analysis helps determine which approach is more suitable for real world applications where image sizes may vary significantly. The results also highlight the ability of the CCSE algorithm to handle larger images efficiently while still producing reliable cluster estimates.&lt;br /&gt;
&lt;br /&gt;
[[Image:placeholder.png]]&lt;br /&gt;
&lt;br /&gt;
=== Sensitivity Validation ===&lt;br /&gt;
&lt;br /&gt;
Sensitivity analysis is used to evaluate how stable each clustering method is when its input parameters change. A method that is less sensitive to parameter variation is considered more robust because it produces more consistent results under different settings.&lt;br /&gt;
&lt;br /&gt;
In this study, sensitivity is evaluated for all three methods. For the Elbow Method and the Gap Statistic Method, sensitivity is tested by changing the maximum number of clusters, &amp;lt;math&amp;gt;K_{\max}&amp;lt;/math&amp;gt;. For the CCSE algorithm, sensitivity is examined by varying the distance parameter &amp;lt;math&amp;gt;D&amp;lt;/math&amp;gt;, which controls how histogram peaks are grouped when estimating the number of clusters.&lt;br /&gt;
&lt;br /&gt;
To ensure a fair comparison, the same parameter range is used for all methods. The value of &amp;lt;math&amp;gt;D&amp;lt;/math&amp;gt; for CCSE is set equal to &amp;lt;math&amp;gt;K_{\max}&amp;lt;/math&amp;gt; for the Elbow and Gap methods. Both parameters are varied from 5 to 40, using an increment of 5. For each parameter value, the estimated number of clusters is recorded and compared.&lt;br /&gt;
&lt;br /&gt;
[[Image:placeholder.png]]&lt;br /&gt;
&lt;br /&gt;
The Gap Statistic Method shows a nearly linear increase in the estimated number of clusters as &amp;lt;math&amp;gt;K_{\max}&amp;lt;/math&amp;gt; increases. This behavior indicates a high sensitivity to the chosen maximum value, meaning the estimated result depends strongly on the input parameter.&lt;br /&gt;
&lt;br /&gt;
The Elbow Method shows a non linear trend and is slightly less sensitive than the Gap Statistic Method. However, the estimated number of clusters still changes noticeably as &amp;lt;math&amp;gt;K_{\max}&amp;lt;/math&amp;gt; increases, which suggests that the method remains dependent on the selected parameter range.&lt;br /&gt;
&lt;br /&gt;
In contrast, the CCSE algorithm produces more stable estimates as the distance parameter &amp;lt;math&amp;gt;D&amp;lt;/math&amp;gt; increases. While the estimated number of clusters decreases gradually, the change is smoother and more controlled compared to the other methods. This indicates lower sensitivity to parameter variation.&lt;br /&gt;
&lt;br /&gt;
Overall, the CCSE algorithm demonstrates the highest robustness among the three methods. Its reduced sensitivity to parameter changes allows it to produce more consistent cluster estimates across a wide range of settings, making it more reliable for practical image segmentation tasks.&lt;br /&gt;
&lt;br /&gt;
== Conclusion ==&lt;br /&gt;
&lt;br /&gt;
From the results presented above, it can be concluded that the proposed CCSE algorithm performs well across several important aspects of image segmentation, including segmentation quality, computation time, and robustness. Visual inspection shows that the segmented images produced using CCSE are similar to those generated by the Elbow Method and the Gap Statistic, indicating that CCSE is able to capture the main color structure of the images.&lt;br /&gt;
&lt;br /&gt;
Quantitative evaluation using the CRESE metric further supports these observations. For both original and contrast-enhanced images, the reconstruction errors produced by CCSE are comparable to those of the other methods. This shows that CCSE can estimate a reasonable number of color clusters even when image contrast changes.&lt;br /&gt;
&lt;br /&gt;
In terms of efficiency, CCSE clearly outperforms the Elbow and Gap Statistic methods. Its computation time increases very little as image size grows, making it suitable for high-resolution images and large datasets. In addition, CCSE shows stable behavior across different parameter settings, which indicates good robustness.&lt;br /&gt;
&lt;br /&gt;
Overall, the CCSE algorithm provides a practical and reliable approach for estimating the number of color clusters in image segmentation, offering a good balance between accuracy, speed, and stability.&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
== Appendix 1 ==&lt;br /&gt;
&lt;br /&gt;
link to code: https://drive.google.com/drive/folders/1kJ1jRgtYwjPT1HOiSKBag3t2gvJKGu8J?usp=drive_link&lt;/div&gt;</summary>
		<author><name>Sisira2</name></author>
	</entry>
	<entry>
		<id>http://vista.su.domains/psych221wiki/index.php?title=Smart_Cluster_Selection_for_CIELAB_Color_Segmentation&amp;diff=146026</id>
		<title>Smart Cluster Selection for CIELAB Color Segmentation</title>
		<link rel="alternate" type="text/html" href="http://vista.su.domains/psych221wiki/index.php?title=Smart_Cluster_Selection_for_CIELAB_Color_Segmentation&amp;diff=146026"/>
		<updated>2025-12-13T06:33:11Z</updated>

		<summary type="html">&lt;p&gt;Sisira2: /* Quantitative Validation */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction ==&lt;br /&gt;
Image segmentation is a fundamental step in many computer vision applications because it allows algorithms to separate meaningful regions, identify objects, and reduce the complexity of visual scenes. Color is one of the most informative cues for distinguishing visual elements, which is why color-based segmentation methods are commonly used. In particular, clustering techniques group pixels that have similar color characteristics, making them effective for isolating regions with shared appearance. &lt;br /&gt;
&lt;br /&gt;
A major challenge in color-based segmentation is determining the appropriate number of color clusters for a given image. If too few clusters are chosen, under-segmentation occurs and important details may be merged into a single region. If too many clusters are used, over-segmentation can happen, causing noise or small variations in color to form separate, meaningless regions. In many practical settings, the number of clusters is selected manually or determined using methods that require extensive computation. Common techniques such as the Elbow Method and the Gap Statistic address this problem by repeatedly running clustering algorithms like K-Means while testing different numbers of clusters. Although effective, this repeated evaluation becomes computationally expensive for high-resolution images or large datasets. As a result, these methods are often unsuitable for real-time systems or applications that must process many images efficiently. &lt;br /&gt;
&lt;br /&gt;
This project proposes an alternative approach that estimates the ideal number of color clusters directly from the statistical properties of the image. Instead of testing many cluster counts, the method analyzes perceptual lightness variation, the distribution of chromatic information, and the shapes of color histograms in the CIELAB color space. By examining these characteristics, the approach aims to infer how many meaningful color groups are present in the image. The overall goal is to develop a faster and more scalable solution that maintains reliable segmentation performance while significantly reducing computational cost.&lt;br /&gt;
&lt;br /&gt;
== Background ==&lt;br /&gt;
=== Color-Based Image Segmentation ===&lt;br /&gt;
&lt;br /&gt;
Color-based segmentation aims to partition an image into meaningful regions by grouping pixels with similar color properties. This approach relies on representing pixel values in a color space where numerical differences correspond to perceptual differences. One commonly used color space for this purpose is CIELAB (L*a*b*), which separates lightness from chromatic information. This separation allows brightness variations to be treated independently from color differences, which is especially useful in real-world images with varying illumination.&lt;br /&gt;
&lt;br /&gt;
CIELAB is designed to be approximately perceptually uniform, meaning that equal distances in the color space correspond to roughly equal perceived color differences. As a result, Euclidean distance in CIELAB provides a meaningful measure of color similarity. This property makes CIELAB well suited for clustering-based segmentation methods, color quantization, and visual analysis tasks.&lt;br /&gt;
&lt;br /&gt;
=== Statistical and Histogram-Based Methods ===&lt;br /&gt;
&lt;br /&gt;
Many image segmentation techniques rely on statistical summaries of color distributions to guide decision-making. These methods include edge-based approaches, region-growing techniques, and clustering algorithms such as K-Means, Mean Shift, and Gaussian Mixture Models. A common component across these approaches is the analysis of color histograms, which capture how frequently different color values occur in an image.&lt;br /&gt;
&lt;br /&gt;
Histogram analysis can reveal dominant color regions, transitions between areas, and the overall complexity of a scene. In particular, local maxima in color histograms are often interpreted as significant color groups or object components. By examining the number and prominence of these peaks, it is possible to gain insight into how many meaningful color regions may be present in an image without performing full segmentation.&lt;br /&gt;
&lt;br /&gt;
=== Estimating the Number of Clusters ===&lt;br /&gt;
&lt;br /&gt;
Determining the appropriate number of clusters is a long-standing problem in both image processing and unsupervised learning. Many traditional methods estimate the number of clusters by repeatedly running a clustering algorithm with different values and comparing the resulting performance. One influential contribution to this area is the prediction-based resampling approach proposed by Dudoit and Fridlyand, which evaluates cluster stability to estimate the number of meaningful groups in a dataset.&lt;br /&gt;
&lt;br /&gt;
Popular practical techniques such as the Elbow Method and the Gap Statistic follow similar ideas. The Elbow Method selects the number of clusters based on the point where improvements in clustering quality begin to diminish. The Gap Statistic compares clustering performance on real data against random data and selects the number of clusters that shows the largest improvement over chance. While effective, these methods require multiple clustering runs, which can be computationally expensive for large images or datasets.&lt;br /&gt;
&lt;br /&gt;
=== Motivation for Image-Derived Cluster Estimation ===&lt;br /&gt;
&lt;br /&gt;
The ideas underlying perceptual color spaces, histogram analysis, and cluster number estimation suggest that useful information about segmentation complexity is already embedded in the image itself. Rather than repeatedly running clustering algorithms, it may be possible to estimate the number of color clusters directly from image-derived statistics.&lt;br /&gt;
&lt;br /&gt;
This project builds on these foundations by analyzing perceptual lightness variation, chromatic spread, and histogram structure within the CIELAB color space. By combining these cues into a single formulation, the goal is to estimate the number of meaningful color clusters efficiently, reducing computational cost while maintaining reliable segmentation performance.&lt;br /&gt;
&lt;br /&gt;
== Methods ==&lt;br /&gt;
&lt;br /&gt;
=== Proposed Method ===&lt;br /&gt;
The proposed method consists of three main stages. First, the input image is converted from the three-channel RGB color space to the CIELAB (Lab*) color space. Separate histograms are then extracted for the &amp;lt;math&amp;gt;L&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;a&amp;lt;/math&amp;gt;, and &amp;lt;math&amp;gt;b&amp;lt;/math&amp;gt; channels. Second, two statistical parameters are computed from each histogram: the standard deviation and the number of local maxima. These values describe the distribution and structure of lightness and color information in the image. Finally, the optimal number of color clusters is estimated using the CIELAB Color Segment Estimation (CCSE) function, defined as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt; &amp;lt;math&amp;gt; k = \left\lfloor \ln\left(\frac{\sigma_L}{n_L}\right) \right\rfloor \cdot \max(n_a, n_b) + \min(n_a, n_b) &amp;lt;/math&amp;gt; &amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In this equation, &amp;lt;math&amp;gt;\sigma_L&amp;lt;/math&amp;gt; denotes the standard deviation of the &amp;lt;math&amp;gt;L&amp;lt;/math&amp;gt;-channel histogram, while &amp;lt;math&amp;gt;n_L&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;n_a&amp;lt;/math&amp;gt;, and &amp;lt;math&amp;gt;n_b&amp;lt;/math&amp;gt; represent the number of local maxima detected in the &amp;lt;math&amp;gt;L&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;a&amp;lt;/math&amp;gt;, and &amp;lt;math&amp;gt;b&amp;lt;/math&amp;gt; histograms, respectively. The term &amp;lt;math&amp;gt;\max(n_a, n_b)&amp;lt;/math&amp;gt; selects the channel with the strongest chromatic variation, while &amp;lt;math&amp;gt;\min(n_a, n_b)&amp;lt;/math&amp;gt; represents the weaker chromatic channel. A complete overview of the method is illustrated in the processing pipeline shown in Figure 3. It should be noted that this method requires input images to be in standard three-channel RGB format.&lt;br /&gt;
&lt;br /&gt;
=== Color Histogram ===&lt;br /&gt;
Color information in an image can be described using several types of descriptors, such as color histograms, color correlograms, color coherence vectors, and color moments. Among these options, the color histogram is one of the most commonly used representations because it is simple to compute and effective at capturing overall color content, especially when an image has a distinct color distribution compared to others in a dataset.&lt;br /&gt;
&lt;br /&gt;
In the proposed method, information is extracted from the &amp;lt;math&amp;gt;L&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;a&amp;lt;/math&amp;gt;, and &amp;lt;math&amp;gt;b&amp;lt;/math&amp;gt; histograms by analyzing their standard deviations and the number of local maxima. These measurements describe important properties of the image and provide the motivation for the design of the CCSE function:&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;Lightness distribution&#039;&#039;&#039;: The standard deviation of the &amp;lt;math&amp;gt;L&amp;lt;/math&amp;gt;-channel histogram indicates the range of lightness values in the image. A larger standard deviation corresponds to a wider spread of brightness levels, while a smaller value suggests more uniform lighting.&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;Color distribution&#039;&#039;&#039;: The standard deviations of the &amp;lt;math&amp;gt;a&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;b&amp;lt;/math&amp;gt; histograms reflect the diversity of chromatic content. Higher values indicate a broader range of colors, whereas lower values suggest limited color variation.&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;Peak separability&#039;&#039;&#039;: The number of local maxima in the &amp;lt;math&amp;gt;L&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;a&amp;lt;/math&amp;gt;, and &amp;lt;math&amp;gt;b&amp;lt;/math&amp;gt; histograms indicates how well different lightness and color levels are separated. More local maxima imply clearly distinguishable color or intensity regions, while fewer maxima suggest more clustered values.&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;Image complexity&#039;&#039;&#039;: Taken together, the standard deviations and local maxima across all three channels provide an estimate of overall image complexity. Images with larger histogram spreads and more peaks are considered more complex, while images with fewer peaks and narrower distributions are simpler.&lt;br /&gt;
&lt;br /&gt;
Overall, histogram analysis offers a compact yet informative description of an image’s lightness and color structure, which is valuable for segmentation and object recognition tasks.&lt;br /&gt;
&lt;br /&gt;
=== CCSE Function ===&lt;br /&gt;
The term &amp;lt;math&amp;gt;\left\lfloor \ln\left(\frac{\sigma_L}{n_L}\right) \right\rfloor&amp;lt;/math&amp;gt; computes the logarithm of the ratio between the standard deviation of the &amp;lt;math&amp;gt;L&amp;lt;/math&amp;gt;-channel histogram and the number of its local maxima. This ratio reflects the balance between the spread of lightness values and the separability of different lightness levels in the image. Applying the logarithm helps normalize the scale of the values and reduces sensitivity to extreme cases. The floor operation ensures that the resulting estimate of the number of clusters remains an integer. This formulation also prevents the estimated number of clusters from becoming too small when an image contains colors with very similar hues and limited lightness variation.&lt;br /&gt;
&lt;br /&gt;
Multiplying this term by &amp;lt;math&amp;gt;\max(n_a, n_b)&amp;lt;/math&amp;gt; emphasizes the chromatic channel with the greater number of distinct peaks, which typically corresponds to the dominant source of color variation in the image. Using only the weaker chromatic channel could lead to an underestimation of the required number of color segments.&lt;br /&gt;
&lt;br /&gt;
Finally, adding &amp;lt;math&amp;gt;\min(n_a, n_b)&amp;lt;/math&amp;gt; ensures that information from the less dominant chromatic channel is still taken into account. While the channel with stronger variation plays a more important role, incorporating the weaker channel leads to a more balanced and accurate estimation of the number of color clusters.&lt;br /&gt;
&lt;br /&gt;
== Results ==&lt;br /&gt;
&lt;br /&gt;
=== Visual Validation ===&lt;br /&gt;
&lt;br /&gt;
The first part of the evaluation focuses on visual validation, which allows us to directly compare the segmentation results produced by the CCSE algorithm with those from the Elbow Method and the Gap Statistic Method. To ensure a fair comparison, all methods are tested under the same conditions. Since the Elbow and Gap methods require evaluating a range of cluster values, we set a maximum number of clusters of 𝐾max = 20 for all images.&lt;br /&gt;
&lt;br /&gt;
After estimating the optimal number of clusters using each method, the images are segmented accordingly and visually inspected. The comparison focuses on how well each method captures dominant color regions, object boundaries, and overall segmentation smoothness. The results show that the segmentations produced by CCSE are visually very similar to those obtained using the Elbow and Gap methods. This indicates that CCSE successfully captures the main color structures of the images.&lt;br /&gt;
&lt;br /&gt;
Overall, this visual validation demonstrates that CCSE can achieve segmentation quality comparable to established methods, while avoiding the repeated clustering steps required by the Elbow and Gap approaches.&lt;br /&gt;
&lt;br /&gt;
[[File:visualvalidation.png|caption]]&lt;br /&gt;
&lt;br /&gt;
=== Quantitative Validation ===&lt;br /&gt;
&lt;br /&gt;
Quantitative validation is performed using &#039;&#039;&#039;Color Reconstruction Error-based Segmentation Evaluation (CRESE)&#039;&#039;&#039;. This metric evaluates how accurately a segmented image reconstructs the original image in terms of color. It computes the sum of color differences between each pixel’s original color and the average color of the cluster to which the pixel is assigned. A lower reconstruction error indicates better segmentation performance and a more accurate estimate of the number of color clusters.&lt;br /&gt;
&lt;br /&gt;
Let &amp;lt;math&amp;gt;O \in \mathbb{R}^{H \times W \times 3}&amp;lt;/math&amp;gt; denote the original image, and let &amp;lt;math&amp;gt;S \in \mathbb{R}^{H \times W \times 3}&amp;lt;/math&amp;gt; denote the segmented image, where each pixel is replaced by the average color of its assigned cluster. Let&lt;br /&gt;
&amp;lt;math&amp;gt;C = {c_1, c_2, \dots, c_n}&amp;lt;/math&amp;gt; be the set of unique cluster colors in &amp;lt;math&amp;gt;S&amp;lt;/math&amp;gt;, where &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; is the number of clusters. For each cluster color &amp;lt;math&amp;gt;c_i&amp;lt;/math&amp;gt;, a binary mask &amp;lt;math&amp;gt;M_i \in {0,1}^{H \times W}&amp;lt;/math&amp;gt; is defined to indicate pixel membership.&lt;br /&gt;
&lt;br /&gt;
The total color reconstruction error &amp;lt;math&amp;gt;E&amp;lt;/math&amp;gt; is computed as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt; &amp;lt;math&amp;gt; E = \sum_{i=1}^{n} \sum_{h=1}^{H} \sum_{w=1}^{W} M_i(h,w)\,\left\| O(h,w) - c_i \right\|_2 &amp;lt;/math&amp;gt; &amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where &amp;lt;math&amp;gt;|\cdot|_2&amp;lt;/math&amp;gt; denotes the Euclidean distance between color vectors. &lt;br /&gt;
To enable comparison across images of different sizes, the error is normalized and expressed as a percentage:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt; &amp;lt;math&amp;gt; E_{\text{normalized}} = \frac{E}{H \cdot W \cdot 255 \cdot \sqrt{3}} \times 100 &amp;lt;/math&amp;gt; &amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
During experimentation, contrast enhancement was observed to increase the estimated number of clusters. Since contrast enhancement has constant-time complexity, it does not affect the computational cost of the CRESE evaluation. Using this metric, validation curves of normalized reconstruction error versus the number of clusters &amp;lt;math&amp;gt;k&amp;lt;/math&amp;gt; are generated for both original and contrast-enhanced images.&lt;br /&gt;
&lt;br /&gt;
[[Image:quantitativevalidation.png]]&lt;br /&gt;
&lt;br /&gt;
=== Efficiency Validation ===&lt;br /&gt;
&lt;br /&gt;
This section evaluates the computation time of the CCSE algorithm and compares it with the Elbow Method and the Gap Statistic Method in the context of image segmentation. While earlier sections focused on segmentation accuracy, the goal here is to understand how efficiently each method performs as image size increases.&lt;br /&gt;
&lt;br /&gt;
A high resolution beach image with a size of 3840 × 2160 pixels is used as the test image. The image is not contrast enhanced so that computation time is affected only by image size and not by additional preprocessing. To analyze scalability, resized versions of the image are created while preserving the original aspect ratio. The image is scaled to 10%, 25%, 33%, 50%, and 75% of its original dimensions, resulting in a range of images with different pixel counts.&lt;br /&gt;
&lt;br /&gt;
To ensure a fair comparison, the maximum number of clusters is fixed at &amp;lt;math&amp;gt;K_{\max} = 20&amp;lt;/math&amp;gt; for both the Elbow Method and the Gap Statistic Method. For each resized image, the time required by each algorithm to estimate the optimal number of clusters is measured. These measurements allow us to observe how computation time changes as image resolution increases.&lt;br /&gt;
&lt;br /&gt;
By comparing the computation times across all image sizes, we can evaluate the efficiency and scalability of each method. This analysis helps determine which approach is more suitable for real world applications where image sizes may vary significantly. The results also highlight the ability of the CCSE algorithm to handle larger images efficiently while still producing reliable cluster estimates.&lt;br /&gt;
&lt;br /&gt;
[[Image:placeholder.png]]&lt;br /&gt;
&lt;br /&gt;
=== Sensitivity Validation ===&lt;br /&gt;
&lt;br /&gt;
Sensitivity analysis is used to evaluate how stable each clustering method is when its input parameters change. A method that is less sensitive to parameter variation is considered more robust because it produces more consistent results under different settings.&lt;br /&gt;
&lt;br /&gt;
In this study, sensitivity is evaluated for all three methods. For the Elbow Method and the Gap Statistic Method, sensitivity is tested by changing the maximum number of clusters, &amp;lt;math&amp;gt;K_{\max}&amp;lt;/math&amp;gt;. For the CCSE algorithm, sensitivity is examined by varying the distance parameter &amp;lt;math&amp;gt;D&amp;lt;/math&amp;gt;, which controls how histogram peaks are grouped when estimating the number of clusters.&lt;br /&gt;
&lt;br /&gt;
To ensure a fair comparison, the same parameter range is used for all methods. The value of &amp;lt;math&amp;gt;D&amp;lt;/math&amp;gt; for CCSE is set equal to &amp;lt;math&amp;gt;K_{\max}&amp;lt;/math&amp;gt; for the Elbow and Gap methods. Both parameters are varied from 5 to 40, using an increment of 5. For each parameter value, the estimated number of clusters is recorded and compared.&lt;br /&gt;
&lt;br /&gt;
[[Image:placeholder.png]]&lt;br /&gt;
&lt;br /&gt;
The Gap Statistic Method shows a nearly linear increase in the estimated number of clusters as &amp;lt;math&amp;gt;K_{\max}&amp;lt;/math&amp;gt; increases. This behavior indicates a high sensitivity to the chosen maximum value, meaning the estimated result depends strongly on the input parameter.&lt;br /&gt;
&lt;br /&gt;
The Elbow Method shows a non linear trend and is slightly less sensitive than the Gap Statistic Method. However, the estimated number of clusters still changes noticeably as &amp;lt;math&amp;gt;K_{\max}&amp;lt;/math&amp;gt; increases, which suggests that the method remains dependent on the selected parameter range.&lt;br /&gt;
&lt;br /&gt;
In contrast, the CCSE algorithm produces more stable estimates as the distance parameter &amp;lt;math&amp;gt;D&amp;lt;/math&amp;gt; increases. While the estimated number of clusters decreases gradually, the change is smoother and more controlled compared to the other methods. This indicates lower sensitivity to parameter variation.&lt;br /&gt;
&lt;br /&gt;
Overall, the CCSE algorithm demonstrates the highest robustness among the three methods. Its reduced sensitivity to parameter changes allows it to produce more consistent cluster estimates across a wide range of settings, making it more reliable for practical image segmentation tasks.&lt;br /&gt;
&lt;br /&gt;
== Conclusion ==&lt;br /&gt;
&lt;br /&gt;
From the results presented above, it can be concluded that the proposed CCSE algorithm performs well across several important aspects of image segmentation, including segmentation quality, computation time, and robustness. Visual inspection shows that the segmented images produced using CCSE are similar to those generated by the Elbow Method and the Gap Statistic, indicating that CCSE is able to capture the main color structure of the images.&lt;br /&gt;
&lt;br /&gt;
Quantitative evaluation using the CRESE metric further supports these observations. For both original and contrast-enhanced images, the reconstruction errors produced by CCSE are comparable to those of the other methods. This shows that CCSE can estimate a reasonable number of color clusters even when image contrast changes.&lt;br /&gt;
&lt;br /&gt;
In terms of efficiency, CCSE clearly outperforms the Elbow and Gap Statistic methods. Its computation time increases very little as image size grows, making it suitable for high-resolution images and large datasets. In addition, CCSE shows stable behavior across different parameter settings, which indicates good robustness.&lt;br /&gt;
&lt;br /&gt;
Overall, the CCSE algorithm provides a practical and reliable approach for estimating the number of color clusters in image segmentation, offering a good balance between accuracy, speed, and stability.&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
== Appendix 1 ==&lt;br /&gt;
&lt;br /&gt;
link to code: https://drive.google.com/drive/folders/1kJ1jRgtYwjPT1HOiSKBag3t2gvJKGu8J?usp=drive_link&lt;/div&gt;</summary>
		<author><name>Sisira2</name></author>
	</entry>
	<entry>
		<id>http://vista.su.domains/psych221wiki/index.php?title=Smart_Cluster_Selection_for_CIELAB_Color_Segmentation&amp;diff=146025</id>
		<title>Smart Cluster Selection for CIELAB Color Segmentation</title>
		<link rel="alternate" type="text/html" href="http://vista.su.domains/psych221wiki/index.php?title=Smart_Cluster_Selection_for_CIELAB_Color_Segmentation&amp;diff=146025"/>
		<updated>2025-12-13T06:32:47Z</updated>

		<summary type="html">&lt;p&gt;Sisira2: /* Visual Validation */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction ==&lt;br /&gt;
Image segmentation is a fundamental step in many computer vision applications because it allows algorithms to separate meaningful regions, identify objects, and reduce the complexity of visual scenes. Color is one of the most informative cues for distinguishing visual elements, which is why color-based segmentation methods are commonly used. In particular, clustering techniques group pixels that have similar color characteristics, making them effective for isolating regions with shared appearance. &lt;br /&gt;
&lt;br /&gt;
A major challenge in color-based segmentation is determining the appropriate number of color clusters for a given image. If too few clusters are chosen, under-segmentation occurs and important details may be merged into a single region. If too many clusters are used, over-segmentation can happen, causing noise or small variations in color to form separate, meaningless regions. In many practical settings, the number of clusters is selected manually or determined using methods that require extensive computation. Common techniques such as the Elbow Method and the Gap Statistic address this problem by repeatedly running clustering algorithms like K-Means while testing different numbers of clusters. Although effective, this repeated evaluation becomes computationally expensive for high-resolution images or large datasets. As a result, these methods are often unsuitable for real-time systems or applications that must process many images efficiently. &lt;br /&gt;
&lt;br /&gt;
This project proposes an alternative approach that estimates the ideal number of color clusters directly from the statistical properties of the image. Instead of testing many cluster counts, the method analyzes perceptual lightness variation, the distribution of chromatic information, and the shapes of color histograms in the CIELAB color space. By examining these characteristics, the approach aims to infer how many meaningful color groups are present in the image. The overall goal is to develop a faster and more scalable solution that maintains reliable segmentation performance while significantly reducing computational cost.&lt;br /&gt;
&lt;br /&gt;
== Background ==&lt;br /&gt;
=== Color-Based Image Segmentation ===&lt;br /&gt;
&lt;br /&gt;
Color-based segmentation aims to partition an image into meaningful regions by grouping pixels with similar color properties. This approach relies on representing pixel values in a color space where numerical differences correspond to perceptual differences. One commonly used color space for this purpose is CIELAB (L*a*b*), which separates lightness from chromatic information. This separation allows brightness variations to be treated independently from color differences, which is especially useful in real-world images with varying illumination.&lt;br /&gt;
&lt;br /&gt;
CIELAB is designed to be approximately perceptually uniform, meaning that equal distances in the color space correspond to roughly equal perceived color differences. As a result, Euclidean distance in CIELAB provides a meaningful measure of color similarity. This property makes CIELAB well suited for clustering-based segmentation methods, color quantization, and visual analysis tasks.&lt;br /&gt;
&lt;br /&gt;
=== Statistical and Histogram-Based Methods ===&lt;br /&gt;
&lt;br /&gt;
Many image segmentation techniques rely on statistical summaries of color distributions to guide decision-making. These methods include edge-based approaches, region-growing techniques, and clustering algorithms such as K-Means, Mean Shift, and Gaussian Mixture Models. A common component across these approaches is the analysis of color histograms, which capture how frequently different color values occur in an image.&lt;br /&gt;
&lt;br /&gt;
Histogram analysis can reveal dominant color regions, transitions between areas, and the overall complexity of a scene. In particular, local maxima in color histograms are often interpreted as significant color groups or object components. By examining the number and prominence of these peaks, it is possible to gain insight into how many meaningful color regions may be present in an image without performing full segmentation.&lt;br /&gt;
&lt;br /&gt;
=== Estimating the Number of Clusters ===&lt;br /&gt;
&lt;br /&gt;
Determining the appropriate number of clusters is a long-standing problem in both image processing and unsupervised learning. Many traditional methods estimate the number of clusters by repeatedly running a clustering algorithm with different values and comparing the resulting performance. One influential contribution to this area is the prediction-based resampling approach proposed by Dudoit and Fridlyand, which evaluates cluster stability to estimate the number of meaningful groups in a dataset.&lt;br /&gt;
&lt;br /&gt;
Popular practical techniques such as the Elbow Method and the Gap Statistic follow similar ideas. The Elbow Method selects the number of clusters based on the point where improvements in clustering quality begin to diminish. The Gap Statistic compares clustering performance on real data against random data and selects the number of clusters that shows the largest improvement over chance. While effective, these methods require multiple clustering runs, which can be computationally expensive for large images or datasets.&lt;br /&gt;
&lt;br /&gt;
=== Motivation for Image-Derived Cluster Estimation ===&lt;br /&gt;
&lt;br /&gt;
The ideas underlying perceptual color spaces, histogram analysis, and cluster number estimation suggest that useful information about segmentation complexity is already embedded in the image itself. Rather than repeatedly running clustering algorithms, it may be possible to estimate the number of color clusters directly from image-derived statistics.&lt;br /&gt;
&lt;br /&gt;
This project builds on these foundations by analyzing perceptual lightness variation, chromatic spread, and histogram structure within the CIELAB color space. By combining these cues into a single formulation, the goal is to estimate the number of meaningful color clusters efficiently, reducing computational cost while maintaining reliable segmentation performance.&lt;br /&gt;
&lt;br /&gt;
== Methods ==&lt;br /&gt;
&lt;br /&gt;
=== Proposed Method ===&lt;br /&gt;
The proposed method consists of three main stages. First, the input image is converted from the three-channel RGB color space to the CIELAB (Lab*) color space. Separate histograms are then extracted for the &amp;lt;math&amp;gt;L&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;a&amp;lt;/math&amp;gt;, and &amp;lt;math&amp;gt;b&amp;lt;/math&amp;gt; channels. Second, two statistical parameters are computed from each histogram: the standard deviation and the number of local maxima. These values describe the distribution and structure of lightness and color information in the image. Finally, the optimal number of color clusters is estimated using the CIELAB Color Segment Estimation (CCSE) function, defined as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt; &amp;lt;math&amp;gt; k = \left\lfloor \ln\left(\frac{\sigma_L}{n_L}\right) \right\rfloor \cdot \max(n_a, n_b) + \min(n_a, n_b) &amp;lt;/math&amp;gt; &amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In this equation, &amp;lt;math&amp;gt;\sigma_L&amp;lt;/math&amp;gt; denotes the standard deviation of the &amp;lt;math&amp;gt;L&amp;lt;/math&amp;gt;-channel histogram, while &amp;lt;math&amp;gt;n_L&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;n_a&amp;lt;/math&amp;gt;, and &amp;lt;math&amp;gt;n_b&amp;lt;/math&amp;gt; represent the number of local maxima detected in the &amp;lt;math&amp;gt;L&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;a&amp;lt;/math&amp;gt;, and &amp;lt;math&amp;gt;b&amp;lt;/math&amp;gt; histograms, respectively. The term &amp;lt;math&amp;gt;\max(n_a, n_b)&amp;lt;/math&amp;gt; selects the channel with the strongest chromatic variation, while &amp;lt;math&amp;gt;\min(n_a, n_b)&amp;lt;/math&amp;gt; represents the weaker chromatic channel. A complete overview of the method is illustrated in the processing pipeline shown in Figure 3. It should be noted that this method requires input images to be in standard three-channel RGB format.&lt;br /&gt;
&lt;br /&gt;
=== Color Histogram ===&lt;br /&gt;
Color information in an image can be described using several types of descriptors, such as color histograms, color correlograms, color coherence vectors, and color moments. Among these options, the color histogram is one of the most commonly used representations because it is simple to compute and effective at capturing overall color content, especially when an image has a distinct color distribution compared to others in a dataset.&lt;br /&gt;
&lt;br /&gt;
In the proposed method, information is extracted from the &amp;lt;math&amp;gt;L&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;a&amp;lt;/math&amp;gt;, and &amp;lt;math&amp;gt;b&amp;lt;/math&amp;gt; histograms by analyzing their standard deviations and the number of local maxima. These measurements describe important properties of the image and provide the motivation for the design of the CCSE function:&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;Lightness distribution&#039;&#039;&#039;: The standard deviation of the &amp;lt;math&amp;gt;L&amp;lt;/math&amp;gt;-channel histogram indicates the range of lightness values in the image. A larger standard deviation corresponds to a wider spread of brightness levels, while a smaller value suggests more uniform lighting.&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;Color distribution&#039;&#039;&#039;: The standard deviations of the &amp;lt;math&amp;gt;a&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;b&amp;lt;/math&amp;gt; histograms reflect the diversity of chromatic content. Higher values indicate a broader range of colors, whereas lower values suggest limited color variation.&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;Peak separability&#039;&#039;&#039;: The number of local maxima in the &amp;lt;math&amp;gt;L&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;a&amp;lt;/math&amp;gt;, and &amp;lt;math&amp;gt;b&amp;lt;/math&amp;gt; histograms indicates how well different lightness and color levels are separated. More local maxima imply clearly distinguishable color or intensity regions, while fewer maxima suggest more clustered values.&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;Image complexity&#039;&#039;&#039;: Taken together, the standard deviations and local maxima across all three channels provide an estimate of overall image complexity. Images with larger histogram spreads and more peaks are considered more complex, while images with fewer peaks and narrower distributions are simpler.&lt;br /&gt;
&lt;br /&gt;
Overall, histogram analysis offers a compact yet informative description of an image’s lightness and color structure, which is valuable for segmentation and object recognition tasks.&lt;br /&gt;
&lt;br /&gt;
=== CCSE Function ===&lt;br /&gt;
The term &amp;lt;math&amp;gt;\left\lfloor \ln\left(\frac{\sigma_L}{n_L}\right) \right\rfloor&amp;lt;/math&amp;gt; computes the logarithm of the ratio between the standard deviation of the &amp;lt;math&amp;gt;L&amp;lt;/math&amp;gt;-channel histogram and the number of its local maxima. This ratio reflects the balance between the spread of lightness values and the separability of different lightness levels in the image. Applying the logarithm helps normalize the scale of the values and reduces sensitivity to extreme cases. The floor operation ensures that the resulting estimate of the number of clusters remains an integer. This formulation also prevents the estimated number of clusters from becoming too small when an image contains colors with very similar hues and limited lightness variation.&lt;br /&gt;
&lt;br /&gt;
Multiplying this term by &amp;lt;math&amp;gt;\max(n_a, n_b)&amp;lt;/math&amp;gt; emphasizes the chromatic channel with the greater number of distinct peaks, which typically corresponds to the dominant source of color variation in the image. Using only the weaker chromatic channel could lead to an underestimation of the required number of color segments.&lt;br /&gt;
&lt;br /&gt;
Finally, adding &amp;lt;math&amp;gt;\min(n_a, n_b)&amp;lt;/math&amp;gt; ensures that information from the less dominant chromatic channel is still taken into account. While the channel with stronger variation plays a more important role, incorporating the weaker channel leads to a more balanced and accurate estimation of the number of color clusters.&lt;br /&gt;
&lt;br /&gt;
== Results ==&lt;br /&gt;
&lt;br /&gt;
=== Visual Validation ===&lt;br /&gt;
&lt;br /&gt;
The first part of the evaluation focuses on visual validation, which allows us to directly compare the segmentation results produced by the CCSE algorithm with those from the Elbow Method and the Gap Statistic Method. To ensure a fair comparison, all methods are tested under the same conditions. Since the Elbow and Gap methods require evaluating a range of cluster values, we set a maximum number of clusters of 𝐾max = 20 for all images.&lt;br /&gt;
&lt;br /&gt;
After estimating the optimal number of clusters using each method, the images are segmented accordingly and visually inspected. The comparison focuses on how well each method captures dominant color regions, object boundaries, and overall segmentation smoothness. The results show that the segmentations produced by CCSE are visually very similar to those obtained using the Elbow and Gap methods. This indicates that CCSE successfully captures the main color structures of the images.&lt;br /&gt;
&lt;br /&gt;
Overall, this visual validation demonstrates that CCSE can achieve segmentation quality comparable to established methods, while avoiding the repeated clustering steps required by the Elbow and Gap approaches.&lt;br /&gt;
&lt;br /&gt;
[[File:visualvalidation.png|caption]]&lt;br /&gt;
&lt;br /&gt;
=== Quantitative Validation ===&lt;br /&gt;
&lt;br /&gt;
Quantitative validation is performed using &#039;&#039;&#039;Color Reconstruction Error-based Segmentation Evaluation (CRESE)&#039;&#039;&#039;. This metric evaluates how accurately a segmented image reconstructs the original image in terms of color. It computes the sum of color differences between each pixel’s original color and the average color of the cluster to which the pixel is assigned. A lower reconstruction error indicates better segmentation performance and a more accurate estimate of the number of color clusters.&lt;br /&gt;
&lt;br /&gt;
Let &amp;lt;math&amp;gt;O \in \mathbb{R}^{H \times W \times 3}&amp;lt;/math&amp;gt; denote the original image, and let &amp;lt;math&amp;gt;S \in \mathbb{R}^{H \times W \times 3}&amp;lt;/math&amp;gt; denote the segmented image, where each pixel is replaced by the average color of its assigned cluster. Let&lt;br /&gt;
&amp;lt;math&amp;gt;C = {c_1, c_2, \dots, c_n}&amp;lt;/math&amp;gt; be the set of unique cluster colors in &amp;lt;math&amp;gt;S&amp;lt;/math&amp;gt;, where &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; is the number of clusters. For each cluster color &amp;lt;math&amp;gt;c_i&amp;lt;/math&amp;gt;, a binary mask &amp;lt;math&amp;gt;M_i \in {0,1}^{H \times W}&amp;lt;/math&amp;gt; is defined to indicate pixel membership.&lt;br /&gt;
&lt;br /&gt;
The total color reconstruction error &amp;lt;math&amp;gt;E&amp;lt;/math&amp;gt; is computed as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt; &amp;lt;math&amp;gt; E = \sum_{i=1}^{n} \sum_{h=1}^{H} \sum_{w=1}^{W} M_i(h,w)\,\left\| O(h,w) - c_i \right\|_2 &amp;lt;/math&amp;gt; &amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where &amp;lt;math&amp;gt;|\cdot|_2&amp;lt;/math&amp;gt; denotes the Euclidean distance between color vectors. &lt;br /&gt;
To enable comparison across images of different sizes, the error is normalized and expressed as a percentage:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt; &amp;lt;math&amp;gt; E_{\text{normalized}} = \frac{E}{H \cdot W \cdot 255 \cdot \sqrt{3}} \times 100 &amp;lt;/math&amp;gt; &amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
During experimentation, contrast enhancement was observed to increase the estimated number of clusters. Since contrast enhancement has constant-time complexity, it does not affect the computational cost of the CRESE evaluation. Using this metric, validation curves of normalized reconstruction error versus the number of clusters &amp;lt;math&amp;gt;k&amp;lt;/math&amp;gt; are generated for both original and contrast-enhanced images.&lt;br /&gt;
&lt;br /&gt;
[[Image:placeholder.png]]&lt;br /&gt;
&lt;br /&gt;
=== Efficiency Validation ===&lt;br /&gt;
&lt;br /&gt;
This section evaluates the computation time of the CCSE algorithm and compares it with the Elbow Method and the Gap Statistic Method in the context of image segmentation. While earlier sections focused on segmentation accuracy, the goal here is to understand how efficiently each method performs as image size increases.&lt;br /&gt;
&lt;br /&gt;
A high resolution beach image with a size of 3840 × 2160 pixels is used as the test image. The image is not contrast enhanced so that computation time is affected only by image size and not by additional preprocessing. To analyze scalability, resized versions of the image are created while preserving the original aspect ratio. The image is scaled to 10%, 25%, 33%, 50%, and 75% of its original dimensions, resulting in a range of images with different pixel counts.&lt;br /&gt;
&lt;br /&gt;
To ensure a fair comparison, the maximum number of clusters is fixed at &amp;lt;math&amp;gt;K_{\max} = 20&amp;lt;/math&amp;gt; for both the Elbow Method and the Gap Statistic Method. For each resized image, the time required by each algorithm to estimate the optimal number of clusters is measured. These measurements allow us to observe how computation time changes as image resolution increases.&lt;br /&gt;
&lt;br /&gt;
By comparing the computation times across all image sizes, we can evaluate the efficiency and scalability of each method. This analysis helps determine which approach is more suitable for real world applications where image sizes may vary significantly. The results also highlight the ability of the CCSE algorithm to handle larger images efficiently while still producing reliable cluster estimates.&lt;br /&gt;
&lt;br /&gt;
[[Image:placeholder.png]]&lt;br /&gt;
&lt;br /&gt;
=== Sensitivity Validation ===&lt;br /&gt;
&lt;br /&gt;
Sensitivity analysis is used to evaluate how stable each clustering method is when its input parameters change. A method that is less sensitive to parameter variation is considered more robust because it produces more consistent results under different settings.&lt;br /&gt;
&lt;br /&gt;
In this study, sensitivity is evaluated for all three methods. For the Elbow Method and the Gap Statistic Method, sensitivity is tested by changing the maximum number of clusters, &amp;lt;math&amp;gt;K_{\max}&amp;lt;/math&amp;gt;. For the CCSE algorithm, sensitivity is examined by varying the distance parameter &amp;lt;math&amp;gt;D&amp;lt;/math&amp;gt;, which controls how histogram peaks are grouped when estimating the number of clusters.&lt;br /&gt;
&lt;br /&gt;
To ensure a fair comparison, the same parameter range is used for all methods. The value of &amp;lt;math&amp;gt;D&amp;lt;/math&amp;gt; for CCSE is set equal to &amp;lt;math&amp;gt;K_{\max}&amp;lt;/math&amp;gt; for the Elbow and Gap methods. Both parameters are varied from 5 to 40, using an increment of 5. For each parameter value, the estimated number of clusters is recorded and compared.&lt;br /&gt;
&lt;br /&gt;
[[Image:placeholder.png]]&lt;br /&gt;
&lt;br /&gt;
The Gap Statistic Method shows a nearly linear increase in the estimated number of clusters as &amp;lt;math&amp;gt;K_{\max}&amp;lt;/math&amp;gt; increases. This behavior indicates a high sensitivity to the chosen maximum value, meaning the estimated result depends strongly on the input parameter.&lt;br /&gt;
&lt;br /&gt;
The Elbow Method shows a non linear trend and is slightly less sensitive than the Gap Statistic Method. However, the estimated number of clusters still changes noticeably as &amp;lt;math&amp;gt;K_{\max}&amp;lt;/math&amp;gt; increases, which suggests that the method remains dependent on the selected parameter range.&lt;br /&gt;
&lt;br /&gt;
In contrast, the CCSE algorithm produces more stable estimates as the distance parameter &amp;lt;math&amp;gt;D&amp;lt;/math&amp;gt; increases. While the estimated number of clusters decreases gradually, the change is smoother and more controlled compared to the other methods. This indicates lower sensitivity to parameter variation.&lt;br /&gt;
&lt;br /&gt;
Overall, the CCSE algorithm demonstrates the highest robustness among the three methods. Its reduced sensitivity to parameter changes allows it to produce more consistent cluster estimates across a wide range of settings, making it more reliable for practical image segmentation tasks.&lt;br /&gt;
&lt;br /&gt;
== Conclusion ==&lt;br /&gt;
&lt;br /&gt;
From the results presented above, it can be concluded that the proposed CCSE algorithm performs well across several important aspects of image segmentation, including segmentation quality, computation time, and robustness. Visual inspection shows that the segmented images produced using CCSE are similar to those generated by the Elbow Method and the Gap Statistic, indicating that CCSE is able to capture the main color structure of the images.&lt;br /&gt;
&lt;br /&gt;
Quantitative evaluation using the CRESE metric further supports these observations. For both original and contrast-enhanced images, the reconstruction errors produced by CCSE are comparable to those of the other methods. This shows that CCSE can estimate a reasonable number of color clusters even when image contrast changes.&lt;br /&gt;
&lt;br /&gt;
In terms of efficiency, CCSE clearly outperforms the Elbow and Gap Statistic methods. Its computation time increases very little as image size grows, making it suitable for high-resolution images and large datasets. In addition, CCSE shows stable behavior across different parameter settings, which indicates good robustness.&lt;br /&gt;
&lt;br /&gt;
Overall, the CCSE algorithm provides a practical and reliable approach for estimating the number of color clusters in image segmentation, offering a good balance between accuracy, speed, and stability.&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
== Appendix 1 ==&lt;br /&gt;
&lt;br /&gt;
link to code: https://drive.google.com/drive/folders/1kJ1jRgtYwjPT1HOiSKBag3t2gvJKGu8J?usp=drive_link&lt;/div&gt;</summary>
		<author><name>Sisira2</name></author>
	</entry>
	<entry>
		<id>http://vista.su.domains/psych221wiki/index.php?title=File:Visualvalidation.png&amp;diff=146024</id>
		<title>File:Visualvalidation.png</title>
		<link rel="alternate" type="text/html" href="http://vista.su.domains/psych221wiki/index.php?title=File:Visualvalidation.png&amp;diff=146024"/>
		<updated>2025-12-13T06:32:10Z</updated>

		<summary type="html">&lt;p&gt;Sisira2: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Sisira2</name></author>
	</entry>
	<entry>
		<id>http://vista.su.domains/psych221wiki/index.php?title=File:Quantitativevalidation.png&amp;diff=146023</id>
		<title>File:Quantitativevalidation.png</title>
		<link rel="alternate" type="text/html" href="http://vista.su.domains/psych221wiki/index.php?title=File:Quantitativevalidation.png&amp;diff=146023"/>
		<updated>2025-12-13T06:31:59Z</updated>

		<summary type="html">&lt;p&gt;Sisira2: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Sisira2</name></author>
	</entry>
	<entry>
		<id>http://vista.su.domains/psych221wiki/index.php?title=File:Compvalidation.png&amp;diff=146022</id>
		<title>File:Compvalidation.png</title>
		<link rel="alternate" type="text/html" href="http://vista.su.domains/psych221wiki/index.php?title=File:Compvalidation.png&amp;diff=146022"/>
		<updated>2025-12-13T06:31:46Z</updated>

		<summary type="html">&lt;p&gt;Sisira2: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Sisira2</name></author>
	</entry>
	<entry>
		<id>http://vista.su.domains/psych221wiki/index.php?title=File:Sensitivityvalidaiton.png&amp;diff=146021</id>
		<title>File:Sensitivityvalidaiton.png</title>
		<link rel="alternate" type="text/html" href="http://vista.su.domains/psych221wiki/index.php?title=File:Sensitivityvalidaiton.png&amp;diff=146021"/>
		<updated>2025-12-13T06:31:29Z</updated>

		<summary type="html">&lt;p&gt;Sisira2: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Sisira2</name></author>
	</entry>
	<entry>
		<id>http://vista.su.domains/psych221wiki/index.php?title=Smart_Cluster_Selection_for_CIELAB_Color_Segmentation&amp;diff=146020</id>
		<title>Smart Cluster Selection for CIELAB Color Segmentation</title>
		<link rel="alternate" type="text/html" href="http://vista.su.domains/psych221wiki/index.php?title=Smart_Cluster_Selection_for_CIELAB_Color_Segmentation&amp;diff=146020"/>
		<updated>2025-12-13T06:30:59Z</updated>

		<summary type="html">&lt;p&gt;Sisira2: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction ==&lt;br /&gt;
Image segmentation is a fundamental step in many computer vision applications because it allows algorithms to separate meaningful regions, identify objects, and reduce the complexity of visual scenes. Color is one of the most informative cues for distinguishing visual elements, which is why color-based segmentation methods are commonly used. In particular, clustering techniques group pixels that have similar color characteristics, making them effective for isolating regions with shared appearance. &lt;br /&gt;
&lt;br /&gt;
A major challenge in color-based segmentation is determining the appropriate number of color clusters for a given image. If too few clusters are chosen, under-segmentation occurs and important details may be merged into a single region. If too many clusters are used, over-segmentation can happen, causing noise or small variations in color to form separate, meaningless regions. In many practical settings, the number of clusters is selected manually or determined using methods that require extensive computation. Common techniques such as the Elbow Method and the Gap Statistic address this problem by repeatedly running clustering algorithms like K-Means while testing different numbers of clusters. Although effective, this repeated evaluation becomes computationally expensive for high-resolution images or large datasets. As a result, these methods are often unsuitable for real-time systems or applications that must process many images efficiently. &lt;br /&gt;
&lt;br /&gt;
This project proposes an alternative approach that estimates the ideal number of color clusters directly from the statistical properties of the image. Instead of testing many cluster counts, the method analyzes perceptual lightness variation, the distribution of chromatic information, and the shapes of color histograms in the CIELAB color space. By examining these characteristics, the approach aims to infer how many meaningful color groups are present in the image. The overall goal is to develop a faster and more scalable solution that maintains reliable segmentation performance while significantly reducing computational cost.&lt;br /&gt;
&lt;br /&gt;
== Background ==&lt;br /&gt;
=== Color-Based Image Segmentation ===&lt;br /&gt;
&lt;br /&gt;
Color-based segmentation aims to partition an image into meaningful regions by grouping pixels with similar color properties. This approach relies on representing pixel values in a color space where numerical differences correspond to perceptual differences. One commonly used color space for this purpose is CIELAB (L*a*b*), which separates lightness from chromatic information. This separation allows brightness variations to be treated independently from color differences, which is especially useful in real-world images with varying illumination.&lt;br /&gt;
&lt;br /&gt;
CIELAB is designed to be approximately perceptually uniform, meaning that equal distances in the color space correspond to roughly equal perceived color differences. As a result, Euclidean distance in CIELAB provides a meaningful measure of color similarity. This property makes CIELAB well suited for clustering-based segmentation methods, color quantization, and visual analysis tasks.&lt;br /&gt;
&lt;br /&gt;
=== Statistical and Histogram-Based Methods ===&lt;br /&gt;
&lt;br /&gt;
Many image segmentation techniques rely on statistical summaries of color distributions to guide decision-making. These methods include edge-based approaches, region-growing techniques, and clustering algorithms such as K-Means, Mean Shift, and Gaussian Mixture Models. A common component across these approaches is the analysis of color histograms, which capture how frequently different color values occur in an image.&lt;br /&gt;
&lt;br /&gt;
Histogram analysis can reveal dominant color regions, transitions between areas, and the overall complexity of a scene. In particular, local maxima in color histograms are often interpreted as significant color groups or object components. By examining the number and prominence of these peaks, it is possible to gain insight into how many meaningful color regions may be present in an image without performing full segmentation.&lt;br /&gt;
&lt;br /&gt;
=== Estimating the Number of Clusters ===&lt;br /&gt;
&lt;br /&gt;
Determining the appropriate number of clusters is a long-standing problem in both image processing and unsupervised learning. Many traditional methods estimate the number of clusters by repeatedly running a clustering algorithm with different values and comparing the resulting performance. One influential contribution to this area is the prediction-based resampling approach proposed by Dudoit and Fridlyand, which evaluates cluster stability to estimate the number of meaningful groups in a dataset.&lt;br /&gt;
&lt;br /&gt;
Popular practical techniques such as the Elbow Method and the Gap Statistic follow similar ideas. The Elbow Method selects the number of clusters based on the point where improvements in clustering quality begin to diminish. The Gap Statistic compares clustering performance on real data against random data and selects the number of clusters that shows the largest improvement over chance. While effective, these methods require multiple clustering runs, which can be computationally expensive for large images or datasets.&lt;br /&gt;
&lt;br /&gt;
=== Motivation for Image-Derived Cluster Estimation ===&lt;br /&gt;
&lt;br /&gt;
The ideas underlying perceptual color spaces, histogram analysis, and cluster number estimation suggest that useful information about segmentation complexity is already embedded in the image itself. Rather than repeatedly running clustering algorithms, it may be possible to estimate the number of color clusters directly from image-derived statistics.&lt;br /&gt;
&lt;br /&gt;
This project builds on these foundations by analyzing perceptual lightness variation, chromatic spread, and histogram structure within the CIELAB color space. By combining these cues into a single formulation, the goal is to estimate the number of meaningful color clusters efficiently, reducing computational cost while maintaining reliable segmentation performance.&lt;br /&gt;
&lt;br /&gt;
== Methods ==&lt;br /&gt;
&lt;br /&gt;
=== Proposed Method ===&lt;br /&gt;
The proposed method consists of three main stages. First, the input image is converted from the three-channel RGB color space to the CIELAB (Lab*) color space. Separate histograms are then extracted for the &amp;lt;math&amp;gt;L&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;a&amp;lt;/math&amp;gt;, and &amp;lt;math&amp;gt;b&amp;lt;/math&amp;gt; channels. Second, two statistical parameters are computed from each histogram: the standard deviation and the number of local maxima. These values describe the distribution and structure of lightness and color information in the image. Finally, the optimal number of color clusters is estimated using the CIELAB Color Segment Estimation (CCSE) function, defined as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt; &amp;lt;math&amp;gt; k = \left\lfloor \ln\left(\frac{\sigma_L}{n_L}\right) \right\rfloor \cdot \max(n_a, n_b) + \min(n_a, n_b) &amp;lt;/math&amp;gt; &amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In this equation, &amp;lt;math&amp;gt;\sigma_L&amp;lt;/math&amp;gt; denotes the standard deviation of the &amp;lt;math&amp;gt;L&amp;lt;/math&amp;gt;-channel histogram, while &amp;lt;math&amp;gt;n_L&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;n_a&amp;lt;/math&amp;gt;, and &amp;lt;math&amp;gt;n_b&amp;lt;/math&amp;gt; represent the number of local maxima detected in the &amp;lt;math&amp;gt;L&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;a&amp;lt;/math&amp;gt;, and &amp;lt;math&amp;gt;b&amp;lt;/math&amp;gt; histograms, respectively. The term &amp;lt;math&amp;gt;\max(n_a, n_b)&amp;lt;/math&amp;gt; selects the channel with the strongest chromatic variation, while &amp;lt;math&amp;gt;\min(n_a, n_b)&amp;lt;/math&amp;gt; represents the weaker chromatic channel. A complete overview of the method is illustrated in the processing pipeline shown in Figure 3. It should be noted that this method requires input images to be in standard three-channel RGB format.&lt;br /&gt;
&lt;br /&gt;
=== Color Histogram ===&lt;br /&gt;
Color information in an image can be described using several types of descriptors, such as color histograms, color correlograms, color coherence vectors, and color moments. Among these options, the color histogram is one of the most commonly used representations because it is simple to compute and effective at capturing overall color content, especially when an image has a distinct color distribution compared to others in a dataset.&lt;br /&gt;
&lt;br /&gt;
In the proposed method, information is extracted from the &amp;lt;math&amp;gt;L&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;a&amp;lt;/math&amp;gt;, and &amp;lt;math&amp;gt;b&amp;lt;/math&amp;gt; histograms by analyzing their standard deviations and the number of local maxima. These measurements describe important properties of the image and provide the motivation for the design of the CCSE function:&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;Lightness distribution&#039;&#039;&#039;: The standard deviation of the &amp;lt;math&amp;gt;L&amp;lt;/math&amp;gt;-channel histogram indicates the range of lightness values in the image. A larger standard deviation corresponds to a wider spread of brightness levels, while a smaller value suggests more uniform lighting.&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;Color distribution&#039;&#039;&#039;: The standard deviations of the &amp;lt;math&amp;gt;a&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;b&amp;lt;/math&amp;gt; histograms reflect the diversity of chromatic content. Higher values indicate a broader range of colors, whereas lower values suggest limited color variation.&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;Peak separability&#039;&#039;&#039;: The number of local maxima in the &amp;lt;math&amp;gt;L&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;a&amp;lt;/math&amp;gt;, and &amp;lt;math&amp;gt;b&amp;lt;/math&amp;gt; histograms indicates how well different lightness and color levels are separated. More local maxima imply clearly distinguishable color or intensity regions, while fewer maxima suggest more clustered values.&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;Image complexity&#039;&#039;&#039;: Taken together, the standard deviations and local maxima across all three channels provide an estimate of overall image complexity. Images with larger histogram spreads and more peaks are considered more complex, while images with fewer peaks and narrower distributions are simpler.&lt;br /&gt;
&lt;br /&gt;
Overall, histogram analysis offers a compact yet informative description of an image’s lightness and color structure, which is valuable for segmentation and object recognition tasks.&lt;br /&gt;
&lt;br /&gt;
=== CCSE Function ===&lt;br /&gt;
The term &amp;lt;math&amp;gt;\left\lfloor \ln\left(\frac{\sigma_L}{n_L}\right) \right\rfloor&amp;lt;/math&amp;gt; computes the logarithm of the ratio between the standard deviation of the &amp;lt;math&amp;gt;L&amp;lt;/math&amp;gt;-channel histogram and the number of its local maxima. This ratio reflects the balance between the spread of lightness values and the separability of different lightness levels in the image. Applying the logarithm helps normalize the scale of the values and reduces sensitivity to extreme cases. The floor operation ensures that the resulting estimate of the number of clusters remains an integer. This formulation also prevents the estimated number of clusters from becoming too small when an image contains colors with very similar hues and limited lightness variation.&lt;br /&gt;
&lt;br /&gt;
Multiplying this term by &amp;lt;math&amp;gt;\max(n_a, n_b)&amp;lt;/math&amp;gt; emphasizes the chromatic channel with the greater number of distinct peaks, which typically corresponds to the dominant source of color variation in the image. Using only the weaker chromatic channel could lead to an underestimation of the required number of color segments.&lt;br /&gt;
&lt;br /&gt;
Finally, adding &amp;lt;math&amp;gt;\min(n_a, n_b)&amp;lt;/math&amp;gt; ensures that information from the less dominant chromatic channel is still taken into account. While the channel with stronger variation plays a more important role, incorporating the weaker channel leads to a more balanced and accurate estimation of the number of color clusters.&lt;br /&gt;
&lt;br /&gt;
== Results ==&lt;br /&gt;
&lt;br /&gt;
=== Visual Validation ===&lt;br /&gt;
&lt;br /&gt;
The first part of the evaluation focuses on visual validation, which allows us to directly compare the segmentation results produced by the CCSE algorithm with those from the Elbow Method and the Gap Statistic Method. To ensure a fair comparison, all methods are tested under the same conditions. Since the Elbow and Gap methods require evaluating a range of cluster values, we set a maximum number of clusters of 𝐾max = 20 for all images.&lt;br /&gt;
&lt;br /&gt;
After estimating the optimal number of clusters using each method, the images are segmented accordingly and visually inspected. The comparison focuses on how well each method captures dominant color regions, object boundaries, and overall segmentation smoothness. The results show that the segmentations produced by CCSE are visually very similar to those obtained using the Elbow and Gap methods. This indicates that CCSE successfully captures the main color structures of the images.&lt;br /&gt;
&lt;br /&gt;
Overall, this visual validation demonstrates that CCSE can achieve segmentation quality comparable to established methods, while avoiding the repeated clustering steps required by the Elbow and Gap approaches.&lt;br /&gt;
&lt;br /&gt;
[[File:example.jpg|caption]]&lt;br /&gt;
&lt;br /&gt;
=== Quantitative Validation ===&lt;br /&gt;
&lt;br /&gt;
Quantitative validation is performed using &#039;&#039;&#039;Color Reconstruction Error-based Segmentation Evaluation (CRESE)&#039;&#039;&#039;. This metric evaluates how accurately a segmented image reconstructs the original image in terms of color. It computes the sum of color differences between each pixel’s original color and the average color of the cluster to which the pixel is assigned. A lower reconstruction error indicates better segmentation performance and a more accurate estimate of the number of color clusters.&lt;br /&gt;
&lt;br /&gt;
Let &amp;lt;math&amp;gt;O \in \mathbb{R}^{H \times W \times 3}&amp;lt;/math&amp;gt; denote the original image, and let &amp;lt;math&amp;gt;S \in \mathbb{R}^{H \times W \times 3}&amp;lt;/math&amp;gt; denote the segmented image, where each pixel is replaced by the average color of its assigned cluster. Let&lt;br /&gt;
&amp;lt;math&amp;gt;C = {c_1, c_2, \dots, c_n}&amp;lt;/math&amp;gt; be the set of unique cluster colors in &amp;lt;math&amp;gt;S&amp;lt;/math&amp;gt;, where &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; is the number of clusters. For each cluster color &amp;lt;math&amp;gt;c_i&amp;lt;/math&amp;gt;, a binary mask &amp;lt;math&amp;gt;M_i \in {0,1}^{H \times W}&amp;lt;/math&amp;gt; is defined to indicate pixel membership.&lt;br /&gt;
&lt;br /&gt;
The total color reconstruction error &amp;lt;math&amp;gt;E&amp;lt;/math&amp;gt; is computed as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt; &amp;lt;math&amp;gt; E = \sum_{i=1}^{n} \sum_{h=1}^{H} \sum_{w=1}^{W} M_i(h,w)\,\left\| O(h,w) - c_i \right\|_2 &amp;lt;/math&amp;gt; &amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where &amp;lt;math&amp;gt;|\cdot|_2&amp;lt;/math&amp;gt; denotes the Euclidean distance between color vectors. &lt;br /&gt;
To enable comparison across images of different sizes, the error is normalized and expressed as a percentage:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt; &amp;lt;math&amp;gt; E_{\text{normalized}} = \frac{E}{H \cdot W \cdot 255 \cdot \sqrt{3}} \times 100 &amp;lt;/math&amp;gt; &amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
During experimentation, contrast enhancement was observed to increase the estimated number of clusters. Since contrast enhancement has constant-time complexity, it does not affect the computational cost of the CRESE evaluation. Using this metric, validation curves of normalized reconstruction error versus the number of clusters &amp;lt;math&amp;gt;k&amp;lt;/math&amp;gt; are generated for both original and contrast-enhanced images.&lt;br /&gt;
&lt;br /&gt;
[[Image:placeholder.png]]&lt;br /&gt;
&lt;br /&gt;
=== Efficiency Validation ===&lt;br /&gt;
&lt;br /&gt;
This section evaluates the computation time of the CCSE algorithm and compares it with the Elbow Method and the Gap Statistic Method in the context of image segmentation. While earlier sections focused on segmentation accuracy, the goal here is to understand how efficiently each method performs as image size increases.&lt;br /&gt;
&lt;br /&gt;
A high resolution beach image with a size of 3840 × 2160 pixels is used as the test image. The image is not contrast enhanced so that computation time is affected only by image size and not by additional preprocessing. To analyze scalability, resized versions of the image are created while preserving the original aspect ratio. The image is scaled to 10%, 25%, 33%, 50%, and 75% of its original dimensions, resulting in a range of images with different pixel counts.&lt;br /&gt;
&lt;br /&gt;
To ensure a fair comparison, the maximum number of clusters is fixed at &amp;lt;math&amp;gt;K_{\max} = 20&amp;lt;/math&amp;gt; for both the Elbow Method and the Gap Statistic Method. For each resized image, the time required by each algorithm to estimate the optimal number of clusters is measured. These measurements allow us to observe how computation time changes as image resolution increases.&lt;br /&gt;
&lt;br /&gt;
By comparing the computation times across all image sizes, we can evaluate the efficiency and scalability of each method. This analysis helps determine which approach is more suitable for real world applications where image sizes may vary significantly. The results also highlight the ability of the CCSE algorithm to handle larger images efficiently while still producing reliable cluster estimates.&lt;br /&gt;
&lt;br /&gt;
[[Image:placeholder.png]]&lt;br /&gt;
&lt;br /&gt;
=== Sensitivity Validation ===&lt;br /&gt;
&lt;br /&gt;
Sensitivity analysis is used to evaluate how stable each clustering method is when its input parameters change. A method that is less sensitive to parameter variation is considered more robust because it produces more consistent results under different settings.&lt;br /&gt;
&lt;br /&gt;
In this study, sensitivity is evaluated for all three methods. For the Elbow Method and the Gap Statistic Method, sensitivity is tested by changing the maximum number of clusters, &amp;lt;math&amp;gt;K_{\max}&amp;lt;/math&amp;gt;. For the CCSE algorithm, sensitivity is examined by varying the distance parameter &amp;lt;math&amp;gt;D&amp;lt;/math&amp;gt;, which controls how histogram peaks are grouped when estimating the number of clusters.&lt;br /&gt;
&lt;br /&gt;
To ensure a fair comparison, the same parameter range is used for all methods. The value of &amp;lt;math&amp;gt;D&amp;lt;/math&amp;gt; for CCSE is set equal to &amp;lt;math&amp;gt;K_{\max}&amp;lt;/math&amp;gt; for the Elbow and Gap methods. Both parameters are varied from 5 to 40, using an increment of 5. For each parameter value, the estimated number of clusters is recorded and compared.&lt;br /&gt;
&lt;br /&gt;
[[Image:placeholder.png]]&lt;br /&gt;
&lt;br /&gt;
The Gap Statistic Method shows a nearly linear increase in the estimated number of clusters as &amp;lt;math&amp;gt;K_{\max}&amp;lt;/math&amp;gt; increases. This behavior indicates a high sensitivity to the chosen maximum value, meaning the estimated result depends strongly on the input parameter.&lt;br /&gt;
&lt;br /&gt;
The Elbow Method shows a non linear trend and is slightly less sensitive than the Gap Statistic Method. However, the estimated number of clusters still changes noticeably as &amp;lt;math&amp;gt;K_{\max}&amp;lt;/math&amp;gt; increases, which suggests that the method remains dependent on the selected parameter range.&lt;br /&gt;
&lt;br /&gt;
In contrast, the CCSE algorithm produces more stable estimates as the distance parameter &amp;lt;math&amp;gt;D&amp;lt;/math&amp;gt; increases. While the estimated number of clusters decreases gradually, the change is smoother and more controlled compared to the other methods. This indicates lower sensitivity to parameter variation.&lt;br /&gt;
&lt;br /&gt;
Overall, the CCSE algorithm demonstrates the highest robustness among the three methods. Its reduced sensitivity to parameter changes allows it to produce more consistent cluster estimates across a wide range of settings, making it more reliable for practical image segmentation tasks.&lt;br /&gt;
&lt;br /&gt;
== Conclusion ==&lt;br /&gt;
&lt;br /&gt;
From the results presented above, it can be concluded that the proposed CCSE algorithm performs well across several important aspects of image segmentation, including segmentation quality, computation time, and robustness. Visual inspection shows that the segmented images produced using CCSE are similar to those generated by the Elbow Method and the Gap Statistic, indicating that CCSE is able to capture the main color structure of the images.&lt;br /&gt;
&lt;br /&gt;
Quantitative evaluation using the CRESE metric further supports these observations. For both original and contrast-enhanced images, the reconstruction errors produced by CCSE are comparable to those of the other methods. This shows that CCSE can estimate a reasonable number of color clusters even when image contrast changes.&lt;br /&gt;
&lt;br /&gt;
In terms of efficiency, CCSE clearly outperforms the Elbow and Gap Statistic methods. Its computation time increases very little as image size grows, making it suitable for high-resolution images and large datasets. In addition, CCSE shows stable behavior across different parameter settings, which indicates good robustness.&lt;br /&gt;
&lt;br /&gt;
Overall, the CCSE algorithm provides a practical and reliable approach for estimating the number of color clusters in image segmentation, offering a good balance between accuracy, speed, and stability.&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
== Appendix 1 ==&lt;br /&gt;
&lt;br /&gt;
link to code: https://drive.google.com/drive/folders/1kJ1jRgtYwjPT1HOiSKBag3t2gvJKGu8J?usp=drive_link&lt;/div&gt;</summary>
		<author><name>Sisira2</name></author>
	</entry>
	<entry>
		<id>http://vista.su.domains/psych221wiki/index.php?title=Smart_Cluster_Selection_for_CIELAB_Color_Segmentation&amp;diff=146015</id>
		<title>Smart Cluster Selection for CIELAB Color Segmentation</title>
		<link rel="alternate" type="text/html" href="http://vista.su.domains/psych221wiki/index.php?title=Smart_Cluster_Selection_for_CIELAB_Color_Segmentation&amp;diff=146015"/>
		<updated>2025-12-13T05:32:49Z</updated>

		<summary type="html">&lt;p&gt;Sisira2: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction ==&lt;br /&gt;
Image segmentation is a fundamental step in many computer vision applications because it allows algorithms to separate meaningful regions, identify objects, and reduce the complexity of visual scenes. Color is one of the most informative cues for distinguishing visual elements, which is why color-based segmentation methods are commonly used. In particular, clustering techniques group pixels that have similar color characteristics, making them effective for isolating regions with shared appearance. &lt;br /&gt;
&lt;br /&gt;
A major challenge in color-based segmentation is determining the appropriate number of color clusters for a given image. If too few clusters are chosen, under-segmentation occurs and important details may be merged into a single region. If too many clusters are used, over-segmentation can happen, causing noise or small variations in color to form separate, meaningless regions. In many practical settings, the number of clusters is selected manually or determined using methods that require extensive computation. Common techniques such as the Elbow Method and the Gap Statistic address this problem by repeatedly running clustering algorithms like K-Means while testing different numbers of clusters. Although effective, this repeated evaluation becomes computationally expensive for high-resolution images or large datasets. As a result, these methods are often unsuitable for real-time systems or applications that must process many images efficiently. &lt;br /&gt;
&lt;br /&gt;
This project proposes an alternative approach that estimates the ideal number of color clusters directly from the statistical properties of the image. Instead of testing many cluster counts, the method analyzes perceptual lightness variation, the distribution of chromatic information, and the shapes of color histograms in the CIELAB color space. By examining these characteristics, the approach aims to infer how many meaningful color groups are present in the image. The overall goal is to develop a faster and more scalable solution that maintains reliable segmentation performance while significantly reducing computational cost.&lt;br /&gt;
&lt;br /&gt;
== Background ==&lt;br /&gt;
==== Color-Based Image Segmentation ====&lt;br /&gt;
&lt;br /&gt;
Color-based segmentation aims to partition an image into meaningful regions by grouping pixels with similar color properties. This approach relies on representing pixel values in a color space where numerical differences correspond to perceptual differences. One commonly used color space for this purpose is CIELAB (L*a*b*), which separates lightness from chromatic information. This separation allows brightness variations to be treated independently from color differences, which is especially useful in real-world images with varying illumination.&lt;br /&gt;
&lt;br /&gt;
CIELAB is designed to be approximately perceptually uniform, meaning that equal distances in the color space correspond to roughly equal perceived color differences. As a result, Euclidean distance in CIELAB provides a meaningful measure of color similarity. This property makes CIELAB well suited for clustering-based segmentation methods, color quantization, and visual analysis tasks.&lt;br /&gt;
&lt;br /&gt;
==== Statistical and Histogram-Based Methods ====&lt;br /&gt;
&lt;br /&gt;
Many image segmentation techniques rely on statistical summaries of color distributions to guide decision-making. These methods include edge-based approaches, region-growing techniques, and clustering algorithms such as K-Means, Mean Shift, and Gaussian Mixture Models. A common component across these approaches is the analysis of color histograms, which capture how frequently different color values occur in an image.&lt;br /&gt;
&lt;br /&gt;
Histogram analysis can reveal dominant color regions, transitions between areas, and the overall complexity of a scene. In particular, local maxima in color histograms are often interpreted as significant color groups or object components. By examining the number and prominence of these peaks, it is possible to gain insight into how many meaningful color regions may be present in an image without performing full segmentation.&lt;br /&gt;
&lt;br /&gt;
==== Estimating the Number of Clusters ====&lt;br /&gt;
&lt;br /&gt;
Determining the appropriate number of clusters is a long-standing problem in both image processing and unsupervised learning. Many traditional methods estimate the number of clusters by repeatedly running a clustering algorithm with different values and comparing the resulting performance. One influential contribution to this area is the prediction-based resampling approach proposed by Dudoit and Fridlyand, which evaluates cluster stability to estimate the number of meaningful groups in a dataset.&lt;br /&gt;
&lt;br /&gt;
Popular practical techniques such as the Elbow Method and the Gap Statistic follow similar ideas. The Elbow Method selects the number of clusters based on the point where improvements in clustering quality begin to diminish. The Gap Statistic compares clustering performance on real data against random data and selects the number of clusters that shows the largest improvement over chance. While effective, these methods require multiple clustering runs, which can be computationally expensive for large images or datasets.&lt;br /&gt;
&lt;br /&gt;
==== Motivation for Image-Derived Cluster Estimation ====&lt;br /&gt;
&lt;br /&gt;
The ideas underlying perceptual color spaces, histogram analysis, and cluster number estimation suggest that useful information about segmentation complexity is already embedded in the image itself. Rather than repeatedly running clustering algorithms, it may be possible to estimate the number of color clusters directly from image-derived statistics.&lt;br /&gt;
&lt;br /&gt;
This project builds on these foundations by analyzing perceptual lightness variation, chromatic spread, and histogram structure within the CIELAB color space. By combining these cues into a single formulation, the goal is to estimate the number of meaningful color clusters efficiently, reducing computational cost while maintaining reliable segmentation performance.&lt;br /&gt;
&lt;br /&gt;
== Methods ==&lt;br /&gt;
&lt;br /&gt;
==== Proposed Method ====&lt;br /&gt;
The proposed method consists of three main stages. First, the input image is converted from the three-channel RGB color space to the CIELAB (Lab*) color space. Separate histograms are then extracted for the L, a, and b channels. Second, two statistical parameters are computed from each histogram: the standard deviation and the number of local maxima. These values characterize the spread and structure of lightness and color information in the image. Finally, the optimal number of color clusters is estimated using the CIELAB Color Segment Estimation (CCSE) function, defined as:&lt;br /&gt;
&lt;br /&gt;
[[File:sisiformula.png|caption]]&lt;br /&gt;
&lt;br /&gt;
In this equation, σ_L denotes the standard deviation of the L-channel histogram, while n_L, n_a, and n_b represent the number of local maxima detected in the L, a, and b histograms, respectively. The term max(n_a, n_b) selects the channel with the strongest chromatic variation, and min(n_a, n_b) represents the weaker chromatic channel. A complete overview of the method is illustrated in the processing pipeline shown in Figure 3. It should be noted that the method requires input images to be in standard three-channel RGB format.&lt;br /&gt;
&lt;br /&gt;
==== Color Histogram ====&lt;br /&gt;
Color information in an image can be represented using several descriptors, including color histograms, color correlograms, color coherence vectors, and color moments. Among these, the color histogram is one of the most widely used representations due to its simplicity and effectiveness, particularly when the color distribution of an image is distinct from that of other images in a dataset.&lt;br /&gt;
&lt;br /&gt;
In this method, information is extracted from the L, a, and b histograms by analyzing their standard deviations and the number of local maxima. These metrics capture important characteristics of the image and motivate the design of the CCSE function:&lt;br /&gt;
&lt;br /&gt;
* Lightness distribution: The standard deviation of the L histogram indicates the range of lightness values present in the image. A higher standard deviation corresponds to a wider range of brightness levels, while a lower value suggests a more uniform lightness distribution.&lt;br /&gt;
&lt;br /&gt;
* Color distribution: The standard deviations of the a and b histograms reflect the diversity of chromatic information in the image. Larger values indicate a broader color palette, whereas smaller values imply limited color variation.&lt;br /&gt;
&lt;br /&gt;
* Peak separability: The number of local maxima in the L, a, and b histograms provides insight into how well different lightness and color levels are separated. A larger number of local maxima suggests distinct and separable color or intensity regions, while fewer maxima indicate more tightly clustered values.&lt;br /&gt;
&lt;br /&gt;
* Image complexity: Together, the standard deviations and local maxima across all three channels provide an estimate of overall image complexity. Images with larger spreads and more histogram peaks are considered more complex, whereas images with fewer peaks and narrower distributions are simpler.&lt;br /&gt;
&lt;br /&gt;
Overall, histogram analysis offers a compact yet informative description of an image’s lightness and color structure, which is valuable for segmentation and object recognition tasks.&lt;br /&gt;
&lt;br /&gt;
==== CCSE Function ====&lt;br /&gt;
The term ⌊ ln( σ_L / n_L ) ⌋ computes the logarithm of the ratio between the standard deviation of the L histogram and the number of its local maxima. This ratio captures the relationship between the overall spread of lightness values and the degree of separability among different lightness levels. Applying the logarithm helps normalize the scale and reduces sensitivity to extreme values. The floor operation ensures that the resulting cluster estimate remains an integer. This formulation also prevents the estimated number of clusters from becoming too small in cases where the image contains colors with very similar hues and low lightness variation.&lt;br /&gt;
&lt;br /&gt;
Multiplying by max(n_a, n_b) emphasizes the chromatic channel with the greatest number of distinct peaks, which typically corresponds to the dominant source of color variation in the image. Relying only on the weaker chromatic channel could lead to underestimation of the number of required color segments.&lt;br /&gt;
&lt;br /&gt;
At the same time, adding min(n_a, n_b) ensures that information from the less dominant chromatic channel is not ignored. While the channel with stronger variation should carry more weight, incorporating the weaker channel contributes to a more balanced and accurate estimation of the number of color clusters.&lt;br /&gt;
&lt;br /&gt;
==== Time Complexity ====&lt;br /&gt;
The time complexity of the proposed method can be analyzed by examining each step of the algorithm. Let N denote the total number of pixels in the image. Converting the image from RGB to CIELAB color space requires O(N) time. Computing the histograms for the three channels also takes O(N) time. Since each histogram contains at most 256 bins, the process of detecting local maxima can be treated as a constant-time operation. All mathematical operations used in the CCSE function have constant time complexity. Any additional looping over pixels has a worst-case complexity of O(N). As a result, the overall time complexity of the proposed method is O(N), making it efficient and scalable for high-resolution images.&lt;br /&gt;
&lt;br /&gt;
== Conclusion ==&lt;br /&gt;
&lt;br /&gt;
From the results presented above, it can be concluded that the proposed CCSE algorithm performs well across several important aspects of image segmentation, including segmentation quality, computation time, and robustness. Visual inspection shows that the segmented images produced using CCSE are similar to those generated by the Elbow Method and the Gap Statistic, indicating that CCSE is able to capture the main color structure of the images.&lt;br /&gt;
&lt;br /&gt;
Quantitative evaluation using the CRESE metric further supports these observations. For both original and contrast-enhanced images, the reconstruction errors produced by CCSE are comparable to those of the other methods. This shows that CCSE can estimate a reasonable number of color clusters even when image contrast changes.&lt;br /&gt;
&lt;br /&gt;
In terms of efficiency, CCSE clearly outperforms the Elbow and Gap Statistic methods. Its computation time increases very little as image size grows, making it suitable for high-resolution images and large datasets. In addition, CCSE shows stable behavior across different parameter settings, which indicates good robustness.&lt;br /&gt;
&lt;br /&gt;
Overall, the CCSE algorithm provides a practical and reliable approach for estimating the number of color clusters in image segmentation, offering a good balance between accuracy, speed, and stability.&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
== Appendix 1 ==&lt;/div&gt;</summary>
		<author><name>Sisira2</name></author>
	</entry>
	<entry>
		<id>http://vista.su.domains/psych221wiki/index.php?title=Smart_Cluster_Selection_for_CIELAB_Color_Segmentation&amp;diff=146014</id>
		<title>Smart Cluster Selection for CIELAB Color Segmentation</title>
		<link rel="alternate" type="text/html" href="http://vista.su.domains/psych221wiki/index.php?title=Smart_Cluster_Selection_for_CIELAB_Color_Segmentation&amp;diff=146014"/>
		<updated>2025-12-13T05:30:36Z</updated>

		<summary type="html">&lt;p&gt;Sisira2: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction ==&lt;br /&gt;
Image segmentation is a fundamental step in many computer vision applications because it allows algorithms to separate meaningful regions, identify objects, and reduce the complexity of visual scenes. Color is one of the most informative cues for distinguishing visual elements, which is why color-based segmentation methods are commonly used. In particular, clustering techniques group pixels that have similar color characteristics, making them effective for isolating regions with shared appearance. &lt;br /&gt;
&lt;br /&gt;
A major challenge in color-based segmentation is determining the appropriate number of color clusters for a given image. If too few clusters are chosen, under-segmentation occurs and important details may be merged into a single region. If too many clusters are used, over-segmentation can happen, causing noise or small variations in color to form separate, meaningless regions. In many practical settings, the number of clusters is selected manually or determined using methods that require extensive computation. Common techniques such as the Elbow Method and the Gap Statistic address this problem by repeatedly running clustering algorithms like K-Means while testing different numbers of clusters. Although effective, this repeated evaluation becomes computationally expensive for high-resolution images or large datasets. As a result, these methods are often unsuitable for real-time systems or applications that must process many images efficiently. &lt;br /&gt;
&lt;br /&gt;
This project proposes an alternative approach that estimates the ideal number of color clusters directly from the statistical properties of the image. Instead of testing many cluster counts, the method analyzes perceptual lightness variation, the distribution of chromatic information, and the shapes of color histograms in the CIELAB color space. By examining these characteristics, the approach aims to infer how many meaningful color groups are present in the image. The overall goal is to develop a faster and more scalable solution that maintains reliable segmentation performance while significantly reducing computational cost.&lt;br /&gt;
&lt;br /&gt;
== Background ==&lt;br /&gt;
==== Color-Based Image Segmentation ====&lt;br /&gt;
&lt;br /&gt;
Color-based segmentation aims to partition an image into meaningful regions by grouping pixels with similar color properties. This approach relies on representing pixel values in a color space where numerical differences correspond to perceptual differences. One commonly used color space for this purpose is CIELAB (L*a*b*), which separates lightness from chromatic information. This separation allows brightness variations to be treated independently from color differences, which is especially useful in real-world images with varying illumination.&lt;br /&gt;
&lt;br /&gt;
CIELAB is designed to be approximately perceptually uniform, meaning that equal distances in the color space correspond to roughly equal perceived color differences. As a result, Euclidean distance in CIELAB provides a meaningful measure of color similarity. This property makes CIELAB well suited for clustering-based segmentation methods, color quantization, and visual analysis tasks.&lt;br /&gt;
&lt;br /&gt;
==== Statistical and Histogram-Based Methods ====&lt;br /&gt;
&lt;br /&gt;
Many image segmentation techniques rely on statistical summaries of color distributions to guide decision-making. These methods include edge-based approaches, region-growing techniques, and clustering algorithms such as K-Means, Mean Shift, and Gaussian Mixture Models. A common component across these approaches is the analysis of color histograms, which capture how frequently different color values occur in an image.&lt;br /&gt;
&lt;br /&gt;
Histogram analysis can reveal dominant color regions, transitions between areas, and the overall complexity of a scene. In particular, local maxima in color histograms are often interpreted as significant color groups or object components. By examining the number and prominence of these peaks, it is possible to gain insight into how many meaningful color regions may be present in an image without performing full segmentation.&lt;br /&gt;
&lt;br /&gt;
==== Estimating the Number of Clusters ====&lt;br /&gt;
&lt;br /&gt;
Determining the appropriate number of clusters is a long-standing problem in both image processing and unsupervised learning. Many traditional methods estimate the number of clusters by repeatedly running a clustering algorithm with different values and comparing the resulting performance. One influential contribution to this area is the prediction-based resampling approach proposed by Dudoit and Fridlyand, which evaluates cluster stability to estimate the number of meaningful groups in a dataset.&lt;br /&gt;
&lt;br /&gt;
Popular practical techniques such as the Elbow Method and the Gap Statistic follow similar ideas. The Elbow Method selects the number of clusters based on the point where improvements in clustering quality begin to diminish. The Gap Statistic compares clustering performance on real data against random data and selects the number of clusters that shows the largest improvement over chance. While effective, these methods require multiple clustering runs, which can be computationally expensive for large images or datasets.&lt;br /&gt;
&lt;br /&gt;
==== Motivation for Image-Derived Cluster Estimation ====&lt;br /&gt;
&lt;br /&gt;
The ideas underlying perceptual color spaces, histogram analysis, and cluster number estimation suggest that useful information about segmentation complexity is already embedded in the image itself. Rather than repeatedly running clustering algorithms, it may be possible to estimate the number of color clusters directly from image-derived statistics.&lt;br /&gt;
&lt;br /&gt;
This project builds on these foundations by analyzing perceptual lightness variation, chromatic spread, and histogram structure within the CIELAB color space. By combining these cues into a single formulation, the goal is to estimate the number of meaningful color clusters efficiently, reducing computational cost while maintaining reliable segmentation performance.&lt;br /&gt;
&lt;br /&gt;
== Methods ==&lt;br /&gt;
&lt;br /&gt;
==== Proposed Method ====&lt;br /&gt;
The proposed method consists of three main stages. First, the input image is converted from the three-channel RGB color space to the CIELAB (Lab*) color space. Separate histograms are then extracted for the L, a, and b channels. Second, two statistical parameters are computed from each histogram: the standard deviation and the number of local maxima. These values characterize the spread and structure of lightness and color information in the image. Finally, the optimal number of color clusters is estimated using the CIELAB Color Segment Estimation (CCSE) function, defined as:&lt;br /&gt;
&lt;br /&gt;
[[File:sisiformula.png|caption]]&lt;br /&gt;
&lt;br /&gt;
In this equation, σ_L denotes the standard deviation of the L-channel histogram, while n_L, n_a, and n_b represent the number of local maxima detected in the L, a, and b histograms, respectively. The term max(n_a, n_b) selects the channel with the strongest chromatic variation, and min(n_a, n_b) represents the weaker chromatic channel. A complete overview of the method is illustrated in the processing pipeline shown in Figure 3. It should be noted that the method requires input images to be in standard three-channel RGB format.&lt;br /&gt;
&lt;br /&gt;
==== Color Histogram ====&lt;br /&gt;
Color information in an image can be represented using several descriptors, including color histograms, color correlograms, color coherence vectors, and color moments. Among these, the color histogram is one of the most widely used representations due to its simplicity and effectiveness, particularly when the color distribution of an image is distinct from that of other images in a dataset.&lt;br /&gt;
&lt;br /&gt;
In this method, information is extracted from the L, a, and b histograms by analyzing their standard deviations and the number of local maxima. These metrics capture important characteristics of the image and motivate the design of the CCSE function:&lt;br /&gt;
&lt;br /&gt;
* Lightness distribution: The standard deviation of the L histogram indicates the range of lightness values present in the image. A higher standard deviation corresponds to a wider range of brightness levels, while a lower value suggests a more uniform lightness distribution.&lt;br /&gt;
&lt;br /&gt;
* Color distribution: The standard deviations of the a and b histograms reflect the diversity of chromatic information in the image. Larger values indicate a broader color palette, whereas smaller values imply limited color variation.&lt;br /&gt;
&lt;br /&gt;
* Peak separability: The number of local maxima in the L, a, and b histograms provides insight into how well different lightness and color levels are separated. A larger number of local maxima suggests distinct and separable color or intensity regions, while fewer maxima indicate more tightly clustered values.&lt;br /&gt;
&lt;br /&gt;
* Image complexity: Together, the standard deviations and local maxima across all three channels provide an estimate of overall image complexity. Images with larger spreads and more histogram peaks are considered more complex, whereas images with fewer peaks and narrower distributions are simpler.&lt;br /&gt;
&lt;br /&gt;
Overall, histogram analysis offers a compact yet informative description of an image’s lightness and color structure, which is valuable for segmentation and object recognition tasks.&lt;br /&gt;
&lt;br /&gt;
==== CCSE Function ====&lt;br /&gt;
The term ⌊ ln( σ_L / n_L ) ⌋ computes the logarithm of the ratio between the standard deviation of the L histogram and the number of its local maxima. This ratio captures the relationship between the overall spread of lightness values and the degree of separability among different lightness levels. Applying the logarithm helps normalize the scale and reduces sensitivity to extreme values. The floor operation ensures that the resulting cluster estimate remains an integer. This formulation also prevents the estimated number of clusters from becoming too small in cases where the image contains colors with very similar hues and low lightness variation.&lt;br /&gt;
&lt;br /&gt;
Multiplying by max(n_a, n_b) emphasizes the chromatic channel with the greatest number of distinct peaks, which typically corresponds to the dominant source of color variation in the image. Relying only on the weaker chromatic channel could lead to underestimation of the number of required color segments.&lt;br /&gt;
&lt;br /&gt;
At the same time, adding min(n_a, n_b) ensures that information from the less dominant chromatic channel is not ignored. While the channel with stronger variation should carry more weight, incorporating the weaker channel contributes to a more balanced and accurate estimation of the number of color clusters.&lt;br /&gt;
&lt;br /&gt;
==== Time Complexity ====&lt;br /&gt;
The time complexity of the proposed method can be analyzed by examining each step of the algorithm. Let N denote the total number of pixels in the image. Converting the image from RGB to CIELAB color space requires O(N) time. Computing the histograms for the three channels also takes O(N) time. Since each histogram contains at most 256 bins, the process of detecting local maxima can be treated as a constant-time operation. All mathematical operations used in the CCSE function have constant time complexity. Any additional looping over pixels has a worst-case complexity of O(N). As a result, the overall time complexity of the proposed method is O(N), making it efficient and scalable for high-resolution images.&lt;/div&gt;</summary>
		<author><name>Sisira2</name></author>
	</entry>
	<entry>
		<id>http://vista.su.domains/psych221wiki/index.php?title=Smart_Cluster_Selection_for_CIELAB_Color_Segmentation&amp;diff=146013</id>
		<title>Smart Cluster Selection for CIELAB Color Segmentation</title>
		<link rel="alternate" type="text/html" href="http://vista.su.domains/psych221wiki/index.php?title=Smart_Cluster_Selection_for_CIELAB_Color_Segmentation&amp;diff=146013"/>
		<updated>2025-12-13T04:59:32Z</updated>

		<summary type="html">&lt;p&gt;Sisira2: /* Time Complexity */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction ==&lt;br /&gt;
Image segmentation is a fundamental step in many computer vision applications because it allows algorithms to separate meaningful regions, identify objects, and reduce the complexity of visual scenes. Color is one of the most informative cues for distinguishing visual elements, which is why color-based segmentation methods are commonly used. In particular, clustering techniques group pixels that have similar color characteristics, making them effective for isolating regions with shared appearance. &lt;br /&gt;
&lt;br /&gt;
A major challenge in color-based segmentation is determining the appropriate number of color clusters for a given image. If too few clusters are chosen, under-segmentation occurs and important details may be merged into a single region. If too many clusters are used, over-segmentation can happen, causing noise or small variations in color to form separate, meaningless regions. In many practical settings, the number of clusters is selected manually or determined using methods that require extensive computation. Common techniques such as the Elbow Method and the Gap Statistic address this problem by repeatedly running clustering algorithms like K-Means while testing different numbers of clusters. Although effective, this repeated evaluation becomes computationally expensive for high-resolution images or large datasets. As a result, these methods are often unsuitable for real-time systems or applications that must process many images efficiently. &lt;br /&gt;
&lt;br /&gt;
This project proposes an alternative approach that estimates the ideal number of color clusters directly from the statistical properties of the image. Instead of testing many cluster counts, the method analyzes perceptual lightness variation, the distribution of chromatic information, and the shapes of color histograms in the CIELAB color space. By examining these characteristics, the approach aims to infer how many meaningful color groups are present in the image. The overall goal is to develop a faster and more scalable solution that maintains reliable segmentation performance while significantly reducing computational cost.&lt;br /&gt;
&lt;br /&gt;
== Background ==&lt;br /&gt;
==== Color-Based Image Segmentation ====&lt;br /&gt;
&lt;br /&gt;
Color-based segmentation aims to partition an image into meaningful regions by grouping pixels with similar color properties. This approach relies on representing pixel values in a color space where numerical differences correspond to perceptual differences. One commonly used color space for this purpose is CIELAB (L*a*b*), which separates lightness from chromatic information. This separation allows brightness variations to be treated independently from color differences, which is especially useful in real-world images with varying illumination.&lt;br /&gt;
&lt;br /&gt;
CIELAB is designed to be approximately perceptually uniform, meaning that equal distances in the color space correspond to roughly equal perceived color differences. As a result, Euclidean distance in CIELAB provides a meaningful measure of color similarity. This property makes CIELAB well suited for clustering-based segmentation methods, color quantization, and visual analysis tasks.&lt;br /&gt;
&lt;br /&gt;
==== Statistical and Histogram-Based Methods ====&lt;br /&gt;
&lt;br /&gt;
Many image segmentation techniques rely on statistical summaries of color distributions to guide decision-making. These methods include edge-based approaches, region-growing techniques, and clustering algorithms such as K-Means, Mean Shift, and Gaussian Mixture Models. A common component across these approaches is the analysis of color histograms, which capture how frequently different color values occur in an image.&lt;br /&gt;
&lt;br /&gt;
Histogram analysis can reveal dominant color regions, transitions between areas, and the overall complexity of a scene. In particular, local maxima in color histograms are often interpreted as significant color groups or object components. By examining the number and prominence of these peaks, it is possible to gain insight into how many meaningful color regions may be present in an image without performing full segmentation.&lt;br /&gt;
&lt;br /&gt;
==== Estimating the Number of Clusters ====&lt;br /&gt;
&lt;br /&gt;
Determining the appropriate number of clusters is a long-standing problem in both image processing and unsupervised learning. Many traditional methods estimate the number of clusters by repeatedly running a clustering algorithm with different values and comparing the resulting performance. One influential contribution to this area is the prediction-based resampling approach proposed by Dudoit and Fridlyand, which evaluates cluster stability to estimate the number of meaningful groups in a dataset.&lt;br /&gt;
&lt;br /&gt;
Popular practical techniques such as the Elbow Method and the Gap Statistic follow similar ideas. The Elbow Method selects the number of clusters based on the point where improvements in clustering quality begin to diminish. The Gap Statistic compares clustering performance on real data against random data and selects the number of clusters that shows the largest improvement over chance. While effective, these methods require multiple clustering runs, which can be computationally expensive for large images or datasets.&lt;br /&gt;
&lt;br /&gt;
==== Motivation for Image-Derived Cluster Estimation ====&lt;br /&gt;
&lt;br /&gt;
The ideas underlying perceptual color spaces, histogram analysis, and cluster number estimation suggest that useful information about segmentation complexity is already embedded in the image itself. Rather than repeatedly running clustering algorithms, it may be possible to estimate the number of color clusters directly from image-derived statistics.&lt;br /&gt;
&lt;br /&gt;
This project builds on these foundations by analyzing perceptual lightness variation, chromatic spread, and histogram structure within the CIELAB color space. By combining these cues into a single formulation, the goal is to estimate the number of meaningful color clusters efficiently, reducing computational cost while maintaining reliable segmentation performance.&lt;br /&gt;
&lt;br /&gt;
== Methods ==&lt;br /&gt;
&lt;br /&gt;
==== Proposed Method ====&lt;br /&gt;
The proposed method consists of three main stages. First, the input image is converted from the three-channel RGB color space to the CIELAB (Lab*) color space. Separate histograms are then extracted for the L, a, and b channels. Second, two statistical parameters are computed from each histogram: the standard deviation and the number of local maxima. These values characterize the spread and structure of lightness and color information in the image. Finally, the optimal number of color clusters is estimated using the CIELAB Color Segment Estimation (CCSE) function, defined as:&lt;br /&gt;
&lt;br /&gt;
[[File:sisiformula.png|caption]]&lt;br /&gt;
&lt;br /&gt;
In this equation, σ_L denotes the standard deviation of the L-channel histogram, while n_L, n_a, and n_b represent the number of local maxima detected in the L, a, and b histograms, respectively. The term max(n_a, n_b) selects the channel with the strongest chromatic variation, and min(n_a, n_b) represents the weaker chromatic channel. A complete overview of the method is illustrated in the processing pipeline shown in Figure 3. It should be noted that the method requires input images to be in standard three-channel RGB format.&lt;br /&gt;
&lt;br /&gt;
==== Color Histogram ====&lt;br /&gt;
Color information in an image can be represented using several descriptors, including color histograms, color correlograms, color coherence vectors, and color moments. Among these, the color histogram is one of the most widely used representations due to its simplicity and effectiveness, particularly when the color distribution of an image is distinct from that of other images in a dataset.&lt;br /&gt;
&lt;br /&gt;
In this method, information is extracted from the L, a, and b histograms by analyzing their standard deviations and the number of local maxima. These metrics capture important characteristics of the image and motivate the design of the CCSE function:&lt;br /&gt;
&lt;br /&gt;
* Lightness distribution: The standard deviation of the L histogram indicates the range of lightness values present in the image. A higher standard deviation corresponds to a wider range of brightness levels, while a lower value suggests a more uniform lightness distribution.&lt;br /&gt;
&lt;br /&gt;
* Color distribution: The standard deviations of the a and b histograms reflect the diversity of chromatic information in the image. Larger values indicate a broader color palette, whereas smaller values imply limited color variation.&lt;br /&gt;
&lt;br /&gt;
* Peak separability: The number of local maxima in the L, a, and b histograms provides insight into how well different lightness and color levels are separated. A larger number of local maxima suggests distinct and separable color or intensity regions, while fewer maxima indicate more tightly clustered values.&lt;br /&gt;
&lt;br /&gt;
* Image complexity: Together, the standard deviations and local maxima across all three channels provide an estimate of overall image complexity. Images with larger spreads and more histogram peaks are considered more complex, whereas images with fewer peaks and narrower distributions are simpler.&lt;br /&gt;
&lt;br /&gt;
Overall, histogram analysis offers a compact yet informative description of an image’s lightness and color structure, which is valuable for segmentation and object recognition tasks.&lt;br /&gt;
&lt;br /&gt;
==== CCSE Function ====&lt;br /&gt;
The term ⌊ ln( σ_L / n_L ) ⌋ computes the logarithm of the ratio between the standard deviation of the L histogram and the number of its local maxima. This ratio captures the relationship between the overall spread of lightness values and the degree of separability among different lightness levels. Applying the logarithm helps normalize the scale and reduces sensitivity to extreme values. The floor operation ensures that the resulting cluster estimate remains an integer. This formulation also prevents the estimated number of clusters from becoming too small in cases where the image contains colors with very similar hues and low lightness variation.&lt;br /&gt;
&lt;br /&gt;
Multiplying by max(n_a, n_b) emphasizes the chromatic channel with the greatest number of distinct peaks, which typically corresponds to the dominant source of color variation in the image. Relying only on the weaker chromatic channel could lead to underestimation of the number of required color segments.&lt;br /&gt;
&lt;br /&gt;
At the same time, adding min(n_a, n_b) ensures that information from the less dominant chromatic channel is not ignored. While the channel with stronger variation should carry more weight, incorporating the weaker channel contributes to a more balanced and accurate estimation of the number of color clusters.&lt;br /&gt;
&lt;br /&gt;
==== Time Complexity ====&lt;br /&gt;
The time complexity of the proposed method can be analyzed by examining each step of the algorithm. Let N denote the total number of pixels in the image. Converting the image from RGB to CIELAB color space requires O(N) time. Computing the histograms for the three channels also takes O(N) time. Since each histogram contains at most 256 bins, the process of detecting local maxima can be treated as a constant-time operation. All mathematical operations used in the CCSE function have constant time complexity. Any additional looping over pixels has a worst-case complexity of O(N).&lt;br /&gt;
&lt;br /&gt;
As a result, the overall time complexity of the proposed method is O(N), making it efficient and scalable for high-resolution images.&lt;/div&gt;</summary>
		<author><name>Sisira2</name></author>
	</entry>
	<entry>
		<id>http://vista.su.domains/psych221wiki/index.php?title=Smart_Cluster_Selection_for_CIELAB_Color_Segmentation&amp;diff=146012</id>
		<title>Smart Cluster Selection for CIELAB Color Segmentation</title>
		<link rel="alternate" type="text/html" href="http://vista.su.domains/psych221wiki/index.php?title=Smart_Cluster_Selection_for_CIELAB_Color_Segmentation&amp;diff=146012"/>
		<updated>2025-12-13T04:59:01Z</updated>

		<summary type="html">&lt;p&gt;Sisira2: /* Proposed Method */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction ==&lt;br /&gt;
Image segmentation is a fundamental step in many computer vision applications because it allows algorithms to separate meaningful regions, identify objects, and reduce the complexity of visual scenes. Color is one of the most informative cues for distinguishing visual elements, which is why color-based segmentation methods are commonly used. In particular, clustering techniques group pixels that have similar color characteristics, making them effective for isolating regions with shared appearance. &lt;br /&gt;
&lt;br /&gt;
A major challenge in color-based segmentation is determining the appropriate number of color clusters for a given image. If too few clusters are chosen, under-segmentation occurs and important details may be merged into a single region. If too many clusters are used, over-segmentation can happen, causing noise or small variations in color to form separate, meaningless regions. In many practical settings, the number of clusters is selected manually or determined using methods that require extensive computation. Common techniques such as the Elbow Method and the Gap Statistic address this problem by repeatedly running clustering algorithms like K-Means while testing different numbers of clusters. Although effective, this repeated evaluation becomes computationally expensive for high-resolution images or large datasets. As a result, these methods are often unsuitable for real-time systems or applications that must process many images efficiently. &lt;br /&gt;
&lt;br /&gt;
This project proposes an alternative approach that estimates the ideal number of color clusters directly from the statistical properties of the image. Instead of testing many cluster counts, the method analyzes perceptual lightness variation, the distribution of chromatic information, and the shapes of color histograms in the CIELAB color space. By examining these characteristics, the approach aims to infer how many meaningful color groups are present in the image. The overall goal is to develop a faster and more scalable solution that maintains reliable segmentation performance while significantly reducing computational cost.&lt;br /&gt;
&lt;br /&gt;
== Background ==&lt;br /&gt;
==== Color-Based Image Segmentation ====&lt;br /&gt;
&lt;br /&gt;
Color-based segmentation aims to partition an image into meaningful regions by grouping pixels with similar color properties. This approach relies on representing pixel values in a color space where numerical differences correspond to perceptual differences. One commonly used color space for this purpose is CIELAB (L*a*b*), which separates lightness from chromatic information. This separation allows brightness variations to be treated independently from color differences, which is especially useful in real-world images with varying illumination.&lt;br /&gt;
&lt;br /&gt;
CIELAB is designed to be approximately perceptually uniform, meaning that equal distances in the color space correspond to roughly equal perceived color differences. As a result, Euclidean distance in CIELAB provides a meaningful measure of color similarity. This property makes CIELAB well suited for clustering-based segmentation methods, color quantization, and visual analysis tasks.&lt;br /&gt;
&lt;br /&gt;
==== Statistical and Histogram-Based Methods ====&lt;br /&gt;
&lt;br /&gt;
Many image segmentation techniques rely on statistical summaries of color distributions to guide decision-making. These methods include edge-based approaches, region-growing techniques, and clustering algorithms such as K-Means, Mean Shift, and Gaussian Mixture Models. A common component across these approaches is the analysis of color histograms, which capture how frequently different color values occur in an image.&lt;br /&gt;
&lt;br /&gt;
Histogram analysis can reveal dominant color regions, transitions between areas, and the overall complexity of a scene. In particular, local maxima in color histograms are often interpreted as significant color groups or object components. By examining the number and prominence of these peaks, it is possible to gain insight into how many meaningful color regions may be present in an image without performing full segmentation.&lt;br /&gt;
&lt;br /&gt;
==== Estimating the Number of Clusters ====&lt;br /&gt;
&lt;br /&gt;
Determining the appropriate number of clusters is a long-standing problem in both image processing and unsupervised learning. Many traditional methods estimate the number of clusters by repeatedly running a clustering algorithm with different values and comparing the resulting performance. One influential contribution to this area is the prediction-based resampling approach proposed by Dudoit and Fridlyand, which evaluates cluster stability to estimate the number of meaningful groups in a dataset.&lt;br /&gt;
&lt;br /&gt;
Popular practical techniques such as the Elbow Method and the Gap Statistic follow similar ideas. The Elbow Method selects the number of clusters based on the point where improvements in clustering quality begin to diminish. The Gap Statistic compares clustering performance on real data against random data and selects the number of clusters that shows the largest improvement over chance. While effective, these methods require multiple clustering runs, which can be computationally expensive for large images or datasets.&lt;br /&gt;
&lt;br /&gt;
==== Motivation for Image-Derived Cluster Estimation ====&lt;br /&gt;
&lt;br /&gt;
The ideas underlying perceptual color spaces, histogram analysis, and cluster number estimation suggest that useful information about segmentation complexity is already embedded in the image itself. Rather than repeatedly running clustering algorithms, it may be possible to estimate the number of color clusters directly from image-derived statistics.&lt;br /&gt;
&lt;br /&gt;
This project builds on these foundations by analyzing perceptual lightness variation, chromatic spread, and histogram structure within the CIELAB color space. By combining these cues into a single formulation, the goal is to estimate the number of meaningful color clusters efficiently, reducing computational cost while maintaining reliable segmentation performance.&lt;br /&gt;
&lt;br /&gt;
== Methods ==&lt;br /&gt;
&lt;br /&gt;
==== Proposed Method ====&lt;br /&gt;
The proposed method consists of three main stages. First, the input image is converted from the three-channel RGB color space to the CIELAB (Lab*) color space. Separate histograms are then extracted for the L, a, and b channels. Second, two statistical parameters are computed from each histogram: the standard deviation and the number of local maxima. These values characterize the spread and structure of lightness and color information in the image. Finally, the optimal number of color clusters is estimated using the CIELAB Color Segment Estimation (CCSE) function, defined as:&lt;br /&gt;
&lt;br /&gt;
[[File:sisiformula.png|caption]]&lt;br /&gt;
&lt;br /&gt;
In this equation, σ_L denotes the standard deviation of the L-channel histogram, while n_L, n_a, and n_b represent the number of local maxima detected in the L, a, and b histograms, respectively. The term max(n_a, n_b) selects the channel with the strongest chromatic variation, and min(n_a, n_b) represents the weaker chromatic channel. A complete overview of the method is illustrated in the processing pipeline shown in Figure 3. It should be noted that the method requires input images to be in standard three-channel RGB format.&lt;br /&gt;
&lt;br /&gt;
==== Color Histogram ====&lt;br /&gt;
Color information in an image can be represented using several descriptors, including color histograms, color correlograms, color coherence vectors, and color moments. Among these, the color histogram is one of the most widely used representations due to its simplicity and effectiveness, particularly when the color distribution of an image is distinct from that of other images in a dataset.&lt;br /&gt;
&lt;br /&gt;
In this method, information is extracted from the L, a, and b histograms by analyzing their standard deviations and the number of local maxima. These metrics capture important characteristics of the image and motivate the design of the CCSE function:&lt;br /&gt;
&lt;br /&gt;
* Lightness distribution: The standard deviation of the L histogram indicates the range of lightness values present in the image. A higher standard deviation corresponds to a wider range of brightness levels, while a lower value suggests a more uniform lightness distribution.&lt;br /&gt;
&lt;br /&gt;
* Color distribution: The standard deviations of the a and b histograms reflect the diversity of chromatic information in the image. Larger values indicate a broader color palette, whereas smaller values imply limited color variation.&lt;br /&gt;
&lt;br /&gt;
* Peak separability: The number of local maxima in the L, a, and b histograms provides insight into how well different lightness and color levels are separated. A larger number of local maxima suggests distinct and separable color or intensity regions, while fewer maxima indicate more tightly clustered values.&lt;br /&gt;
&lt;br /&gt;
* Image complexity: Together, the standard deviations and local maxima across all three channels provide an estimate of overall image complexity. Images with larger spreads and more histogram peaks are considered more complex, whereas images with fewer peaks and narrower distributions are simpler.&lt;br /&gt;
&lt;br /&gt;
Overall, histogram analysis offers a compact yet informative description of an image’s lightness and color structure, which is valuable for segmentation and object recognition tasks.&lt;br /&gt;
&lt;br /&gt;
==== CCSE Function ====&lt;br /&gt;
The term ⌊ ln( σ_L / n_L ) ⌋ computes the logarithm of the ratio between the standard deviation of the L histogram and the number of its local maxima. This ratio captures the relationship between the overall spread of lightness values and the degree of separability among different lightness levels. Applying the logarithm helps normalize the scale and reduces sensitivity to extreme values. The floor operation ensures that the resulting cluster estimate remains an integer. This formulation also prevents the estimated number of clusters from becoming too small in cases where the image contains colors with very similar hues and low lightness variation.&lt;br /&gt;
&lt;br /&gt;
Multiplying by max(n_a, n_b) emphasizes the chromatic channel with the greatest number of distinct peaks, which typically corresponds to the dominant source of color variation in the image. Relying only on the weaker chromatic channel could lead to underestimation of the number of required color segments.&lt;br /&gt;
&lt;br /&gt;
At the same time, adding min(n_a, n_b) ensures that information from the less dominant chromatic channel is not ignored. While the channel with stronger variation should carry more weight, incorporating the weaker channel contributes to a more balanced and accurate estimation of the number of color clusters.&lt;br /&gt;
&lt;br /&gt;
==== Time Complexity ====&lt;br /&gt;
The time complexity of the proposed method can be analyzed by examining each step of the algorithm. Let N denote the total number of pixels in the image. Converting the image from RGB to CIELAB color space requires O(N) time. Computing the histograms for the three channels also takes O(N) time.&lt;br /&gt;
&lt;br /&gt;
Since each histogram contains at most 256 bins, the process of detecting local maxima can be treated as a constant-time operation. All mathematical operations used in the CCSE function have constant time complexity. Any additional looping over pixels has a worst-case complexity of O(N).&lt;br /&gt;
&lt;br /&gt;
As a result, the overall time complexity of the proposed method is O(N), making it efficient and scalable for high-resolution images.&lt;/div&gt;</summary>
		<author><name>Sisira2</name></author>
	</entry>
	<entry>
		<id>http://vista.su.domains/psych221wiki/index.php?title=File:Sisiformula.png&amp;diff=146011</id>
		<title>File:Sisiformula.png</title>
		<link rel="alternate" type="text/html" href="http://vista.su.domains/psych221wiki/index.php?title=File:Sisiformula.png&amp;diff=146011"/>
		<updated>2025-12-13T04:50:01Z</updated>

		<summary type="html">&lt;p&gt;Sisira2: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Sisira2</name></author>
	</entry>
	<entry>
		<id>http://vista.su.domains/psych221wiki/index.php?title=Smart_Cluster_Selection_for_CIELAB_Color_Segmentation&amp;diff=146010</id>
		<title>Smart Cluster Selection for CIELAB Color Segmentation</title>
		<link rel="alternate" type="text/html" href="http://vista.su.domains/psych221wiki/index.php?title=Smart_Cluster_Selection_for_CIELAB_Color_Segmentation&amp;diff=146010"/>
		<updated>2025-12-13T04:48:46Z</updated>

		<summary type="html">&lt;p&gt;Sisira2: Created page with &amp;quot;== Introduction == Image segmentation is a fundamental step in many computer vision applications because it allows algorithms to separate meaningful regions, identify objects, and reduce the complexity of visual scenes. Color is one of the most informative cues for distinguishing visual elements, which is why color-based segmentation methods are commonly used. In particular, clustering techniques group pixels that have similar color characteristics, making them effective...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction ==&lt;br /&gt;
Image segmentation is a fundamental step in many computer vision applications because it allows algorithms to separate meaningful regions, identify objects, and reduce the complexity of visual scenes. Color is one of the most informative cues for distinguishing visual elements, which is why color-based segmentation methods are commonly used. In particular, clustering techniques group pixels that have similar color characteristics, making them effective for isolating regions with shared appearance. &lt;br /&gt;
&lt;br /&gt;
A major challenge in color-based segmentation is determining the appropriate number of color clusters for a given image. If too few clusters are chosen, under-segmentation occurs and important details may be merged into a single region. If too many clusters are used, over-segmentation can happen, causing noise or small variations in color to form separate, meaningless regions. In many practical settings, the number of clusters is selected manually or determined using methods that require extensive computation. Common techniques such as the Elbow Method and the Gap Statistic address this problem by repeatedly running clustering algorithms like K-Means while testing different numbers of clusters. Although effective, this repeated evaluation becomes computationally expensive for high-resolution images or large datasets. As a result, these methods are often unsuitable for real-time systems or applications that must process many images efficiently. &lt;br /&gt;
&lt;br /&gt;
This project proposes an alternative approach that estimates the ideal number of color clusters directly from the statistical properties of the image. Instead of testing many cluster counts, the method analyzes perceptual lightness variation, the distribution of chromatic information, and the shapes of color histograms in the CIELAB color space. By examining these characteristics, the approach aims to infer how many meaningful color groups are present in the image. The overall goal is to develop a faster and more scalable solution that maintains reliable segmentation performance while significantly reducing computational cost.&lt;br /&gt;
&lt;br /&gt;
== Background ==&lt;br /&gt;
==== Color-Based Image Segmentation ====&lt;br /&gt;
&lt;br /&gt;
Color-based segmentation aims to partition an image into meaningful regions by grouping pixels with similar color properties. This approach relies on representing pixel values in a color space where numerical differences correspond to perceptual differences. One commonly used color space for this purpose is CIELAB (L*a*b*), which separates lightness from chromatic information. This separation allows brightness variations to be treated independently from color differences, which is especially useful in real-world images with varying illumination.&lt;br /&gt;
&lt;br /&gt;
CIELAB is designed to be approximately perceptually uniform, meaning that equal distances in the color space correspond to roughly equal perceived color differences. As a result, Euclidean distance in CIELAB provides a meaningful measure of color similarity. This property makes CIELAB well suited for clustering-based segmentation methods, color quantization, and visual analysis tasks.&lt;br /&gt;
&lt;br /&gt;
==== Statistical and Histogram-Based Methods ====&lt;br /&gt;
&lt;br /&gt;
Many image segmentation techniques rely on statistical summaries of color distributions to guide decision-making. These methods include edge-based approaches, region-growing techniques, and clustering algorithms such as K-Means, Mean Shift, and Gaussian Mixture Models. A common component across these approaches is the analysis of color histograms, which capture how frequently different color values occur in an image.&lt;br /&gt;
&lt;br /&gt;
Histogram analysis can reveal dominant color regions, transitions between areas, and the overall complexity of a scene. In particular, local maxima in color histograms are often interpreted as significant color groups or object components. By examining the number and prominence of these peaks, it is possible to gain insight into how many meaningful color regions may be present in an image without performing full segmentation.&lt;br /&gt;
&lt;br /&gt;
==== Estimating the Number of Clusters ====&lt;br /&gt;
&lt;br /&gt;
Determining the appropriate number of clusters is a long-standing problem in both image processing and unsupervised learning. Many traditional methods estimate the number of clusters by repeatedly running a clustering algorithm with different values and comparing the resulting performance. One influential contribution to this area is the prediction-based resampling approach proposed by Dudoit and Fridlyand, which evaluates cluster stability to estimate the number of meaningful groups in a dataset.&lt;br /&gt;
&lt;br /&gt;
Popular practical techniques such as the Elbow Method and the Gap Statistic follow similar ideas. The Elbow Method selects the number of clusters based on the point where improvements in clustering quality begin to diminish. The Gap Statistic compares clustering performance on real data against random data and selects the number of clusters that shows the largest improvement over chance. While effective, these methods require multiple clustering runs, which can be computationally expensive for large images or datasets.&lt;br /&gt;
&lt;br /&gt;
==== Motivation for Image-Derived Cluster Estimation ====&lt;br /&gt;
&lt;br /&gt;
The ideas underlying perceptual color spaces, histogram analysis, and cluster number estimation suggest that useful information about segmentation complexity is already embedded in the image itself. Rather than repeatedly running clustering algorithms, it may be possible to estimate the number of color clusters directly from image-derived statistics.&lt;br /&gt;
&lt;br /&gt;
This project builds on these foundations by analyzing perceptual lightness variation, chromatic spread, and histogram structure within the CIELAB color space. By combining these cues into a single formulation, the goal is to estimate the number of meaningful color clusters efficiently, reducing computational cost while maintaining reliable segmentation performance.&lt;br /&gt;
&lt;br /&gt;
== Methods ==&lt;br /&gt;
&lt;br /&gt;
==== Proposed Method ====&lt;br /&gt;
The proposed method consists of three main stages. First, the input image is converted from the three-channel RGB color space to the CIELAB (Lab*) color space. Separate histograms are then extracted for the L, a, and b channels. Second, two statistical parameters are computed from each histogram: the standard deviation and the number of local maxima. These values characterize the spread and structure of lightness and color information in the image. Finally, the optimal number of color clusters is estimated using the CIELAB Color Segment Estimation (CCSE) function, defined as:&lt;br /&gt;
&lt;br /&gt;
[[File:example.jpg|caption]]&lt;br /&gt;
&lt;br /&gt;
In this equation, σ_L denotes the standard deviation of the L-channel histogram, while n_L, n_a, and n_b represent the number of local maxima detected in the L, a, and b histograms, respectively. The term max(n_a, n_b) selects the channel with the strongest chromatic variation, and min(n_a, n_b) represents the weaker chromatic channel. A complete overview of the method is illustrated in the processing pipeline shown in Figure 3. It should be noted that the method requires input images to be in standard three-channel RGB format.&lt;br /&gt;
&lt;br /&gt;
==== Color Histogram ====&lt;br /&gt;
Color information in an image can be represented using several descriptors, including color histograms, color correlograms, color coherence vectors, and color moments. Among these, the color histogram is one of the most widely used representations due to its simplicity and effectiveness, particularly when the color distribution of an image is distinct from that of other images in a dataset.&lt;br /&gt;
&lt;br /&gt;
In this method, information is extracted from the L, a, and b histograms by analyzing their standard deviations and the number of local maxima. These metrics capture important characteristics of the image and motivate the design of the CCSE function:&lt;br /&gt;
&lt;br /&gt;
* Lightness distribution: The standard deviation of the L histogram indicates the range of lightness values present in the image. A higher standard deviation corresponds to a wider range of brightness levels, while a lower value suggests a more uniform lightness distribution.&lt;br /&gt;
&lt;br /&gt;
* Color distribution: The standard deviations of the a and b histograms reflect the diversity of chromatic information in the image. Larger values indicate a broader color palette, whereas smaller values imply limited color variation.&lt;br /&gt;
&lt;br /&gt;
* Peak separability: The number of local maxima in the L, a, and b histograms provides insight into how well different lightness and color levels are separated. A larger number of local maxima suggests distinct and separable color or intensity regions, while fewer maxima indicate more tightly clustered values.&lt;br /&gt;
&lt;br /&gt;
* Image complexity: Together, the standard deviations and local maxima across all three channels provide an estimate of overall image complexity. Images with larger spreads and more histogram peaks are considered more complex, whereas images with fewer peaks and narrower distributions are simpler.&lt;br /&gt;
&lt;br /&gt;
Overall, histogram analysis offers a compact yet informative description of an image’s lightness and color structure, which is valuable for segmentation and object recognition tasks.&lt;br /&gt;
&lt;br /&gt;
==== CCSE Function ====&lt;br /&gt;
The term ⌊ ln( σ_L / n_L ) ⌋ computes the logarithm of the ratio between the standard deviation of the L histogram and the number of its local maxima. This ratio captures the relationship between the overall spread of lightness values and the degree of separability among different lightness levels. Applying the logarithm helps normalize the scale and reduces sensitivity to extreme values. The floor operation ensures that the resulting cluster estimate remains an integer. This formulation also prevents the estimated number of clusters from becoming too small in cases where the image contains colors with very similar hues and low lightness variation.&lt;br /&gt;
&lt;br /&gt;
Multiplying by max(n_a, n_b) emphasizes the chromatic channel with the greatest number of distinct peaks, which typically corresponds to the dominant source of color variation in the image. Relying only on the weaker chromatic channel could lead to underestimation of the number of required color segments.&lt;br /&gt;
&lt;br /&gt;
At the same time, adding min(n_a, n_b) ensures that information from the less dominant chromatic channel is not ignored. While the channel with stronger variation should carry more weight, incorporating the weaker channel contributes to a more balanced and accurate estimation of the number of color clusters.&lt;br /&gt;
&lt;br /&gt;
==== Time Complexity ====&lt;br /&gt;
The time complexity of the proposed method can be analyzed by examining each step of the algorithm. Let N denote the total number of pixels in the image. Converting the image from RGB to CIELAB color space requires O(N) time. Computing the histograms for the three channels also takes O(N) time.&lt;br /&gt;
&lt;br /&gt;
Since each histogram contains at most 256 bins, the process of detecting local maxima can be treated as a constant-time operation. All mathematical operations used in the CCSE function have constant time complexity. Any additional looping over pixels has a worst-case complexity of O(N).&lt;br /&gt;
&lt;br /&gt;
As a result, the overall time complexity of the proposed method is O(N), making it efficient and scalable for high-resolution images.&lt;/div&gt;</summary>
		<author><name>Sisira2</name></author>
	</entry>
	<entry>
		<id>http://vista.su.domains/psych221wiki/index.php?title=Psych221-Projects-2025-Fall&amp;diff=146009</id>
		<title>Psych221-Projects-2025-Fall</title>
		<link rel="alternate" type="text/html" href="http://vista.su.domains/psych221wiki/index.php?title=Psych221-Projects-2025-Fall&amp;diff=146009"/>
		<updated>2025-12-13T04:09:01Z</updated>

		<summary type="html">&lt;p&gt;Sisira2: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[http://vista.su.domains/psych221wiki/index.php?title=Main_Page#Psych221  Return to Psych 221 Main Page]&lt;br /&gt;
&lt;br /&gt;
There are two deliverables for the project:&lt;br /&gt;
# A group presentation&lt;br /&gt;
# A wiki-style project page write-up&lt;br /&gt;
&lt;br /&gt;
* The write-up should roughly follow [http://vista.su.domains/psych221wiki/index.php?title=Project_Guidelines this organization from the Project Guidelines Page]&lt;br /&gt;
* Please visit [https://www.mediawiki.org/wiki/Help:Editing_pages MediaWiki&#039;s editing help page].&lt;br /&gt;
&lt;br /&gt;
== To set up your project&#039;s page ==&lt;br /&gt;
* Log in to this wiki with the username and password you created.&lt;br /&gt;
* Edit the Projects section of this page (just below). Do this by clicking on &amp;quot;[edit]&amp;quot; to the right of each section title. &lt;br /&gt;
* Make a new line for your project using the format shown below, pasting the line for your project under the last item/group. The first part of the text within the double brackets is the name of the new page.  This must be unique, and putting the group member names is a safest way to assure this. The second part, after &#039;|&#039; is the displayed text and can be your project title.&lt;br /&gt;
* Save the Project section by clicking the Save button at the bottom of the page&lt;br /&gt;
* Finally, click on the link for your project.  This will take you to a new blank page that you can edit.  You can use the basic format for your page that is in the Sample Project.&lt;br /&gt;
* Math tip: Use the tags &amp;amp;lt;math&amp;amp;gt; and &amp;amp;lt;/math&amp;amp;gt; to wrap an equation. For example, this code:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt; &amp;lt;math&amp;gt; a + b = c^2 &amp;lt;/math&amp;gt; &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Renders as this equation:&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;a + b = c^2&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Uploading images - Use the &amp;quot;upload file&amp;quot; link at the upper right of the page.  Do a Google Search to learn &amp;quot;What is the syntax for inserting an uploaded image file into the wikimedia page?&amp;quot;&lt;br /&gt;
&lt;br /&gt;
==Projects for Psych 221 (2025-2026)==&lt;br /&gt;
# [[WandellFarrellLian|Sample Project]]&lt;br /&gt;
#* Brian Wandell, Joyce Farrell, David Cardinal, Hyunwoo Gu.&lt;br /&gt;
# [[Pokemon Color Transfer|Pokemon Color Transfer]]&lt;br /&gt;
#* Wenxiao Cai, Yifei Deng&lt;br /&gt;
# [[ISETHDR CV Experiment|ISETHDR CV Experiment]]&lt;br /&gt;
#* Gray Kim, Louise Schul&lt;br /&gt;
# [[ISETBIO Baseball Simulation Experiment|ISETBIO Baseball Simulation Experiment]]&lt;br /&gt;
#* Alex Lipman&lt;br /&gt;
# [[Evaluation Pipeline with GenAI-Assisted Algorithm Development for Virtual Image Denoising and Pixel-Defect Correction|Evaluation Pipeline with GenAI-Assisted Algorithm Development for Virtual Image Denoising and Pixel-Defect Correction]]&lt;br /&gt;
#* Stephanie Chang, Yulin Deng&lt;br /&gt;
# [[Simulation of Optical Response in Oral Tissue]]&lt;br /&gt;
#* Sylvia Chin, Lise Brisson&lt;br /&gt;
# [[Neural Network Implementation of S-CIELAB for Perceptual Color Metrics]]&lt;br /&gt;
#* Anna Yu, Shu An&lt;br /&gt;
#[[The Optics of Weaving: Linearity, Reflectance, and Spatial Frequency Simulation]]&lt;br /&gt;
#* Dominique Schleider&lt;br /&gt;
# [[The Statistical Footprint of AI-Generated Images]] (work in progress)&lt;br /&gt;
#* Michael Sommeling&lt;br /&gt;
# [[Imaging Strategies for Enhancing Blood Visibility in Oral Tissue]]&lt;br /&gt;
#* Rubina Shrestha, Réne Nerio Martinez&lt;br /&gt;
# [[Smart Cluster Selection for CIELAB Color Segmentation]]&lt;br /&gt;
#* Sisira Aarukapalli&lt;/div&gt;</summary>
		<author><name>Sisira2</name></author>
	</entry>
</feed>