A boundary detection method, device, apparatus and storage medium

By detecting the edge region image of the glass cover and combining it with the height, width and dirt region images, the boundary of the glass cover is accurately extracted, which solves the problems of unstable detection effect and high cost in traditional methods and realizes efficient boundary detection in complex backgrounds.

CN119625005BActive Publication Date: 2026-02-27ZHONGKE HUIYUAN VISUAL TECHNOLOGY (LUOYANG) CO LTD +1
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202411699588.4
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-11-25
Publication Date
2026-02-27
Estimated Expiration
2044-11-25

AI Technical Summary

Technical Problem

Traditional image processing methods are easily affected by noise when detecting the boundaries of glass covers, resulting in unstable detection results and high costs.

Method used

By acquiring the target image of the target device, detecting the edge region image, determining the first target region image based on the edge region image, and determining the second and third target region images by the height and width range, and combining the dirty region image, the boundary of the target component is accurately extracted.

Benefits of technology

It enables accurate extraction of glass cover plate boundaries in complex backgrounds, overcomes background interference, improves detection stability, and reduces costs.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119625005B_ABST
    Figure CN119625005B_ABST
Patent Text Reader

Abstract

The present disclosure provides a boundary detection method, device, equipment and storage medium. The method comprises: obtaining a target image to be detected of a target device, the target image to be detected comprising an image of a target component of the target device; detecting an edge region image in the target image to be detected, and determining a first target region image in the target image to be detected based on the edge region image; determining a second target region image in the target image to be detected based on a height of the first target region image and a height of the target component; extracting a dirty region image corresponding to the target component based on the second target region image; determining a third target region image in the target image to be detected according to the second target region image and a width of the target component; and determining a boundary of the target component in the target image to be detected based on the second target region image, the third target region image and the dirty region image. The method can accurately extract the boundary.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present disclosure relates to the technical field of image processing, and particularly relates to a boundary detection method and device, equipment and a storage medium. BACKGROUND

[0002] As a key component of electronic devices such as smart phones and tablet computers, the quality and processing precision of the glass cover plate will affect the performance and user experience of the electronic device. Therefore, how to detect the boundary of the glass cover plate has become an important part of the production process of the electronic device.

[0003] However, due to the transparent nature of the glass cover plate and the complex background environment, the traditional image processing method is prone to noise interference in a complex background, and has the problems of unstable detection effect and high detection cost. Therefore, how to accurately detect the boundary of the glass cover plate has become a technical problem to be solved. SUMMARY

[0004] The present disclosure provides a boundary detection method, device, equipment and storage medium to at least solve the above technical problems in the prior art.

[0005] According to a first aspect of the present disclosure, a boundary detection method is provided, the method comprising:

[0006] obtaining a target image to be detected of a target device, the target image to be detected comprising an image of a target component of the target device;

[0007] detecting an edge region image in the target image to be detected, and determining a first target region image in the target image to be detected based on the edge region image;

[0008] determining a second target region image in the target image to be detected based on a height of the first target region image and a height of the target component;

[0009] extracting a dirty region image corresponding to the target component based on the second target region image;

[0010] determining a third target region image in the target image to be detected according to the second target region image and a width of the target component;

[0011] determining a boundary of the target component in the target image to be detected based on the second target region image, the third target region image and the dirty region image.

[0012] In an implementation manner, the determining the first target region image in the target image to be detected based on the edge region image comprises:

[0013] resetting pixel values of the pixels in the edge region image to 0 to obtain a reset image;

[0014] performing normalization processing on the reset image to obtain a normalized image;

[0015] removing an interference region of the normalized image to obtain a first target region image in the target image to be detected.

[0016] In an implementation, the removing of the interference region of the normalized image to obtain the first target region image in the target image to be detected includes:

[0017] determining an initial target region image in the normalized image;

[0018] performing an opening operation on the initial target region image to obtain a processed image as the first target region image in the target image to be detected.

[0019] In an implementation, the performing of the opening operation on the initial target region image to obtain the processed image as the first target region image in the target image to be detected includes:

[0020] performing erosion processing on the initial target region image using a preset structure element to obtain an eroded image;

[0021] performing dilation processing on the eroded image using the preset structure element to obtain a dilated image as the first target region image in the target image to be detected.

[0022] In an implementation, the determining of the second target region image in the target image to be detected based on the height of the first target region image and the height of the target component includes:

[0023] determining a target height range according to the height of the first target region image and the height of the target component;

[0024] extracting a target component region image in the target image to be detected;

[0025] determining whether a height of the target component region image belongs to the target height range;

[0026] if yes, determining the target component region image as the second target region image in the target image to be detected.

[0027] In an implementation, the extracting of a dirty region image corresponding to a target component based on the second target region image includes:

[0028] performing filling processing on the second target region image to obtain a filled image;

[0029] extracting a first filled sub-region image with a gray value less than a first preset gray threshold from the filled image;

[0030] determining an intersection region image of the first filled sub-region image and the filled image as a dirty region image corresponding to the target component.

[0031] In an implementation manner, the third target region image in the target image to be detected is determined according to the second target region image and the width of the target component, including:

[0032] performing filling processing on the second target region image to obtain a filled image;

[0033] extracting a second filled sub-region image with a gray value less than a second preset gray threshold from the filled image;

[0034] performing open operation processing on the second filled sub-region image to obtain a processed image;

[0035] determining a target width range according to the width of the processed image and the width of the target component;

[0036] extracting a target component region image in the target image to be detected;

[0037] determining whether the height of the target component region image belongs to the target width range;

[0038] if yes, determining the target component region image as the third target region image in the target image to be detected.

[0039] In an implementation manner, the boundary of the target component in the target image to be detected is determined based on the second target region image, the third target region image and the dirty region image, including:

[0040] determining a union image of the second target region image, the third target region image and the dirty region image;

[0041] performing region filling on the union image to obtain a filled image;

[0042] determining the boundary of the target component in the target image to be detected based on the filled image.

[0043] In an implementation manner, the boundary of the target component in the target image to be detected is determined based on the filled image, including:

[0044] performing an open operation on the filled image to obtain a first processed image;

[0045] performing a close operation on the first processed image to obtain a second processed image;

[0046] extracting edge pixel points of the second processed image;

[0047] determining a boundary contour line based on the edge pixel points as a boundary of the target component.

[0048] In an implementation, the determining a boundary contour line based on the edge pixel points as a boundary of the target component comprises:

[0049] fitting a boundary contour line based on the edge pixel points as a boundary of the target component.

[0050] In an implementation, the target component comprises a glass cover plate of the target device.

[0051] According to a second aspect of the present disclosure, there is provided a boundary detection apparatus, the apparatus comprising:

[0052] an image acquisition module configured to acquire a target image of a target device to be detected, the target image comprising an image of a target component of the target device;

[0053] a first region determination module configured to detect an edge region image in the target image to be detected, and determine a first target region image in the target image to be detected based on the edge region image;

[0054] a second region determination module configured to determine a second target region image in the target image to be detected based on a height of the first target region image and a height of the target component;

[0055] a dirty region determination module configured to extract a dirty region image corresponding to the target component based on the second target region image;

[0056] a third region determination module configured to determine a third target region image in the target image to be detected according to the second target region image and a width of the target component;

[0057] a boundary determination module configured to determine a boundary of the target component in the target image to be detected based on the second target region image, the third target region image and the dirty region image.

[0058] In an implementation, the first region determining module is specifically configured to reset pixel values of pixel points of the edge region image to 0 to obtain a reset image; perform normalization processing on the reset image to obtain a normalized image; and remove an interference region of the normalized image to obtain a first target region image in the target image to be detected.

[0059] In an implementation, the first region determining module is specifically configured to determine an initial target region image in the normalized image; and perform open operation processing on the initial target region image to obtain a processed image as the first target region image in the target image to be detected.

[0060] In an implementation, the first region determining module is specifically configured to perform erosion processing on the initial target region image by using a preset structure element to obtain an eroded image; perform inflation processing on the eroded image by using the preset structure element to obtain an inflated image as the first target region image in the target image to be detected.

[0061] In an implementation, the first region determining module is specifically configured to determine a target height range according to a height of the first target region image and a height of the target component; extract a target component region image in the target image to be detected; determine whether a height of the target component region image belongs to the target height range; and if so, determine the target component region image as a second target region image in the target image to be detected.

[0062] In an implementation, the dirty region determining module is specifically configured to perform filling processing on the second target region image to obtain a filled image; extract a first filled sub-region image with a gray value less than a first preset gray threshold from the filled image; and determine an intersection region image of the first filled sub-region image and the filled image as a dirty region image corresponding to the target component.

[0063] In an implementation, the third region determining module is specifically configured to perform filling processing on the second target region image to obtain a filled image; extract a second filled sub-region image with a gray value less than a second preset gray threshold from the filled image; perform open operation processing on the second filled sub-region image to obtain a processed image; determine a target width range according to a width of the processed image and a width of the target component; extract a target component region image in the target image to be detected; determine whether a height of the target component region image belongs to the target width range; and if so, determine the target component region image as a third target region image in the target image to be detected.

[0064] The boundary detection method, device, equipment and storage medium provided by the present disclosure, by acquiring a target image to be detected of a target device, the target image to be detected including an image of a target component of the target device; detecting an edge region image in the target image to be detected, and determining a first target region image in the target image to be detected based on the edge region image; determining a second target region image in the target image to be detected based on a height of the first target region image and a height of the target component; extracting a dirty region image corresponding to the target component based on the second target region image; determining a third target region image in the target image to be detected according to the second target region image and a width of the target component; and determining a boundary of the target component in the target image to be detected based on the second target region image, the third target region image and the dirty region image. That is, by detecting the edge region image and determining the accurate range corresponding to the target component according to the height and width of the target component, and considering the dirty region of the target component, the background interference of the target component is overcome, and the accurate extraction of the boundary is realized.

[0065] It should be understood that the content described in this part is not intended to identify key or important features of the embodiments of the present disclosure, nor is it used to limit the scope of the present disclosure. Other features of the present disclosure will become apparent from the following description. BRIEF DESCRIPTION OF DRAWINGS

[0066] The above and other objects, features and advantages of the exemplary embodiments of the present disclosure will be more apparent from the following detailed description taken in conjunction with the accompanying drawings, in which:

[0067] In the drawings, identical or corresponding reference signs refer to identical or corresponding parts.

[0068] Figure 1 Fig. 1 shows a flow diagram of a boundary detection method provided by an embodiment of the present disclosure;

[0069] Figure 2 Fig. 2 shows a target image to be detected of a target device provided by an embodiment of the present disclosure;

[0070] Figure 3 Fig. 3 shows an edge region image of a target image to be detected of a target device provided by an embodiment of the present disclosure;

[0071] Figure 4 Fig. 4 shows a first target region image determination flowchart provided by an embodiment of the present disclosure;

[0072] Figure 5 Fig. 5 shows a second target region image in the target image to be detected provided by an embodiment of the present disclosure;

[0073] Figure 6A third target region image in the target image to be detected is shown.

[0074] Figure 7 Another third target region image in the target image to be detected is shown.

[0075] Figure 8 A boundary diagram of a target component in the target image to be detected of the target device is shown.

[0076] Figure 9 Each part image of a target component in the target image to be detected of the target device in the embodiment of the present disclosure is shown.

[0077] Figure 10 A boundary image of a target component in the target image to be detected of the target device in the embodiment of the present disclosure is shown.

[0078] Figure 11 A structural diagram of the boundary detection device provided by the embodiment of the present disclosure is shown.

[0079] Figure 12 A structural diagram of an electronic device provided by the embodiment of the present disclosure is shown. DETAILED DESCRIPTION

[0080] In order to make the objectives, characteristics and advantages of the present disclosure more obvious and easy to understand, the technical solutions in the embodiments of the present disclosure will be described clearly and completely below with reference to the drawings in the embodiments of the present disclosure. Obviously, the described embodiments are only part of the embodiments of the present disclosure, rather than all the embodiments. Based on the embodiments in the present disclosure, all other embodiments obtained by those skilled in the art without creative labor are within the scope of protection of the present disclosure.

[0081] Since the current glass cover plate boundary detection is easily affected by the transparent characteristics of the glass cover plate and the complex background environment, resulting in unstable detection effect and high detection cost, in order to accurately detect the boundary of the glass cover plate, the present disclosure provides a boundary detection method, device, equipment and storage medium. The boundary detection method provided by the present disclosure can be applied to any electronic device that can perform image processing, including but not limited to computers, mobile phones, tablets and the like.

[0082] The technical solutions of the embodiments of the present disclosure will be described below with reference to the drawings in the embodiments of the present disclosure.

[0083] Figure 1 A flowchart of the boundary detection method provided by the embodiment of the present disclosure is shown, as shown in Figure 1 The method comprises:

[0084] S101, acquire a target image to be detected of a target device.

[0085] In the present disclosure, the target image to be detected includes an image of a target component of the target device.

[0086] In the present disclosure, an appearance image of the target device can be collected by an image collection device. The target device can be an electronic device such as a mobile phone, a computer, and a tablet computer. The target component can be a glass cover plate component covering the screen or camera of the target device. The glass cover plate component can be used to protect the screen and camera of the target device. The image collection device can use a high-precision 2D camera. Figure 2 A target image to be detected of a target device provided by an embodiment of the present disclosure is shown in FIG. 2. Figure 2 As shown in FIG. 2, the target device is a mobile phone, and a high-precision 2D camera can be used to shoot an appearance image of the mobile phone including the screen of the mobile phone to obtain a target image to be detected 200. The target image to be detected 200 includes a glass cover plate region image 201 of the mobile phone.

[0087] S102, detect an edge region image in the target image to be detected, and determine a first target region image in the target image to be detected based on the edge region image.

[0088] In the present disclosure, an edge detection operator can be used to extract the edge region image in the target image to be detected. The edge detection operator can include a Canny operator and a Sobel operator, etc. For example, the edge detection operator can be used to perform grayscale processing on the target image to be detected to obtain a corresponding grayscale image. A first gradient image is obtained by performing horizontal convolution processing on the grayscale image, and a second gradient image is obtained by performing vertical convolution processing on the grayscale image. The amplitude of the first gradient image and the second gradient image is calculated, and the edge region image in the target image to be detected is determined according to the amplitude. The vertical convolution kernel can use convolution kernel A, and the horizontal convolution kernel can use convolution kernel B:

[0089]

[0090] Figure 3 An edge region image of a target image to be detected of a target device provided by an embodiment of the present disclosure is shown in FIG. 3. Figure 3 A part of the edge region image 301 on the left side of the target component in the target image to be detected 200 is shown in FIG. 3. Figure 2

[0091] In one possible implementation, Figure 4 A first target region image determination flowchart provided by an embodiment of the present disclosure is shown in FIG. 4. Figure 4 As shown in FIG. 4, the determination of the first target region image in the target image to be detected based on the edge region image includes:​

[0092] S401, reset the pixel value of the pixel point of the edge region image to 0 to obtain a reset image.

[0093] In the present disclosure, in order to distinguish the edge region and the target component region, the pixel value of the pixel point of the edge region image can be reset to 0. For example, Figure 3 For example, Figure 3 The edge region image 301 of the glass cover plate of the mobile phone is shown, in order to make the glass cover plate region and the edge region more distinct, the pixel value of all pixel points in the edge region image 301 can be reset to 0.

[0094] S402, normalizing the reset image to obtain a normalized image.

[0095] In the present disclosure, in order to further distinguish the image of the target component region from the edge, the reset image can be normalized, specifically, the pixel value of the pixel point in the reset image within a preset pixel range can be mapped to [0, 255], and the pixel value of the pixel point in the reset image not within the preset pixel range can be reset to 255, so as to realize the distinct gray value of the target component inside and the edge region. The preset pixel range can be a range [Min, Max] composed of a first preset minimum pixel threshold Min and a first preset maximum pixel threshold Max, the first preset minimum pixel threshold Min and the first preset maximum pixel threshold Max can be set according to the actual application scenario, for example, the first preset minimum pixel threshold can be set to 0 or 10, and the first preset maximum pixel threshold can be set to 200 or 255.

[0096] S403, eliminating the interference region of the normalized image to obtain a first target region image in the target image to be detected.

[0097] In one possible implementation, the eliminating the interference region of the normalized image to obtain a first target region image in the target image to be detected can include steps A1-A2:

[0098] Step A1, determining an initial target region image in the normalized image.

[0099] In the present disclosure, the pixel range composed of the second preset minimum pixel threshold and the second preset maximum pixel threshold can be used to screen the pixel points from the normalized image. Specifically, the pixel points with pixel values greater than or equal to the second preset minimum pixel threshold and less than or equal to the second preset maximum pixel threshold in the normalized image can be screened. The region composed of the screened pixel points is the initial target region image, which represents the region where the target component is located. The second preset minimum pixel threshold and the second preset maximum pixel threshold can be set according to the actual application scenario. For example, the second preset minimum pixel threshold can be set to 200, and the second preset maximum pixel threshold can be set to 255, or the second preset minimum pixel threshold can be set to 190, and the second preset maximum pixel threshold can be set to 250.

[0100] Step A2, performing an opening operation on the initial target region image to obtain a processed image as the first target region image in the target image to be detected.

[0101] In the present disclosure, the initial target region image can be subjected to erosion processing and dilation processing to obtain a processed image as the first target region image in the target image to be detected.

[0102] In one possible implementation, the opening operation on the initial target region image to obtain a processed image as the first target region image in the target image to be detected can include steps B1-B2:

[0103] Step B1, performing erosion processing on the initial target region image using a preset structure element to obtain an eroded image.

[0104] In the present disclosure, the preset structure element can be a pre-set binary matrix used to define the shape and size of the neighborhood in the erosion process. The shape of the preset structure element can be set to a rectangle or a circle, etc. For example, the preset structure element can be set to a 2x2 rectangular structure element B:

[0105]

[0106] Each element in a 2x2 rectangular structuring element B corresponds to one pixel. This 2x2 rectangular structuring element B can be used to erode the initial target region image. Specifically, an origin can be defined in the rectangular structuring element B. For example, the element in the first row and first column of the rectangular structuring element B can be defined as the origin. The rectangular structuring element B traverses the initial target region image with a preset step size. When the origin of the rectangular structuring element B is translated to pixel (x, y) of the initial target region image, if the pixel value corresponding to the element with a value of 1 in the rectangular structuring element B at pixel (x, y) is also 1, then the pixel value at pixel (x, y) is reset to 1; otherwise, the pixel value at pixel (x, y) is reset to 0. After traversing the initial target region image using the preset structuring element, the erosion process of the initial target region image is completed. This erosion process can shrink the boundary of the initial target region image and eliminate small and meaningless targets. The preset step size can be set to one pixel or two pixel distances.

[0107] Step B2: The eroded image is dilated using the preset structuring element to obtain the dilated image as the first target region image in the target image to be detected.

[0108] The pre-defined structural element is used to dilate the eroded image. Specifically, a 2x2 rectangular structural element B can be used as an example to dilate the eroded image. Specifically, an origin can be defined in the rectangular structural element B; for example, the element in the first row and second column of the rectangular structural element B can be defined as the origin. The rectangular structural element B traverses the eroded image with a pre-defined step size. When the origin of the rectangular structural element B is translated to pixel (x', y') of the eroded image, if at least one element in the rectangular structural element B with a value of 1 also corresponds to a pixel with a value of 1 at pixel (x', y'), then the pixel value at pixel (x, y) is reset to 1; otherwise, the pixel value at pixel (x, y) is reset to 0. After traversing the eroded image using the pre-defined structural element, the dilation process of the initial target region image is completed. Through the dilation process, the background points in the eroded image that come into contact with each other can be merged into the target component region, thus expanding the boundary of the target component region outward. By filling in certain holes in the area where the target component is located and eliminating small particle noise contained in the area where the target component is located, the resulting first target area image can be free of interfering factors.

[0109] S103, based on the height of the first target region image and the height of the target component, determine the second target region image in the target image to be detected.

[0110] In a possible implementation, the determining the second target region image in the target image to be detected based on the height of the first target region image and the height of the target component can include steps C1-C4.

[0111] Step C1, determining a target height range according to the height of the first target region image and the height of the target component.

[0112] In the present disclosure, a ratio between the height of the target component and the height of the first target region image can be calculated, and the target height range can be determined according to the ratio. For example, if the height of the first target region image is H, and the ratio between the height of the target component and the height of the first target region image is 0.6, the target height range can be set as [0.5H, 0.9H], and if the ratio between the height of the target component and the height of the first target region image is 0.5, the target height range can be set as [0.4H, 0.9H].

[0113] Step C2, extracting a target component region image in the target image to be detected.

[0114] Step C3, determining whether the height of the target component region image belongs to the target height range.

[0115] Step C4, if yes, determining the target component region image as the second target region image in the target image to be detected.

[0116] The component region of the target device in the target image to be detected can be detected, and if there is a component region with a height in the target height range, the component region image can be determined as the target component region image. Taking the glass cover plate of the target device as an example, Figure 5 a second target region image in the target image to be detected provided by an embodiment of the present disclosure is shown, as shown in Figure 5 As shown in the figure, a mobile phone glass cover plate region image 501 with a height belonging to the target height range is detected in the target image to be detected.

[0117] S104, extracting a dirty region image corresponding to the target component based on the second target region image.

[0118] In the present disclosure, since the dirty pollution with a deep color on the target component can be removed as an interference factor, which can affect the integrity of the target component region, the dirty region on the target component can be processed separately to obtain the corresponding dirty region image.

[0119] In the present disclosure, the extracting a dirty region image corresponding to the target component based on the second target region image can include steps D1-D3:

[0120] Step D1, performing filling processing on the second target region image to obtain a filled image.

[0121] Specifically, the second target region image can be converted into a binary image to clearly separate the dirt region image, and then an edge detection algorithm or a contour extraction algorithm is used to extract the contour points of the binary image, the convex hull region of the image is calculated according to the contour points, and the pixel value of the pixel point of the convex hull region is filled with 255 to obtain the filled image. Through the convex hull filling, the shape of the dirt region can be highlighted, thereby improving the accuracy of segmenting the dirt region.

[0122] Step D2, extracting a first filled sub-region image with a gray value less than a first preset gray threshold from the filled image.

[0123] In the present disclosure, the first preset gray threshold can be set according to the actual application scenario, for example, it can be set to 255 or 250, etc.

[0124] The pixel with a gray value less than the first preset gray threshold can represent a darker region in the image, and generally these regions can contain dirt or defects, etc., so the first filled sub-region image can be screened out as a possible dirt region through the first preset gray threshold.

[0125] Step D3, determining the intersection region image of the first filled sub-region image and the filled image as the dirt region image corresponding to the target component.

[0126] By intersecting the first filled sub-region with the filled image, the dirt region inside the target component can be more accurately located, and since only the region that satisfies both the first filled sub-region image and the filled image is retained in the intersection image, it can be ensured that the dirt region obtained is complete and accurate.

[0127] S105, determining a third target region image in the to-be-detected target image according to the second target region image and the width of the target component.

[0128] In one possible implementation, the step of determining a third target region image in the to-be-detected target image according to the second target region image and the width of the target component can include steps E1-E7.

[0129] Step E1, performing filling processing on the second target region image to obtain a filled image.

[0130] This step can refer to step D1, which is not described here.

[0131] Step E2, extracting a second filled sub-region image with a gray value less than a second preset gray threshold value in the filled image.

[0132] In the present disclosure, the second preset gray threshold value can be set according to the actual application scenario, for example, it can be set to 255 or 250, etc.

[0133] The pixel with a gray value less than the second preset gray threshold value can represent a darker region in the image. Taking the glass cover plate of the mobile phone as an example, the dark region with a gray value less than the second preset gray threshold value can be the upper and lower edge regions of the glass cover plate of the mobile phone.

[0134] Step E3, performing an opening operation on the second filled sub-region image to obtain a processed image.

[0135] In the present disclosure, the second filled sub-region can be subjected to an erosion process, and the image after the erosion process can be subjected to a dilation process to obtain a processed image. Through the erosion and dilation processes, the objects or noises in the second filled sub-region image can be removed, and the larger component shape can be retained. Specifically, in the present disclosure, the second filled sub-region image can be subjected to an erosion process using the preset structure element.

[0136] Step E4, determining a target width range according to the width of the processed image and the width of the target component.

[0137] In the present disclosure, the ratio between the width of the target component and the width of the processed image can be calculated, and the target width range can be determined according to the ratio. For example, the width of the first target region image is W, if the ratio between the width of the target component and the width of the processed image is 0.6, the target width range can be set as [0.5W, 0.8W], if the ratio between the height of the target component and the width of the processed image is 0.5, the target width range can be set as [0.4W, 0.9W].

[0138] Step E5, extracting a target component region image in the to-be-detected target image.

[0139] Step E6, determining whether the height of the target component region image belongs to the target width range.

[0140] Step E7, if yes, determining the target component region image as a third target region image in the to-be-detected target image.

[0141] In the present disclosure, the component region of the target device in the to-be-detected target image can be detected, if there is a component region with a width within the target width range, the component region image can be determined as a third target region image, and the third target region image can be used as a supplementary region image of the target component.

[0142] If the target device is a mobile phone and the target component is a glass cover plate, the pixel values of the upper and lower parts of the glass cover plate are deep colors, so the upper and lower cover plate regions cannot be included in the extracted cover plate region image. In the present disclosure, the upper and lower cover plate regions can be screened out by the target width range, and the upper and lower cover plate regions are taken as the supplementary region images of the glass cover plate, so that the glass cover plate region image can be extracted more accurately. Figure 6 and Figure 7 For example, Figure 6 shows a third target region image in the target image to be detected provided by an embodiment of the present disclosure, Figure 7 shows another third target region image in the target image to be detected provided by an embodiment of the present disclosure, as shown in Figure 6 As shown in the target image to be detected, a mobile phone glass cover plate region image 601 with a width belonging to the target width range is detected, and the glass cover plate region image 601 is the upper cover plate region of the glass cover plate, as shown in Figure 7 As shown in the target image to be detected, a mobile phone glass cover plate region image 701 with a width belonging to the target width range is also detected, and the glass cover plate region image 701 is the lower cover plate region of the glass cover plate. The glass cover plate region image 601 and the glass cover plate region image 701 can be taken as the supplementary region images of the mobile phone glass cover plate region image 501 as shown. Figure 5

[0143] In the present disclosure, the target width range is determined by the width of the processed image and the width of the target component, the third target region image in the target image to be detected is determined based on the target width range as the supplementary region image of the target component, and the region image of the target component can be more accurately determined based on the supplementary region image, so that a more accurate target component boundary can be determined.

[0144] S106, based on the second target region image, the third target region image and the dirty region image, determining the boundary of the target component in the target image to be detected.

[0145] In a possible implementation, the determination of the boundary of the target component in the target image to be detected based on the second target region image, the third target region image and the dirty region image can include steps F1-F3:

[0146] Step F1, determining the union image of the second target region image, the third target region image and the dirty region image.

[0147] In the present disclosure, the foreground union of the second target region image, the third target region image and the dirty region image can be obtained, and the new image composed of the foreground union is taken as the union image.

[0148] ​If the target device is a mobile phone, and the target component is a glass cover plate, the foreground of the glass cover plate region image 601 shown in FIG. 6, the foreground of the glass cover plate region image 701 shown in FIG. 7, and the foreground of the mobile phone glass cover plate region image 501 shown in FIG. 5 can be taken as a union to obtain a union image. Figure 6 Figure 7 Figure 5

[0149] Step F2, the union image is region filled to obtain a filled image.

[0150] In the present disclosure, the union image can be filled to obtain a filled image as the final region image corresponding to the target component. Then, the boundary of the target component can be extracted based on the final region image corresponding to the target component.

[0151] Step F3, based on the filled image, the boundary of the target component in the target image to be detected is determined.

[0152] In the present disclosure, based on the filled image, the boundary of the target component in the target image to be detected can include steps G1-G4:

[0153] Step G1, the filled image is subjected to an opening operation to obtain a first processed image.

[0154] In the present disclosure, a preset structure element can be used to erode the filled image to obtain an eroded image, and then a preset structure element can be used to dilate the eroded image to obtain a first processed image. By eroding and dilating the filled image, small objects or noise in the filled image can be removed.

[0155] Step G2, the first processed image is subjected to a closing operation to obtain a second processed image.

[0156] In the present disclosure, the first processed image can be dilated, specifically, the foreground of the first processed image can be expanded outward to obtain a dilated image. Then, the dilated image is eroded to make the structure of the image smaller. By dilating and eroding the first processed image, small holes and edges in the first processed image can be filled, and the broken parts of the target component in the first processed image can be connected. By filling the holes in the first processed image and connecting the broken parts, the noise in the first processed image is reduced, and the edge of the target component is smoother.

[0157] Step G3, the edge pixel points of the second processed image are extracted.

[0158] In the present disclosure, an edge extraction operator can be used to extract the edge pixel points of the second processed image.​​​

[0159] Step G4: Determine the boundary contour line based on the edge pixels, which serves as the boundary of the target component.

[0160] In this disclosure, a boundary contour line can be fitted based on the edge pixels to serve as the boundary of the target component. Specifically, a suitable boundary fitting algorithm can be selected according to requirements. For example, a polynomial fitting algorithm, a spline curve fitting algorithm, or a fitted curve generation algorithm can be used to fit multiple edge pixels to obtain a fitted curve as the boundary of the target component.

[0161] Figure 8 This illustration shows a boundary diagram of a target component in the target image to be detected provided in an embodiment of this disclosure. Figure 6 Image 601 of the mobile phone glass cover area shown. Figure 7 Image 701 of the mobile phone glass cover area shown Figure 5 The union of the mobile phone glass cover area image 501 shown is used to obtain the final area image corresponding to the glass cover. After performing filling, opening, and closing operations on the final area image, the following is obtained: Figure 8 The glass cover image 801 is shown. Edge pixels of the glass cover image are extracted, and the boundary contour line obtained by fitting the edge pixels is as follows. Figure 8 The boundary 802 of the glass cover plate shown.

[0162] The boundary detection method disclosed herein involves acquiring a target image of a target device, including images of target components of the target device; detecting edge region images in the target image, and determining a first target region image based on the edge region images; determining a second target region image based on the height of the first target region image and the height of the target component; extracting a dirty region image corresponding to the target component based on the second target region image; determining a third target region image based on the width of the second target region image and the target component; and determining the boundary of the target component in the target image based on the second target region image, the third target region image, and the dirty region image. In other words, by detecting edge region images and determining the accurate range of the target component based on its height and width, and considering the dirty region of the target component, the method overcomes background interference and achieves accurate boundary extraction.

[0163] Figure 9 Images of various parts of a target component in a target image of a target device in an embodiment of this disclosure are shown. The target device is a mobile phone, and the target component is a glass cover, such as... Figure 9As shown, sub-region image 901 of the glass cover plate contains a large amount of dirt; the edges of sub-region image 902 of the glass cover plate are unclear; the edge boundary of sub-region image 903 of the glass cover plate appears as alternating black and white lines; and the imaging of sub-region image 904 of the glass cover plate is interfered with by shadows. Using the boundary detection method provided in this disclosure, the accurate boundary of the glass cover plate can be extracted. Figure 10 This invention discloses a boundary image of a target component in a target image to be detected in a target device according to an embodiment of the present disclosure. Figure 10 Showing Figure 9 The clear and accurate boundaries determined by the boundary detection method provided in this disclosure are obtained from the sub-region images 901, 902, 903, and 904 of the glass cover plate. Figure 10 As shown, after processing by the boundary detection method provided in this disclosure, Figure 9 The boundary of the sub-region image 901 of the middle glass cover is as follows Figure 10 The boundary shown is 1001. Figure 9 The boundary of the sub-region image 902 of the middle glass cover is as follows Figure 10 The boundary shown is 1002. Figure 9 The boundary of the sub-region image 903 of the middle glass cover is as follows: Figure 10 The boundary shown is 1003. Figure 9 The boundary of the sub-region image 904 of the middle glass cover is as follows: Figure 10 The boundary shown is 1004.

[0164] Based on the same inventive concept, and according to the boundary detection method provided in the above embodiments of this disclosure, another embodiment of this disclosure also provides a boundary detection device, the structural schematic diagram of which is shown below. Figure 11 As shown, it specifically includes:

[0165] Image acquisition module 1101 is used to acquire a target image to be detected of the target device, wherein the target image to be detected includes an image of a target component of the target device;

[0166] The first region determination module 1102 is used to detect edge region images in the target image to be detected, and determine a first target region image in the target image to be detected based on the edge region images;

[0167] The second region determination module 1103 is used to determine the second target region image in the target image to be detected based on the height of the first target region image and the height of the target component;

[0168] The dirty area determination module 1104 is used to extract the dirty area image corresponding to the target component based on the second target area image;

[0169] The third region determination module 1105 is configured to determine a third target region image in the target image to be detected according to the second target region image and a width of the target component.

[0170] The boundary determination module 1106 is configured to determine a boundary of the target component in the target image to be detected based on the second target region image, the third target region image, and the dirty region image.

[0171] By using the boundary detection device, the edge region image in the target image to be detected is detected, and the first target region image in the target image to be detected is determined based on the edge region image. The second target region image in the target image to be detected is determined based on the height of the first target region image and the height of the target component. The dirty region image corresponding to the target component is extracted based on the second target region image. The third target region image in the target image to be detected is determined according to the second target region image and the width of the target component. The boundary of the target component in the target image to be detected is determined based on the second target region image, the third target region image, and the dirty region image. That is, the accurate range corresponding to the target component is determined by detecting the edge region image and according to the height and the width of the target component, and the background interference of the target component is overcome, and the accurate extraction of the boundary is realized.

[0172] In an implementation, the first region determination module 1102 is specifically configured to reset pixel values of pixel points of the edge region image to 0 to obtain a reset image; perform normalization processing on the reset image to obtain a normalized image; and remove an interference region of the normalized image to obtain the first target region image in the target image to be detected.

[0173] In an implementation, the first region determination module 1102 is specifically configured to determine an initial target region image in the normalized image; and perform open operation processing on the initial target region image to obtain a processed image as the first target region image in the target image to be detected.

[0174] In an implementation, the first region determination module 1102 is specifically configured to perform erosion processing on the initial target region image by using a preset structure element to obtain an eroded image; perform inflation processing on the eroded image by using the preset structure element to obtain an inflated image as the first target region image in the target image to be detected.

[0175] In an implementation, the first region determining module 1102 is specifically configured to determine a target height range according to a height of the first target region image and a height of the target component; extract a target component region image in the to-be-detected target image; determine whether the height of the target component region image belongs to the target height range; and if so, determine the target component region image as a second target region image in the to-be-detected target image.

[0176] In an implementation, the dirty region determining module 1104 is specifically configured to perform filling processing on the second target region image to obtain a filled image; extract a first filled sub-region image with a gray value less than a first preset gray threshold from the filled image; and determine an intersection region image of the first filled sub-region image and the filled image as a dirty region image corresponding to the target component.

[0177] In an implementation, the third region determining module 1105 is specifically configured to perform filling processing on the second target region image to obtain a filled image; extract a second filled sub-region image with a gray value less than a second preset gray threshold from the filled image; perform open operation processing on the second filled sub-region image to obtain a processed image; determine a target width range according to a width of the processed image and a width of the target component; extract a target component region image in the to-be-detected target image; determine whether the width of the target component region image belongs to the target width range; and if so, determine the target component region image as a third target region image in the to-be-detected target image.

[0178] According to embodiments of the present disclosure, the present disclosure further provides an electronic device and a readable storage medium.

[0179] Figure 12 A schematic block diagram of an example electronic device 1200 that can be used to implement embodiments of the present disclosure is shown. The electronic device is intended to represent various forms of digital computers, such as laptops, desktops, tablets, personal digital assistants, servers, blade servers, mainframes, and other appropriate computers. The electronic device can also represent various forms of mobile devices, such as personal digital assistants, cellular telephones, smartphones, wearable devices, and other similar computing devices. The components shown here, their connections and relationships, and their functions, are meant to be examples only, and are not meant to limit implementations of the present disclosure described and / or claimed in this document.

[0180] As Figure 12As shown, the device 1200 includes a computing unit 1201 that can perform various appropriate actions and processes in accordance with a computer program stored in a read-only memory (ROM) 1202 or a computer program loaded from the storage unit 1208 into a random access memory (RAM) 1203. Various programs and data required for the operation of the device 1200 can also be stored in the RAM 1203. The computing unit 1201, the ROM 1202, and the RAM 1203 are connected to each other through a bus 1204. An input / output (I / O) interface 1205 is also connected to the bus 1204.

[0181] A plurality of components in the device 1200 are connected to the I / O interface 1205, including: an input unit 1206, such as a keyboard, a mouse, etc.; an output unit 1207, such as various types of displays, speakers, etc.; a storage unit 1208, such as a magnetic disk, an optical disk, etc.; and a communication unit 1209, such as a network card, a modem, a wireless communication transceiver, etc. The communication unit 1209 allows the device 1200 to exchange information / data with other devices through a computer network, such as the Internet, and / or various telecommunication networks.

[0182] The computing unit 1201 can be various general and / or special purpose processing components with processing and computing capabilities. Some examples of the computing unit 1201 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various special-purpose artificial intelligence (AI) computing chips, various computing units running machine learning model algorithms, a digital signal processor (DSP), and any appropriate processor, controller, microcontroller, etc. The computing unit 1201 performs various methods and processes described above, such as the boundary detection method. For example, in some embodiments, the boundary detection method can be implemented as a computer software program that is tangibly embodied in a machine-readable medium, such as the storage unit 1208. In some embodiments, part or all of the computer program can be loaded and / or installed on the device 1200 via the ROM 1202 and / or the communication unit 1209. When the computer program is loaded into the RAM 1203 and executed by the computing unit 1201, one or more steps of the boundary detection method described above can be performed. Alternatively, in other embodiments, the computing unit 1201 can be configured to perform the boundary detection method by any other appropriate means, such as by means of firmware.

[0183] Various implementations of the systems and techniques described above can be realized in digital electronic circuitry, integrated circuitry, a field programmable gate array (FPGA), an application specific integrated circuit (ASIC), a system on a chip (SOC), a complex programmable logic device (CPLD), computer hardware, firmware, software, and / or combinations thereof. These various implementations can include implementation in one or more computer programs that are executable and / or interpretable on a programmable system including at least one programmable processor, which can be special or general purpose, coupled to receive data and instructions from, and to transmit data and instructions to, a storage system, at least one input device, and at least one output device.

[0184] Program code for carrying out methods of the present disclosure can be written in any combination of one or more programming languages. The program code can be provided to a processor or controller of a general purpose computer, special purpose computer, or other programmable data processing apparatus to produce a machine, such that the program code, when executed by the processor or controller, produces the functions / operations specified in the flowcharts and / or the block diagrams. The program code can be executed entirely on a machine, partially on a machine, partially on a machine as a stand-alone software package, partially on a machine and partially on a remote machine or entirely on a remote machine or server.

[0185] In the context of the present disclosure, a machine-readable medium can be a tangible medium that contains or stores a program for use by or in connection with an instruction execution system, apparatus, or device. The machine-readable medium can be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium can include but is not limited to an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any suitable combination of the foregoing. More specific examples of the machine-readable storage medium will include one or more lines of electrical connections, portable computer disks, hard disk drives, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or Flash memory), optical fibers, portable compact disc read-only memories (CD-ROMs), optical storage devices, magnetic storage devices, or any suitable combination of the foregoing.

[0186] To provide for interaction with a user, the systems and techniques described here can be implemented on a computer having a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user and a keyboard and a pointing device (e.g., a mouse or a trackball) by which the user can provide input to the computer. Other kinds of devices can be used to provide for interaction with a user as well; for example, feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form, including acoustic, speech, or tactile input.

[0187] The systems and techniques described here can be implemented in a computing system that includes a back end component (e.g., as a data server), or that includes a middleware component (e.g., an application server), or that includes a front end component (e.g., a user computer having a graphical user interface or a Web browser through which a user can interact with an implementation of the systems and techniques described here), or any combination of such back end, middleware, or front end components. The components of the system can be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include a local area network (LAN), a wide area network (WAN), and the Internet.

[0188] The computer system can include clients and servers. A client and server are generally remote from each other and typically interact through a communication network. The relationship of client and server is generally established by computer programs running on the respective computers and having a client-server relationship to each other. The servers can be cloud servers, servers of a distributed system, or servers combined with a blockchain.

[0189] It should be understood that the various forms of flow shown above can be re-ordered, added to, or deleted from without departing from the scope of the present disclosure. For example, the steps recited in the present disclosure can be executed in parallel, in series, or in a different order, without departing from the desired results of the technology disclosed herein, which are not limited herein.

[0190] In addition, the terms "first", "second", etc., are used herein only to describe different instances, and do not imply or suggest relative importance or imply the number of indicated technical features. Therefore, the features defined with "first", "second" can explicitly or implicitly include at least one of the features. In the description of the present disclosure, the meaning of "a plurality of" is two or more, unless otherwise specifically limited.

[0191] The above merely provides the specific implementation of the present disclosure, but the protection scope of the present disclosure is not limited thereto, any person skilled in the art can easily think of the changes or replacements within the technical range disclosed by the present disclosure, which should be covered within the protection scope of the present disclosure. Therefore, the protection scope of the present disclosure should be subject to the protection scope of the claims.

Claims

1. A method of boundary detection, characterized by, The method comprises: obtaining a target image to be detected of a target device, the target image to be detected comprising an image of a target component of the target device; detecting an edge region image in the target image to be detected, and determining a first target region image in the target image to be detected based on the edge region image; determining a second target region image in the target image to be detected based on a height of the first target region image and a height of the target component; extracting a dirty region image corresponding to the target component based on the second target region image; determining a third target region image in the target image to be detected according to the second target region image and a width of the target component; determining a boundary of the target component in the target image to be detected based on the second target region image, the third target region image and the dirty region image; wherein the determining the first target region image in the target image to be detected based on the edge region image comprises: resetting pixel values of pixel points of the edge region image to 0 to obtain a reset image; performing normalization processing on the reset image to obtain a normalized image; removing an interference region of the normalized image to obtain the first target region image in the target image to be detected; the determining the third target region image in the target image to be detected according to the second target region image and the width of the target component comprises: performing padding processing on the second target region image to obtain a padded image; extracting a second padding sub-region image with a gray value less than a second preset gray threshold from the padded image; performing open operation processing on the second padding sub-region image to obtain a processed image; determining a target width range according to a width of the processed image and the width of the target component; extracting a target component region image in the target image to be detected; determining whether a height of the target component region image belongs to the target width range; if yes, determining the target component region image as the third target region image in the target image to be detected.

2. The method of claim 1, wherein, the removing the interference region of the normalized image to obtain the first target region image in the target image to be detected comprises: determining an initial target region image in the normalized image; performing open operation processing on the initial target region image to obtain a processed image as the first target region image in the target image to be detected.

3. The method of claim 2, wherein, the performing open operation processing on the initial target region image to obtain a processed image as the first target region image in the target image to be detected comprises: performing erosion processing on the initial target region image using a preset structure element to obtain an eroded image; performing inflation processing on the eroded image using the preset structure element to obtain an inflated image as the first target region image in the target image to be detected.

4. The method of claim 1, wherein, the determining the second target region image in the target image to be detected based on the height of the first target region image and the height of the target component comprises: determine a target height range according to a height of the first target region image and a height of the target component; extract a target component region image in the to-be-detected target image; determine whether the height of the target component region image belongs to the target height range; if yes, determine the target component region image as a second target region image in the to-be-detected target image.

5. The method of claim 1, wherein, the target component region image, including: perform filling processing on the second target region image to obtain a filled image; extract a first filled sub-region image with a gray value less than a first preset gray threshold from the filled image; determine an intersection region image of the first filled sub-region image and the filled image as the target component corresponding dirty region image.

6. The method of claim 1, wherein, the target component region image, including: determine a union image of the second target region image, the third target region image and the dirty region image; perform region filling on the union image to obtain a filled image; determine the boundary of the target component in the to-be-detected target image based on the filled image.

7. The method of claim 6, wherein, the target component region image, including: perform opening operation processing on the filled image to obtain a first processing image; perform closing operation processing on the first processing image to obtain a second processing image; extract edge pixel points of the second processing image; determine a boundary contour line based on the edge pixel points as the boundary of the target component.

8. The method of claim 7, wherein, the target component region image, including: fit a boundary contour line based on the edge pixel points as the boundary of the target component.

9. The method of claim 1, wherein, the target component includes a glass cover plate of the target device.

10. A boundary detection apparatus characterized by comprising: the device includes: an image acquisition module configured to acquire a to-be-detected target image of a target device, the to-be-detected target image including an image of a target component of the target device; a first region determination module configured to detect an edge region image in the to-be-detected target image and determine a first target region image in the to-be-detected target image based on the edge region image; a second region determination module configured to determine a second target region image in the to-be-detected target image based on a height of the first target region image and a height of the target component; a dirty region determination module configured to extract a target component corresponding dirty region image based on the second target region image; a third region determination module configured to determine a third target region image in the to-be-detected target image according to the second target region image and a width of the target component; a boundary determination module configured to determine a boundary of the target component in the to-be-detected target image based on the second target region image, the third target region image and the dirty region image. The first region determining module is specifically configured to reset pixel values of pixel points of the edge region image to 0 to obtain a reset image, perform normalization processing on the reset image to obtain a normalized image, and remove an interference region of the normalized image to obtain a first target region image in the target image to be detected. The third region determining module is specifically configured to perform padding processing on the second target region image to obtain a padded image, extract a second padding sub-region image with a gray value less than a second preset gray threshold from the padded image, perform open operation processing on the second padding sub-region image to obtain a processed image, determine a target width range according to a width of the processed image and a width of the target component, extract a target component region image from the target image to be detected, and determine whether a height of the target component region image belongs to the target width range. If yes, the target component region image is determined as a third target region image in the target image to be detected.

11. The apparatus of claim 10, wherein, The first region determining module is specifically configured to determine an initial target region image in the normalized image, and perform open operation processing on the initial target region image to obtain a processed image as the first target region image in the target image to be detected.

12. The apparatus of claim 11, wherein, The first region determining module is specifically configured to perform erosion processing on the initial target region image by using a preset structure element to obtain an eroded image, and perform inflation processing on the eroded image by using the preset structure element to obtain an inflated image as the first target region image in the target image to be detected.

13. The apparatus of claim 10, wherein, The first region determining module is specifically configured to determine a target height range according to a height of the first target region image and a height of the target component, extract a target component region image from the target image to be detected, and determine whether a height of the target component region image belongs to the target height range. If yes, the target component region image is determined as a second target region image in the target image to be detected.

14. The apparatus of claim 10, wherein, The dirty region determining module is specifically configured to perform padding processing on the second target region image to obtain a padded image, extract a first padding sub-region image with a gray value less than a first preset gray threshold from the padded image, and determine an intersection region image of the first padding sub-region image and the padded image as a dirty region image corresponding to the target component.

15. An electronic device, comprising: comprise: at least one processor; and a memory connected with the at least one processor in communication; wherein the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to perform the method of any one of claims 1-9.

16. A non-transitory computer-readable storage medium having stored thereon computer instructions, wherein, The computer instructions are used to enable a computer to perform the method of any one of claims 1-9.

Citation Information

Patent Citations

  • Defect detection method and device, computer device and storage medium

    CN113554649A

  • Edge defect detection method and device, equipment and storage medium

    CN118822943A