Linear edge and corner detection method and device and storage medium

By using straight edge and corner point detection methods during the automatic calibration of the fine inspection camera, the problem of edge blur in the virtual focus image is solved, the accuracy and reliability of feature extraction are improved, and the accuracy and stability of calibration results are ensured.

CN119762518AActive Publication Date: 2025-04-04SHENZHEN SEICHITECH TECHN CO LTD

Patent Information

Application Number
CN202510258795.4
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-03-06
Publication Date
2025-04-04
Estimated Expiration
2045-03-06

AI Technical Summary

Technical Problem

During the automatic calibration process of the precision camera, due to the inhorizontal position of the calibration plate and the small depth of field, the image has a dummy focus phenomenon and blurred edges, making it difficult to accurately extract the characteristics of the straight edges and corners, which affects the accuracy and reliability of the calibration results.

Method used

A straight line edge and corner point detection method is used to convolve the image through the edge detection operator, obtain the gradient amplitude map and gradient direction map, set the gradient amplitude threshold, filter the tiny areas, perform hypothesis test and threshold segmentation, judge corner features, perform morphological expansion and rectangularity calculation, filter the straight line edge feature area, and extract the target straight line edge features and corner features using the regional skeleton contour method.

Benefits of technology

It effectively solves the problem of edge blur in the virtual focus image, improves the accuracy and reliability of linear edges and corner features, and ensures the accuracy and stability of the automatic calibration process.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119762518A_ABST
    Figure CN119762518A_ABST
Patent Text Reader

Abstract

The invention discloses a linear edge and corner detection method and device and a storage medium, relates to the technical field of machine vision, and is used for accurately acquiring linear edge and corner features. The method comprises the following steps: carrying out convolution on an input image to obtain a gradient magnitude diagram and a gradient direction diagram; acquiring a first image area in the gradient directional diagram; performing first hypothesis testing on the first image region to obtain a first region set and a second region set; dividing the second region set into a first sub-region set and a second sub-region set, and respectively carrying out second hypothesis testing on the first sub-region set and the second sub-region set; if both pass the second hypothesis test, calculating the absolute value of the mean value difference in the gradient direction of the two; determining to add the second region set into the first region set according to the absolute value; performing morphological expansion on the first region set, and calculating the rectangularity of each region; obtaining a linear edge feature region according to a rectangularity clamping control threshold value; and obtaining target linear edge features and angular point features in the linear edge feature region.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of machine vision technology, and in particular to a method, device and storage medium for detecting straight line edges and corner points. Background Art

[0002] In the panel industry, there is a composite inspection system consisting of a main inspection camera and a precision inspection camera. The main inspection camera is used to detect the defect location and defect type, and the precision inspection camera is used to further determine the hierarchical position of the defect in the display screen. In order to move the defects under the field of view of the main inspection camera to the field of view of the precision inspection camera, it is necessary to calibrate the image coordinate system of the main inspection camera and the stage coordinate system. Because the field of view of the precision inspection camera is small, it can only capture part of the calibration plate. In the existing process, an automatic calibration method based on the edge patrol of the precision inspection camera is proposed. This method identifies the straight edge features of the inner frame of the calibration plate so that the precision inspection camera can align the identified inner frame corner points during the edge patrol along the inner frame of the calibration plate, and record the stage position. Finally, according to the physical parameters of the calibration plate, the center of the precision inspection camera is calculated to align the stage position of each mark point, thereby realizing automatic calibration.

[0003] During the border inspection process, it is necessary to identify the straight edges and corner features of the inner frame of the calibration plate in the captured image. However, in actual applications, the calibration plate is often not completely level with the camera plane, and the depth of field of the precision inspection camera is relatively small. As a result, during the shooting process, the image is prone to out-of-focus as the stage (the platform used to carry and move the calibration plate) moves.

[0004] Because the edge blur and grayscale changes are not obvious in the out-of-focus image, the edge of the calibration plate becomes blurred, the detail information is lost, and the continuity and directionality of the edge points are difficult to accurately judge, resulting in difficulty in accurately extracting straight edge and corner point features, which in turn affects the accuracy and reliability of the calibration results. Summary of the invention

[0005] In order to solve the above technical problems, the present application provides a straight line edge and corner point detection method, device and storage medium.

[0006] The technical solution provided in this application is described below: The first aspect of the present application provides a straight line edge and corner point detection method, comprising: Use edge detection operator to convolve the input image to obtain gradient magnitude map and gradient direction map; Setting a gradient amplitude threshold, and acquiring a first image region in the gradient direction map according to the gradient amplitude threshold and the gradient amplitude map, wherein the first image region is an edge region in the gradient direction map where the gradient amplitude is significant; Filtering tiny areas in the first image area according to the connected domain analysis and the preset minimum area; Performing a first hypothesis test on the first image region to obtain a first region set and a second region set, wherein the first region set is the region in the first image region that passes the first hypothesis test, and the second region set is the region in the first image region that fails the first hypothesis test; dividing the second region set into a first sub-region set and a second sub-region set according to threshold segmentation, and performing a second hypothesis test on the first sub-region set and the second sub-region set respectively; If both the first sub-region set and the second sub-region set pass the second hypothesis test, determining whether there is a corner feature in the second region set; If it is determined that there is a corner feature in the second region set, marking the second region set as a corner feature region and adding it to the first region set; Performing morphological dilation on the first region set, and calculating the rectangularity of each region in the first region set; Setting a rectangularity control threshold, and screening out straight edge feature regions according to the rectangularity control threshold and the rectangularity of each region in the first region set; According to the regional skeleton contour method, the target straight line edge features and corner point features in the straight line edge feature region are obtained.

[0007] Optionally, the step of convolving the input image using an edge detection operator to obtain a gradient magnitude map and a gradient direction map includes: Convolve the input image using the x-direction convolution kernel and the y-direction convolution kernel of the edge detection operator to obtain the gradient component in the x-direction and the gradient component in the y-direction; For each pixel of the input image, calculating the Euclidean norm of the x-direction gradient component and the y-direction gradient component of the pixel to obtain the gradient amplitude of the pixel; Integrating the gradient magnitudes of all pixels to generate a gradient magnitude map of the input image; For each pixel of the input image, the arc tangent value of the gradient component in the x direction and the gradient component in the y direction are calculated to obtain the gradient direction of the pixel; The gradient directions of all pixels are integrated to generate a gradient direction map of the input image.

[0008] Optionally, the setting of a gradient amplitude threshold and obtaining a first image region in the gradient direction map according to the gradient amplitude threshold and the gradient amplitude map, wherein the first image region is an edge region in the gradient direction map where the gradient amplitude is significant, includes: The gradient amplitude threshold is set to N times the maximum gradient amplitude in the gradient amplitude map (0 <N<1); Comparing the gradient magnitude of each pixel in the gradient direction map with the gradient magnitude threshold; All pixel points whose gradient magnitudes are greater than a gradient magnitude threshold are acquired to generate a first image region.

[0009] Optionally, performing a first hypothesis test on the first image region to obtain a first region set and a second region set includes: Dividing the first image area into a plurality of blocks; The variance of the gradient direction of each block is selected to be equal to the variance of the gradient direction of the straight edge as the original hypothesis; Calculate the test statistic according to the gradient direction variance of the block, the number of pixels, and the gradient direction variance of the straight line edge; Determine a significance level, and calculate a test lower limit value according to the number of pixels in the block and the significance level; By comparing the test statistic with the test lower limit value, determining whether the block satisfies the corresponding null hypothesis; If yes, the block passes the first hypothesis test and is divided into a first region set; If not, the block fails the first hypothesis test and is divided into a second region set.

[0010] Optionally, after determining according to the absolute value that the second region set contains a corner feature and before marking the second region set as a corner feature region and adding the second region set to the first region set, the method further includes: determining, according to the absolute value, whether the second region set contains a corner feature; If so, determining that the second region contains corner features; If not, it is determined that the second region set contains arc features, and the second region set is discarded.

[0011] Optionally, the step of setting a rectangularity control threshold and filtering out a straight edge feature region according to the rectangularity control threshold and the rectangularity of each region in the first region set includes: Set a rectangularity control threshold; Comparing the rectangularity of each area with the rectangularity control threshold; The non-rectangular region is screened out to obtain a straight edge feature region, wherein the non-rectangular region is a region whose rectangularity does not meet the rectangular control threshold.

[0012] Optionally, the acquiring the target straight line edge features and corner point features in the straight line edge feature region according to the regional skeleton contour method includes: Extracting a straight line skeleton in the straight line edge feature region; converting the straight line skeleton into a straight line profile; Extracting target straight line edge features in the straight line profile using a straight line detection algorithm; According to the target straight line edge feature, the corner point feature in the corner feature area is obtained.

[0013] A second aspect of the present application provides a distance-based stimulation value calibration device, comprising: The convolution unit uses the edge detection operator to convolve the input image to obtain the gradient magnitude map and the gradient direction map; A first acquisition unit is configured to set a gradient amplitude threshold and acquire a first image region in the gradient direction map according to the gradient amplitude threshold and the gradient amplitude map, wherein the first image region is an edge region in the gradient direction map where the gradient amplitude is significant; A filtering unit, filtering a tiny area in the first image area according to a connected domain analysis and a preset minimum area; a first testing unit, performing a first hypothesis test on the first image region to obtain a first region set and a second region set, wherein the first region set is the region in the first image region that passes the first hypothesis test, and the second region set is the region in the first image region that fails the first hypothesis test; a second testing unit, which divides the second region set into a first sub-region set and a second sub-region set according to threshold segmentation, and performs a second hypothesis test on the first sub-region set and the second sub-region set respectively; a judging unit, judging whether there is a corner feature in the second sub-region set if both the first sub-region set and the second sub-region set pass the second hypothesis test; The processing unit, if it is determined that there is a corner feature in the second region set, marks the second region set as a corner feature region and adds it to the first region set; a calculation unit, performing morphological dilation on the first region set, and calculating a rectangular degree of each region in the first region set; a screening unit, which sets a rectangularity control threshold, and screens out straight edge feature regions according to the rectangularity control threshold and the rectangularity of each region in the first region set; The second acquisition unit acquires target straight line edge features and corner point features in the straight line edge feature region according to a regional skeleton contour method.

[0014] Optionally, the convolution unit includes: Convolve the input image using the x-direction convolution kernel and the y-direction convolution kernel of the edge detection operator to obtain the gradient component in the x-direction and the gradient component in the y-direction; For each pixel of the input image, calculating the Euclidean norm of the x-direction gradient component and the y-direction gradient component of the pixel to obtain the gradient amplitude of the pixel; Integrating the gradient magnitudes of all pixels to generate a gradient magnitude map of the input image; For each pixel of the input image, the arc tangent value of the gradient component in the x direction and the gradient component in the y direction are calculated to obtain the gradient direction of the pixel; The gradient directions of all pixels are integrated to generate a gradient direction map of the input image.

[0015] Optionally, the first acquiring unit includes: The gradient amplitude threshold is set to N times the maximum gradient amplitude in the gradient amplitude map (0 <N<1); Comparing the gradient magnitude of each pixel in the gradient direction map with the gradient magnitude threshold; All pixel points whose gradient magnitudes are greater than the gradient magnitude threshold are acquired to generate a first image region.

[0016] Optionally, the first inspection unit includes: Dividing the first image area into a plurality of blocks; The variance of the gradient direction of each block is selected to be equal to the variance of the gradient direction of the straight edge as the original hypothesis; Calculate the test statistic according to the gradient direction variance of the block, the number of pixels, and the gradient direction variance of the straight line edge; Determine a significance level, and calculate a test lower limit value according to the number of pixels in the block and the significance level; By comparing the test statistic with the test lower limit value, determining whether the block satisfies the corresponding null hypothesis; If yes, the block passes the first hypothesis test and is divided into a first region set; If not, the block fails the first hypothesis test and is divided into a second region set.

[0017] Optionally, the judging unit includes: If both the first sub-region set and the second sub-region set pass the second hypothesis test, calculating the absolute value of the mean difference in gradient direction between the first sub-region set and the second sub-region set; Determining whether the absolute value meets the corner feature; If so, determining that the second region contains corner features; If not, it is determined that the second region set contains arc features, and the second region set is discarded.

[0018] Optionally, the screening unit comprises: Set a rectangularity control threshold; Comparing the rectangularity of each area with the rectangularity control threshold; The non-rectangular region is screened out to obtain a straight edge feature region, wherein the non-rectangular region is a region whose rectangularity does not meet the rectangular control threshold.

[0019] Optionally, the second acquiring unit includes: Extracting a straight line skeleton in the straight line edge feature region; converting the straight line skeleton into a straight line profile; Extracting target straight line edge features in the straight line profile using a straight line detection algorithm; According to the target straight line edge feature, the corner point feature in the corner feature area is obtained.

[0020] The third aspect of the present application provides a distance-based stimulation value calibration device, comprising: Processor, memory, input-output unit, and bus; The processor is connected to the memory, the input and output unit, and the bus; The memory stores a program, and the processor calls the program to execute the first aspect and the optional stimulation value calibration method of any one of the first aspect.

[0021] A fourth aspect of the present application provides a computer-readable storage medium, on which a program is stored. When the program is executed on a computer, the program executes the first aspect and the optional stimulation value calibration method of any one of the first aspect.

[0022] It can be seen from the above technical solutions that this application has the following advantages: By convolving the input image with an edge detection operator, the grayscale changes in the image can be accurately captured, and the gradient magnitude map and gradient direction map can be obtained based on the grayscale changes. Setting the gradient magnitude threshold can further filter out edge areas (first image areas) with significant gradient magnitudes, reduce the interference of noise and irrelevant details, and improve the accuracy of edge detection.

[0023] By filtering the tiny areas in the first image area through connected domain analysis and the preset minimum area, non-important edges caused by noise or image details can be removed, making subsequent processing more efficient and accurate. Hypothesis testing is performed on the first image area, and the area is divided into two parts: those that pass the test and those that fail the test, and the area containing straight line edges is efficiently identified. Further segmentation and hypothesis testing of the area that fails the first hypothesis test can effectively distinguish between corner features and arc features, while improving the robustness of corner point detection and reducing missed detections and false detections. By determining whether there are corner features in the second area set, marking the area with corner features as a corner feature area and adding it to the first area set, this provides theoretical support for the subsequent positioning of corner point features.

[0024] By performing morphological dilation and rectangular calculation on the first region set, regions with straight edge features can be further screened out. By setting the rectangular control threshold, the straight edge of the inner border of the calibration plate can be accurately identified, providing a reliable basis for subsequent corner point extraction. The regional skeleton contour method is used to obtain the target straight edge features and corner point features in the straight edge feature region. This method can intuitively reflect the geometric shape of the edge, making the straight line features and corner point features more intuitive and simple.

[0025] Multiple hypothesis testing steps reduce the amount of calculation and complexity of subsequent processing and improve the overall processing efficiency. At the same time, it ensures that when the input image is out of focus, the system can still accurately identify the edge and corner features of the inner frame of the calibration plate, which also provides strong support for subsequent image processing and calibration work. BRIEF DESCRIPTION OF THE DRAWINGS

[0026] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative labor.

[0027] Figure 1 A schematic diagram of an embodiment of a straight line edge and corner point detection method of the present application; Figure 2 A schematic diagram of an embodiment of a method for obtaining a gradient magnitude map and a gradient direction map of the present application; Figure 3 A schematic diagram of an embodiment of a method for acquiring a first image area of ​​the present application; Figure 4 A schematic diagram of an embodiment of the first hypothesis testing method of the present application; Figure 5A schematic diagram of an embodiment of a method for determining whether there is a corner feature in the present application; Figure 6 A schematic diagram of an embodiment of a method for obtaining a straight edge feature region of the present application; Figure 7 A schematic diagram of an embodiment of a method for obtaining target straight line edge features and corner point features of the present application; Figure 8 A schematic diagram of the structure of the straight line edge and corner point detection device of the present application; Fig. 9 Another structural schematic diagram of the straight line edge and corner point detection device of the present application; Fig.10 Schematic diagram of three edge features of this application; Fig.11 Schematic diagram of three edge features when out of focus in this application; Fig.12 This is a schematic diagram of the edge and corner point extraction results when not out of focus in this application; Fig.13 This is a schematic diagram of the edge and corner point extraction results when the image is out of focus in this application. DETAILED DESCRIPTION

[0028] In the following description, specific details such as specific system structures, technologies, etc. are provided for the purpose of illustration rather than limitation, so as to provide a thorough understanding of the embodiments of the present application. However, it should be clear to those skilled in the art that the present application may also be implemented in other embodiments without these specific details. In other cases, detailed descriptions of well-known systems, devices, circuits, and methods are omitted to prevent unnecessary details from obstructing the description of the present application.

[0029] It should be understood that when used in the present specification and the appended claims, the term "comprising" indicates the presence of described features, wholes, steps, operations, elements and / or components, but does not exclude the presence or addition of one or more other features, wholes, steps, operations, elements, components and / or combinations thereof.

[0030] It should also be understood that the term “and / or” used in the specification and appended claims refers to any and all possible combinations of one or more of the associated listed items, and includes these combinations.

[0031] As used in the specification and appended claims of this application, the term "if" can be interpreted as "when" or "uponce" or "in response to determining" or "in response to detecting", depending on the context. Similarly, the phrase "if it is determined" or "if [described condition or event] is detected" can be interpreted as meaning "uponce it is determined" or "in response to determining" or "uponce [described condition or event] is detected" or "in response to detecting [described condition or event]", depending on the context.

[0032] In addition, in the description of the present application specification and the appended claims, the terms "first", "second", "third", etc. are only used to distinguish the descriptions and cannot be understood as indicating or implying relative importance.

[0033] References to "one embodiment" or "some embodiments" etc. described in the specification of this application mean that one or more embodiments of the present application include specific features, structures or characteristics described in conjunction with the embodiment. Therefore, the statements "in one embodiment", "in some embodiments", "in some other embodiments", "in some other embodiments", etc. that appear in different places in this specification do not necessarily refer to the same embodiment, but mean "one or more but not all embodiments", unless otherwise specifically emphasized in other ways. The terms "including", "comprising", "having" and their variations all mean "including but not limited to", unless otherwise specifically emphasized in other ways.

[0034] An automatic calibration method based on edge patrol of a precision inspection camera is proposed in the existing process. This method identifies the straight edge features of the inner frame of the calibration plate and enables the precision inspection camera to align the identified corner points of the inner frame during the edge patrol along the inner frame of the calibration plate, and records the position of the stage. Finally, the center of the precision inspection camera is calculated according to the physical parameters of the calibration plate to align the stage position of each mark point, thereby realizing automatic calibration.

[0035] During the border inspection process, it is necessary to identify the straight edges and corner features of the inner frame of the calibration plate in the captured image. However, in actual applications, the calibration plate is often not completely level with the camera image plane, and the depth of field of the precision inspection camera is relatively small. As a result, during the shooting process, the image is prone to out-of-focus as the stage (the platform used to carry and move the calibration plate) moves.

[0036] Because the edge blur and grayscale changes are not obvious in the out-of-focus image, the edge of the calibration plate becomes blurred, the detail information is lost, and the continuity and directionality of the edge points are difficult to accurately judge, resulting in difficulty in accurately extracting straight edge and corner point features, which in turn affects the accuracy and reliability of the calibration results.

[0037] Based on this, the present application discloses a straight line edge and corner point detection method, device and storage medium for accurately obtaining the straight line edge and corner point features of the inner frame of a calibration plate.

[0038] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.

[0039] The method of the present application can be applied to a server, a device, a terminal or other devices with logic processing capabilities, and the present application does not limit this. For the convenience of description, the following description is made by taking the execution subject as an example of a terminal.

[0040] See also Figure 1 The present application provides an embodiment of a straight line edge and corner point detection method, comprising: 101. Use the edge detection operator to convolve the input image to obtain a gradient magnitude map and a gradient direction map; Edge detection operators are a type of filter used to calculate image gradients. Edge detection operators can be selected from Sobel operators, Prewitt operators, Canny edge detectors, etc. These edge detection operators contain one or more pairs of convolution kernels, which are used to calculate the gradient components in the x direction and y direction respectively.

[0041] The gradient magnitude indicates the rate or intensity of change of the grayscale value of a pixel in an image. The gradient direction indicates the direction in which the grayscale value of a pixel changes fastest. After obtaining the input image by photographing the calibration plate with a precision inspection camera, the input image is convolved with a suitable edge detection operator to obtain the gradient magnitude map and gradient direction map corresponding to the input image.

[0042] 102. Setting a gradient amplitude threshold, and acquiring a first image region in a gradient direction map according to the gradient amplitude threshold and the gradient amplitude map; There are still some edge regions with significant gradient amplitude (i.e., drastic grayscale changes) in the gradient direction map obtained after edge detection operator processing, and the edge regions contain straight line edges and corner point features.

[0043] First, a suitable gradient amplitude threshold is set, which can be a multiple of the maximum gradient amplitude in the gradient amplitude map. By comparing the gradient amplitude threshold with the gradient amplitude of each pixel in the gradient amplitude map, some edge areas with drastic grayscale changes can be distinguished. The corresponding edge area is located in the gradient direction map, and the edge area in the gradient direction map is extracted to obtain the first image area.

[0044] 103. Filtering a tiny area in the first image area according to the connected domain analysis and a preset minimum area; After obtaining the first image region, a connected domain analysis is performed on the first image region to identify all connected regions in the first image region. Each connected region is composed of a group of interconnected pixels, and these pixels form a continuous block in the image.

[0045] After the connected domain analysis, a threshold is set, i.e., the minimum area. The minimum area is used to determine which areas are considered small areas and should be filtered out, and which areas are considered important and need to be retained. According to the set minimum area threshold, all identified connected areas are traversed. For areas with an area smaller than the minimum area, they are considered small areas and filtered out. The filtering operation can be to set the pixel value of the small area to the background color. For areas with an area greater than or equal to the minimum area, they are retained.

[0046] 104. Perform a first hypothesis test on the first image region to obtain a first region set and a second region set; Different edge features have different variances of gradient directions. Points on a straight edge have the same gradient direction because the edge is a straight line and perpendicular to the gradient direction. In theory, the variance of the gradient direction distribution of all points on a straight edge is approximately equal to 0 (or very small). Points on an arc edge have a continuously changing gradient direction because the edge is curved. The variance of the gradient direction distribution of points in the arc edge region is relatively large and not equal to 0. Therefore, the straight edge feature and the arc edge feature can be distinguished based on the variance of the gradient direction of the edge feature.

[0047] The first hypothesis test is based on the gradient direction variance of the edge feature. By assuming that the gradient direction variance of the edge feature is 0, a hypothesis test is performed on each area in the first image area, and the first image area is divided into a first area set and a second area set.

[0048] 105. Divide the second region set into a first sub-region set and a second sub-region set according to the threshold segmentation, and perform a second hypothesis test on the first sub-region set and the second sub-region set respectively; After the second region set is obtained through step 104, the gradient direction mean of the second region set is solved, and the gradient direction mean is obtained according to the calculation.

[0049] A suitable threshold is set, and according to the threshold, the second region set that fails the hypothesis test is divided into two sub-region sets with different gradient direction means. Specifically, each pixel point in the second region set is traversed to determine whether the difference between its gradient direction and the mean is greater than or less than the threshold, and the pixel points are classified into different sub-region sets, namely, the first sub-region set and the second sub-region set, according to the determination result.

[0050] After the two sub-region sets are divided, a second hypothesis test is performed on the two sub-region sets respectively. The second hypothesis test is similar to the first hypothesis test. Both are based on the gradient direction variance of the edge features to perform hypothesis tests on the two sub-region sets, and record the test results of the first sub-region set and the second sub-region set.

[0051] 106. If both the first sub-region set and the second sub-region set pass the second hypothesis test, determining whether there is a corner feature in the second region set; Confirm whether the first sub-region set and the second sub-region set pass the second hypothesis test. If both pass the second hypothesis test, it means that there is no significant difference in the gradient direction variance of the edge features in the two sub-region sets (0 or close to 0), indicating that there may be corner features in the second region set. By analyzing the first sub-region set and the second sub-region set, it is determined whether the second region set contains corner features.

[0052] 107. If it is determined that there is a corner feature in the second region set, mark the second region set as a corner feature region and add it to the first region set; Through step 106, it can be determined whether the second region set contains corner features. Once it is determined that the second region set contains corner features, the second region set needs to be marked to clearly define the region containing corner features in the second region set as a corner feature region. The marking can be implemented in a variety of ways such as image annotation, data label, index or identifier.

[0053] The marked corner feature regions are integrated into the first region set. Theoretically, the first region set and the second region set are continuous or adjacent in the image space, and they can be directly merged into a larger region set.

[0054] 108. Perform morphological dilation on the first region set, and calculate the rectangularity of each region in the first region set; Morphological dilation is an image processing operation based on set theory that scans the image using a probe called a structuring element, which is chosen to be slightly larger than the smallest feature size in the first region set to ensure an effective dilation effect.

[0055] The dilation operation fills small holes, connects adjacent regions, or slightly expands region boundaries by matching the structural element to each pixel position in the first region set. After the dilation operation, each region in the first region set will be changed.

[0056] Rectangularity is a measure of how close a region is to a rectangle, defined as the ratio of the area of ​​the region to the area of ​​its smallest enclosing rectangle. The value of rectangularity is between 0 and 1, with a completely rectangular region having a rectangularity of 1, and non-rectangular regions having lower rectangularity values.

[0057] The rectangularity of each area after expansion is calculated based on the minimum circumscribed rectangle in the first area set and the area of ​​each area. The calculation formula is as follows:

[0058] In the formula, is the area of ​​each region, is the area of ​​the minimum circumscribed rectangle of the first region set.

[0059] 109. Setting a rectangular degree control threshold, and screening out a straight edge feature region according to the rectangular degree control threshold and the rectangular degrees of each region in the first region set; Set a reasonable rectangularity control threshold, which is used to distinguish areas with straight edge features from other non-rectangular areas.

[0060] The above step 108 has calculated the rectangularity of each area of ​​the first area set, and compared the rectangularity of each area with the set threshold. If the rectangularity is greater than or equal to the threshold, the area is considered to have a straight edge feature; otherwise, the area is considered to not meet the requirements. According to the comparison result, all areas with straight edge features are marked.

[0061] 110. According to the regional skeleton contour method, the target straight line edge features and corner point features in the straight line edge feature area are obtained.

[0062] The thinning algorithm is used to extract the straight line skeleton of the straight line edge feature area, and then the extracted skeleton is contoured to form a clear and continuous straight line contour. The straight line contour is analyzed using the straight line detection algorithm to accurately identify and extract the target straight line edge features. Finally, the intersection of the target straight line edge features is calculated to accurately identify the corner point features.

[0063] In this embodiment, by using the edge detection operator to convolve the input image, the grayscale changes in the image can be accurately captured, and the gradient magnitude map and the gradient direction map can be obtained according to the grayscale changes. Setting the gradient magnitude threshold can further filter out the edge area (first image area) with significant gradient magnitude, reduce the interference of noise and irrelevant details, and improve the accuracy of edge detection.

[0064] By filtering the tiny areas in the first image area through connected domain analysis and the preset minimum area, non-important edges caused by noise or image details can be removed, making subsequent processing more efficient and accurate. Hypothesis testing is performed on the first image area, and the area is divided into two parts: those that pass the test and those that fail the test, and the area containing straight line edges is efficiently identified. Further segmentation and hypothesis testing of the area that fails the first hypothesis test can effectively distinguish between corner features and arc features, while improving the robustness of corner point detection and reducing missed detections and false detections. By determining whether there are corner features in the second area set, marking the area with corner features as a corner feature area and adding it to the first area set, this provides theoretical support for the subsequent positioning of corner point features.

[0065] By performing morphological dilation and rectangular calculation on the first region set, regions with straight edge features can be further screened out. By setting the rectangular control threshold, the straight edge of the inner border of the calibration plate can be accurately identified, providing a reliable basis for subsequent corner point extraction. The regional skeleton contour method is used to obtain the target straight edge features and corner point features in the straight edge feature region. This method can intuitively reflect the geometric shape of the edge, making the straight line features and corner point features more intuitive and simple.

[0066] Multiple hypothesis testing steps reduce the amount of calculation and complexity of subsequent processing and improve the overall processing efficiency. At the same time, it ensures that when the input image is out of focus, the system can still accurately identify the edge and corner features of the inner frame of the calibration plate, which also provides strong support for subsequent image processing and calibration. For specific edge and corner extraction results, please refer to Fig.12 and Fig.13 In the figure, the yellow wireframe is the enlarged border of the corner feature area, the yellow dotted line is the enlarged auxiliary line, and the red dot is the corner feature obtained by this method; the red line segment and the green line segment are the target straight line edge features obtained by this method; specifically, the red line segment is the target straight line edge feature of the upper edge, and the green line segment is the target straight line edge feature of the left edge. In order to distinguish two different target straight line edge features, red and green are used to distinguish them.

[0067] See also Figure 2 The present application provides an embodiment of a method for obtaining a gradient magnitude map and a gradient direction map, the embodiment comprising: 201. Convolve the input image using the x-direction convolution kernel and the y-direction convolution kernel of the edge detection operator to obtain the gradient component in the x-direction and the gradient component in the y-direction; 202. For each pixel of the input image, calculate the Euclidean norm of the x-direction gradient component and the y-direction gradient component of the pixel to obtain the gradient amplitude of the pixel; 203. Integrate the gradient magnitudes of all pixels to generate a gradient magnitude map of the input image; 204. For each pixel point of the input image, calculate the inverse tangent value of the gradient component in the x direction and the gradient component in the y direction to obtain the gradient direction of the pixel point; 205. Integrate the gradient directions of all pixels to generate a gradient direction map of the input image.

[0068] The x-direction convolution kernel is a horizontal filter in the edge detection operator, which is used to detect horizontal edges. Similarly, the y-direction convolution kernel is a vertical filter in the edge detection operator, which is used to detect vertical edges. These two convolution kernels are applied to each pixel of the input image to calculate the convolution, and two output images are obtained, one is the gradient component image in the x-direction, and the other is the gradient component image in the y-direction.

[0069] For each pixel of the input image, the gradient magnitude is obtained by calculating the Euclidean norm (i.e., the Pythagorean theorem) of the gradient component of the pixel in the x-direction or y-direction. The gradient magnitudes of the gradient components in the x-direction and y-direction of all pixels are integrated to form a new image, i.e., the gradient magnitude map.

[0070] For each pixel of the input image, the gradient direction is obtained by calculating the arc tangent of the gradient components of the pixel in the x and y directions. The gradient directions of all pixels are integrated to form a new image, namely the gradient direction map. This image reflects the edge direction of each pixel in the input image.

[0071] In this embodiment, by using the x-direction and y-direction convolution kernels of the edge detection operator, the gradient components of the image in the horizontal and vertical directions can be accurately calculated, and these gradient components reflect the brightness change rate of the image in different directions. The gradient amplitude is obtained by calculating the Euclidean norm of the x-direction gradient component and the y-direction gradient component, and the gradient amplitude can reflect the edge strength of each pixel in the image.

[0072] The gradient magnitude map can clearly show the edge position in the image. By integrating the gradient magnitudes of all pixels to generate a gradient magnitude map, the noise in the image can be further smoothed and the robustness of edge detection can be improved. The gradient direction map shows the gradient direction of each pixel in the image, that is, the inclination angle of the edge. The generated gradient magnitude map and gradient direction map can serve as the basis for subsequent image processing algorithms.

[0073] See also Figure 3 The present application provides an embodiment of a method for acquiring a first image area, the embodiment comprising: 301. Set the gradient amplitude threshold to N times the maximum gradient amplitude in the gradient amplitude map (0 <N<1); 302. Compare the gradient magnitude of each pixel in the gradient direction map with the gradient magnitude threshold; 303. Acquire all pixel points whose gradient amplitudes are greater than the gradient amplitude threshold, and generate a first image region.

[0074] First, it is necessary to determine the maximum gradient amplitude in the gradient amplitude map and select a suitable (greater than 0 and less than 1) proportionality coefficient N based on experience, such as N=0.1, 0.2, etc., and set it as the gradient amplitude threshold. This proportionality coefficient determines the sensitivity of the threshold relative to the maximum gradient amplitude. A smaller N value means a higher sensitivity, which can filter out more edge features; while a larger N value means a lower sensitivity, which only filters out the most significant edge features. Multiply the maximum gradient amplitude by the proportionality coefficient N to get the gradient amplitude threshold.

[0075] Traverse each pixel in the gradient amplitude map and extract the gradient amplitude corresponding to each pixel. Compare the gradient amplitude of each pixel with the calculated gradient amplitude threshold to determine whether the pixel belongs to the edge feature significant area. For all pixels whose gradient amplitude is greater than the gradient amplitude threshold, they are regarded as pixels with significant edge features and included in the first image area. By integrating all the filtered pixels, the first image area is constructed. This area contains all pixels with significant edge features in the image and is the basis for subsequent image processing and analysis.

[0076] In this embodiment, by setting a reasonable gradient amplitude threshold, the edge feature significant area in the image can be accurately screened out, reducing the interference of noise and irrelevant details. The pixel points with significant edge features are screened out through a simple comparison operation, avoiding complex calculation processes and improving the efficiency of image processing. The first image area contains the most important edge feature information in the image, providing a data basis for subsequent image processing.

[0077] See also Figure 4 , the present application provides an embodiment of a method for first hypothesis testing, the embodiment comprising: 401. Divide a first image area into a plurality of blocks; 402. Selecting the variance of the gradient direction of each block to be equal to the variance of the gradient direction of the straight edge as the original hypothesis; 403. Calculate a test statistic according to the gradient direction variance of the block, the number of pixels, and the gradient direction variance of the straight line edge; 404. Determine a significance level, and calculate a test lower limit value according to the number of pixels in the block and the significance level; 405. By comparing the test statistic and the test lower limit value, it is determined whether the block satisfies the corresponding null hypothesis; 406. If yes, the block passes the first hypothesis test and is divided into the first region set; 407. If not, the block fails the first hypothesis test and is divided into a second region set.

[0078] First, the first image area is divided into multiple blocks to facilitate subsequent hypothesis testing.

[0079] ‌Hypothesis testing is a method used in statistics to judge statistical inferences‌. ‌Hypothesis testing analyzes sample data to determine whether the hypothesis about the population parameter is valid. The basic idea of ​​hypothesis testing is the "small probability event" principle. Small probability events are almost impossible to occur in a test. If a small probability event occurs in a test, then there is reason to doubt the correctness of the null hypothesis and reject the null hypothesis. Hypothesis testing usually involves two hypotheses: the null hypothesis and the alternative hypothesis. The null hypothesis usually indicates that there is no change or no difference between the two groups of samples. It is the hypothesis that the researcher wants to refute; while the alternative hypothesis indicates that a change has occurred or there is a difference. It is the hypothesis that the researcher wants to prove.

[0080] Set the null hypothesis The variance of the gradient direction of each block in the first image region is equal to 0. Alternative hypothesis The variance of the gradient direction of each block in the first image region is not equal to 0. This indicates that the gradient direction distribution within the block is uniform, which means that the block is an approximate straight line edge, because the gradient direction of a straight line edge is usually consistent or presents a specific pattern. This indicates that the gradient direction distribution within the block is not uniform, which means that the block contains curvature and may therefore have a curved edge rather than a straight edge.

[0081] The variance distribution of the gradient direction of the block belongs to the sample variance of a single population, which conforms to the degree of freedom Chi-square distribution of , so we choose the chi-square statistic As the test statistic of the variance of the gradient direction of each block.

[0082] The formula for calculating the test statistic is as follows:

[0083] in is the number of samples, that is, the number of pixels in each block, is the standard deviation of the target sample, that is, the standard deviation of the gradient direction of each block; is the theoretical overall standard deviation. Here, for the straight edge feature, the overall standard deviation of the edge point gradient direction is 0.

[0084] After calculating the test statistic, a significance level is determined based on the empirical value, which indicates the probability of making a "true rejection error", that is, the gradient direction of the image region is not 0, but the algorithm identifies it as a region with a gradient direction variance of 0.

[0085] Significance Level is a key concept in hypothesis testing. It defines the risk level that the algorithm is willing to take for incorrectly rejecting the null hypothesis when the null hypothesis is true. The smaller the significance level, the harder it is to reject the null hypothesis and the larger the acceptance region. Conversely, the larger the significance level, the easier it is to reject the null hypothesis and the smaller the acceptance region.

[0086] Under large sample conditions, the chi-square distribution is infinitely close to the normal distribution. The approximate mean is , a normal distribution with variance 1 . It can be seen from this that of The quantiles are:

[0087] in, Represents the standard normal distribution Quantile.

[0088] Standard Normal Distribution Quantile The calculation formula is as follows:

[0089] In the formula, represents the cumulative distribution function of the standard normal distribution, represents the error function.

[0090] The error function can be calculated by calling the existing interface function, which can be approximated by the dichotomy method to make the standard normal cumulative distribution function value equal to of Quantile Then substitute the error function into the second equation and solve it to get of Quantile, that is, the lower limit of the gradient direction variance hypothesis test .

[0091] The calculated statistics The lower limit of the test obtained by solving the significance level For comparison. > , then it falls into the rejection region, rejects the null hypothesis, and is considered to have failed the gradient direction variance hypothesis test. ≤ , it falls into the acceptance domain, accepts the original hypothesis, and is considered to pass the gradient direction variance hypothesis test.

[0092] The block set that passes the above hypothesis test is recorded as the first area set , the set of regions that failed the hypothesis test is recorded as the second set of regions .

[0093] In this embodiment, by subdividing the first image area into a plurality of blocks, a more detailed analysis of the image can be achieved. Each block can be independently tested for hypothesis, thereby more accurately capturing the local features in the image. The gradient directional variance of the straight edge has specific characteristics, and using it as the original hypothesis helps to distinguish the straight edge area and the arc area in the image. Statistics are constructed to measure whether the sample data (i.e., the gradient directional variance of the block) supports a certain hypothesis (i.e., the gradient directional variance of the straight edge). Finally, according to the results of the hypothesis test, the blocks are divided into a first area set and a second area set.

[0094] See also Figure 5 The present application provides an embodiment of a method for determining whether there is a corner feature, the embodiment comprising: 501. If both the first sub-region set and the second sub-region set pass the second hypothesis test, calculate the absolute value of the gradient direction mean difference between the first sub-region set and the second sub-region set; 502. Determine whether the absolute value meets the corner feature; 503. If yes, determine that the second region contains corner features; 504. If not, determine that the second region set contains arc features, and discard the second region set.

[0095] Confirm the first sub-region set and the second sub-region set Both have passed the second hypothesis test, indicating that the two sub-region sets statistically meet the null hypothesis, that is, the variance of the gradient directions of the two sub-region sets is equal to 0.

[0096] However, the two sub-region sets may constitute corner features or curve features, so it is necessary to further confirm whether the two sub-region sets constitute corner features. and the second sub-region set The gradient direction mean is calculated for the first sub-region set and the second sub-region set The absolute value of the mean difference in the gradient direction of the two sub-region sets can reflect the degree of difference between the two sub-region sets in the gradient direction, that is, the angle formed by the gradient directions of the two sub-region sets.

[0097] If the absolute value of the difference in the mean gradient direction of the two sub-region sets is approximately equal to 45°, 315° (equivalent to 45°, because the gradient direction is cyclic, 360°-45°=315°), 90° or 270°, then the second region set is determined to be If the absolute value of the mean difference in the gradient direction of two sub-region sets is not equal to 45°, 315°, 90° or 270°, then the second region set is considered There may be arc features in the region, or the gradient direction change in the region is not significant enough to be identified as a corner. Since this application focuses on identifying the corner points of the corner features, the second region set is discarded. , that is, no further analysis or processing is performed on it.

[0098] In this embodiment, the sub-region set is preliminarily screened by hypothesis testing to ensure that only qualified region sets enter the subsequent gradient direction mean difference calculation stage. This helps to reduce unnecessary calculations and improve the efficiency of the overall algorithm. By calculating the absolute value of the gradient direction mean difference, the subtle differences in directional changes between regions can be accurately captured, which is crucial for distinguishing corner (sharp change in direction) and arc (smooth change in direction) features. By setting clear judgment criteria (i.e., whether it meets the corner feature, it can reduce the misjudgment of arc features as corner features, or vice versa, which helps to improve the robustness and reliability of the overall algorithm. In addition, once it is determined that the second region set contains corner features or arc features, a decision can be made immediately (keep or discard), avoiding further redundant processing.

[0099] See also Figure 6 The present application provides an embodiment of a method for obtaining a straight edge feature region, the embodiment comprising: 601. Set a rectangular degree control threshold; 602. Compare the rectangularity of each area with the rectangularity control threshold; 603. Filter out non-rectangular regions to obtain straight edge feature regions, where the non-rectangular regions are regions whose rectangularity does not meet the rectangular control threshold.

[0100] According to the image characteristics and requirements, set a reasonable rectangular control threshold. This threshold is used to determine whether the image area is rectangular or close to a rectangular shape. Compare the rectangularity of each area with the preset rectangularity control threshold. If the rectangularity is greater than or equal to the rectangularity control threshold, the area is considered to not meet the control threshold; if the rectangularity is less than the rectangularity control threshold, the area is considered to meet the control threshold.

[0101] After comparison, the areas whose rectangularity does not meet the card control threshold are regarded as non-rectangular areas. These areas have complex shapes and do not meet the characteristics of rectangles or near rectangles. Non-rectangular areas often contain a lot of noise and redundant information, and processing this information consumes a lot of computing resources.

[0102] After the non-rectangular area is removed, the rectangular area that meets the card control threshold becomes the final straight edge feature area of ​​the inner frame of the calibration plate. The straight edge feature area has a clear straight edge.

[0103] In this embodiment, by setting the rectangular degree control threshold, the region with straight edge features in the image can be accurately screened out, and the non-rectangular region can be screened out. By screening out the non-rectangular region, the method can significantly reduce the amount of image data to be processed, thereby reducing the computational complexity and improving the processing speed. Through rectangular degree control, it is possible to resist external interference factors to a certain extent, screen out regions with stable straight edge features, and thus improve the robustness of the system.

[0104] See also Figure 7 The present application provides an embodiment of a method for obtaining target straight line edge features and corner point features, the embodiment comprising: 701. Extracting a straight line skeleton in a straight line edge feature region; 702. Convert the straight line skeleton into a straight line outline; 703. Extracting target straight line edge features in the straight line profile using a straight line detection algorithm; 704. Obtain corner point features in the corner feature area according to the target straight line edge features.

[0105] The skeleton is a refined representation of the region, which retains the main shape features of the region and removes redundant information. The contour is the boundary representation of the skeleton, which contains the shape information of the target region.

[0106] The skeletonization algorithm is applied to the straight edge feature region to generate the skeleton of the region, specifically, the boundary pixels of the region are gradually peeled off until a single-pixel wide skeleton is obtained. At the same time, the contour extraction algorithm is applied to the straight edge feature region to obtain its boundary contour.

[0107] On the skeleton and contour, the straight line edge features are identified by searching for continuous and approximately straight line pixel segments. For each identified straight line, its direction, length, position and other attributes are recorded as the target straight line edge feature. The corner point is the intersection of two straight line edges in the straight line edge feature area, with significant gradient changes. Based on the two identified target straight line edge features, the specific position (coordinates) of the corner point feature is determined.

[0108] In this embodiment, the linear skeleton in the linear edge feature region is extracted, which greatly simplifies the complexity of the linear edge feature region, while retaining the main shape features, making the search and identification of linear edge features on the skeleton more efficient. Contour extraction provides a clear boundary of the target area, which helps to quickly locate and analyze linear edge features.

[0109] By searching for continuous and approximately straight pixel segments on the skeleton and contour, the straight edge features can be accurately identified. The specific position of the corner point is determined by identifying the intersection of two target straight edge features, thus achieving high-precision positioning of the corner point features.

[0110] See also Figure 8 , the present application provides a straight line edge and corner point detection device, comprising: The convolution unit 801 uses an edge detection operator to convolve the input image to obtain a gradient magnitude map and a gradient direction map; A first acquisition unit 802 sets a gradient amplitude threshold, and acquires a first image region in the gradient direction map according to the gradient amplitude threshold and the gradient amplitude map, wherein the first image region is an edge region in the gradient direction map where the gradient amplitude is significant; A filtering unit 803 filters the tiny regions in the first image region according to the connected domain analysis and the preset minimum region area; A first testing unit 804 performs a first hypothesis test on the first image region to obtain a first region set and a second region set, wherein the first region set is the region in the first image region that passes the first hypothesis test, and the second region set is the region in the first image region that fails the first hypothesis test; A second testing unit 805 is configured to divide the second region set into a first sub-region set and a second sub-region set according to the threshold segmentation, and perform a second hypothesis test on the first sub-region set and the second sub-region set respectively; A judging unit 806 , judging whether there is a corner feature in the second sub-region set if both the first sub-region set and the second sub-region set pass the second hypothesis test; Processing unit 807, if it is determined that there is a corner feature in the second region set, marks the second region set as a corner feature region and adds it to the first region set; A calculation unit 808 performs morphological dilation on the first region set and calculates the rectangularity of each region in the first region set; A screening unit 809 sets a rectangular degree control threshold, and screens out straight edge feature regions according to the rectangular degree control threshold and the rectangular degrees of each region in the first region set; The second acquisition unit 810 acquires target straight line edge features and corner point features in the straight line edge feature region according to the regional skeleton contour method.

[0111] Optionally, the convolution unit 801 includes: Convolve the input image using the x-direction convolution kernel and the y-direction convolution kernel of the edge detection operator to obtain the gradient component in the x-direction and the gradient component in the y-direction; For each pixel of the input image, the Euclidean norm of the x-direction gradient component and the y-direction gradient component of the pixel is calculated to obtain the gradient amplitude of the pixel; Integrate the gradient magnitudes of all pixels to generate a gradient magnitude map of the input image; For each pixel of the input image, calculate the inverse tangent value of its x-direction gradient component and y-direction gradient component to obtain the gradient direction of the pixel; Integrate the gradient directions of all pixels to generate the gradient direction map of the input image.

[0112] Optionally, the first acquiring unit 802 includes: Set the gradient amplitude threshold to N times the maximum gradient amplitude in the gradient amplitude map (0 <N<1); Compare the gradient magnitude of each pixel in the gradient direction map with the gradient magnitude threshold; All pixel points whose gradient magnitudes are greater than the gradient magnitude threshold are acquired to generate a first image region.

[0113] Optionally, the first inspection unit 804 includes: Dividing the first image area into a plurality of blocks; The variance of the gradient direction of each block is selected to be equal to the variance of the gradient direction of the straight edge as the original hypothesis; The test statistic is calculated based on the gradient direction variance of the block, the number of pixels, and the gradient direction variance of the straight edge; Determine a significance level, and calculate the lower limit of the test based on the number of pixels in the block and the significance level; By comparing the test statistic and the test lower limit, it is determined whether the block meets the corresponding null hypothesis; If yes, the block passes the first hypothesis test and is divided into the first region set; If not, the block fails the first hypothesis test and is divided into the second region set.

[0114] Optionally, the judging unit 806 includes: If both the first sub-region set and the second sub-region set pass the second hypothesis test, the absolute value of the mean difference in gradient direction between the first sub-region set and the second sub-region set is calculated; Determine whether the absolute value meets the corner feature; If so, it is determined that the second region set contains corner features; If not, it is determined that the second region set contains arc features, and the second region set is discarded.

[0115] Optionally, the screening unit 809 includes: Set a rectangularity control threshold; Compare the rectangularity of each area with the rectangularity control threshold; The non-rectangular area is filtered out to obtain the straight edge feature area. The non-rectangular area is the area whose rectangularity does not meet the rectangular control threshold.

[0116] Optionally, the second obtaining unit 810 includes: Extracting the straight line skeleton in the straight line edge feature area; Convert straight line skeletons into straight line outlines; Use the line detection algorithm to extract the target line edge features in the line contour; According to the target straight line edge features, the corner point features in the corner feature area are obtained.

[0117] See also Fig. 9 , the present application also provides a straight line edge and corner point detection device, comprising: Processor 901 , memory 902 , input-output unit 903 , and bus 904 .

[0118] The processor 901 is connected to the memory 902 , the input and output unit 903 , and the bus 904 .

[0119] The memory 902 stores a program, and the processor 901 calls the program to execute the following steps: Figures 1 to 7 Straight line edge and corner point detection method.

[0120] The present application provides a computer-readable storage medium, on which a program is stored, and when the program is executed on a computer, the program performs the following steps: Figures 1 to 7 Straight line edge and corner point detection method.

[0121] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working processes of the systems, devices and units described above can refer to the corresponding processes in the aforementioned method embodiments and will not be repeated here.

[0122] In the several embodiments provided in the present application, it should be understood that the disclosed systems, devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic. For example, the division of the units is only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be an indirect coupling or communication connection through some interfaces, devices or units, which can be electrical, mechanical or other forms.

[0123] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.

[0124] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.

[0125] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application is essentially or the part that contributes to the prior art or all or part of the technical solution can be embodied in the form of a software product. The computer software product is stored in a storage medium, including several instructions to enable a computer device (which can be a personal computer, server, or network device, etc.) to execute all or part of the steps of the method described in each embodiment of the present application. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, read-only memory), random access memory (RAM, random access memory), disk or optical disk and other media that can store program code.

Claims

1. A method for detecting straight line edges and corner points, characterized in that: include: Use edge detection operator to convolve the input image to obtain gradient magnitude map and gradient direction map; Setting a gradient amplitude threshold, and acquiring a first image region in the gradient direction map according to the gradient amplitude threshold and the gradient amplitude map, wherein the first image region is an edge region in the gradient direction map where the gradient amplitude is significant; Filtering tiny areas in the first image area according to the connected domain analysis and the preset minimum area; Performing a first hypothesis test on the first image region to obtain a first region set and a second region set, wherein the first region set is the region in the first image region that passes the first hypothesis test, and the second region set is the region in the first image region that fails the first hypothesis test; dividing the second region set into a first sub-region set and a second sub-region set according to threshold segmentation, and performing a second hypothesis test on the first sub-region set and the second sub-region set respectively; If both the first sub-region set and the second sub-region set pass the second hypothesis test, determining whether there is a corner feature in the second region set; If it is determined that there is a corner feature in the second region set, marking the second region set as a corner feature region and adding it to the first region set; Performing morphological dilation on the first region set, and calculating the rectangularity of each region in the first region set; Setting a rectangularity control threshold, and screening out straight edge feature regions according to the rectangularity control threshold and the rectangularity of each region in the first region set; According to the regional skeleton contour method, the target straight line edge features in the straight line edge feature region are obtained, and the corner point features are obtained by solving the straight line edge features in the corner region.

2. The method for detecting straight line edges and corner points according to claim 1, characterized in that: The method of using an edge detection operator to convolve the input image to obtain a gradient magnitude map and a gradient direction map includes: Convolve the input image using the x-direction convolution kernel and the y-direction convolution kernel of the edge detection operator to obtain the gradient component in the x-direction and the gradient component in the y-direction; For each pixel of the input image, calculating the Euclidean norm of the x-direction gradient component and the y-direction gradient component of the pixel to obtain the gradient amplitude of the pixel; Integrating the gradient magnitudes of all pixels to generate a gradient magnitude map of the input image; For each pixel of the input image, the arc tangent value of the gradient component in the x direction and the gradient component in the y direction are calculated to obtain the gradient direction of the pixel; The gradient directions of all pixels are integrated to generate a gradient direction map of the input image.

3. The method for detecting straight line edges and corner points according to claim 2, characterized in that: The step of setting a gradient amplitude threshold and acquiring a first image region in the gradient direction map according to the gradient amplitude threshold and the gradient amplitude map, wherein the first image region is an edge region in the gradient direction map where the gradient amplitude is significant, comprises: The gradient amplitude threshold is set to N times the maximum gradient amplitude in the gradient amplitude map (0 <N<1); Comparing the gradient magnitude of each pixel in the gradient direction map with the gradient magnitude threshold; All pixel points whose gradient magnitudes are greater than a gradient magnitude threshold are acquired to generate a first image region.

4. The method for detecting straight line edges and corner points according to claim 3, characterized in that: The performing a first hypothesis test on the first image region to obtain a first region set and a second region set comprises: Dividing the first image area into a plurality of blocks; The variance of the gradient direction of each block is selected to be equal to the variance of the gradient direction of the straight edge as the original hypothesis; Calculate the test statistic according to the gradient direction variance of the block, the number of pixels, and the gradient direction variance of the straight line edge; Determine a significance level, and calculate a test lower limit value according to the number of pixels in the block and the significance level; By comparing the test statistic with the test lower limit value, determining whether the block satisfies the corresponding null hypothesis; If yes, the block passes the first hypothesis test and is divided into a first region set; If not, the block fails the first hypothesis test and is divided into a second region set.

5. The method for detecting straight line edges and corner points according to claim 4, characterized in that: If both the first sub-region set and the second sub-region set pass the second hypothesis test, determining whether there is a corner feature in the second region set includes: If both the first sub-region set and the second sub-region set pass the second hypothesis test, calculating the absolute value of the mean difference in gradient direction between the first sub-region set and the second sub-region set; Determining whether the absolute value meets the corner feature; If so, determining that the second region contains corner features; If not, it is determined that the second region set contains arc features, and the second region set is discarded.

6. The straight line edge and corner point detection method according to any one of claims 1 to 5, characterized in that: The step of setting a rectangular degree control threshold and filtering out a straight edge feature region according to the rectangular degree control threshold and the rectangular degrees of each region in the first region set includes: Set a rectangularity control threshold; Comparing the rectangularity of each area with the rectangularity control threshold; The non-rectangular region is screened out to obtain a straight edge feature region, wherein the non-rectangular region is a region whose rectangularity does not meet the rectangular control threshold.

7. The straight line edge and corner point detection method according to any one of claims 1 to 5, characterized in that: The method of obtaining the target straight line edge feature in the straight line edge feature region according to the regional skeleton contour method, and solving the corner point feature according to the straight line edge feature of the corner region includes: Extracting a straight line skeleton in the straight line edge feature region; converting the straight line skeleton into a straight line profile; Extracting target straight line edge features in the straight line profile using a straight line detection algorithm; According to the target straight line edge feature, the corner point feature in the corner feature area is obtained.

8. A straight line edge and corner point detection device, characterized in that: include: The convolution unit uses the edge detection operator to convolve the input image to obtain the gradient magnitude map and the gradient direction map; A first acquisition unit is configured to set a gradient amplitude threshold and acquire a first image region in the gradient direction map according to the gradient amplitude threshold and the gradient amplitude map, wherein the first image region is an edge region in the gradient direction map where the gradient amplitude is significant; A filtering unit, filtering a tiny area in the first image area according to a connected domain analysis and a preset minimum area; a first testing unit, performing a first hypothesis test on the first image region to obtain a first region set and a second region set, wherein the first region set is the region in the first image region that passes the first hypothesis test, and the second region set is the region in the first image region that fails the first hypothesis test; a second testing unit, which divides the second region set into a first sub-region set and a second sub-region set according to threshold segmentation, and performs a second hypothesis test on the first sub-region set and the second sub-region set respectively; a judging unit, judging whether there is a corner feature in the second sub-region set if both the first sub-region set and the second sub-region set pass the second hypothesis test; The processing unit, if it is determined that there is a corner feature in the second region set, marks the second region set as a corner feature region and adds it to the first region set; a calculation unit, performing morphological dilation on the first region set, and calculating a rectangular degree of each region in the first region set; a screening unit, which sets a rectangularity control threshold, and screens out straight edge feature regions according to the rectangularity control threshold and the rectangularity of each region in the first region set; The second acquisition unit acquires target straight line edge features and corner point features in the straight line edge feature region according to a regional skeleton contour method.

9. A straight line edge and corner point detection device, characterized in that: include: Processor, memory, input-output unit, and bus; The processor is connected to the memory, the input and output unit, and the bus; The memory stores a program, and the processor calls the program to execute the straight line edge and corner point detection method according to any one of claims 1 to 7.

10. A computer-readable storage medium having a program stored thereon, wherein when the program is executed on a computer, the method for detecting straight line edges and corner points according to any one of claims 1 to 7 is executed.

Citation Information

Patent Citations

  • Port water area extraction based large port detection method for polarimetric SAR image

    CN105551049A

  • High-resolution SAR image ship detection method based on visual attention mechanism

    CN107274401A

  • Display panel frame detection method and device and electronic equipment

    CN117392127A

Cited By

  • Lithium battery positive and negative pole piece measuring method and system based on X-ray image analysis

    CN121961991A

  • Lithium battery positive and negative electrode sheet measurement method and system based on x-ray image analysis

    CN121961991B