# Computer-Vision-Based Product Quality Inspection and Novel Counting System
## 1 Introduction
This study was developed to improve the automation and accuracy of defect detection, quality control, and inventory management by integrating SIFT (scale-invariant feature transform)-based defect detection, a real-time counting correction system using YOLOv8 (You Only Look Once version 8) Pose, and a precision counting mechanism using difference image techniques. The system is designed to solve the consistency, time, and labor cost issues caused by manual inspection in large-scale manufacturing environments. Product defects are inspected through computer vision technology using cameras, and if the product has a defect and the detected value is different from the standard product, the system notifies the operator for reprocessing. Reprocessed products are re-examined using differential imaging technology to ensure they meet quality standards. Test results showed that the system demonstrated high accuracy in defect detection and quality control, contributing to reducing human errors and significantly improving the efficiency of the overall manufacturing process. Figure 1 presents a schematic diagram of the entire system. When a product is placed on the conveyor belt, defects are detected, and uniformity is assessed through a camera installed on the belt, after which accepted products proceed to the counter. At this stage, Camera 2 identifies the products, calculates the quantity through difference images, and computes the average value. Weight measurement and counting are then performed to ensure accurate inventory management. This study utilized a high-speed camera with a variable focus function, 1280 \(\times\) 720 resolution, and a frame rate of 120 fps (frames per second) to maximize efficiency in defect detection and quality control. This high-speed capability ensures precise detection of even minor defects on products moving rapidly on a conveyor belt. The camera's variable focus function allows it to adapt flexibly to various product sizes and shapes, enabling stable defect detection without the need for additional focus adjustments. The camera was installed approximately 50 cm above the conveyor belt and set at a 90-degree angle to capture detailed images of the product surfaces with precision. This configuration provides a standardized setup that can be reliably applied across diverse manufacturing processes. Additionally, the lighting system was designed to optimize illumination and uniformity in the inspection area by supplying light from both directions. This process addresses the issues mentioned above, and in this study, we propose three improved technologies. First, we utilize the SIFT algorithm to compare images and detect defects that remain robust against rotation and size changes in product images. SIFT extracts feature points from an image, enabling accurate similarity analysis regardless of rotation or size [9; 10; 11; 12; 13]. Recent studies demonstrate SIFT's high efficacy in modern applications, thanks to continuous improvements in memory storage. Advances in data compression, for instance, allow consecutive nibble pairs to be stored within a single byte, reducing memory usage by half without causing alignment issues. This bit-level improvement supports faster comparative analysis while preserving storage efficiency and matching accuracy [14]. After correcting the product's size and orientation using SIFT, product defects and uniformity were determined by analyzing the SSIM, PSNR, and MSE values with the \(\text{S}_{\text{combined}}\) formula and difference image technique. Second, we introduced the YOLOv8 Pose algorithm to create a system that corrects counting errors in real time whenever an operator is detected on the load cell. This solution ensures accurate product counting by temporarily causing weight measurement when an operator steps onto or approaches the load cell. Third, we developed an accurate product counting method using the difference image technique to address errors caused by the load cell's resolution limitations.