Scratch-resistant instrument control system and method based on image recognition
By using an image recognition-based scratch resistance tester control system, the system accurately calculates the positions of adjacent creases and analyzes grayscale and color changes, solving the problem of inaccurate scratch recognition under complex surface morphology and achieving high-precision scratch assessment and standardized report generation.
Patent Information
- Application Number
- CN202511097064.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-08-06
- Publication Date
- 2025-11-14
- Estimated Expiration
- Not applicable · inactive patent
AI Technical Summary
Existing technologies struggle to accurately identify scratches on complex surface morphologies. Ambient light interference affects image quality, resulting in inaccurate measurements of scratch boundaries and depths. Furthermore, the lack of multi-dimensional analysis capabilities makes it difficult to provide comprehensive and accurate damage assessments.
The scratch resistance tester control system, based on image recognition, accurately calculates the positions of adjacent creases and analyzes grayscale changes, color changes, and texture features through modules for crease positioning and area delineation, sample movement and scratching, image processing, and scratch effectiveness evaluation. Combined with depth and width thresholds, it generates a standardized test report.
It enables accurate identification and assessment of scratches, improves the standardization and quantification of damage assessment, reduces errors in traditional methods, and ensures the accuracy and data stability of scratch assessment.
Smart Images

Figure CN120948262A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of abrasion resistance testing technology, and in particular to a scratch resistance tester control system and method based on image recognition. Background Technology
[0002] The field of wear resistance testing technology includes research on detection and evaluation methods for the wear resistance of material surfaces. It mainly involves surface deformation analysis under mechanical stress, monitoring of microstructure changes, and establishment of durability quantification indicators. This field uses standardized testing equipment to simulate the friction and wear process in actual use scenarios, and combines optical observation methods to determine the degree of damage to the sample surface. It focuses on solving technical problems such as standardization of test parameters, quantitative assessment of damage, and improvement of testing efficiency, forming a complete technical system from sample preparation and test environment control to damage analysis.
[0003] One of the methods and control systems for a scratch resistance tester based on image recognition involves using a high-resolution image acquisition device to obtain microscopic morphology data of the material surface, achieving automatic identification of scratch marks through grayscale contrast analysis and texture feature extraction, configuring a multi-axis motion control module to precisely adjust the force angle and stroke of the scratching tool, integrating an illumination compensation device to eliminate ambient light interference, using an edge detection algorithm to delineate the boundary of the damaged area, calculating the scratch depth parameter based on the pixel density change rate, and finally generating a standardized test report that includes timestamps, coordinate positioning, and damage level.
[0004] Existing technologies rely on image recognition and grayscale analysis, but they are prone to overlooking minute scratches on complex surface morphologies. Ambient light interference affects image quality in actual testing, resulting in inaccurate measurement of scratch boundaries and depth. Furthermore, existing technologies lack the ability to perform multi-dimensional analysis of scratch features, making it difficult to provide a comprehensive and accurate damage assessment. Due to limitations in the testing environment and low control precision, standardization and data stability during the scratch testing process are difficult to guarantee, limiting their effectiveness in high-precision applications. Summary of the Invention
[0005] The purpose of this invention is to overcome the shortcomings of the existing technology and propose an image recognition-based scratch resistance instrument control system and method.
[0006] To achieve the above objectives, the present invention adopts the following technical solution: a scratch-resistant instrument control system based on image recognition, the system comprising: The crease localization and region delineation module uses a camera to acquire sample image data, extracts texture features of adjacent creases, calculates relative positions and distances, determines crease boundaries, delineates detection areas, and generates a dataset of detection area boundary coordinates. The sample movement and scraping module sets the sample's movement range on the platform based on the detection area boundary coordinate dataset, controls the sample movement, completes scraping through the scraping head, records images, and generates a scratch image sequence result; The image processing module calls the scratch region image data in the scratch image sequence results, analyzes grayscale continuity, detects boundary gradient and texture changes, compares color differences, extracts depth, width and spatial shape, identifies contour direction, and generates a scratch feature dataset. The scratch validity evaluation module compares the depth and width of scratches in the scratch feature dataset with a set scratch benchmark. If both the depth and width exceed the threshold, the scratch is considered valid; otherwise, it is invalid, and a scratch validity result is generated. The equipment control and scratch level module compares the depth and width of the effective scratches with the depth and width of the preset scratches based on the effective scratch data, classifies them into levels, and generates level control instructions.
[0007] As a further aspect of the present invention, the detection area boundary coordinate dataset specifically includes effective crease spacing values, crease boundary coordinates, and area vertex coordinates; the scratch image sequence results include time sequence number, effective image frame set, and blurred frame removal criteria; the scratch feature dataset specifically refers to depth parameters, width values, and morphological distribution vectors; the scratch validity results include valid identifiers, invalid identifiers, and dual threshold judgment criteria; and the level control instructions specifically include scratch level parameters, binary control codes, and a set of device operation signals.
[0008] As a further aspect of the present invention, the crease positioning and region delineation module includes: The image feature extraction submodule uses a camera to acquire sample image data, extracts the brightness, contrast, and texture direction of the crease region from the image data, combines multiple feature values, calculates the texture difference between adjacent creases to characterize the texture changes of different creases, and establishes a crease texture feature sequence. The crease spacing calculation submodule calls the trend of the change of the texture difference value in the crease texture feature sequence, determines the texture abrupt change point as the initial boundary of the crease, calculates the pixel distance between adjacent initial boundaries and compares it with the set distance benchmark value, filters out the paired creases, and obtains the effective crease spacing value. The detection area generation submodule determines the centerline position of the two parallel creases based on the effective crease spacing value, and extends it to both sides by a preset number of pixels to delineate the scratch detection area. It then extracts the pixel coordinates of the four vertices of the area to generate a detection area boundary coordinate dataset.
[0009] As a further aspect of the present invention, the sample moving and scraping module includes: The motion path setting submodule calls the detection area boundary coordinate dataset, parses the coordinates of the four vertices of the area to set the motion range of the sample on the fixed platform, calculates the linear interpolation points between each vertex, and sets the drive frequency and step value of the platform motor in combination with the preset scraping speed requirements, establishes a control sequence including start and stop signals, speed parameters and displacement commands, and obtains the sample motion path command set. The scraping process recording submodule drives the platform control system to make the sample move uniformly along the specified path and pass through the fixed scraping head according to the start / stop signals and displacement commands in the sample motion path instruction set. At the same time, it sends a synchronous trigger signal to the image acquisition card to control the camera to continuously capture images of the detection area at a preset frame rate and establish a real-time scraping image frame set. The image sequence generation submodule calls each image in the real-time scratch image frame set and assigns a unique sequence number based on the acquisition time. All image frames with sequence numbers are arranged in chronological order, and blurry image frames caused by platform start-up and shutdown jitter are removed to generate scratch image sequence results. As a further aspect of the present invention, the image processing module includes: The grayscale feature parsing submodule extracts the grayscale of pixels in the scratch region of a single frame image from the scratch image sequence result, calculates the grayscale difference between adjacent pixels, counts the grayscale change rate of five consecutive pixels, and establishes a grayscale gradient sequence. The chromaticity difference quantization submodule extracts the hue values of the scratch region and the background region in the grayscale gradient sequence, calculates the average difference between the two hue values, and performs a weighted calculation based on the saturation difference value to generate a chromaticity difference matrix. The morphological feature extraction submodule selects three sampling points at the boundary of the scratch area based on the chromaticity difference matrix, calculates the brightness difference value between each point and the background area as a depth parameter, measures the number of pixels in the maximum width direction of the scratch and converts it into the actual length value, and establishes a scratch feature dataset containing depth and width.
[0010] As a further aspect of the present invention, the scratch effectiveness evaluation module includes: The threshold comparison submodule calls the depth and width values of the scratches in the scratch feature dataset, and performs subtraction operations with the set depth and width reference values of the scratches respectively to calculate the depth difference and width difference, and establishes a two-parameter difference set; The validity determination submodule, based on the set of two-parameter differences, determines whether the depth difference and the width difference are non-negative. When both conditions are met, it is marked as a valid scratch; otherwise, it is marked as an invalid scratch, and a scratch validity result is generated.
[0011] As a further aspect of the present invention, the device control and scratch level module includes: The baseline parameter calculation submodule extracts the depth and width values of the effective scratches from the scratch validity results, and calculates the percentages of these values with the preset scratch depth and width to establish parameter ratio coefficients. The scratch level determination submodule, based on the parameter ratio coefficient, marks scratches as minor, moderate, and severe when both the depth ratio and width ratio reach different grading ranges, respectively, and generates scratch level parameters. The control command generation submodule converts the device operation signals corresponding to different scratch levels into binary control codes based on the scratch level parameters, and generates level control commands.
[0012] A scratch resistance meter control method based on image recognition, wherein the image recognition-based scratch resistance meter control method is executed based on the aforementioned image recognition-based scratch resistance meter control system, and includes the following steps: S1: The camera acquires sample image data, extracts texture features of adjacent creases, calculates relative positions and distances, determines crease boundaries, delineates detection areas, and generates a dataset of detection area boundary coordinates. S2: Based on the detection area boundary coordinate dataset, set the sample's movement range on the platform, control the sample movement, complete the scraping with the scraping head, record the image, and generate a scratch image sequence result; S3: Call the scratch region image data in the scratch image sequence result, analyze the grayscale continuity, detect the boundary gradient and texture changes, compare the color difference, extract the depth, width and spatial shape, identify the contour direction, and generate a scratch feature dataset; S4: The depth and width of the scratches in the scratch feature dataset are compared with the set scratch benchmark. If both the depth and width exceed the threshold, the scratches are considered valid; otherwise, they are invalid. The scratch validity result is generated. S5: Based on the effective scratch data, compare the depth and width of the effective scratch with the depth and width of the preset scratch, classify them into levels, and generate level control instructions.
[0013] Compared with the prior art, the advantages and positive effects of the present invention are as follows: In this invention, the delineation of the scratch detection area is optimized by accurately calculating the relative position and distance of adjacent creases, and image-based accurate damage assessment is achieved. Image processing technology performs detailed analysis on features such as grayscale changes, color changes, texture features, and boundary grayscale gradients of the scratches, enhancing the scratch recognition capability. Combined with depth and width threshold judgment mechanisms, effective and invalid scratches are effectively distinguished, ensuring the accuracy of scratch assessment. By comparing scratch depth and width, different levels of damage are classified, optimizing data generation and control output during the scratch test process, improving the standardization and quantification of damage assessment, and reducing errors in traditional methods. Attached Figure Description
[0014] Figure 1 This is a system flowchart of the present invention; Figure 2 This is a flowchart illustrating the acquisition process of the crease positioning and region delineation module of the present invention. Figure 3 This is a flowchart of the sample moving and scraping module of the present invention. Figure 4 This is a flowchart illustrating the acquisition process of the image processing module of the present invention. Figure 5 This is a flowchart illustrating the acquisition process of the scratch effectiveness assessment module of the present invention. Figure 6 This is a flowchart of the device control and scratch level acquisition module of the present invention. Detailed Implementation
[0015] The technical solution of the present invention will now be described with reference to the accompanying drawings.
[0016] In embodiments of the present invention, words such as "exemplarily," "for example," etc., are used to indicate that something is an example, illustration, or description. Any embodiment or design described as "exemplary" in the present invention should not be construed as being more preferred or advantageous than other embodiments or designs. Specifically, the use of the word "exemplary" is intended to present the concept in a concrete manner. Furthermore, in embodiments of the present invention, the meaning expressed by "and / or" can be both, or either one.
[0017] In the embodiments of this invention, the terms "image" and "picture" may sometimes be used interchangeably. It should be noted that, without emphasizing the distinction between them, they convey the same meaning. Similarly, the terms "of," "corresponding (relevant)," and "corresponding" may sometimes be used interchangeably. It should be noted that, without emphasizing the distinction between them, they convey the same meaning.
[0018] In this embodiment of the invention, sometimes a subscript such as W1 may be written in a non-subscript form such as W1. When the difference is not emphasized, the meaning they express is the same.
[0019] To make the technical problems, technical solutions and advantages of the present invention clearer, a detailed description will be given below in conjunction with the accompanying drawings and specific embodiments.
[0020] Please see Figure 1 This invention provides a technical solution: a scratch resistance tester control system based on image recognition, the system comprising: The crease localization and region delineation module uses a camera to acquire sample image data, extracts texture image features of adjacent creases from the image data, calculates the relative position and distance between adjacent creases on the sample surface and determines the crease boundary, delineates the scratch detection area based on the area between two adjacent parallel creases, and generates a dataset of detection area boundary coordinates. The sample movement and scraping module sets the movement range of the sample on the fixed platform based on the boundary coordinate dataset of the detection area, so that the sample moves uniformly along the scraping detection area and completes the scraping process through the fixed scraping head. The camera records the scratch images in the detection area in real time during the scraping process and generates a scratch image sequence result. The image processing module calls the grayscale change trend of the scratch area image data in the scratch image sequence, analyzes the grayscale continuity, boundary grayscale gradient features and image texture changes, compares the color of the scratch area image with the color of the background area, extracts the color of the scratch, determines the depth, width and spatial distribution of the scratch, identifies the edge contour and direction of the scratch, and generates a scratch feature dataset. The scratch validity assessment module compares the depth and width of scratches in the scratch feature dataset with the set scratch baseline. If the depth exceeds the set depth threshold and the width exceeds the set width threshold, it is judged as a valid scratch; otherwise, it is judged as an invalid scratch, and a scratch validity result is generated. The equipment control and scratch level module compares the depth and width of the valid scratches with the depth and width of the preset scratches based on the valid scratch determination information in the scratch validity results, and classifies the scratches into minor scratches, moderate scratches, and severe scratches, and generates control commands based on the scratch level results.
[0021] The detection area boundary coordinate dataset specifically includes effective crease spacing values, crease boundary coordinates, and area vertex coordinates. The scratch image sequence results include time sequence number, effective image frame set, and blur frame removal criteria. The scratch feature dataset specifically refers to depth parameters, width values, and morphological distribution vectors. The scratch validity results include valid identifiers, invalid identifiers, and dual threshold judgment criteria. The grade control instructions specifically include scratch grade parameters, binary control codes, and a set of device operation signals.
[0022] Please see Figure 2 The crease positioning and area delineation module includes: The image feature extraction submodule uses a camera to acquire sample image data, extracts the brightness, contrast, and texture direction of the crease region from the image data, combines multiple feature values, calculates the texture difference between adjacent creases to characterize the texture changes of different creases, and establishes a crease texture feature sequence. The camera acquires sample image data. Specifically, an industrial camera with a resolution of 5120x5120 pixels is positioned directly in front of a horizontally placed cardboard box sample. The sample surface has two parallel creases caused by repeated folding. The camera lens is kept 30 cm away from the sample plane. Under a 500 lux illumination from a ring-shaped shadowless lamp, an uncompressed 8-bit grayscale image in TIFF format is acquired. The image data is stored as a 5120x5120 two-dimensional integer matrix, where each element's value ranges from 0 to 255. The system then extracts the central region containing the two creases, a 2000x1000 pixel area, as the region of interest (ROI). Within the ROI, the system scans row by row, pixel by pixel, extracting the brightness of each pixel and calculating its local contrast and texture direction. The brightness... Directly extract pixels The grayscale value, for example, the brightness value of a pixel in a flat area is 180, and the brightness value of a pixel in a crease area is 70. The calculation of local contrast is based on the pixel value. Within a 5x5 neighborhood window centered on the pixel, the standard deviation of the grayscale values of 25 pixels within that window is calculated. Pixels in flat areas have a uniform grayscale distribution and a lower standard deviation, such as 3.5, while pixels in crease areas exhibit drastic grayscale value changes and have a higher standard deviation, such as 48.2. Texture direction is calculated by applying a 3x3 Sobel operator to calculate the gradient in the horizontal direction. and the gradient in the vertical direction Texture direction Then by calculating the arctangent function It was found that for horizontal creases, the gradient direction is mainly vertical, with an angle value close to 90 degrees. The system will adjust the brightness of each pixel. Contrast and texture direction Three eigenvalues are combined to form an eigenvector. Next, to quantify the texture difference between adjacent creases, the system divides the ROI into continuous, non-overlapping 10x1000 pixel rectangular blocks by row, and calculates the average feature vector of all pixels within each block. Then, for two adjacent rectangular blocks in the vertical direction (e.g., the first...),... line block and the first (row blocks), calculate the weighted Euclidean distance between their average feature vectors as the texture dissimilarity. The calculation process is as follows: ; Among them, the weighting coefficient , , This is based on prior knowledge. Texture direction is the most crucial factor in distinguishing creases, therefore it has the highest weight, followed by contrast, and then brightness. This setting is based on the analysis of 100 standard sample images. It is 0.7. It is 0.2. For example, the average characteristic of a flat region block is 0.1. The average characteristics of adjacent crease regions are Calculated The value is: ; The system calculates from the first row of the ROI to the last row, thus obtaining a one-dimensional array, which consists of a series of The values are used to establish a crease texture feature sequence.
[0023] The crease spacing calculation submodule calls the trend of the change of texture difference value in the crease texture feature sequence, determines the texture abrupt change point as the initial boundary of the crease, calculates the pixel distance between adjacent initial boundaries and compares it with the set distance benchmark value, filters out the paired creases, and obtains the effective crease spacing value. The system analyzes the changing trends of texture difference values in the crease texture feature sequence, for example, by calling upon 199 texture difference values. A one-dimensional array of values, where each value corresponds to the degree of texture variation between two adjacent 10-pixel high rectangular blocks in the sample image. The system searches for this value... Local peaks in the sequence are used to locate the row positions where the texture changes drastically. A value is considered a local peak if it is greater than the two immediately preceding and following peaks. The value must be greater than a dynamically set mutation threshold. The threshold is calculated by first calculating the entire The average of all 199 values in the sequence and standard deviation Then set The coefficient here Based on experimental data, a value of 2.5 was set. This setting effectively filters out spurious peaks caused by minute surface inhomogeneities or noise in the material. Assuming calculations yield... , Then the mutation threshold System traversal The sequence was found to be located in lines 25 and 76. The values are 80.2 and 81.5, both greater than 65.2. Therefore, the corresponding physical row positions of the sample image, such as the 250th and 760th row pixels, are determined as the preliminary boundaries of the crease, and their row coordinates are recorded. Subsequently, the system calculates the pixel distance between adjacent preliminary boundaries, i.e. Pixels, and compare that distance with a set distance reference value. The distance to the reference value was compared. The settings are based on the physical design specifications of the cardboard box sample. The design drawings indicate that the distance between the two core folds is 6.4 millimeters. Through pre-calibration, under the current camera shooting conditions, each millimeter corresponds to 80 pixels. Therefore... Set as For each pixel, the system sets a tolerance range to filter paired creases. This tolerance range is set to ±5% of the baseline value based on the fluctuations in the manufacturing process. The calculation result is Since the calculated pixel distance of 510 falls within this range, the system determines that the two preliminary boundaries are validly paired creases, thus obtaining the valid crease spacing value.
[0024] The detection area generation submodule determines the centerline position of two parallel creases based on the effective crease spacing value, and extends to both sides by a preset number of pixels to delineate the scratch detection area. It then extracts the pixel coordinates of the four vertices of the area to generate the detection area boundary coordinate dataset. Based on the effective crease spacing of 510 pixels and the row coordinates of the two creases being 250 and 760 respectively, the system first determines the centerline positions of the two parallel creases. Assuming the initial boundary is the centerline of the crease, the row coordinates of the two centerlines are: and Next, the system calculates the position of the centerline of the intermediate region between these two centerlines, and its row coordinates. Subsequently, the system started from the center line of the intermediate region. Begin by extending a preset number of pixels to both sides, namely upwards and downwards. The preset pixel count The settings reference the physical dimensions of the scratch head used in subsequent scratch tests. For example, if the physical width of the scratch head is 1.5 mm, to ensure the scratch head remains entirely within the detection area during movement with a safety margin, the width of the scratch area must be greater than 1.5 mm; here it is set to 2.0 mm. Based on the ratio of 80 pixels per millimeter, 2.0 mm corresponds to 160 pixels. Therefore, the number of pixels extending from the center line to one side... for Based on the pixels, the system calculates the row coordinates of the upper and lower boundaries of the scratch detection area, and the upper boundary coordinates. Lower boundary coordinates The horizontal range of the scratched area, i.e., its left and right boundaries, is determined based on the scratching stroke required for the sample to move on the platform. For example, the test procedure may require a 40 mm scratch in the center area of the sample, corresponding to a pixel length of... In pixels, if the total width of the image is 5120 pixels and its center point is at 2560 pixels, then the starting x-coordinate of the scratch is... End of x-coordinate Finally, the system integrates the coordinates of these four boundaries and extracts the pixel coordinates of the four vertices of the rectangular region in the image coordinate system, namely the top left corner (960, 425), the top right corner (4160, 425), the bottom left corner (960, 585), and the bottom right corner (4160, 585), to generate a dataset of boundary coordinates of the detection region.
[0025] Please see Figure 3 The sample moving and scraping module includes: The motion path setting submodule calls the detection area boundary coordinate dataset, parses the coordinates of the four vertices of the area to set the motion range of the sample on the fixed platform, calculates the linear interpolation points between each vertex, and sets the drive frequency and step value of the platform motor in combination with the preset scraping speed requirements, establishes a control sequence including start and stop signals, speed parameters and displacement commands, and obtains the sample motion path command set. The system first parses the pixel coordinates of four vertices representing the detection region from the dataset: top left (960, 425), top right (4160, 425), bottom left (960, 585), and bottom right (4160, 585). Based on these four vertex coordinates, the system sets the precise movement range of the sample on the fixed testing platform. Since the scraping action is horizontal, the movement path is set to the horizontal central axis of the rectangular region, with the ordinate of this central axis remaining constant. The starting point X-coordinate of the motion is 960, and the ending point X-coordinate is 4160. Therefore, the total pixel length of the path is... Based on the previously established conversion ratio of 80 pixels per millimeter, the physical distance corresponding to this path is... Next, the system, based on the preset scratching speed requirement of 2 mm / s in the mechanical property testing standard for cardboard box materials, sets the drive frequency and step value of the platform motor. The X-axis of the platform is driven by a stepper motor with inherent parameters of 200 steps per revolution and a ball screw lead of 2 mm. Therefore, the number of steps required for the motor to move the platform 1 mm is calculated as follows: Steps / mm, motor drive frequency The calculation method is based on the scraping speed. The number of steps per millimeter required by the motor The product of, i.e. ,in millimeters per second Steps per millimeter, the driving frequency is calculated. Hertz, the total step value required to complete a 40 mm displacement is Finally, the system integrates these calculated core parameters into a control sequence, which includes a start / stop signal to trigger the motion, set to the number "1", a drive frequency parameter to set the motor speed, set to the floating-point number 200.0, and a step value to set the total displacement, set to the integer 4000, to obtain the sample motion path instruction set.
[0026] The scraping process recording submodule drives the platform control system to make the sample move evenly along the specified path and pass through the fixed scraping head according to the start / stop signals and displacement commands in the sample motion path instruction set. At the same time, it sends a synchronous trigger signal to the image acquisition card to control the camera to continuously capture images of the detection area at a preset frame rate and establish a real-time scraping image frame set. Based on the start / stop signal "1", speed parameter "200.0 Hz", and displacement command "4000 steps" in the sample motion path command set, the system sends the command to the motion controller of the two-dimensional moving platform via an RS232 serial interface. After parsing the command, the controller immediately outputs a series of TTL level pulse signals to the X-axis stepper motor driver. The frequency of this pulse train is precisely 200 Hz, and the total number of pulses is 4000, thereby driving the sample stage to move along the preset horizontal central axis at a constant speed of 2 mm / s. During the movement, the sample passes directly above a tungsten carbide scraper head fixed by a clamp. The scraper head has a tip curvature radius of 0.1 mm and is subjected to a constant normal force of 5 Newtons through a precision spring loading mechanism. At the instant the sample stage begins to move, the motion controller sends a synchronization trigger signal with a duration equal to the total motion time to the external image acquisition card through one of its digital I / O output ports. The total motion time is... Therefore, the trigger signal is a high-level signal lasting 20 seconds. The image acquisition card is activated upon receiving the rising edge of this high-level signal and immediately sends an exposure trigger command to the industrial camera at a preset acquisition frame rate of 10 frames per second. This frame rate is set to ensure that one frame is captured for every 0.2 millimeters of movement at a scratching speed of 2 millimeters per second. During the entire 20-second scratching process, the camera will continuously capture and output a total of [number missing] frames. Images with a resolution of 5120x5120 pixels are generated and transmitted in real time through the CameraLink high-speed interface and stored in the computer's dynamic random access memory (RAM) to create a set of real-time scratch image frames.
[0027] The image sequence generation submodule calls each image in the real-time scratch image frame set and assigns a unique sequence number based on the acquisition time. It arranges all image frames with sequence numbers in chronological order and removes blurry image frames caused by platform start-up and shutdown jitter, generating scratch image sequence results. The system retrieves 200 images stored in memory from a real-time scraping image frame set. First, it processes each frame sequentially, assigning it a unique sequence number based on its acquisition time. Specifically, starting from the moment the platform's motion controller sends a synchronization trigger signal (T=0.0 seconds), the first acquired frame is assigned sequence number 1 and a timestamp of 0.0 seconds, the second frame is assigned sequence number 2 and a timestamp of 0.1 seconds, and so on, until the 200th frame is assigned sequence number 200 and a timestamp of 19.9 seconds. After numbering and sorting, the system performs a filtering operation to remove blurry image frames caused by minor mechanical vibrations that may occur during platform acceleration and deceleration. This filtering process involves calculating the clarity metric of each image frame, which is determined by calculating the grayscale variance after the image's Laplacian transform. To obtain, for a picture of size Image The formula for calculating its sharpness index is: ; in It uses a 3x3 Laplacian kernel (e.g., [[0,1,0],[1,-4,1],[0,1,0]]) to apply a Laplacian kernel to the original image in coordinates. The value obtained after performing a convolution operation at that point, and It is the average value of all pixel values in the entire Laplacian image, which the system will calculate. The value and a preset fuzzy judgment threshold The threshold is compared. The settings are based on 50 standard clear images and 50 blurry images caused by shaking. The value was determined after calculation, and statistics showed that clear images... The values are all greater than 1100, while the blurred image's... The values are all less than 700, therefore the threshold will be determined. When set to 900, the system calculates the first frame image in the sequence. The value is 510, which is below 900, therefore it is determined to be a blurry frame and removed from the sequence. Similarly, the last frame... The value was 560, and it was also removed. After traversing and judging all 200 frames of images, a total of 2 frames of images were removed. The remaining 198 clear frames of images were reorganized according to their original sequence number order to generate the scratch image sequence result.
[0028] Please see Figure 4 The image processing module includes: The grayscale feature parsing submodule extracts the grayscale of pixels in the scratch region of a single frame image from the scratch image sequence, calculates the grayscale difference between adjacent pixels, counts the grayscale change rate of five consecutive pixels, and establishes a grayscale gradient sequence. The system extracts the grayscale values of the scratch region pixels from a single frame image in the scratch image sequence. It selects the 100th frame image from the sequence for processing; this image is a 5120x5120 8-bit grayscale image matrix. The system first locks onto the previously defined detection region, a rectangular area of 3200x160 pixels. Within this region, the system analyzes each pixel from top to bottom along its vertical central axis, calculating the grayscale difference between adjacent pixels. Defined as located at the row pixel grayscale value With the location of the row pixel grayscale value The absolute value of the difference between them, i.e. For example, at the upper boundary of the scratch, a pixel row enters the scratch area from the background area, and its grayscale value sequence might be [180, 179, 110, 65, 62]. The calculated difference sequence is [1, 69, 45, 3]. Then, based on this difference data, the system calculates the grayscale change rate of five consecutive pixels. The grayscale change rate of the first five consecutive rows of pixels at the beginning of the action. The value is calculated as the difference between the maximum and minimum grayscale values among the five rows of pixels, divided by the pixel row number interval of 4. For example, for the grayscale value sequence [179, 110, 65, 62, 61], the maximum value is 179 and the minimum value is 61, and its rate of change is... For the sequence [182, 180, 181, 183, 182] within the background region, the maximum value is 183 and the minimum value is 180, with a change rate of... The system calculates the grayscale change rate at each position along the central axis from the starting row to the ending row. The values are stored sequentially in a one-dimensional array to create a grayscale gradient sequence.
[0029] The chromaticity difference quantization submodule extracts the hue values of the scratch region and the background region in the grayscale gradient sequence, calculates the average difference between the two hue values, and performs a weighted calculation based on the saturation difference value to generate a chromaticity difference matrix. The system first extracts the hue values of the scratch region and the background region from the grayscale gradient sequence. Then, it analyzes the distribution of these values within the sequence and sets the grayscale change rate. Exceeding a specific threshold The pixel location is identified as the boundary region, and this threshold Set to 3 times the mean of the entire sequence plus 3 times the standard deviation to distinguish the sharp changes in the scratch edges from the gentle fluctuations in the background. Assume that after calculation... The area with a change rate of 29.5 is identified as the boundary, while the area with a change rate of 0.75 is considered the background. The system determines the specific pixel range of the scratch area based on the boundary location and extracts the grayscale values of the pixels in that area from the original image as its "hue value." Simultaneously, it extracts the grayscale values of background pixels located more than 50 pixels from the boundary as their "hue values." For example, the system collects grayscale values from 1000 pixels within the scratch area, with an average value of 55.8, and collects grayscale values from 1000 pixels in the background area, with an average value of 181.2. The system then calculates the average difference in hue values between the two areas, i.e., the average grayscale difference. Next, the system calculates the saturation difference value. In a grayscale image, this difference value is defined as the absolute value of the difference between the standard deviations of the pixel grayscale values in two regions. Assuming the standard deviation of the grayscale values in the scratch region... The standard deviation of the grayscale values in the background area is 15.3. If the value is 2.5, then the saturation difference value is... Finally, a weighted calculation is performed. The weighting coefficients are set based on the fact that the average grayscale difference can more directly reflect the visibility of scratches, while the standard deviation difference serves as an auxiliary factor. Therefore, the grayscale difference weight is set accordingly. Saturation difference weight These two weight values were determined by regression analysis of the parameters of 100 known grade scratch samples, generating a color difference matrix.
[0030] The morphological feature extraction submodule selects three sampling points at the boundary of the scratch area based on the chromaticity difference matrix, calculates the brightness difference value between each point and the background area as the depth parameter, measures the number of pixels in the maximum width direction of the scratch and converts it into the actual length value, and establishes a scratch feature dataset containing depth and width. Based on the scratch location information identified in the chromaticity difference matrix, the system selects three sampling points, denoted as P1, P2, and P3, at positions of 25%, 50%, and 75% along the scratch length direction within the scratch region boundary of the original image. Next, the system calculates the brightness difference between each sampling point and the background region. This value is used as the scratch depth parameter. The brightness difference is directly represented by the difference between the pixel grayscale value at the sampling point and the average grayscale value of the background region. The average grayscale value of the background region has been calculated to be 181.2. Assuming the pixel grayscale values of the three sampling points are G(P1) = 52, G(P2) = 48, and G(P3) = 55, the brightness difference values of the three points are respectively... , , The final depth parameters Take the average of these three differences, that is Subsequently, the system measures the number of pixels along the maximum width direction of the scratch. Specifically, it scans at three positions (P1, P2, and P3) along a direction perpendicular to the scratch length and counts consecutive pixels with grayscale values below a certain threshold. The number of pixels, this threshold Set the background average gray level to three times the background gray level standard deviation, i.e. Assuming the pixel widths measured at points P1, P2, and P3 are 10 pixels, 12 pixels, and 11 pixels respectively, the system selects the maximum value of 12 pixels as the maximum width and converts this number of pixels into an actual length value according to a calibration ratio of 80 pixels / mm, i.e., the width. Millimeters, and finally the depth parameter and width value are integrated to create a scratch feature dataset containing both depth and width.
[0031] Please see Figure 5 The scratch effectiveness assessment module includes: The threshold comparison submodule calls the depth and width values of scratches in the scratch feature dataset, and performs subtraction operations with the set depth and width baseline values of the scratches respectively to calculate the depth difference and width difference, and establishes a two-parameter difference set; The system retrieves the depth and width values of scratches from the scratch feature dataset and extracts the calculated depth parameter from this dataset. and width value millimeters, and each compared with a pre-defined scratch depth reference value. and width reference value Perform a subtraction operation, where the depth reference value The settings referenced the Visual Acceptable Limit (AQL) standard for this cardboard box product. This standard, derived from a statistical analysis of the perceptibility of 100 scratch samples of varying severity by 50 testers, determined that when the lightness difference value was below 100, over 95% of the testers could not perceive the scratches at standard viewing distance (30 cm) and illumination (500 lux). Therefore, [the standard was set as follows]. Set to 100, width baseline value The setting is based on the product design specifications regarding functional defects. These specifications explicitly state that any surface scratches wider than 0.12 mm are considered defects that may affect long-term reliability. Therefore, [the following is a separate, unrelated clause:] The value is set to 0.12 mm, and the system then performs the specific subtraction operation to calculate the depth difference. Calculate the width difference The system then stores the two calculated differences in millimeters, creating a two-parameter difference set.
[0032] The validity determination submodule, based on the two-parameter difference set, determines whether the depth difference and the width difference are non-negative. When both conditions are met, it is marked as a valid scratch; otherwise, it is marked as an invalid scratch, and the scratch validity result is generated. Based on a two-parameter difference set, the system retrieves depth differences from the set. Difference between width and height The process proceeds to the millimeter level, then enters the judgment process, which includes two parallel logical condition judgments. The first judgment is whether the depth difference is a non-negative number. Whether it is valid or not, will Substituting the value 29.53, since... The condition is met, so the first condition is true. The second condition is whether the width difference is non-negative. Whether it is valid or not, will Substituting the value 0.03, since... The condition is true, so the second condition is also true. The system then performs a logical AND operation on these two conditions. When both conditions are true, the currently analyzed scratch is marked as a "valid scratch." If, in another instance, the measured scratch width is 0.11 mm, then the width difference is... millimeters, at this point the second condition If the condition is not met, the judgment result is false, and the result of the logical AND operation is also false. The scratch will then be marked as "invalid scratch". In this example, since both conditions are true, the system finally outputs the mark as "valid scratch", generating a scratch validity result.
[0033] Please see Figure 6 The equipment control and scratch rating module includes: The baseline parameter calculation submodule extracts the depth and width values of valid scratches from the scratch validity results, calculates the percentages of these values with the preset scratch depth and width, and establishes parameter ratio coefficients. The system first identifies valid scratches as "valid scratches" from the scratch validity results and then retrieves their corresponding depth parameters. and width value The system then compared these two measured values with a preset scratch depth grading benchmark, in millimeters. and width grading benchmark The percentage calculations and the setting of these two grading benchmarks are based on statistical data from product failure analysis. This data shows that when the lightness difference value of the scratch reaches 200 or the physical width reaches 0.25 mm, the pixel yield of the cardboard box sample will drop by more than 5%, which is a critical point for serious defects. Therefore, the depth grading benchmark is... Set to 200, and set the width grading reference. The setting is 0.25 mm, and the system then performs a percentage calculation, determining the depth scaling factor. The calculation is the measured depth value divided by the depth grading benchmark value and then multiplied by 100, i.e. Width ratio factor The calculation is to divide the measured width value by the width grading benchmark value and then multiply by 100, that is... The system stores these two calculated percentage values and establishes parameter proportional coefficients; The scratch level determination submodule, based on parameter ratio coefficients, marks scratches as minor, moderate, and severe when both depth and width ratios reach different grading ranges, and generates scratch level parameters. Based on the parameter scaling factor, the system retrieves the depth scaling factor from memory. Width scaling factor Then, these two coefficients are compared one by one with the three preset scratch level grading intervals. These intervals are defined according to the production quality control specifications for different degrees of defects. Specifically, the intervals are as follows: Slight scratches require both depth and width ratios to be in the range of [0%, 40%]; medium scratches require both depth and width ratios to be in the range of [40%, 70%]; and severe scratches require at least one of the depth and width ratios to exceed 70%. The system first judges the slight scratch level because... and If none of the values fall within the [0%, 40%] range, this judgment result is false. The system then proceeds to judge the level of medium scratches, based on the following conditions: and Substitute the values into the first condition. The second condition is valid. This also applies because both conditions are met simultaneously. The system will then classify the scratch as a "moderate scratch" and will not proceed with further severity assessment. If the scratch is measured in another example... , Therefore, this scratch does not meet the criteria for a medium-sized scratch, but because... If the criteria for severe scratches are met, the scratches will be marked as "severe scratches". Based on the judgment result of the current instance, scratch level parameters will be generated.
[0034] The control command generation submodule converts the equipment operation signals corresponding to different scratch levels into binary control codes based on the scratch level parameters, and generates level control commands. Based on the scratch level parameters, the "medium scratch" label is obtained and matched with a preset level-signal mapping table. This table defines the subsequent physical operation signals of the equipment corresponding to different scratch levels. The table is set according to the material handling process of the automated production line. Specifically, "minor scratch" corresponds to the "release" signal, "medium scratch" corresponds to the "transfer to re-inspection station" signal, "severe scratch" corresponds to the "direct rejection" signal, and "invalid scratch" corresponds to the "no operation" signal. In this example, the "medium scratch" label successfully matches the "transfer to re-inspection station" equipment operation signal. Subsequently, the system converts the device operation signal described in the text into a 4-bit binary control code that can be directly parsed and executed by the downstream programmable logic controller (PLC). The conversion rule is as follows: "No operation" is converted to 0000, "Release" is converted to 0001, "Transfer to re-inspection station" is converted to 0010, and "Direct rejection" is converted to 0100. Each bit in this encoding rule represents a specific control channel and has a clear physical meaning. Therefore, the system converts the "Transfer to re-inspection station" signal into its corresponding binary code 0010 and packages the binary data into a data frame to generate a grade control instruction.
[0035] A scratch-resistant instrument control method based on image recognition includes the following steps: S1: The camera acquires sample image data, extracts texture features of adjacent creases, calculates relative positions and distances, determines crease boundaries, delineates detection areas, and generates a dataset of detection area boundary coordinates. S2: Based on the detection area boundary coordinate dataset, set the sample's movement range on the platform, control the sample movement, complete the scraping with the scraping head, record the image, and generate a scratch image sequence result; S3: Call the scratch region image data in the scratch image sequence results, analyze the grayscale continuity, detect boundary gradient and texture changes, compare color differences, extract depth, width and spatial shape, identify contour direction, and generate scratch feature dataset; S4: Compare the depth and width of scratches in the scratch feature dataset with the set scratch baseline. If both the depth and width exceed the threshold, the scratches are considered valid; otherwise, they are invalid. Generate scratch validity results. S5: Based on the valid scratch data, compare the depth and width of the valid scratch with the depth and width of the preset scratch, classify them into levels, and generate level control instructions.
[0036] The above are merely specific embodiments of the present invention, but the scope of protection of the present invention is not limited thereto. Any variations or substitutions that can be easily conceived by those skilled in the art within the technical scope disclosed in the present invention should be included within the scope of protection of the present invention. Therefore, the scope of protection of the present invention should be determined by the scope of the claims.
Claims
1. A scratch resistance tester control system based on image recognition, characterized in that, The system includes: The crease localization and region delineation module uses a camera to acquire sample image data, extracts texture features of adjacent creases, calculates relative positions and distances, determines crease boundaries, delineates detection areas, and generates a dataset of detection area boundary coordinates. The sample movement and scraping module sets the sample's movement range on the platform based on the detection area boundary coordinate dataset, controls the sample movement, completes scraping through the scraping head, records images, and generates a scratch image sequence result; The image processing module calls the scratch region image data in the scratch image sequence results, analyzes grayscale continuity, detects boundary gradient and texture changes, compares color differences, extracts depth, width and spatial shape, identifies contour direction, and generates a scratch feature dataset. The scratch validity evaluation module compares the depth and width of scratches in the scratch feature dataset with a set scratch benchmark. If both the depth and width exceed the threshold, the scratch is considered valid; otherwise, it is invalid, and a scratch validity result is generated. The equipment control and scratch level module compares the depth and width of the effective scratches with the depth and width of the preset scratches based on the effective scratch data, classifies them into levels, and generates level control instructions.
2. The image recognition-based scratch resistance tester control system according to claim 1, characterized in that: The detection area boundary coordinate dataset specifically includes effective crease spacing values, crease boundary coordinates, and region vertex coordinates. The scratch image sequence results include time sequence number, effective image frame set, and blurred frame removal criteria. The scratch feature dataset specifically refers to depth parameters, width values, and morphological distribution vectors. The scratch validity results include valid identifiers, invalid identifiers, and dual threshold judgment criteria. The level control instructions specifically include scratch level parameters, binary control codes, and a set of device operation signals.
3. The image recognition-based scratch resistance tester control system according to claim 1, characterized in that: The crease positioning and region delineation module includes: The image feature extraction submodule uses a camera to acquire sample image data, extracts the brightness, contrast, and texture direction of the crease region from the image data, combines multiple feature values, calculates the texture difference between adjacent creases to characterize the texture changes of different creases, and establishes a crease texture feature sequence. The crease spacing calculation submodule calls the trend of the change of the texture difference value in the crease texture feature sequence, determines the texture abrupt change point as the initial boundary of the crease, calculates the pixel distance between adjacent initial boundaries and compares it with the set distance benchmark value, filters out the paired creases, and obtains the effective crease spacing value. The detection area generation submodule determines the centerline position of the two parallel creases based on the effective crease spacing value, and extends it to both sides by a preset number of pixels to delineate the scratch detection area. It then extracts the pixel coordinates of the four vertices of the area to generate a detection area boundary coordinate dataset.
4. The image recognition-based scratch resistance tester control system according to claim 1, characterized in that: The sample moving and scraping module includes: The motion path setting submodule calls the detection area boundary coordinate dataset, parses the coordinates of the four vertices of the area to set the motion range of the sample on the fixed platform, calculates the linear interpolation points between each vertex, and sets the drive frequency and step value of the platform motor in combination with the preset scraping speed requirements, establishes a control sequence including start and stop signals, speed parameters and displacement commands, and obtains the sample motion path command set. The scraping process recording submodule drives the platform control system to make the sample move uniformly along the specified path and pass through the fixed scraping head according to the start / stop signals and displacement commands in the sample motion path instruction set. At the same time, it sends a synchronous trigger signal to the image acquisition card to control the camera to continuously capture images of the detection area at a preset frame rate and establish a real-time scraping image frame set. The image sequence generation submodule calls each image in the real-time scratch image frame set and assigns a unique sequence number based on the acquisition time. It then arranges all the image frames with sequence numbers in chronological order and removes blurry image frames caused by platform start-up and shutdown jitter, generating a scratch image sequence result.
5. The image recognition-based scratch resistance tester control system according to claim 1, characterized in that: The image processing module includes: The grayscale feature parsing submodule extracts the grayscale of pixels in the scratch region of a single frame image from the scratch image sequence result, calculates the grayscale difference between adjacent pixels, counts the grayscale change rate of five consecutive pixels, and establishes a grayscale gradient sequence. The chromaticity difference quantization submodule extracts the hue values of the scratch region and the background region in the grayscale gradient sequence, calculates the average difference between the two hue values, and performs a weighted calculation based on the saturation difference value to generate a chromaticity difference matrix. The morphological feature extraction submodule selects three sampling points at the boundary of the scratch area based on the chromaticity difference matrix, calculates the brightness difference value between each point and the background area as a depth parameter, measures the number of pixels in the maximum width direction of the scratch and converts it into the actual length value, and establishes a scratch feature dataset containing depth and width.
6. The image recognition-based scratch resistance tester control system according to claim 1, characterized in that: The scratch effectiveness assessment module includes: The threshold comparison submodule calls the depth and width values of the scratches in the scratch feature dataset, and performs subtraction operations with the set depth and width reference values of the scratches respectively to calculate the depth difference and width difference, and establishes a two-parameter difference set; The validity determination submodule, based on the set of two-parameter differences, determines whether the depth difference and the width difference are non-negative. When both conditions are met, it is marked as a valid scratch; otherwise, it is marked as an invalid scratch, and a scratch validity result is generated.
7. The image recognition-based scratch resistance tester control system according to claim 1, characterized in that: The device control and scratch level module includes: The baseline parameter calculation submodule extracts the depth and width values of the effective scratches from the scratch validity results, and calculates the percentages of these values with the preset scratch depth and width to establish parameter ratio coefficients. The scratch level determination submodule, based on the parameter ratio coefficient, marks scratches as minor, moderate, and severe when both the depth ratio and width ratio reach different grading ranges, respectively, and generates scratch level parameters. The control command generation submodule converts the device operation signals corresponding to different scratch levels into binary control codes based on the scratch level parameters, and generates level control commands.
8. A scratch-resistant instrument control method based on image recognition, characterized in that, The method, used in the image recognition-based scratch resistance instrument control system according to any one of claims 1-7, includes the following steps: S1: The camera acquires sample image data, extracts texture features of adjacent creases, calculates relative positions and distances, determines crease boundaries, delineates detection areas, and generates a dataset of detection area boundary coordinates. S2: Based on the detection area boundary coordinate dataset, set the sample's movement range on the platform, control the sample movement, complete the scraping with the scraping head, record the image, and generate a scratch image sequence result; S3: Call the scratch region image data in the scratch image sequence result, analyze the grayscale continuity, detect the boundary gradient and texture changes, compare the color difference, extract the depth, width and spatial shape, identify the contour direction, and generate a scratch feature dataset; S4: The depth and width of the scratches in the scratch feature dataset are compared with the set scratch benchmark. If both the depth and width exceed the threshold, the scratches are considered valid; otherwise, they are invalid. The scratch validity result is generated. S5: Based on the effective scratch data, compare the depth and width of the effective scratch with the depth and width of the preset scratch, classify them into levels, and generate level control instructions.