Swimming goggles leakproofness detection method and system based on machine vision
The method and system use machine vision to accurately detect swimming goggles' airtightness by preprocessing video data, performing grayscale and mean shift segmentation, and calculating bubble movement speed, enhancing detection precision and consistency.
Patent Information
- Application Number
- CN202411724135.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-28
- Publication Date
- 2024-12-27
- Estimated Expiration
- 2044-11-28
AI Technical Summary
Existing methods for detecting swimming goggles airtightness, such as manual detection and simple computer vision, suffer from low accuracy due to visual fatigue and light source interference, leading to inefficiencies and reduced detection precision.
A method and system using machine vision that involves obtaining vacuuming video data, preprocessing, grayscale processing, mean shift segmentation, and bubble movement speed calculation to generate an alarm signal when the speed exceeds a threshold.
The system provides real-time, high-precision airtightness detection by reducing human error and light source interference, ensuring consistent and repeatable evaluations of goggles' sealing performance.
Smart Images

Figure CN119197913A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of swimming goggles airtightness detection, and in particular to a swimming goggles airtightness detection method and system based on machine vision. Background Art
[0002] With the development and continuous improvement of social and economic levels, people's demand for consumer quality continues to increase. More and more people pay more attention to quality and safety when choosing swimming sports, and require safer and more reliable products when choosing. If the goggles used for swimming are damaged or leaking, it will affect the user's normal comfort and safety in the water, and even pose a risk of drowning. If too many bubbles leak, the goggles will quickly lose their proper buoyancy.
[0003] In the prior art, the tightness detection of swimming goggles mainly adopts manual detection methods or simple computer vision methods to assist detection. However, manual detection often results in false detection and missed detection, and long-term detection is prone to visual fatigue, which reduces the efficiency and accuracy of detection. The currently used computer vision-assisted methods are easily affected by light sources, thereby reducing the efficiency and accuracy of detection.
[0004] In the prior art, manual detection is susceptible to visual fatigue, resulting in reduced detection accuracy. Existing computer vision-assisted methods are susceptible to interference from external light sources, resulting in poor performance and low detection accuracy. Summary of the invention
[0005] The present invention provides a method and system for detecting the tightness of swimming goggles based on machine vision, so as to realize real-time high-precision quality monitoring in the process of logistics transportation.
[0006] In a first aspect, in order to solve the above technical problems, the present invention provides a method for detecting the tightness of swimming goggles based on machine vision, comprising: 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 marking 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.
[0007] As an optional implementation, 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.
[0008] As an optional implementation manner, grayscale processing is performed on the preprocessed video data to obtain grayscale video data, including: The grayscale processing calculation formula is as follows:
[0009] Among them, Gray represents the grayscale value of the pixel obtained by processing; R represents the red channel value of the pixel before processing; G represents the green channel value of the pixel before processing; B represents the blue channel value before processing.
[0010] As an optional implementation, mean shift segmentation processing is performed on the grayscale video data, and the bubble features are obtained by marking the grayscale video data, 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; Based on the marked pixels, partition processing is performed to obtain bubble features.
[0011] As an optional implementation manner, applying the mean shift iterative algorithm to obtain the drift vector includes: The mean shift iterative algorithm calculation formula is as follows:
[0012] in, represents the drift vector; Indicates the current pixel gray value; Represents the weighted mean of the current pixel; The weighted mean calculation formula is as follows:
[0013] in, Represents the weighted mean of the current pixel; 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; Indicates the index of the sum, from 1 to ; Indicates the total number of pixels in the neighborhood of the current pixel; It is The location of the neighboring pixels.
[0014] As an optional implementation, performing an update operation according to the drift vector to obtain a new center point includes: The update operation calculation formula is as follows:
[0015] in, Indicates Round iteration center point; Indicates Round iteration center point; is the mean shift vector; Represents the acceleration factor.
[0016] As an optional implementation, performing grayscale updating according to the new center point to obtain a new grayscale value includes: 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.
[0017] As an optional implementation manner, 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:
[0018] in, represents the scalar characteristic of the drift vector; represents the drift vector.
[0019] As an optional implementation, the bubble movement speed is calculated according to the bubble characteristics to obtain the bubble movement speed, including: The bubble movement speed calculation formula is as follows:
[0020] in, Indicates The frame speed; , ) indicates the Pixel coordinates of the marked region of the frame; ( , ) indicates the Pixel coordinates of the marked region of the frame; Indicates the time interval between two frames; Indicates motion displacement.
[0021] In a second aspect, the present invention provides a swimming goggles tightness detection system based on machine vision, comprising: 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.
[0022] Compared with the prior art, the present invention has the following beneficial effects: The present invention provides a method for detecting the airtightness of swimming goggles based on machine vision, comprising: acquiring vacuumized video data recorded by a camera; performing preprocessing according to the vacuumized video data to obtain preprocessed video data; performing grayscale processing according to the preprocessed video data to obtain grayscale video data; performing mean shift segmentation processing according to the grayscale video data, and marking to obtain bubble features; performing bubble movement speed calculation according to the bubble features to obtain the bubble movement speed; and generating an alarm signal according to the bubble movement speed when it is determined that the bubble movement speed is greater than a preset threshold, and sending the alarm signal to a client.
[0023] The present invention reduces the interference of human factors through automatic video data processing, improves the consistency and repeatability of detection, and can more accurately evaluate the sealing performance of swimming goggles by accurately identifying bubble characteristics and movement states, thereby improving the accuracy of detection. BRIEF DESCRIPTION OF THE DRAWINGS
[0024] Figure 1 It is a flow chart of a method for detecting the tightness of swimming goggles based on machine vision provided by an embodiment of the present invention; Figure 2 It is a flowchart of the mean shift segmentation processing process provided by an embodiment of the present invention.
[0025] Figure 3 The present invention is a flowchart of a system for detecting the tightness of swimming goggles based on machine vision provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0026] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0027] With the development and continuous improvement of social and economic levels, people's demand for consumer quality continues to increase. More and more people pay more attention to quality and safety when choosing swimming sports, and require safer and more reliable products when choosing. If the goggles used for swimming are damaged or leaking, it will affect the user's normal comfort and safety in the water, and even pose a risk of drowning. If too many bubbles leak, the goggles will quickly lose their proper buoyancy.
[0028] In the prior art, the tightness detection of swimming goggles mainly adopts manual detection methods or simple computer vision methods to assist detection. However, manual detection often results in false detection and missed detection, and long-term detection is prone to visual fatigue, which reduces the efficiency and accuracy of detection. The currently used computer vision-assisted methods are easily affected by light sources, thereby reducing the efficiency and accuracy of detection.
[0029] In the prior art, it is necessary to study a new method to make the judgment of the air tightness of swimming goggles more accurate. Combined with image analysis to calculate the change process of bubbles, the bubbles can be accurately detected, and a more reasonable judgment method can be provided to judge the possibility of bubble occurrence and obtain more scientific detection results.
[0030] In order to solve the above problems, a method for detecting the tightness of swimming goggles based on machine vision provided in an embodiment of the present application will be introduced and explained in detail through the following specific embodiments.
[0031] Reference Figure 1 The first embodiment of the present invention provides a method for detecting the tightness of swimming goggles based on machine vision, comprising the following steps: S11, obtaining vacuuming video data recorded by the camera; S12, performing preprocessing according to the vacuuming video data to obtain preprocessed video data; S13, performing grayscale processing on the preprocessed video data to obtain grayscale video data; S14, performing mean shift segmentation processing according to the grayscale video data, and marking the data to obtain bubble features; S15, calculating the bubble movement speed according to the bubble characteristics to obtain the bubble movement speed; S16, generating an alarm signal according to the bubble movement speed, when it is determined that the bubble movement speed is greater than a preset threshold, and sending the alarm signal to the client; In step S11 , the vacuuming video data recorded by the camera is obtained.
[0032] It should be noted that in order to improve the accuracy of detection and ensure the robustness of the entire system, a CCD camera is selected as the image acquisition device in the constructed detection device. The CCD camera uses a high-resolution CCD sensor and a high-pixel CCD camera so that every detail of the goggles can be collected. In order to simplify the collection environment and improve the reliability of collection, the uniform brightness of the light source should be kept consistent in the collection environment, and the noise of the entire system should be minimized.
[0033] It should be noted that for the bubbles generated when the air is extracted from the swimming goggles, since the bubbles are small in size, change quickly, and move irregularly, it is necessary to reduce the frame rate of the swimming goggles vacuuming video sequence and mark 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, causing the bubble area in the pixel area to be too large, and the judgment error rate to increase; if the frame rate is too fast, the number and workload of subsequent image judgments will increase. Exemplarily, in an embodiment of the present invention, the video frame rate is set to 30 frames, and for videos with a camera recording frame rate greater than 30, the frequency is reduced to obtain a 30-frame video. Of course, according to different actual application scenarios and user needs, the video frame rate can also be set to 40 frames, 50 frames or other frame rates, and the present invention is not limited to this.
[0034] In step S12, 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.
[0035] It should be noted that the down-converted video data is obtained by reducing the frame rate of the video to reduce the amount of data, making subsequent processing more efficient. The denoised video data is reduced by Gaussian blur filtering. Gaussian blur is a low-pass filter that smoothes the image by weighted averaging the pixel values in the neighborhood, thereby removing the high-frequency parts of the image, such as edge and particle noise. The pre-processed video data is obtained after continuous frame difference detection, which can highlight the changing parts in the video and provide accurate motion information for subsequent bubble feature extraction.
[0036] It should be noted that downscaling reduces the complexity of the data by reducing 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 smoothes image edges through convolution with a Gaussian kernel. The continuous frame difference detection operation detects changes in the video by calculating the difference between consecutive frames, improving the algorithm's ability to identify bubble movement in swimming goggles.
[0037] In step S13, grayscale processing is performed on the preprocessed video data to obtain grayscale video data, including: The grayscale processing calculation formula is as follows:
[0038] Among them, Gray represents the grayscale value of the pixel obtained by processing; R represents the red channel value of the pixel before processing; G represents the green channel value of the pixel before processing; B represents the blue channel value before processing.
[0039] It should be noted that a grayscale image refers to 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 grayscale value of the pixel obtained by processing. It is a single numerical value that represents the brightness level of the pixel. In a grayscale image, the color information is removed and only the brightness information is retained, which simplifies the image data and makes subsequent processing more efficient. Grayscaling is an operation that converts a color image into a grayscale image. In a color image, each pixel consists of the values of three color channels: red (R), green (G), and blue (B). Grayscaling combines the values of these three channels into one grayscale value through a specific calculation formula.
[0040] Reference Figure 2 In step S14, mean shift segmentation processing is performed according to the grayscale video data, and the bubble features are obtained by marking, including: S141, performing edge detection according to the grayscale video data to obtain initial edge points; S142, performing eight-neighborhood scanning according to the initial edge point to obtain a retrieval record; S143, 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; S144, performing an update operation according to the drift vector to obtain a new center point; S145, updating the grayscale according to the new center point to obtain a new grayscale value; S146, calculating a scalar feature of the drift vector according to the drift vector to obtain the scalar feature of the drift vector; 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, marking the current pixel to obtain a marked pixel; S148, performing partition processing according to the marked pixels to obtain bubble features.
[0041] 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 often used in image processing for feature point clustering, image segmentation, object contour detection, 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 areas in the image, such as bubbles.
[0042] In step S141, edge detection is performed based on the grayscale video data to obtain initial edge points.
[0043] It should be noted that the purpose of edge detection based on grayscale video data is to identify the areas in the image where the brightness changes most significantly, which mark the outline or boundary of the object. By applying an edge detection algorithm, for example, the Canny algorithm is used in the embodiment 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 used, 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.
[0044] In step S142, eight neighborhood scans are performed based on the initial edge points to obtain retrieval records.
[0045] It should be noted that eight-neighborhood scanning refers to checking the adjacent pixels of each edge point in the up, down, left, right and four diagonal directions. This is a common image space search technology used to explore and record the neighborhood information of pixels in the image. Through eight-neighborhood scanning, a retrieval record is constructed, which contains information on whether each pixel has been searched. This retrieval record is to avoid repeated processing of the same pixel, thereby improving the efficiency and accuracy of the algorithm. In the tightness detection of swimming goggles, this step ensures that all possible bubble areas can be fully covered while avoiding wasting computing resources on areas that have already been analyzed. Through effective eight-neighborhood scanning and retrieval records, it is ensured that each pixel is processed only once in the subsequent mean shift segmentation process, which can reduce computational redundancy, increase processing speed, and ensure accurate extraction of bubble features.
[0046] In step S143, 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, including: The mean shift iterative algorithm calculation formula is as follows:
[0047] in, represents the drift vector; Indicates the current pixel gray value; Represents the weighted mean of the current pixel; The weighted mean calculation formula is as follows:
[0048] in, Represents the weighted mean of the current pixel; 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; Indicates the index of the sum, from 1 to ; Indicates the total number of pixels in the neighborhood of the current pixel; It is The location of the neighboring pixels.
[0049] It should be noted that each initial edge point is processed according to the retrieval record. If the retrieval record shows that a pixel point has been searched, then the point is skipped and no further processing is performed. This is done to avoid repeated calculations and improve the efficiency of the algorithm. If the retrieval record shows that a pixel point has not been searched, the pixel value of the point is stored, and the mean shift iteration algorithm is applied to calculate the drift vector. The mean shift iteration algorithm is a method for estimating the movement direction of a sample point based on the statistical characteristics of the pixel values in the local neighborhood of the sample point. Drift vector Indicates the direction and distance that a sample point moves toward a higher density area. Weighted mean The calculation involves the kernel function , bandwidth matrix , the weight of the kernel function And the determinant of the bandwidth matrix and the inverse matrix In this way, the position of each pixel can be iteratively updated until it converges to the local density maximum points, which correspond to the bubble areas 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 the tightness of swimming goggles.
[0050] In step S144, an update operation is performed according to the drift vector to obtain a new center point, including: The update operation calculation formula is as follows:
[0051] in, Indicates Round iteration center point; Indicates Round iteration center point; is the mean shift vector; Represents the acceleration factor.
[0052] It should be noted that is the acceleration factor, which is used to control the size of the update step. The update operation causes the position of the sample point to move to the area with higher local density. As the iteration proceeds, the sample point will gradually approach the local density maximum point, that is, the characteristic area in the image. It plays an important role in this process, it can help speed up convergence, but it also needs to be carefully selected to avoid instability caused by excessive updates. When it is close to zero, it indicates that the sample point is close to the local density maximum point, and it can be considered that the iteration has converged. Less than When It is close enough to the local density maximum point, that is, the iteration has converged. Of course, depending on the actual application scenario and user needs, this threshold can also be set to , Or other suitable values, the present invention is not limited to this.
[0053] In step S145, grayscale update is performed according to the new center point 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.
[0054] 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 indicator 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 determined whether the sample point is located in the edge area or smooth area of the image. Exemplarily, in an 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 it to be 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 an edge area. Of course, depending on the actual application scenario and user needs, the bandwidth threshold can also be set to other values, such as 3.0, 4.0 or other suitable values, and the present invention is not limited to this.
[0055] If the current bandwidth is greater than the preset bandwidth threshold, this indicates that the sample point may be located at the edge of the image, and edge detection is appropriate. Edge detection helps identify areas in the image where the brightness changes significantly, which are the outlines or boundaries of objects.
[0056] If the current bandwidth is less than the preset bandwidth threshold, it indicates that the sample point is located in the smooth area of the image, and filtering and denoising is appropriate at this time. Filtering and denoising smoothes the image by calculating the mean of the grayscale value, reducing the impact of noise and thus improving the quality of the image.
[0057] In step S146, a scalar feature of the drift vector is calculated according to the drift vector to obtain the scalar feature of the drift vector, including: The scalar feature calculation formula is as follows:
[0058] in, represents the scalar characteristic of the drift vector; represents the drift vector.
[0059] It should be noted that the scalar characteristic of the drift vector is calculated by The square of the Euclidean norm of is obtained. This scalar feature reflects the size of the drift vector, which can be used to evaluate the movement trend and speed of the sample point in the feature space.
[0060] In the mean shift algorithm, the drift vector points to the direction where the density of sample points increases. When the scalar characteristic of the drift vector When it is small, it indicates that the sample point is close to 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 point is small, so the length of the drift vector is also small.
[0061] 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, the current pixel is marked to obtain a marked pixel.
[0062] It should be noted that in this step, the computer converts the scalar characteristic of the drift vector is compared with a preset bandwidth threshold. If the scalar feature of the drift vector If the value is less than the preset bandwidth threshold, it indicates that the sample point is close to the local density maximum point, that is, the iteration has converged. At this time, the computer will mark the current pixel to obtain the marked pixel.
[0063] The bandwidth threshold is a pre-set 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 too sensitive to noise, resulting in misjudgment. Exemplarily, in an embodiment 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 it to be 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 an edge area. Of course, depending on the actual application scenario and user needs, the bandwidth threshold can also be set to other values, such as 3.0, 4.0 or other suitable values, and the present invention is not limited to this.
[0064] In the context of goggle tightness testing, accurately determining the relationship between the scalar characteristics of the drift vector and the preset bandwidth threshold is crucial for accurately identifying bubble features. Only when the sample points converge to the exact location of the bubble can the computer reliably analyze the movement state of the bubble and the tightness of the goggles. By marking the converged pixels, the computer can effectively distinguish the bubble area in the image, providing accurate basic data for subsequent bubble movement speed calculation and tightness evaluation.
[0065] In step S148, partition processing is performed based on the marked pixels to obtain bubble features.
[0066] It should be noted that the partitioning process based on the labeled pixels divides the image into multiple regions, each of which represents an independent bubble feature. The purpose of the partitioning process is to divide these labeled pixels into different regions based on their spatial proximity and density similarity. The pixels in each region have similar features and are related to each other 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.
[0067] 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 airtightness of goggles because they provide key information such as the location, size and shape of the bubbles. Through further analysis of these bubble features, such as calculating the movement speed of the bubbles or monitoring the changes of the bubbles over time, the computer can accurately determine whether the goggles have leaks or other airtightness problems.
[0068] In step S15, the bubble movement speed is calculated according to the bubble characteristics to obtain the bubble movement speed, including: The bubble movement speed calculation formula is as follows:
[0069] in, Indicates The frame speed; , ) indicates the Pixel coordinates of the marked region of the frame; ( , ) indicates the Pixel coordinates of the marked region of the frame; Indicates the time interval between two frames; Indicates motion displacement.
[0070] It should be noted that by measuring the movement displacement of bubbles between consecutive video frames, the computer can determine the movement speed of the bubbles. The bubble movement speed calculation formula calculates the displacement of bubbles between two frames based on the Euclidean distance, and then divides it by the time interval to get the speed. In this way, the computer can quantify the movement of bubbles and analyze the airtightness of the goggles accordingly. If the movement speed of the bubbles exceeds the preset threshold, this may indicate that there is 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 goggles have good sealing performance and the movement of the bubbles is mainly due to other factors, such as water flow or the buoyancy of the bubbles themselves.
[0071] In step S16, based on 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 the client.
[0072] It should be noted that the calculated bubble movement speed is compared with a pre-set threshold. If the bubble movement speed exceeds this threshold, the system will determine that the goggles may have leakage or other airtightness problems, and then generate an alarm signal. This threshold is set based on experience and experimental data to distinguish between normal situations and potential leakage. Exemplarily, in an 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, the system will determine that the goggles may have a leakage problem and need further inspection or be eliminated. Of course, depending on the actual application scenario and user needs, this threshold can also be set to 1.5 centimeters per second, 2.5 centimeters per second or other suitable values, and the present invention is not limited to this.
[0073] It should be noted that sending the alarm signal to the client is a key step to ensure timely communication 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 the problems in the production process, thereby improving product quality and production efficiency.
[0074] Reference Figure 3 The second embodiment of the present invention provides a swimming goggles airtightness detection system based on machine vision, comprising: 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.
[0075] It should be noted that the intelligent logistics transportation quality monitoring system provided in an embodiment of the present invention is used to execute all the process steps of the machine vision-based swimming goggle tightness detection method in the above-mentioned embodiment. The working principles and beneficial effects of the two correspond one to one, and thus will not be repeated here.
[0076] The working process of the present invention is described below using a relatively common scenario as an example.
[0077] First, the starting point of the detection method is to obtain video data of the vacuuming process of the swimming goggles recorded by a high-speed camera. These high-resolution video data provide raw materials for subsequent analysis and are the basis of the entire detection process. By preprocessing these video data, including frequency reduction processing, Gaussian blur filtering and continuous frame difference detection, the computer can effectively reduce the noise and redundant information in the data, while highlighting the changes in the swimming goggles during the vacuuming process. Frequency reduction processing reduces the amount of data by reducing the frame rate of the video, making subsequent processing more efficient; Gaussian blur filtering reduces noise by smoothing the image, making the image features more obvious; continuous frame difference detection detects changes in the video by calculating the differences between consecutive frames, providing accurate motion information for identifying bubbles in the swimming goggles.
[0078] Next, the preprocessed video data will be grayscaled 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 the pixel to obtain the grayscale value of each pixel. Grayscale processing simplifies the image data while retaining key visual information, laying the foundation for subsequent image processing steps. In a grayscale image, color information is removed and only brightness information is retained, which makes the features in the image more prominent and facilitates 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.
[0079] After grayscale processing, mean shift segmentation processing is applied to grayscale video data to identify and mark bubble features in the image. The mean shift algorithm is a method that estimates the direction of motion of a sample point based on the statistical characteristics of pixel values in the local neighborhood of the sample point. By calculating the weighted mean and drift vector of each pixel, the algorithm can accurately identify the bubble edges in the image. In this process, the algorithm iteratively updates the position of the sample point until it converges to the local density maximum points, which correspond to the bubble areas in the image. By accurately identifying the bubble features and motion states, this method can more accurately evaluate the airtightness of the goggles. In order to improve the efficiency of the mean shift algorithm, the role of the acceleration coefficient in the update operation can be combined to help speed up the convergence speed, but 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 the iteration can be considered to have converged. By marking the converged pixels, the computer can effectively distinguish the bubble area in the image, providing accurate basic data for subsequent bubble motion speed calculation and airtightness evaluation.
[0080] On the basis of 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 time interval. If the movement speed of the bubbles exceeds a preset threshold, this may indicate that the goggles are leaking 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 goggles have good sealing performance and the movement of the bubbles is mainly due to other factors, such as water flow or the buoyancy of the bubbles themselves. In order to calculate the movement speed of the bubbles more accurately, 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 image brightness consistency assumption. By analyzing the pixel brightness changes in the image sequence, the movement speed and direction of each pixel in the image are calculated. Of course, other methods can also be used to track the movement trajectory of the bubbles, and the present invention is not limited to this.
[0081] Finally, when the system determines that the bubble movement speed is greater than the preset threshold, an alarm signal will be automatically generated and sent to the client. The generation of alarm signals is an important part of automated detection. It ensures that once an abnormal situation is found, relevant personnel can be notified in time and take appropriate measures. The client may be a monitoring system, a mobile application, or directly the staff responsible for quality control. In this way, goggle manufacturers can quickly identify and solve problems in the production process, thereby improving product quality and production efficiency. This automated feedback mechanism not only improves the response speed of detection, but also enhances the transparency and controllability of the entire production process. In addition, by building an efficient communication system, alarm signals can be quickly delivered to relevant personnel to ensure that they can take appropriate measures in time. In this way, goggle manufacturers can quickly identify and solve problems in the production process, thereby improving product quality and production efficiency.
[0082] In summary, the present invention provides a method for detecting the airtightness of swimming goggles based on machine vision, comprising: acquiring vacuumization video data recorded by a camera; performing preprocessing on the vacuumization 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 marking to obtain bubble features; calculating the bubble movement speed on the basis of the bubble features to obtain the bubble movement speed; based on the bubble movement speed, when it is determined that the bubble movement speed is greater than a preset threshold, generating an alarm signal, and sending the alarm signal to a client.
[0083] The present invention reduces the interference of human factors through automatic video data processing, improves the consistency and repeatability of detection, and can more accurately evaluate the sealing performance of swimming goggles by accurately identifying bubble characteristics and movement states, thereby improving the accuracy of detection.
[0084] The embodiment of the present invention further 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 program for monitoring the quality of intelligent logistics transportation. When the processor executes the computer program, the steps in the above-mentioned embodiments of the method for detecting the tightness of swimming goggles based on machine vision are implemented, such as Figure 1 Alternatively, the processor implements the functions of each module / unit in the above-mentioned system embodiments when executing the computer program.
[0085] Exemplarily, the computer program may be divided into one or more modules / units, which are stored in the memory and executed by the processor to implement the present invention. The one or more modules / units may be a series of computer program instruction segments capable of implementing specific functions, which are used to describe the execution process of the computer program in the terminal device.
[0086] The terminal device may be a computing device such as a desktop computer, a notebook, a PDA, and a smart tablet. The terminal device may include, but is not limited to, a processor and a memory. Those skilled in the art will appreciate that the above components are merely examples of terminal devices and do not constitute a limitation on the terminal device. The terminal device may include more or fewer components than the above components, or may combine certain components, or different components. For example, the terminal device may also include input and output devices, network access devices, buses, etc.
[0087] The processor may be a central processing unit (CPU), other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. The general-purpose processor may be a microprocessor or any conventional processor, etc. The processor is the control center of the terminal device, and uses various interfaces and lines to connect various parts of the entire terminal device.
[0088] The memory can be used to store the computer program and / or module, and the processor realizes various functions of the terminal device by running or executing the computer program and / or module stored in the memory, and calling the data stored in the memory. The memory can mainly include a program storage area and a data storage area, wherein the program storage area can store an operating system, an application required for at least one function (such as a sound playback function, an image playback function, etc.), etc.; the data storage area can store data created according to the use of the mobile phone (such as audio data, a phone book, etc.), etc. In addition, the memory can include a high-speed random access memory, and can also include a non-volatile memory, such as a hard disk, a memory, a plug-in hard disk, a smart memory card (Smart Media Card, SMC), a secure digital (Secure Digital, SD) card, a flash card (Flash Card), at least one disk storage device, a flash memory device, or other volatile solid-state storage devices.
[0089] Wherein, 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, the present invention implements all or part of the processes in the above-mentioned embodiment method, and can also be completed by instructing the relevant hardware through a computer program. The computer program can be stored in a computer-readable storage medium, and the computer program can implement the steps of the above-mentioned various method embodiments when executed by the processor. Wherein, the computer program includes computer program code, and the computer program code can be in source code form, object code form, executable file or some intermediate form. The computer-readable medium may include: any entity or system capable of carrying the computer program code, recording medium, U disk, mobile hard disk, disk, optical disk, computer memory, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), electric carrier signal, telecommunication signal and software distribution medium. It should be noted that the content contained 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, computer-readable media do not include electric carrier signals and telecommunication signals.
[0090] It should be noted that the system embodiment described above is merely illustrative, wherein the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the scheme of this embodiment. In addition, in the drawings of the system embodiment provided by the present invention, the connection relationship between the modules indicates that there is a communication connection between them, which may be specifically implemented as one or more communication buses or signal lines. A person of ordinary skill in the art may understand and implement it without paying any creative effort.
[0091] The specific embodiments described above further illustrate the purpose, technical solutions and beneficial effects of the present invention. It should be understood that the above description is only a specific embodiment of the present invention and is not intended to limit the scope of protection of the present invention. It is particularly pointed out that for those skilled in the art, any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present invention should be included in the scope of protection 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 marking 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: ; Among them, Gray represents the grayscale value of the pixel obtained by processing; R represents the red channel value of the pixel before processing; G represents the green channel value of the pixel before processing; B represents 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 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; Based on the marked pixels, partition processing is performed to obtain bubble features.
5. The method for detecting the tightness of swimming goggles based on machine vision according to claim 4, characterized in that: The method of applying the mean shift iterative algorithm to obtain the drift vector includes: The mean shift iterative algorithm calculation formula is as follows: ;in, represents the drift vector; Indicates the current pixel gray value; Represents the weighted mean of the current pixel; The weighted mean calculation formula is as follows: ;in, Represents the weighted mean of the current pixel; 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; Indicates the index of the sum, from 1 to ; Indicates the total number of pixels in the neighborhood of the current pixel; It is The location of the neighboring pixels.
6. The method for detecting the tightness of swimming goggles based on machine vision according to claim 4, 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.
7. The method for detecting the tightness of swimming goggles based on machine vision according to claim 4, 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.
8. The method for detecting the tightness of swimming goggles based on machine vision according to claim 4, 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.
9. 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 the Pixel coordinates of the marked area of the frame; ( , ) indicates the Pixel coordinates of the marked region of the frame; Indicates the time interval between two frames; Indicates motion displacement.
10. A swimming goggle tightness detection system based on machine vision, 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
Automatic bubble eliminating system for vacuum casting and method
CN101670636A
Mean shift based grey relation infrared imaging target segmentation method
CN102063707A
Depth image segmentation method based on mean shift algorithm and mathematical morphology
CN103136753A
Method for extracting gesture contour in augmented reality system
CN106326872A
Underwater target recognition method based on machine vision
CN107578045A
