This approach consists of the following:  
* An input material scanning system (scanner), which is responsible for recognizing and classifying the type of defects using vision techniques;
* Cutting optimization algorithms depending on the type of defect in order to eliminate selected process stages;
* A module for parameterizing the scanner's operation conducted by the operator;
* A sorting module and the semi-automatic stacking of the output material;
* An integral cutting module with a sorting system;
* A module for the semi-automatic unstacking of the material for feeding to the cutting line. An important element of the system is the scanning module, which includes a defect detection algorithm based on artificial neural networks. Blue stains are a tree disease that causes the wood to change color to blue or black. It is a defect that is difficult to detect based on the color of the wood, because it can be easily confused with wood defects or dirt. Traditional methods of detecting blue stains in sawmill wood are time consuming and expensive. The use of neural networks allows for a faster and more effective detection of blue stains in sawmill wood, which can help increase sawmill production efficiency. Neural networks are a type of machine learning algorithm that imitate how the brain works. Neural networks are used due to their effectiveness in solving problems related to the processing of images, sounds, text, and other data. Due to their ability to generalize knowledge, neural networks are particularly useful for detecting objects in images. One of the applications of neural networks is the detection of blue stains in sawmill wood. There are studies in the literature on the use of vision techniques for wood quality inspection [1; 2; 3]. In 2005, [PERSON] et al. (2005) proposed a technique for assessing blue stains using image analysis [4]. The method of the quantitative assessment of the presence of a blue stain according to the standard [5] was found to be insufficient. A scale from 0 to 5 was used for visual assessment, where 0 means no blue stain and 5 means a complete coverage of the cross-section with blue-staining fungi to a depth of 5 mm. Neural networks were used as generalizing classifiers to measure surface blue stains, as well as to analyze the distribution of fungal invasion inside the wood. However, even with additional data reduction and clustering techniques, it has been difficult to obtain results comparable to subjective visual assessment. Nevertheless, it has been proven that image processing and 3D reconstruction seem to be valuable tools for assessing blue stains [6; 7; 8]. In another article [9], a modified wood testing methodology standardized according to the EN 152 standard was presented, intended to test the effectiveness of wood coatings. A method called the EN 152 reverse method was used for the computer-aided grading of coated wood to assess the discoloration of the coatings and analyze the blue-stained wood inside the samples. Three-dimensional (3D) reconstructions of the samples were obtained, which became a tool for an in-depth analysis of the presence of blue stains [10; 11; 12]. Similar results were obtained in studies published in [4; 13]. The usefulness of vision methods was confirmed, and the development of modern computer-controlled planners with a scanning head that accelerate the process by controlling for the presence of blue stains was predicted [14; 15]. In 2005, a color image segmentation method using neural networks was also proposed for detecting wood surface defects [16]. The proposed method is called FMMIS (Fuzzy Min-Max Neural Network for Image Segmentation). Automatic visual inspection (AVI) systems includes five processing steps: image acquisition, image enhancement, image segmentation, feature extraction, and classification. The recognized defects cover 10 defect categories: bird's eye and freckle, pockets of bark and tar, fade, split, stain, blue stain, with, dead knot, living knot, and hole.