<!DOCTYPE article PUBLIC "-//NLM//DTD JATS (Z39.96) Journal Archiving and Interchange DTD v1.0 20120330//EN" "JATS-archivearticle1.dtd">
<article xmlns:xlink="http://www.w3.org/1999/xlink">
  <front>
    <journal-meta>
      <journal-title-group>
        <journal-title>V. Vysotska);</journal-title>
      </journal-title-group>
    </journal-meta>
    <article-meta>
      <title-group>
        <article-title>Fast Color Images Clustering for Real-Time Computer Vision and AI System</article-title>
      </title-group>
      <contrib-group>
        <contrib contrib-type="author">
          <string-name>Victoria Vysotska</string-name>
          <email>victoria.a.vysotska@lpnu.ua</email>
          <xref ref-type="aff" rid="aff1">1</xref>
        </contrib>
        <contrib contrib-type="author">
          <string-name>Kirill Smelyakov</string-name>
          <email>kyrylo.smelyakov@nure.ua</email>
          <xref ref-type="aff" rid="aff0">0</xref>
        </contrib>
        <contrib contrib-type="author">
          <string-name>Nataliia Sharonova</string-name>
          <email>nvsharonova@ukr.net</email>
          <xref ref-type="aff" rid="aff2">2</xref>
        </contrib>
        <contrib contrib-type="author">
          <string-name>Eugen Vakulik</string-name>
          <email>yevhen.vakulik@nure.ua</email>
          <xref ref-type="aff" rid="aff0">0</xref>
        </contrib>
        <contrib contrib-type="author">
          <string-name>Oleksii Filipov</string-name>
          <email>oleksii.filipov@nure.ua</email>
          <xref ref-type="aff" rid="aff0">0</xref>
        </contrib>
        <contrib contrib-type="author">
          <string-name>Ruslan Kotelnykov</string-name>
          <email>ruslan.kotelnykov@nure.ua</email>
          <xref ref-type="aff" rid="aff0">0</xref>
        </contrib>
        <aff id="aff0">
          <label>0</label>
          <institution>Kharkiv National University of Radio Electronics</institution>
          ,
          <addr-line>Nauky Ave. 14, Kharkiv, 61166</addr-line>
          ,
          <country country="UA">Ukraine</country>
        </aff>
        <aff id="aff1">
          <label>1</label>
          <institution>Lviv Polytechnic National University</institution>
          ,
          <addr-line>Stepan Bandera Street, 12, Lviv, 79013</addr-line>
          ,
          <country country="UA">Ukraine</country>
        </aff>
        <aff id="aff2">
          <label>2</label>
          <institution>National Technical University "KhPI"</institution>
          ,
          <addr-line>Kyrpychova str. 2, Kharkiv, 61002</addr-line>
          ,
          <country country="UA">Ukraine</country>
        </aff>
      </contrib-group>
      <pub-date>
        <year>1809</year>
      </pub-date>
      <volume>000</volume>
      <fpage>0</fpage>
      <lpage>0001</lpage>
      <abstract>
        <p>The article describes the development of a color image clustering algorithm for a real-time computer vision and AI system. An important feature of the algorithm is the preliminary use of a large number of fast image preprocessing algorithms to optimize the preparation of data for efficient clustering in the color space. The proposed clustering algorithm is focused on processing clusters of arbitrary shape. The paper presents the results of experiments on the processing of monochromatic and non-monochromatic color images. These clustering results are shown as images and as clusters in the Unity environment. Recommendations for practical use, conclusions and links to repositories of experiment results are given. The analysis of the results of a large number of experiments shows that the proposed adaptive clustering algorithm can be effectively used both in powerful computer vision and artificial intelligence systems and in relatively low-power embedded systems by adjusting the parameters to the specifics of the problem</p>
      </abstract>
      <kwd-group>
        <kwd>eol&gt;Fast Clustering</kwd>
        <kwd>Color Image</kwd>
        <kwd>Preprocessing</kwd>
        <kwd>Grid Model</kwd>
        <kwd>Adaptation</kwd>
        <kwd>Efficiency Estimation 1</kwd>
      </kwd-group>
    </article-meta>
  </front>
  <body>
    <sec id="sec-1">
      <title>1. Introduction</title>
      <p>
        The development of innovative tools [
        <xref ref-type="bibr" rid="ref1">1-3</xref>
        ] and modern technologies for pattern recognition [4,
5] in our time is increasingly focused on the use of new models and algorithms of artificial
intelligence (AI) [6], primarily clustering, artificial neural networks (NN) and classification.
Although, pre-processing models [
        <xref ref-type="bibr" rid="ref1">1, 6</xref>
        ], solutions in the fields of ICT [7], in robotics with use of
embedded systems [8-10] and security systems [11-13] are also of great interest in some aspects.
      </p>
      <p>Such a great interest in artificial intelligence systems is associated with their effective
application in pattern recognition systems, which are enjoying commercial success. Currently,
such (data-centric business) systems and applications are successfully used to search for goods
in online stores using Image Based Search technology. In car and biometric identification systems,
contactless payment systems in supermarkets based on face recognition technology, in many
other applications.</p>
      <p>Concerning clustering, a large number of new models and algorithms have been proposed in
recent years. At the same time, not all of them meet modern requirements in terms of
computational efficiency, especially when used in embedded systems. What is the reason for this?</p>
      <p>
        Most of the algorithms iteratively recalculate the position of the centers over all observations
of the cluster. The problem is that the number of observations may be too large. Taking into
account the size of modern images (from 8 to 64 MP), the number of observations in dense
clusters and their surroundings can be estimated in hundreds of thousands [
        <xref ref-type="bibr" rid="ref1">1</xref>
        ].
      </p>
      <p>At the same time, classic algorithms such as k-means, mean shift, and their analogs and
modifications are relatively efficient at the construction of spherical clusters because of the usage
of the distance function. However, they have problems with building arbitrary shaped clusters.</p>
      <p>As a result, clustering becomes a bottleneck in modern computer vision algorithms. Therefore,
despite all the advantages of clustering, it is often abandoned due to the unacceptable
computational complexity and/or inadequacy of processing clusters of arbitrary shape.</p>
      <p>To solve these problems, in this work we propose a fast algorithm for constructing clusters of
arbitrary shape. The parameterization of the algorithm makes it possible to effectively adapt it
both for relatively powerful server systems and relatively less powerful embedded systems.
Unless otherwise stated, the input data is a color image in RGB format.</p>
    </sec>
    <sec id="sec-2">
      <title>2. Related Works</title>
      <p>In recent decades, the k-means clustering method has gained wide popularity in image analysis,
serving as an effective and powerful tool for data grouping. Clustering color images using k-means
is an active area of research that attracts the attention of researchers in the fields of computer
vision and image processing.</p>
      <p>In their works, the authors explore the application of the k-means algorithm in various
domains of human activity, such as color image quantization [14], sky image segmentation [15]
and medicine[16].</p>
      <p>The authors introduces a clustering algorithm to address cluster size bias, a common issue in
conventional methods like K-means [17]. While balanced K-means provides equal-sized clusters,
it is slow. The proposed heuristic algorithm offers a faster alternative with reduced bias. It
successively divides larger clusters and optimizes centroids when the desired number is reached,
allowing for bias and error adjustment.</p>
      <p>The accurate estimation of the number of materials in a hyperspectral image is crucial for
various hyperspectral image-processing tasks, such as classification and unmixing. In a work [18],
authors introduced an algorithm utilizing clustering principles for estimating the number of
materials in the image.</p>
      <p>An important direction is the processing of low-quality images with noise or pixel losses.</p>
      <p>In paper [19], the authors propose to reduce the computational complexity of spectral image
clustering methods by introducing a sub-sampling procedure that cuts the number of pixels for
classification in half. This preserves the spatial structure of the image.</p>
      <p>One of the promising directions in the field of clustering is methods based on the principles of
sparse subspace clustering, which group spectral signatures, ensuring their sparse
representation. In recent years, there has been a growing number of works [20-22] on the topic
of spectral clustering.</p>
      <p>In the research addressed by this article [20], the authors tackle the issue of clustering spectral
images, aiming to identify groups and distributions within spectral signatures without the need
for a prior training stage. Methods based on sparse subspace clustering group spectral signatures
into different subspaces, seeking the least dense representation for each pixel and ensuring their
affiliation with the same class. Despite their high accuracy, these methods encounter the
challenge of increasing computational complexity as the number of pixels grows. This work
proposes an approach to reduce the number of pixels for the classification of spectral images by
half through a subsampling procedure that eliminates every second adjacent pixel while
preserving the spatial structure of the image.</p>
      <p>In the field of hyperspectral image (HSI) clustering, the extraction of valuable clustering
information can be utilized for the classification of real objects, environmental monitoring, and
other tasks. Spectral clustering stands out as one of the most popular clustering methods and has
been successfully applied in hyperspectral image clustering, garnering significant attention.
However, the majority of these methods do not take advantage of the spatial information in HSI,
which could enhance pixel correlation and improve accuracy. In this paper [21], based on the
physical characteristics of HSI, a new approach is proposed, named hyperspectral image
clustering based on spatial information and spectral clustering (SISC). By combining spatial
window
and spectral factors, the
algorithm
utilizes joint spatial-spectral information,
reconstructs the central point, and reveals local spatial structure using nearby spatial points.</p>
      <p>The field of compressive spectral imaging (CSI) involves acquiring random projections of a
spectral scene. Conventionally, a computationally expensive reconstruction of the underlying 3D
scene is required before applying any post-processing tasks such as clustering. To enhance the
quality of reconstruction and subsequent post-processing results, prior works have focused on
adaptively designing sensing matrices. In contrast, this paper [22] introduces a novel hierarchical
adaptive approach for the design of a sensing matrix in the single-pixel camera. The proposed
approach enables pixel clustering directly in the compressed domain. At each step of the
hierarchical model, a sensing matrix is tailored to facilitate the extraction of clustering features
directly from the compressed measurements. The final segmentation map is obtained through
majority voting from partial clustering results at each hierarchy step.</p>
      <p>Neural networks provide a powerful tool for extracting high-level features from images,
making them promising in the field of image clustering. Various architectures of neural networks,
including deep convolutional neural networks (CNN), autoencoders, and generative adversarial
networks (GAN), are actively explored to enhance the clustering process and improve accuracy
in identifying similar patterns. Works [23-27] present key trends and outcomes of applying
neural networks in image clustering tasks, while also identifying challenges and prospects in this
research area.</p>
    </sec>
    <sec id="sec-3">
      <title>3. Methods and Materials</title>
      <sec id="sec-3-1">
        <title>3.1. Image Preprocessing</title>
        <p>Considering the architecture and algorithms of modern computer vision systems and, above all,
neural networks, the stage of image preprocessing is usually distinguished. This stage is designed
for the rapid preparation of the image for the most efficient processing.</p>
        <p>In this regard, the first step in the preprocessing stage is to downscale the image.</p>
        <p>The downscaling factor and the anti-aliasing filter are usually selected experimentally,
according to efficiency requirements, taking into account the characteristics of the computer
vision system equipment. The authors of this paper carried out a series of experiments, and the
following conclusions were made.</p>
        <p>
          When the scale is reduced once, a square window with linear size being an integer greater than
1 (2, 3, …) is used. If you plan to reduce the scale iteratively and work with the pyramid of images,
then the linear size of the window, as when working with SNS [
          <xref ref-type="bibr" rid="ref1">1</xref>
          ], should be a multiple of a power
of an integer greater than 1. To quickly and smoothly change the scale without losing significant
details of the scene, powers of 2 (2, 4, 8, ...) are usually considered.
        </p>
        <p>With regard to smoothing filters, the authors have tested thinning, averaging, and a series of
adaptive filters [8]. It was found that thinning is the best in terms of time efficiency, and in most
cases is only slightly inferior in quality in comparison with other filters. With high input image
quality, thinning is not inferior in quality with respect to other filters at all. Therefore, it is
recommended to use the thinning filter by default.</p>
        <p>
          The following averaging filter (1) is optimal for the most realistic transmission of small details
if enough computational resources are present and when processing small images. Also, in such
conditions, this filter is optimal for noise smoothing in terms of the balance of time and quality
 =  1 ∑ =1   ∙   , 

= ∑ =1   ,
(1)
where   is the brightness level for the component of the color model in the neighborhood (each
component is processed separately from each other), and   are the weight coefficients [
          <xref ref-type="bibr" rid="ref1">1, 8</xref>
          ]. In
practice, the mean filter is most often used with   = 1.
        </p>
        <p>
          Adaptive filters, especially with large window sizes, unacceptably smooth small details, lines
and fragments of object boundaries [
          <xref ref-type="bibr" rid="ref1">1, 8</xref>
          ]. They are also characterized by a nonlinear (most often
quadratic) estimate of the complexity. Therefore, their usage is unacceptable without special
justification.
        </p>
        <p>To reduce the complexity of clustering, in addition to reducing the scale, it is proposed to
optimize the partitioning grid of the RGBH space, where H(r, g, b) is the frequency of values (r, g,
b) in the RGB space.</p>
        <p>When preparing data for clustering, an image is scanned and a matrix H(r, g, b) is formed. The
cells of this matrix store data on the frequency of distribution of colors (r, g, b) in the pixels of the
image. Then the clustering of color areas in RGB space is performed using this matrix.</p>
        <p>For a standard color image (type 24 bit) in the RGB model, 28 ∙ 28 ∙ 28 = 16 777 216 possible
colors are defined. For many applications, given the iterative nature of clustering, processing such
a large number of cells is not acceptable in terms of computational complexity.</p>
        <p>This is also unnecessary because the analysis of the experiment results shows that the
contents of many cells are not informative.</p>
        <p>It is advisable to reduce the number of cells in RGB space in such a situation. To do this, we
enlarge the RGB space partition grid using the factor  = 2 (Fig. 1).</p>
        <p>Numerous experiments have shown that the best results are obtained for steps 4 and 8. In
most experiments, it was possible to reduce the complexity of clustering by about 64 (512) times
without reducing the quality by using enlarged cells 4 ∙ 4 ∙ 4 (or 8 ∙ 8 ∙ 8).</p>
        <p>Under such conditions, the RGB space is first divided into enlarged cells with a step  , after
which the frequency is calculated for these cells by adding the frequencies of the unit cells (r, g,
b).</p>
        <p>For an adequate construction of clusters of arbitrary shape, it is planned (this will be described
below) to analyze the level lines of the function H(r, g, b).</p>
        <p>Analysis of typical distributions H(r, g, b) showed the following.</p>
        <p>Almost any image has one or several dominant objects.</p>
        <p>The frequency of the chromaticity region of the dominant object, as a rule, is several orders of
magnitude higher than the frequencies of other objects in the image. Visually, this frequency looks
like a separate peak on the histogram. In this situation, consideration of all lines of the
distribution level H(r, g, b) is redundant and unnecessarily laborious.</p>
        <p>It is proposed to quantize the frequency into a predetermined (optimized at the training stage)
number of levels  to find a balance between computational complexity and quality. For this, a
non-linear quantization law (analog of log scale) is used to neutralize the influence of dominant
objects in the image. For these purposes, a flexible function of forming the boundaries of 
frequency quantization levels is proposed
  =


( −  ) ∙   ,
(2)
where  is the quantization boundary of the level  ,  = 0, … ,  ; 
is the maximum frequency,
 is the peak frequency suppression coefficient of dominant objects (Fig. 2).
quantization levels in numerical form</p>
        <p>After all the parameters of the models are determined, the image preprocessing is performed
according to the following algorithm:
1) the image is resized to the required size;
2) the resulting image is scanned:
1, … ,  are used instead of frequencies.</p>
        <p>- cell frequencies are found on the enlarged grid in RGB space;
- the found frequencies are quantized according to (2). After that, the quantization levels  =</p>
      </sec>
      <sec id="sec-3-2">
        <title>3.2. Data Clustering</title>
        <p>The clustering algorithm is iterative. External iterations of the algorithm are used to enumerate
and sequentially consider the levels ( = 1, … ,  ) of quantizing the cell frequency in the RGB cube.
Internal iterations are used to build clusters at the current quantization level, taking into account
the clustering results at previous levels.</p>
        <p>So, the levels of quantization are viewed from top to bottom, starting from the most significant
levels, ( = 1, … ,  ).</p>
        <p>For level  , clusters of adjacent cells with a frequency at level  are constructed using the wave
method. In 3-dimensional RGB space, two distinct cells (  ,   ,   ) and (  ,   ,   ) are considered
adjacent if the following condition is met
|  −   | ≤ 1 
|  −   | ≤ 1 
|  −   | ≤ 1.</p>
        <p>(3)</p>
        <p>These clusters are numbered in ascending order. Clusters built from cells of the same level will
be called simple. Adjacent clusters built on the current and one of the previous levels, if any, are
merged. Clusters that have adjacent cells are considered adjacent. A cluster resulting from the
merging of clusters is called a composite cluster. Just like a simple cluster, it gets a new number.
We use continuous numbering for numbering of clusters (Fig. 3 – Fig. 5).</p>
        <p>For the stability of the clustering method to noise and shadows of objects (so that clusters are
not falsely combined into one cluster), at least the lowest level  =  is not considered when
constructing clusters.</p>
        <p>In this case, we can lose small-sized objects. In this case, we can lose small-sized objects, but
we will maintain an adequate nested structure of large objects. During the process of building
clusters, information about them at each iteration is stored in three tables.</p>
        <p>The first table (Cluster) is used to store general information about all clusters (Table 1, Table
4, Table 7).</p>
        <p>This table stores the cluster number (continuous numbering), cluster type
(simple/composite), level number ( = 1, … ,  ) on which the cluster is built and the cluster
number in the simple/composite clusters table.</p>
        <p>The second table (S-Cluster) is used to store information about simple clusters (Table 2, Table
5, Table 8).</p>
        <p>This table stores the number of a simple cluster in the continuous numbering system of simple
clusters, the number of a simple cluster in the Cluster table and a reference to the array of
coordinates of cells { [ ,  ,  ] } from which the simple cluster is built.</p>
        <p>The third table (C-Cluster) is used to store information about composite clusters (Table 3,
Table 6, Table 9).</p>
        <p>This table stores the composite cluster number in the continuous composite cluster
numbering system, the composite cluster number in the Cluster table, and the tuple of clusters
from which the composite cluster is built.</p>
        <sec id="sec-3-2-1">
          <title>C-Cluster Number in Cluster C-Cluster Tuple of Clusters</title>
        </sec>
        <sec id="sec-3-2-2">
          <title>Table</title>
        </sec>
        <sec id="sec-3-2-3">
          <title>Cluster Number in S/ C-Cluster Table 1 2</title>
        </sec>
        <sec id="sec-3-2-4">
          <title>Cluster Number in S</title>
          <p>/ C-Cluster Table
1
2
3</p>
        </sec>
        <sec id="sec-3-2-5">
          <title>C-Cluster Number in Cluster C-Cluster Tuple of Clusters</title>
        </sec>
        <sec id="sec-3-2-6">
          <title>Table 5 (2,3) 4 1</title>
        </sec>
        <sec id="sec-3-2-7">
          <title>Cluster Number</title>
        </sec>
        <sec id="sec-3-2-8">
          <title>Cluster Type Level Number 2 2</title>
          <p>9
10</p>
        </sec>
      </sec>
    </sec>
    <sec id="sec-4">
      <title>4. Experiment</title>
      <p>During the experiment, two images of automobiles were utilized (Fig. 6). The dimensions of each
image were 1 megapixel.
To delineate homogeneous regions during the experiment, two stages were implemented.</p>
      <p>At the first stage, image preprocessing was conducted using the method described in Section
3.1. To mitigate clustering complexity, an optimization of the RGBH color space partitioning grid
was applied, where H(r, g, b) represents the frequency of values (r, g, b) in the RGB color space.</p>
      <p>For the second stage of the experiment, five data arrays were formed during preprocessing,
each representing a one-dimensional matrix of color frequencies on the processed image in the
RGB palette:</p>
      <p>Unoptimized RGB palette - 16,777,216 possible colors (2^8∙2^8∙2^8)</p>
      <p>Utilizing a 2x2x2 cell, where the frequency of consecutive, neighboring colors in the 2x2x2 cell
is summed into one – 2,097,152 possible colors</p>
      <p>Utilizing a 4x4x4 cell, where the frequency of consecutive, neighboring colors in the 4x4x4 cell
is summed into one – 262,144 possible colors</p>
      <p>Utilizing an 8x8x8 cell, where the frequency of consecutive, neighboring colors in the 8x8x8
cell is summed into one – 32,768 possible colors</p>
      <p>Utilizing a 16x16x16 cell, where the frequency of consecutive, neighboring colors in the
16x16x16 cell is summed into one – 4,096 possible colors</p>
      <p>The algorithm for the experiment was implemented in C# on the .NET Framework platform.
Visualization of the second stage, specifically clustering, was conducted using the Unity 3D [31]
Engine.</p>
      <p>The second stage, the clustering process, was implemented using the method described in
Section 3.2, based on the dataset of color frequencies prepared during preprocessing. The
execution time of the clustering stage was measured for each dataset. Unity 3D Engine was
employed for visualizing the clustering process.</p>
    </sec>
    <sec id="sec-5">
      <title>5. Results</title>
      <p>We will use the Unity package and the classic image representation to visualize and assess the
quality of clustering results.</p>
      <p>As the analysis of the experimental results shows, the low estimates of the complexity of
clustering are fully confirmed. The time of even an unoptimized single-threaded clustering of a 1
MP image (processor - Intel Core i5 6600k 3.7 GHz, RAM - 16 Gb DDR4) for practically significant
4x4x4 cells is approximately 0.25 seconds, and for 8x8x8 cells is approximately 0.0225 seconds.</p>
      <p>In terms of quality, the situation is as follows. In the first approximation, all objects in the
image can be divided into 2 main categories: monochromatic and non-monochromatic.</p>
      <p>The quality of clustering of monochromatic objects can be considered quite acceptable. As for
non-monochromatic objects, instead of a single tone with a high frequency we get a large number
of blurry tones of an object with a low frequency.</p>
      <p>The corresponding clusters are built and combined with each other at the lower levels. In the
worst conditions, they are combined at the lowest level. At the same time, they are also combined
with adjacent clusters for other objects. As a result, the colors of several objects form one cluster.</p>
      <p>Let's consider the situation with examples. As initial data, consider the cars shown in Fig. 6
(clustering parameters: number of levels  = 20, suppression coefficient  = 0.75, cell size 8 ∙ 8 ∙
8).</p>
      <p>Let's start by analyzing the “good” data for the comparatively monochromatic car in Fig. 6.a.
As expected, the dominant objects with a high frequency were the first to stand out relatively
well. At first, a monochromatic sky was clustered by the 9th level (Fig. 7.a). Then a cluster with
shades of black stood out by the 13th level (Fig. 7.b). After that, the cluster corresponding to the
one-color part of the car was constructed by the 15th level (Fig. 7.c).</p>
      <p>After that, at level 15, the unsaturated colors (located near the axis of grayscale) began to
clearly combine with each other (Fig. 8).
c)
Figure 7: The result of clustering of monochrome fragments of the scene in Fig. 6.a.</p>
      <p>Why does that happen? To understand the reasons, let's look at what happens in the color
space at levels 13 (top left) to 20 (bottom right) without levels 18 and 19 using Unity (Fig. 9).
Starting from level 14, the clusters gradually merge in the color space, especially near the gray
scale axis. This is due to the construction of clusters with colors corresponding to different
objects.</p>
      <p>Now, let’s consider the "bad" data in the same initial conditions. Let’s consider a
nonmonochromatic (due to uneven lighting) car in Fig. 6.b. In terms of dominant objects, blue, gray,
and black objects clustered relatively well by the 10th level (Fig. 10.a-c). The colored fragment
of the car appears only at the 11th level (Fig. 10.d). And at the same level, the merging of clusters
begins significantly in the region of unsaturated colors (Fig. 10.e). This is even more noticeable at
the 12th level (Fig. 10.f).
e)
Figure 10: The result of car clustering in Fig. 6.b.</p>
      <p>The colored part of the car stands out more or less only at the 14th level and immediately
merges into one cluster with other objects (Fig. 11). This is because of the significant range of
colors of the red-violet part of the car. This is because of the significant spread of colors of the
red-violet part of the car and the inseparability of this cloud in the RGB cube from adjacent colors
(Fig. 12).</p>
      <p>All clustering results (Fig. 9 and Fig. 12) show an interesting effect. Saturated colors of objects,
whatever their spread in the RGB cube is, are rather compactly located in the plane along the H
component of the HSV model. Further, this 3D data can be further processed and filtered.</p>
      <p>Moreover, the saturation S of the object also changes slightly for "good" data (orange car in
Fig. 9). Because of this, the shape of the object's cluster clearly repeats the triangular section
formed by the color half-plane and the edges of the RGB cube.</p>
      <p>The clustering results of the considered images at all levels can be found here [32].</p>
    </sec>
    <sec id="sec-6">
      <title>6. Discussions</title>
      <p>The obtained results of the experiments indicate the high efficiency of the proposed method for
clustering color images. The clustering demonstrates the capability of effectively extracting color
regions, rendering it promising in the context of real-time computer vision and artificial
intelligence systems.</p>
      <p>One of the key merits of the developed system is its high processing speed in real-time mode.
As evident from the table, the utilization of merging adjacent color frequencies into 4x4x4 and
8x8x8 cells during the preprocessing stage yields minimal temporal delays in clustering while
maintaining satisfactory quality. This feature renders the system effective and swift in conditions
requiring prompt data processing.</p>
      <p>The assessment of clustering quality confirms a sufficiently high accuracy and reliability in
delineating various color regions in images. The algorithm's performance leads to clear and
distinguishable groups, affirming its applicability across a broad spectrum of visual data.</p>
      <p>Furthermore, the system demonstrated robustness to variations in conditions, such as
changes in lighting, image resolution, and the presence of noise. Comparative analysis with other
methods highlights a key advantage of the developed system in that, unlike the k-means method,
it does not necessitate a predetermined number of clusters. The k-means method assumes that
the number of clusters is known in advance, which can be a limitation in real-world scenarios
where the number of clusters may be variable and unknown.</p>
      <p>The developed system showcases automatic determination of the optimal number of clusters
based on intrinsic data characteristics. This significantly enhances the method's flexibility and
applicability in situations where the number of clusters to be delineated in an image is not
predetermined. Such an approach is particularly valuable in real-time conditions where
instantaneous adaptation to changing conditions and data dynamics is required. The automatic
determination of the number of clusters reduces the need for preconfiguration, making the
method more convenient and versatile for various usage scenarios.</p>
      <p>The developed clustering method has a wide range of practical applications, including
realtime streaming data processing, automatic object recognition in images, and optimization of
computer vision processes in the field of artificial intelligence.</p>
      <p>Possible directions for future research include refining the method to handle different types
of images, expanding functionality for multitasking scenarios, and conducting in-depth
investigations into the impact of parameters on clustering outcomes.</p>
    </sec>
    <sec id="sec-7">
      <title>7. Conclusions</title>
      <p>The paper proposes a fast clustering algorithm based on the consistent use of preprocessing and
clustering of image pixels in RGB space.</p>
      <p>At the preprocessing stage (a), the scale is first reduced and (optionally) the image is
smoothed, (b) the aggregated color frequencies are found on the enlarged RGB space grid, (c) the
adaptive quantization of the cell frequencies of such a grid in RGBH is performed.</p>
      <p>The proposed preprocessing algorithm allows you to quickly prepare data and reduce by
several orders of magnitude the number of enumerated space cells when building clusters in
RGBH. Accordingly, the complexity of data clustering in RGBH is decreased. We obtain the
following conclusions based on the averaged experimental data (scaling is not taken into account
as a standard procedure): 1) the grid sampling is most often done with a factor of 4 (or 8), so the
number of cells in the RGBH space is reduced by 64 (or 512) times; 2) the number of quantization
levels usually ranges between 16 and 32, while the frequency of some cells can be up to 10,000
or more. In this situation, the number of frequency gradations decreases from 100 to 1000 times.</p>
      <p>As a result, the proposed algorithm makes it possible to cluster data almost instantly.</p>
      <p>The following computing system was used for the purposes of the experiments: CPU - Intel
Core i5 6600k 3.7 GHz, RAM - 16 Gb DDR4. The software was run locally in a single thread. Color
images with a size of 1 MP are processed, the number of levels is  = 20. In these conditions, the
clustering time is: a) for 1x1x1 cells - several minutes, the result is not very stable (it has no
practical sense); b) for 2x2x2 cells - about 10 seconds; c) for 4x4x4 cells - about 0.25 seconds; d)
for 8x8x8 cells - about 0.0225 seconds. Such a high efficiency of the proposed algorithm (taking
into account the possibility of parallel data processing) makes it possible to use it for clustering
and segmentation in even relatively low-powered embedded systems.</p>
      <p>Due to the wide parameterization, preprocessing algorithms can be fine-tuned to the features
of the problem that is being solved.</p>
      <p>The proposed clustering algorithm allows to adequately build clusters of arbitrary shape for
relatively monochromatic objects taking into account the position of the level lines. It also allows
to create a hierarchy of nesting clusters (corresponding to the level lines), which is important for
separating objects close in color in the image during subsequent processing. Unfortunately,
nonsolid objects (usually unevenly lit) may not be processed adequately, since their colors are highly
diffused and become adjacent to the colors of other objects.
[2] I. Ruban, H. Khtoudov, V. Lishchenko, A. Zvonko, S. Glukhov, I. Khizhnyak, V. Maliuha,
Y. Polonskyi, R. Kushpeta, The Calculating Effectiveness Increasing of Detecting Air Objects
by Combining Surveillance Radars into The Coherent System // International Journal of
Emerging Trends in Engineering Research. – Vol. 8. (№ 4), 2020. – P. 1295-1301.
[3] V. Lishchenko, V. Chaliy, H. Khudov, and A. Zvonko. Proposals for Improving of Air
Surveillance Informativity in MIMO Radar Systems Based on Two-Dimensional Radars //
Intern. Scient.-Pract. Conf. Problems of Infocommunications. Science and Technology
(PIC S&amp;T), 9-12 Oct 2018, Kharkiv. – P. 153–156.
[4] S. Orozco-Arias et al., "SENMAP: A Convolutional Neural Network Architecture for Curation
of LTR-RT Libraries from Plant Genomes," 2021 IEEE 2nd International Congress of
Biomedical Engineering and Bioengineering (CI-IB&amp;BI), Bogota D.C., Colombia, 2021, pp. 1-4,
doi: 10.1109/CI-IBBI54220.2021.9626130.
[5] Lishchenko V., Khudov H., Tiutiunnyk V., Kuprii V., Zots F. and Misiyuk G. The Method of
Increasing the Detection Range of Unmanned Aerial Vehicles In Multiradar Systems Based
on Surveillance Radars // IEEE 39th International Conference on Electronics and
Nanotechnology (ELNANO), 16-18 April 2019, Kyiv, Ukraine. – P. 559-562.
[6] C. Mejia-Escobar, M. Cazorla and E. Martinez-Martin, "Improving Facial Expression
Recognition Through Data Preparation and Merging," in IEEE Access, vol. 11, pp.
7133971360, 2023, doi: 10.1109/ACCESS.2023.3293728.
[7] B. Zhao, J. R. Sveinsson, M. O. Ulfarsson and J. Chanussot, "(Semi-) Supervised Mixtures of
Factor Analyzers and Deep Mixtures of Factor Analyzers Dimensionality Reduction
Algorithms For Hyperspectral Images Classification," IGARSS 2019 - 2019 IEEE International
Geoscience and Remote Sensing Symposium, Yokohama, Japan, 2019, pp. 887-890, doi:
10.1109/IGARSS.2019.8898932.
[8] Ruban I., Churyumov G., Tokarev V., Tkachov V. Provision of Survivability of Reconfigurable
Mobile System on Exposure to High-Power Electromagnetic Radiation // Selected Papers of
the XVII International Scientific and Practical Conference on Information Technologies and
Security (ITS 2017). – CEUR Workshop Processing. – Kyiv, Ukraine, 2017. – P. 105-111.
[9] Serkov A., Kravets V., Yakovenko I., Churyumov G., Tokariev V., Nannan W. Ultra Wideband
Signals in Control Systems of Unmanned Aerial Vehicles // IEEE International Conference on
“Dependable Systems, Services and Technologies”, (DESSERT’2019). – 2019, Leeds, United
Kingdom, June 5-7. – P. 26-29.
[10] Tkachov V., Tokariev V., Dukh Y., Volotka V. Method of Data Collection in Wireless Sensor
Networks Using Flying Ad Hoc Network // IEEE International Scientific-Practical Conference
“Problems of Infocommunications, Science and Technology”, (PIC S&amp;T). – 2018, Kharkiv,
Ukraine, 9-12 October. – P. 197-201.
[11] Yevdokymenko M. Investigation of Tensor Approach for Providing Multimedia Quality in
Infocommunication Networks // Ceur Workshop Proceedings of the International Workshop
on Cyber Hygiene (CybHyg-2019) co-located with 1st International Conference on Cyber
Hygiene and Conflict Management in Global Information Networks (CyberConf 2019). –
2019. – Vol. 2654. – P. 227-239.
[12] Yevdokymenko M., Mohamed E., Onwuakpa P. Ethical hacking and penetration testing using
raspberry PI // 2017 4th International Scientific-Practical Conference Problems of
Infocommunications. Science and Technology (PIC S&amp;T), Kharkiv, 2017. – P. 179-181.
[13] Kuzminykh I., Carlsson A., Yevdokymenko M., Sokolov V. Investigation of the IoT device
lifetime with secure data transmission // In: Galinina O., Andreev S., Balandin S.,
Koucheryavy Y. (eds) Internet of Things, Smart Spaces, and Next Generation Networks and
Systems. NEW2AN 2019, ruSMART 2019. Lecture Notes in Computer Science, Springer,
Cham. Vol. 11660. – P. 16-27.
[14] H. Palus and M. Frackiewicz, "Deterministic vs. Random Initializations for K-Means Color
Image Quantization," 2019 15th International Conference on Signal-Image Technology &amp;
Internet-Based Systems (SITIS), Sorrento, Italy, 2019, pp. 50-55, doi:
10.1109/SITIS.2019.00020.
[15] S. Dinc, R. Russell and L. A. C. Parra, "Cloud Region Segmentation from All Sky Images using
Double K-Means Clustering," 2022 IEEE International Symposium on Multimedia (ISM), Italy,
2022, pp. 261-262, doi: 10.1109/ISM55400.2022.00058.
[16] F. Lopez-Tiro, H. Peregrina-Barreto, J. Rangel-Magdaleno and J. C. Ramirez-San-Juan,
"Localization of blood vessels in in-vitro LSCI images with K-means," 2021 IEEE
International Instrumentation and Measurement Technology Conference (I2MTC), Glasgow,
United Kingdom, 2021, pp. 1-5, doi: 10.1109/I2MTC50364.2021.9460100.
[17] A. Ito, "Successive Binary Partition K-means Method for Clustering with Less Cluster Size
Bias," 2022 7th International Conference on Signal and Image Processing (ICSIP), Suzhou,
China, 2022, pp. 772-776, doi: 10.1109/ICSIP55141.2022.9886452.
[18] J. Prades, A. Salazar, G. Safont and L. Vergara, "Experimental Study of Hierarchical Clustering
for Unmixing of Hyperspectral Images," 2021 IEEE International Conference on Aerospace
Electronics and Remote Sensing Technology (ICARES), Bali, Indonesia, 2021, pp. 1-5, doi:
10.1109/ICARES53960.2021.9665201.
[19] J. Bacca, K. Sanchez and H. Arguello, "Sparse Subspace Clustering for Hyperspectral Images
with Missing Pixels," 2019 XXII Symposium on Image, Signal Processing and Artificial Vision
(STSIVA), Bucaramanga, Colombia, 2019, pp. 1-5, doi: 10.1109/STSIVA.2019.8730242.
[20] Y. Wei, C. Niu, H. Wang and D. Liu, "The Hyperspectral Image Clustering Based on Spatial
Information and Spectral Clustering," 2019 IEEE 4th International Conference on Signal and
Image Processing (ICSIP), Wuxi, China, 2019, pp. 127-131, doi:
10.1109/SIPROCESS.2019.8868487.
[21] C. Hinojosa, J. Bacca, E. Vargas, S. Castillo and H. Arguello, "Single-Pixel Camera Sensing
Matrix Design for Hierarchical Compressed Spectral Clustering," 2019 IEEE 29th
International Workshop on Machine Learning for Signal Processing (MLSP), Pittsburgh, PA,
USA, 2019, pp. 1-6, doi: 10.1109/MLSP.2019.8918856.
[22] J. Lopez, C. Hinojosa and H. Arguello, "Fast Subspace Clustering Algorithm with Efficient
Similarity-Constrained Sampling for Hyperspectral Images," 2021 IEEE 31st International
Workshop on Machine Learning for Signal Processing (MLSP), Gold Coast, Australia, 2021,
pp. 1-6, doi: 10.1109/MLSP52302.2021.9596507.
[23] K. Smelyakov, A. Chupryna, O. Bohomolov and I. Ruban, "The Neural Network Technologies
Effectiveness for Face Detection," 2020 IEEE Third International Conference on Data Stream
Mining &amp; Processing (DSMP), 2020, pp. 201-205, doi: 10.1109/DSMP47368.2020.9204049.
[24] K. Smelyakov, A. Chupryna, O. Bohomolov and N. Hunko, "The Neural Network Models
Effectiveness for Face Detection and Face Recognition," 2021 IEEE Open Conference of
Electrical, Electronic and Information Sciences (eStream), 2021, pp. 1-7, doi:
10.1109/eStream53087.2021.9431476.
[25] K. Smelyakov, M. Shupyliuk, V. Martovytskyi, D. Tovchyrechko and O. Ponomarenko,
"Efficiency of image convolution," 2019 IEEE 8th International Conference on Advanced
Optoelectronics and Lasers (CAOL), 2019, pp. 578-583, doi:
10.1109/CAOL46282.2019.9019450.
[26] M. Tonin and R. L. de Queiroz, "On Quantization of Image Classification Neural Networks for
Compression Without Retraining," 2022 IEEE International Conference on Image Processing
(ICIP), Bordeaux, France, 2022, pp. 916-920, doi: 10.1109/ICIP46576.2022.9897466.
[27] Kyrychenko, I., Nazarov, O., Huliiev, N., Avdieiev, O. “Selection of Artificial Neural Networks
for Disease Prediction”, 2023 7th International Conference on Computational Linguistics and
Intelligent Systems (COLINS-2023), 2023. – CEUR-WS, 2023, ISSN 16130073. - Volume 3387,
РР. 236-248.
[28] Color Space:
https://cdn.firespring.com/images/36580bd4-0617-45db-9623941537eab10d.png
[29] Car Image:
https://www.autocentre.ua/wp-content/uploads/2018/05/Die-Besten-bis5000-Euro-TueV-Report-2018-1200x800-17fa1ff16f0bfc7a.jpg
[30] Car Image: https://auto.ironhorse.ru/wp-content/uploads/2018/06/Q8-side.jpg
[31] https://unity.com
[32] Results: https://drive.google.com/drive/folders/1MHdinKBlqIGuwz0Irtm4zYV10Ca-XLAK</p>
    </sec>
  </body>
  <back>
    <ref-list>
      <ref id="ref1">
        <mixed-citation>
          [1]
          <string-name>
            <surname>Rafael</surname>
            <given-names>C.</given-names>
          </string-name>
          <string-name>
            <surname>Gonzalez</surname>
          </string-name>
          , Richard E. Woods Digital Image Processing, 4th edition Pearson/Prentice Hall,
          <year>2018</year>
          . -
          <fpage>1168p</fpage>
          .P. S. Abril,
          <string-name>
            <given-names>R.</given-names>
            <surname>Plant</surname>
          </string-name>
          ,
          <article-title>The patent holder's dilemma: Buy, sell, or troll?</article-title>
          ,
          <source>Communications of the ACM</source>
          <volume>50</volume>
          (
          <year>2007</year>
          )
          <fpage>36</fpage>
          -
          <lpage>44</lpage>
          . doi:
          <volume>10</volume>
          .1145/1188913.1188915.
        </mixed-citation>
      </ref>
    </ref-list>
  </back>
</article>