A method and system for detecting the airtightness of swimming goggles based on machine vision

Through the detection method based on machine vision, the problem of low efficiency and accuracy of swimming goggles in the prior art is solved, real-time and high-precision airtight detection is realized, and the consistency and repeatability of the detection are improved.

CN119197913BActive Publication Date: 2025-06-27ZHEJIANG KUQU NETWORK TECH CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202411724135.2
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-11-28
Publication Date
2025-06-27
Estimated Expiration
2044-11-28

AI Technical Summary

Technical Problem

In the prior art, the detection of the airtightness of swimming goggles relies on manual detection or simple computer vision methods and is susceptible to light sources, resulting in a decrease in detection efficiency and accuracy.

Method used

Using a detection method based on machine vision, the vacuum video data recorded by the camera is obtained, pre-processing, graying processing, mean drift segmentation processing and bubble motion speed calculation are performed, and alarm signals are generated and sent to the client.

Benefits of technology

Real-time and high-precision swimming goggles sealing detection is realized, reducing interference from human factors, improving the consistency and repeatability of the detection, and enhancing the accurate evaluation of swimming goggles sealing performance.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119197913B_ABST
    Figure CN119197913B_ABST
Patent Text Reader

Abstract

The present invention discloses a method and system for detecting the airtightness of swimming goggles based on machine vision. The method includes: acquiring vacuum pumping video data recorded by a camera; performing preprocessing on the vacuum pumping video data to obtain preprocessed video data; performing grayscale processing on the preprocessed video data to obtain grayscale video data; performing mean shift segmentation processing on the grayscale video data and making markings to obtain bubble features; calculating the bubble movement speed based on the bubble features to obtain the bubble movement speed; when it is determined that the bubble movement speed is greater than a preset threshold based on the bubble movement speed, generating an alarm signal and sending the alarm signal to the client. This method can improve the accuracy of detecting the airtightness of swimming goggles.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of goggle airtightness detection, and particularly to a goggle airtightness detection method and system based on machine vision. Background Art

[0002] With the development and continuous improvement of the social and economic level, people's demand for consumption quality is constantly increasing. More and more people pay more attention to quality and safety when choosing swimming sports, and require products to be safer and more reliable when choosing. If there are problems such as breakage or air leakage in the goggles used during swimming, it will affect the normal comfort and safety of the user in the water, and even pose a risk of drowning. If too many air bubbles leak, the goggles will quickly lose their due buoyancy, etc.

[0003] In the prior art, for the airtightness detection of swimming goggles, mainly manual detection methods are used, or simple computer vision methods are used for auxiliary detection. However, manual detection errors and omissions occur from time to time, and visual fatigue is prone to occur during the long detection process, resulting in a decline in the detection efficiency and accuracy; the currently applied computer vision auxiliary methods are easily affected by light sources, thus reducing the detection efficiency and accuracy.

[0004] In the prior art, manual detection is easily affected by visual fatigue, resulting in a decline in detection accuracy. The existing computer vision auxiliary methods are easily interfered by external light sources, resulting in poor performance and low detection accuracy. Summary of the Invention

[0005] The present invention provides a goggle airtightness detection method and system based on machine vision to achieve real-time high-precision quality monitoring during the logistics transportation process.

[0006] In a first aspect, to solve the above technical problems, the present invention provides a goggle airtightness detection method based on machine vision, including:

[0007] Obtaining the vacuuming video data recorded by a camera;

[0008] Performing preprocessing on the vacuuming video data to obtain preprocessed video data;

[0009] Performing grayscale processing on the preprocessed video data to obtain grayscale video data;

[0010] Performing mean shift segmentation processing on the grayscale video data and performing marking to obtain bubble features;

[0011] Calculating the bubble movement speed based on the bubble features to obtain the bubble movement speed;

[0012] According to the bubble movement speed, when it is determined that the bubble movement speed is greater than a preset threshold, an alarm signal is generated and the alarm signal is sent to the client.

[0013] As an optional implementation manner, preprocessing is performed on the vacuum pumping video data recorded by the camera to obtain preprocessed video data, including:

[0014] Performing downsampling processing on the vacuum pumping video data recorded by the camera to obtain downsampled video data;

[0015] Performing Gaussian blur filtering operation on the downsampled video data to obtain noise-reduced video data;

[0016] Performing continuous frame difference detection operation on the noise-reduced video data to obtain preprocessed video data.

[0017] As an optional implementation manner, grayscale processing is performed on the preprocessed video data to obtain grayscale video data, including:

[0018] The calculation formula for the grayscale processing is as follows:

[0019]

[0020] Among them, Gray represents the pixel grayscale value obtained by processing; R represents the pixel red channel value before processing; G represents the pixel green channel value before processing; B represents the pixel blue channel value before processing.

[0021] As an optional implementation manner, mean shift segmentation processing is performed on the grayscale video data and marked to obtain bubble features, including:

[0022] Performing edge detection on the grayscale video data to obtain initial edge points;

[0023] Performing eight-neighborhood scanning on the initial edge points to obtain a retrieval record;

[0024] When it is determined that the retrieval record is not retrieved according to the retrieval record, pixel value storage is performed and the mean shift iteration algorithm is applied to obtain a drift vector;

[0025] Performing an update operation according to the drift vector to obtain a new center point;

[0026] Performing grayscale update according to the new center point to obtain a new grayscale value;

[0027] Calculating the scalar feature of the drift vector according to the drift vector to obtain the scalar feature of the drift vector;

[0028] According to the scalar feature, when it is determined that the scalar feature of the drift vector is less than a preset bandwidth threshold, the current pixel is marked to obtain a marked pixel;

[0029] According to the marked pixel, partition processing is performed to obtain a bubble feature.

[0030] As an optional implementation manner, applying the mean shift iterative algorithm to obtain a drift vector includes:

[0031] The calculation formula of the mean shift iterative algorithm is as follows:

[0032]

[0033] Wherein, represents the drift vector; represents the gray value of the current pixel; represents the weighted mean of the current pixel point;

[0034] The calculation formula of the weighted mean is as follows:

[0035]

[0036] Wherein, represents the weighted mean of the current pixel point; is the weight of the kernel function; is the bandwidth matrix; represents the kernel function; represents the determinant of the bandwidth matrix; represents the inverse matrix of the bandwidth matrix; represents the summation index, from 1 to ; represents the total number of pixel points in the neighborhood of the current pixel point; is the position of the

[0037] As an optional implementation manner, according to the drift vector, an update operation is performed to obtain a new center point, including:

[0038] The calculation formula of the update operation is as follows:

[0039]

[0040] Wherein, represents the center point of the th round of iteration; represents the center point of the th round of iteration; is the mean shift vector; represents the acceleration coefficient.

[0041] As an alternative implementation, according to the new center point, perform grayscale update to obtain a new grayscale value, including:

[0042] According to the new center point, calculate the bandwidth to obtain the current bandwidth;

[0043] According to the current bandwidth, judge the size relationship between the current bandwidth and a preset bandwidth threshold;

[0044] When it is judged that the current bandwidth is greater than the preset bandwidth threshold, perform edge detection;

[0045] When it is judged that the current bandwidth is less than the preset bandwidth threshold, perform filtering and noise reduction processing, calculate the average grayscale value, and replace the grayscale value of the current pixel point with the average grayscale value to obtain a new grayscale value.

[0046] As an alternative implementation, according to the drift vector, calculate the scalar feature of the drift vector to obtain the scalar feature of the drift vector, including:

[0047] The calculation formula of the scalar feature is as follows:

[0048]

[0049] Among them, represents the scalar feature of the drift vector; represents the drift vector.

[0050] As an alternative implementation, according to the bubble feature, calculate the bubble movement speed to obtain the bubble movement speed, including:

[0051] The calculation formula of the bubble movement speed is as follows:

[0052]

[0053] Among them, represents the movement speed of the th frame; ([[]] , ) represents the pixel coordinates of the marked area of the th frame; ([[]] , ) represents the pixel coordinates of the marked area of the th frame; represents the time interval between two frames; represents the movement displacement.

[0054] In a second aspect, the present invention provides a goggle airtightness detection system based on machine vision, including:

[0055] An input module for obtaining the vacuuming video data recorded by a camera;

[0056] A preprocessing module, configured to perform preprocessing on the vacuum pumping video data recorded by the camera to obtain preprocessed video data;

[0057] A grayscale conversion module, configured to perform grayscale processing on the preprocessed video data to obtain grayscale video data;

[0058] A bubble feature module, configured to perform mean shift segmentation processing on the grayscale video data and perform marking to obtain bubble features;

[0059] A speed calculation module, configured to calculate the bubble movement speed based on the bubble features to obtain the bubble movement speed;

[0060] An output module, configured to generate an alarm signal according to the bubble movement speed and send the alarm signal to the client when it is determined that the bubble movement speed is greater than a preset threshold.

[0061] Compared with the prior art, the present invention has the following beneficial effects:

[0062] The present invention provides a method for detecting the airtightness of swimming goggles based on machine vision, including: obtaining the vacuum pumping video data recorded by a camera; performing preprocessing on the vacuum pumping video data to obtain preprocessed video data; performing grayscale processing on the preprocessed video data to obtain grayscale video data; performing mean shift segmentation processing on the grayscale video data and performing marking to obtain bubble features; calculating the bubble movement speed based on the bubble features to obtain the bubble movement speed; generating an alarm signal according to the bubble movement speed and sending the alarm signal to the client when it is determined that the bubble movement speed is greater than a preset threshold.

[0063] The present invention reduces the interference of human factors through automated video data processing, improving the consistency and repeatability of detection. By accurately identifying the bubble features and movement states, the present invention can more accurately evaluate the airtight performance of swimming goggles, thereby improving the accuracy of detection. Description of the Drawings

[0064] Figure 1 is a schematic flowchart of a method for detecting the airtightness of swimming goggles based on machine vision provided by an embodiment of the present invention;

[0065] Figure 2 is a schematic flowchart of the mean shift segmentation processing process provided by an embodiment of the present invention.

[0066] Figure 3 is a schematic flowchart of a system for detecting the airtightness of swimming goggles based on machine vision provided by an embodiment of the present invention. Specific Embodiments

[0067] Next, the technical solutions in the embodiments of the present invention will be clearly and completely described in conjunction with the accompanying drawings in the embodiments of the present invention. Obviously, the described embodiments are only a part of the embodiments of the present invention, rather than all the embodiments. All other embodiments obtained by those of ordinary skill in the art based on the embodiments of the present invention without creative efforts shall fall within the protection scope of the present invention.

[0068] With the development and continuous improvement of the social and economic level, people's demand for consumption quality is constantly increasing. More and more people pay more attention to quality and safety when choosing swimming sports, and require products to be safer and more reliable when choosing. If there are problems such as breakage or air leakage in the swimming goggles used during swimming, it will affect the normal comfort and safety of the user in the water, and even pose a risk of drowning. If too many bubbles leak, the swimming goggles will quickly lose their due buoyancy, etc.

[0069] In the prior art, for the airtightness detection of swimming goggles, mainly manual detection methods or simple computer vision methods are used for auxiliary detection. However, missed detections and false detections often occur in manual detection, and visual fatigue is easily generated during the long detection process, reducing the detection efficiency and accuracy; the currently applied computer vision assistance method is easily affected by the light source, thus reducing the detection efficiency and accuracy.

[0070] In the prior art, it is necessary to study a new method to make the judgment of the airtightness of swimming goggles more accurate. Combine image analysis to calculate the change process of bubbles, accurately detect the bubbles, and provide a more reasonable judgment method to judge the possibility of the appearance of bubbles and obtain a more scientific detection result.

[0071] To solve the above problems, the following specific embodiments will be used to introduce and illustrate in detail a swimming goggle airtightness detection method based on machine vision provided by the embodiments of the present application.

[0072] Refer to Figure 1 , the first embodiment of the present invention provides a swimming goggle airtightness detection method based on machine vision, including the following steps:

[0073] S11, obtain the vacuum pumping video data recorded by the camera;

[0074] S12, perform preprocessing on the vacuum pumping video data to obtain preprocessed video data;

[0075] S13, perform grayscale processing on the preprocessed video data to obtain grayscale video data;

[0076] S14. Perform mean shift segmentation processing on the grayscale video data and mark it to obtain bubble features.

[0077] S15. Calculate the bubble movement speed based on the bubble features to obtain the bubble movement speed.

[0078] S16. When it is determined that the bubble movement speed is greater than a preset threshold based on the bubble movement speed, generate an alarm signal and send the alarm signal to the client.

[0079] In step S11, obtain the vacuum extraction video data recorded by the camera.

[0080] It should be noted that to improve the detection accuracy and ensure the robustness of the entire system, in the constructed detection device, a CCD camera is selected as the image acquisition device. This CCD camera selects a high-resolution CCD sensor and a high-pixel CCD camera so that every detail of the swimming goggles can be captured. To simplify the acquisition environment and improve the acquisition reliability, in the acquisition environment, the uniform brightness of the light source should be kept consistent, and the noise of the entire system should be minimized as much as possible.

[0081] It should be noted that for the bubbles generated when air is extracted from the swimming goggles, due to the small volume, fast change, and irregular movement of the bubbles, it is necessary to reduce the frame rate of the vacuum extraction video sequence of the swimming goggles and label each continuous frame image in the video; if the frame rate is too low, it is easy to cause the same bubble to overlap in two consecutive frames, resulting in too large an area of the bubble in the pixel region and an increase in the error rate of judgment; if the frame rate is too fast, it will increase the number and workload of subsequent image judgments. Exemplarily, in the embodiment of the present invention, the video frame rate is set to 30 frames. For videos with a camera recording frame rate greater than 30, frequency reduction processing is performed to obtain a 30-frame video. Of course, according to different actual application scenarios and user requirements, the video frame rate can also be set to 40 frames, 50 frames, or other frame rates, and the present invention does not limit this.

[0082] In step S12, perform preprocessing on the vacuum extraction video data recorded by the camera to obtain preprocessed video data, including:

[0083] Perform frequency reduction processing on the vacuum extraction video data recorded by the camera to obtain frequency-reduced video data;

[0084] Perform Gaussian blur filtering operation on the frequency-reduced video data to obtain noise-reduced video data;

[0085] Perform continuous frame difference detection operation on the noise-reduced video data to obtain preprocessed video data.

[0086] It should be noted that the downsampled video data reduces the data volume by decreasing the frame rate of the video, making subsequent processing more efficient. The denoised video data reduces the noise in the image through Gaussian blur filtering operation. Gaussian blur is a low-pass filter that smooths the image by weighted averaging the pixel values in the neighborhood, thereby removing the high-frequency parts of the image, such as edges and granular noise. The preprocessed video data is obtained after consecutive frame difference detection operation, which can highlight the changing parts in the video and provide accurate motion information for subsequent bubble feature extraction.

[0087] It should be noted that the downsampling process reduces the complexity of the data by decreasing the frame rate of the video, making subsequent processing steps more efficient. Gaussian blur filtering is a commonly used image smoothing technique that reduces image noise and smooths image edges by convolution with a Gaussian kernel. The consecutive frame difference detection operation detects changes in the video by calculating the differences between consecutive frames, improving the algorithm's ability to identify the bubble motion in the goggles.

[0088] In step S13, according to the preprocessed video data, grayscale processing is performed to obtain grayscale video data, including:

[0089] The calculation formula for the grayscale processing is as follows:

[0090]

[0091] where Gray represents the pixel grayscale value obtained by processing; R represents the pixel red channel value before processing; G represents the pixel green channel value before processing; B represents the pixel blue channel value before processing.

[0092] It should be noted that a grayscale image is an image in which each pixel has only one intensity value, which is represented as a grayscale value ranging from 0 (black) to 255 (white). The grayscale value is the pixel grayscale value obtained by processing, which is a single numerical value representing the brightness level of the pixel. In a grayscale image, color information is removed and only brightness information is retained, which simplifies the image data and makes subsequent processing more efficient. Grayscale processing is an operation that converts a color image into a grayscale image. In a color image, each pixel consists of the numerical values of the red (R), green (G), and blue (B) color channels. Grayscale processing combines the numerical values of these three channels into a single grayscale value through a specific calculation formula.

[0093] Refer to Figure 2 In step S14, according to the grayscale video data, mean shift segmentation processing is performed and marked to obtain bubble features, including:

[0094] S141, according to the grayscale video data, edge detection is performed to obtain initial edge points;

[0095] S142. Perform an eight-neighborhood scan based on the initial edge points to obtain a retrieval record.

[0096] S143. Based on the retrieval record, when it is determined that the retrieval record has not been retrieved, store the pixel value and apply the mean shift iterative algorithm to obtain a drift vector.

[0097] S144. Perform an update operation based on the drift vector to obtain a new center point.

[0098] S145. Perform gray-level update based on the new center point to obtain a new gray-level value.

[0099] S146. Calculate the scalar feature of the drift vector based on the drift vector to obtain the scalar feature of the drift vector.

[0100] S147. Based on the scalar feature, when it is determined that the scalar feature of the drift vector is less than a preset bandwidth threshold, mark the current pixel to obtain a marked pixel.

[0101] S148. Perform partition processing based on the marked pixel to obtain bubble features.

[0102] It should be noted that the mean shift segmentation process mentioned in step S14 is a clustering algorithm based on kernel density estimation, which is commonly used in image processing for feature point clustering, image segmentation, object contour inspection, target tracking, etc. The core idea of the mean shift algorithm is to regard each pixel point as a sample in the feature space, and then find the local maximum points of the sample point density function through an iterative process. These points correspond to the feature regions in the image, such as bubbles.

[0103] In step S141, perform edge detection based on the grayscale video data to obtain initial edge points.

[0104] It should be noted that the purpose of edge detection based on grayscale video data is to identify the regions with the most significant brightness changes in the image, and these regions mark the contours or boundaries of objects. By applying an edge detection algorithm, for example, the Canny algorithm is used in the embodiments of the present invention to obtain a series of initial edge points, which define the boundaries of potential bubbles. Of course, other edge detection algorithms can also be adopted, and the present invention does not limit this. Among them, the initial edge points represent the edge information of bubbles or other features, providing a basis for subsequent operations.

[0105] In step S142, perform an eight-neighborhood scan based on the initial edge points to obtain a retrieval record.

[0106] It should be noted that eight-neighborhood scanning refers to checking the adjacent pixel points in the up, down, left, right, and four diagonal directions of each edge point. This is a common image space search technique used to explore and record the neighborhood information of pixel points in an image. Through eight-neighborhood scanning, a retrieval record is constructed, which contains information on whether each pixel point has been searched. This retrieval record is to avoid redundant processing of the same pixel points, thereby improving the efficiency and accuracy of the algorithm. In the detection of the airtightness of swimming goggles, this step ensures that all possible bubble areas can be comprehensively covered, while avoiding wasting computing resources on areas that have already been analyzed. Through effective eight-neighborhood scanning and retrieval record, it is ensured that in the subsequent mean shift segmentation process, each pixel point is only processed once, which can reduce computational redundancy, improve processing speed, and ensure the accurate extraction of bubble features.

[0107] In step S143, according to the retrieval record, when it is determined that the retrieval record is not retrieved, pixel value storage is performed, and the mean shift iteration algorithm is applied to obtain a drift vector, including:

[0108] The calculation formula of the mean shift iteration algorithm is as follows:

[0109]

[0110] Where, represents the drift vector; represents the current pixel gray value; represents the weighted mean of the current pixel point;

[0111] The calculation formula of the weighted mean is as follows:

[0112]

[0113] Where, represents the weighted mean of the current pixel point; is the weight of the kernel function; is the bandwidth matrix; represents the kernel function; represents the determinant of the bandwidth matrix; represents the inverse matrix of the bandwidth matrix; represents the summation index, from 1 to ; represents the total number of pixel points in the neighborhood of the current pixel point; is the th position of the neighborhood pixel point.

[0114] It should be noted that each initial edge point is processed according to the retrieval record. If the retrieval record shows that a certain pixel point has been searched, then this point is skipped and no further processing is done. This is to avoid repeated calculations and improve the efficiency of the algorithm. If the retrieval record shows that a certain pixel point has not been searched, then the pixel value of this point is stored, and the mean shift iterative algorithm is applied to calculate the drift vector. The mean shift iterative algorithm is a method for estimating the movement direction of a sample point based on the statistical characteristics of pixel values within the local neighborhood of the sample point. The drift vector represents the direction and distance in which the sample point moves towards a region with higher density. The weighted mean calculation involves the kernel function , the bandwidth matrix , the weight of the kernel function , as well as the determinant of the bandwidth matrix and the inverse matrix . In this way, the position of each pixel point can be iteratively updated until it converges to a local density maximum point, and these points correspond to the bubble regions in the image. This method can accurately identify and track bubbles, thus providing accurate basic data for subsequent calculation of bubble movement speed and evaluation of goggle airtightness.

[0115] In step S144, according to the drift vector, an update operation is performed to obtain a new center point, including:

[0116] The calculation formula for the update operation is as follows:

[0117]

[0118] where, represents the center point of the th iteration; represents the center point of the th iteration; is the mean shift vector; represents the acceleration coefficient.

[0119] It should be noted that is the acceleration coefficient, which is used to control the size of the update step. The update operation causes the position of the sample point to move towards a region with higher local density. As the iteration progresses, the sample point will gradually approach the local density maximum point, that is, the feature region in the image. The acceleration coefficient plays an important role in this process. It can help accelerate the convergence speed, but at the same time, it also needs to be carefully selected to avoid instability caused by excessive updates. When the drift vector is close to zero, it indicates that the sample point has approached the local density maximum point, and at this time, it can be considered that the iteration has converged. Exemplarily, in the embodiment of the present invention, when the square of the Euclidean norm of the drift vector Less than when it is considered that the sample point is already close enough to the local density maximum point, that is, the iteration has converged. Of course, according to different actual application scenarios and user requirements, this threshold can also be set to , or other appropriate values, and the present invention does not limit this.

[0120] In step S145, according to the new center point, gray level update is performed to obtain a new gray level value, including:

[0121] According to the new center point, bandwidth calculation is performed to obtain the current bandwidth;

[0122] According to the current bandwidth, judge the size relationship between the current bandwidth and the preset bandwidth threshold;

[0123] When it is judged that the current bandwidth is greater than the preset bandwidth threshold, edge detection is performed;

[0124] When it is judged that the current bandwidth is less than the preset bandwidth threshold, filtering and noise reduction processing is performed, and the average value of the gray level is calculated, and the average value of the gray level is used to replace the gray level value of the current pixel point to obtain a new gray level value.

[0125] It should be noted that bandwidth calculation is an important step in the mean shift algorithm, which determines the sensitivity of the algorithm to local features of the image. The current bandwidth is an index to measure the distribution range of pixel values in the neighborhood of the sample point. By comparing the current bandwidth with the preset bandwidth threshold, it can be judged whether the sample point is located in the edge area or the smooth area of the image. Exemplarily, in the embodiment of the present invention, the bandwidth threshold is set to 5.0. When the bandwidth value of the sample point is less than 5.0, the algorithm determines that it is located in the smooth area of the image; on the contrary, if the bandwidth value is greater than 5.0, it is considered to be the edge area. Of course, according to different actual application scenarios and user requirements, the bandwidth threshold can also be set to other values, such as 3.0, 4.0 or other appropriate values, and the present invention does not limit this.

[0126] If the current bandwidth is greater than the preset bandwidth threshold, this indicates that the sample point may be located in the edge area of the image, and at this time, it is appropriate to perform edge detection. Edge detection helps to identify areas with significant brightness changes in the image, and these areas are the contours or boundaries of objects.

[0127] If the current bandwidth is less than the preset bandwidth threshold, this indicates that the sample point is located in the smooth area of the image, and at this time, it is appropriate to perform filtering and noise reduction processing. The filtering and noise reduction processing smooths the image by calculating the average value of the gray level, reduces the influence of noise, and thus improves the quality of the image.

[0128] In step S146, according to the drift vector, calculate the scalar feature of the drift vector to obtain the scalar feature of the drift vector, including:

[0129] The calculation formula for the scalar feature is as follows:

[0130]

[0131] Where, represents the scalar feature of the drift vector; represents the drift vector.

[0132] It should be noted that the scalar feature of the drift vector is obtained by calculating the square of the Euclidean norm of the drift vector This scalar feature reflects the magnitude of the drift vector, which can be used to evaluate the movement trend and speed of the sample points in the feature space.

[0133] In the mean shift algorithm, the drift vector points in the direction of increasing sample point density. When the scalar feature of the drift vector is small, it indicates that the sample points have approached the local density maximum point, that is, the iteration has converged. This is because near the local density maximum point, the density gradient of the sample points is small, so the length of the drift vector is also small.

[0134] In step S147, according to the scalar feature, when it is determined that the scalar feature of the drift vector is less than a preset bandwidth threshold, mark the current pixel to obtain a marked pixel.

[0135] It should be noted that in this step, the computer compares the scalar feature of the drift vector with the preset bandwidth threshold. If the scalar feature of the drift vector is less than the preset bandwidth threshold, this indicates that the sample points have approached the local density maximum point, that is, the iteration has converged. At this time, the computer will mark the current pixel to obtain a marked pixel.

[0136] The bandwidth threshold is a preset parameter that determines the sensitivity of the algorithm to local density changes. By selecting an appropriate bandwidth threshold, the sensitivity and stability of the algorithm can be balanced. If the bandwidth threshold is set too large, the algorithm may miss some important local features; if the bandwidth threshold is set too small, the algorithm may be overly sensitive to noise, resulting in misjudgments. Exemplarily, in the embodiments of the present invention, the bandwidth threshold is set to 5.0. When the bandwidth value of a sample point is less than 5.0, the algorithm determines that it is located in the smooth region of the image; on the contrary, if the bandwidth value is greater than 5.0, it is considered an edge region. Of course, according to different actual application scenarios and user requirements, the bandwidth threshold can also be set to other values, such as 3.0, 4.0, or other appropriate values, and the present invention does not limit this.

[0137] In the context of goggle airtightness detection, accurately determining the relationship between the scalar features of the drift vector and the preset bandwidth threshold is crucial for precisely identifying bubble features. Only when the sample points converge to the accurate position of the bubble can the computer reliably analyze the motion state of the bubble and the airtight performance of the goggles. By marking the converged pixels, the computer can effectively distinguish the bubble regions in the image, providing accurate basic data for subsequent calculation of the bubble movement speed and airtightness evaluation.

[0138] In step S148, according to the marked pixels, partition processing is performed to obtain bubble features.

[0139] It should be noted that partitioning the image based on the already marked pixels divides the image into multiple regions, and each region represents an independent bubble feature. The purpose of the partitioning process is to divide these marked pixels into different regions according to their spatial proximity and density similarity. The pixel points in each region have similar features and are interconnected through connectivity. This partitioning process is achieved through connected component analysis, which can identify all connected pixel clusters in the image and treat them as separate feature regions.

[0140] It should be noted that the partitioning process enables the computer to extract clear bubble features from the complex image background. The extraction of these bubble features is crucial for evaluating the airtight performance of the goggles because they provide key information such as the position, size, and shape of the bubbles. By further analyzing these bubble features, such as calculating the movement speed of the bubbles or monitoring the changes in bubbles over time, the computer can accurately determine whether there are leaks or other airtightness problems in the goggles.

[0141] In step S15, according to the bubble features, the bubble movement speed is calculated to obtain the bubble movement speed, including:

[0142] The formula for calculating the bubble movement speed is as follows:

[0143]

[0144] wherein, represents the movement speed of the th frame; ( , ) represents the pixel coordinates of the marked area of the th frame; ( , ) represents the pixel coordinates of the marked area of the th frame; represents the time interval between two frames; represents the movement displacement.

[0145] It should be noted that by measuring the movement displacement of the bubble between consecutive video frames, the computer can determine the movement speed of the bubble. The formula for calculating the bubble movement speed is based on the Euclidean distance to calculate the displacement of the bubble between two frames, and then divided by the time interval to obtain the speed. Through this method, the computer can quantify the movement of the bubble and analyze the airtightness of the goggles accordingly. If the movement speed of the bubble exceeds a preset threshold, this may indicate that there is a leak in the goggles because the bubble will move quickly due to the pressure difference. On the contrary, if the movement speed of the bubble is small, this may indicate that the airtight performance of the goggles is good, and the movement of the bubble is mainly due to other factors, such as water flow or the buoyancy of the bubble itself.

[0146] In step S16, according to the bubble movement speed, when it is determined that the bubble movement speed is greater than the preset threshold, an alarm signal is generated and the alarm signal is sent to the client.

[0147] It should be noted that the calculated bubble movement speed is compared with a preset threshold. If the bubble movement speed exceeds this threshold, the system will determine that there may be a leak or other airtightness problems in the goggles, and then an alarm signal is generated. This threshold is set based on experience and experimental data to distinguish normal situations from potential leaks. Exemplarily, in the embodiment of the present invention, the bubble movement speed is set to 2 centimeters per second. If the calculated bubble movement speed exceeds 2 centimeters per second, then the system will determine that there may be a leak problem in the goggles and further inspection or rejection is required. Of course, according to different actual application scenarios and user requirements, this threshold can also be set to 1.5 centimeters per second, 2.5 centimeters per second or other appropriate values, and the present invention does not limit this.

[0148] It should be noted that sending the alarm signal to the client is a crucial step to ensure the timely transmission of information. The client may be a monitoring system, a mobile application, or directly the staff responsible for quality control. In this way, the goggle manufacturer can quickly identify and solve problems in the production process, thereby improving product quality and production efficiency.

[0149] Referring to Figure 3 , the second embodiment of the present invention provides a machine vision-based goggle airtightness detection system, including:

[0150] An input module for acquiring the vacuum pumping video data recorded by the camera;

[0151] A preprocessing module for preprocessing the vacuum pumping video data recorded by the camera to obtain preprocessed video data;

[0152] A grayscale conversion module for performing grayscale processing on the preprocessed video data to obtain grayscale video data;

[0153] A bubble feature module for performing mean shift segmentation processing on the grayscale video data and marking it to obtain bubble features;

[0154] A speed calculation module for calculating the bubble movement speed based on the bubble features to obtain the bubble movement speed;

[0155] An output module for generating an alarm signal and sending the alarm signal to the client when it is determined that the bubble movement speed is greater than a preset threshold based on the bubble movement speed.

[0156] It should be noted that the intelligent logistics transportation quality monitoring system provided in the embodiment of the present invention is used to execute all the process steps of the machine vision-based goggle airtightness detection method in the above embodiment, and the working principles and beneficial effects of the two correspond one by one, so they will not be elaborated here.

[0157] The following describes the working process of the present invention with a relatively common scenario as an example.

[0158] First, the starting point of this detection method is to obtain the video data of the goggle evacuation process recorded by a high-speed camera. These high-resolution video data provide the raw materials for subsequent analysis and are the basis of the entire detection process. By preprocessing these video data, including downsampling, Gaussian blur filtering, and consecutive frame difference detection, the computer can effectively reduce the noise and redundant information in the data while highlighting the changes in the goggles during the evacuation process. Downsampling reduces the data volume by decreasing the frame rate of the video, making subsequent processing more efficient; Gaussian blur filtering reduces noise by smoothing the image, making the features of the image more obvious; consecutive frame difference detection detects changes in the video by calculating the differences between consecutive frames, providing accurate motion information for identifying bubbles in the goggles.

[0159] Next, the preprocessed video data will undergo grayscale processing to convert the color image into a grayscale image. This step uses a specific calculation formula to combine the values of the red, green, and blue color channels of each pixel to obtain the grayscale value of each pixel. Grayscale processing simplifies the image data while retaining the key visual information, laying the foundation for subsequent image processing steps. In a grayscale image, the color information is removed, and only the brightness information is retained, making the features in the image more prominent and facilitating subsequent edge detection and feature extraction. In actual operation, grayscale processing can be implemented using functions in image processing libraries such as OpenCV to ensure the efficiency and accuracy of the conversion.

[0160] After grayscale processing, mean shift segmentation processing is applied to the grayscale video data to identify and label the bubble features in the image. The mean shift algorithm is a method that estimates the motion direction of sample points based on the statistical characteristics of pixel values within the local neighborhood of the sample points. By calculating the weighted mean and drift vector of each pixel point, the algorithm can accurately identify the edges of bubbles in the image. During this process, the algorithm iteratively updates the positions of the sample points until it converges to the local density maximum points, which correspond to the bubble regions in the image. By accurately identifying the bubble features and motion states, this method can more accurately evaluate the airtight performance of the goggles. To improve the efficiency of the mean shift algorithm, the role of the acceleration coefficient in the update operation can be combined to help accelerate the convergence speed, but it also needs to be carefully selected to avoid instability caused by excessive updates. When the drift vector approaches zero, it indicates that the sample point has approached the local density maximum point, and at this time, the iteration can be considered to have converged. By labeling the converged pixels, the computer can effectively distinguish the bubble regions in the image, providing accurate basic data for subsequent calculation of the bubble motion speed and airtightness evaluation.

[0161] Based on the mean shift algorithm, the computer further calculates the movement speed of the bubbles. This step involves measuring the movement displacement of the bubbles between consecutive video frames and calculating the speed based on the displacement and the time interval. If the movement speed of the bubbles exceeds a preset threshold, this may indicate a leak in the goggles because the bubbles will move quickly due to the pressure difference. On the contrary, if the movement speed of the bubbles is small, this may indicate that the airtight performance of the goggles is good, and the movement of the bubbles is mainly due to other factors, such as water flow or the buoyancy of the bubbles themselves. To calculate the movement speed of the bubbles more precisely, the optical flow method can be used to track the movement trajectory of the bubbles. The optical flow method is a motion estimation algorithm based on the assumption of image brightness consistency. By analyzing the pixel brightness changes in the image sequence, the movement speed and direction of each pixel in the image can be calculated. Of course, other methods can also be used to track the movement trajectory of the bubbles, and the present invention does not limit this.

[0162] Finally, when the system determines that the movement speed of the bubbles is greater than the preset threshold, an alarm signal will be automatically generated and sent to the client. The generation of the alarm signal is an important part of the automatic detection, which ensures that once an abnormal situation is detected, relevant personnel can be notified in time and take corresponding measures. The client may be a monitoring system, a mobile application, or directly the staff responsible for quality control. In this way, the goggle manufacturer can quickly identify and solve problems in the production process, thereby improving product quality and production efficiency. This automatic feedback mechanism not only improves the response speed of the detection but also enhances the transparency and controllability of the entire production process. In addition, by building an efficient communication system, the alarm signal can be quickly transmitted to the relevant personnel to ensure that they can take corresponding measures in time. In this way, the goggle manufacturer can quickly identify and solve problems in the production process, thereby improving product quality and production efficiency.

[0163] In summary, the present invention provides a method for detecting the airtightness of goggles based on machine vision, including: obtaining the vacuuming video data recorded by the camera; performing preprocessing on the basis of the vacuuming video data to obtain preprocessed video data; performing grayscale processing on the basis of the preprocessed video data to obtain grayscale video data; performing mean shift segmentation processing on the basis of the grayscale video data and performing marking to obtain bubble features; calculating the movement speed of the bubbles on the basis of the bubble features to obtain the movement speed of the bubbles; and generating an alarm signal and sending the alarm signal to the client when it is determined that the movement speed of the bubbles is greater than a preset threshold on the basis of the movement speed of the bubbles.

[0164] The present invention reduces the interference of human factors through automated video data processing, improving the consistency and repeatability of detection. By accurately identifying the characteristics and motion states of bubbles, the present invention can more accurately evaluate the airtight performance of swimming goggles, thereby improving the accuracy of detection.

[0165] An embodiment of the present invention also provides a terminal device. The terminal device includes: a processor, a memory, and a computer program stored in the memory and executable on the processor, such as a monitoring program for the quality of intelligent logistics transportation. When the processor executes the computer program, the steps in the above-mentioned embodiments of various machine vision-based swimming goggle airtightness detection methods are implemented, such as Figure 1 the step S11 shown. Alternatively, when the processor executes the computer program, the functions of each module / unit in the above-mentioned system embodiments are implemented.

[0166] Exemplarily, the computer program can be divided into one or more modules / units. The one or more modules / units are stored in the memory and executed by the processor to complete the present invention. The one or more modules / units can be a series of computer program instruction segments capable of performing specific functions, and these instruction segments are used to describe the execution process of the computer program in the terminal device.

[0167] The terminal device can be a computing device such as a desktop computer, a notebook, a palm computer, and a smart tablet. The terminal device may include, but is not limited to, a processor and a memory. Those skilled in the art can understand that the above components are only examples of the terminal device and do not constitute a limitation on the terminal device. It may include more or fewer components than the above, or combine certain components, or different components. For example, the terminal device may further include input / output devices, network access devices, a bus, etc.

[0168] The so-called processor may be a central processing unit (CPU), or may also be other general-purpose processors, digital signal processors (DSPs), application specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. The general-purpose processor may be a microprocessor or the processor may also be any conventional processor, etc. The processor is the control center of the terminal device, connecting various parts of the entire terminal device through various interfaces and lines.

[0169] The memory can be used to store the computer program and / or module. By running or executing the computer program and / or module stored in the memory, and invoking the data stored in the memory, the processor realizes various functions of the terminal device. The memory mainly includes a program storage area and a data storage area. Among them, the program storage area can store an operating system, application programs required for at least one function (such as a sound playback function, an image playback function, etc.); the data storage area can store data created according to the use of the mobile phone (such as audio data, phone book, etc.). In addition, the memory can include high-speed random access memory, and can also include non-volatile memory, such as a hard disk, memory, plug-in hard disk, smart media card (SMC), secure digital (SD) card, flash card, at least one magnetic disk storage device, flash device, or other volatile solid-state storage devices.

[0170] Among them, if the module / unit integrated in the terminal device is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on such an understanding, to implement all or part of the processes in the above-mentioned embodiment methods of the present invention, it can also be completed by a computer program instructing relevant hardware. The computer program can be stored in a computer-readable storage medium. When the computer program is executed by the processor, the steps of the above-mentioned various method embodiments can be realized. Among them, the computer program includes computer program code, and the computer program code can be in the form of source code, object code, executable file or some intermediate form, etc. The computer-readable medium can include: any entity or system, recording medium, USB flash drive, mobile hard disk, magnetic disk, optical disc, computer memory, read-only memory (ROM), random access memory (RAM), electrical carrier signal, telecommunication signal, and software distribution medium that can carry the computer program code. It should be noted that the content included in the computer-readable medium can be appropriately increased or decreased according to the requirements of legislation and patent practice in the jurisdiction. For example, in some jurisdictions, according to legislation and patent practice, the computer-readable medium does not include electrical carrier signals and telecommunication signals.

[0171] It should be noted that the system embodiments described above are merely illustrative. The units described as separate components may or may not be physically separated. The components shown as units may or may not be physical units, that is, they may be located in one place or distributed to multiple network units. Some or all of the modules can be selected according to actual needs to achieve the purpose of the solution of this embodiment. In addition, in the attached drawings of the system embodiments provided by the present invention, the connection relationship between the modules indicates that there is a communication connection between them, which can be specifically implemented as one or more communication buses or signal lines. Those of ordinary skill in the art can understand and implement it without creative efforts.

[0172] The specific embodiments described above further elaborate on the purpose, technical solution, and beneficial effects of the present invention. It should be understood that the above are only specific embodiments of the present invention and are not used to limit the protection scope of the present invention. In particular, for those skilled in the art, any modifications, equivalent replacements, improvements, etc. made within the spirit and principle of the present invention shall be included in the protection scope of the present invention.

Claims

1. A method for detecting the tightness of swimming goggles based on machine vision, characterized in that: Executed by a computer, including: Obtaining vacuuming video data recorded by a camera; Preprocessing is performed according to the vacuuming video data to obtain preprocessed video data; Performing grayscale processing on the preprocessed video data to obtain grayscale video data; According to the grayscale video data, mean shift segmentation processing is performed and marked to obtain bubble features, including: Perform edge detection according to the grayscale video data to obtain initial edge points; Perform eight-neighborhood scanning according to the initial edge point to obtain a retrieval record; According to the search record, when it is determined that the search record is not searched, pixel values ​​are stored, and a mean shift iterative algorithm is applied to obtain a drift vector; Perform an update operation according to the drift vector to obtain a new center point; According to the new center point, grayscale is updated to obtain a new grayscale value; Calculating a scalar feature of the drift vector according to the drift vector to obtain a scalar feature of the drift vector; According to the scalar feature, when it is determined that the scalar feature of the drift vector is less than a preset bandwidth threshold, marking the current pixel to obtain a marked pixel; According to the marked pixels, partition processing is performed to obtain bubble features; Calculating the bubble movement speed according to the bubble characteristics to obtain the bubble movement speed; According to the bubble movement speed, when it is determined that the bubble movement speed is greater than a preset threshold, an alarm signal is generated and sent to a client.

2. The method for detecting the tightness of swimming goggles based on machine vision according to claim 1, characterized in that: Preprocessing is performed according to the vacuuming video data recorded by the camera to obtain preprocessed video data, including: Performing frequency reduction processing on the vacuuming video data recorded by the camera to obtain frequency-reduced video data; Performing a Gaussian blur filtering operation on the downsampled video data to obtain noise-reduced video data; A continuous frame difference detection operation is performed according to the noise reduction video data to obtain pre-processed video data.

3. The method for detecting the tightness of swimming goggles based on machine vision according to claim 1, characterized in that: According to the pre-processed video data, grayscale processing is performed to obtain grayscale video data, including: The grayscale processing calculation formula is as follows: in, Represents the grayscale value of the processed pixel; Indicates the red channel value of the pixel before processing; Indicates the green channel value of the pixel before processing; Indicates the blue channel value before processing.

4. The method for detecting the tightness of swimming goggles based on machine vision according to claim 1, characterized in that: According to the drift vector, an update operation is performed to obtain a new center point, including: The update operation calculation formula is as follows: in, Indicates Round iteration center point; Indicates Round iteration center point; is the mean shift vector; Represents the acceleration factor.

5. The method for detecting the tightness of swimming goggles based on machine vision according to claim 1, characterized in that: According to the new center point, grayscale is updated to obtain a new grayscale value, including: Calculate the bandwidth based on the new center point to obtain the current bandwidth; According to the current bandwidth, determining a size relationship between the current bandwidth and a preset bandwidth threshold; When it is determined that the current bandwidth is greater than a preset bandwidth threshold, edge detection is performed; When it is determined that the current bandwidth is less than a preset bandwidth threshold, filtering and noise reduction processing is performed, and the grayscale value mean is calculated, and the grayscale value of the current pixel is replaced by the grayscale value mean to obtain a new grayscale value.

6. The method for detecting the tightness of swimming goggles based on machine vision according to claim 1, characterized in that: Calculating a scalar feature of the drift vector according to the drift vector to obtain the scalar feature of the drift vector includes: The scalar feature calculation formula is as follows: in, represents the scalar characteristic of the drift vector; represents the drift vector.

7. The method for detecting the tightness of swimming goggles based on machine vision according to claim 1, characterized in that: According to the bubble characteristics, the bubble movement speed is calculated to obtain the bubble movement speed, including: The bubble movement speed calculation formula is as follows: in, Indicates The frame speed; Indicates Pixel coordinates of the marked region of the frame; Indicates Pixel coordinates of the marked region of the frame; Indicates the time interval between two frames; Indicates motion displacement.

8. A swimming goggles airtightness detection system based on machine vision, used to implement the swimming goggles airtightness detection method based on machine vision as claimed in any one of claims 1 to 7, characterized in that: include: An input module, used to obtain the vacuuming video data recorded by the camera; A preprocessing module, used for preprocessing the vacuuming video data recorded by the camera to obtain preprocessed video data; A grayscale conversion module, used for performing grayscale processing on the preprocessed video data to obtain grayscale video data; A bubble feature module is used to perform mean shift segmentation processing according to the grayscale video data, and mark it to obtain bubble features; A velocity calculation module, used to calculate the bubble movement velocity according to the bubble characteristics to obtain the bubble movement velocity; The output module is used to generate an alarm signal according to the bubble movement speed and send the alarm signal to the client when it is determined that the bubble movement speed is greater than a preset threshold.

Citation Information

Patent Citations

  • Air tightness detection bubble positioning method and system based on artificial intelligence

    CN112381808A