Corner point detection method and device, computer device, storage medium and program product
By performing position adjustment and longitudinal integral image processing in corner detection, the accuracy problem of corner detection under different slope scenarios is solved, and efficient and accurate corner localization is achieved.
Patent Information
- Application Number
- CN202310353179.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-03-30
- Publication Date
- 2025-12-05
- Estimated Expiration
- 2043-03-30
AI Technical Summary
Existing corner detection algorithms have low accuracy when facing real-world application scenarios with different slopes, and cannot adapt to complex real-world situations.
By acquiring images of the product to be inspected and template images, and adjusting their positions, corner regions are searched and detected using corner templates and vertical integral images. Combined with corner detection parameters, the accuracy of corner positioning is improved.
It improves the accuracy and efficiency of corner detection, reduces errors caused by positional offset, and ensures the accuracy of product size detection.
Smart Images

Figure CN116977413B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of computer, in particular to a corner point detection method and device, computer equipment, storage medium and computer program product. BACKGROUND
[0002] With the development of computer technology, and the wide application of various electronic products, including computer, communication and consumer electronic products, the product quality requirements of various electronic products are increasingly improved. Among them, the size specifications of different devices in electronic products are accurate and correct, which is particularly important for the overall quality of the product. In the device installation process, if the device size error occurs, it will cause the device installation failure and the problem of product complete structure being damaged. Therefore, in the product quality inspection process, the device size measurement is performed to judge whether the size of the device meets the size specifications, thereby reducing the size error.
[0003] Traditionally, the corresponding relationship between the feature pixels (i.e. corner points) of the device image and the template image needs to be determined to judge whether there is a deviation between the device image and the template image, so as to judge whether the size of the device meets the size specifications of the template. When searching for the corner points on the image, a local window is usually moved on the image to judge whether the gray scale changes greatly, that is, if the gray scale values in the window all change greatly, then the region where the window is located has a corner point.
[0004] However, since the point grabbing in the actual operation scene often has different slopes, the general corner point searching algorithm is suitable for the scene with a single fixed slope, and cannot adapt to the searching of corner points with different slopes, and the detection result of the corner point is also prone to error. Therefore, the general corner point searching algorithm still has the problem of low accuracy of the corner point detection result. SUMMARY
[0005] Therefore, it is necessary to provide a corner point detection method, device, computer equipment, storage medium and computer program product capable of improving the accuracy of the corner point detection result.
[0006] In a first aspect, the present application provides a corner point detection method. The method comprises:
[0007] obtaining a product image to be detected and a template image matched with the product specifications of the product image to be detected;
[0008] adjusting the position of the product image to be detected based on the template image to obtain a coarsely adjusted product image;
[0009] According to the corner point template on the template image, a corner point region search process is performed on the coarse adjustment product image to obtain a corner point region on the coarse adjustment product image that matches the corner point template.
[0010] Based on the corner point detection parameter and the longitudinal integral image corresponding to the corner point region, a corner point detection process is performed to obtain a corner point corresponding to the product image to be detected.
[0011] In one of the embodiments, after the product image to be detected is obtained, the method further comprises:
[0012] Based on the trained key point detection model, a corner point region on the product image to be detected is obtained.
[0013] Based on the corner point detection parameter and the longitudinal integral image corresponding to the corner point region, a corner point detection process is performed to obtain a corner point corresponding to the product image to be detected.
[0014] In a second aspect, the present application further provides a corner point detection device. The device comprises:
[0015] A product image to be detected acquisition module is configured to acquire a product image to be detected and a template image matching a product specification of the product image to be detected;
[0016] A position adjustment module is configured to perform position adjustment on the product image to be detected based on the template image to obtain a coarse adjustment product image;
[0017] A corner point region acquisition module is configured to perform a corner point region search process on the coarse adjustment product image according to a corner point template on the template image to obtain a corner point region on the coarse adjustment product image that matches the corner point template;
[0018] A corner point detection module is configured to perform a corner point detection process based on a corner point detection parameter and a longitudinal integral image corresponding to the corner point region to obtain a corner point corresponding to the product image to be detected.
[0019] In a third aspect, the present application further provides a computer device. The computer device comprises a memory and a processor, the memory stores a computer program, and the processor implements the following steps when executing the computer program:
[0020] A product image to be detected and a template image matching a product specification of the product image to be detected are acquired;
[0021] A position adjustment module is configured to perform position adjustment on the product image to be detected based on the template image to obtain a coarse adjustment product image;
[0022] According to the corner point template on the template image, a corner point region search process is performed on the coarse product image to obtain a corner point region on the coarse product image that matches the corner point template;
[0023] Based on the corner point detection parameter and the longitudinal integral image corresponding to the corner point region, a corner point detection process is performed to obtain a corner point corresponding to the product image to be detected.
[0024] In a fourth aspect, the present application further provides a computer readable storage medium. The computer readable storage medium has a computer program stored thereon, and the computer program, when executed by a processor, implements the following steps:
[0025] An image of a product to be detected and a template image matching a product specification of the image of the product to be detected are obtained;
[0026] Based on the template image, a position adjustment is performed on the image of the product to be detected to obtain a coarse product image;
[0027] According to the corner point template on the template image, a corner point region search process is performed on the coarse product image to obtain a corner point region on the coarse product image that matches the corner point template;
[0028] Based on the corner point detection parameter and the longitudinal integral image corresponding to the corner point region, a corner point detection process is performed to obtain a corner point corresponding to the product image to be detected.
[0029] In a fifth aspect, the present application further provides a computer program product. The computer program product comprises a computer program, and the computer program, when executed by a processor, implements the following steps:
[0030] An image of a product to be detected and a template image matching a product specification of the image of the product to be detected are obtained;
[0031] Based on the template image, a position adjustment is performed on the image of the product to be detected to obtain a coarse product image;
[0032] According to the corner point template on the template image, a corner point region search process is performed on the coarse product image to obtain a corner point region on the coarse product image that matches the corner point template;
[0033] Based on the corner point detection parameter and the longitudinal integral image corresponding to the corner point region, a corner point detection process is performed to obtain a corner point corresponding to the product image to be detected.
[0034] In the corner point detection method, device, computer device, storage medium and computer program product, the product image to be detected is obtained, and the template image matched with the product specification of the product image to be detected is obtained, and the position of the product image to be detected is adjusted based on the template image to obtain a coarsely adjusted product image, so that the error caused by the position deviation of the product to be detected on the corner point detection is reduced. Further, the corner point region searching processing is performed on the coarsely adjusted product image according to the corner point template on the template image to obtain the corner point region matched with the corner point template on the coarsely adjusted product image, so as to preliminarily determine the corner point region where the corner point is located, so that the corner point detection processing is further performed based on the corner point detection parameter and the longitudinal integral graph corresponding to the corner point region, the problem that the corner point positioning in the corner point region obtained through the template matching is inaccurate is solved, and the corner point corresponding to the product image to be detected is quickly and accurately obtained, and the corner point detection efficiency of the product image to be detected is improved. BRIEF DESCRIPTION OF DRAWINGS
[0035] Figure 1 An application environment diagram of the corner point detection method in an embodiment is shown;
[0036] Figure 2 A flowchart of the corner point detection method in an embodiment is shown;
[0037] Figure 3 A diagram of the product image to be detected in an embodiment is shown;
[0038] Figure 4 A diagram of the coarsely adjusted product image in an embodiment is shown;
[0039] Figure 5 A diagram of the corner point template on the template image in an embodiment is shown;
[0040] Figure 6 A process diagram of the corner point region searching processing performed on the coarsely adjusted product image in an embodiment is shown;
[0041] Figure 7 A diagram of the corner point region matched with the corner point template on the coarsely adjusted product image in an embodiment is shown;
[0042] Figure 8 A diagram of the corner point position with the same slope as the corner point template in an embodiment is shown;
[0043] Figure 9 A diagram of the corner point position with different slopes from the corner point template in an embodiment is shown;
[0044] Figure 10 A diagram of the longitudinal integral graph corresponding to the corner point region in an embodiment is shown;
[0045] Figure 11A flowchart of a process for obtaining a corner point corresponding to a product image to be detected in an embodiment;
[0046] Figure 12 A process diagram for performing a corner point detection process based on a corner point detection parameter and a longitudinal integral image corresponding to a corner point region in an embodiment;
[0047] Figure 13 A diagram of a corner point determined in a longitudinal integral image in an embodiment;
[0048] Figure 14 A diagram of a corner point corresponding to a product image to be detected in an embodiment;
[0049] Figure 15 A flowchart of a corner point detection method in another embodiment;
[0050] Figure 16 A block diagram of a corner point detection device in an embodiment;
[0051] Figure 17 An internal structure diagram of a computer device in an embodiment. DETAILED DESCRIPTION
[0052] In order to make the purposes, technical solutions and advantages of the present application clearer, the present application is further described in detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and not to limit the present application.
[0053] The corner point detection method provided by the embodiments of the present application relates to artificial intelligence technology, and can be applied to various scenes such as cloud technology, artificial intelligence, intelligent transportation, network media and auxiliary driving. Among them, artificial intelligence (AI) is to use a digital computer or a machine controlled by a digital computer to simulate, extend and expand human intelligence, perceive the environment, acquire knowledge and use the knowledge to obtain the best results. In other words, artificial intelligence is a comprehensive technology of computer science, which tries to understand the essence of intelligence and produce a new intelligent machine that can react in a similar way to human intelligence. Artificial intelligence is to study the design principles and implementation methods of various intelligent machines, so that the machines have the functions of perception, reasoning and decision-making. Artificial intelligence technology is a comprehensive discipline, involving a wide range of fields, including both hardware and software technologies. Artificial intelligence basic technologies generally include technologies such as sensors, special artificial intelligence chips, cloud computing, distributed storage, big data processing technology, operation / interaction system, mechatronics, etc. Artificial intelligence software technology mainly includes computer vision technology, speech processing technology, natural language processing technology, and machine learning / deep learning, etc. Among them, computer vision technology (CV) is a science that studies how to make machines "see". Further, it refers to using cameras and computers to replace human eyes to identify, detect and measure targets, and further process images so that the computer processing becomes more suitable for human eye observation or image transmission to instrument detection. As a scientific discipline, computer vision researches related theories and technologies, trying to establish an artificial intelligence system that can obtain information from images or multidimensional data. Computer vision technology usually includes image processing, image recognition, image semantic understanding, image retrieval, OCR, video processing, video semantic understanding, video content / behavior recognition, three-dimensional object reconstruction, 3D technology, virtual reality, augmented reality, simultaneous localization and mapping, etc. It also includes common face recognition, fingerprint recognition and other biometric identification technologies. Machine learning (ML) is a multi-disciplinary subject involving probability theory, statistics, approximation theory, convex analysis, algorithm complexity theory, etc. It is a specialized research on how computers simulate or implement human learning behavior to acquire new knowledge or skills, and reorganize existing knowledge structure to continuously improve their performance. Machine learning is the core of artificial intelligence and the fundamental approach to making computers intelligent, and its applications are widespread in various fields of artificial intelligence. Machine learning and deep learning usually include artificial neural networks, belief networks, reinforcement learning, transfer learning, inductive learning, and example-based learning.
[0054] With the research and progress of artificial intelligence technology, artificial intelligence technology is researched and applied in many fields, such as common smart home, smart wearable device, virtual assistant, smart speaker, smart marketing, unmanned driving, automatic driving, unmanned aerial vehicle, robot, smart medical treatment, smart customer service, etc. It is believed that with the development of technology, artificial intelligence technology will be applied in more fields and play an increasingly important role.
[0055] The corner point detection method provided by the embodiments of the present application is particularly related to computer vision technology and machine learning technology in artificial intelligence technology, and can be applied in an application environment as shown in Figure 1 The terminal 102 communicates with the server 104 through a network. The data storage system can store data required to be processed by the server 104. The data storage system can be integrated on the server 104, or placed on a cloud or other network server. The terminal 102 can be, but is not limited to, various personal computers, notebook computers, smart phones, tablet computers, Internet of Things devices, portable wearable devices, aircraft, etc. The Internet of Things device can be a smart speaker, a smart vehicle device, etc. The portable wearable device can be a smart watch, a smart bracelet, a head-mounted device, etc. The server 104 can be a standalone physical server, or a server cluster composed of multiple physical servers.
[0056] Further, the terminal 102 and the server 104 can be individually used to execute the corner point detection method provided in the embodiments of the present application, and the terminal 102 and the server 104 can also cooperatively execute the corner point detection method provided in the embodiments of the present application. For example, taking the terminal 102 and the server 104 cooperatively executing the corner point detection method provided in the embodiments of the present application as an example, the server 104 acquires a product image to be detected, and a template image matched with the product specification of the product image to be detected, and adjusts the position of the product image to be detected based on the template image to obtain a coarsely adjusted product image. Further, the server 104 performs corner point region searching processing on the coarsely adjusted product image based on a corner point template on the template image, to obtain a corner point region matched with the corner point template on the coarsely adjusted product image, and performs corner point detection processing based on a corner point detection parameter and a longitudinal integral image corresponding to the corner point region, to obtain a corner point corresponding to the product image to be detected. The product image to be detected can be stored in a cloud storage of the server 104, or in a data storage system, or in a local storage of the terminal 102, and can be acquired from the server 104, or from the data storage system, or from the terminal 102 when the corner point detection processing is required. When the corner point corresponding to the product image to be detected is obtained, the distance of the corner point quality detection can be further detected to obtain the product size of the product image to be detected, so as to determine whether the product size meets a preset product specification, thereby generating a quality detection result of the product to be detected.
[0057] In one embodiment, asFigure 2 As shown in the method for detecting a corner point is provided, and the method is applied to Figure 1 The server in the method is taken as an example for illustration, and the method comprises the following steps:
[0058] In step S202, an image of a product to be detected is acquired, and a template image matching a product specification of the image of the product to be detected is acquired.
[0059] The image of the product to be detected can be an image of a product to be detected in quality, such as an image of an electronic product, including an image of a computer, a communication product, and a consumer product, and can also be an image of a component of an electronic product.
[0060] Specifically, a product point image, specifically a product point image of the product to be detected, is acquired, and the product point image is subjected to binary segmentation processing, that is, the product point image is divided into black and white colors, so as to obtain the image of the product to be detected corresponding to the product point image.
[0061] Further, as shown in the schematic diagram of the image of the product to be detected, after the product point image is acquired and subjected to binary segmentation processing, the image of the product to be detected as shown in Figure 3 Figure 3
[0062] In one embodiment, after the image of the product to be detected is acquired, a product specification corresponding to the image of the product to be detected is further determined, and each candidate template image is subjected to matching processing according to the product specification, so as to obtain a template image with successful matching.
[0063] The product specification can be understood as a size specification of the product, that is, a standard size of the product, including basic dimensions of the product or a component of the product, such as length, width, and height, and can also include installation angles between product components and other dimensions.
[0064] Further, the template image library generally stores a plurality of candidate template images, and each candidate template image corresponds to a different product specification, that is, each candidate template image is used for position adjustment of the image of the product to be detected with a different product specification.
[0065] Specifically, according to the product specification corresponding to the image of the product to be detected, each candidate template image in the template image library is subjected to search matching processing, so as to obtain a template image with successful matching of the product specification of the image of the product to be detected from the template image library.
[0066] In step S204, the image of the product to be detected is subjected to position adjustment based on the template image, so as to obtain a coarsely adjusted product image.
[0067] Specifically, since the position of the product to be detected placed on the detection table by the mechanical hand during the quality detection of the product to be detected may be deviated, in order to reduce the deviation of the position of the product to be detected in different directions such as up, down, left and right, and the interference caused by the corner point detection, after the position of the device on the product to be detected is preliminarily positioned, the position of the product to be detected image is adjusted according to the template image, so that the device position on the product to be detected image and the device position on the template image are roughly coincided, so as to obtain a coarsely adjusted product image.
[0068] Further, as shown in Figure 4 , a coarsely adjusted product image is provided, and the coarsely adjusted product image is obtained by adjusting the position of the product to be detected image according to the template image, as shown in Figure 4 , it can be seen that the position of the template image marked by the marking box 402 and the position of the product to be detected image 404 can be seen on the coarsely adjusted product image.
[0069] In step S206, the corner point region search processing is performed on the coarsely adjusted product image according to the corner point template on the template image, and the corner point region matched with the corner point template on the coarsely adjusted product image is obtained.
[0070] Specifically, according to the corner point template on the template image, the search region on the coarsely adjusted product image is determined, and the corner point region search processing is performed in the search region according to the corner point template, and the corner point region matched with the corner point template is obtained.
[0071] As shown in Figure 5 , a corner point template on a template image is provided, and as shown in Figure 5 , it can be seen that the corner point template on the template image specifically includes a left corner point template 502 and a right corner point template 504. According to the corner point template on the template image, the search region on the coarsely adjusted product image is determined, and a plurality of first search regions corresponding to the left corner point template and a plurality of second search regions corresponding to the right corner point template are determined.
[0072] Further, since the left corner point template corresponds to a plurality of first search regions, and the right corner point template also corresponds to a plurality of second search regions, in order to avoid the search result confusion (i.e. the problem that there are multiple corner point regions in the same search region, or the corner point regions in different search regions overlap) in the corner point region search process, in the search process, each first search region does not coincide with each second search region, thereby avoiding a series of search errors caused by cross search.
[0073] In one embodiment, as shown in Figure 6 , a corner point region search processing process for the coarsely adjusted product image is provided, and as shown in Figure 6As can be seen, taking the corner region search processing based on the left corner template of the template image as an example, Figure 6 Figure (a) in the figure is used to represent the left corner point template of the template image. Figure 6 Figure (b) in the image represents a coarse-tuned product image.
[0074] Among them, Figure 6 In Figure (b), based on the corner template on the template image, for example... Figure 6 The left corner template shown in Figure (a) can determine a matching search area 602 on the coarsely adjusted product image. A search box 604 of a preset size is set within the search area 602, where the size of the search box 604 is smaller than the size of the search area 602. The search box 604 can be continuously moved within the search area 602 until a corner area 606 matching the corner template is found. The found corner area 606 contains corners corresponding to the corners in the product image to be detected. Further corner detection is required based on this corner area to obtain the corners corresponding to the product image to be detected.
[0075] In one embodiment, such as Figure 7 As shown, this is a schematic diagram of a corner region on a coarsely adjusted product image that matches a corner template. Figure 7 It can be seen that by performing a corner region search within the search area, one can obtain results such as... Figure 7 The multiple corner point regions 702 shown.
[0076] It is understandable that, since the coarse adjustment of the product image can include multiple corner points, when searching for corner point regions based on the corner point template, multiple corner point regions 702 that match the corner point template can be found, and each corner point region 702 includes its own corner point.
[0077] In this process, corner region search is performed based on the corner template. After obtaining the corner region that matches the corner template, the corners included in the corner region can be further determined based on corner detection algorithms (such as the common Harris detection algorithm or Shi-Tomasi detection algorithm). However, under different slopes, the positions of the corners determined from the corner region are different. Specifically, the slope of the corner template and the slope of the corner region are the same, the slope of the corner region is less than the slope of the corner template, and the slope of the corner region is greater than the slope of the corner template.
[0078] In one embodiment, such as Figure 8 As shown, a corner position with the same slope as the corner template is provided. (Refer to...) Figure 8It can be seen that when the slope of the corner point template and the slope of the corner point region are the same, the position of the determined corner point does not shift obviously, but due to the complexity of the actual application scene, quality detection needs to be performed on a plurality of different products or product components, and there is usually a case of different slopes, which cannot guarantee that the slope of the corner point template and the slope of the corner point region are the same every time detection is performed, resulting in that the accuracy of the corner point detection result is still relatively low in the actual scene.
[0079] Specifically, as shown in Figure 9 , a corner point position is provided when the slope of the corner point template is different, and as shown in Figure 9 , it can be seen that Figure 9 , FIG. (a) shows that when the slope of the corner point region is less than the slope of the corner point template, the corner point position shifts inward, and Figure 9 , FIG. (b) shows that when the slope of the corner point region is greater than the slope of the corner point template, the corner point position shifts outward. Therefore, in a complex actual application scene, in order to ensure the accuracy of the determined corner point position, further corner point detection processing needs to be performed on the obtained corner point region matched with the corner point template based on the corner point detection parameter and the longitudinal integral graph corresponding to the corner point region, rather than directly determining the corner point based on the corner point region.
[0080] Step S208, performing corner point detection processing based on the corner point detection parameter and the longitudinal integral graph corresponding to the corner point region to obtain a corner point corresponding to the product image to be detected.
[0081] Specifically, the corner point detection parameter specifically includes a sampling distance, and specifically, the sampling distance is sequentially sampled on the longitudinal integral graph to obtain a sampling point coordinate pair corresponding to the sampling distance, and when the difference value of the sampling point coordinate pair meets a corner point detection end condition, a corner point corresponding to the product image to be detected is obtained.
[0082] The sampling distance can be adjusted according to actual application requirements and is not limited to specific values, and can be, for example, 10 pixel values, or 15 pixel values, or 20 pixel values, and a plurality of different values. According to the size of the sampling distance, the longitudinal integral graph is sequentially sampled to obtain a plurality of sampling point coordinate pairs, and the horizontal distance between the obtained sampling point coordinate pairs is the size of the sampling distance.
[0083] Further, by calculating the difference value of the plurality of sampling point coordinate pairs obtained by sampling, the difference value can be understood as the vertical distance between the sampling point coordinate pairs, and when the difference value of the sampling point coordinate pair meets the corner point detection end condition, a corner point corresponding to the product image to be detected is obtained.
[0084] In one embodiment, before the corner point detection processing is performed based on the corner point detection parameter and the longitudinal integral graph corresponding to the corner point region, the method further comprises:
[0085] Based on the coordinate values of the pixel points in the corner point region, the longitudinal attribute values corresponding to the pixel points in the corner point region are obtained by sequentially performing longitudinal integral processing; and the original longitudinal integral graph corresponding to the corner point region is generated according to the horizontal coordinate values of the pixel points in the corner point region and the longitudinal attribute values.
[0086] Specifically, for each pixel point in the corner point region, the coordinates of the pixel point can be represented as (x i ,y j ), and the longitudinal integral processing can be specifically understood as, for each pixel point (x i ,y j ), the vertical coordinates y j of the pixel points are integrated and summed according to the same horizontal coordinate x i to obtain the longitudinal attribute value Y' corresponding to the horizontal coordinate. The longitudinal integral graph can reduce the two-dimensional image to a one-dimensional histogram, which can avoid high algorithm complexity and calculation amount on the two-dimensional image, and further corner point detection processing is performed based on the longitudinal integral graph.
[0087] For example, the corner point region includes pixel points (x1, y1), (x1, y2), (x1, y3), (x2, y4), (x2, y5), and (x2, y6), then the vertical coordinates y1, y2, and y3 are integrated for the same horizontal coordinate x1, and similarly, the vertical coordinates y4, y5, and y6 are integrated for the same horizontal coordinate x2.
[0088] Further, the longitudinal attribute value corresponding to each pixel point in the corner point region is determined by the following formula (1):
[0089] (1).
[0090] wherein, f(x, y) represents the pixel value at the coordinates x, y, h represents the height of the corner point region, and the longitudinal attribute value Y' is normalized after the integral summation, and the specific value of the longitudinal attribute value Y' can correspond to the height of the pixel point in the image to be detected. In one embodiment, after the original longitudinal integral graph corresponding to the corner point region is obtained, the method further comprises:
[0091] In one embodiment, after the original longitudinal integral graph corresponding to the corner point region is obtained, the method further comprises:
[0092] The value of the horizontal coordinate of each pixel point in the original longitudinal integral image is obtained. The value of the horizontal coordinate of each pixel point in the original longitudinal integral image is from small to large. The longitudinal attribute value corresponding to each horizontal coordinate is obtained in turn according to the inverse order of the value of each horizontal coordinate. The flipped longitudinal integral image is obtained according to the value of each horizontal coordinate after the inverse order and the longitudinal attribute value corresponding to each horizontal coordinate.
[0093] Specifically, by obtaining the value of the horizontal coordinate of each pixel point in the original longitudinal integral image, and the value of the horizontal coordinate in the original longitudinal integral image is sorted from small to large, and then by inversely processing the value of each horizontal coordinate in the original longitudinal integral image, that is, obtaining the sorted value from large to small, the longitudinal attribute value corresponding to each horizontal coordinate is obtained according to the sorted value of each horizontal coordinate from large to small, and then the flipped longitudinal integral image can be generated according to the value of each horizontal coordinate after the inverse order and the longitudinal attribute value corresponding to each horizontal coordinate.
[0094] By flipping the original longitudinal integral image, the trend of the flipped longitudinal integral image is first rising, then gently falling, and then falling, and then the corner point region search processing corresponding to different corner point templates can be realized without obtaining the original longitudinal integral image corresponding to the corner point region corresponding to different corner point templates. Specifically, by flipping the integral image, the corner point region search processing on the plurality of first search regions in the flipped longitudinal integral image according to the left corner point template and the corner point region search processing on the plurality of second search regions in the flipped longitudinal integral image according to the right corner point template can be realized at the same time.
[0095] In one embodiment, as Figure 10 , a longitudinal integral image corresponding to a corner point region is provided, as Figure 10 can be known, the longitudinal integral image can be used to represent the longitudinal integral attribute value Y' corresponding to each horizontal coordinate value X obtained by performing integral sum processing on the longitudinal coordinate value Y of each pixel point having the same horizontal coordinate value X according to the horizontal coordinate value X of each pixel point. As Figure 10 indicated in the longitudinal integral image, the range of the horizontal coordinate X is 0 to 80 pixels (corresponding to the horizontal coordinate of the pixel point), and the range of the longitudinal attribute value Y' is 0 to 60 pixels (corresponding to the longitudinal integral attribute value of the pixel point with the same horizontal coordinate). In the longitudinal integral image, the longitudinal integral attribute value Y' of each pixel point presents a trend of first gently, then rising, then gently, and then falling.
[0096] Specifically, by obtaining coordinate values (including horizontal coordinate values X and vertical coordinate values Y) of each pixel point in the corner point region, and integrating and summing the vertical coordinate values Y of each pixel point with the same horizontal coordinate value X, a vertical attribute value Y' corresponding to each horizontal coordinate value X is obtained. Further, after generating the original vertical integral image corresponding to the corner point region according to the horizontal coordinate values X of each pixel point in the corner point region and each vertical attribute value Y', a flip processing is performed based on the original vertical integral image, that is, the vertical attribute values corresponding to each horizontal coordinate are obtained in reverse order of the values of each horizontal coordinate, and the flipped vertical integral image as shown in Figure 10
[0097] In one embodiment, after obtaining the product image to be detected, the method further comprises:
[0098] Based on the trained key point detection model, a corner point region on the product image to be detected is obtained; based on the corner point detection parameter and the vertical integral image corresponding to the corner point region, a corner point corresponding to the product image to be detected is obtained.
[0099] Specifically, by obtaining the product image to be detected, and based on the trained key point detection model, key point detection is performed on the product image to be detected to obtain a corresponding key point, and based on a preset expansion range, the key point is taken as the center to perform region expansion to obtain a corner point region on the product image to be detected that includes the key point.
[0100] Further, the corner point detection parameter specifically includes a sampling distance, and specifically, sampling points on the vertical integral image are obtained in sequence according to the sampling distance, and when the difference value of the sampling point coordinate pair meets the corner point detection end condition, a corner point corresponding to the product image to be detected is obtained.
[0101] In the above corner point detection method, by obtaining the product image to be detected and a template image matching the product specification of the product image to be detected, and based on the template image, position adjustment is performed on the product image to be detected to obtain a coarsely adjusted product image, thereby reducing the error caused by the position deviation of the product to be detected on the corner point detection. Further, according to the corner point template on the template image, a corner point region search processing is performed on the coarsely adjusted product image to obtain a corner point region on the coarsely adjusted product image that matches the corner point template, so as to preliminarily determine the corner point region where the corner point is located, so as to further perform corner point detection processing based on the corner point detection parameter and the vertical integral image corresponding to the corner point region, solve the problem of inaccurate positioning of the corner point in the corner point region obtained by template matching, and quickly and accurately obtain the corner point corresponding to the product image to be detected, thereby improving the corner point detection efficiency of the product image to be detected.
[0102] In one embodiment, the step of searching for a corner point region in a search region according to a corner point template to obtain a corner point region matched with the corner point template comprises:
[0103] In the search region, the corner point region searching process is performed according to the corner point template to obtain a plurality of candidate corner point regions; similarity data between the corner point template and each candidate corner point region is determined; and the corner point region matched with the corner point template is determined according to the similarity data.
[0104] Specifically, the corner point region searching process is performed in the search region according to a search frame corresponding to the corner point template to obtain a plurality of candidate corner point regions. The corner point template includes a left corner point template and a right corner point template, the search region includes a plurality of first search regions corresponding to the left corner point template and a plurality of second search regions corresponding to the right corner point template, and the search frame also includes a first search frame corresponding to the left corner point template and a second search frame corresponding to the right corner point template.
[0105] Similarly, the search frame is matched with the respective corner point template, and the search frames in different search regions can be of the same size. For example, the sizes of the first search regions are the same, and thus the sizes of the first search frames in the first search regions are the same, or the sizes of the second search regions are the same, and thus the sizes of the second search frames in the second search regions are the same. Similarly, if the sizes of the first search regions and the second search regions are the same, the sizes of the first search frames and the second search frames are also the same. It can be understood that in actual application, the sizes of the search regions and the search frames are not specifically limited and can be adjusted according to actual needs.
[0106] Further, after obtaining the plurality of candidate corner point regions, similarity data between the corner point template and each candidate corner point region is further determined. The candidate corner point regions corresponding to the left corner point template include each first candidate corner point region, and the candidate corner point regions corresponding to the right corner point template include each second candidate corner point region. Specifically, similarity data between the left corner point template and each first candidate corner point region and similarity data between the right corner point template and each second candidate corner point region are calculated, and the similarity data is calculated in the same way.
[0107] After the similarity data between the corner point template and each candidate corner point region is determined, a similarity matrix can be obtained. The step of determining the corner point region matched with the corner point template according to the similarity data means that the maximum similarity data needs to be further determined from the similarity matrix, and the position corresponding to the maximum similarity data is obtained, i.e., the candidate corner point region corresponding to the maximum similarity data is obtained, so that the candidate corner point region corresponding to the maximum similarity data is determined as the corner point region matched with the corner point template.
[0108] In one embodiment, the similarity data between the corner point template and each candidate corner point region is determined, including:
[0109] The determination of the corner point template includes a first pixel average value corresponding to a template region of the corner point template, and a second pixel average value corresponding to each candidate corner point region; a first pixel standard deviation corresponding to the corner point template is determined according to the first pixel average value and coordinate values of each pixel point in the template region included in the corner point template; a second pixel standard deviation corresponding to the candidate corner point region is determined according to the second pixel average value and coordinate values of each pixel point in the candidate corner point region; and the similarity data between the corner point template and each candidate corner point region is determined based on the first pixel average value, the first pixel standard deviation, the second pixel average value, the second pixel standard deviation, and a scaling parameter.
[0110] Specifically, the first pixel average value is obtained by obtaining each pixel point in the template region included in the corner point template and performing an average-summing process based on each pixel point. Similarly, the second pixel average value is obtained by obtaining each pixel point in the candidate corner point region and performing an average-summing process based on each pixel point.
[0111] Further, the first pixel standard deviation corresponding to the corner point template is determined according to the first pixel average value and coordinate values of each pixel point in the template region included in the corner point template. Specifically, a general standard deviation calculation method is used. Specifically, the difference between the coordinate value of each pixel point and the first pixel average value is calculated, and the square of the difference is obtained. Then, the square of each difference is summed and averaged, and finally, the square root is taken to obtain the first pixel standard deviation.
[0112] The second pixel standard deviation corresponding to the candidate corner point region is determined according to the second pixel average value and coordinate values of each pixel point in the candidate corner point region in the same way as the first pixel standard deviation corresponding to the corner point template, but the specific data used is different (the second pixel average value and the coordinate values of each pixel point in the candidate corner point region are used to calculate the second pixel standard deviation), which will not be described in detail.
[0113] In one embodiment, the similarity data between the corner point template and each candidate corner point region is calculated using the following formula (2):
[0114] (2);
[0115] wherein, represents the similarity data, represents the candidate corner point region, represents the corner point template region, represents the coordinate , pixel values at coordinate positions in the candidate corner region, pixel values at coordinate positions in the corner template region, pixel values at coordinate positions in the corner template region, pixel values at coordinate positions in the corner template region, a first pixel mean value representing the corner template region, a second pixel mean value representing the candidate corner region, a first pixel standard deviation representing the corner template region, a second pixel standard deviation representing the candidate corner region, a scaling parameter, which belongs to a hyperparameter, and its value is set and adjusted according to actual application or actual demand, and is not limited to a specific value or specific values.
[0116] In this embodiment, by performing corner region search processing in the search region according to the corner template, a plurality of candidate corner regions are obtained, and similarity data between the corner template and each candidate corner region is determined, so as to determine the corner region matched with the corner template according to the similarity data. The corner region search processing is realized in the search region on the product image coarsely adjusted according to the corner template, and the corner region matched with the corner template is screened from the plurality of candidate corner regions obtained, so as to perform further corner detection based on the corner region, including performing corner detection processing based on the corner detection parameter and the longitudinal integral graph corresponding to the corner region, to solve the problem of inaccurate corner positioning in the corner region obtained by template matching, thereby quickly and accurately obtaining the corner corresponding to the product image to be detected.
[0117] In one embodiment, the corner detection parameter includes a sampling distance, a starting slope and an ending slope, as shown in Figure 11 The step of obtaining the corner corresponding to the product image to be detected, i.e., the step of performing corner detection processing based on the corner detection parameter and the longitudinal integral graph corresponding to the corner region, specifically includes:
[0118] In step S1102, sampling is sequentially performed on the longitudinal integral graph according to the sampling distance, and a sampling point coordinate pair corresponding to the sampling distance is obtained.
[0119] Specifically, the sampling distance can be adjusted according to actual application demand, and is not limited to a specific value, and can take multiple different values such as 10 pixel values, or 15 pixel values, or 20 pixel values. According to the size of the sampling distance, such as the size of the sampling distance of 15 pixel values, sampling is sequentially performed on the longitudinal integral graph, and a plurality of sampling point coordinate pairs are constantly obtained, and the horizontal distance between each sampling point coordinate pair obtained is the size of the sampling distance.
[0120] Step S1104, if the difference value of the sampling point coordinate pair is greater than the slope of the starting slope, it is determined that the corner point detection start condition is met.
[0121] Specifically, by calculating the difference value of the plurality of sampling point coordinate pairs obtained by sampling, the difference value can be specifically understood as the vertical distance between the sampling point coordinate pairs, and the slope size of the preset starting slope in the corner point detection parameter is obtained, and further the difference value of the sampling point coordinate pair and the slope of the starting slope are compared.
[0122] For example, when sampling on the longitudinal integral graph, the sampling point coordinate pairs obtained by sampling include (x1, y1), (x2, y2), the horizontal distance between the sampling point coordinate pairs is (x2- x1), that is, the sampling distance, and the vertical distance between the sampling point coordinate pairs is (y2- y1), that is, the difference value.
[0123] When the difference value of the sampling point coordinate pair is greater than the slope of the starting slope, it indicates that the current corner point detection start condition is met. Specifically, during the sampling process based on the longitudinal integral graph, the difference value of the sampling point coordinate pair obtained in the early stage is less than the slope of the ending slope, that is, the corner point detection end condition is met. However, the sampling point coordinate pair only meets the condition that the difference value is less than the slope of the ending slope cannot be used as the final required corner point of the product image to be detected, and thus the sampling point coordinate pair only meeting the condition that the difference value is less than the slope of the ending slope is excluded, which is realized by setting a corner point detection start condition.
[0124] Specifically, by setting the difference value of the sampling point coordinate pair to be greater than the slope of the starting slope as the corner point detection start condition, the sampling point coordinate pair obtained in the early stage with the difference value less than the slope of the ending slope can be excluded, and sampling is performed again after the corner point detection start condition is met to obtain the candidate sampling point coordinate pair.
[0125] The slope of the starting slope is usually greater than the slope of the ending slope, that is, the trend of the longitudinal integral graph during the sampling process is usually first rising, then gently falling, and then falling. When sampling on the longitudinal integral graph and determining the corner point, the corner point detection start condition needs to be met first, and then the corner point detection end condition needs to be met on this basis to obtain the corner point corresponding to the product image to be detected.
[0126] Step S1106, the candidate sampling region meeting the corner point detection start condition is determined from the longitudinal integral graph.
[0127] Specifically, when it is determined that the corner point detection start condition is met, the coordinate pair of the sampling point meeting the corner point detection start condition is taken as the starting point of the candidate sampling region, and the ending point of the candidate sampling region can be the ending point of the longitudinal integral graph, that is, the region before the corner point detection start condition is met can be removed, and the region after the corner point detection start condition is met is taken as the candidate sampling region.
[0128] In step S1108, the candidate sampling region is sampled according to the sampling distance to obtain the coordinate pair of the candidate sampling point corresponding to the sampling distance.
[0129] Specifically, after it is determined that the corner point detection start condition is met and the candidate sampling region meeting the corner point detection start condition is determined, sampling is started again, specifically, the candidate sampling region is sampled according to the sampling distance to obtain the coordinate pair of the candidate sampling point corresponding to the sampling distance, and the horizontal distance between the coordinate pairs of the candidate sampling points is the size of the sampling distance. The sampling distance can also be adjusted according to actual application requirements, and is not limited to specific values.
[0130] In step S1110, if the difference value of the coordinate pair of the candidate sampling point is less than the slope of the end slope, it is determined that the corner point detection end condition is met.
[0131] Specifically, the difference value of the coordinate pair of the candidate sampling point obtained by sampling is calculated, which can be understood as the vertical distance between the coordinate pairs of the candidate sampling points, and the slope of the end slope in the corner point detection parameter is obtained, and the difference value of the coordinate pair of the candidate sampling point and the slope of the candidate slope are further compared.
[0132] Similarly, when sampling on the longitudinal integral graph, the coordinate pairs of the candidate sampling points obtained by sampling include (x3, y3) and (x4, y4), the horizontal distance between the coordinate pairs of the candidate sampling points is (x4-x3), which is the sampling distance, and the vertical distance between the coordinate pairs of the candidate sampling points is (y4-y3), which is the difference value.
[0133] Further, when the difference value of the coordinate pair of the candidate sampling point is less than the slope of the end slope, it is indicated that the current corner point detection end condition is met. The corner point detection end condition can be understood as the completion of the current sampling and corner point detection process based on the longitudinal integral graph, and the coordinate pair of the candidate sampling point determined at the completion time can be further processed to obtain the corner point corresponding to the product image to be detected.
[0134] In step S1112, the sampling center point of the coordinate pair of the candidate sampling point meeting the corner point detection end condition is determined as the corner point corresponding to the product image to be detected.
[0135] Specifically, when the corner detection termination condition is met, the sampling center point of the candidate sampling point coordinate pair that meets the corner detection termination condition is obtained, and the sampling center point of the candidate sampling point coordinate pair is determined as the corner point corresponding to the product image to be detected.
[0136] In one embodiment, such as Figure 12 As shown, the corner detection process, based on corner detection parameters and the longitudinal integral image corresponding to the corner region, is described below. Figure 12 It can be seen that when sampling and corner detection based on the vertical integral image, the corner detection parameters required include the sampling distance (i.e., Figure 12 The interval in the middle), the slope of the initial slope (i.e. Figure 12 The slope of the start_slope and the slope of the end_slope (i.e., the slope of the start_slope). Figure 12 The slope of stop_slope in the sample. This includes the difference between the coordinate pairs of the sampling points acquired using the sampling distance (i.e., the slope of the stop_slope). Figure 12 In the above, the diff is the vertical distance between pairs of sample point coordinates, while the sampling distance is the horizontal distance between pairs of sample point coordinates.
[0137] Specifically, refer to Figure 12 As can be seen, when sampling based on the vertical integral image, sampling is performed sequentially on the vertical integral image according to the sampling distance interval to obtain multiple sampling point coordinate pairs corresponding to the sampling distance interval. The difference value diff of each sampling point coordinate pair is calculated sequentially. When the difference value of the sampling point coordinate pair is greater than the slope of the starting slope start_slope, the corner detection start condition is met. After the corner detection start condition is met, sampling continues to be performed sequentially on the vertical integral image according to the sampling distance interval until the difference value of the obtained sampling point coordinate pairs is less than the slope of the ending slope stop_slope. The sampling end condition is then met. Thus, the sampling center point of the candidate sampling point coordinate pair that meets the corner detection end condition is determined as the corner point corresponding to the product image to be detected.
[0138] In one embodiment, such as Figure 13 As shown, a schematic diagram of corner points determined in a vertical integral plot is provided, with reference to... Figure 13 It can be seen that, Figure 13 The initial corner point 1302 is obtained by performing corner region search processing on the coarse-tuned product image based on the corner template, obtaining the corner region on the coarse-tuned product image that matches the corner template, and then using a conventional corner detection algorithm to perform corner detection based on the corner region. Figure 13The refined corner point 1304 is obtained by performing corner detection processing based on corner detection parameters (including the slope of the starting slope and the slope of the ending slope of the sampling distance) and the longitudinal integral map corresponding to the corner area, and the corner points corresponding to the product image to be detected.
[0139] Among them, reference Figure 13 It can be seen that the position of the initial corner point 1302 is offset relative to the refined corner point 1304, and there is a certain offset in both time and coordinates. The accuracy of the determined corner point still needs to be improved. However, the refined corner point 1304 obtained by performing corner point detection processing based on corner point detection parameters and the longitudinal integral image corresponding to the corner point area is a more accurate corner point obtained after adjusting the position and offset of the initial corner point 1302.
[0140] Furthermore, such as Figure 14 As shown, a schematic diagram of the corner points corresponding to the image of the product to be inspected is provided. Figure 14 It can be seen that, Figure 14 The initial corner point 1402 is obtained by performing corner region search processing on the coarse-tuned product image based on the corner template, obtaining the corner region on the coarse-tuned product image that matches the corner template, and then using a conventional corner detection algorithm to perform corner detection based on the corner region. Figure 14 The fine-tuned corner point 1404 is obtained by performing corner detection processing on the corner area that matches the corner template on the coarse-tuned product image, based on corner detection parameters (including the slope of the starting slope and the slope of the ending slope of the sampling distance) and the longitudinal integral map corresponding to the corner area, to obtain the corner point corresponding to the product image to be detected.
[0141] Among them, reference Figure 14 It can be seen that the initial corner point 1402 is offset in position within the corner point area compared to the refined corner point 1404, and is offset further inward. Its positioning accuracy still needs to be improved. The refined corner point 1404 is the corner point position after refinement and adjustment, and its accuracy is higher. This is conducive to obtaining accurate test results in the subsequent product quality inspection process and reducing error data in the inspection process.
[0142] In one embodiment, a corner refinement algorithm is provided. Specifically, the algorithm performs corner detection processing based on corner detection parameters and the longitudinal integral image corresponding to the corner region to obtain the corner points (i.e., output data `knee_index`) corresponding to the product image to be detected. The corner detection parameters specifically include the sampling distance (i.e., interval), the slope of the starting slope (i.e., the slope of `start_slope`), and the slope of the ending slope (i.e., the slope of `stop_slope`).
[0143] Specifically, in the corner refinement algorithm, the flipping processing of the longitudinal integral image is implemented by flipping the longitudinal integral image, i.e., by executing the processing logic of "if X[-1]<X[0] then index=index[::-1]", so that the trend of the flipped longitudinal integral image is first rising, then gently falling, and then falling, and then the corner region search processing of the plurality of first search regions in the flipped longitudinal integral image according to the left corner point template and the corner region search processing of the plurality of second search regions in the flipped longitudinal integral image according to the right corner point template can be implemented. Wherein, For representing the value from the full list in reverse order, i.e., copying the original longitudinal integral image from the last element to the first element, implementing the flipping of the original longitudinal integral image, and obtaining the flipped longitudinal integral image.
[0144] Wherein, in the process of sampling on the longitudinal integral image according to the sampling distance interval, Figure X A plurality of sampling point coordinate pairs are obtained, and the obtained sampling point coordinate pairs can be used to represent the curr point and the prev point, wherein curr=index[i] and prev=index[i-interval], i.e., the horizontal distance of the sampling point coordinate pair is equal to the sampling distance interval, and diff=abs(X[curr]-X[prev]), i.e., the difference value diff of the sampling point coordinate pair is equal to the vertical distance of the sampling point coordinate pair.
[0145] Further, by executing the processing logic "if diff>int(interval*start_slope) then start_dropping=True", it is determined whether the corner detection start condition is met. Specifically, when the difference value diff of the sampling point coordinate pair is greater than the slope of the start slope start_slope, it is determined that the corner detection start condition is met, at which time it is necessary to continue sampling on the longitudinal integral image according to the sampling distance, and continue to calculate the difference value diff of each candidate sampling point coordinate pair obtained by sampling.
[0146] Similarly, whether the corner point detection end condition is met is determined by executing the processing logic "if start_dropping and diff < int(interval * stop_slope) then return index[i-interval / / 2]". Specifically, when the difference value diff of the sample point coordinate pair is less than the slope of the end slope stop_slope, the corner point detection end condition is met, the corner point detection loop is exited, and the center point of the interval [i-interval / / 2] when the loop is exited is returned, that is, the sampling center point of the sample point coordinate pair when the corner point detection end condition is met is determined as the corner point corresponding to the product image to be detected.
[0147] In this embodiment, the sample points are sequentially sampled on the longitudinal integral image according to the sampling distance, and the sample point coordinate pair corresponding to the sampling distance is obtained. When the difference value of the sample point coordinate pair is greater than the slope of the start slope, it is determined that the corner point detection start condition is met, and the candidate sampling region meeting the corner point detection start condition is determined from the longitudinal integral image. Further, the candidate sample points are sequentially sampled in the candidate sampling region according to the sampling distance, and the candidate sample point coordinate pair corresponding to the sampling distance is obtained. When the difference value of the candidate sample point coordinate pair is less than the slope of the end slope, it is determined that the corner point detection end condition is met, and the sampling center point of the candidate sample point coordinate pair when the corner point detection end condition is met is determined as the corner point corresponding to the product image to be detected. The further corner point detection is realized according to the sampling distance, the slope of the start slope, the slope of the end slope, and the longitudinal integral image corresponding to the corner point region, instead of the way of performing corner point detection based on the corner point region by using the conventional corner point detection algorithm. The corner point determined by considering multiple corner point detection parameters has higher positioning accuracy and smaller positioning error in the detection process, and the precision of the obtained corner point is improved.
[0148] In one embodiment, as shown in FIG. 1, Figure 15 a corner point detection method is provided, which specifically includes the following steps:
[0149] In step S1501, a product point image is obtained, and the product point image is subjected to binary segmentation processing to obtain a product image to be detected corresponding to the product point image.
[0150] In step S1502, the product specification corresponding to the product image to be detected is determined, and each candidate template image is subjected to matching processing according to the product specification to obtain a template image that matches successfully.
[0151] In step S1503, the product image to be detected is subjected to position adjustment based on the template image to obtain a coarsely adjusted product image.
[0152] Step S1504, according to the corner point template on the template image, a search region on the rough product image is determined.
[0153] Step S1505, in the search region, a corner point region search process is performed according to the corner point template, and a plurality of candidate corner point regions are obtained.
[0154] Step S1506, a first pixel average value corresponding to the template region included in the corner point template and a second pixel average value corresponding to each candidate corner point region are determined.
[0155] Step S1507, according to the first pixel average value and the coordinate value of each pixel point in the template region included in the corner point template, a first pixel standard deviation corresponding to the corner point template is determined.
[0156] Step S1508, according to the second pixel average value and the coordinate value of each pixel point in the candidate corner point region, a second pixel standard deviation corresponding to the candidate corner point region is determined.
[0157] Step S1509, based on the first pixel average value, the first pixel standard deviation, the second pixel average value, the second pixel standard deviation and the scaling parameter, similarity data between the corner point template and each candidate corner point region is determined.
[0158] Step S1510, according to the similarity data, a corner point region matched with the corner point template is determined.
[0159] Step S1511, based on the coordinate value of each pixel point in the corner point region, a vertical integral process is sequentially performed to obtain a vertical attribute value corresponding to each pixel point in the corner point region.
[0160] Step S1512, according to the horizontal coordinate value of each pixel point in the corner point region and each vertical attribute value, an original vertical integral graph corresponding to the corner point region is generated.
[0161] Step S1513, the value of the horizontal coordinate value of each pixel point in the original vertical integral graph is obtained, the value of the horizontal coordinate value of each pixel point in the original vertical integral graph is from small to large, and the vertical attribute value corresponding to each horizontal coordinate is sequentially obtained in the reverse order of the value of each horizontal coordinate.
[0162] Step S1514, according to the value of each horizontal coordinate in the reverse order and the vertical attribute value corresponding to each horizontal coordinate, a flipped vertical integral graph is obtained.
[0163] Step S1515, according to a sampling distance, sampling is sequentially performed on the vertical integral graph to obtain a sampling point coordinate pair corresponding to the sampling distance.
[0164] Step S1516, if the difference value of the sampling point coordinate pair is greater than the slope of the starting slope, it is determined that the corner point detection start condition is met.
[0165] Step S1517, determining the candidate sampling region meeting the corner point detection start condition from the longitudinal integral graph, and sequentially sampling in the candidate sampling region according to the sampling distance to obtain the candidate sampling point coordinate pair corresponding to the sampling distance.
[0166] Step S1518, if the difference value of the candidate sampling point coordinate pair is less than the slope of the end slope, determining that the corner point detection end condition is met.
[0167] Step S1519, determining the sampling center point of the candidate sampling point coordinate pair when the corner point detection end condition is met as the corner point corresponding to the product image to be detected.
[0168] In the above-mentioned corner point detection method, by obtaining the product image to be detected and the template image matched with the product specification of the product image to be detected, and based on the template image, the position of the product image to be detected is adjusted to obtain the coarsely adjusted product image, thereby reducing the error caused by the position deviation of the product to be detected on the corner point detection. Further, according to the corner point template on the template image, the corner point region searching process is performed on the coarsely adjusted product image to obtain the corner point region matched with the corner point template on the coarsely adjusted product image, so as to preliminarily determine the corner point region where the corner point is located, so as to further perform the corner point detection process based on the corner point detection parameter and the longitudinal integral graph corresponding to the corner point region, thereby solving the problem of inaccurate positioning of the corner point in the corner point region obtained by template matching, so as to quickly and accurately obtain the corner point corresponding to the product image to be detected, and improve the corner point detection efficiency of the product image to be detected.
[0169] In one embodiment, a corner point detection method is provided, which specifically includes the following parts:
[0170] P1, product point map processing
[0171] Firstly, by obtaining the product point map, specifically the product overhead point map of the product to be detected, and performing binary segmentation processing on the product point map, i.e., dividing the product point map into black and white colors, the product image to be detected corresponding to the product point map is obtained.
[0172] Secondly, after obtaining the product image to be detected, the product specification corresponding to the product image to be detected is further determined, and each candidate template image is matched according to the product specification to obtain the template image matched successfully.
[0173] Specifically, according to the product specification corresponding to the product image to be detected, each candidate template image in the template image library is searched and matched to obtain the template image matched successfully with the product specification of the product image to be detected from the template image library.
[0174] P2, position adjustment of product image to be detected
[0175] Specifically, since the position of the product to be detected placed on the detection table by the mechanical hand in the process of quality detection of the product to be detected may be deviated, in order to reduce the deviation of the placement position of the product to be detected in different directions such as up, down, left and right, and the interference caused by the corner point detection, after preliminarily positioning the position of the device on the product to be detected, the position of the product to be detected image is adjusted according to the template image, so that the device position on the product to be detected image and the device position on the template image are roughly coincided, so as to obtain the coarsely adjusted product image.
[0176] P3, corner point template matching, corner point region determination
[0177] Specifically, according to the corner point template on the template image, the search region on the coarsely adjusted product image is determined, and in the search region, the corner point region search processing is performed according to the corner point template, and the corner point region matched with the corner point template is obtained. Wherein, the left corner point template corresponds to a plurality of first search regions, and the right corner point template also corresponds to a plurality of second search regions, in order to avoid the situation that the search result is confused (that is, there are multiple corner point regions in the same search region, or the corner point regions in different search regions are overlapped) in the corner point region search process, then in the search process, each first search region does not coincide, and each second search region does not coincide, so as to avoid a series of search errors caused by cross search.
[0178] Wherein, according to the corner point template on the template image, such as the left corner point template, the matched search region on the coarsely adjusted product image can be determined, and the search frame with a preset size specification size is set in the search region. Wherein, the size of the search frame is smaller than the size of the search region, and the search frame can be moved in the search region until the corner point region matched with the corner point template is searched.
[0179] In one embodiment, the step of searching the corner point region in the search region according to the corner point template to obtain the corner point region matched with the corner point template comprises:
[0180] In the search region, the corner point region search processing is performed according to the corner point template to obtain a plurality of candidate corner point regions; the similarity data between the corner point template and each candidate corner point region is determined; and according to the similarity data, the corner point region matched with the corner point template is determined.
[0181] Specifically, a corner point region search process is performed in the search region according to the search box corresponding to the corner point template, so as to obtain a plurality of candidate corner point regions. The corner point template includes a left corner point template and a right corner point template, the search region includes a plurality of first search regions corresponding to the left corner point template and a plurality of second search regions corresponding to the right corner point template, and the search box includes a first search box corresponding to the left corner point template and a second search box corresponding to the right corner point template.
[0182] Similarly, the search box is matched with the respective corner point template, and the sizes of the search boxes in different search regions can be the same, for example, the sizes of the first search regions are the same, so the sizes of the first search boxes in the first search regions are the same, or the sizes of the second search regions are the same, so the sizes of the second search boxes in the second search regions are the same. Similarly, if the sizes of the first search regions and the second search regions are the same, the sizes of the first search boxes and the second search boxes are also the same. It can be understood that in actual application, the sizes of the search regions and the search boxes are not specifically limited and can be adjusted according to actual needs.
[0183] Further, after obtaining a plurality of candidate corner point regions, similarity data between the corner point template and each candidate corner point region is further determined. The candidate corner point regions corresponding to the left corner point template include each first candidate corner point region, and the candidate corner point regions corresponding to the right corner point template include each second candidate corner point region. Specifically, similarity data between the left corner point template and each first candidate corner point region and similarity data between the right corner point template and each second candidate corner point region are calculated, and the similarity data is calculated in the same way.
[0184] Wherein, after the similarity data between the corner point template and each candidate corner point region is determined, a similarity matrix can be obtained, and the corner point region matched with the corner point template is determined according to the similarity data, which means that the maximum similarity data needs to be further determined from the similarity matrix, and the position corresponding to the maximum similarity data is obtained, that is, the candidate corner point region corresponding to the maximum similarity data is obtained, so that the candidate corner point region corresponding to the maximum similarity data is determined as the corner point region matched with the corner point template.
[0185] In one embodiment, determining the similarity data between the corner point template and each candidate corner point region includes:
[0186] The first pixel average value corresponding to the template region included in the corner point template and the second pixel average value corresponding to each candidate corner point region are determined, the first pixel standard deviation corresponding to the corner point template is determined according to the first pixel average value and the coordinate values of each pixel point in the template region included in the corner point template, the second pixel standard deviation corresponding to the candidate corner point region is determined according to the second pixel average value and the coordinate values of each pixel point in the candidate corner point region, and the similarity data between the corner point template and each candidate corner point region is determined based on the first pixel average value, the first pixel standard deviation, the second pixel average value, the second pixel standard deviation and the scaling parameter.
[0187] Specifically, the first pixel average value is obtained by obtaining each pixel point in the template region included in the corner point template and performing sum and average processing based on each pixel point. Similarly, the second pixel average value is obtained by obtaining each pixel point in the candidate corner point region and performing sum and average processing based on each pixel point.
[0188] Further, the first pixel standard deviation corresponding to the corner point template is determined according to the first pixel average value and the coordinate values of each pixel point in the template region included in the corner point template. Specifically, the difference between the coordinate values of each pixel point and the first pixel average value is calculated, the square of the difference is obtained, the square of each difference is summed and averaged, and the square root is taken to obtain the first pixel standard deviation.
[0189] The second pixel standard deviation corresponding to the candidate corner point region is determined according to the second pixel average value and the coordinate values of each pixel point in the candidate corner point region. The method of determining the second pixel standard deviation is the same as that of determining the first pixel standard deviation, but the specific data used is different (the second pixel average value and the coordinate values of each pixel point in the candidate corner point region are used to calculate the second pixel standard deviation).
[0190] P4, determining a corner point
[0191] Specifically, the corner point detection parameter and the longitudinal integral graph corresponding to the corner point region are used to perform corner point detection processing to obtain the corner point corresponding to the product image to be detected.
[0192] The corner point detection parameters include a sampling distance, a starting slope and an ending slope. Specifically, the sampling distance is used to sample the longitudinal integral image to obtain a sampling point coordinate pair corresponding to the sampling distance. If a differential value of the sampling point coordinate pair is greater than a slope of the starting slope, it is determined that the starting condition of the corner point detection is met. Further, a candidate sampling region meeting the starting condition of the corner point detection is determined from the longitudinal integral image. The sampling distance is used to sample the candidate sampling region to obtain a candidate sampling point coordinate pair corresponding to the sampling distance. If a differential value of the candidate sampling point coordinate pair is less than a slope of the ending slope, it is determined that the ending condition of the corner point detection is met. Thus, a sampling center point of the candidate sampling point coordinate pair meeting the ending condition of the corner point detection is determined as a corner point corresponding to the product image to be detected.
[0193] In one embodiment, the longitudinal integral image is sampled according to the size of the sampling distance to constantly obtain a plurality of sampling point coordinate pairs. The horizontal distance between the sampling point coordinate pairs is the size of the sampling distance. The differential value of the sampling point coordinate pairs is obtained by calculating the vertical distance between the sampling point coordinate pairs. The slope of the starting slope is obtained. The differential value of the sampling point coordinate pairs is compared with the slope of the starting slope.
[0194] When the differential value of the sampling point coordinate pair is greater than the slope of the starting slope, it is indicated that the starting condition of the corner point detection is met. The differential value of the sampling point coordinate pair greater than the slope of the starting slope is set as the starting condition of the corner point detection. Thus, the sampling point coordinate pair obtained in the early stage and having the differential value less than the slope of the ending slope is removed. The sampling is performed after the starting condition of the corner point detection is met to obtain the candidate sampling point coordinate pair. The slope of the starting slope is usually greater than the slope of the ending slope. The trend of the longitudinal integral image is usually upward, flat and then downward. The starting condition of the corner point detection is met first, and then the ending condition of the corner point detection is met to obtain the corner point corresponding to the product image to be detected.
[0195] Further, the sampling point coordinate pair meeting the starting condition of the corner point detection is used as the starting point of the candidate sampling region. The ending point of the candidate sampling region can be the ending point of the longitudinal integral image. The region before the starting condition of the corner point detection is removed. The region after the starting condition of the corner point detection is used as the candidate sampling region. The sampling distance is used to sample the candidate sampling region to obtain a plurality of candidate sampling point coordinate pairs corresponding to the sampling distance. The horizontal distance between the candidate sampling point coordinate pairs is the size of the sampling distance.
[0196] Similarly, by calculating the difference value of the plurality of candidate sampling point coordinate pairs obtained by sampling, the difference value can be specifically understood as the vertical distance between the candidate sampling point coordinate pairs, and the slope size of the preset end slope in the corner point detection parameter is obtained, and the difference value of the candidate sampling point coordinate pairs and the slope of the candidate slope are further compared. When the difference value of the candidate sampling point coordinate pairs is less than the slope of the end slope, it indicates that the current satisfies the corner point detection end condition. The corner point detection end condition can be understood as that the current sampling based on the longitudinal integral image and the processing of the corner point detection are completed, and further processing can be performed based on the candidate sampling point coordinate pairs determined at the completion time to obtain the corner point corresponding to the product image to be detected.
[0197] Finally, when the corner point detection end condition is detected, the sampling center point of the candidate sampling point coordinate pair satisfying the corner point detection end condition is obtained, and the sampling center point of the candidate sampling point coordinate pair is determined as the corner point corresponding to the product image to be detected.
[0198] In the above corner point detection method, by obtaining the product image to be detected and the template image matched with the product specification of the product image to be detected, and based on the template image, the position of the product image to be detected is adjusted to obtain a coarsely adjusted product image, thereby reducing the error caused by the position deviation of the product to be detected on the corner point detection. Further, according to the corner point template on the template image, the corner point region search processing is performed on the coarsely adjusted product image to obtain the corner point region matched with the corner point template on the coarsely adjusted product image, so as to preliminarily determine the corner point region where the corner point is located, so as to further perform the corner point detection processing based on the corner point detection parameter and the longitudinal integral image corresponding to the corner point region, solve the problem of inaccurate positioning of the corner point in the corner point region obtained by template matching, and quickly and accurately obtain the corner point corresponding to the product image to be detected, thereby improving the corner point detection efficiency of the product image to be detected.
[0199] It should be understood that, although each step in the flowchart involved in the above embodiments is displayed in sequence according to the arrow, these steps are not necessarily executed in sequence according to the arrow. Unless otherwise specified herein, the execution of these steps is not strictly limited in sequence, and these steps can be executed in other sequences. Moreover, at least part of the steps in the flowchart involved in the above embodiments can include multiple steps or stages, which are not necessarily executed at the same time, but can be executed at different times, and the execution sequence of these steps or stages is not necessarily sequential, but can be executed in rotation or alternation with at least part of other steps or steps or stages in other steps.
[0200] Based on the same inventive concept, the embodiments of the present application also provide an angle point detection device for implementing the angle point detection method described above. The implementation scheme of the device for solving the problem is similar to the implementation scheme described in the above method, so the specific limitations in one or more angle point detection device embodiments provided below can refer to the limitations of the angle point detection method described above, which will not be repeated here.
[0201] In one embodiment, as shown in Figure 16 An angle point detection device is provided, comprising: a to-be-detected product image acquisition module 1602, a position adjustment module 1604, an angle point region obtaining module 1606, and an angle point detection module 1608.
[0202] The to-be-detected product image acquisition module 1602 is configured to acquire a to-be-detected product image and a template image matching a product specification of the to-be-detected product image.
[0203] The position adjustment module 1604 is configured to perform position adjustment on the to-be-detected product image based on the template image to obtain a coarsely adjusted product image.
[0204] The angle point region obtaining module 1606 is configured to perform angle point region search processing on the coarsely adjusted product image according to an angle point template on the template image to obtain an angle point region on the coarsely adjusted product image matching the angle point template.
[0205] The angle point detection module 1608 is configured to perform angle point detection processing based on an angle point detection parameter and a longitudinal integral graph corresponding to the angle point region to obtain an angle point corresponding to the to-be-detected product image.
[0206] In the angle point detection device described above, the to-be-detected product image and the template image matching the product specification of the to-be-detected product image are acquired, and the to-be-detected product image is adjusted in position based on the template image to obtain a coarsely adjusted product image, thereby reducing the error caused by the position deviation of the to-be-detected product on the angle point detection. Further, the coarsely adjusted product image is processed according to the angle point template on the template image to obtain an angle point region on the coarsely adjusted product image matching the angle point template, so as to preliminarily determine the angle point region where the angle point is located, so as to further perform angle point detection processing based on the angle point detection parameter and the longitudinal integral graph corresponding to the angle point region, solve the problem of inaccurate positioning of the angle point in the angle point region obtained by template matching, and quickly and accurately obtain the angle point corresponding to the to-be-detected product image, thereby improving the angle point detection efficiency of the to-be-detected product image.
[0207] In an embodiment, the product image to be detected acquisition module is further configured to: acquire a product dot map, and perform binary segmentation processing on the product dot map to obtain a product image to be detected corresponding to the product dot map; determine a product specification corresponding to the product image to be detected; and perform matching processing on each candidate template image according to the product specification to obtain a template image that matches successfully.
[0208] In an embodiment, the corner point region acquisition module is further configured to: determine a search region on the coarsely adjusted product image according to the corner point template on the template image; and perform corner point region search processing according to the corner point template in the search region to obtain a corner point region that matches the corner point template.
[0209] In an embodiment, the corner point region acquisition module is further configured to: perform corner point region search processing according to the corner point template in the search region to obtain a plurality of candidate corner point regions; determine similarity data between the corner point template and each candidate corner point region; and determine a corner point region that matches the corner point template according to the similarity data.
[0210] In an embodiment, the corner point region acquisition module is further configured to: determine a first pixel average value corresponding to a template region included in the corner point template, and a second pixel average value corresponding to each candidate corner point region; determine a first pixel standard deviation corresponding to the corner point template according to the first pixel average value and coordinate values of each pixel point in the template region included in the corner point template; determine a second pixel standard deviation corresponding to the candidate corner point region according to the second pixel average value and coordinate values of each pixel point in the candidate corner point region; and determine similarity data between the corner point template and each candidate corner point region based on the first pixel average value, the first pixel standard deviation, the second pixel average value, the second pixel standard deviation, and a scaling parameter.
[0211] In an embodiment, the corner point detection module is further configured to: sequentially sample the longitudinal integral image according to a sampling distance to obtain a plurality of sample point coordinate pairs corresponding to the sampling distance; and determine a corner point corresponding to the product image to be detected if a difference value of the sample point coordinate pairs satisfies a corner point detection end condition.
[0212] In an embodiment, the corner point detection module is further configured to: determine that a corner point detection start condition is satisfied if the difference value of the sample point coordinate pairs is greater than a slope of a starting slope; determine a candidate sampling region that satisfies the corner point detection start condition from the longitudinal integral image; sequentially sample the candidate sampling region according to the sampling distance to obtain a plurality of candidate sample point coordinate pairs corresponding to the sampling distance; determine that a corner point detection end condition is satisfied if a difference value of the candidate sample point coordinate pairs is less than a slope of an ending slope; and determine a sample center point of the candidate sample point coordinate pair when the corner point detection end condition is satisfied as the corner point corresponding to the product image to be detected.
[0213] In an embodiment, the corner point detection apparatus is further provided with a longitudinal integral image obtaining module, configured to: sequentially perform longitudinal integral processing based on coordinate values of each pixel in the corner point region to obtain a longitudinal attribute value corresponding to each pixel in the corner point region; and generate an original longitudinal integral image corresponding to the corner point region according to the horizontal coordinate values of each pixel in the corner point region and the longitudinal attribute values.
[0214] In an embodiment, the longitudinal integral image obtaining module is further configured to: obtain the horizontal coordinate values of each pixel in the original longitudinal integral image; the horizontal coordinate values of each pixel in the original longitudinal integral image are arranged in ascending order; sequentially obtain the longitudinal attribute values corresponding to each horizontal coordinate according to the inverse order of the horizontal coordinate values; and obtain a flipped longitudinal integral image according to the horizontal coordinate values in the inverse order and the longitudinal attribute values corresponding to each horizontal coordinate.
[0215] In an embodiment, the corner point detection apparatus is further provided with: a corner point region obtaining module, configured to obtain a corner point region on a product image to be detected based on a trained key point detection model; and a corner point obtaining module, configured to perform corner point detection processing based on corner point detection parameters and a longitudinal integral image corresponding to the corner point region to obtain a corner point corresponding to the product image to be detected.
[0216] Each of the above modules of the corner point detection apparatus can be realized by software, hardware, or a combination thereof. Each of the above modules can be embedded in or independent of a processor in a computer device in hardware form, or stored in a memory in the computer device in software form, so as to be called and executed by a processor to perform operations corresponding to each of the above modules.
[0217] In an embodiment, a computer device is provided, which can be a server, and an internal structure diagram of the computer device can be as shown in FIG. 6. Figure 17As shown in the figure. The computer device includes a processor, a memory, an input / output interface (Input / Output, referred to as I / O) and a communication interface. Among them, the processor, the memory and the input / output interface are connected through the system bus, and the communication interface is connected to the system bus through the input / output interface. Among them, the processor of the computer device is used to provide computing and control capability. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program and a database. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The database of the computer device is used to store data such as to-be-detected product images, template images matched with product specifications of the to-be-detected product images, coarsely adjusted product images, corner point templates, corner point regions matched with the corner point templates on the coarsely adjusted product images, corner point detection parameters, longitudinal integral graphs corresponding to the corner point regions, and corner points corresponding to the to-be-detected product images. The input / output interface of the computer device is used to exchange information between the processor and external devices. The communication interface of the computer device is used to communicate with external terminals through network connection. The computer program is executed by the processor to implement a corner point detection method.
[0218] Those skilled in the art can understand that, Figure 17 The skilled in the art can understand that,
[0219] In one embodiment, a computer device is also provided, including a memory and a processor, the memory stores a computer program, and the processor executes the computer program to implement the steps in each of the above method embodiments.
[0220] In one embodiment, a computer readable storage medium is provided, which stores a computer program, and the computer program is executed by a processor to implement the steps in each of the above method embodiments.
[0221] In one embodiment, a computer program product is provided, including a computer program, and the computer program is executed by a processor to implement the steps in each of the above method embodiments.
[0222] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data for analysis, stored data, displayed data, etc.) involved in the present application are all information and data authorized by the user or authorized by all parties, and the collection, use and processing of related data need to comply with relevant laws, regulations and standards of relevant countries and regions.
[0223] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing the relevant hardware through a computer program. The computer program can be stored in a non-volatile computer readable storage medium, and when the computer program is executed, the processes of the above-mentioned embodiments of the methods can be included. Any reference to memory, database or other medium used in the embodiments provided in the present application can include at least one of non-volatile and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical storage, high-density embedded non-volatile memory, resistive memory (ReRAM), magnetoresistive random access memory (MRAM), ferroelectric memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. As an illustration but not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM), etc. The database involved in the embodiments provided in the present application can include at least one of a relational database and a non-relational database. The non-relational database can include a distributed database based on a block chain, etc., without being limited thereto. The processor involved in the embodiments provided in the present application can be a general-purpose processor, a central processing unit, a graphics processing unit, a digital signal processor, a programmable logic device, a data processing logic device based on quantum computing, etc., without being limited thereto.
[0224] Any combination of the technical features of the above embodiments can be made. In order to make the description simple, all possible combinations of the technical features in the above embodiments are not described, however, as long as the combination of the technical features does not exist, it should be considered as the scope of the present application.
[0225] The above embodiments only express several implementation manners of the present application, and the description is more specific and detailed, but it should not be understood as a limitation on the scope of the patent of the present application. It should be pointed out that for ordinary skilled in the art, without departing from the concept of the present application, a number of modifications and improvements can be made, which are within the scope of protection of the present application. Therefore, the protection scope of the present application should be subject to the appended claims.
Claims
1. A corner point detection method characterized by, The method comprises: acquiring a product image to be detected and a template image matching a product specification of the product image to be detected; performing position adjustment on the product image to be detected based on the template image to obtain a coarsely adjusted product image; performing corner point region search processing on the coarsely adjusted product image according to a corner point template on the template image to obtain a corner point region matching the corner point template on the coarsely adjusted product image; performing corner point detection processing based on a corner point detection parameter and a longitudinal integral graph corresponding to the corner point region to obtain a corner point corresponding to the product image to be detected; the corner point detection parameter comprises a sampling distance, a starting slope and an ending slope; the performing corner point detection processing based on the corner point detection parameter and the longitudinal integral graph corresponding to the corner point region to obtain the corner point corresponding to the product image to be detected comprises: sampling on the longitudinal integral graph in sequence according to the sampling distance to obtain a sampling point coordinate pair corresponding to the sampling distance; if a differential value of the sampling point coordinate pair is greater than a slope of the starting slope, it is determined that a corner point detection start condition is met; a candidate sampling region meeting the corner point detection start condition is determined from the longitudinal integral graph; sampling is performed in sequence on the candidate sampling region according to the sampling distance to obtain a candidate sampling point coordinate pair corresponding to the sampling distance; if a differential value of the candidate sampling point coordinate pair is less than the slope of the ending slope, it is determined that a corner point detection end condition is met; a sampling center point of the candidate sampling point coordinate pair when the corner point detection end condition is met is determined as the corner point corresponding to the product image to be detected.
2. The method of claim 1, wherein, the performing corner point region search processing on the coarsely adjusted product image according to the corner point template on the template image to obtain the corner point region matching the corner point template on the coarsely adjusted product image comprises: determining a search region on the coarsely adjusted product image according to the corner point template on the template image; performing corner point region search processing according to the corner point template in the search region to obtain the corner point region matching the corner point template.
3. The method of claim 2, wherein, the performing corner point region search processing according to the corner point template in the search region to obtain the corner point region matching the corner point template comprises: performing corner point region search processing according to the corner point template in the search region to obtain a plurality of candidate corner point regions; determining similarity data between the corner point template and each of the candidate corner point regions; determining the corner point region matching the corner point template according to the similarity data.
4. The method according to claim 2 or 3, characterized in that, the corner point template comprises a left corner point template and a right corner point template; the search region comprises a plurality of first search regions corresponding to the left corner point template and a plurality of second search regions corresponding to the right corner point template; each of the first search regions does not overlap, and each of the second search regions does not overlap.
5. The method of claim 3, wherein, the determining similarity data between the corner point template and each of the candidate corner point regions comprises: determining a first pixel average value corresponding to a template region included in the corner point template and a second pixel average value corresponding to each of the candidate corner point regions; determine a first pixel standard deviation corresponding to the corner point template according to the first pixel average value and coordinate values of each pixel point in a template region included in the corner point template; determine a second pixel standard deviation corresponding to the candidate corner point region according to the second pixel average value and coordinate values of each pixel point in the candidate corner point region; determine similarity data between the corner point template and each candidate corner point region based on the first pixel average value, the first pixel standard deviation, the second pixel average value, the second pixel standard deviation, and a scaling parameter.
6. The method according to any one of claims 1 to 3, characterized in that, Before the corner point detection processing is performed based on the corner point detection parameter and the longitudinal integral graph corresponding to the corner point region, the method further includes: performing longitudinal integral processing on the coordinate values of each pixel point in the corner point region in sequence to obtain a longitudinal attribute value corresponding to each pixel point in the corner point region; generate an original longitudinal integral graph corresponding to the corner point region according to the longitudinal attribute values and the abscissa values of each pixel point in the corner point region.
7. The method of claim 6, wherein, After the original longitudinal integral graph corresponding to the corner point region is generated according to the longitudinal attribute values and the abscissa values of each pixel point in the corner point region, the method further includes: obtain the abscissa values of each pixel point in the original longitudinal integral graph; the abscissa values of each pixel point in the original longitudinal integral graph are in ascending order; obtain the longitudinal attribute values corresponding to each abscissa value in reverse order of the abscissa values; and obtain a flipped longitudinal integral graph according to the abscissa values in reverse order and the longitudinal attribute values corresponding to each abscissa value.
8. The method according to any one of claims 1 to 3, characterized in that, The method of obtaining the product image to be detected and the template image matching the product specification of the product image to be detected includes: obtain a product point position map, and perform binary segmentation processing on the product point position map to obtain the product image to be detected corresponding to the product point position map; determine the product specification corresponding to the product image to be detected; perform matching processing on each candidate template image according to the product specification to obtain a template image that matches successfully.
9. A corner point detection apparatus characterized by comprising: The device includes: a product image to be detected obtaining module configured to obtain a product image to be detected and a template image matching a product specification of the product image to be detected; a position adjusting module configured to perform position adjustment on the product image to be detected based on the template image to obtain a coarsely adjusted product image; a corner point region obtaining module configured to perform corner point region search processing on the coarsely adjusted product image according to a corner point template on the template image to obtain a corner point region on the coarsely adjusted product image that matches the corner point template; a corner point detection module configured to perform corner point detection processing based on a corner point detection parameter and a longitudinal integral graph corresponding to the corner point region to obtain a corner point corresponding to the product image to be detected. The corner point detection parameter comprises a sampling distance, a start slope and an end slope; the corner point detection module is further configured to: sample the longitudinal integral graph according to the sampling distance to obtain a sampling point coordinate pair corresponding to the sampling distance; if a differential value of the sampling point coordinate pair is greater than a slope of the start slope, it is determined that a corner point detection start condition is met; a candidate sampling region meeting the corner point detection start condition is determined from the longitudinal integral graph; sampling is performed in the candidate sampling region according to the sampling distance to obtain a candidate sampling point coordinate pair corresponding to the sampling distance; if a differential value of the candidate sampling point coordinate pair is less than the slope of the end slope, it is determined that a corner point detection end condition is met; a sampling center point of the candidate sampling point coordinate pair when the corner point detection end condition is met is determined as a corner point corresponding to the product image to be detected.
10. The apparatus of claim 9, wherein, The corner point region obtaining module is further configured to: determine a search region on the rough product image according to the corner point template on the template image; and perform a corner point region search process according to the corner point template in the search region to obtain a corner point region matched with the corner point template.
11. The apparatus of claim 10, wherein, The corner point region obtaining module is further configured to: perform a corner point region search process according to the corner point template in the search region to obtain a plurality of candidate corner point regions; determine similarity data between the corner point template and each of the candidate corner point regions; and determine a corner point region matched with the corner point template according to the similarity data.
12. The apparatus of claim 11, wherein, The corner point region obtaining module is further configured to: determine a first pixel average value corresponding to a template region included in the corner point template, and a second pixel average value corresponding to each of the candidate corner point regions; determine a first pixel standard deviation corresponding to the corner point template according to the first pixel average value and coordinate values of each pixel point in the template region included in the corner point template; determine a second pixel standard deviation corresponding to each of the candidate corner point regions according to the second pixel average value and coordinate values of each pixel point in the candidate corner point region; and determine similarity data between the corner point template and each of the candidate corner point regions based on the first pixel average value, the first pixel standard deviation, the second pixel average value, the second pixel standard deviation and a scaling parameter.
13. The apparatus of any one of claims 9 to 11, wherein, The device further comprises a longitudinal integral graph obtaining module configured to: perform longitudinal integration processing according to coordinate values of each pixel point in the corner point region to obtain a longitudinal attribute value corresponding to each pixel point in the corner point region; and generate an original longitudinal integral graph corresponding to the corner point region according to the longitudinal attribute value and the horizontal coordinate value of each pixel point in the corner point region.
14. The apparatus of claim 13, wherein, The longitudinal integral graph obtaining module is further configured to: The value of the abscissa of each pixel point in the original longitudinal integral graph is obtained; the value of the abscissa of each pixel point in the original longitudinal integral graph is from small to large; the longitudinal attribute value corresponding to each abscissa is obtained in turn according to the inverse order of the value of each abscissa; and the flipped longitudinal integral graph is obtained according to the value of each abscissa after being reversed in order and the longitudinal attribute value corresponding to each abscissa.
15. The apparatus of any one of claims 9 to 11, wherein, The product image to be detected acquisition module is further used for: A product point position graph is obtained, and binary segmentation processing is performed on the product point position graph to obtain a product image to be detected corresponding to the product point position graph; a product specification corresponding to the product image to be detected is determined; and each candidate template image is matched according to the product specification to obtain a template image that is successfully matched. 16.A computer device, comprising a memory and a processor, wherein the memory stores a computer program, and the computer device is configured to perform the method according to any one of claims 1-15. The processor executes the computer program to implement the steps of the method in any one of claims 1 to 8.
17. A computer readable storage medium having stored thereon a computer program, characterized in that, The computer program is executed by the processor to implement the steps of the method in any one of claims 1 to 8.
18. A computer program product comprising a computer program, characterized in that, The computer program is executed by the processor to implement the steps of the method in any one of claims 1 to 8.
Citation Information
Patent Citations
Airplane detection method based on airport remote sensing image
CN108564602A
Method for detecting and recognizing objects of an image using haar-like features
US20120328160A1