Special-shaped screen defect detection method and device, equipment and storage medium
By dividing the outer contour of the special screen into straight and curved segments, and generating a rectangular boundary area for defect detection, the detection problem caused by the adhesion of the boundary defects and background of the special screen is solved, and the detection accuracy is improved.
Patent Information
- Application Number
- CN202411593215.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-08
- Publication Date
- 2025-02-18
AI Technical Summary
The prior art is difficult to detect defects of the special-shaped screen on the boundary because these defects are adhered to the screen background, resulting in the failure of the rectangle-based defect detection method.
By obtaining the screen detection image of the special-shaped screen, filtering out the screen area and extracting the outer contour, dividing it into straight line segments and curve segments, generating rectangular boundary areas based on these straight line segments and curve segments, performing defect detection, and mapping the detection results to Screen detection image.
The problem of the defect detection method based on rectangular frame detection with the screen background when detecting defects in the border of the special screen is effectively avoided, and the accuracy of defect detection is improved.
Smart Images

Figure CN119477864A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of screen detection technology, and in particular to a method, device, equipment and storage medium for detecting defects in special-shaped screens. Background Art
[0002] When performing defect detection on special-shaped screens, the defects on the boundaries of the special-shaped screens have low contrast, are close to the boundaries, and are small in size. This will cause the boundary defects of the special-shaped screen to stick to the screen background, making it difficult for the rectangle-based defect detection method to detect the defects on the boundaries of the special-shaped screens.
[0003] The above contents are only used to assist in understanding the technical solution of the present application and do not constitute an admission that the above contents are prior art. Summary of the invention
[0004] The main purpose of the present application is to provide a method, device, equipment and storage medium for detecting defects in special-shaped screens, aiming to solve the technical problem that the defects on the boundaries of special-shaped screens are difficult to detect using a rectangle-based defect detection method because the defects on the boundaries of the special-shaped screens are adhered to the background of the screen.
[0005] To achieve the above purpose, the present application proposes a method for detecting defects in a special-shaped screen, and the method comprises:
[0006] Acquire a screen detection image of a special-shaped screen;
[0007] Screening out a screen area of the screen detection image and extracting an outer contour of the screen area;
[0008] Cutting the outer contour into straight line segments and curved line segments;
[0009] Generate a rectangular boundary area based on the straight line segment and the curved line segment;
[0010] Defect detection is performed on the rectangular boundary area to obtain defect detection information, and the defect detection information is mapped to the screen detection image to complete defect detection of the special-shaped screen.
[0011] In one embodiment, the step of acquiring a screen detection image of a special-shaped screen includes:
[0012] Acquire an initial screen detection image of the special-shaped screen by shooting a camera;
[0013] Determine whether the angle between the shooting camera and the special-shaped screen is a preset value;
[0014] When it is determined that the angle between the shooting camera and the special-shaped screen is a preset value, determining the initial screen detection image as the screen detection image;
[0015] When it is determined that the angle between the shooting camera and the special-shaped screen is not a preset value, the screen detection image is obtained after performing trapezoidal correction on the initial screen detection image.
[0016] In one embodiment, the step of dividing the outer contour into straight line segments and curved line segments comprises:
[0017] Performing polygon fitting on the outer contour to obtain a target polygon;
[0018] When the length of a target edge in the target polygon is less than a length threshold and the angle between the target edge and an adjacent edge is greater than an angle threshold, determining that the target edge is a curved edge, and determining a curved segment based on all curved edges of the target polygon;
[0019] When the length of a target edge in the target polygon is greater than the length threshold and the angle between the target edge and an adjacent edge is greater than the angle threshold, the target edge is determined to be a straight line segment.
[0020] In one embodiment, the step of generating a rectangular boundary area based on the straight line segment and the curved line segment includes:
[0021] Determine the height of the line segment normal vector of the straight line segment;
[0022] Determine a rectangular detection area according to the straight line segment and the height of the line segment normal vector;
[0023] Obtaining all contour points on the curve segment and determining the number of contour points;
[0024] Determine the normal direction of each contour point;
[0025] Determine a target rectangular detection area according to the number of contour points and the height of the line segment normal vector, copy the pixels of each contour point to the target rectangular detection area in sequence along the normal direction, and store the coordinates and normal direction of each contour point;
[0026] The target rectangular detection area and the rectangular detection area are connected end to end according to the position relationship to obtain a rectangular boundary area.
[0027] In one embodiment, the step of dividing the outer contour into straight line segments and curved line segments comprises:
[0028] Determine a contour chain list of the outer contour, wherein the contour chain list is obtained by sequentially connecting all pixel points on the outer contour;
[0029] Determine the contour inflection point of the outer contour according to the contour chain list;
[0030] Cutting the outer contour into initial straight line segments and initial curve segments according to the contour inflection points;
[0031] The pixel point data corresponding to the initial straight line segment is fitted into a straight line segment by using the least square method, and the pixel point data corresponding to the initial curve segment is fitted into a curve segment by using the least square method.
[0032] In one embodiment, the step of generating a rectangular boundary area based on the straight line segment and the curved line segment includes:
[0033] Determine the detection step size;
[0034] Based on the straight line segment and the detection step, a rectangular detection area is generated;
[0035] Based on the curve segment and the detection step length, generating a sector-shaped detection area;
[0036] The sector-shaped detection area is converted into a target rectangular detection area by polar coordinate transformation;
[0037] The target rectangular detection area and the rectangular detection area are connected end to end according to the position relationship to obtain a rectangular boundary area.
[0038] In one embodiment, the step of performing defect detection on the rectangular boundary area to obtain defect detection information includes:
[0039] Determine a middle area based on the screen area and the rectangular detection area;
[0040] Filtering the rectangular boundary area and the middle area respectively to obtain a target rectangular boundary area and a target middle area;
[0041] Defect segmentation is performed on the target rectangular boundary area and the target middle defect respectively to obtain defect detection information.
[0042] In addition, to achieve the above-mentioned purpose, the present application also proposes a device for detecting defects in a special-shaped screen, and the device for detecting defects in a special-shaped screen comprises:
[0043] An acquisition module, used for acquiring a screen detection image of a special-shaped screen;
[0044] A screening module, used for screening out the screen area of the screen detection image and extracting the outer contour of the screen area;
[0045] A segmentation module, used for segmenting the outer contour into straight line segments and curved line segments;
[0046] A generating module, used for generating a rectangular boundary area based on the straight line segment and the curved line segment;
[0047] The detection module is used to perform defect detection on the rectangular boundary area, obtain defect detection information, and map the defect detection information to the screen detection image to complete defect detection of the special-shaped screen.
[0048] In addition, to achieve the above-mentioned purpose, the present application also proposes a device for detecting defects in special-shaped screens, which includes: a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the computer program is configured to implement the steps of the method for detecting defects in special-shaped screens as described above.
[0049] In addition, to achieve the above-mentioned purpose, the present application also proposes a storage medium, which is a computer-readable storage medium, and a computer program is stored on the storage medium. When the computer program is executed by the processor, the steps of the method for detecting defects in special-shaped screens as described above are implemented.
[0050] In addition, to achieve the above-mentioned purpose, the present application also provides a computer program product, which includes a computer program, and when the computer program is executed by a processor, the steps of the method for detecting defects in special-shaped screens as described above are implemented.
[0051] One or more technical solutions proposed in this application have at least the following technical effects:
[0052] The method, device, equipment and storage medium for detecting defects in special-shaped screens proposed in the present application obtain a screen detection image of a special-shaped screen; filter out a screen area of the screen detection image and extract an outer contour of the screen area; divide the outer contour into straight line segments and curve segments; generate a rectangular boundary area based on the straight line segments and the curve segments; perform defect detection on the rectangular boundary area to obtain defect detection information, and map the defect detection information to the screen detection image to complete defect detection of the special-shaped screen, thereby solving the problem that the defect detection method based on a rectangle is difficult to detect the special-shaped screen because the boundary defects of the special-shaped screen are adhered to the screen background. Compared with the prior art, the present application first divides the outer contour of the special-shaped screen area into straight line segments and curved line segments, and then generates a rectangular boundary area for representing the boundary area of the special-shaped screen according to the straight line segments and the curved line segments, and then performs defect detection on the rectangular boundary area, and then maps the defect detection results to the screen detection image to complete the defect detection of the special-shaped screen. This can avoid detecting the boundary defects of the special-shaped screen together with the screen background when detecting the boundary defects of the special-shaped screen based on the defect detection of the rectangular frame, thereby effectively preventing the defect detection results of the special-shaped screen from being affected by the low contrast between the boundary defects of the special-shaped screen and the screen background, thereby effectively improving the accuracy of the defect results of the special-shaped screen. BRIEF DESCRIPTION OF THE DRAWINGS
[0053] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present application and, together with the description, serve to explain the principles of the present application.
[0054] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, for ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative labor.
[0055] Figure 1 A schematic diagram of a process flow provided for Embodiment 1 of the method for detecting defects in special-shaped screens of the present application;
[0056] Figure 2 A schematic diagram of mobile phone screen types provided in Example 1 of the method for detecting irregular screen defects of the present application;
[0057] Figure 3 A schematic diagram of the inflection point of the contour in the water drop screen provided in the first embodiment of the special-shaped screen defect detection method of the present application;
[0058] Figure 4 A schematic diagram of a sector-shaped detection area in a screen area provided in Embodiment 2 of the method for detecting defects in special-shaped screens of the present application;
[0059] Figure 5 A schematic diagram of a rectangular detection area in a screen area provided in Embodiment 2 of the method for detecting defects in special-shaped screens of the present application;
[0060] Figure 6 A schematic diagram of the splicing of a rectangular area and a rectangular detection area provided in Example 2 of the method for detecting defects in special-shaped screens of the present application;
[0061] Figure 7 A schematic diagram of the middle area of the screen area provided in Example 2 of the method for detecting defects in special-shaped screens of the present application;
[0062] Figure 8 A schematic diagram of a flow chart provided for Embodiment 2 of the method for detecting defects in special-shaped screens of the present application;
[0063] Fig. 9 A schematic diagram of polygon fitting provided for Example 2 of the method for detecting defects in special-shaped screens of the present application;
[0064] Fig.10 A schematic diagram of obtaining a rectangular image from a straight line segment provided in Embodiment 2 of the method for detecting defects in special-shaped screens of the present application;
[0065] Fig.11 A schematic diagram of obtaining a rectangular image from a curve segment provided in Embodiment 2 of the method for detecting defects in special-shaped screens of the present application;
[0066] Fig.12 This is a schematic diagram of the module structure of the device for detecting defects in special-shaped screens according to an embodiment of the present application;
[0067] Fig.13 This is a schematic diagram of the device structure of the hardware operating environment involved in the method for detecting defects in special-shaped screens in an embodiment of the present application.
[0068] The purpose, features and advantages of this application will be further described in conjunction with the embodiments and with reference to the accompanying drawings. DETAILED DESCRIPTION
[0069] It should be understood that the specific embodiments described herein are only used to explain the technical solutions of the present application and are not used to limit the present application.
[0070] In order to better understand the technical solution of the present application, a detailed description will be given below in conjunction with the accompanying drawings and specific implementation methods.
[0071] The main solution of the embodiment of the present application is: obtaining a screen detection image of a special-shaped screen; screening out the screen area of the screen detection image, and extracting the outer contour of the screen area; dividing the outer contour into straight line segments and curve segments; generating a rectangular boundary area based on the straight line segments and the curve segments; performing defect detection on the rectangular boundary area to obtain defect detection information, and mapping the defect detection information to the screen detection image to complete the defect detection of the special-shaped screen.
[0072] In this embodiment, for ease of description, the following description is made by taking the detection device for identifying irregular screen defects as the execution subject.
[0073] In the prior art, the defect at the boundary of the irregular-shaped screen is adhered to the screen background, which makes it difficult for the rectangle-based defect detection method to detect the defect at the boundary of the irregular-shaped screen.
[0074] It can be seen from the above embodiments that the present application obtains a screen detection image of a special-shaped screen; screens out the screen area of the screen detection image and extracts the outer contour of the screen area; divides the outer contour into straight line segments and curve segments; generates a rectangular boundary area based on the straight line segments and the curve segments; performs defect detection on the rectangular boundary area to obtain defect detection information, and maps the defect detection information to the screen detection image to complete the defect detection of the special-shaped screen, thereby solving the problem that the defect detection method based on the rectangle is difficult to detect the defects on the boundary of the special-shaped screen because the boundary defects of the special-shaped screen are adhered to the screen background. Technical problem. Compared with the prior art, the present application first divides the outer contour of the special-shaped screen area into straight line segments and curved line segments, and then generates a rectangular boundary area for representing the boundary area of the special-shaped screen according to the straight line segments and the curved line segments, and then performs defect detection on the rectangular boundary area, and then maps the defect detection results to the screen detection image to complete the defect detection of the special-shaped screen. This can avoid detecting the boundary defects of the special-shaped screen together with the screen background when detecting the boundary defects of the special-shaped screen based on the rectangular frame defect detection, and thus effectively prevent the defect detection results of the special-shaped screen from being affected by the low contrast between the boundary defects of the special-shaped screen and the screen background, thereby effectively improving the accuracy of the defect results of the special-shaped screen.
[0075] It should be noted that the execution subject of this embodiment can be a computing service device with data processing, network communication and program running functions, such as a tablet computer, a personal computer, a mobile phone, etc., or an electronic device capable of realizing the above functions, a special-shaped screen defect detection device, etc. The following takes the special-shaped screen defect detection device as an example to illustrate this embodiment and the following embodiments.
[0076] Based on this, the embodiment of the present application provides a method for detecting irregular screen defects, referring to Figure 1 , Figure 1 This is a flow chart of the first embodiment of the method for detecting defects in special-shaped screens of the present application.
[0077] In this embodiment, the method for detecting irregular screen defects includes steps S10 to S50:
[0078] Step S10, obtaining a screen detection image of the special-shaped screen;
[0079] It should be noted that if Figure 2 As shown, the special-shaped screen may be a notch screen, a water drop screen, a hole-punch screen, etc.; the screen detection image refers to an image used for defect detection.
[0080] In a feasible implementation manner, the step of obtaining a screen detection image of the special-shaped screen includes: obtaining an initial screen detection image of the special-shaped screen by using a shooting camera; determining whether the angle between the shooting camera and the special-shaped screen is a preset value; when it is determined that the angle between the shooting camera and the special-shaped screen is a preset value, determining the initial screen detection image as the screen detection image; when it is determined that the angle between the shooting camera and the special-shaped screen is a preset value, performing trapezoidal correction on the initial screen detection image to obtain a screen detection image.
[0081] It should be noted that the shooting camera refers to an industrial camera used to shoot the special-shaped screen of a mobile phone, and the preset value may be 90 degrees.
[0082] It can be understood that if the shooting camera is not perpendicular to the special-shaped screen (that is, the angle between the shooting camera and the special-shaped screen is less than 90 degrees), it is necessary to perform trapezoidal correction on the initial screen detection image obtained (because the shooting camera is not perpendicular to the special-shaped screen, the initial screen detection image obtained is distorted, so it needs to be adjusted through trapezoidal correction). If the shooting camera is perpendicular to the special-shaped screen (that is, the angle between the shooting camera and the special-shaped screen is less than 90 degrees), the initial screen detection image can be directly determined as the screen detection image without trapezoidal correction.
[0083] Step S20, screening out the screen area of the screen detection image, and extracting the outer contour of the screen area;
[0084] In a specific implementation, the screen detection image may be binarized, and then the screen area in the screen detection image may be screened out based on the binarization result, and then the outer contour of the special-shaped screen may be extracted from the screen area.
[0085] It should be noted that the outer contour of the screen area is composed of pixel points on the boundary of the screen area.
[0086] Step S30, dividing the outer contour into straight line segments and curved line segments;
[0087] In a feasible implementation, the step of dividing the outer contour into straight line segments and curved line segments includes: determining a contour linked list of the outer contour, wherein the contour linked list is obtained by sequentially connecting all pixel points on the outer contour; determining a contour inflection point of the outer contour according to the contour linked list; and dividing the outer contour into straight line segments and curved line segments according to the contour inflection point.
[0088] It should be noted that the contour inflection point refers to the point on the outer contour chain list where the curvature changes. The contour inflection point on the outer contour can be determined by calculating the first-order derivative and the second-order derivative of the contour chain list. These contour inflection points can then be used to divide the outer contour into multiple straight line segments and multiple curved segments (the curved segments here are arc segments).
[0089] In the specific implementation, Figure 3 A schematic diagram of the contour inflection points of the water drop screen is shown, where straight line segments or curve segments are formed between the contour inflection points.
[0090] In a feasible implementation, the step of dividing the outer contour into straight line segments and curve segments according to the contour inflection point includes: determining a contour linked list of the outer contour, wherein the contour linked list is obtained by sequentially connecting all pixel points on the outer contour; determining the contour inflection point of the outer contour according to the contour linked list; dividing the outer contour into initial straight line segments and initial curve segments according to the contour inflection point; fitting the pixel point data corresponding to the initial straight line segments into straight line segments by the least squares method, and fitting the pixel point data corresponding to the initial curve segments into curve segments by the least squares method.
[0091] It should be noted that the outer contour can be preliminarily divided into initial straight line segments and initial curve segments through the contour inflection points, and then the pixel point data corresponding to the initial curve segments and the initial straight line segments are fitted into straight line segments and curve segments through the least squares method. The curve segments after fitting are standard arc segments.
[0092] Step S40, generating a rectangular boundary area based on the straight line segment and the curve segment;
[0093] It can be understood that since the outer contour is divided into multiple straight line segments and multiple curved segments, each curved segment and each straight line segment will generate a corresponding rectangular area. In order to improve the detection efficiency of defect detection, the rectangular areas and rectangular detection areas can be connected end to end in sequence to obtain a rectangular boundary area. Finally, the defects on the boundary of the special-shaped screen can be detected based on the rectangular boundary area.
[0094] In a feasible implementation, the step of generating a rectangular boundary area based on the straight line segment and the curve segment includes: determining a detection step; generating a rectangular detection area based on the straight line segment and the detection step; generating a sector-shaped detection area based on the curve segment and the detection step; converting the sector-shaped detection area into a target rectangular detection area through polar coordinate transformation; connecting the target rectangular detection area and the rectangular detection area end to end according to a positional relationship to obtain a rectangular boundary area.
[0095] It should be noted that the detection step size can be set according to the screen type; Figure 4 As shown, Figure 4 The fan-shaped area in the upper left corner is the fan-shaped detection area generated according to the curve segment (i.e., arc segment) and the detection step length; Figure 5 The top rectangle is the rectangular detection area generated based on the straight line segment and the detection step size.
[0096] It can be understood that since the sector-shaped detection area corresponding to the curve segment (arc segment) is not a rectangle, it is necessary to continue to process the sector-shaped detection area, such as converting the sector-shaped detection area into a rectangular area (i.e., the target rectangular detection area) through polar coordinate transformation, and finally obtaining the target rectangular detection area corresponding to each curve segment in the outer contour and the rectangular detection area corresponding to each straight line segment. Because the sector-shaped detection area and the rectangular detection area are both generated by the detection step, the rectangular area obtained after the polar coordinate transformation of the sector-shaped detection area is the same as one of the sides of the rectangular detection area. In order to improve the detection efficiency of defect detection, the target rectangular detection area and the rectangular detection area generated by these curve segments and straight line segments can be connected into a rectangular boundary area. Finally, the defects of the special-shaped screen on the boundary are detected based on the rectangular boundary area.
[0097] In the specific implementation, Figure 6 As shown, the end-to-end splicing is to splice the rectangle A after the polar coordinate conversion of the sector-shaped detection area with the rectangle B corresponding to the rectangular detection area. The rectangular areas obtained by polar coordinate conversion of all sector-shaped detection areas are spliced end-to-end with the rectangular detection areas according to the position relationship to obtain the rectangular boundary area.
[0098] Step S50, performing defect detection on the rectangular boundary area to obtain defect detection information, and mapping the defect detection information to the screen detection image to complete defect detection of the special-shaped screen.
[0099] It should be noted that a defect detection algorithm based on a rectangular frame is used for defect detection in the rectangular boundary area, so that the rectangular boundary area can be completely framed within the rectangular frame for defect detection. Finally, the defect detection results obtained after defect detection are mapped to the screen detection image, and finally the defect detection of the special-shaped screen is completed.
[0100] In a feasible implementation manner, the step of performing defect detection on the rectangular boundary area and obtaining defect detection information includes: determining the middle area based on the screen area and the rectangular detection area; filtering the rectangular boundary area and the middle area respectively to obtain a target rectangular boundary area and a target middle area; performing defect segmentation on the target rectangular boundary area and the target middle defect respectively to obtain defect detection information.
[0101] It should be noted that if Figure 7 As shown, the outer solid line outline represents the outer outline of the special-shaped screen (the area contained by the outer solid line is the screen area), the area contained by the dotted rectangle is the middle area, and the area contained by the inner solid line outline is the screen area minus the fan-shaped detection area and the rectangular detection area. Since the inner solid line outline is not a rectangle, the middle area with a rectangular shape can be obtained by expanding outward on the basis of the inner solid line outline (that is, the rectangle represented by the dotted line in the figure). The defect segmentation can be performed after filtering the rectangular boundary area and the middle area respectively, and finally the defect detection information can be obtained after the defect features are screened.
[0102] In this embodiment, the annular boundary area of the special-shaped screen can be converted into a rectangular boundary area, which can prevent the defect on the boundary of the special-shaped screen from being difficult to detect by the rectangle-based defect detection method due to the boundary defect of the special-shaped screen being adhered to the screen background.
[0103] This embodiment acquires a screen detection image of a special-shaped screen; screens out a screen area of the screen detection image and extracts an outer contour of the screen area; divides the outer contour into straight line segments and curved line segments; generates a rectangular boundary area based on the straight line segments and the curved line segments; performs defect detection on the rectangular boundary area to obtain defect detection information, and maps the defect detection information to the screen detection image to complete defect detection of the special-shaped screen, thereby solving the technical problem that the defect detection method based on a rectangle is difficult to detect defects on the boundary of the special-shaped screen because the boundary defects of the special-shaped screen are adhered to the screen background. Compared with the prior art, the present application first divides the outer contour of the special-shaped screen area into straight line segments and curved line segments, and then generates a rectangular boundary area for representing the boundary area of the special-shaped screen according to the straight line segments and the curved line segments, and then performs defect detection on the rectangular boundary area and maps the defect detection result to the screen detection image to complete the defect detection of the special-shaped screen. This can avoid detecting the boundary defects of the special-shaped screen together with the screen background when detecting the boundary defects of the special-shaped screen based on the defect detection of the rectangular frame, and thus effectively prevent the defect detection results of the special-shaped screen from being affected by the low contrast between the boundary defects of the special-shaped screen and the screen background, thereby effectively improving the accuracy of the defect results of the special-shaped screen.
[0104] Based on the first embodiment of the present application, in the second embodiment of the present application, the same or similar contents as those in the above-mentioned embodiment 1 can refer to the above introduction, and will not be repeated later. Figure 8 , step S30 also includes steps S301 to S303:
[0105] Step S301, performing polygon fitting on the outer contour to obtain a target polygon;
[0106] It should be noted that if Fig. 9 As shown in the figure, a polygon fitting method (Douglas-Peucker (DP) approximation algorithm) can be used to fit the outer contour to obtain the target polygon. Specifically, the algorithm first selects the two farthest points from the contour, connects the two points, and then finds a point on the original contour that is farthest from the offline segment, and adds the point to the approximated new contour. The algorithm iterates repeatedly, continuously adding the farthest point to the result until the shortest distance from all points to the polygon is less than the precision specified by the parameter parameter. From this, it can be seen that it is more appropriate to set the precision to a fraction of the value representing the total length of the contour, such as the contour perimeter or the perimeter of the outer rectangle.
[0107] Step S302, when the length of the target edge in the target polygon is less than a length threshold and the angle between the target edge and an adjacent edge is greater than an angle threshold, determining that the target edge is a curved edge, and determining a curved segment based on all curved edges of the target polygon;
[0108] It should be noted that the adjacent edges refer to two edges adjacent to the target edge; the length threshold and the angle threshold can be set in advance.
[0109] Step S303: When the length of the target edge in the target polygon is greater than the length threshold and the angle between the target edge and the adjacent edge is greater than the angle threshold, determine that the target edge is a straight line segment.
[0110] In the specific implementation, the length and angle of each edge of the target polygon are analyzed:
[0111] 1) If the length of a certain edge L(i) of the target polygon is less than the length threshold TL, and the angle difference between its other two adjacent edges L(i-1) and L(i+1) is greater than the angle threshold Tθ, then the edge length L(i) is determined to be a curved edge.
[0112] 2) If the length of a side L(i) of the polygon is not less than the length threshold TL, and the angle difference between it and the other two adjacent sides L(i-1) and L(i+1) is greater than the angle threshold Tθ, then the side length L(i) is determined to be a straight line segment.
[0113] It should be noted that all curve edges S (L1, L2, L3...) of the outer contour of the screen are clustered based on positions to obtain curve segments.
[0114] In a feasible implementation, the step of generating a rectangular boundary area based on the straight line segment and the curved line segment includes: determining the height of the line segment normal vector of the straight line segment; determining a rectangular detection area based on the straight line segment and the line segment normal vector height; obtaining all contour points on the curved line segment and determining the number of contour points; determining the normal direction of each contour point; determining a target rectangular detection area based on the number of contour points and the line segment normal vector height, so as to copy the pixels of each contour point to the target rectangular detection area in sequence along the normal direction, and store the coordinates and normal direction of each contour point; and connecting the target rectangular detection area and the rectangular detection area end to end according to the positional relationship to obtain a rectangular boundary area.
[0115] It should be noted that the method of obtaining a rectangular detection area through a straight line segment is as follows: Fig.10 As shown, given a line segment, the corresponding rectangle is obtained by setting the height of the line segment normal vector, and the image within the original rectangle is extracted.
[0116] It should be noted that the method of obtaining the target rectangular detection area through the curve segment is: obtain all the contour points on the curve segment, such as Fig.11As shown, the tangent direction and normal direction of each contour point are calculated; a new rectangular image is set, the number of contour points of the curve segment is used as the width of the rectangular image, and the height of the line segment normal vector is used as the height, and each contour point is copied one by one along the normal vector to the rectangular image, and the coordinates and normal vector direction of each contour point are stored as a mapping matrix. Later, the detected defect information is mapped back to the original image through inverse operation.
[0117] This embodiment obtains a target polygon by performing polygon fitting on the outer contour; when the length of the target side in the target polygon is less than a length threshold and the angle between the target side and the adjacent side is greater than an angle threshold, the target side is determined to be a curved side, and a curved segment is determined based on all the curved sides of the target polygon; when the length of the target side in the target polygon is greater than the length threshold and the angle between the target side and the adjacent side is greater than the angle threshold, the target side is determined to be a straight line segment. In the above manner, the outer contour of the special-shaped screen can be quickly cut into straight line segments and curved line segments.
[0118] It should be noted that the above examples are only used to understand the present application and do not constitute a limitation on the method for detecting defects in special-shaped screens of the present application. More simple transformations based on this technical concept are all within the scope of protection of the present application.
[0119] This application also provides a device for detecting irregular screen defects. Fig.12 , the special-shaped screen defect detection device comprises:
[0120] An acquisition module 10 is used to acquire a screen detection image of a special-shaped screen;
[0121] A screening module 20, used for screening out the screen area of the screen detection image and extracting the outer contour of the screen area;
[0122] A segmentation module 30, used for segmenting the outer contour into straight line segments and curved line segments;
[0123] A generating module 40, configured to generate a rectangular boundary region based on the straight line segment and the curved line segment;
[0124] The detection module 50 is used to perform defect detection on the rectangular boundary area, obtain defect detection information, and map the defect detection information to the screen detection image to complete defect detection of the special-shaped screen.
[0125] The shaped screen defect detection device provided by the present application adopts the shaped screen defect detection method in the above embodiment, which can solve the technical problem that the defect detection method based on rectangles is difficult to detect the defect on the boundary of the shaped screen because the boundary defect of the shaped screen is adhered to the screen background. Compared with the prior art, the beneficial effects of the shaped screen defect detection device provided by the present application are the same as the beneficial effects of the shaped screen defect detection method provided by the above embodiment, and the other technical features of the shaped screen defect detection device are the same as the features disclosed in the above embodiment method, which will not be repeated here.
[0126] The present application provides a device for detecting defects in a special-shaped screen, which includes: at least one processor; and a memory that is communicatively connected to the at least one processor; wherein the memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can execute the method for detecting defects in the special-shaped screen in the above-mentioned embodiment one.
[0127] Reference below Fig.13 , which shows a schematic diagram of the structure of a device for detecting defects in a special-shaped screen suitable for implementing the embodiment of the present application. The device for detecting defects in a special-shaped screen in the embodiment of the present application may include but is not limited to mobile terminals such as mobile phones, laptop computers, digital broadcast receivers, PDAs (Personal Digital Assistants), PADs (Portable Application Descriptions), PMPs (Portable Media Players), vehicle-mounted terminals (such as vehicle-mounted navigation terminals), etc., and fixed terminals such as digital TVs, desktop computers, etc. Fig.13 The special-shaped screen defect detection device shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present application.
[0128] like Fig.13As shown, the special-shaped screen defect detection device may include a processing device 1001 (such as a central processing unit, a graphics processor, etc.), which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM: Read Only Memory) 1002 or a program loaded from a storage device 1003 to a random access memory (RAM: Random Access Memory) 1004. In RAM1004, various programs and data required for the operation of the special-shaped screen defect detection device are also stored. The processing device 1001, ROM1002 and RAM1004 are connected to each other through a bus 1005. An input / output (I / O) interface 1006 is also connected to the bus. Typically, the following systems can be connected to the I / O interface 1006: input devices 1007 including, for example, a touch screen, a touchpad, a keyboard, a mouse, an image sensor, a microphone, an accelerometer, a gyroscope, etc.; output devices 1008 including, for example, a liquid crystal display (LCD), a speaker, a vibrator, etc.; storage devices 1003 including, for example, a magnetic tape, a hard disk, etc.; and communication devices 1009. The communication device 1009 can allow the special-shaped screen defect detection device to communicate with other devices wirelessly or by wire to exchange data. Although the figure shows a special-shaped screen defect detection device with various systems, it should be understood that it is not required to implement or have all the systems shown. More or fewer systems may be implemented or have alternatively.
[0129] In particular, according to the embodiments disclosed in the present application, the process described above with reference to the flowchart can be implemented as a computer software program. For example, the embodiments disclosed in the present application include a computer program product, which includes a computer program carried on a computer-readable medium, and the computer program includes a program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from a network through a communication device, or installed from a storage device 1003, or installed from a ROM 1002. When the computer program is executed by the processing device 1001, the above-mentioned functions defined in the method of the embodiment disclosed in the present application are executed.
[0130] The special-shaped screen defect detection device provided by the present application adopts the special-shaped screen defect detection method in the above embodiment, which can solve the technical problem that the defect detection method based on rectangles is difficult to detect the defect on the boundary of the special-shaped screen because the boundary defect of the special-shaped screen is adhered to the screen background. Compared with the prior art, the beneficial effects of the special-shaped screen defect detection device provided by the present application are the same as the beneficial effects of the special-shaped screen defect detection method provided by the above embodiment, and the other technical features of the special-shaped screen defect detection device are the same as the features disclosed in the method of the previous embodiment, which will not be repeated here.
[0131] It should be understood that the various parts disclosed in this application can be implemented by hardware, software, firmware or a combination thereof. In the description of the above embodiments, specific features, structures, materials or characteristics can be combined in any one or more embodiments or examples in a suitable manner.
[0132] The above is only a specific implementation of the present application, but the protection scope of the present application is not limited thereto. Any person skilled in the art who is familiar with the present technical field can easily think of changes or substitutions within the technical scope disclosed in the present application, which should be included in the protection scope of the present application. Therefore, the protection scope of the present application should be based on the protection scope of the claims.
[0133] The present application provides a computer-readable storage medium having computer-readable program instructions (ie, computer programs) stored thereon, and the computer-readable program instructions are used to execute the method for detecting irregular screen defects in the above-mentioned embodiment.
[0134] The computer-readable storage medium provided in the present application may be, for example, a USB flash drive, but is not limited to electrical, magnetic, optical, electromagnetic, infrared, or semiconductor systems, systems or devices, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In this embodiment, the computer-readable storage medium may be any tangible medium containing or storing a program that can be used by or in combination with an instruction execution system, system or device. The program code contained on the computer-readable storage medium may be transmitted using any appropriate medium, including but not limited to: wires, optical cables, RF (Radio Frequency), etc., or any suitable combination of the above.
[0135] The computer-readable storage medium may be included in the special-shaped screen defect detection device; or may exist independently without being assembled into the special-shaped screen defect detection device.
[0136] The above-mentioned computer-readable storage medium carries one or more programs. When the above-mentioned one or more programs are executed by the special-shaped screen defect detection device, the special-shaped screen defect detection device enables the special-shaped screen defect detection device to: obtain a screen detection image of the special-shaped screen; filter out the screen area of the screen detection image, and extract the outer contour of the screen area; divide the outer contour into straight line segments and curve segments; generate a rectangular boundary area based on the straight line segments and the curve segments; perform defect detection on the rectangular boundary area to obtain defect detection information, and map the defect detection information to the screen detection image to complete the defect detection of the special-shaped screen.
[0137] Computer program code for performing the operations of the present application may be written in one or more programming languages or a combination thereof, including object-oriented programming languages such as Java, Smalltalk, C++, and conventional procedural programming languages such as "C" or similar programming languages. The program code may be executed entirely on the user's computer, partially on the user's computer, as a separate software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer through any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computer (e.g., via the Internet using an Internet service provider).
[0138] The flow chart and block diagram in the accompanying drawings illustrate the possible architecture, function and operation of the system, method and computer program product according to various embodiments of the present application. In this regard, each square box in the flow chart or block diagram can represent a module, a program segment or a part of a code, and the module, the program segment or a part of the code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the square box can also occur in a sequence different from that marked in the accompanying drawings. For example, two square boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each square box in the block diagram and / or flow chart, and the combination of the square boxes in the block diagram and / or flow chart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.
[0139] The modules involved in the embodiments described in this application may be implemented by software or hardware, wherein the name of the module does not constitute a limitation on the unit itself in some cases.
[0140] The readable storage medium provided by the present application is a computer-readable storage medium, which stores computer-readable program instructions (i.e., computer programs) for executing the above-mentioned special-shaped screen defect detection method, and can solve the technical problem that the defect detection method based on rectangles is difficult to detect the defect on the boundary of the special-shaped screen due to the adhesion of the boundary defect of the special-shaped screen with the screen background. Compared with the prior art, the beneficial effects of the computer-readable storage medium provided by the present application are the same as the beneficial effects of the special-shaped screen defect detection method provided by the above-mentioned embodiment, and will not be repeated here.
[0141] The present application also provides a computer program product, including a computer program, which implements the steps of the above-mentioned method for detecting defects in special-shaped screens when executed by a processor.
[0142] The computer program product provided by the present application can solve the technical problem that the defect detection method based on rectangles is difficult to detect the defect on the boundary of the irregular screen because the boundary defect of the irregular screen is adhered to the screen background. Compared with the prior art, the beneficial effects of the computer program product provided by the present application are the same as the beneficial effects of the irregular screen defect detection method provided by the above embodiment, and will not be elaborated here.
[0143] The above descriptions are only some embodiments of the present application, and are not intended to limit the patent scope of the present application. All equivalent structural changes made using the contents of the present application specification and drawings under the technical concept of the present application, or direct / indirect applications in other related technical fields are included in the patent protection scope of the present application.
Claims
1. A method for detecting defects in special-shaped screens, characterized in that: The method comprises: Acquire a screen detection image of a special-shaped screen; Screening out a screen area of the screen detection image and extracting an outer contour of the screen area; Cutting the outer contour into straight line segments and curved line segments; Generate a rectangular boundary area based on the straight line segment and the curved line segment; Defect detection is performed on the rectangular boundary area to obtain defect detection information, and the defect detection information is mapped to the screen detection image to complete defect detection of the special-shaped screen.
2. The method according to claim 1, characterized in that The step of obtaining a screen detection image of a special-shaped screen comprises: Acquire an initial screen detection image of the special-shaped screen by shooting a camera; Determine whether the angle between the shooting camera and the special-shaped screen is a preset value; When it is determined that the angle between the shooting camera and the special-shaped screen is a preset value, determining the initial screen detection image as the screen detection image; When it is determined that the angle between the shooting camera and the special-shaped screen is not a preset value, the screen detection image is obtained after performing trapezoidal correction on the initial screen detection image.
3. The method according to claim 1, characterized in that The step of dividing the outer contour into straight line segments and curved line segments comprises: Performing polygon fitting on the outer contour to obtain a target polygon; When the length of a target edge in the target polygon is less than a length threshold and the angle between the target edge and an adjacent edge is greater than an angle threshold, determining that the target edge is a curved edge, and determining a curved segment based on all curved edges of the target polygon; When the length of a target edge in the target polygon is greater than the length threshold and the angle between the target edge and an adjacent edge is greater than the angle threshold, the target edge is determined to be a straight line segment.
4. The method according to claim 3, characterized in that The step of generating a rectangular boundary area based on the straight line segment and the curved line segment comprises: Determine the height of the line segment normal vector of the straight line segment; Determine a rectangular detection area according to the straight line segment and the height of the line segment normal vector; Obtaining all contour points on the curve segment and determining the number of contour points; Determine the normal direction of each contour point; Determine a target rectangular detection area according to the number of contour points and the height of the line segment normal vector, copy the pixels of each contour point to the target rectangular detection area in sequence along the normal direction, and store the coordinates and normal direction of each contour point; The target rectangular detection area and the rectangular detection area are connected end to end according to the position relationship to obtain a rectangular boundary area.
5. The method according to claim 1, characterized in that The step of dividing the outer contour into straight line segments and curved line segments comprises: Determine a contour chain list of the outer contour, wherein the contour chain list is obtained by sequentially connecting all pixel points on the outer contour; Determine the contour inflection point of the outer contour according to the contour chain list; Cutting the outer contour into initial straight line segments and initial curve segments according to the contour inflection points; The pixel point data corresponding to the initial straight line segment is fitted into a straight line segment by using the least square method, and the pixel point data corresponding to the initial curve segment is fitted into a curve segment by using the least square method.
6. The method according to claim 5, characterized in that The step of generating a rectangular boundary area based on the straight line segment and the curved line segment comprises: Determine the detection step size; Based on the straight line segment and the detection step, a rectangular detection area is generated; Based on the curve segment and the detection step, generating a sector-shaped detection area; The sector-shaped detection area is converted into a target rectangular detection area by polar coordinate transformation; The target rectangular detection area and the rectangular detection area are connected end to end according to the position relationship to obtain a rectangular boundary area.
7. The method according to claim 4 or 6, characterized in that The step of performing defect detection on the rectangular boundary area to obtain defect detection information comprises: Determine a middle area based on the screen area and the rectangular detection area; Filtering the rectangular boundary area and the middle area respectively to obtain a target rectangular boundary area and a target middle area; Defect segmentation is performed on the target rectangular boundary area and the target middle defect respectively to obtain defect detection information.
8. A device for detecting defects in special-shaped screens, characterized in that: The device comprises: An acquisition module, used for acquiring a screen detection image of a special-shaped screen; A screening module, used for screening out the screen area of the screen detection image and extracting the outer contour of the screen area; A segmentation module, used for segmenting the outer contour into straight line segments and curved line segments; A generating module, used for generating a rectangular boundary area based on the straight line segment and the curved line segment; The detection module is used to perform defect detection on the rectangular boundary area, obtain defect detection information, and map the defect detection information to the screen detection image to complete defect detection of the special-shaped screen.
9. A device for detecting defects in special-shaped screens, characterized in that: The device comprises: a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the computer program is configured to implement the steps of the method for detecting defects of an irregular screen as claimed in any one of claims 1 to 7.
10. A storage medium, characterized in that: The storage medium is a computer-readable storage medium, and a computer program is stored on the storage medium. When the computer program is executed by a processor, the steps of the method for detecting defects in an irregular screen as described in any one of claims 1 to 7 are implemented.
Citation Information
Cited By
Steel pipe weld defect detection method and system based on machine vision
CN121213499A
Method and system for detecting defects of display screen with arc edge and electronic equipment
CN121213542A
A method, system, and electronic device for detecting defects in a display screen with rounded edges.
CN121213542B