Paper product counting method based on machine vision

By constructing a dynamic interference baseline library and multimodal counting logic, and combining photoelectric sensors and multispectral cameras, a paper product counting method with high precision and robustness in complex industrial environments was achieved. This solved the problem of insufficient counting accuracy of traditional methods under multimodal interference, and improved the accuracy and adaptability of the counting process.

CN121544550APending Publication Date: 2026-02-17YUNNAN XINHUA PRINTING FACTORY NO 5 CO LTD
View PDF 0 Cites 2 Cited by

Patent Information

Application Number
CN202511680684.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-11-17
Publication Date
2026-02-17

AI Technical Summary

Technical Problem

Traditional paper product counting methods based on single visible light vision are not adaptable to multimodal interference in complex industrial environments and lack dynamic baseline correction capabilities, resulting in insufficient counting accuracy and robustness. In particular, false detection and missed detection problems are serious in scenarios with a mixture of dynamic transport and static stacking.

Method used

A dynamic interference baseline library is constructed using a multispectral industrial camera. Combined with real-time detection by photoelectric sensors, and through multimodal counting logic and differential heat map localization, accurate identification and counting of paper candidate areas are achieved. This includes trajectory encoding and thickness gradient dual-mode counting logic. Combined with real-time image quality and scene type, a high frame rate acquisition mode is dynamically adapted to perform cross-validation of counting results and anomaly detection.

Benefits of technology

It significantly improves the accuracy and scene adaptability of the paper product counting process, effectively solves the problems of false detection and missed detection caused by light fluctuations, mechanical vibration and dust interference, and ensures the stability and reliability of counting results.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121544550A_ABST
    Figure CN121544550A_ABST
Patent Text Reader

Abstract

The invention discloses a paper product counting method based on machine vision, and relates to the technical field of image processing and industrial automation. The method is used for solving the problem of low technical accuracy of paper products in complex industrial environments. The method comprises the following steps of: quantitatively recording inherent interference characteristics of a counting area by constructing an interference baseline library capable of being dynamically updated; performing real-time anomaly detection and positioning, acquiring images through a multispectral camera, comparing baseline features, and generating a difference thermodynamic diagram to position a paper candidate area; performing multi-modal counting, adopting track coding counting logic for a dynamic transmission scene, and adopting thickness gradient counting logic for a static stacking scene; counting results are subjected to cross check, dynamic and static counting results are compared, and accuracy is ensured through confidence evaluation; and the accuracy and the reliability of a paper product technology are obviously improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the fields of image processing and industrial automation technology, specifically to a method for counting paper products based on machine vision. Background Technology

[0002] With the deepening of intelligent manufacturing, production processes are placing higher demands on digitalization and intelligence. Meanwhile, quality management systems have strict requirements for product counting accuracy. In industries with high precision requirements such as printing, packaging, and document manufacturing, achieving efficient and reliable non-contact paper product technology has become a key link in improving production efficiency and quality control; however, existing technologies still have significant limitations.

[0003] Traditional counting methods based on single visible light vision are not adaptable to multimodal interference in complex industrial environments. Their image processing algorithms do not effectively integrate the anti-vibration design of the hardware acquisition end with the multispectral feature fusion mechanism of the software analysis end, and lack the ability to quantitatively model inherent interference and dynamically correct the baseline, resulting in insufficient counting accuracy and robustness in mixed scenarios of dynamic transmission and static stacking.

[0004] To address the aforementioned shortcomings, a technical solution is provided. Summary of the Invention

[0005] A machine vision-based method for counting paper products, comprising:

[0006] S1. Construction of dynamic interference baseline library: In an empty scene without paper, images of the counting area are acquired by a multispectral industrial camera, interference features are extracted and quantized, a baseline feature set is constructed, and it is dynamically updated based on trigger conditions.

[0007] S2. Real-time anomaly detection and localization: When an object is detected entering the target counting area by the photoelectric sensor, the camera is controlled to acquire real-time images. After preprocessing the real-time images, real-time features are extracted, compared with the baseline feature set, a difference heat map is generated, and the paper candidate area is located.

[0008] S3. Multimodal counting execution: Based on the counting scenario type, the corresponding counting logic is adopted; for dynamic transmission scenarios, trajectory encoding counting logic is used to obtain counting result A; for static stacking scenarios, thickness gradient counting logic is used to obtain counting result B.

[0009] S4. Cross-validation of counting results: Compare the absolute difference between counting results A and B. If the difference is lower than the validation threshold, the average of A and B is used as the final counting result. If it is greater than the validation threshold, anomaly investigation is performed, including pseudo-trajectory investigation for dynamic scenes or abnormal slope correction for static scenes, and the confidence score result is used as the final output.

[0010] As a further improvement of the present invention, the specific implementation process of step S1 is as follows:

[0011] During equipment initialization and startup, a multispectral industrial camera is deployed in the target counting area, and vibration and displacement detection are performed using a fixed reference point preset based on the triangulation principle. Images of the paperless environment are acquired synchronously via dual channels, including a visible light channel and a near-infrared channel. Interference features are extracted from the paperless environment images, including environmental noise features, carrier interference features, and paper residue interference features. The extracted interference features are quantized, encoded, and integrated into a baseline feature set, which is then stored in an industrial database. When trigger conditions are met, baseline update pre-detection is initiated. Trigger conditions include the equipment running continuously for a preset maximum duration, the cumulative count reaching a preset maximum number, manual triggering by the administrator, or a sudden change in environmental parameters.

[0012] If the difference between the new feature set and the old feature set exceeds a preset threshold, the baseline feature set is updated.

[0013] As a further improvement of the present invention, the specific operation steps of step S2 include:

[0014] The system sends real-time acquisition commands to a multispectral industrial camera, including an adaptive acquisition mode based on the paper movement speed detected by a photoelectric sensor, and a high frame rate mode when the speed is below a preset threshold. It preprocesses the acquired real-time images, including bad pixel repair based on the mean interpolation of adjacent pixels, vignetting correction based on factory calibration data, and random noise reduction using an adaptive median filtering algorithm. The preprocessed images are then verified. Interference features of the real-time images are extracted to generate the current feature set, and its dimensionality consistency with the baseline feature set is verified. A three-dimensional difference matrix is ​​formed by comparing the difference between the current feature set and the baseline feature set using a preset algorithm.

[0015] The difference in environmental noise is calculated using a formula as a weighted sum of the flicker frequency deviation and the trajectory curvature deviation;

[0016] The carrier interference difference was calculated by weighting the difference between the norm of the texture matrix and the standard deviation of vibration.

[0017] The residual interference difference is determined by comparing the real-time residual contour area with the average area of ​​the baseline residual contour.

[0018] As a further improvement of the present invention, the specific operation steps of step S2 also include:

[0019] The preprocessed real-time image is automatically divided into several sub-blocks based on a preset paper size, and zero-padding is performed on the edge regions. Each sub-block is numbered, and local contribution parameters to the 3D difference matrix are extracted, including the standard deviation of gray-level fluctuation within the sub-block, the difference of texture matrix elements, and the area ratio of fibrous regions. The comprehensive difference value of each sub-block is obtained through a weighted summation formula and normalized to the [0,1] interval. Based on the linear color mapping rule, the comprehensive difference value of the sub-block is converted into a color gradient to generate a difference heatmap. A scene adaptive threshold is set based on the interference fluctuation range dynamically generated from the baseline feature set. The difference heatmap is traversed, and sub-blocks with comprehensive difference values ​​lower than the scene adaptive threshold are removed, while high difference regions are retained. Morphological operations are performed on the high difference regions to finally locate the paper candidate regions.

[0020] As a further improvement of the present invention, the specific implementation process of the trajectory encoding and counting logic is as follows:

[0021] A continuous acquisition command is sent to the multispectral industrial camera, and a temporary ID, including acquisition timing, sub-block coordinates, and channel identifier, is assigned to the candidate paper region. Gray-level gradient extreme points within the candidate region are extracted as feature points. Based on the coordinate changes of the same feature point in adjacent frames, a formula is used to... The pixel displacement is calculated, where, These represent the feature points at... Pixel displacement along the axis. Represents the feature points of frame t. pixel coordinates, Indicates the first Same feature point in frame Pixel coordinates;

[0022] Based on the camera calibration parameters, the pixel displacement is converted into the actual physical displacement to obtain the final displacement vector;

[0023] Set trajectory constraint rules based on the physical dimensions of the paper;

[0024] The theoretical position of the current frame is predicted by fitting the displacement vectors of the previous two frames; a unique trajectory encoding is generated for the complete coverage of the three stages of entry, stabilization and departure, including the entry frame number, average trajectory velocity, departure frame number and feature check code, and the total number of encodings per unit time is counted to obtain the counting result A.

[0025] As a further improvement of the present invention, the specific operation steps of the thickness gradient counting logic are as follows:

[0026] A low-angle laser emitter is deployed below the stacked platform, and a CCD camera is deployed above it, so that the laser beam is at a preset incident angle. Illuminate the stacked surface and acquire images of the reflected light stripe deformation; generate a grayscale distribution curve of the reflected light stripe with the stack width as the horizontal axis and the grayscale value as the vertical axis, and calculate the average slope of the grayscale distribution curve to obtain the stacked reflection slope R; use the formula... The number of stacking layers is obtained, where This represents the slope of reflection from a single sheet of paper. This represents the increment of the slope of a single sheet of paper. Indicates the thickness of a single sheet of paper. Indicates the correction factor;

[0027] If the stack is tilted, the tilt angle is obtained from the top image. The number of stacked layers is corrected, the corrected number of stacked layers is integerized, and the edge integrity is verified based on the near-infrared channel to finally obtain the counting result B.

[0028] As a further improvement of the present invention, the specific implementation process of step S4 is as follows:

[0029] Based on the absolute difference between counting results A and B And compare it with the preset verification threshold H; if Then, the arithmetic mean of A and B is taken as the final counting result F, and the decimal result is rounded according to the rounding rule of rounding to the nearest even number.

[0030] like Then, the anomaly investigation process will be initiated: when At that time, based on velocity deviation, trajectory curvature, and morphological integrity, pseudo-trajectories are identified in the dynamic trajectory, and the corrected trajectory is obtained after eliminating them. ;when At that time, the correction result is obtained by locating the gray-level abrupt change region through near-infrared image and correcting the slope of the reflected light stripe. If the difference still exceeds the threshold after correction, a confidence score is obtained based on a weighted formula combining trajectory integrity weight, velocity consistency, and morphological regularity. The confidence score is obtained by weighting the slope smoothness, edge sharpness, and goodness of fit using a formula. The system prioritizes the result with higher confidence level as the final output; if the confidence level deviation is small, an alarm is triggered and the system switches to a degraded mode to await manual intervention.

[0031] Compared with the prior art, the beneficial effects of the present invention are:

[0032] This invention constructs a system with a multispectral industrial camera as the sensing core, preset fixed reference points and photoelectric sensors as the environmental perception foundation, and a dynamically updated baseline feature library to ensure the long-term stability of the counting benchmark. It embeds a difference heatmap localization mechanism throughout the entire process of image acquisition, preprocessing, feature comparison, and counting execution. It performs three-dimensional matrix-based quantitative analysis of key interference features and achieves accurate statistics through trajectory encoding and thickness gradient dual-mode counting logic. Simultaneously, it dynamically adapts high frame rate acquisition modes and counting strategies based on real-time image quality and scene type, intelligently distinguishing between dynamic transmission and static stacking scene requirements. This effectively solves the problems of false detection and missed detection caused by light fluctuations, mechanical vibrations, and dust interference in complex industrial environments using traditional machine vision counting methods. It significantly improves the accuracy and scene adaptability of the paper product counting process. Attached Figure Description

[0033] Figure 1 This is a flowchart of the method of the present invention. Detailed Implementation

[0034] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.

[0035] Example:

[0036] like Figure 1 As shown, a machine vision-based paper product counting method includes dynamic interference baseline library construction, real-time anomaly detection and localization, multimodal counting execution, and cross-validation of counting results.

[0037] S1. Construction of Dynamic Interference Baseline Library: This is used to quantify the inherent interference characteristics of the recording and counting area in a paperless, empty scenario, and to build a securely stored and dynamically updated interference baseline library. The specific implementation process is as follows:

[0038] When the device initializes and starts, a multispectral industrial camera is deployed in the target counting area. Based on the triangulation principle, three fixed reference points are preset in the target counting area for vibration and displacement detection. An encrypted connection is established between the camera and the industrial control host via the OPC UA security protocol. The industrial control host sends continuous acquisition commands to the multispectral industrial camera to synchronously trigger the acquisition of preset fixed frames of paperless environment images via dual channels, including a visible light channel and a near-infrared channel. Interference features are extracted and quantized from the paperless environment images, including:

[0039] Environmental noise characteristic coding coefficients:

[0040] Light source flicker characteristics: Extract the global gray-level mean value from a fixed frame of a paperless environment image in the visible light channel to obtain a gray-level mean value sequence, perform Fourier transform, and extract the flicker frequency F corresponding to the peak value of the power spectrum; based on the gray-level mean value sequence, extract the maximum and minimum values ​​of the global gray-level mean to obtain the gray-level fluctuation amplitude. The flicker feature coding coefficients of the light source are obtained based on the flicker frequency and grayscale fluctuation amplitude. The flicker frequency must be within a preset range. If the flicker frequency exceeds the preset range, it is determined that the light source is abnormal, and recalibration is performed until the flicker frequency is within the preset range.

[0041] Suspended dust features: For fixed-frame images of a paperless environment in the near-infrared channel, dust particles are segmented based on the Otsu adaptive thresholding method to obtain a set of dust pixels for each frame; each dust particle is tracked, and a filtering window is set to... Pixels are based on state equations To make predictions and updates, among which, Indicates the first Frame dust coordinates They are respectively Instantaneous velocity in the axial direction, The frame interval is represented; a trajectory vector for each dust particle is generated based on the state equation, and the average velocity of the trajectory is obtained based on the trajectory vector. With trajectory curvature Generate suspended dust feature coding coefficients ;

[0042] Carrier interference feature encoding:

[0043] Carrier texture features: Random noise is removed from the image based on the global grayscale mean of a fixed frame of a paperless environment image using the visible light channel, resulting in the carrier average texture image. This carrier average texture image is then divided into... Sub-blocks of pixels, generated based on the Sobel operator algorithm The grayscale gradient along the axis is used to obtain the gradient intensity and gradient direction of the sub-block. The gradient intensity and gradient direction information of all sub-blocks are combined to generate a two-dimensional texture matrix, where each element corresponds to the gradient intensity and gradient direction of a sub-block.

[0044] Vibration characteristics of the carrier: Based on preset fixed points, the coordinates of each fixed point are extracted, and then analyzed using a formula. The displacement of the fixed point is calculated. ,in, Represents each fixed point In the The displacement of the frame relative to the initial position of the fixed point; Representing fixed points At the initial position of the first frame The coordinate values ​​of the axis. Indicates a fixed point In the Frames The coordinate values ​​of the axis; the standard deviation of the displacement at all fixed points is obtained based on the displacement of all fixed points and marked as the carrier vibration coding coefficient.

[0045] Paper residue interference coding:

[0046] A pixel-by-pixel maximum value operation is performed on the paperless image of the fixed frame in the near-infrared channel to obtain the residual interference enhanced image. The Canny edge detection algorithm is used to extract the contours of fibers and paper scraps. For each extracted contour, morphological operations are used to obtain the contour perimeter and area. Interference with an area exceeding the preset residual threshold is removed. The average perimeter C and average area S of the remaining residual interference are calculated. The final bias code is (C, S).

[0047] After all interference features are encoded, they are integrated into a baseline feature set, recorded in a structured manner, and written into an industrial database.

[0048] Baseline update pre-detection is initiated when any of the following triggering conditions are met:

[0049] (1) The equipment runs continuously for the preset maximum operating time;

[0050] (2) The cumulative count reaches the preset maximum count;

[0051] (3) The administrator manually triggers the baseline update;

[0052] (4) Real-time sudden interference detection: Based on the deployed auxiliary sensors, the environmental parameters are monitored in real time. When the sensor detects a sudden change in environmental parameters, such as the flicker frequency fluctuating by more than 20% within 1 second or the dust density increasing by 3 times, the baseline update pre-detection is immediately triggered.

[0053] When baseline update pre-detection is triggered, the device re-acquires paperless images of fixed frames, extracts a temporary feature set and compares it with the existing baseline feature set. If the differences of multiple features exceed a preset threshold, the complete baseline update process is triggered, replacing the old baseline feature set with the new baseline feature set, while retaining the historical baseline version for retrospective purposes.

[0054] S2. Real-time anomaly detection and positioning: When the device detects an object entering the target counting area based on the photoelectric sensor, it performs real-time anomaly detection. The specific implementation process is as follows:

[0055] Real-time acquisition commands sent to the multispectral camera, including dual-channel synchronous triggering and scene adaptation parameters;

[0056] Synchronous triggering: The high-precision synchronous clock unit built into the industrial control host generates a trigger pulse, which is transmitted to the camera through a dedicated synchronous signal line. After receiving the trigger pulse, the camera simultaneously sends an exposure start command to the visible light and near-infrared channels. The exposure time and gain parameters are uniformly configured through the camera's internal registers, thus realizing synchronous triggering of the visible light and near-infrared channels.

[0057] Adaptive acquisition mode: The paper movement speed is detected in real time by photoelectric sensor. When the paper movement speed is lower than the preset minimum threshold, the high frame rate mode is enabled for image acquisition. When no paper movement is detected, the fixed frame mode is enabled for image acquisition.

[0058] Based on real-time images acquired by a multispectral camera, multi-step optimization is performed using the camera's built-in preprocessing unit, including:

[0059] Defect Pixel Repair: The algorithm uses the average interpolation logic of adjacent pixels to repair the coordinates of defective pixels recorded in the factory calibration of the camera sensor. The gray value of the defective pixel is replaced with the average gray value of the adjacent pixels to avoid interference of a single abnormal pixel with local feature calculation.

[0060] Vignette correction: Based on the vignetting data calibrated at the camera's factory settings, adaptive compensation is performed on the grayscale values ​​of the image edge regions;

[0061] Adaptive noise reduction: For random noise in the environment, an adaptive median filtering algorithm is adopted, which dynamically adjusts the size of the filter kernel based on the gray-level distribution of the pixel neighborhood;

[0062] Preprocessing verification: The preprocessed image is compared with the preset standards based on the camera's built-in verification unit to detect and repair the number of bad pixels and the grayscale uniformity after vignetting correction. Images that do not meet the standards will be automatically discarded and re-acquired.

[0063] The logic for generating the baseline feature set includes feature segmentation threshold, calculation algorithm, and encoding format; interference features are extracted and quantized from the acquired real-time images to generate a new baseline feature set.

[0064] Abnormal features that appear during the extraction process are automatically marked and corrected using interpolation to ensure the integrity of the current feature set;

[0065] After extraction, the industrial control host automatically verifies the consistency between the dimensions of the current feature set and the dimensions of the baseline feature set. If the dimensions do not match, the extraction is repeated.

[0066] A three-dimensional difference matrix is ​​generated by comparing the difference between the current feature set and the baseline feature set using a preset algorithm. The specific implementation process is as follows:

[0067] Environmental noise difference: through formula The environmental noise difference value was calculated, where, This indicates the flicker frequency deviation of the light source. These represent the real-time light source flicker frequency and the baseline light source flicker frequency, respectively. This represents the trajectory curvature deviation term. These are the influence weighting factors for the flicker frequency deviation term and the trajectory curvature deviation term, respectively.

[0068] Carrier interference differences: through formula The carrier interference difference value is calculated, where M represents the 2D texture matrix. Represents the square root of the sum of squares of all elements in a 2D texture matrix; These represent the real-time vibration standard deviation and the baseline dynamic standard deviation, respectively. Indicates the vibration difference term. , The square root of the sum of squares of all elements of the texture matrix and the influence weighting factor of the vibration difference term are respectively used;

[0069] Residual interference difference: If the area of ​​the real-time residual contour is greater than n times the average area of ​​the reference residual contour, it is determined to be a residual interference difference. If the real-time residual contour area is less than n times the average area of ​​the baseline residual contour, it is determined to be a residual interference difference. 0;

[0070] The preprocessed real-time image is divided into non-overlapping uniform segments, and sub-blocks are automatically divided and adjusted based on the preset paper size. For example, A4 paper corresponds to 20×20 pixels, and a business card corresponds to 5×5 pixels.

[0071] Sub-block numbers are arranged in row and column order; if the image resolution cannot be divided by the sub-block, zero-padding is performed on the remaining edge areas.

[0072] For each sub-block, the local contribution parameters corresponding to the three-dimensional difference matrix are extracted; the standard deviation of gray-level fluctuation within the sub-block corresponds to the local contribution of environmental noise difference, the difference of texture matrix elements corresponding to the sub-block corresponds to the local contribution of carrier interference difference, and the area ratio of fibrous regions within the sub-block corresponds to the local contribution of residual interference difference; the comprehensive difference value of the sub-block is obtained by using a weighted summation formula, with the weights consistent with the three-dimensional difference matrix.

[0073] Normalize the overall difference values ​​of all sub-blocks and map them to... The interval eliminates the magnitude difference of the difference value under different scenarios; adopts a linear color mapping rule, the difference value from 0 to 1 corresponds to the gradient transition of color from light to dark, sets multiple color gradient thresholds, and each interval corresponds to the corresponding color range to generate a difference heatmap, while retaining the mapping relationship between sub-block number and color, and supporting subsequent reverse query of spatial coordinates.

[0074] Based on the calibration experiment, a difference threshold is set. The difference heatmap is traversed based on the difference threshold, and sub-blocks in the difference heatmap that are smaller than the preset scene adaptive threshold are removed, while high difference areas are retained. The scene adaptive threshold is dynamically generated based on the interference fluctuation range in the baseline feature set, for example, 1.5 times the standard deviation of the carrier vibration.

[0075] Morphological operations are performed on high-discrepancy regions to obtain candidate regions for the paper.

[0076] S3, Multimodal counting execution:

[0077] When the target counting area is on the conveyor belt, the trajectory encoding counting logic is activated:

[0078] The industrial control host sends continuous acquisition commands to the multispectral camera and assigns temporary IDs to the candidate areas of the paper, including acquisition timing identifiers, sub-block coordinates, and channel identifiers.

[0079] Extract the gray-level gradient extreme points within the candidate area of ​​the paper as feature points, and combine the coordinates of the feature points in adjacent frames with the acquisition time difference between the two frames. Through formula The pixel displacement is calculated, where, These represent the feature points at... Pixel displacement along the axis. Represents the feature points of frame t. pixel coordinates, Indicates the first Same feature point in frame Pixel coordinates;

[0080] Based on the camera calibration parameters, the pixel displacement is converted into the actual physical displacement to obtain the final displacement vector;

[0081] Based on the preset physical dimensions of the paper, including length L and width W, trajectory constraint rules are set: if the displacement vectors of 3 consecutive frames satisfy... If the trajectory of a single frame exceeds the constraint threshold, it is determined to be a continuation of the same paper's trajectory, and the temporary IDs are merged; if the displacement vector of any frame exceeds the constraint threshold, interpolation verification is initiated.

[0082] The theoretical position of the current frame is predicted by fitting the displacement vectors of the previous two frames. If the actual position deviates from the theoretical position... If the deviation exceeds the limit, it is determined to be an abnormal displacement caused by temporary occlusion, and the trajectory correlation is maintained; if the deviation exceeds the limit, it is considered to be an abnormal displacement caused by temporary occlusion. If the trajectory is broken, the current temporary ID will be cancelled.

[0083] A unique trajectory code is generated for each piece of paper with a complete trajectory. The encoding format is the entry frame number, the average trajectory speed, the exit frame number, and the feature check code. The average trajectory speed is calculated from the total displacement vector, and the feature check code is generated based on the hash value of the trajectory vector.

[0084] Trajectory integrity satisfies three-stage coverage:

[0085] Entry stage: The paper candidate region enters the field of view from the image edge, and the displacement meets the constraints for 3 consecutive frames;

[0086] Stable phase: The candidate paper region continues to move within the field of view, and the displacement vector remains stable;

[0087] Leaving phase: The paper candidate region leaves the field of view from the image edge, with no subsequent displacement for 3 consecutive frames.

[0088] If any stage is missing, the trajectory is considered incomplete and will not be encoded.

[0089] The total number of unique trajectory codes per unit time is counted to obtain the counting result A for the dynamic transmission scenario; during the counting process, a trajectory code buffer pool is established, and duplicate codes are excluded by comparing the entry frame number with the feature check code; at the same time, the theoretical calculation range is obtained by multiplying the paper physical size, conveyor belt speed and the counting time.

[0090] If the actual statistical result exceeds the preset maximum excess ratio of the theoretical counting range, a secondary verification is initiated to recheck the integrity of the trajectory code; if the verification passes, the counting result A is temporarily stored in the industrial control host cache; if the verification fails, it is marked as a suspicious result and the equipment self-test is triggered.

[0091] When the target counting region is a stacking platform, the thickness gradient counting logic is activated:

[0092] A low-angle laser emitter is deployed below the stacking platform, and a CCD camera is deployed at the corresponding position above it. The laser beam illuminates the surface of the stacked paper at a preset incident angle to form a reflected light stripe. The deformation image of the reflected light stripe is acquired, and the gray value distribution curve of the reflected light stripe is generated with the stacking width as the horizontal axis and the gray value as the vertical axis. The average slope of the gray value distribution curve is calculated to obtain the stacking reflection slope R.

[0093] Through formula The number of stacking layers is calculated; where, This represents the slope of reflection from a single sheet of paper. This represents the increment of the slope of a single sheet of paper. Indicates the thickness of a single sheet of paper. Indicates the preset incident angle. This represents the correction factor, used to correct calculation errors caused by factors such as tiny air gaps between papers, laser scattering, and surface wrinkles. The optimal value is obtained by calibration based on multiple sets of stacked samples with known layers.

[0094] The counting result B of the static stacked scene is obtained based on the number of stacking layers;

[0095] If the stacked papers are tilted, the tilt angle can be obtained from the top image captured by the camera. Through formula Make corrections; adjust the calculated number of layers. Perform integer conversion if The decimal part is taken, and the integer part is then verified through the near-infrared channel to check the integrity of the stacking edge, which helps to determine the final number of stacking layers.

[0096] Both counting results A and B are temporarily stored in the industrial control host cache area, and metadata including counting timestamps, scene types, and device parameters are recorded for verification.

[0097] S4. Cross-validation of counting results

[0098] If the equipment covers both dynamic and static scenarios, the industrial control host synchronously retrieves the counting result A of the dynamic transmission scenario and the counting result B of the static stacking scenario from the buffer, and then uses the formula... Calculate the absolute difference between A and B, and set a verification threshold H based on the counting error tolerance in the industrial scenario. The specific implementation process is as follows:

[0099] If the calculated absolute difference between A and B If the counting results A and B are consistent, the arithmetic mean of the counting results A and B is taken as the final counting result F; if the final counting result is a decimal, it is rounded up according to the rounding rule of rounding to the nearest even number.

[0100] The final counting result F is integrated with metadata into a structured record, output to the control panel display in real time, and written to the industrial database. At the same time, the temporary counting results A and B in the buffer are cleared.

[0101] If the calculated absolute difference between A and B Then, the anomaly investigation process will be initiated:

[0102] (1) When At that time, perform dynamic scene pseudo-trajectory investigation and correction of counting result A:

[0103] The device iterates through all unique trajectory codes in the dynamic scene and performs multi-dimensional pseudo-trajectory determination:

[0104] Speed ​​deviation verification: The speed deviation rate is obtained based on the average speed of the trajectory and the preset speed of the paper. If the speed deviation rate is greater than the preset threshold, it is marked as a suspicious pseudo trajectory.

[0105] Track curvature verification: If the track curvature is greater than twice the paper track curvature, the suspicious mark is reinforced;

[0106] Morphological integrity verification: Check the coverage of the trajectory. If it is not completely covered or the trajectory length is less than 50% of the minimum length of a single sheet of paper, it is judged as a false trajectory.

[0107] Perform a removal operation on the marked pseudo-trajectories, recount the total number of remaining valid trajectory codes, and generate a corrected count result. ;like Based on the counting results The arithmetic mean of B yields the final result F;

[0108] like If the absolute difference with B is still greater than the verification threshold, further check the dynamic scene parameters, including verifying whether the camera frame rate is adapted to the current conveyor belt speed and checking whether the preset physical size of the paper is consistent with the actual product.

[0109] (2) When At that time, perform static scene abnormal slope investigation and count result B correction:

[0110] Abnormal slope identification: Based on the gray-scale change detection and edge continuity analysis of the stacked top surface image acquired by the near-infrared channel, abnormal areas are located. If the gray-scale change amplitude exceeds 3 times that of the normal surface and the number of consecutive edge pixels is less than 5, the area is determined to be a wrinkle or impurity interference area.

[0111] Slope Correction: For the grayscale distribution curve of the reflected light stripe, the slope of the abnormal transition segment is replaced with the average slope of the nearest normal region, and the number of stacking layers is recalculated. If the abnormal region accounts for more than 30% of the total stacking area, the current image is deemed unreliable, and a new stacked image is acquired. The grayscale distribution curve is reconstructed based on the new image to generate the correction result. ;

[0112] like Based on the counting results and The arithmetic mean of the two results is used to obtain the final result F;

[0113] like and If the absolute difference is still greater than the verification threshold, the correction process is executed again.

[0114] If the number of corrections reaches the preset maximum number of corrections, and the absolute difference between A and B is still greater than the verification threshold, calculate the confidence scores of A and B respectively based on the counting process data recorded in step S3:

[0115] Through formula The confidence score of the counting result A is calculated; where, The completeness of the trajectory is indicated by the percentage of trajectories that fully cover all three stages. Indicating speed consistency, it refers to the inverse ratio of the average speed of each track to the standard deviation of the set conveyor belt speed; The degree of morphological standardization refers to the proportion of trajectories whose trajectories conform to the preset paper size. These represent the weighting factors for trajectory completeness, velocity consistency, and morphological regularity, respectively.

[0116] Through formula The confidence score of the counting result B is calculated, where, This indicates the smoothness of the slope, referring to the smoothness of the grayscale distribution curve of the reflected light stripe; This indicates edge sharpness, referring to the clarity and continuity of stacked edges in near-infrared images; Goodness of fit refers to the degree to which the actual slope curve fits the ideal slope curve. These represent the weighting factors affecting slope smoothness, edge sharpness, and goodness of fit, respectively.

[0117] like If the score is greater than the preset confidence threshold, the count result with the higher confidence score will be used as the final count result.

[0118] like If the score is less than the preset confidence threshold, it indicates that the confidence scores of count result A and count result B have a small deviation. In this case, the system will directly trigger a safety alarm, prompting the administrator to intervene manually on the industrial control host interface.

[0119] When a manual intervention from the administrator is required, the device automatically switches to degraded mode. In degraded mode, the counting result of the single path with higher confidence is used as the temporary output, and the counting result is marked to remind the administrator to perform manual review.

[0120] The above description is merely a specific embodiment of this application, but the scope of protection of this application is not limited thereto. Any variations or substitutions that can be easily conceived by those skilled in the art within the scope of the technology disclosed in this application should be included within the scope of protection of this application. Therefore, the scope of protection of this application should be determined by the scope of the claims.

Claims

1. A machine vision-based paper product counting method, characterized by, Comprise: S1, dynamic interference baseline library construction: in the paperless empty scene, the image of the counting area is collected by the multispectral industrial camera, the interference features are extracted and quantized coding, the baseline feature set is constructed, and the baseline feature set is dynamically updated based on the trigger condition; S2, real-time anomaly detection and positioning: when the object enters the target counting area through the photoelectric sensor, the camera is controlled to collect real-time images, the real-time images are preprocessed, the real-time features are extracted, the baseline feature set is compared, the difference heat map is generated, and the paper candidate area is located; S3, multi-modal counting execution: based on the counting scene type, the corresponding counting logic is adopted; for dynamic conveying scene, trajectory coding counting logic is adopted to obtain counting result A; For static stacking scene, thickness gradient counting logic is adopted to obtain counting result B; S4, cross verification of counting results: compare the absolute difference value of counting results A and B, if the difference value is less than the verification threshold, the average value based on A and B is taken as the final counting result; If greater than the verification threshold, abnormal troubleshooting is carried out, including pseudo trajectory troubleshooting for dynamic scene or abnormal slope correction for static scene, and the confidence score result is taken as the final output.

2. The machine vision-based paper product counting method according to claim 1, wherein, The specific implementation process of the S1 step is as follows: When the device initialization starts, the multispectral industrial camera is deployed in the target counting area, and the vibration and displacement detection is carried out based on the preset fixed reference point according to the principle of triangular positioning; the double-channel synchronous trigger is used to collect the paperless environment image, and the double-channel includes visible light channel and near-infrared channel; The interference features are extracted from the paperless environment image, including environmental noise features, carrier interference features and paper residue interference features; The extracted interference features are quantized and coded to integrate into the baseline feature set, and stored in the industrial database; when the trigger condition is met, the baseline update pre-detection is started, and the trigger condition includes that the device continuous running reaches the preset maximum time, the cumulative counting reaches the preset maximum number, the administrator manually triggers or the environmental parameter mutates; If the difference between the new feature set and the old feature set exceeds the preset threshold, the baseline feature set is updated.

3. The machine vision-based paper product counting method according to claim 1, wherein, The specific operation steps of the S2 step include: Send real-time acquisition instruction to multispectral industrial camera, including adaptive acquisition mode based on the paper motion speed detected by photoelectric sensor, when the speed is lower than the preset threshold, high frame rate mode is enabled; the collected real-time image is preprocessed, including bad point repair based on adjacent pixel mean value interpolation, dark corner correction based on factory calibration data and random noise reduction using adaptive median filter algorithm, and the preprocessed image is verified; the interference features of real-time image are extracted to generate current feature set, and the consistency of its dimension with baseline feature set is verified, the difference degree of current feature set and baseline feature set is compared through preset algorithm, and three-dimensional difference matrix is formed; The environmental noise difference is calculated by the weighted sum of the flash frequency deviation and the trajectory curvature deviation; The carrier interference difference is calculated by the weighted sum of the norm of the texture matrix and the vibration standard deviation; The residual interference difference is determined based on the comparison of the real-time residual contour area and the average area of the reference residual contour.

4. The machine vision-based paper product counting method according to claim 1, wherein, The specific operation steps of the S2 step also include: The pre-processed real-time image is automatically divided into several sub-blocks based on a preset paper size, and zero padding is performed on the edge region; each sub-block is numbered, and local contribution parameters for the three-dimensional difference matrix are extracted, including the standard deviation of gray level fluctuation within the sub-block, the difference of texture matrix elements, and the area proportion of fibrous region; the comprehensive difference value of each sub-block is obtained through a weighted summation formula, and normalized processing is performed to map it to the [0, 1] interval; based on the linear color mapping rule, the sub-block comprehensive difference value is converted into a color gradient to generate a difference heat map; a scene adaptive threshold dynamically generated based on the baseline feature set interference fluctuation range is set, the difference heat map is traversed, sub-blocks with a comprehensive difference value lower than the scene adaptive threshold are removed, and high difference areas are retained; morphological operations are performed on the high difference area, and finally the paper candidate area is located.

5. The machine vision-based paper product counting method according to claim 1, wherein, The specific implementation process of the trajectory encoding counting logic is as follows: The continuous acquisition instruction is sent to the multi-spectrum industrial camera, and a temporary ID including acquisition time sequence, sub-block coordinates and channel identification is assigned to the paper candidate region; the gray scale gradient extreme points in the candidate region are extracted as feature points, the pixel displacement amount is obtained through calculation based on the coordinate change of the same feature point in adjacent frames by formula , wherein, respectively represent the pixel displacement amount of the feature point in the x-axis direction and the y-axis direction, represents the pixel coordinates of the feature point in the t-th frame, represents the pixel coordinates of the same feature point in the t-1-th frame, represents the pixel coordinates of the same feature point in the t+1-th frame.​​​ Convert the pixel displacement amount to the actual physical displacement based on the camera calibration parameters to obtain the final displacement vector; Set trajectory constraint rules based on the physical size of the paper; Based on the displacement vectors of the previous two frames, the theoretical position of the current frame is fitted; a unique trajectory code including the entering frame number, trajectory average speed, leaving frame number, and feature check code is generated for the trajectory covering the entering, stable, and leaving three stages; the total number of codes in a unit time is counted to obtain the counting result A.

6. The machine vision-based paper product counting method according to claim 1, wherein, The specific operation steps of the thickness gradient counting logic are as follows: Deploy low-angle laser emitter under the stacking platform and CCD camera above the stacking platform, so that the laser beam is incident at a preset angle Irradiate the stacking surface and collect the reflected light bar image; generate the gray value distribution curve of the reflected light bar with the stacking width as the horizontal axis and the gray value as the vertical axis, and calculate the average slope of the gray value distribution curve to obtain the stacking reflection slope R; the formula The number of stacked layers is obtained, wherein The single sheet reflection slope is represented by The single sheet slope increment is represented by The single sheet thickness is represented by The correction coefficient is represented by If there is a tilt in the stack, the tilt angle is acquired by the top surface image The number of stack layers is corrected, the corrected number of stack layers is integerized, and the edge integrity is verified based on the near-infrared channel to finally obtain the counting result B.

7. The machine vision-based paper product counting method according to claim 1, wherein, The specific implementation process of the S4 step is as follows: based on the absolute difference between the count results A and B and compared with a preset check threshold H; if the arithmetic mean of A and B is taken as the final count result F, and the decimal result is rounded according to the rule of rounding up six and rounding down five If , the abnormality checking process is started: when , the dynamic trajectory is checked for pseudo-trajectory based on speed deviation, trajectory curvature, and morphological integrity, and the corrected result is obtained after elimination ; when , the near-infrared image is positioned to locate the gray mutation area, and the slope of the reflected light bar is corrected to obtain the corrected result ; if the difference after correction is still above the threshold, the confidence score is obtained based on the trajectory integrity weight, speed consistency, and morphological standardization combined with the weighting formula ; The confidence score is obtained based on the slope smoothness, edge definition, and goodness of fit in combination with a weighting formula ; The result with higher confidence is preferentially used as the final output; if the confidence deviation is small, an alarm is triggered and a degraded mode is switched to wait for manual intervention.

Citation Information

Cited By

  • A paper cup stacking quantity online identification method and system based on machine vision

    CN122265979A

  • A paper cup stacking quantity online identification method and system based on machine vision

    CN122265979B