# Classification of Objects by Shape Applied to Amber Gemstone Classification
## 1 Introduction and Related Work  
Nowadays, amber is still extracted from the Baltic Sea and adjacent mines and is used to create impressive jewelry, souvenirs, and mosaics. In order to provide amber art craftsmen with suitable raw materials, amber gemstones are selected and sorted according to their size, shape, and shade. Amber can be considered a specific object because there are uncountable varieties of shades, shapes, and sizes. In this work, we aimed to create an image analysis algorithm capable of classifying amber gemstones on a conveyor, working under real-time conditions. As a result, the submitted object for processing must be assigned to the identified class, or the \"other\" class when it cannot be set to the given object with acceptable accuracy. The main purpose of this work was to achieve a classification accuracy comparable to expert's work, but for real-time operations (fractions of a second) at the same time. Scientists in this field have achieved good results in obtaining visual properties and using them to classify and sort objects into a small number of categories. First- and second-order statistical properties [1] are used for visual surface evaluation. Sorting is often used in the food industry [2] to separate objects in waste recycling operations [3]. These systems are based on the acquisition of the optical properties of objects' surfaces using different types of sensors, such as CCD (charge-coupled device) cameras, spectroscopy [4], stereo vision, and infrared light. The optical properties depend on the lighting conditions, which makes it very important to isolate objects from the environment and to install a reliable source of artificial lighting. Such systems have strict operational requirements. In high-speed automation, qualitative classification is important when classifying color images. Using histogram limitation techniques, pixel counting, different types of lighting, and removal of contour color tones make it possible to obtain a good classification accuracy [5]. Some authors [6, 7] have proposed amber classification according to the shape, based on contour properties. The algorithm begins with the processing of each photo. Initially, a photois converted from an RGB (red, green, blue) color palette to a binary form. Later, \"empty\" spaces in the object are filled up and shadows are removed. The image is normalized so that the longitudinal part of the object is parallel to the \(X\)-axis. Finally, the object image is resized to fit a 256 \(\times\) 256 pixel size. The centroid distance function (CDF) has been used to identify object forms. This is a one-dimensional function is expressed at a distance from the reference point to the centroid of the object. For each photo, 64 referrals are selected. The referral coordinates are found using the Moore-Neighbor tracking algorithm modified by [PERSON]'s stopping criteria, which provides an array of the object's contour coordinates. Circular shift is applied to eliminate the angle of rotation, resulting in a 64 \(\times\) 64 matrix. The resulting matrix is normalized (to eliminate the effect of amber size) and inverted (to eliminate the mirror reflection of amber), which results in a 128 \(\times\) 64 matrix that is used for classification. The algorithm uses a decision tree ensemble consisting of several decision trees that have been trained with different training and testing data sets. The ultimate solution is the class provided by the decision tree ensemble. For each amber photo, a 128 \(\times\) 64 matrix is created and passed to the decision tree ensemble. Due to the relatively large amount of data needed to describe the form of amber, the algorithm is not suitable for real-time operating systems because it requires large computational resources. This approach [6; 7] requires an expert who must first select amber forms, classify them by hand, and then train the decision trees. Therefore, in this investigation, we also asked ourselves, are there any methods that could help us avoid manual work in such classification tasks?