Boundary detection method and device, equipment and storage medium

By detecting the edge area image of the glass cover plate and determining the target area image based on the height and width of the target component, combined with dirty area processing, the problem of unstable detection effect in the complex background of traditional methods is solved, and the accurate detection of the boundary of the glass cover plate is achieved.

CN119625005AActive Publication Date: 2025-03-14ZHONGKE HUIYUAN VISUAL TECHNOLOGY (LUOYANG) CO LTD +1
View PDF 12 Cites 0 Cited by

Patent Information

Application Number
CN202411699588.4
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-11-25
Publication Date
2025-03-14
Estimated Expiration
2044-11-25

AI Technical Summary

Technical Problem

Traditional image processing methods are susceptible to interference from transparent properties and complex background environments when detecting the boundaries of glass covers, resulting in unstable detection effects and high cost.

Method used

By acquiring the target image to be detected by the target device, the edge area image is detected and the first target area image is determined, the second target area image is determined based on the height of the area image and the height of the target component, the dirty area image is extracted, and the boundary of the target component is determined according to the second and third target area images.

Benefits of technology

It realizes accurate detection of glass cover boundaries under complex backgrounds, overcomes background interference, improves detection accuracy and reduces detection costs.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119625005A_ABST
    Figure CN119625005A_ABST
Patent Text Reader

Abstract

The invention provides a boundary detection method and device, equipment and a storage medium, and the method comprises the steps: obtaining a to-be-detected target image of target equipment, and enabling the to-be-detected image to comprise an image of a target assembly of the target equipment; detecting an edge region image in a to-be-detected target image, and determining a first target region image in the to-be-detected target image based on the edge region image; determining a second target area image in the to-be-detected target image based on the height of the first target area image and the height of the target component; based on the second target area image, extracting a dirty area image corresponding to the target component; determining a third target area image in the to-be-detected target image according to the second target area image and the width of the target component; and determining the boundary of the target component in the to-be-detected target image based on the second target area image, the third target area image and the dirty area image. By adopting the method, the precise extraction of the boundary is realized.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present disclosure relates to the field of image processing technology, and in particular to a boundary detection method, device, equipment and storage medium. Background Art

[0002] Glass cover is a key component of electronic devices such as smartphones and tablets. Its quality and processing accuracy will affect the performance and user experience of electronic devices. Therefore, how to detect the boundary of glass cover has become an important part of the electronic device production process.

[0003] However, due to the transparent nature of the glass cover and the complex background environment, traditional image processing methods are easily affected by noise in complex backgrounds, resulting in unstable detection results and high detection costs. Therefore, how to accurately detect the boundaries of the glass cover has become a technical problem that needs to be solved urgently. Summary of the invention

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

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

[0006] Acquire a target image to be detected of a target device, wherein the target image to be detected includes 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 area image in the target image to be detected based on the height of the first target area image and the height of the target component;

[0009] Based on the second target area image, extracting a dirty area image corresponding to the target component;

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

[0011] Based on the second target area image, the third target area image and the dirty area image, a boundary of the target component in the target image to be detected is determined.

[0012] In one possible implementation manner, determining the first target area image in the target image to be detected based on the edge area image includes:

[0013] Resetting the pixel values ​​of the pixels of the edge area image to 0 to obtain a reset image;

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

[0015] The interference area of ​​the normalized image is eliminated to obtain a first target area image in the target image to be detected.

[0016] In one possible implementation manner, removing the interference area of ​​the normalized image to obtain the first target area image in the target image to be detected includes:

[0017] Determining an initial target area image in the normalized image;

[0018] The initial target area image is subjected to an opening operation to obtain a processed image as the first target area image in the target image to be detected.

[0019] In one possible implementation manner, performing an opening operation on the initial target area image to obtain a processed image as the first target area image in the target image to be detected includes:

[0020] Using a preset structural element to perform corrosion processing on the initial target area image to obtain a corroded image;

[0021] The eroded image is expanded using the preset structural element to obtain an expanded image as the first target area image in the target image to be detected.

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

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

[0024] Extracting a target component area image from the target image to be detected;

[0025] Determining whether the height of the target component area image falls within the target height range;

[0026] If yes, the target component area image is determined as the second target area image in the target image to be detected.

[0027] In one possible implementation manner, extracting the dirty area image corresponding to the target component based on the second target area image includes:

[0028] Performing filling processing on the second target area image to obtain a filled image;

[0029] Extracting a first filled sub-region image whose grayscale value is less than a first preset grayscale threshold value in the filled image;

[0030] An intersection area image of the first filled sub-area image and the filled image is determined as a dirty area image corresponding to the target component.

[0031] In one possible implementation manner, determining a third target area image in the target image to be detected according to the second target area image and the width of the target component includes:

[0032] Performing filling processing on the second target area image to obtain a filled image;

[0033] Extracting a second filled sub-region image whose grayscale value is less than a second preset grayscale threshold value in the filled image;

[0034] Performing an opening operation 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 area image from the target image to be detected;

[0037] Determine whether the height of the target component area image falls within the target width range;

[0038] If yes, the target component area image is determined as the third target area image in the target image to be detected.

[0039] In one possible implementation manner, determining the boundary of the target component in the target image to be detected based on the second target area image, the third target area image and the dirty area image includes:

[0040] Determine a union image of the second target area image, the third target area image and the dirty area image;

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

[0042] Based on the filled image, a boundary of the target component in the target image to be detected is determined.

[0043] In one possible implementation manner, determining the boundary of the target component in the target image to be detected based on the filled image includes:

[0044] Performing an opening operation on the padded image to obtain a first processed image;

[0045] Performing a closing operation on the first processed image to obtain a second processed image;

[0046] Extracting edge pixels of the second processed image;

[0047] A boundary contour line is determined based on the edge pixel points as the boundary of the target component.

[0048] In one possible implementation manner, determining a boundary contour line based on the edge pixel points as a boundary of the target component includes:

[0049] A boundary contour line is fitted based on the edge pixel points as the boundary of the target component.

[0050] In one possible implementation, the target component includes a glass cover plate of the target device.

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

[0052] An image acquisition module, used for acquiring a target image to be detected of a target device, wherein the target image to be detected includes 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 determining 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 area determination module, used for extracting a dirty area image corresponding to a target component based on the second target area image;

[0056] A third region determining module, configured to determine a 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;

[0057] A boundary determination module is used to determine the boundary of the target component in the target image to be detected based on the second target area image, the third target area image and the dirty area image.

[0058] In one possible implementation mode, the first area determination module is specifically used to reset the pixel values ​​of the pixel points of the edge area image to 0 to obtain a reset image; normalize the reset image to obtain a normalized image; and eliminate the interference area of ​​the normalized image to obtain the first target area image in the target image to be detected.

[0059] In one possible implementation manner, the first region determination module is specifically used to determine an initial target region image in the normalized image; perform 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.

[0060] In one possible implementation manner, the first area determination module is specifically used to use a preset structural element to corrode the initial target area image to obtain an corroded image; and use the preset structural element to dilate the corroded image to obtain the dilated image as the first target area image in the target image to be detected.

[0061] In one possible implementation manner, the first area determination module is specifically used to determine a target height range based on the height of the first target area image and the height of the target component; extract a target component area image in the target image to be detected; determine whether the height of the target component area image belongs to the target height range; if so, determine the target component area image as the second target area image in the target image to be detected.

[0062] In one possible implementation, the dirty area determination module is specifically used to fill the second target area image to obtain a filled image; extract a first filled sub-area image whose grayscale value is less than a first preset grayscale threshold in the filled image; and determine the intersection area image of the first filled sub-area image and the filled image as the dirty area image corresponding to the target component.

[0063] In one possible implementation, the third area determination module is specifically used to fill the second target area image to obtain a filled image; extract a second filled sub-area image whose grayscale value is less than a second preset grayscale threshold in the filled image; perform an opening operation on the second filled sub-area image to obtain a processed image; determine a target width range based on the width of the processed image and the width of the target component; extract the target component area image in the target image to be detected; determine whether the height of the target component area image belongs to the target width range; if so, determine the target component area image as the third target area image in the target image to be detected.

[0064] The boundary detection method, device, equipment and storage medium disclosed in the present invention obtain a target image to be detected of a target device, wherein the target image to be detected includes an image of a target component of the target device; detect an edge area image in the target image to be detected, and determine a first target area image in the target image to be detected based on the edge area image; determine a second target area image in the target image to be detected based on the height of the first target area image and the height of the target component; extract a dirty area image corresponding to the target component based on the second target area image; determine a third target area image in the target image to be detected based on the second target area image and the width of the target component; and determine the boundary of the target component in the target image to be detected based on the second target area image, the third target area image and the dirty area image. That is, by detecting the edge area image and determining the accurate range corresponding to the target component based on the height and width of the target component, and taking into account the dirty area of ​​the target component, the background interference of the target component is overcome, and accurate extraction of the boundary is achieved.

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

[0066] The above and other objects, features and advantages of the exemplary embodiments of the present disclosure will become readily understood by reading the detailed description below with reference to the accompanying drawings. In the accompanying drawings, several embodiments of the present disclosure are shown in an exemplary and non-limiting manner, in which:

[0067] In the drawings, the same or corresponding reference numerals represent the same or corresponding parts.

[0068] Figure 1 A schematic diagram of a process flow of a boundary detection method provided by an embodiment of the present disclosure is shown;

[0069] Figure 2 A target image to be detected of a target device provided by an embodiment of the present disclosure is shown;

[0070] 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;

[0071] Figure 4 A first target area image determination flow chart provided by an embodiment of the present disclosure is shown;

[0072] Figure 5 A second target area image in the target image to be detected provided by an embodiment of the present disclosure is shown;

[0073] Figure 6A third target area image in the target image to be detected provided by an embodiment of the present disclosure is shown;

[0074] Figure 7 Another third target area image in the target image to be detected provided by an embodiment of the present disclosure is shown;

[0075] Figure 8 A schematic diagram of a boundary of a target component in the target image to be detected provided by an embodiment of the present disclosure is shown;

[0076] Fig. 9 The images of various parts of the target component in the target image to be detected of the target device in the embodiment of the present disclosure are shown;

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

[0078] Fig.11 A schematic diagram of the structure of a boundary detection device provided by an embodiment of the present disclosure is shown;

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

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

[0081] Since the current boundary detection of glass cover plates is easily affected by the transparent characteristics of the glass cover plates and the complex background environment, resulting in unstable detection results and high detection costs, in order to accurately detect the boundaries of the glass cover plates, the present disclosure provides a boundary detection method, apparatus, device 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 and tablet computers.

[0082] The technical solution of the embodiment of the present disclosure will be described below in conjunction with the drawings in the embodiment of the present disclosure.

[0083] Figure 1 A schematic diagram of a process flow of a boundary detection method provided by an embodiment of the present disclosure is shown. Figure 1 As shown, the method includes:

[0084] S101, obtaining 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 image acquisition device may be used to acquire an appearance image of a target device, and the target device may be an electronic device such as a mobile phone, a computer, and a tablet computer. The target component may be a glass cover component covering a screen or a camera of the target device. The glass cover component may be used to protect the screen and the camera of the target device. The image acquisition device may be a high-precision 2D camera. Figure 2 FIG. 4 shows a target image to be detected of a target device provided by an embodiment of the present disclosure, such as Figure 2 As shown, the target device is a mobile phone, and a high-precision 2D camera can be used to capture an image of the mobile phone's appearance including the mobile phone screen to obtain an image 200 to be detected, wherein the image 200 to be detected includes an image 201 of the glass cover area 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 area image in the target image to be detected. The edge detection operator can include a Canny operator and a Sobel operator, etc. For example, an edge detection operator can be used to grayscale the target image to be detected to obtain a corresponding grayscale image. The grayscale image is horizontally convolved to obtain a first gradient image, and the grayscale image is vertically convolved to obtain a second gradient image, and the amplitudes of the first gradient image and the second gradient image are calculated, and the edge area image in the target image to be detected is determined according to the amplitude, wherein 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. Figure 3 Shown Figure 2 A partial edge area image 301 is shown on the left side of the target component in the image 200 to be detected.

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

[0092] S401, resetting the pixel values ​​of the pixels of the edge area image to 0 to obtain a reset image.

[0093] In the present disclosure, in order to clearly distinguish the edge area from the target component area, the pixel values ​​of the pixel points of the edge area image can be reset to 0. Figure 3 For example, Figure 3 An edge region image 301 of a glass cover of a mobile phone is shown. In order to make the glass cover region and the edge region more distinct, the pixel values ​​of all pixels in the edge region image 301 may be reset to 0.

[0094] S402, performing normalization processing on the reset image to obtain a normalized image.

[0095] In the present disclosure, in order to further distinguish the image of the area where the target component is located from the edge, the reset image can be normalized. Specifically, the pixel values ​​of the pixels in the reset image within the preset pixel range can be mapped to [0,255], and the pixel values ​​of the pixels in the reset image that are not within the preset pixel range can be reset to 255, thereby achieving a clear distinction between the grayscale values ​​of the internal and edge areas of the target component. The preset pixel range can be a range [Min,Max] consisting 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, etc., and the first preset maximum pixel threshold can be set to 200 or 255, etc.

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

[0097] In a possible implementation, removing the interference area of ​​the normalized image to obtain the first target area image in the target image to be detected may include steps A1-A2:

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

[0099] In the present disclosure, pixel points can be screened from the normalized image according to a pixel range formed by a second preset minimum pixel threshold and a second preset maximum pixel threshold. Specifically, pixel points whose pixel values ​​in the normalized image are greater than or equal to the second preset minimum pixel threshold and less than or equal to the second preset maximum pixel threshold can be screened, and the area formed by the screened pixel points is the initial target area image, which represents the area where the target component is located, wherein 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 area image to obtain a processed image as the first target area image in the target image to be detected.

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

[0102] In a possible implementation, 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 may include steps B1-B2:

[0103] Step B1, using a preset structural element to perform corrosion processing on the initial target area image to obtain a corroded image.

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

[0105]

[0106] A pixel corresponding to each element in the 2x2 rectangular structure element B can be eroded by using the 2x2 rectangular structure element B. Specifically, the origin can be defined in the rectangular structure element B. For example, the element in the first row and the first column of the rectangular structure element B can be defined as the origin. The rectangular structure element B traverses the initial target area image with a preset step size. When the origin of the rectangular structure element B is translated to the pixel point (x, y) of the initial target area image, if the values ​​of the corresponding pixel points at the element position with the element value of 1 in the rectangular structure element B when the rectangular structure element B is at the pixel point (x, y) are all 1, then the pixel value at the pixel point (x, y) is reset to 1, otherwise the pixel value at the pixel point (x, y) is reset to 0. After the preset structure element traverses the initial target area image, the erosion processing of the initial target area image is completed. The erosion processing can shrink the boundary of the initial target area image and eliminate small and meaningless targets. Among them, the preset step size can be set to a pixel distance or a two pixel distance.

[0107] Step B2: using the preset structure element to dilate the eroded image to obtain the dilated image as the first target area image in the target image to be detected.

[0108] The eroded image is expanded by using the preset structure element. Specifically, the 2x2 rectangular structure element B can be taken as an example, and the 2x2 rectangular structure element B can be used to expand the eroded image. Specifically, the origin can be defined in the rectangular structure element B, for example, the element in the first row and second column of the rectangular structure element B can be defined as the origin, and the rectangular structure element B traverses the eroded image with a preset step size. When the origin of the rectangular structure element B is translated to the pixel point (x', y') of the eroded image, if the rectangular structure element B is at the pixel point (x', y'), the value of the corresponding pixel point at the position of at least one element with an element value of 1 in the rectangular structure element B is also 1, then the pixel value at the pixel point (x, y) is reset to 1, otherwise the pixel value at the pixel point (x, y) is reset to 0. After the eroded image is traversed by the preset structure element, the expansion process of the initial target area image is completed, and the contacting background points in the eroded image can be merged into the target component area through the expansion process, even if the boundary of the area where the target component is located expands outward. Some holes in the area where the target component is located are filled, and small particle noise contained in the area where the target component is located is eliminated, so that the obtained first target area image can eliminate interference factors.

[0109] S103: Determine a second target area image in the target image to be detected based on the height of the first target area image and the height of the target component.

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

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

[0112] In the present disclosure, the ratio between the height of the target component and the height of the first target area 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 area image is H, if the ratio between the height of the target component and the height of the first target area image is 0.6, the target height range can be set to [0.5H, 0.9H], and if the ratio between the height of the target component and the height of the first target area image is 0.5, the target height range can be set to [0.4H, 0.9H].

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

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

[0115] Step C4: if yes, determine the target component area image as the second target area image in the target image to be detected.

[0116] The component area of ​​the target device in the target image to be detected can be detected. If there is a component area whose height is within the target height range, the component area image can be determined as the target component area image. Taking the glass cover of the target device as an example, Figure 5 A second target area image in the target image to be detected provided by an embodiment of the present disclosure is shown. Figure 5 As shown, a mobile phone glass cover area image 501 whose height belongs to the target height range is detected in the target image to be detected.

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

[0118] In the present disclosure, since dark-colored dirt may exist on the target component and is removed as an interference factor, which will affect the integrity of the target component area, the dirty area on the target component can be processed separately to obtain a corresponding dirty area image.

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

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

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

[0122] Step D2, extracting a first filled sub-region image whose grayscale value is less than a first preset grayscale threshold in the filled image.

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

[0124] Pixels with grayscale values ​​less than the first preset grayscale threshold may represent darker areas in the image, which may usually contain dirt or flaws, etc. Therefore, the first filled sub-area image can be screened out as a possible dirty area by the first preset grayscale threshold.

[0125] Step D3: determining the intersection area image of the first filled sub-area image and the filled image as the dirty area image corresponding to the target component.

[0126] By finding the intersection of the first filling sub-region and the filled image, the dirty area inside the target component can be located more accurately. Since the intersection image only retains the area that satisfies both the first filling sub-region image and the filled image, it can be ensured that the dirty area found is complete and accurate.

[0127] S105: Determine a third target area image in the target image to be detected according to the second target area image and the width of the target component.

[0128] In a possible implementation manner, determining the third target area image in the target image to be detected according to the second target area image and the width of the target component may include steps E1-E7:

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

[0130] This step may refer to step D1 and will not be described in detail here.

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

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

[0133] Pixels with grayscale values ​​less than the second preset grayscale threshold may represent darker areas in the image. Taking the glass cover of a mobile phone as an example, the dark areas with grayscale values ​​less than the second preset grayscale threshold may be the upper and lower edge areas of the glass cover 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 filling sub-region may be corroded, and the corroded image may be dilated to obtain a processed image. Through the corroded dilation process, objects or noise in the second filling sub-region image may be removed, and a larger component shape may be retained. Specifically, in the present disclosure, the preset structural element may be used to corrode the second filling sub-region image.

[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, if the width of the first target area 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 to [0.5W, 0.8W], and 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 to [0.4W, 0.9W].

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

[0139] Step E6, determining whether the height of the target component area image falls within the target width range.

[0140] Step E7: if yes, determine the target component area image as the third target area image in the target image to be detected.

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

[0142] If the target device is a mobile phone and the target component is a glass cover, since the pixel values ​​of the upper and lower parts of the glass cover are dark in color, the upper and lower cover areas are usually not included when extracting the cover area image. In the present disclosure, the upper cover area and the lower cover area can be filtered out by the target width range, and the upper cover area and the lower cover area can be used as the supplementary area image of the glass cover. Figure 6 and Figure 7 For example, Figure 6 A third target area image in the target image to be detected provided by an embodiment of the present disclosure is shown. Figure 7 Another third target area image in the target image to be detected provided by the embodiment of the present disclosure is shown. Figure 6 As shown, a mobile phone glass cover plate area image 601 whose width belongs to the target width range is detected in the target image to be detected. The glass cover plate area image 601 is the upper cover plate area of ​​the glass cover plate. Figure 7 As shown, a mobile phone glass cover plate area image 701 whose width belongs to the target width range is also detected in the target image to be detected. The glass cover plate area image 701 is the lower cover plate area of ​​the glass cover plate. The glass cover plate area image 601 and the glass cover plate area image 701 can be used as Figure 5 A supplementary area image of the mobile phone glass cover area image 501 is shown.

[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, and based on the target width range, the third target area image in the target image to be detected is determined as a supplementary area image of the target component. Based on the supplementary area image, the area image of the target component can be more accurately determined, thereby determining a more accurate target component boundary.

[0144] S106: Determine a boundary of the target component in the target image to be detected based on the second target area image, the third target area image and the dirty area image.

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

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

[0147] In the present disclosure, a foreground union of the second target region image, the third target region image and the dirty region image may be obtained, and a new image formed by the foreground union may be used as a union image.

[0148] If the target device is a mobile phone, the target component is a glass cover. Figure 6 The glass cover area image 601, Figure 7 The glass cover area image 701 and Figure 5 The foreground of the mobile phone glass cover area image 501 shown is unioned to obtain a union image.

[0149] Step F2, performing region filling on the union image to obtain a filled image.

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

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

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

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

[0154] In the present disclosure, the filled image can be eroded using a preset structure element to obtain an eroded image, and then the eroded image can be expanded using a preset structure element to obtain a first processed image. By performing erosion and expansion on the filled image, small objects or noise in the filled image can be removed.

[0155] Step G2, performing a closing operation on the first processed image 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 reduce the structure of the image. By dilating and eroding the first processed image, small holes and edges in the first processed image can be filled, and broken parts of the target component in the first processed image can be connected. By filling holes in the first processed image and connecting broken parts, the noise in the first processed image is reduced, making the edge of the target component smoother.

[0157] Step G3: extract edge pixels of the second processed image.

[0158] In the present disclosure, an edge extraction operator may be used to extract edge pixels of the second processed image.

[0159] Step G4, determining a boundary contour line based on the edge pixel points as the boundary of the target component.

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

[0161] Figure 8 A schematic diagram of the boundary of a target component in the target image to be detected provided by an embodiment of the present disclosure is shown. Figure 6 The mobile phone glass cover area image 601 is shown. Figure 7 The mobile phone glass cover area image 701 and Figure 5 The mobile phone glass cover plate region image 501 shown in the figure is obtained by obtaining a union, and a final region image corresponding to the glass cover plate is obtained. After the final region image is filled, opened, and closed, the following is obtained: Figure 8 The glass cover plate image 801 is shown in FIG. The edge pixel points of the glass cover plate image are extracted, and the boundary contour line obtained by fitting the edge pixel points is as shown in FIG. Figure 8 The border 802 of the glass cover is shown.

[0162] The boundary detection method disclosed in the present invention is adopted, by acquiring a target image to be detected of a target device, the image to be detected includes an image of a target component of the target device; detecting an edge area image in the target image to be detected, and determining a first target area image in the target image to be detected based on the edge area image; determining a second target area image in the target image to be detected based on the height of the first target area image and the height of the target component; extracting a dirty area image corresponding to the target component based on the second target area image; determining a third target area image in the target image to be detected based on the second target area image and the width of the target component; and determining the boundary of the target component in the target image to be detected based on the second target area image, the third target area image and the dirty area image. That is, by detecting the edge area image and determining the accurate range corresponding to the target component based on the height and width of the target component, and taking into account the dirty area of ​​the target component, the background interference of the target component is overcome, and accurate extraction of the boundary is achieved.

[0163] Fig. 9 1 shows various parts of the target component in the target image to be detected of the target device in the embodiment of the present disclosure. The target device is a mobile phone, and the target component is a glass cover plate. Fig. 9As shown, there is a lot of dirt inside the sub-region image 901 of the glass cover, the edge of the sub-region image 902 of the glass cover is not clear, the edge boundary of the sub-region image 903 of the glass cover is in a black and white state, and the imaging of the sub-region image 904 of the glass cover is disturbed by shadows. Using the boundary detection method provided by the present disclosure, the accurate boundary of the glass cover can be extracted. Fig.10 A boundary image of a target component in a target image to be detected of a target device in an embodiment of the present disclosure is shown. Fig.10 Shown Fig. 9 The sub-region image 901 of the glass cover, the sub-region image 902 of the glass cover, the sub-region image 903 of the glass cover, and the sub-region image 904 of the glass cover are processed by the boundary detection method provided by the present disclosure to determine the clear and accurate boundaries. Fig.10 As shown, after being processed by the boundary detection method provided by the present disclosure, Fig. 9 The boundary of the sub-region image 901 of the glass cover is as follows: Fig.10 The boundary 1001 shown, Fig. 9 The boundary of the sub-region image 902 of the glass cover is as follows: Fig.10 The boundary 1002 shown, Fig. 9 The boundary of the sub-region image 903 of the glass cover is as follows: Fig.10 The boundary 1003 shown, Fig. 9 The boundary of the sub-region image 904 of the glass cover is as follows: Fig.10 Boundary 1004 is shown.

[0164] Based on the same inventive concept, according to the boundary detection method provided by the above embodiment of the present disclosure, correspondingly, another embodiment of the present disclosure further provides a boundary detection device, whose structural schematic diagram is shown in FIG. Fig.11 As shown, specifically including:

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

[0166] A first region determining module 1102 is 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;

[0167] A second region determining module 1103 is used to determine a 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] A dirty area determination module 1104 is used to extract a dirty area image corresponding to a target component based on the second target area image;

[0169] A third region determining module 1105 is used to determine a 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;

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

[0171] The boundary detection device disclosed in the present invention is adopted, by acquiring a target image to be detected of a target device, the image to be detected includes an image of a target component of the target device; detecting an edge area image in the target image to be detected, and determining a first target area image in the target image to be detected based on the edge area image; determining a second target area image in the target image to be detected based on the height of the first target area image and the height of the target component; extracting a dirty area image corresponding to the target component based on the second target area image; determining a third target area image in the target image to be detected based on the second target area image and the width of the target component; and determining the boundary of the target component in the target image to be detected based on the second target area image, the third target area image and the dirty area image. That is, by detecting the edge area image and determining the accurate range corresponding to the target component based on the height and width of the target component, and taking into account the dirty area of ​​the target component, the background interference of the target component is overcome, and accurate extraction of the boundary is achieved.

[0172] In one possible implementation, the first area determination module 1102 is specifically used to reset the pixel values ​​of the pixel points of the edge area image to 0 to obtain a reset image; normalize the reset image to obtain a normalized image; and eliminate the interference area of ​​the normalized image to obtain the first target area image in the target image to be detected.

[0173] In one possible implementation, the first region determination module 1102 is specifically used to determine an initial target region image in the normalized image; perform 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.

[0174] In one possible implementation, the first region determination module 1102 is specifically used to use a preset structural element to corrode the initial target region image to obtain a corroded image; and use the preset structural element to dilate the corroded image to obtain the dilated image as the first target region image in the target image to be detected.

[0175] In one possible implementation, the first area determination module 1102 is specifically used to determine a target height range based on the height of the first target area image and the height of the target component; extract the target component area image in the target image to be detected; determine whether the height of the target component area image belongs to the target height range; if so, determine the target component area image as the second target area image in the target image to be detected.

[0176] In one possible implementation, the dirty area determination module 1104 is specifically used to fill the second target area image to obtain a filled image; extract a first filled sub-area image whose grayscale value is less than a first preset grayscale threshold in the filled image; and determine the intersection area image of the first filled sub-area image and the filled image as the dirty area image corresponding to the target component.

[0177] In one possible implementation, the third area determination module 1105 is specifically used to fill the second target area image to obtain a filled image; extract a second filled sub-area image whose grayscale value is less than a second preset grayscale threshold in the filled image; perform an opening operation on the second filled sub-area image to obtain a processed image; determine a target width range based on the width of the processed image and the width of the target component; extract the target component area image in the target image to be detected; determine whether the height of the target component area image belongs to the target width range; if so, determine the target component area image as the third target area image in the target image to be detected.

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

[0179] Fig.12 A schematic block diagram of an example electronic device 1200 that can be used to implement an embodiment of the present disclosure is shown. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device can also represent various forms of mobile devices, such as personal digital processing, cellular phones, smart phones, wearable devices, and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely examples and are not intended to limit the implementation of the present disclosure described and / or required herein.

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

[0181] A number 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 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 may be a variety of general and / or special 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 dedicated artificial intelligence (AI) computing chips, various computing units running machine learning model algorithms, digital signal processors (DSPs), and any appropriate processors, controllers, microcontrollers, etc. The computing unit 1201 performs the various methods and processes described above, such as the boundary detection method. For example, in some embodiments, the boundary detection method may be implemented as a computer software program, which is tangibly contained in a machine-readable medium, such as a storage unit 1208. In some embodiments, part or all of the computer program may 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 may be performed. Alternatively, in other embodiments, the computing unit 1201 may be configured to perform the boundary detection method in any other appropriate manner (e.g., by means of firmware).

[0183] Various implementations of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on chips (SOCs), complex programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various implementations can include: being implemented in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which can be a special purpose or general purpose programmable processor that can receive data and instructions from a storage system, at least one input device, and at least one output device, and transmit data and instructions to the storage system, the at least one input device, and the at least one output device.

[0184] The program code for implementing the method of the present disclosure may be written in any combination of one or more programming languages. These program codes may be provided to a processor or controller of a general-purpose computer, a special-purpose computer, or other programmable data processing device, so that the program code, when executed by the processor or controller, enables the functions / operations specified in the flow chart and / or block diagram to be implemented. The program code may be executed entirely on the machine, partially on the machine, partially on the machine and partially on a remote machine as a stand-alone software package, or entirely on a remote machine or server.

[0185] In the context of the present disclosure, a machine-readable medium may be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, device, or equipment. A machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium may include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, device, or equipment, or any suitable combination of the foregoing. A more specific example of a machine-readable storage medium may include an electrical connection based on one or more lines, 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 foregoing.

[0186] To provide interaction with a user, the systems and techniques described herein 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 pointing device (e.g., a mouse or trackball) through which the user can provide input to the computer. Other types of devices can also be used to provide interaction with the user; for example, the 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 input, voice input, or tactile input).

[0187] The systems and techniques described herein may be implemented in a computing system that includes back-end components (e.g., as a data server), or a computing system that includes middleware components (e.g., an application server), or a computing system that includes front-end components (e.g., a user computer with a graphical user interface or a web browser through which a user can interact with implementations of the systems and techniques described herein), or a computing system that includes any combination of such back-end components, middleware components, or front-end components. The components of the system may 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] A computer system may include a client and a server. The client and the server are generally remote from each other and usually interact through a communication network. The relationship of client and server is generated by computer programs running on respective computers and having a client-server relationship with each other. The server may be a cloud server, a server of a distributed system, or a server combined with a blockchain.

[0189] It should be understood that the various forms of processes shown above can be used to reorder, add or delete steps. For example, the steps recorded in this disclosure can be executed in parallel, sequentially or in different orders, as long as the desired results of the technical solutions disclosed in this disclosure can be achieved, and this document does not limit this.

[0190] In addition, the terms "first" and "second" are used for descriptive purposes only and should not be understood as indicating or implying relative importance or implicitly indicating the number of technical features indicated. Thus, a feature defined as "first" or "second" may explicitly or implicitly include at least one of the features. In the description of the present disclosure, the meaning of "plurality" is two or more, unless otherwise clearly and specifically defined.

[0191] The above is only a specific embodiment of the present disclosure, but the protection scope of the present disclosure is not limited thereto. Any person skilled in the art who is familiar with the technical field can easily think of changes or substitutions within the technical scope disclosed in the present disclosure, which should be included in the protection scope of the present disclosure. Therefore, the protection scope of the present disclosure should be based on the protection scope of the claims.

Claims

1. A boundary detection method, characterized in that: The method comprises: Acquire a target image to be detected of a target device, wherein the target image to be detected includes 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 area image in the target image to be detected based on the height of the first target area image and the height of the target component; Based on the second target area image, extracting a dirty area image corresponding to the target component; Determining a third target area image in the target image to be detected according to the second target area image and the width of the target component; Based on the second target area image, the third target area image and the dirty area image, a boundary of the target component in the target image to be detected is determined.

2. The method according to claim 1, characterized in that: The determining, based on the edge area image, a first target area image in the target image to be detected comprises: Resetting the pixel values ​​of the pixels of the edge area image to 0 to obtain a reset image; Performing normalization processing on the reset image to obtain a normalized image; The interference area of ​​the normalized image is eliminated to obtain a first target area image in the target image to be detected.

3. The method according to claim 2, characterized in that The step of removing the interference area of ​​the normalized image to obtain a first target area image in the target image to be detected includes: Determining an initial target area image in the normalized image; The initial target area image is subjected to an opening operation to obtain a processed image as the first target area image in the target image to be detected.

4. The method according to claim 3, characterized in that The performing an opening operation on the initial target area image to obtain a processed image as the first target area image in the target image to be detected includes: Using a preset structural element to perform corrosion processing on the initial target area image to obtain a corroded image; The eroded image is expanded using the preset structural element to obtain an expanded image as the first target area image in the target image to be detected.

5. The method according to claim 1, characterized in that The determining, based on the height of the first target area image and the height of the target component, a second target area image in the target image to be detected, comprises: Determining a target height range according to the height of the first target area image and the height of the target component; Extracting a target component area image from the target image to be detected; Determining whether the height of the target component area image falls within the target height range; If yes, the target component area image is determined as the second target area image in the target image to be detected.

6. The method according to claim 1, characterized in that The step of extracting the dirty area image corresponding to the target component based on the second target area image includes: Performing filling processing on the second target area image to obtain a filled image; Extracting a first filled sub-region image whose grayscale value is less than a first preset grayscale threshold value in the filled image; An intersection area image of the first filled sub-area image and the filled image is determined as a dirty area image corresponding to the target component.

7. The method according to claim 1, characterized in that The step of determining a third target area image in the target image to be detected according to the second target area image and the width of the target component comprises: Performing filling processing on the second target area image to obtain a filled image; Extracting a second filled sub-region image whose grayscale value is less than a second preset grayscale threshold value in the filled image; Performing an opening operation on the second filled sub-region image to obtain a processed image; determining a target width range according to the width of the processed image and the width of the target component; Extracting a target component area image from the target image to be detected; Determine whether the height of the target component area image falls within the target width range; If yes, the target component area image is determined as the third target area image in the target image to be detected.

8. A boundary detection device, characterized in that: The device comprises: An image acquisition module, used for acquiring a target image to be detected of a target device, wherein the target image to be detected includes an image of a target component of the target device; 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; A second region determining 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; A dirty area determination module, used for extracting a dirty area image corresponding to a target component based on the second target area image; A third region determining module, configured to determine a 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; A boundary determination module is used to determine the boundary of the target component in the target image to be detected based on the second target area image, the third target area image and the dirty area image.

9. An electronic device, characterized in that: include: at least one processor; as well as a memory 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 to enable the at least one processor to perform the method according to any one of claims 1 to 7.

10. A non-transitory computer-readable storage medium storing computer instructions, characterized in that: The computer instructions are used to make a computer execute the method according to any one of claims 1-7.

Citation Information

Patent Citations

  • Display screen cover plate, display screen assembly and mobile terminal

    CN106886253A

  • Lens dirt detection method and device and terminal device

    CN110766679A

  • Picture processing method and device

    CN112862693A

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

    CN113554649A

  • Lens dirt detection method and device and image detection equipment

    CN116958058A