Glass thickness measurement method and system, storage medium and electronic equipment
By using image recognition technology to obtain pixel gradient information of the glass edge image, and screening and fitting edge points, the problems of low glass thickness measurement accuracy and high cost in the existing technology are solved, and high-precision and low-cost glass thickness measurement is achieved.
Patent Information
- Application Number
- CN202510914206.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-07-03
- Publication Date
- 2025-10-10
Smart Images

Figure CN120765715A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the technical field of thickness measurement, and in particular to a glass thickness measurement method, system, storage medium, and electronic device. Background Art
[0002] Glass thickness is an essential parameter required in the glass processing and production process, so it is necessary to accurately measure the glass thickness. For example, the glass thickness needs to be strictly monitored during the production of tempered glass. However, in the existing technology, glass thickness detection is usually carried out manually, by laser or ultrasonic means. In the case of manual measurement, the measurement accuracy of the glass is low; in the case of laser or ultrasonic measurement, the measurement cost is high and the measurement environment requirements are strict. Summary of the Invention
[0003] In response to the above-mentioned problems in the prior art, the purpose of this application is to utilize the light transmittance of glass and adopt image recognition to measure the thickness of glass, thereby reducing the cost of glass thickness measurement and the measurement environment requirements, and improving the measurement accuracy.
[0004] In order to solve the above problems, the present application provides a glass thickness measurement method, comprising: Acquire the glass edge image of the glass to be tested in the thickness direction; Performing pixel detection on a plurality of pixel points in the glass edge image to obtain pixel gradient amplitude values and pixel gradient directions corresponding to each of the plurality of pixel points; the pixel gradient amplitude value of each pixel represents a brightness change rate of the pixel point; and the pixel gradient direction of each pixel point represents a brightness enhancement direction of the pixel point; Performing edge point screening on the plurality of pixel points based on the pixel gradient amplitude value and the pixel gradient direction to obtain a plurality of edge points; Performing straight line fitting on the plurality of edge points to determine an edge line corresponding to the glass to be tested; The glass thickness corresponding to the glass to be measured is determined based on the edge line corresponding to the glass to be measured.
[0005] In an embodiment of the present application, the edge point screening of the plurality of pixel points based on the pixel gradient amplitude value and the pixel gradient direction to obtain the plurality of edge points includes: Determining a first pixel point and a second pixel point adjacent to any pixel point based on a pixel gradient direction of any pixel point; the first pixel point, the any pixel point, and the second pixel point are arranged in sequence along the pixel gradient direction of the any pixel point; If the pixel gradient amplitude value of any pixel point is greater than the pixel gradient amplitude value of the first pixel point, and the pixel gradient amplitude value of any pixel point is greater than the pixel gradient amplitude value of the second pixel point, determining the any pixel point as a target edge point; The plurality of edge points are determined based on the target edge point.
[0006] In an embodiment of the present application, the target edge point includes sub-pixel coordinate information, and the method further includes: Get the pixel distance between two adjacent pixels; Calculating based on the pixel gradient amplitude value of the first pixel point and the pixel gradient amplitude of the second pixel point to obtain a slope of the brightness change rate between the first pixel point and the second pixel point; Calculating based on the pixel gradient amplitude value of any pixel point, the pixel gradient amplitude value of the first pixel point, and the pixel gradient amplitude value of the second pixel point, obtaining a brightness change rate curvature between the target edge point and the adjacent pixel point; Determining the offset coordinates of the target edge point based on the direction angle corresponding to the pixel gradient direction of any pixel point, the brightness change rate slope, the brightness change rate curvature, and the pixel distance; The sub-pixel coordinate information is determined based on the offset coordinates and the coordinates corresponding to the any pixel.
[0007] In the embodiment of the present application, performing pixel detection on a plurality of pixel points in the glass edge image to obtain pixel gradient amplitude values and pixel gradient directions corresponding to the plurality of pixel points includes: Obtaining convolution matrices corresponding to multiple preset directions and a neighborhood matrix corresponding to any pixel point; the neighborhood matrix is determined based on pixel values corresponding to multiple pixel points that meet preset conditions and are centered on the any pixel point; Performing convolution processing on the neighborhood matrix corresponding to any pixel point based on the convolution matrices corresponding to the multiple preset directions to obtain brightness information corresponding to the any pixel point; the brightness information includes gradient amplitude values corresponding to the multiple preset directions; Determine a pixel gradient amplitude value and a pixel gradient direction corresponding to any pixel point based on brightness information corresponding to any pixel point; The pixel gradient amplitude value and the pixel gradient direction corresponding to each of the plurality of pixel points are determined based on the pixel gradient amplitude value and the pixel gradient direction corresponding to any one of the pixel points.
[0008] In an embodiment of the present application, the method further includes: Get target rectangle information; Binarizing the pixel values in the glass edge image to obtain a binary image; Based on the target rectangle information, a target contour in the binary image is subjected to rectangle fitting to obtain a fitting rectangle corresponding to the glass edge image; the target contour is the outermost contour with the largest area in the binary image.
[0009] In an embodiment of the present application, performing straight line fitting on the plurality of edge points to determine the edge line corresponding to the glass to be tested includes: Performing upper edge fitting based on multiple edge points within the fitting rectangle to obtain a first edge line; the first edge line is close to the upper edge of the fitting rectangle; performing lower edge fitting based on the slope information corresponding to the first edge line and a plurality of edge points within the fitting rectangle to obtain a second edge line; the second edge line is close to the lower edge of the fitting rectangle; An edge line corresponding to the glass to be tested is determined based on the first edge and the second edge.
[0010] In an embodiment of the present application, determining the glass thickness corresponding to the glass to be tested based on the edge line corresponding to the glass to be tested includes: Acquire a first point on the first edge line and a second point on the second edge line; the first point and the second point have the same horizontal coordinate; Performing distance calculation based on the vertical coordinate of the first point and the vertical coordinate of the second point to obtain an image thickness corresponding to the glass to be measured; A mapping calculation is performed based on the image thickness and the camera pixels acquired by the image acquisition device to obtain the glass thickness corresponding to the glass to be measured.
[0011] On the other hand, the present application also provides a glass thickness measurement system, comprising: An image acquisition module is used to acquire an image of the glass edge of the glass to be tested in the thickness direction; a pixel detection module, configured to perform pixel detection on a plurality of pixel points in the glass edge image to obtain pixel gradient amplitude values and pixel gradient directions corresponding to each of the plurality of pixel points; the pixel gradient amplitude value of each pixel represents a brightness change rate of the pixel point; and the pixel gradient direction of each pixel point represents a brightness enhancement direction of the pixel point; an edge screening module, configured to screen edge points of the plurality of pixel points based on the pixel gradient amplitude value and the pixel gradient direction to obtain a plurality of edge points; An edge fitting module, configured to perform straight line fitting on the plurality of edge points to determine an edge line corresponding to the glass to be tested; a thickness determination module configured to determine the glass thickness of the glass to be measured based on the edge line of the glass to be measured.
[0012] In another aspect, the present application also provides an electronic device, which comprises a processor and a memory, the memory storing at least one instruction or at least one program, the at least one instruction or the at least one program being loaded and executed by the processor to implement the above-mentioned glass thickness measurement method.
[0013] In another aspect, the present application also provides a computer storage medium, which stores at least one instruction or at least one program, the at least one instruction or the at least one program being loaded and executed by a processor to implement the above-mentioned glass thickness measurement method.
[0014] Due to the above technical solutions, the glass thickness measurement method has the following beneficial effects: By acquiring the glass edge image of the glass to be measured in the thickness direction, and detecting the pixel gradient amplitude value and the pixel gradient direction in the glass edge image by using the light transmission characteristics of the glass, the pixel points in the glass edge image are determined based on the brightness change of the glass edge image, and then the glass edge line and the glass thickness are determined, thereby reducing the glass thickness measurement cost and the measurement environment requirement, and improving the measurement accuracy. BRIEF DESCRIPTION OF DRAWINGS
[0015] In order to more clearly illustrate the technical solutions of the present application, the following will briefly introduce the drawings needed to be used in the embodiments or prior art description. Obviously, the drawings in the following description are only some embodiments of the present application, and those skilled in the art can obtain other drawings according to these drawings without creating any creative labor.
[0016] Fig. 1 is a schematic diagram of the application scenario of the glass thickness measurement method provided by the embodiment of the present application; Fig. 2 is a schematic diagram of the flow of the glass thickness measurement method provided by the embodiment of the present application; Fig. 3 is a schematic diagram of the edge point determination flow in the glass thickness measurement method provided by the embodiment of the present application; Fig. 4 is a schematic diagram of the sub-pixel coordinate information determination flow in the glass thickness measurement method provided by the embodiment of the present application; Fig. 5 is a schematic diagram of the pixel gradient amplitude value and the pixel gradient direction determination flow in the glass thickness measurement method provided by the embodiment of the present application; Fig. 6 is a schematic diagram of the rectangular fitting flow in the glass thickness measurement method provided by the embodiment of the present application; Fig. 7 is a schematic diagram of an edge line determination process in a glass thickness measurement method according to an embodiment of the present application; Fig. 8 is a schematic diagram of a glass thickness determination process in a glass thickness measurement method according to an embodiment of the present application; Fig. 9 is a schematic diagram of a glass thickness measurement system according to an embodiment of the present application; Fig. 10 is a hardware framework structure diagram corresponding to a glass thickness measurement method according to an embodiment of the present application.
[0017] In the figure, 1 is a glass transportation platform, 2 is a transportation shaft, 3 is a glass to be measured, 4 is an imaging module, and 5 is a light source module. DETAILED DESCRIPTION
[0018] The technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, rather than all the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those skilled in the art without creative work fall within the scope of protection of the present application.
[0019] The term "one embodiment" or "an embodiment" as used herein means that a particular feature, structure, or characteristic described in connection with the embodiment can be included in at least one implementation of the present application. In the description of the present application, it should be understood that the terms "upper", "lower", "left", "right", "top", "bottom", etc. indicate the orientation or positional relationship shown in the drawings, and are only for the convenience of describing the present application and simplifying the description, and do not indicate or imply that the devices or elements referred to must have a particular orientation, be constructed and operated in a particular orientation, and therefore cannot be understood as a limitation on the present application. In addition, the terms "first", "second" are only for the purpose of description, and cannot be understood as indicating or implying relative importance or implicitly indicating the number of the technical features indicated. Therefore, the features limited by "first", "second" can be explicitly or implicitly included one or more of the features. Moreover, the terms "first", "second", etc. are used to distinguish similar objects, and do not necessarily describe a specific order or sequence. It should be understood that the data thus used can be interchanged under appropriate circumstances, so that the embodiments of the present application described herein can be implemented in an order other than that illustrated or described herein.
[0020] Reference Figure 1 The application scenario of the glass thickness measurement method provided by the embodiments of the present application is introduced, specifically, it is applied to a glass transportation flow line, wherein the glass transportation flow line includes a glass transportation platform and a transportation shaft, the shaft is used to drive the glass transportation platform to move, and the glass transportation platform is used to carry glass.
[0021] In the embodiments of the present application, the image acquisition device is arranged on the side of the glass conveying platform and between two adjacent conveying shafts, so that the image acquisition device can acquire the glass edge image in the thickness direction of the glass while reducing the influence of the conveying shaft on image recognition.
[0022] In the embodiments of the present application, the image acquisition device comprises an imaging module and a light source module, and the light source module is used to emit light source when the imaging module works. Specifically, the imaging module includes but is not limited to an adjustable camera, and the light source module includes but is not limited to one or more of LED light sources or high-frequency fluorescent light sources and the like.
[0023] In combination with Figure 2 , a glass thickness measurement method provided by the embodiments of the present application is introduced, and the method comprises: S1001, acquiring a glass edge image in the thickness direction of the glass to be measured.
[0024] In the embodiments of the present application, the glass edge image can be obtained by pre-processing the image acquired by the image acquisition device.
[0025] In the embodiments of the present application, the image acquired by the image acquisition device can be pre-processed by using brightness non-uniformity correction and Gaussian filter denoising.
[0026] S1002, performing pixel detection on a plurality of pixel points in the glass edge image to obtain a plurality of pixel gradient amplitude values and pixel gradient directions corresponding to the plurality of pixel points respectively; the pixel gradient amplitude value of each pixel represents the brightness change rate of each pixel point; the pixel gradient direction of each pixel point represents the brightness enhancement direction of each pixel point; the pixel detection refers to the process of calculating the pixel gradient amplitude value of each pixel point and determining the pixel gradient direction of each pixel point respectively.
[0027] In the embodiments of the present application, due to the light transmission property of the glass, the pixel gradient amplitude value of the pixel point corresponding to the non-glass edge position in the glass edge image is smaller, and the pixel gradient amplitude value of the pixel point corresponding to the glass edge position is larger; in addition, the pixel gradient direction of the pixel point corresponding to the glass edge position should be based on the outward direction of the pixel point itself.
[0028] S1003, performing edge point screening on the plurality of pixel points based on the pixel gradient amplitude value and the pixel gradient direction to obtain a plurality of edge points; the edge point screening refers to the process of screening the plurality of edge points from the plurality of pixel points.
[0029] S1004, performing straight line fitting on the plurality of edge points to determine the edge line corresponding to the glass to be measured; the straight line fitting refers to the process of fitting the plurality of edge points into two parallel straight lines.
[0030] S1005: Determine the glass thickness corresponding to the glass to be measured based on the edge line corresponding to the glass to be measured.
[0031] In an embodiment of the present application, a glass edge image of the glass to be measured in the thickness direction is obtained, and the characteristics of glass transmittance are utilized to detect the pixel gradient amplitude value and the pixel gradient direction in the glass edge image, so as to determine the pixel points in the glass edge image based on the brightness change of the glass edge image, and then determine the glass edge line and the glass thickness, thereby reducing the cost of glass thickness measurement and the measurement environment requirements, and improving the measurement accuracy.
[0032] refer to Figure 3 In the embodiment of the present application, S1003 includes: S2001, determining a first pixel point and a second pixel point adjacent to any pixel point based on a pixel gradient direction of any pixel point; the first pixel point, any pixel point, and the second pixel point are arranged in sequence along the pixel gradient direction of any pixel point.
[0033] In a specific embodiment of the present application, for pixel point A, pixel point B and pixel point C can be determined as adjacent pixel points of pixel point A along the pixel gradient direction of pixel point A; and in the pixel gradient direction of pixel point A, pixel point B, pixel point A and pixel point C are arranged in sequence; that is, pixel point B is the first pixel point of pixel point A, and pixel point C is the second pixel point of pixel point A.
[0034] S2002: Determine any pixel point as a target edge point when the pixel gradient amplitude value of any pixel point is greater than the pixel gradient amplitude value of the first pixel point and the pixel gradient amplitude value of any pixel point is greater than the pixel gradient amplitude value of the second pixel point.
[0035] In the embodiment of the present application, the pixel gradient amplitude value of any pixel point is greater than the pixel gradient amplitude value of the first pixel point, indicating that the brightness change rate of any pixel point is greater than the brightness change rate of the first pixel point; similarly, it can be known that the brightness change rate of any pixel point is greater than the brightness change rate of the second pixel point; therefore, it can be determined that the brightness relationship of the first pixel point, any pixel point and the second pixel point is: bright-dark-bright; based on the light transmittance of the glass, it can be inferred that any pixel point is a target edge point.
[0036] In the specific embodiment of the present application, for pixel A, two adjacent pixel points B and pixel C of pixel A; the pixel gradient amplitude value of pixel A is Greater than the pixel gradient amplitude value of pixel B , and the pixel gradient amplitude value of pixel point A Greater than the pixel gradient amplitude value of pixel B In this case, pixel A can be determined as the target edge point.
[0037] S2003, determine a plurality of edge points based on the target edge point.
[0038] In the embodiment of the present application, the pixel gradient amplitude value corresponding to each of the first pixel point and the second pixel point adjacent to any pixel point in the pixel gradient direction is used to determine whether any pixel point is an edge point by using the light transmission property of glass, so as to improve the accuracy of determining edge points in the edge image of glass, and further improve the measurement accuracy of glass thickness.
[0039] Reference Figure 4 In the embodiment of the present application, the target edge point includes sub-pixel coordinate information, and the glass thickness measurement method further includes: S3001, obtain the pixel distance between two adjacent pixels.
[0040] In the embodiment of the present application, the pixel distance between two adjacent pixels can be Euclidean distance or city block distance.
[0041] S3002, calculate the brightness change rate slope between the first pixel point and the second pixel point based on the pixel gradient amplitude value of the first pixel point and the pixel gradient amplitude value of the second pixel point; the brightness change rate slope represents the change rate of brightness along a certain direction.
[0042] In the embodiment of the present application, the brightness change rate slope between the first pixel point and the second pixel point can be calculated by the following formula:
[0043] Wherein, is the brightness change rate slope, is the pixel gradient amplitude value of the first pixel point, is the pixel gradient amplitude value of the second pixel point.
[0044] S3003, calculate the brightness change rate curvature between the target edge point and the adjacent pixel point based on the pixel gradient amplitude value of any pixel point, the pixel gradient amplitude value of the first pixel point and the pixel gradient amplitude value of the second pixel point; the brightness change rate represents the change rate of the brightness change rate itself.
[0045] In the embodiment of the present application, the brightness change rate curvature between the target edge point and the adjacent pixel point can be calculated by the following formula:
[0046] Wherein, is the brightness change rate curvature, is the pixel gradient amplitude value of the first pixel point, is the pixel gradient amplitude value of any pixel point, is the pixel gradient amplitude value of the second pixel point.
[0047] S3004: Determine the offset coordinates of the target edge point based on the direction angle, brightness change rate slope, brightness change rate curvature, and pixel distance corresponding to the pixel gradient direction of any pixel point.
[0048] In a specific embodiment of the present application, the offset coordinates can be calculated using the following formula:
[0049]
[0050] in, is the offset horizontal coordinate, is the slope of the brightness change rate, is the brightness change rate curvature, is the pixel distance, is the direction angle corresponding to the pixel gradient direction of any pixel point, is the offset vertical coordinate.
[0051] S3005 : Determine sub-pixel coordinate information based on the offset coordinates and the coordinates corresponding to any pixel.
[0052] In a specific embodiment of the present application, the sub-pixel coordinate information can be determined using the following formula:
[0053]
[0054] in, is the horizontal coordinate in the sub-pixel coordinate information, is the horizontal coordinate corresponding to any pixel, is the offset horizontal coordinate, is the vertical coordinate in the sub-pixel coordinate information, is the vertical coordinate corresponding to any pixel, is the offset vertical coordinate.
[0055] In the embodiment of the present application, by determining the sub-pixel coordinate information of the edge point, the coordinate accuracy of the edge point coordinates is improved, thereby improving the fitting accuracy of the straight line fitting based on the edge point, and thereby improving the measurement accuracy of the glass thickness.
[0056] refer to Figure 5 In the embodiment of the present application, S1003 includes: S4001. Obtain convolution matrices corresponding to multiple preset directions and a neighborhood matrix corresponding to any pixel point; the neighborhood matrix is determined based on pixel values corresponding to multiple pixel points that meet preset conditions and are centered at any pixel point.
[0057] In a specific embodiment of the present application, eight preset directions can be set, specifically, eight directions corresponding to 0°, 45°, 90°, 135°, 180°, 225°, 270° and 315°.
[0058] In the specific embodiment of the present application, the convolution matrix corresponding to 0° is for: ; Convolution matrix corresponding to 45° for: ; The convolution matrix corresponding to 90° for: ; The convolution matrix corresponding to 135° for: ; The convolution matrix corresponding to 180° for: ; The convolution matrix corresponding to 225° for: ; The convolution matrix corresponding to 270° for: ; The convolution matrix corresponding to 315° for: .
[0059] In a specific embodiment of the present application, the preset condition is pixel points within a 3×3 range.
[0060] S4002. Perform convolution processing on the neighborhood matrix corresponding to any pixel point based on the convolution matrices corresponding to multiple preset directions to obtain brightness information corresponding to any pixel point; the brightness information includes gradient amplitude values corresponding to the multiple preset directions.
[0061] In a specific embodiment of the present application, the convolution process can be calculated using the following formula:
[0062] in, is any one of multiple preset directions, is the gradient amplitude value corresponding to any preset direction, is the convolution matrix corresponding to any preset direction. Specifically, and correspond; is the neighborhood matrix.
[0063] In a specific embodiment of the present application, the brightness information includes - The corresponding gradient amplitude values.
[0064] S4003. Determine a pixel gradient amplitude value and a pixel gradient direction corresponding to any pixel point based on brightness information corresponding to any pixel point.
[0065] In a specific embodiment of the present application, S4003 includes: The maximum value among the multiple gradient amplitude values corresponding to any pixel point is determined as the pixel gradient amplitude value corresponding to any pixel point; specifically, ,in, is the pixel gradient amplitude value corresponding to any pixel point.
[0066] The preset direction corresponding to the pixel gradient amplitude value is determined as the pixel gradient direction; specifically, ,in, is the pixel gradient direction.
[0067] S4004: Determine the pixel gradient amplitude values and pixel gradient directions corresponding to each of the plurality of pixel points based on the pixel gradient amplitude value and pixel gradient direction corresponding to any pixel point.
[0068] In an embodiment of the present application, convolution is performed by setting multiple preset directions to calculate the pixel gradient amplitude value and the pixel gradient direction of the pixel point, thereby improving the accuracy of determining the pixel gradient amplitude value and the pixel gradient direction of the pixel point, thereby improving the accuracy of edge point determination and improving the accuracy of glass thickness measurement.
[0069] refer to Figure 6 In an embodiment of the present application, the glass thickness measurement method further includes: S5001. Obtain target rectangle information.
[0070] S5002. Binarize the pixel values in the glass edge image to obtain a binary image. Binarization is a process of mapping a continuous grayscale value distribution to a discrete binary state.
[0071] In a specific embodiment of the present application, during the process of binarizing the pixel values of the glass edge image, connected domain filtering interference and morphological closing operations can be used to fill in the edge disconnected areas in the binary image to obtain a binary image.
[0072] S5003. Perform rectangle fitting on the target contour in the binary image based on the target rectangle information to obtain a fitting rectangle corresponding to the glass edge image; the target contour is the outermost contour with the largest area in the binary image; rectangle fitting refers to the process of fitting a rectangle in the glass edge image.
[0073] In a specific embodiment of the present application, by pre-performing rectangular fitting on the target contour in the binary image, the region of interest corresponding to the upper edge or lower edge of the fitting rectangle can be located in the subsequent edge line fitting process, and a straight line fitting is performed based on the region of interest corresponding to the upper edge or lower edge, thereby reducing the straight line fitting range, improving data processing accuracy and efficiency, and thereby improving the accuracy and efficiency of glass thickness measurement.
[0074] refer to Figure 7 In the embodiment of the present application, S1004 includes: S6001. Perform upper edge fitting based on multiple edge points in the fitting rectangle to obtain a first edge line; the first edge line is close to the upper edge of the fitting rectangle; upper edge fitting refers to the process of performing straight line fitting based on multiple edge points in the region of interest corresponding to the upper edge of the fitting rectangle.
[0075] In a specific embodiment of the present application, the edges of the fitting rectangle can be defined during the rectangle fitting process to determine the upper and lower edges of the fitting rectangle; lower edge fitting refers to the process of performing straight line fitting based on multiple edge points in the area of interest corresponding to the lower edge of the fitting rectangle.
[0076] S6002 : Perform lower edge fitting based on slope information corresponding to the first edge line and multiple edge points within the fitting rectangle to obtain a second edge line; the second edge line is close to the lower edge of the fitting rectangle.
[0077] S6003: Determine an edge line corresponding to the glass to be tested based on the first edge and the second edge.
[0078] In a specific embodiment of the present application, by performing straight line fitting within the fitting rectangle, the influence of noise points in the non-edge area of the glass edge image on the fitted edge straight line is reduced, thereby improving the straight line fitting accuracy and the glass thickness measurement accuracy.
[0079] In the specific embodiment of the present application, the straight line fitting process is calculated using the following formula:
[0080] in, is the fitted straight line function, k is the slope of the straight line, b is the constant of the straight line, is the weight of the edge point, ( , ) is the sub-pixel coordinate of the edge point, i represents any edge point among multiple edge points, and n is the number of multiple edge points.
[0081] In a specific embodiment of the present application, the slope of the first edge line is consistent with the slope of the second edge line.
[0082] refer toFigure 8 In the embodiment of the present application, S1005 includes: S7001. Obtain a first point on a first edge line and a second point on a second edge line; the first point and the second point have the same horizontal coordinate.
[0083] In a specific embodiment of the present application, the coordinates of the first point and the coordinates of the second point can be pixel coordinates or the sub-pixel coordinates calculated above. Specifically, the accuracy of the glass thickness measured using sub-pixel coordinates is higher than the accuracy of the glass thickness measured using pixel coordinates.
[0084] S7002: Perform distance calculation based on the vertical coordinate of the first point and the vertical coordinate of the second point to obtain the image thickness corresponding to the glass to be measured.
[0085] S7003. Perform mapping calculation based on the image thickness and the camera pixels acquired by the image acquisition device to obtain the glass thickness corresponding to the glass to be measured; mapping calculation refers to the process of mapping the image distance to the actual distance.
[0086] In a specific embodiment of the present application, by calculating the glass thickness in a coordinate manner and mapping it through camera pixels, the cost of measuring the glass thickness and the measurement environment requirements can be reduced, and the measurement accuracy can be improved.
[0087] refer to Figure 9 , an embodiment of the present application further provides a glass thickness measurement system, the system comprising: The image acquisition module 101 is used to acquire the glass edge image of the glass to be tested in the thickness direction.
[0088] The pixel detection module 102 is used to perform pixel detection on multiple pixel points in the glass edge image to obtain the pixel gradient amplitude value and pixel gradient direction corresponding to each of the multiple pixel points; the pixel gradient amplitude value of each pixel represents the brightness change rate of each pixel point; the pixel gradient direction of each pixel point represents the brightness enhancement direction of each pixel point.
[0089] The edge screening module 103 is configured to screen edge points of a plurality of pixel points based on pixel gradient amplitude values and pixel gradient directions to obtain a plurality of edge points.
[0090] The edge fitting module 104 is used to perform straight line fitting on multiple edge points to determine the edge line corresponding to the glass to be tested.
[0091] The thickness determination module 105 is configured to determine the glass thickness of the glass to be measured based on the edge line of the glass to be measured.
[0092] The edge filtering module includes: The adjacent point determination unit is configured to determine, based on the pixel gradient direction of any pixel point, a first pixel point and a second pixel point adjacent to the any pixel point; the first pixel point, the any pixel point and the second pixel point are arranged in sequence along the pixel gradient direction of the any pixel point.
[0093] The target edge determination unit is configured to determine the any pixel point as a target edge point in a case where the pixel gradient amplitude value of the any pixel point is greater than the pixel gradient amplitude value of the first pixel point and the pixel gradient amplitude value of the any pixel point is greater than the pixel gradient amplitude value of the second pixel point.
[0094] The plurality of edge determination units are configured to determine a plurality of edge points based on the target edge point.
[0095] The glass thickness measurement system further comprises: The pixel distance determination module is configured to obtain a pixel distance between two adjacent pixels.
[0096] The slope calculation module is configured to calculate, based on the pixel gradient amplitude value of the first pixel point and the pixel gradient amplitude value of the second pixel point, a brightness change rate slope between the first pixel point and the second pixel point.
[0097] The curvature calculation module is configured to calculate, based on the pixel gradient amplitude value of the any pixel point, the pixel gradient amplitude value of the first pixel point and the pixel gradient amplitude value of the second pixel point, a brightness change rate curvature between the target edge point and the adjacent pixel point.
[0098] The offset coordinate determination module is configured to determine, based on a direction included angle corresponding to the pixel gradient direction of the any pixel point, the brightness change rate slope, the brightness change rate curvature and the pixel distance, an offset coordinate of the target edge point.
[0099] The sub-pixel coordinate determination module is configured to determine, based on the offset coordinate and a coordinate corresponding to the any pixel, sub-pixel coordinate information.
[0100] The pixel detection module comprises: The matrix acquisition unit is configured to obtain a convolution matrix corresponding to a plurality of preset directions and a neighborhood matrix corresponding to the any pixel point; the neighborhood matrix is determined based on pixel values of a plurality of pixel points satisfying a preset condition and centered on the any pixel point.
[0101] The convolution unit is configured to perform convolution processing on the neighborhood matrix corresponding to the any pixel point based on the convolution matrix corresponding to the plurality of preset directions to obtain brightness information corresponding to the any pixel point; the brightness information comprises gradient amplitude values corresponding to the plurality of preset directions.
[0102] The amplitude and direction determination unit is configured to determine, based on the brightness information corresponding to the any pixel point, a pixel gradient amplitude value and a pixel gradient direction corresponding to the any pixel point.
[0103] Multiple determining units are used to determine the pixel gradient amplitude value and the pixel gradient direction corresponding to multiple pixel points based on the pixel gradient amplitude value and the pixel gradient direction corresponding to any pixel point.
[0104] The glass thickness measurement system also includes: The rectangle acquisition module is used to obtain target rectangle information.
[0105] The binary processing module is used to perform binary processing on the pixel values in the glass edge image to obtain a binary image.
[0106] The rectangle fitting module is used to perform rectangle fitting on the target contour in the binary image based on the target rectangle information to obtain the fitting rectangle corresponding to the glass edge image; the target contour is the outermost contour with the largest area in the binary image.
[0107] Edge fitting module includes; The first fitting unit is configured to perform upper edge fitting based on a plurality of pixel points within the fitting rectangle to obtain a first edge line; the first edge line is close to the upper edge of the fitting rectangle.
[0108] The second fitting unit is configured to perform lower edge fitting based on the slope information corresponding to the first edge line and a plurality of pixel points within the fitting rectangle to obtain a second edge line; the second edge line is close to the lower edge of the fitting rectangle.
[0109] The edge line determination module is used to determine the edge line corresponding to the glass to be tested based on the first edge and the second edge.
[0110] The thickness determination module includes: The point acquisition unit is used to acquire a first point on the first edge line and a second point on the second edge line; the first point and the second point have the same horizontal coordinate.
[0111] The distance determination unit is used to perform distance calculation based on the longitudinal coordinate of the first point and the longitudinal coordinate of the second point to obtain the image thickness corresponding to the glass to be measured.
[0112] The distance mapping unit is used to perform mapping calculation based on the image thickness and the camera pixels collected by the image acquisition device to obtain the glass thickness corresponding to the glass to be measured.
[0113] An embodiment of the present application also provides an electronic device, which includes a processor and a memory, wherein the memory stores at least one instruction or at least one program, and the at least one instruction or at least one program is loaded and executed by the processor to implement the glass thickness measurement method as described above.
[0114] The memory can be used to store software programs and modules. The processor executes various functional applications and data processing by running the software programs and modules stored in the memory. The memory can mainly include a program storage area and a data storage area. The program storage area can store the operating system, application programs required for the functions, etc.; the data storage area can store data created based on the use of the device, etc. In addition, the memory can include high-speed random access memory and non-volatile memory, such as at least one hard disk storage device, flash memory device, or other volatile solid-state storage device. Accordingly, the memory can also include a memory controller to provide the processor with access to the memory.
[0115] The method embodiments provided in the embodiments of the present application can be executed in electronic devices such as mobile terminals, computer terminals, servers or similar computing devices. Figure 10 This is an electronic device provided by the embodiment of the present application. Figure 10 As shown, the electronic device 900 may vary significantly due to different configurations or performance, and may include one or more central processing units (CPUs) 910 (the processor 910 may include, but is not limited to, a processing device such as a microprocessor MCU or a programmable logic device FPGA), a memory 930 for storing data, and one or more storage media 920 (e.g., one or more mass storage devices) for storing application programs 923 or data 922. The memory 930 and storage medium 920 may be either transient or persistent storage. The program stored in the storage medium 920 may include one or more modules, each of which may include a series of instruction operations on the electronic device. Furthermore, the CPU 910 may be configured to communicate with the storage medium 920 to execute the series of instruction operations in the storage medium 920 on the electronic device 900. The electronic device 900 may also include one or more power supplies 960, one or more wired or wireless network interfaces 950, one or more input and output interfaces 940, and / or one or more operating systems 921, such as Windows Server™, Mac OS X™, Unix™, Linux™, FreeBSD™, etc.
[0116] The input / output interface 940 can be used to receive or transmit data via a network. A specific example of the aforementioned network may include a wireless network provided by the communications provider of the electronic device 900. In one embodiment, the input / output interface 940 includes a network interface controller (NIC), which can be connected to other network devices via a base station to enable communication with the Internet. In another embodiment, the input / output interface 940 can be a radio frequency (RF) module for wireless communication with the Internet.
[0117] It can be understood by those skilled in the art that Figure 10 The structure shown is only for illustration and does not limit the structure of the above electronic device. Figure 10 More or fewer components than shown, or with Figure 10 Different configurations shown.
[0118] An embodiment of the present application further provides a storage medium storing at least one instruction or at least one program segment, which is loaded and executed by a processor to implement the glass thickness measurement method as described above.
[0119] The above description has fully disclosed the specific embodiments of this application. It should be noted that any changes made by those skilled in the art to the specific embodiments of this application do not depart from the scope of the claims of this application. Accordingly, the scope of the claims of this application is not limited to the above specific embodiments.
Claims
1. A method for measuring glass thickness, characterized in that: The method comprises: Acquire the glass edge image of the glass to be tested in the thickness direction; Performing pixel detection on a plurality of pixel points in the glass edge image to obtain pixel gradient amplitude values and pixel gradient directions corresponding to each of the plurality of pixel points; the pixel gradient amplitude value of each pixel represents a brightness change rate of the pixel point; and the pixel gradient direction of each pixel point represents a brightness enhancement direction of the pixel point; Performing edge point screening on the plurality of pixel points based on the pixel gradient amplitude value and the pixel gradient direction to obtain a plurality of edge points; Performing straight line fitting on the plurality of edge points to determine an edge line corresponding to the glass to be tested; The glass thickness corresponding to the glass to be measured is determined based on the edge line corresponding to the glass to be measured.
2. The glass thickness measuring method according to claim 1, characterized in that: The performing edge point screening on the plurality of pixel points based on the pixel gradient amplitude value and the pixel gradient direction to obtain the plurality of edge points comprises: Determining a first pixel point and a second pixel point adjacent to any pixel point based on a pixel gradient direction of any pixel point; the first pixel point, the any pixel point, and the second pixel point are arranged in sequence along the pixel gradient direction of the any pixel point; If the pixel gradient amplitude value of any pixel point is greater than the pixel gradient amplitude value of the first pixel point, and the pixel gradient amplitude value of any pixel point is greater than the pixel gradient amplitude value of the second pixel point, determining the any pixel point as a target edge point; The plurality of edge points are determined based on the target edge point.
3. The glass thickness measuring method according to claim 2, characterized in that: The target edge point includes sub-pixel coordinate information, and the method further includes: Get the pixel distance between two adjacent pixels; Calculating based on the pixel gradient amplitude value of the first pixel point and the pixel gradient amplitude of the second pixel point to obtain a slope of the brightness change rate between the first pixel point and the second pixel point; Calculating based on the pixel gradient amplitude value of any pixel point, the pixel gradient amplitude value of the first pixel point, and the pixel gradient amplitude value of the second pixel point, obtaining a brightness change rate curvature between the target edge point and the adjacent pixel point; Determining the offset coordinates of the target edge point based on the direction angle corresponding to the pixel gradient direction of any pixel point, the brightness change rate slope, the brightness change rate curvature, and the pixel distance; The sub-pixel coordinate information is determined based on the offset coordinates and the coordinates corresponding to the any pixel.
4. The glass thickness measuring method according to claim 1, wherein: The performing pixel detection on a plurality of pixel points in the glass edge image to obtain pixel gradient amplitude values and pixel gradient directions corresponding to the plurality of pixel points includes: Obtaining convolution matrices corresponding to multiple preset directions and a neighborhood matrix corresponding to any pixel point; the neighborhood matrix is determined based on pixel values corresponding to multiple pixel points that meet preset conditions and are centered on the any pixel point; Performing convolution processing on the neighborhood matrix corresponding to any pixel point based on the convolution matrices corresponding to the multiple preset directions to obtain brightness information corresponding to the any pixel point; the brightness information includes gradient amplitude values corresponding to the multiple preset directions; Determine a pixel gradient amplitude value and a pixel gradient direction corresponding to any pixel point based on brightness information corresponding to any pixel point; The pixel gradient amplitude value and the pixel gradient direction corresponding to each of the plurality of pixel points are determined based on the pixel gradient amplitude value and the pixel gradient direction corresponding to any one of the pixel points.
5. The glass thickness measuring method according to claim 1, wherein: The method further comprises: Get target rectangle information; Binarizing the pixel values in the glass edge image to obtain a binary image; Based on the target rectangle information, a target contour in the binary image is subjected to rectangle fitting to obtain a fitting rectangle corresponding to the glass edge image; the target contour is the outermost contour with the largest area in the binary image.
6. The glass thickness measuring method according to claim 5, characterized in that: The performing straight line fitting on the plurality of edge points to determine the edge line corresponding to the glass to be tested comprises: Performing upper edge fitting based on multiple pixel points within the fitting rectangle to obtain a first edge line; the first edge line is close to the upper edge of the fitting rectangle; Performing lower edge fitting based on the slope information corresponding to the first edge line and a plurality of pixel points within the fitting rectangle to obtain a second edge line; the second edge line is close to the lower edge of the fitting rectangle; An edge line corresponding to the glass to be tested is determined based on the first edge and the second edge.
7. The glass thickness measuring method according to claim 6, characterized in that: Determining the glass thickness corresponding to the glass to be tested based on the edge line corresponding to the glass to be tested includes: Acquire a first point on the first edge line and a second point on the second edge line; the first point and the second point have the same horizontal coordinate; Performing distance calculation based on the vertical coordinate of the first point and the vertical coordinate of the second point to obtain an image thickness corresponding to the glass to be measured; A mapping calculation is performed based on the image thickness and the camera pixels acquired by the image acquisition device to obtain the glass thickness corresponding to the glass to be measured.
8. A glass thickness measurement system, characterized in that: The system comprises: An image acquisition module is used to acquire an image of the glass edge of the glass to be tested in the thickness direction; a pixel detection module, configured to perform pixel detection on a plurality of pixel points in the glass edge image to obtain pixel gradient amplitude values and pixel gradient directions corresponding to each of the plurality of pixel points; the pixel gradient amplitude value of each pixel represents a brightness change rate of the pixel point; and the pixel gradient direction of each pixel point represents a brightness enhancement direction of the pixel point; an edge screening module, configured to screen edge points of the plurality of pixel points based on the pixel gradient amplitude value and the pixel gradient direction to obtain a plurality of edge points; An edge fitting module, configured to perform straight line fitting on the plurality of edge points to determine an edge line corresponding to the glass to be tested; The thickness determination module is used to determine the glass thickness corresponding to the glass to be tested based on the edge line corresponding to the glass to be tested.
9. A computer storage medium, characterized in that The storage medium stores at least one instruction, at least one program, code set or instruction set, and the at least one instruction, at least one program, code set or instruction set is loaded and executed by the processor to implement the glass thickness measurement method according to any one of claims 1 to 7.
10. An electronic device, characterized in that: The device includes a processor and a memory, wherein the memory stores at least one instruction or at least one program, and the at least one instruction or the at least one program is loaded and executed by the processor to implement the glass thickness measurement method according to any one of claims 1 to 7.
Citation Information
Cited By
Steel plate quality detection method, device, medium and equipment
CN121837158A