A method, device and storage medium for detecting straight edges and corner points

By using edge detection operators and hypothesis inspection and other technical means during the automatic calibration process, the problem of difficulty in extracting straight edge and corner features in the virtual focus image is solved, and the accurate identification of the inner frame features of the calibration plate and the efficient and reliable automatic calibration are achieved.

CN119762518BActive Publication Date: 2025-06-27SHENZHEN SEICHITECH TECHN CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

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

AI Technical Summary

Technical Problem

During the automatic calibration process in the panel industry, since the calibration plate placement position and the camera plane cannot be kept fully level, and the depth of field of the precision inspection camera is small, the image is prone to dummy focus, which makes it difficult to accurately extract the linear edge and corner features, affecting the accuracy and reliability of the calibration results.

Method used

A linear edge and corner point detection method is adopted. By using an edge detection operator to convolve the input image, the gradient amplitude map and gradient direction map are obtained, the gradient amplitude threshold is set and the significant edge areas are filtered, the connection domain analysis and hypothesis testing are performed, the straight edge feature area is screened, and the target straight line edge features and corner features are obtained through the regional skeleton contour method.

Benefits of technology

This method can accurately identify the linear edges and corner features of the inner frame of the calibration plate when the image occurs in the virtual focus phenomenon, improve the accuracy and reliability of the calibration results, and ensure the stability and efficiency of the automatic calibration process.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119762518B_ABST
    Figure CN119762518B_ABST
Patent Text Reader

Abstract

The present application discloses a method, device, and storage medium for detecting straight edges and corner points, which relates to the field of machine vision technology and is used to accurately obtain straight edge and corner point features. The present application includes: performing convolution on an input image to obtain a gradient magnitude map and a gradient direction map; obtaining a first image region in the gradient direction map; performing a first hypothesis test 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 performing a second hypothesis test on both; if both pass the second hypothesis test, then calculate the absolute value of the mean difference of the gradient directions of both; determine to add the second region set to the first region set according to the absolute value; performing morphological dilation on the first region set, and calculating the rectangularity of each region; obtaining a straight edge feature region according to the rectangularity control threshold; obtaining target straight edge features and corner point features in the straight edge feature region.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

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

[0002] In the panel industry, there is a composite detection system composed of a main inspection camera and a fine inspection camera. The main inspection camera is used to detect the defect position and defect type, and the fine inspection camera is used to further determine the hierarchical position of the defect in the display screen. In order to move the defect in the field of view of the main inspection camera to the field of view of the fine inspection camera, it is necessary to calibrate the image coordinate system of the main inspection camera and the stage coordinate system. Since the field of view of the fine inspection camera is very small, only a partial area of the calibration plate can be photographed. In the existing process, an automatic calibration method based on the edge tracing of the fine inspection camera is proposed. This method identifies the straight edge features of the inner border of the calibration plate, makes the fine inspection camera trace the inner border of the calibration plate, aligns the identified corner points of the inner border during the process, records the stage position, and finally calculates the stage position where the center of the fine inspection camera aligns with each Mark point according to the physical parameters of the calibration plate to achieve automatic calibration.

[0003] During the edge tracing process, it is necessary to identify and collect the straight edge and corner point features of the inner border of the calibration plate in the captured image. However, in the actual application process, since the placement position of the calibration plate and the camera plane often cannot be kept completely horizontal, and the depth of field of the fine inspection camera is relatively small, during the shooting process, as the stage (the platform for carrying and moving the calibration plate) moves, the image is prone to defocus phenomenon.

[0004] In a defocused image, the edge is blurred and the gray level change is not obvious. The edge of the calibration plate becomes blurred, the detailed information is lost, and it is difficult to accurately judge the continuity and directionality of the edge points, resulting in difficulty in accurately extracting the straight edge and corner point features, and further affecting the accuracy and reliability of the calibration result. Summary of the Invention

[0005] In order to solve the above technical problems, this application provides a method, device, and storage medium for detecting straight edges and corner points.

[0006] The technical solutions provided in this application are described below:

[0007] The first aspect of this application provides a method for detecting straight edges and corner points, including:

[0008] Convolving the input image with an edge detection operator to obtain a gradient magnitude map and a gradient direction map;

[0009] Setting a gradient magnitude threshold, and obtaining a first image region in the gradient direction map according to the gradient magnitude threshold and the gradient magnitude map. The first image region is an edge region with significant gradient magnitude in the gradient direction map;

[0010] Filter out the tiny regions in the first image region according to the connected component analysis and a preset minimum region area;

[0011] Perform a first hypothesis test on the first image region to obtain a first region set and a second region set, where the first region set is the regions in the first image region that pass the first hypothesis test, and the second region set is the regions in the first image region that do not pass the first hypothesis test;

[0012] Divide the second region set into a first sub-region set and a second sub-region set according to threshold segmentation, and perform a second hypothesis test on the first sub-region set and the second sub-region set respectively;

[0013] If both the first sub-region set and the second sub-region set pass the second hypothesis test, then determine whether there are corner features in the second region set;

[0014] If it is determined that there are corner features in the second region set, mark the second region set as a corner feature region and add it to the first region set;

[0015] Perform morphological dilation on the first region set, and calculate the rectangularity of each region in the first region set;

[0016] Set a rectangularity control threshold, and screen out the straight edge feature regions according to the rectangularity control threshold and the rectangularity of each region in the first region set;

[0017] According to the region skeleton contour method, obtain the target straight edge features and corner features in the straight edge feature regions.

[0018] Optionally, the using an edge detection operator to convolve the input image to obtain a gradient magnitude map and a gradient direction map includes:

[0019] Use the x-direction convolution kernel and y-direction convolution kernel of the edge detection operator to convolve the input image to obtain the x-direction gradient component and the y-direction gradient component;

[0020] For each pixel point of the input image, calculate the Euclidean norm of the x-direction gradient component and the y-direction gradient component of the pixel point to obtain the gradient magnitude of the pixel point;

[0021] Integrate the gradient magnitudes of all pixel points to generate the gradient magnitude map of the input image;

[0022] For each pixel point of the input image, calculate the arctangent value of its x-direction gradient component and y-direction gradient component to obtain the gradient direction of the pixel point;

[0023] Integrate the gradient directions of all pixel points to generate the gradient direction map of the input image.

[0024] Optionally, setting the gradient magnitude threshold and obtaining the first image region in the gradient direction map according to the gradient magnitude threshold and the gradient magnitude map, where the first image region is the edge region with significant gradient magnitude in the gradient direction map, including:

[0025] Set the gradient magnitude threshold to N times (0 < N < 1) of the maximum gradient magnitude in the gradient magnitude map;

[0026] Compare the gradient magnitude of each pixel point in the gradient direction map with the gradient magnitude threshold;

[0027] Obtain all pixel points with gradient magnitudes greater than the gradient magnitude threshold to generate the first image region.

[0028] Optionally, performing a first hypothesis test on the first image region to obtain the first region set and the second region set, including:

[0029] Divide the first image region into multiple blocks;

[0030] Select that the variance of the gradient direction of each block is equal to the variance of the gradient direction of the straight edge as the null hypothesis;

[0031] Calculate the test statistic according to the variance of the gradient direction of the block, the number of pixel points, and the variance of the gradient direction of the straight edge;

[0032] Determine a significance level and calculate the lower limit of the test according to the number of pixel points in the block and the significance level;

[0033] By comparing the test statistic and the lower limit of the test, determine whether the block satisfies the corresponding null hypothesis;

[0034] If so, the block passes the first hypothesis test and is divided into the first region set;

[0035] If not, the block fails the first hypothesis test and is divided into the second region set.

[0036] Optionally, before marking the second region set as the corner feature region and adding it to the first region set after determining that the second region set contains corner features according to the absolute value, further including:

[0037] According to the absolute value, determine whether the second region set contains corner features;

[0038] If so, determine that the second region set contains corner features;

[0039] If not, determine that the second region set contains arc features and discard the second region set.

[0040] Optionally, setting a rectangularity control threshold and screening out linear edge feature regions according to the rectangularity control threshold and the rectangularity of each region in the first region set includes:

[0041] Set a rectangularity control threshold;

[0042] Compare the rectangularity of each region with the rectangularity control threshold;

[0043] Screen out non-rectangular regions to obtain linear edge feature regions, where the non-rectangular regions are regions whose rectangularity does not meet the rectangular control threshold.

[0044] Optionally, according to the region skeleton contour method, obtaining the target linear edge features and corner features in the linear edge feature regions includes:

[0045] Extract the linear skeleton in the linear edge feature regions;

[0046] Convert the linear skeleton into a linear contour;

[0047] Use a line detection algorithm to extract the target linear edge features in the linear contour;

[0048] Obtain the corner features in the corner feature regions according to the target linear edge features.

[0049] The second aspect of the present application provides a distance-based stimulus value calibration device, including:

[0050] A convolution unit that convolves an input image using an edge detection operator to obtain a gradient magnitude map and a gradient direction map;

[0051] A first acquisition unit that sets a gradient magnitude threshold and obtains a first image region in the gradient direction map according to the gradient magnitude threshold and the gradient magnitude map, where the first image region is an edge region with significant gradient magnitude in the gradient direction map;

[0052] A filtering unit that filters out small regions in the first image region according to connected component analysis and a preset minimum region area;

[0053] A first inspection unit that performs a first hypothesis test on the first image region to obtain a first region set and a second region set, where 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;

[0054] The second inspection unit 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;

[0055] The judgment unit determines whether there is a corner feature in the second region set if both the first sub-region set and the second sub-region set pass the second hypothesis test;

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

[0057] The calculation unit performs morphological dilation on the first region set and calculates the rectangularity of each region in the first region set;

[0058] The screening unit sets a rectangularity control threshold and screens out linear edge feature regions according to the rectangularity control threshold and the rectangularity of each region in the first region set;

[0059] The second acquisition unit obtains the target linear edge feature and corner feature in the linear edge feature region according to the region skeleton contour method.

[0060] Optionally, the convolution unit includes:

[0061] Convolve the input image with the x-direction convolution kernel and 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;

[0062] For each pixel point of the input image, calculate the Euclidean norm of the gradient component in the x direction and the gradient component in the y direction of the pixel point to obtain the gradient magnitude of the pixel point;

[0063] Integrate the gradient magnitudes of all pixel points to generate the gradient magnitude map of the input image;

[0064] For each pixel point of the input image, calculate the arctangent value of its gradient component in the x direction and the gradient component in the y direction to obtain the gradient direction of the pixel point;

[0065] Integrate the gradient directions of all pixel points to generate the gradient direction map of the input image.

[0066] Optionally, the first acquisition unit includes:

[0067] Set the gradient magnitude threshold to N times the maximum gradient magnitude in the gradient magnitude map (0 < N < 1);

[0068] Compare the gradient magnitude of each pixel point in the gradient direction map with the gradient magnitude threshold;

[0069] Obtain all pixel points whose gradient magnitudes are greater than the gradient magnitude threshold to generate a first image region.

[0070] Optionally, the first inspection unit includes:

[0071] Divide the first image region into multiple blocks;

[0072] Select that the variance of the gradient direction of each block is equal to the variance of the gradient direction of the straight edge as the null hypothesis;

[0073] Calculate the test statistic according to the variance of the gradient direction of the block, the number of pixel points, and the variance of the gradient direction of the straight edge;

[0074] Determine a significance level and calculate the test lower limit value according to the number of pixel points of the block and the significance level;

[0075] By comparing the test statistic and the test lower limit value, determine whether the block meets the corresponding null hypothesis;

[0076] If so, the block passes the first hypothesis test and is divided into a first region set;

[0077] If not, the block fails the first hypothesis test and is divided into a second region set.

[0078] Optionally, the judgment unit includes:

[0079] If both the first sub-region set and the second sub-region set pass the second hypothesis test, calculate the absolute value of the difference in the mean gradient direction between the first sub-region set and the second sub-region set;

[0080] Judge whether the absolute value conforms to the corner feature;

[0081] If so, determine that the second region set contains corner features;

[0082] If not, determine that the second region set contains arc features and discard the second region set.

[0083] Optionally, the screening unit includes:

[0084] Set a rectangularity control threshold;

[0085] Compare the rectangularity of each region with the rectangularity control threshold;

[0086] Screen 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.

[0087] Optionally, the second acquisition unit includes:

[0088] Extract the straight-line skeleton in the straight-edge feature region;

[0089] Convert the straight-line skeleton into a straight-line contour;

[0090] Use a straight-line detection algorithm to extract the target straight-edge features in the straight-line contour;

[0091] Obtain the corner features in the corner feature region according to the target straight-edge features.

[0092] A third aspect of the present application provides a distance-based stimulus value calibration device, including:

[0093] A processor, a memory, an input / output unit, and a bus;

[0094] The processor is connected to the memory, the input / output unit, and the bus;

[0095] The memory stores a program, and the processor calls the program to execute the stimulus value calibration method in the first aspect and any optional one of the first aspect.

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

[0097] It can be seen from the above technical solutions that the present application has the following advantages:

[0098] By convolving the input image with an edge detection operator, the gray-scale changes in the image can be accurately captured, and a gradient magnitude map and a gradient direction map can be obtained based on the gray-scale changes. Setting a gradient magnitude threshold can further screen out the edge regions (the first image region) with significant gradient magnitudes, reduce the interference of noise and irrelevant details, and improve the accuracy of edge detection.

[0099] By analyzing the connected components and filtering out the tiny regions in the first image region based on a preset minimum region area, the unimportant edges caused by noise or image details can be removed, making the subsequent processing more efficient and accurate. Hypothesis testing is performed on the first image region, dividing the region into two parts: those passing the test and those failing the test, and efficiently identifying the regions containing straight edges. Further segmentation and hypothesis testing are carried out on the regions that fail the first hypothesis test, which can effectively distinguish corner features and arc features, while improving the robustness of corner detection and reducing the cases of missed detection and false detection. By determining whether there are corner features in the second region set and marking the regions with corner features as corner feature regions and adding them to the first region set, this provides a theoretical support for subsequent corner feature localization.

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

[0101] Multiple hypothesis testing steps reduce the computational amount and complexity of subsequent processing and improve the overall processing efficiency. At the same time, it ensures that when the input image has a defocus phenomenon, the system can still accurately identify the edges and corner features of the inner border of the calibration plate, and also provides strong support for subsequent image processing and calibration work. Brief Description of the Drawings

[0102] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the following will briefly introduce the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings in the following description are only some embodiments of the present application. For those of ordinary skill in the art, without creative efforts, other drawings can be obtained based on these drawings.

[0103] Figure 1 Schematic diagram of an embodiment of the straight edge and corner detection method of the present application;

[0104] Figure 2 Schematic diagram of an embodiment of the method for obtaining the gradient magnitude map and gradient direction map of the present application;

[0105] Figure 3 Schematic diagram of an embodiment of the method for obtaining the first image region of the present application;

[0106] Figure 4Schematic diagram of an embodiment of the method for the first hypothesis test of this application;

[0107] Figure 5 Schematic diagram of an embodiment of the method for determining whether there are corner features in this application;

[0108] Figure 6 Schematic diagram of an embodiment of the method for obtaining a linear edge feature region in this application;

[0109] Figure 7 Schematic diagram of an embodiment of the method for obtaining target linear edge features and corner features in this application;

[0110] Figure 8 Schematic diagram of a structure of the linear edge and corner detection device of this application;

[0111] Figure 9 Schematic diagram of another structure of the linear edge and corner detection device of this application;

[0112] Figure 10 Schematic diagram of three edge features of this application;

[0113] Figure 11 Schematic diagram of three edge features during defocus of this application;

[0114] Figure 12 Schematic diagram of the extraction results of edges and corners when not defocused in this application;

[0115] Figure 13 Schematic diagram of the extraction results of edges and corners during defocus of this application. Detailed implementation manners

[0116] In the following description, specific details such as specific system structures and technologies are presented for the purpose of illustration rather than limitation, so as to thoroughly understand the embodiments of this application. However, those skilled in the art should clearly understand that this application can 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 avoid unnecessary details from interfering with the description of this application.

[0117] It should be understood that when used in the specification of this application and the appended claims, the term "comprising" indicates the presence of the 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 their combinations.

[0118] It should also be understood that the term "and / or" as used in the specification and appended claims of this application refers to any combination and all possible combinations of one or more of the associated listed items, and includes these combinations.

[0119] As used in the specification and appended claims of this application, the term "if" may be construed, depending on the context, as "when", "once", "in response to determining", or "in response to detecting". Similarly, the phrases "if determined" or "if [the described condition or event] is detected" may be construed, depending on the context, to mean "once determined", "in response to determining", "once [the described condition or event] is detected", or "in response to detecting [the described condition or event]".

[0120] In addition, in the description of the specification and appended claims of this application, the terms "first", "second", "third", etc. are only used for distinguishing descriptions and cannot be construed as indicating or implying relative importance.

[0121] Reference to "one embodiment" or "some embodiments" or the like described in the specification of this application means that a specific feature, structure, or characteristic described in connection with that embodiment is included in one or more embodiments of this application. Thus, statements such as "in one embodiment", "in some embodiments", "in other some embodiments", "in still other embodiments", etc. that appear in different places in this specification do not necessarily all refer to the same embodiment, but mean "one or more but not all embodiments", unless otherwise specifically emphasized in other ways. The terms "comprising", "including", "having", and their variants all mean "including but not limited to", unless otherwise specifically emphasized in other ways.

[0122] An automatic calibration method based on edge inspection by a precision inspection camera is proposed in the existing process. This method identifies the straight edge features of the inner border of the calibration plate, enables the precision inspection camera to perform edge inspection along the inner border of the calibration plate, aligns the recognized inner border corner points during the process, records the stage position, and finally calculates the stage position where the center of the precision inspection camera aligns with each Mark point according to the physical parameters of the calibration plate to achieve automatic calibration.

[0123] During the edge inspection process, it is necessary to identify the straight edge and corner point features of the inner border of the calibration plate in the acquired image. However, in the actual application process, since the placement position of the calibration plate and the camera image plane often cannot be kept completely horizontal, and the depth of field of the precision inspection camera is relatively small, during the shooting process, as the stage (the platform for carrying and moving the calibration plate) moves, the image is prone to defocus.

[0124] In a defocused image, the edge blurs and the gray level change is not obvious. The edge of the calibration board becomes blurred, and the detailed information is lost. It is difficult to accurately judge the continuity and directionality of edge points, resulting in difficulty in accurately extracting the straight edge and corner features, which in turn affects the accuracy and reliability of the calibration result.

[0125] Based on this, the present application discloses a method, device, and storage medium for detecting straight edges and corners, which are used to accurately obtain the straight edge and corner features of the inner border of the calibration board.

[0126] Next, the technical solutions in the present application will be clearly and completely described in conjunction with the accompanying drawings in the embodiments of the present application. Obviously, the described embodiments are only a part of the embodiments of the present application, rather than all the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those of ordinary skill in the art without creative efforts shall fall within the protection scope of the present application.

[0127] The method of the present application can be applied to a server, device, terminal, or other device with logical processing capabilities. The present application does not make any limitation thereto. For convenience of description, the following description will be made taking the execution entity as a terminal as an example.

[0128] Please refer to Figure 1 , an embodiment of a method for detecting straight edges and corners provided by the present application includes:

[0129] 101. Convolve the input image using an edge detection operator to obtain a gradient magnitude map and a gradient direction map;

[0130] An edge detection operator is a type of filter used to calculate the gradient of an image. The edge detection operator can be selected from the Sobel operator, Prewitt operator, Canny edge detector, etc. These edge detection operators contain one or more pairs of convolution kernels for calculating the gradient components in the x-direction and y-direction respectively.

[0131] The gradient magnitude represents the rate or intensity of the change in the gray level value of the pixel points in the image. The gradient direction represents the direction in which the gray level value of the pixel points changes fastest. After obtaining the input image by shooting the calibration board with a precision inspection camera, use a suitable edge detection operator to convolve the input image to obtain the gradient magnitude map and gradient direction map corresponding to the input image.

[0132] 102. Set a gradient magnitude threshold, and obtain a first image region in the gradient direction map according to the gradient magnitude threshold and the gradient magnitude map;

[0133] In the gradient direction map obtained by processing with the edge detection operator, there are still some edge regions with significant gradient magnitudes (i.e., drastic gray level changes), and the edge regions contain straight edge and corner features.

[0134] First, set a suitable gradient magnitude threshold, which can be a multiple of the maximum gradient magnitude in the gradient magnitude map. By comparing the gradient magnitude threshold with the gradient magnitudes of each pixel point in the gradient magnitude map, some edge regions with drastic gray-scale changes can be distinguished. Locate the corresponding edge regions in the gradient direction map and extract the edge regions in the gradient direction map to obtain the first image region.

[0135] 103. Filter out the tiny regions in the first image region according to the connected component analysis and a preset minimum region area;

[0136] After obtaining the first image region, perform connected component analysis on the first image region to identify all the connected regions in the first image region. Each connected region consists of a group of interconnected pixels, which form a continuous block in the image.

[0137] After performing connected component analysis, set a threshold, i.e., the minimum region area. The minimum region area is used to determine which regions are regarded as tiny regions and should be filtered out, and which regions are regarded as important and need to be retained. According to the set minimum region area threshold, traverse all the identified connected regions. For regions with an area smaller than the minimum region area, regard them as tiny regions and filter them out. The filtering operation can be to set the pixel values of the tiny regions to the background color. For regions with an area greater than or equal to the minimum region area, they are retained.

[0138] 104. Conduct the first hypothesis test on the first image region to obtain the first region set and the second region set;

[0139] The gradient direction variances of different edge features are different. The points on a straight edge have the same gradient direction because the edge is straight and perpendicular to the gradient direction. Theoretically, the variance of the gradient direction distribution of all points on the straight edge is approximately equal to 0 (or very small). The points on a circular arc edge have continuously changing gradient directions because the edge is curved, and the variance of the gradient direction distribution of points within the circular arc edge region will be relatively large and not equal to 0. Therefore, the straight edge feature and the circular arc edge feature can be distinguished according to the gradient direction variance of the edge feature.

[0140] The first hypothesis test is to conduct a hypothesis test on each region in the first image region based on the gradient direction variance of the edge feature by assuming that the gradient direction variance of the edge feature is 0, and divide the first image region into the first region set and the second region set.

[0141] 105. Divide the second region set into the first sub-region set and the second sub-region set according to threshold segmentation, and conduct the second hypothesis test on the first sub-region set and the second sub-region set respectively;

[0142] After obtaining the second region set through step 104, solve the average gradient direction of the second region set, and based on the calculated average gradient direction.

[0143] Set an appropriate threshold. According to this threshold, divide the second region set that fails the hypothesis test into two sub-region sets with different average gradient directions. Specifically, traverse each pixel point in the second region set, determine whether the difference between its gradient direction and the average value is greater than or less than the threshold, and classify the pixel points into different sub-region sets according to the judgment results, namely the first sub-region set and the second sub-region set.

[0144] After dividing the two sub-region sets, conduct a second hypothesis test on the two sub-region sets respectively. The second hypothesis test is similar to the first hypothesis test, both of which are based on the gradient direction variance of the edge features to conduct 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.

[0145] 106. If both the first sub-region set and the second sub-region set pass the second hypothesis test, then determine whether there are corner features in the second region set;

[0146] 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 (0 or close to 0) in the gradient direction variance of the edge features in the two sub-region sets, indicating that there may be corner features in the second region set. Analyze the first sub-region set and the second sub-region set to determine whether the second region set contains corner features.

[0147] 107. If it is determined that there are corner features in the second region set, mark the second region set as a corner feature region and add it to the first region set;

[0148] Through step 106, it is possible to determine whether the second region set contains corner features. Once it is determined that there are corner features in the second region set, the second region set needs to be marked to clarify that the region of the second region set containing corner features is a corner feature region. The marking can be achieved through various methods such as image annotation, data labeling, indexing, or identifiers.

[0149] Integrate the marked corner feature region 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.

[0150] 108. Perform morphological dilation on the first region set and calculate the rectangularity of each region in the first region set;

[0151] Morphological dilation is an image processing operation based on set theory. It uses a probe called a structuring element to scan the image. The structuring element is selected to be slightly larger than the minimum feature size in the first region set to ensure an effective dilation effect.

[0152] The dilation operation acts to fill small holes, connect adjacent regions, or slightly expand the region boundaries by matching the structuring element with each pixel position in the first region set. After the dilation operation, each region in the first region set will change.

[0153] Rectangularity is an index that measures how closely the shape of a region resembles a rectangle. It is defined as the ratio of the area of the region to the area of its minimum bounding rectangle. The value of rectangularity ranges between 0 and 1. A completely rectangular region has a rectangularity of 1, while a non-rectangular region has a lower rectangularity value.

[0154] The rectangularity of each region after dilation is calculated based on the minimum bounding rectangle and the area of each region in the first region set. The calculation formula is as follows:

[0155]

[0156] In the formula, is the area of each region, is the area of the minimum bounding rectangle of the first region set.

[0157] 109. Set a rectangularity control threshold and screen out the straight-edge feature regions according to the rectangularity control threshold and the rectangularity of each region in the first region set;

[0158] Set a reasonable rectangularity control threshold, which is used to distinguish the regions with straight-edge features from other non-rectangular regions.

[0159] In the above step 108, the rectangularity of each region in the first region set has been calculated. Compare the rectangularity of each region with the set threshold. If the rectangularity is greater than or equal to the threshold, it is considered that the region has straight-edge features; otherwise, it is considered that the region does not meet the requirements. According to the comparison results, mark all the regions with straight-edge features.

[0160] 110. According to the region skeleton contour method, obtain the target straight-edge features and corner features in the straight-edge feature regions.

[0161] Adopt a thinning algorithm to extract the straight skeleton of the straight-edge feature region, and then perform contour processing on the extracted skeleton to form a clear and continuous straight contour. Use a straight-line detection algorithm to analyze the straight contour, accurately identify and extract the target straight-edge features. Finally, by calculating the intersection points of the target straight-edge features, accurately identify the corner features.

[0162] In this embodiment, by convolving the input image using an edge detection operator, the gray-scale changes in the image can be accurately captured, and a gradient magnitude map and a gradient direction map can be obtained based on the gray-scale changes. Setting a gradient magnitude threshold can further screen out the edge regions (the first image regions) with significant gradient magnitudes, reduce the interference of noise and irrelevant details, and improve the accuracy of edge detection.

[0163] By performing connected component analysis and filtering out the small regions in the first image region with a preset minimum region area, the unimportant edges caused by noise or image details can be removed, making the subsequent processing more efficient and accurate. Performing a hypothesis test on the first image region divides the region into two parts that pass and fail the test, efficiently identifying the regions containing straight edges. Further segmenting and performing hypothesis tests on the regions that fail the first hypothesis test can effectively distinguish corner features and arc features, improve the robustness of corner detection, and reduce the cases of missed detection and false detection. By determining whether there are corner features in the second region set and marking the regions with corner features as corner feature regions and adding them to the first region set, this provides a theoretical support for subsequent corner feature localization.

[0164] Performing morphological dilation and rectangularity calculation on the first region set can further screen out the regions with straight edge features. By setting a rectangularity control threshold, the straight edges of the inner border of the calibration plate can be accurately identified, providing a reliable basis for subsequent corner extraction. Using the region skeleton contour method to obtain the target straight edge features and corner features in the straight edge feature region, this method can intuitively reflect the geometric shape of the edge, making the straight features and corner features more intuitive and simple.

[0165] The multiple hypothesis test steps reduce the computational amount and complexity of the subsequent processing, improve the overall processing efficiency. At the same time, it ensures that when the input image has a defocus phenomenon, the system can still accurately identify the edges and corner features of the inner border of the calibration plate, and also provides strong support for subsequent image processing and calibration work. The specific edge and corner extraction results can be referred to Figure 12 and Figure 13 , in the figure, the yellow wireframe is the enlarged border of the corner feature region, the yellow dotted line is the enlarged auxiliary line, and the red dots are the corner features obtained by this method; the red line segment and the green line segment are the target straight edge features obtained by this method; specifically, the red line segment is the target straight edge feature of the upper edge, and the green line segment is the target straight edge feature of the left edge. To distinguish the two different target straight edge features, they are distinguished by red and green.

[0166] Please refer to Figure 2, this application provides an embodiment of a method for obtaining a gradient magnitude map and a gradient direction map, and this embodiment includes:

[0167] 201. Convolve the input image with 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;

[0168] 202. For each pixel point of the input image, calculate the Euclidean norm of the gradient component in the x direction and the gradient component in the y direction of the pixel point to obtain the gradient magnitude of the pixel point;

[0169] 203. Integrate the gradient magnitudes of all pixel points to generate the gradient magnitude map of the input image;

[0170] 204. For each pixel point of the input image, calculate the arctangent value of its gradient component in the x direction and the gradient component in the y direction to obtain the gradient direction of the pixel point;

[0171] 205. Integrate the gradient directions of all pixel points to generate the gradient direction map of the input image.

[0172] The x-direction convolution kernel is a horizontal filter in the edge detection operator for detecting horizontal edges. Similarly, the y-direction convolution kernel is a vertical filter in the edge detection operator for detecting vertical edges. Apply these two convolution kernels to each pixel of the input image to calculate the convolution, and obtain two output images, one is the gradient component image in the x direction, and the other is the gradient component image in the y direction.

[0173] For each pixel point of the input image, obtain the gradient magnitude by calculating the Euclidean norm (i.e., the Pythagorean theorem) of the gradient component in the x direction or the y direction of the pixel point. Integrate the gradient magnitudes of the gradient components in the x direction and the y direction of all pixel points to form a new image, that is, the gradient magnitude map.

[0174] For each pixel point of the input image, obtain the gradient direction by calculating the arctangent value of the gradient component in the x direction and the gradient component in the y direction of the pixel point. Integrate the gradient directions of all pixel points to form a new image, that is, the gradient direction map. This image reflects the edge direction of each pixel point in the input image.

[0175] 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 magnitude is obtained by calculating the Euclidean norm of the gradient component in the x direction and the gradient component in the y direction, and the gradient magnitude can reflect the edge strength of each pixel point in the image.

[0176] The gradient magnitude map can clearly show the edge positions in the image. By integrating the gradient magnitudes of all pixels to generate the 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.

[0177] Please refer to Figure 3 , this application provides an embodiment of a method for obtaining a first image region, and this embodiment includes:

[0178] 301. Set the gradient magnitude threshold to N times (0 < N < 1) of the maximum gradient magnitude in the gradient magnitude map;

[0179] 302. Compare the gradient magnitude of each pixel in the gradient direction map with the gradient magnitude threshold;

[0180] 303. Obtain all pixels with gradient magnitudes greater than the gradient magnitude threshold, and generate a first image region.

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

[0182] Traverse each pixel in the gradient magnitude map and extract the corresponding gradient magnitude of each pixel. Compare the gradient magnitude of each pixel with the calculated gradient magnitude threshold to determine whether the pixel belongs to the region with significant edge features. For all pixels with gradient magnitudes greater than the gradient magnitude threshold, consider them as pixels with significant edge features and include them in the first image region. By integrating all the filtered pixels, the first image region is constructed. This region contains all the pixels with significant edge features in the image and is the basis for subsequent image processing and analysis.

[0183] In this embodiment, by setting a reasonable gradient magnitude threshold, the region with significant edge features in the image can be accurately filtered out, reducing the interference of noise and irrelevant details. By simply comparing operations to filter out the pixels with significant edge features, complex calculation processes are avoided, and the efficiency of image processing is improved. The first image region contains the most important edge feature information in the image and provides a data basis for subsequent image processing.

[0184] Please refer to Figure 4 , this application provides an embodiment of a method for the first hypothesis test, and this embodiment includes:

[0185] 401. Divide the first image region into multiple blocks;

[0186] 402. Select that the variance of the gradient direction of each block is equal to the variance of the gradient direction of the straight edge as the null hypothesis;

[0187] 403. Calculate the test statistic according to the variance of the gradient direction of the block, the number of pixel points, and the variance of the gradient direction of the straight edge;

[0188] 404. Determine a significance level, and calculate the lower limit of the test according to the number of pixel points of the block and the significance level;

[0189] 405. By comparing the test statistic and the lower limit of the test, determine whether the block meets the corresponding null hypothesis;

[0190] 406. If so, the block passes the first hypothesis test and is divided into the first region set;

[0191] 407. If not, the block fails the first hypothesis test and is divided into the second region set.

[0192] First, divide the first image region into multiple blocks to facilitate subsequent hypothesis testing.

[0193] Hypothesis testing is a method used in statistics to judge statistical inferences. Hypothesis testing analyzes sample data to determine whether a hypothesis about population parameters holds. The basic idea of hypothesis testing is the "small probability event" principle. A small probability event is almost impossible to occur in one trial. If a small probability event occurs in one trial, then there is reason to doubt the correctness of the null hypothesis and thus 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 two groups of samples, which is the hypothesis that the researcher wants to refute; while the alternative hypothesis indicates that there is a change or a difference, which is the hypothesis that the researcher wants to prove.

[0194] Set the null hypothesis to be that the variance of the gradient direction of each block in the first image region is equal to 0. The alternative hypothesis is that the variance of the gradient direction of each block in the first image region is not equal to 0. The null hypothesis indicates that the distribution of the gradient direction within the block is uniform, meaning that the block is an approximate straight edge, because the gradient direction of a straight edge is usually relatively consistent or presents a specific pattern. The alternative hypothesis It shows that the gradient direction distribution within the block is not uniform, meaning that the block contains curvature and may therefore be a curved edge rather than a straight edge.

[0195] The variance distribution of the gradient direction of the block belongs to the sample variance of a single population, which conforms to the chi-square distribution with degrees of freedom , so the chi-square statistic is selected as the test statistic for the variance of the gradient direction of each block.

[0196] The calculation formula of the test statistic is as follows:

[0197]

[0198] where is the sample size, that is, the number of pixel points 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 standard deviation of the theoretically overall population. Here, for the straight edge feature, the overall standard deviation of the gradient direction of its edge points is 0.

[0199] After calculating the test statistic, determine a significance level according to the empirical value, which represents the probability of making a "false rejection error", that is, the gradient direction of the image area is not 0, but the algorithm determines it as an area with a gradient direction variance of 0.

[0200] The significance level is a key concept in hypothesis testing. It defines the risk level that the algorithm is willing to take to wrongly reject the null hypothesis when the null hypothesis is true. The smaller the significance level, the more difficult 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.

[0201] Under the condition of large samples, the chi-square distribution is infinitely approximated to the normal distribution, approximately follows the normal distribution with a mean of and a variance of 1 . It can be seen from this that of the quantile is:

[0202]

[0203] where, represents the quantile of the standard normal distribution.

[0204] The quantile of the standard normal distribution is calculated as follows:

[0205]

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

[0207] The error function can be calculated by calling an existing interface function, and thus the quantile at which the value of the standard normal cumulative distribution function is equal to can be approximated by the bisection method. Then, substitute the error function into the second formula to solve for the quantile of , which is the lower limit value of the gradient direction variance hypothesis test.

[0208] Compare the calculated statistic with the lower limit value of the test obtained by solving from the significance level. > , if ≤ , then it falls into the acceptance region, the null hypothesis is accepted, and it is considered to pass the gradient direction variance hypothesis test.

[0209] Denote the block set that passes the above hypothesis test as the first region set , and denote the region set that fails the hypothesis test as the second region set .

[0210] In this embodiment, by subdividing the first image region into multiple blocks, more detailed analysis of the image can be achieved. Each block can independently perform a hypothesis test, thereby more accurately capturing local features in the image. The gradient direction variance of the straight edge has specific characteristics. Taking it as the null hypothesis helps to distinguish the straight edge region and the circular arc region in the image. A statistic is constructed to measure whether the sample data (i.e., the gradient direction variance of the block) supports a certain hypothesis (i.e., the gradient direction variance of the straight edge). Finally, according to the results of the hypothesis test, the blocks are divided into the first region set and the second region set.

[0211] Please refer to Figure 5 , this application provides an embodiment of a method for determining whether there is a corner feature, and this embodiment includes:

[0212] 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 difference in the mean gradient direction between the first sub-region set and the second sub-region set;

[0213] 502. Determine whether the absolute value conforms to the corner feature;

[0214] 503. If so, it is determined that the second region set contains corner features.

[0215] 504. If not, it is determined that the second region set contains arc features, and the second region set is discarded.

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

[0217] However, the two sub-region sets may either form corner features or curve features, so it is necessary to further confirm whether the two sub-region sets form corner features. According to the first sub-region set and the second sub-region set 's mean gradient direction, calculate the absolute value of the difference in the mean gradient directions of the first sub-region set and the second sub-region set respectively. The absolute value between them can reflect the degree of difference in the gradient directions of the two sub-region sets, that is, the angle formed by the gradient directions of the two sub-region sets.

[0218] If the absolute value of the difference in the mean gradient directions of the two sub-region sets is approximately equal to 45°, 315° (which is equivalent to 45° because the gradient direction is cyclic, 360° - 45° = 315°), 90° or 270°, then it is determined that there are corner features in the second region set . If the absolute value of the difference in the mean gradient directions of the two sub-region sets is not equal to one of 45°, 315°, 90° or 270°, then it is considered that the second region set may contain arc features, or the change in the gradient direction of this region is not significant enough to be recognized as a corner. Since this application focuses on identifying the corner points where corner features are located, the second region set is discarded, that is, it is no longer further analyzed or processed.

[0219] In this embodiment, the sub-region set is preliminarily screened through hypothesis testing to ensure that only the qualified region set enters the subsequent calculation stage of the mean difference of gradient directions. This helps reduce unnecessary calculations and improve the efficiency of the overall algorithm. By calculating the absolute value of the mean difference of gradient directions, the subtle differences in the directional changes between regions can be accurately captured, which is crucial for distinguishing corner (sharp directional changes) and arc (smooth directional changes) features. By setting clear judgment criteria (i.e., whether it conforms to the corner feature), the misjudgment of arc features as corner features or vice versa can be reduced, which helps 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 (retain or discard) can be made immediately, avoiding further redundant processing.

[0220] Please refer to Figure 6 , this application provides an embodiment of a method for obtaining a straight-edge feature region, and this embodiment includes:

[0221] 601. Set a rectangularity control threshold;

[0222] 602. Compare the rectangularity of each region with the rectangularity control threshold;

[0223] 603. Screen out non-rectangular regions to obtain the straight-edge feature region, and the non-rectangular region is a region whose rectangularity does not meet the rectangularity control threshold.

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

[0225] After comparison, the regions whose rectangularity does not meet the control threshold are regarded as non-rectangular regions. The shapes of these regions are complex and do not conform to the characteristics of a rectangle or a shape close to a rectangle. Non-rectangular regions often contain a large amount of noise and redundant information, and processing this information consumes a large amount of computing resources.

[0226] After screening out the non-rectangular regions, the rectangular regions whose regions meet the control threshold become the straight-edge feature regions of the inner border of the calibration plate. The straight-edge feature regions have clear straight edges.

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

[0228] Please refer to Figure 7 , this application provides an embodiment of a method for obtaining target straight edge features and corner features. This embodiment includes:

[0229] 701. Extract the straight skeleton in the straight edge feature region;

[0230] 702. Convert the straight skeleton into a straight contour;

[0231] 703. Use a straight line detection algorithm to extract the target straight edge features in the straight contour;

[0232] 704. Obtain the corner features in the corner feature region according to the target straight edge features.

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

[0234] Apply a skeletonization algorithm to the straight edge feature region to generate the skeleton of this region. Specifically, gradually strip the boundary pixels of the region until a single-pixel-wide skeleton is obtained. At the same time, apply a contour extraction algorithm to the straight edge feature region to obtain its boundary contour.

[0235] On the skeleton and contour, identify the straight edge features by searching for continuous and approximately straight pixel segments. For each identified straight line, record its attributes such as direction, length, and position as the target straight edge features. A corner is the intersection of two straight edge features in the straight edge feature region and has a significant gradient change. Determine the specific position (coordinates) of the corner feature according to the two identified target straight edge features.

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

[0237] By searching for continuous and approximately straight pixel segments on the skeleton and contour, the straight-edge features can be accurately identified. By identifying the intersection points of two target straight-edge features, the specific positions of the corner points are determined, achieving high-precision positioning of the corner features.

[0238] Please refer to Figure 8 , this application provides a straight-edge and corner detection device, including:

[0239] A convolution unit 801 that convolves the input image using an edge detection operator to obtain a gradient magnitude map and a gradient direction map;

[0240] A first acquisition unit 802 that sets a gradient magnitude threshold and obtains a first image region in the gradient direction map according to the gradient magnitude threshold and the gradient magnitude map. The first image region is an edge region with significant gradient magnitude in the gradient direction map;

[0241] A filtering unit 803 that filters out small regions in the first image region according to connected component analysis and a preset minimum region area;

[0242] A first verification unit 804 that performs a first hypothesis test on the first image region to obtain a first region set and a second region set. The first region set is the regions in the first image region that pass the first hypothesis test, and the second region set is the regions in the first image region that do not pass the first hypothesis test;

[0243] A second verification unit 805 that 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;

[0244] A judgment unit 806 that, if both the first sub-region set and the second sub-region set pass the second hypothesis test, determines whether there are corner features in the second region set;

[0245] A processing unit 807 that, if it is determined that there are corner features in the second region set, marks the second region set as a corner feature region and adds it to the first region set;

[0246] A calculation unit 808 that performs morphological dilation on the first region set and calculates the rectangularity of each region in the first region set;

[0247] A screening unit 809 that 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;

[0248] A second acquisition unit 810 that obtains the target straight-edge features and corner features in the straight-edge feature regions according to the region skeleton contour method.

[0249] Optionally, the convolution unit 801 includes:

[0250] Convolve the input image with the x-direction convolution kernel and 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;

[0251] For each pixel point in the input image, calculate the Euclidean norm of the gradient component in the x direction and the gradient component in the y direction of the pixel point to obtain the gradient magnitude of the pixel point;

[0252] Integrate the gradient magnitudes of all pixel points to generate a gradient magnitude map of the input image;

[0253] For each pixel point in the input image, calculate the arctangent value of its gradient component in the x direction and the gradient component in the y direction to obtain the gradient direction of the pixel point;

[0254] Integrate the gradient directions of all pixel points to generate a gradient direction map of the input image.

[0255] Optionally, the first acquisition unit 802 includes:

[0256] Set the gradient magnitude threshold to N times the maximum gradient magnitude in the gradient magnitude map (0 < N < 1);

[0257] Compare the gradient magnitude of each pixel point in the gradient direction map with the gradient magnitude threshold;

[0258] Obtain all pixel points whose gradient magnitudes are greater than the gradient magnitude threshold to generate a first image region.

[0259] Optionally, the first verification unit 804 includes:

[0260] Divide the first image region into multiple blocks;

[0261] Select that the gradient direction variance of each block is equal to the gradient direction variance of the straight edge as the null hypothesis;

[0262] Calculate the test statistic according to the gradient direction variance of the block, the number of pixel points, and the gradient direction variance of the straight edge;

[0263] Determine a significance level and calculate the test lower limit value according to the number of pixel points in the block and the significance level;

[0264] By comparing the test statistic and the test lower limit value, determine whether the block meets the corresponding null hypothesis;

[0265] If so, the block passes the first hypothesis test and is divided into a first region set;

[0266] If not, the block fails the first hypothesis test and is divided into a second region set.

[0267] Optionally, the determination unit 806 includes:

[0268] If both the first sub-region set and the second sub-region set pass the second hypothesis test, calculate the absolute value of the mean difference in gradient directions between the first sub-region set and the second sub-region set;

[0269] Determine whether the absolute value conforms to the corner feature;

[0270] If so, determine that the second region set contains a corner feature;

[0271] If not, determine that the second region set contains an arc feature and discard the second region set.

[0272] Optionally, the screening unit 809 includes:

[0273] Set a rectangularity control threshold;

[0274] Compare the rectangularity of each region with the rectangularity control threshold;

[0275] Screen out non-rectangular regions to obtain a straight-edge feature region, where the non-rectangular regions are regions whose rectangularity does not meet the rectangular control threshold.

[0276] Optionally, the second acquisition unit 810 includes:

[0277] Extract the straight-line skeleton in the straight-edge feature region;

[0278] Convert the straight-line skeleton into a straight-line contour;

[0279] Use a straight-line detection algorithm to extract the target straight-edge feature in the straight-line contour;

[0280] Obtain the corner feature in the corner feature region according to the target straight-edge feature.

[0281] Please refer to Figure 9 , this application also provides a straight-edge and corner detection device, including:

[0282] A processor 901, a memory 902, an input / output unit 903, and a bus 904.

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

[0284] The memory 902 stores a program, and the processor 901 calls the program to execute the straight-edge and corner detection method as Figures 1 to 7 described.

[0285] This application provides a computer-readable storage medium, on which a program is stored, and when the program is executed on a computer, it executes as Figures 1 to 7Straight edge and corner point detection method.

[0286] Those skilled in the art can clearly understand that for the convenience and brevity of description, the specific working processes of the above-described systems, devices, and units can refer to the corresponding processes in the foregoing method embodiments and will not be elaborated herein.

[0287] In 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 merely illustrative. For example, the division of the units is only a logical function division, and there may be other division methods in actual implementation. For example, 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 displayed or discussed couplings or direct couplings or communication connections to each other can be indirect couplings or communication connections through some interfaces, devices, or units, and can be in electrical, mechanical, or other forms.

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

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

[0290] If the above-mentioned 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 such an understanding, the technical solution of the present application, in essence, 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 and includes several instructions for causing a computer device (which can be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the methods described in each embodiment of the present application. The foregoing storage medium includes: USB flash drive, mobile hard disk, read-only memory (ROM, read-only memory), random access memory (RAM, random access memory), magnetic disk, or optical disk, etc., which can store program codes.

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: Set the gradient amplitude threshold 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 rectangularity 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

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

    CN107274401A

  • Display panel frame detection method and device and electronic equipment

    CN117392127A