## 4 Conclusions  
So far, human-operated optimizers have been responsible for identifying and classifying the type of defect in sawmills, with low efficiency. Their task is to cut out defective parts, e.g., knots. As a result, friezes and semi-finished products for further processing are created. Accuracy in cutting out defects involves cutting out the defect as sparingly as possible to obtain as much material as possible in a better class. The Q-Scan system created by Woodinspector is a pine sawn timber scanner that detects defects, classifies them, and optimizes the cutting of sawn timber in terms of the user-defined product. The scanner is based on digital image analysis technology, which allows for the detection of the most common defects in wood with high and repeatable accuracy throughout the entire working time. The scanner uses industrial cameras, LED illuminators, line lasers, and a high-performance PC computer. Optimization algorithms take into account the locations of defects and their permissible sizes depending on the product. Elements produced for micro-joining are optimized in three quality classes: class 1--no defects; class 2--resin, blue stain, and small knots; and class 3--fused knots. The components of the developed line are as follows: an input material scanning system (scanner) 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 work parameterization module, and a cutting module, which is integrated with the sorting system. The main functionalities of the device are as follows: the detection of defects in wood with an average accuracy of up to 10 mm, the automatic determination of the type and size of the defect (e.g., healthy knot 25 mm), the automatic planning of sawn timber cutting, and sorting according to scanning results. The scanner's efficiency in detecting defects is up to 60 m/min. The largest group of sawn timber producers are small- and medium-sized companies. The proposed approach is tailored to their needs. Digital image analysis technology allows for the detection of blue stain defects in wood with high and repeatable accuracy throughout the entire working time. Optimization algorithms take into account the locations of defects and their permissible sizes depending on the product. Elements produced for micro-joining are optimized in three quality classes: class 1--without defects; class 2--resin, blue stain, and small knots; and class 3--fused knots. Individual defects are detected using dedicated neural networks. This article presents an approach for detecting blue stains on wood. The neural network allowed us to distinguish blue stains from other defects, including wood staining, which does not impair the strength properties of the wood. The implementation of the system in the company allows for a faster and more effective detection of blue stains in sawmill wood, which can help increase the sawmill's production efficiency. The natural variability in wood species could not be fully captured in the training set. In the presented solution, the subject of research was pine wood from Poland. Wood samples from different manufacturers are similar to each other. In subsequent implementations, it is necessary and sufficient to additionally train the system, as described in this article. A certain limitation of the system's operation was the dirtying of the lenses and illuminators of the vision system, which requires the introduction of a systematic procedure for cleaning them. The geographical context of wood and the development of a dirt detection system in the vision system may be areas for further development work. Conceptualization, P.W. and G.K.; methodology, A.M.; software, G.K.; validation, G.K. and G.L. ; writing--original draft preparation, P.W. and G.K.; writing--review and editing, G.L. All authors have read and agreed to the published version of the manuscript.