A machine vision positioning method, device and system

By identifying and analyzing the inner and outer contours of the workpiece and determining its geometric center, the problem of inaccurate positioning of the workpiece in the prior art is solved, improving the processing quality and automatic positioning are achieved, and manual operation costs are reduced.

CN118518005BActive Publication Date: 2024-12-10SHENZHEN XINHEFA MASCH EQUIP CO LTD
View PDF 0 Cites 1 Cited by

Patent Information

Application Number
CN202410604516.0
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-05-15
Publication Date
2024-12-10
Estimated Expiration
2044-05-15

AI Technical Summary

Technical Problem

Existing visual positioning techniques are difficult to accurately locate the processing points on the workpiece, which affects the processing quality.

Method used

By mobilizing the camera to move in parallel with the cutting surface of the product, we collect images, intercept sub-images, combine them into target images, identify the outer and inner contours, generate rectangles, connect the rectangular geometric centers, determine the center point according to the area proportional relationship, and make the coordinates of the processing equipment Align the origin and the center point to complete the visual positioning of the product.

Benefits of technology

The deviation between the center point and the inner and outer contours is reduced, the processing allowance is balanced, the product quality is improved, and the automatic positioning of the product center and the equipment center is realized, reducing labor costs.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118518005B_ABST
    Figure CN118518005B_ABST
Patent Text Reader

Abstract

The present invention relates to the field of computers, and in particular to a machine vision positioning method, device and system, wherein the method first captures an image of a product, then performs shape analysis on the product in the image, finds the geometric centers of the inner and outer contours by identifying and analyzing the shapes of the inner and outer contours, and then determines the center point of the entire product based on the two geometric centers; in the present application, the deviation between the center point and the different positions of the inner and outer contours is reduced, the processing allowance is balanced, the processing amount is more balanced on the inner and outer surfaces of the product, and the product quality is improved; and under the condition of ensuring the processing quality, the automatic positioning of the product center and the equipment center is realized, and no additional manual operation is required, thereby reducing labor costs.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of computers, and in particular to a machine vision positioning method, device and system. Background Art

[0002] Visual positioning technology mainly relies on image processing and machine learning algorithms, and is widely used in automated production lines to assist in the processing of workpieces.

[0003] The existing visual positioning technology mainly plays the role of visual monitoring of the processing in the auxiliary processing process to identify the workpiece to be processed, but it is difficult to accurately locate the processing points on the workpiece, and thus it is difficult to ensure the accurate processing of the workpiece, affecting the processing quality of the workpiece.

[0004] Therefore, the existing visual positioning method has the problem of difficulty in accurately locating the processing position of the workpiece. Summary of the invention

[0005] Based on this, it is necessary to provide a machine vision positioning method, device and system to address the above-mentioned problems.

[0006] The embodiment of the present invention is implemented as follows: a machine vision positioning method, the method comprising:

[0007] S1: Move the camera along a plane parallel to the cutting surface of the product and collect several images;

[0008] S2: For any captured image, a sub-image of a set size is captured at the center of the image;

[0009] S3: combining the sub-images to obtain a target image;

[0010] S4: Identify the outer and inner contours of the product in the target image;

[0011] S5: Generate a first quadrilateral according to the outer contour in the target image;

[0012] S6: Generate a first rectangle according to the first quadrilateral and the contour area of ​​the outer contour;

[0013] S7: generating a second quadrilateral according to the inner contour in the target image;

[0014] S8: generating a second rectangle according to the second quadrilateral and the contour area of ​​the inner contour;

[0015] S9: Connecting the geometric centers of the first rectangle and the second rectangle to obtain a line segment;

[0016] S10: Determine the center point on the obtained line segment according to the area ratio relationship between the first rectangle and the second rectangle, align the coordinate origin of the processing equipment with the center point, and complete the visual positioning of the product.

[0017] In one embodiment, the present invention provides a machine vision positioning device, the device comprising:

[0018] An image acquisition module is used to move the camera along a plane parallel to the cutting surface of the product and acquire a number of images;

[0019] An image capture module is used to capture a sub-image of a set size at the center of any captured image;

[0020] An image combination module, used for combining the sub-images to obtain a target image;

[0021] A first processing module, for identifying an outer contour and an inner contour of a product in a target image;

[0022] A second processing module, used for generating a first quadrilateral according to an outer contour in the target image;

[0023] A third processing module, configured to generate a first rectangle according to the first quadrilateral and the contour area of ​​the outer contour;

[0024] A fourth processing module, used for generating a second quadrilateral according to an inner contour in the target image;

[0025] A fifth processing module, configured to generate a second rectangle according to the second quadrilateral and the contour area of ​​the inner contour;

[0026] A sixth processing module, used to connect the geometric centers of the first rectangle and the second rectangle to obtain a line segment;

[0027] The positioning module is used to determine the center point on the obtained line segment according to the area ratio relationship between the first rectangle and the second rectangle, so as to align the coordinate origin of the processing equipment with the center point and complete the visual positioning of the product.

[0028] In one embodiment, the present invention provides a machine vision positioning system, the system comprising:

[0029] A camera, used to capture product images;

[0030] A computer device is connected to the camera and is used to execute the machine vision positioning method.

[0031] The present invention provides a machine vision positioning method, device and system, wherein the method comprises: moving a camera along a plane parallel to a cutting surface of a product and collecting a plurality of images; for any collected image, intercepting a sub-image of a set size at the center of the image; combining the sub-images to obtain a target image; identifying the outer contour and inner contour of the product in the target image; generating a first quadrilateral according to the outer contour in the target image; generating a first rectangle according to the first quadrilateral and the contour area of ​​the outer contour; generating a second quadrilateral according to the inner contour in the target image; generating a second rectangle according to the second quadrilateral and the contour area of ​​the inner contour; connecting the first rectangle and the second rectangle; A line segment is obtained by finding the geometric center of the shape; a center point is determined on the obtained line segment according to the area ratio relationship between the first rectangle and the second rectangle, so that the coordinate origin of the processing equipment is aligned with the center point, and the visual positioning of the product is completed; in the present application, the geometric center of the inner and outer contours is found by identifying and analyzing the shape of the inner and outer contours, and then the center point of the entire product is determined based on the two geometric centers, thereby reducing the deviation between the center point and the different positions of the inner and outer contours, balancing the processing allowance, making the processing amount more balanced on the inner and outer surfaces of the product, and improving the product quality; and under the condition of ensuring the processing quality, the automatic positioning of the product center and the equipment center is realized, without the need for additional manual operations, thereby reducing labor costs. BRIEF DESCRIPTION OF THE DRAWINGS

[0032] Figure 1 A first flow chart of a machine vision positioning method provided in one embodiment;

[0033] Figure 2 A second flow chart of a machine vision positioning method provided in one embodiment;

[0034] Figure 3 A product image interface diagram of a machine vision positioning method provided in one embodiment;

[0035] Figure 4 A module flow chart of a machine vision positioning device provided in one embodiment;

[0036] Figure 5 A schematic diagram of the composition of a machine vision positioning system provided in one embodiment;

[0037] Figure 6 FIG. 4 is a block diagram of the internal structure of a computer device in one embodiment. DETAILED DESCRIPTION

[0038] In order to make the purpose, technical solution and advantages of the present invention more clearly understood, the present invention is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present invention and are not intended to limit the present invention.

[0039] It is understood that the terms "first", "second", etc. used in the present invention may be used herein to describe various elements, but unless otherwise specified, these elements are not limited by these terms. These terms are only used to distinguish a first element from another element. For example, a first xx script may be referred to as a second xx script, and similarly, a second xx script may be referred to as a first xx script without departing from the scope of the present invention.

[0040] like Figure 1-2 As shown, in one embodiment, a machine vision positioning method is proposed, the method comprising:

[0041] S1: Move the camera along a plane parallel to the cutting surface of the product and collect several images;

[0042] S2: For any captured image, a sub-image of a set size is captured at the center of the image;

[0043] S3: combining the sub-images to obtain a target image;

[0044] S4: Identify the outer and inner contours of the product in the target image;

[0045] S5: Generate a first quadrilateral according to the outer contour in the target image;

[0046] S6: Generate a first rectangle according to the first quadrilateral and the contour area of ​​the outer contour;

[0047] S7: generating a second quadrilateral according to the inner contour in the target image;

[0048] S8: generating a second rectangle according to the second quadrilateral and the contour area of ​​the inner contour;

[0049] S9: Connecting the geometric centers of the first rectangle and the second rectangle to obtain a line segment;

[0050] S10: Determine the center point on the obtained line segment according to the area ratio relationship between the first rectangle and the second rectangle, align the coordinate origin of the processing equipment with the center point, and complete the visual positioning of the product.

[0051] In this embodiment, the method is executed in a computer device, which may be an independent physical server or terminal, or a server cluster composed of multiple physical servers, or a cloud server that provides basic cloud computing services such as cloud servers, cloud databases, cloud storage, and CDN; the camera of the method is a CCD industrial camera; the camera is connected to the computer device, the computer device can mobilize the camera to collect images, and the images collected by the camera can be sent to the computer device;

[0052] In this embodiment, this method is applied to the processing process of a quadrilateral box workpiece with internal and external contours (such as a reducer). Before processing, the workpiece is cut to cut out a horizontal plane as a processing reference plane; then the camera is adjusted to maintain a suitable height (for example, 30 cm from the reference plane) and moved parallel to the reference plane directly above the workpiece to capture images of the workpiece.

[0053] In this embodiment, the generated first rectangle is the most approximate rectangle of the outer contour, and the generated second rectangle is the most approximate rectangle of the inner contour. The center point determined by the geometric centers of the first rectangle and the second rectangle can maintain a suitable distance from both the inner and outer contours.

[0054] In this application, first collect the image of the product (such as Figure 3 As shown), the product in the image is then subjected to shape analysis, the geometric centers of the inner and outer contours are found through recognition and shape analysis of the inner and outer contours, and the center point of the entire product is determined based on the two geometric centers; in the present application, the deviation between the center point and the different positions of the inner and outer contours is reduced, the machining allowance is balanced, the machining amount is more balanced on the inner and outer surfaces of the product, and the product quality is improved; and under the condition of ensuring the machining quality, the automatic positioning of the product center and the equipment center is realized, and no additional manual operation is required, thereby reducing labor costs.

[0055] As a preferred embodiment, for any captured image, intercepting a sub-image of a set size at the center of the image includes:

[0056] Establishing a plane coordinate system on the image;

[0057] Delimiting a first set range on the image;

[0058] For any pixel in the first set range, the pre-distortion coordinates of the pixel are calculated according to the current coordinates of the pixel, and the pixel is moved to the pre-distortion coordinates;

[0059] Delimiting a second set range on the image, wherein the second set range is smaller than the first set range and the second set range is completely within the first set range;

[0060] The image surrounded by the second set range is cut out to obtain a sub-image.

[0061] The horizontal coordinate of the pixel before distortion is calculated in reverse by the following set of equations:

[0062]

[0063] Among them, x d is the current horizontal coordinate, x is the horizontal coordinate before distortion, y is dis the current ordinate, y is the ordinate before distortion, p1 is the first distortion coefficient, p2 is the second distortion coefficient, r is the distance parameter, r satisfies the condition r 2 =x 2 +y 2 .

[0064] In this embodiment, the first setting range and the second setting range are both in the center of the image, the second setting range is located within the first setting range, and the centers of the first setting range and the second setting range coincide, each side of the first setting range is parallel to each edge of the camera view, the shape of the second setting range is consistent with the first setting range, and each side of the second setting range is parallel to the corresponding side of the first setting range; the area of ​​the first setting range can be set to 200 pixels * 200 pixels, and the area of ​​the first setting range can be set to 100 pixels * 100 pixels, and the set size is the area size of the first setting range;

[0065] In this embodiment, the computer device mobilizes the camera to perform grid-type translation acquisition, that is, an image is acquired every time a certain distance is moved, and then a sub-image of a second set range located in the center is cut out from each image, and then the sub-images are combined to obtain a target image. Due to the reasons of the camera hardware itself, the closer the image is to the edge, the more likely the image is to be distorted. Therefore, the way of combining the sub-images makes the distortion of the obtained image within a smaller range, but this method still cannot completely eliminate the distortion. Therefore, by calculating the coordinates of the pixels before distortion and resetting the corresponding pixels, the impact of image distortion can be further reduced. Each pixel can be regarded as an extremely small image. After resetting the pixels, if two pixels are moved to the same position, the pixel moved first will be covered or partially covered by the pixel moved later, that is, a pixel stack is formed. At this time, the final image is displayed with the topmost exposed part after the stack.

[0066] As a preferred embodiment, decolorization is performed on the target image to enhance the contrast of the target image;

[0067] The first quadrilateral is generated according to the outer contour in the target image, that is, a quadrilateral having the smallest average distance from pixels on the outer contour of the product is generated;

[0068] The second quadrilateral is generated according to the inner contour in the target image, that is, a quadrilateral having the smallest average distance from pixels on the inner contour of the product is generated.

[0069] The average distance between the pixels on the contour and the edge of the quadrilateral is calculated by the following formula:

[0070]

[0071] Among them, Da is the average distance, n is the total number of pixels on the outermost side of the contour, d i is the distance between the outermost pixel of the i-th contour and the edge of the quadrilateral.

[0072] In this embodiment, the present application adopts a contour recognition algorithm based on edge detection to identify the inner and outer contours of the product. The identified contour may be composed of several layers of pixels in the width direction, and the pixels used to calculate the average distance refer specifically to the pixels of the outermost layer of the contour; the outer contour / inner contour is approximately composed of four sides, and through each side of the contour, a straight line can be determined with the minimum average distance from the edge, so that four straight lines can be determined for the outer contour / inner contour, and the quadrilateral formed by these four straight lines is the quadrilateral with the minimum average distance from the pixels on the outer contour / inner contour of the product.

[0073] As a preferred embodiment, generating the first rectangle according to the first quadrilateral and the contour area of ​​the outer contour includes:

[0074] Determine a frame area that can just enclose the contour line of the outer contour;

[0075] Determine a rectangle that is completely within the frame area and has the smallest sum of angles with each side of the first quadrilateral as the first rectangle;

[0076] After the first rectangle is generated, the first rectangle is adjusted, including:

[0077] Select a corner point of the first rectangle, and adjust the corner point of the opposite corner so that the average distance between the rectangular side intersecting at the corner point of the opposite corner and the pixels on the outer contour is minimized while keeping the first rectangle always rectangular;

[0078] The selected corner point is adjusted to change the length of the side of the rectangle intersecting the selected corner point, so as to minimize the difference in area between the first rectangle and the first quadrilateral while keeping the first rectangle always a rectangle.

[0079] Generating the second rectangle according to the second quadrilateral and the contour area of ​​the outer contour comprises:

[0080] Determine a frame area that can just enclose the contour line of the inner contour;

[0081] Determine a rectangle that is completely within the frame area and has the smallest sum of angles with each side of the second quadrilateral as the second rectangle;

[0082] After the second rectangle is generated, the second rectangle is adjusted, including:

[0083] Select a corner point of the second rectangle, and adjust the corner point of the opposite corner so that the average distance between the rectangular side intersecting at the corner point of the opposite corner and the pixels on the inner contour is minimized while keeping the second rectangle always rectangular;

[0084] The selected corner point is adjusted to change the length of the side of the rectangle intersecting the selected corner point, so as to minimize the difference in area between the second rectangle and the second quadrilateral while keeping the second rectangle always a rectangle.

[0085] In this embodiment, the frame area is the contour area; the obtained first quadrilateral / second quadrilateral is not necessarily a regular quadrilateral, and the geometric center determined by it may have a large deviation, so it is necessary to generate a corresponding rectangle based on the first quadrilateral / second quadrilateral; the generated rectangle falls in the frame area and has the smallest sum of angles with the sides of the second quadrilateral, ensuring that it does not have too large position and angle deviations from the contour; in the process of adjusting the rectangle, the corner points of the rectangle are selected, that is, the corner points where the two adjacent sides with the smallest average distance from the contour pixels are located are selected; by adjusting the diagonal corner points of the selected corner points, the average distance between the two sides corresponding to the diagonal corner points and the contour pixels can be minimized, and further, by adjusting the selected corner points to minimize the difference in area between the rectangle and the quadrilateral, and in the adjustment process, the average distance between the selected corner points and the corresponding two sides and the contour pixels is minimized as much as possible, so that a rectangle closest to the quadrilateral can be obtained.

[0086] As a preferred embodiment, determining the center point on the obtained line segment according to the area ratio relationship between the first rectangle and the second rectangle includes:

[0087] A center point is determined on a line connecting the geometric center of the first rectangle and the geometric center of the second rectangle, so that the ratio of the distance from the geometric center of the first rectangle to the center point to the distance from the geometric center of the second rectangle is equal to the area ratio of the first rectangle to the second rectangle.

[0088] In this embodiment, the influence of the area size on the geometric center position of the rectangle is fully considered, thereby improving the position accuracy of the determined center point, so that after the coordinate origin of the processing equipment is aligned with the center point, the visual positioning of the product can be accurately completed.

[0089] like Figure 4 As shown, in one embodiment, a machine vision positioning device is proposed, the device comprising:

[0090] An image acquisition module is used to move the camera along a plane parallel to the cutting surface of the product and acquire a number of images;

[0091] An image capture module is used to capture a sub-image of a set size at the center of any captured image;

[0092] An image combination module, used for combining the sub-images to obtain a target image;

[0093] A first processing module, for identifying an outer contour and an inner contour of a product in a target image;

[0094] A second processing module, used for generating a first quadrilateral according to an outer contour in the target image;

[0095] A third processing module, configured to generate a first rectangle according to the first quadrilateral and the contour area of ​​the outer contour;

[0096] A fourth processing module, used for generating a second quadrilateral according to an inner contour in the target image;

[0097] A fifth processing module, configured to generate a second rectangle according to the second quadrilateral and the contour area of ​​the inner contour;

[0098] A sixth processing module, used to connect the geometric centers of the first rectangle and the second rectangle to obtain a line segment;

[0099] The positioning module is used to determine the center point on the obtained line segment according to the area ratio relationship between the first rectangle and the second rectangle, so as to align the coordinate origin of the processing equipment with the center point and complete the visual positioning of the product.

[0100] The process of each module in the machine vision positioning device provided in the embodiment of the present application realizing its own function can be specifically referred to the aforementioned Figure 1 The description of the illustrated embodiment will not be repeated here.

[0101] like Figure 5 As shown, in one embodiment, a machine vision positioning system is proposed, the system comprising:

[0102] A camera, used to capture product images;

[0103] A computer device is connected to the camera and is used to execute the machine vision positioning method.

[0104] In this embodiment, the computer device cooperates with the camera to first capture the image of the product, and then perform shape analysis on the product in the image, find the geometric center of the inner and outer contours through recognition and shape analysis of the inner and outer contours, and then determine the center point of the entire product based on the two geometric centers; in this application, the deviation between the center point and the different positions of the inner and outer contours is reduced, and the processing allowance is balanced, so that the processing amount is more balanced on the inside and outside of the product, thereby improving the product quality; and under the condition of ensuring the processing quality, the automatic positioning of the product center and the equipment center is realized, without the need for additional manual operations, thereby reducing labor costs.

[0105] Figure 6 FIG. 2 shows an internal structure diagram of a computer device in one embodiment. Figure 6As shown, the computer device includes a processor, a memory, a network interface, an input device and a display screen connected through a system bus. Among them, the memory includes a non-volatile storage medium and an internal memory. The non-volatile storage medium of the computer device stores an operating system and may also store a computer program. When the computer program is executed by the processor, the processor can implement the machine vision positioning method provided by the embodiment of the present invention. The internal memory may also store a computer program. When the computer program is executed by the processor, the processor can execute the machine vision positioning method provided by the embodiment of the present invention. The display screen of the computer device may be a liquid crystal display screen or an electronic ink display screen, and the input device of the computer device may be a touch layer covering the display screen, or a button, trackball or touchpad provided on the housing of the computer device, or an external keyboard, touchpad or mouse, etc.

[0106] Those skilled in the art will understand that Figure 6 The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present invention, and does not constitute a limitation on the computer device to which the solution of the present invention is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.

[0107] In one embodiment, the machine vision positioning device provided by the embodiment of the present invention can be implemented in the form of a computer program. The computer program can be used in Figure 6 The computer device shown in the figure is run. The memory of the computer device can store various program modules constituting the machine vision positioning device, for example, Figure 4 The image acquisition module, image interception module, image combination module, first processing module, second processing module, third processing module, fourth processing module, fifth processing module, sixth processing module and positioning module shown in the figure. The computer program composed of each program module enables the processor to execute the steps of the machine vision positioning method of each embodiment of the present invention described in this specification.

[0108] For example, Figure 6 The computer device shown can be Figure 4The image acquisition module in the machine vision positioning device shown executes step S1; the computer device may execute step S2 through the image capture module; the computer device may execute step S3 through the image combination module; the computer device may execute step S4 through the first processing module; the computer device may execute step S5 through the second processing module; the computer device may execute step S6 through the third processing module; the computer device may execute step S7 through the fourth processing module; the computer device may execute step S8 through the fifth processing module; the computer device may execute step S9 through the sixth processing module; the computer device may execute step S10 through the positioning module.

[0109] In one embodiment, a computer device is provided, the computer device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the computer program, the following steps are implemented:

[0110] S1: Move the camera along a plane parallel to the cutting surface of the product and collect several images;

[0111] S2: For any captured image, a sub-image of a set size is captured at the center of the image;

[0112] S3: combining the sub-images to obtain a target image;

[0113] S4: Identify the outer and inner contours of the product in the target image;

[0114] S5: Generate a first quadrilateral according to the outer contour in the target image;

[0115] S6: Generate a first rectangle according to the first quadrilateral and the contour area of ​​the outer contour;

[0116] S7: generating a second quadrilateral according to the inner contour in the target image;

[0117] S8: generating a second rectangle according to the second quadrilateral and the contour area of ​​the inner contour;

[0118] S9: Connecting the geometric centers of the first rectangle and the second rectangle to obtain a line segment;

[0119] S10: Determine the center point on the obtained line segment according to the area ratio relationship between the first rectangle and the second rectangle, align the coordinate origin of the processing equipment with the center point, and complete the visual positioning of the product.

[0120] In one embodiment, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the processor performs the following steps:

[0121] S1: Move the camera along a plane parallel to the cutting surface of the product and collect several images;

[0122] S2: For any captured image, a sub-image of a set size is captured at the center of the image;

[0123] S3: combining the sub-images to obtain a target image;

[0124] S4: Identify the outer and inner contours of the product in the target image;

[0125] S5: Generate a first quadrilateral according to the outer contour in the target image;

[0126] S6: Generate a first rectangle according to the first quadrilateral and the contour area of ​​the outer contour;

[0127] S7: generating a second quadrilateral according to the inner contour in the target image;

[0128] S8: generating a second rectangle according to the second quadrilateral and the contour area of ​​the inner contour;

[0129] S9: Connecting the geometric centers of the first rectangle and the second rectangle to obtain a line segment;

[0130] S10: Determine the center point on the obtained line segment according to the area ratio relationship between the first rectangle and the second rectangle, align the coordinate origin of the processing equipment with the center point, and complete the visual positioning of the product.

[0131] It should be understood that, although each step in the flow chart of each embodiment of the present invention is shown in sequence according to the indication of the arrow, these steps are not necessarily performed in sequence according to the order indicated by the arrow. Unless there is a clear explanation in this article, the execution of these steps does not have a strict order restriction, and these steps can be performed in other orders. Moreover, at least a portion of the steps in each embodiment may include a plurality of sub-steps or a plurality of stages, and these sub-steps or stages are not necessarily performed at the same time, but can be performed at different times, and the execution order of these sub-steps or stages is not necessarily performed in sequence, but can be performed in turn or alternately with at least a portion of other steps or sub-steps or stages of other steps.

[0132] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiments can be completed by instructing the relevant hardware through a computer program, and the program can be stored in a non-volatile computer-readable storage medium. When the program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to memory, storage, database or other media used in the embodiments provided by the present invention can include non-volatile and / or volatile memory. Non-volatile memory can include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM) or flash memory. Volatile memory can include random access memory (RAM) or external cache memory. As an illustration and not limitation, RAM is available in many forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronous link (Synchlink) DRAM (SLDRAM), memory bus (Rambus) direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM).

[0133] The technical features of the above-described embodiments may be arbitrarily combined. To make the description concise, not all possible combinations of the technical features in the above-described embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.

[0134] The above-mentioned embodiments only express several implementation methods of the present invention, and the description thereof is relatively specific and detailed, but it cannot be understood as limiting the scope of the present invention. It should be pointed out that, for ordinary technicians in this field, several variations and improvements can be made without departing from the concept of the present invention, which all belong to the protection scope of the present invention.

Claims

1. A machine vision positioning method, characterized in that: The method comprises: S1: Move the camera along a plane parallel to the cutting surface of the product and collect several images; S2: For any captured image, a sub-image of a set size is captured at the center of the image; S3: combining the sub-images to obtain a target image; S4: Identify the outer and inner contours of the product in the target image; S5: Generate a first quadrilateral according to the outer contour in the target image; S6: Generate a first rectangle according to the first quadrilateral and the contour area of ​​the outer contour; S7: generating a second quadrilateral according to the inner contour in the target image; S8: generating a second rectangle according to the second quadrilateral and the contour area of ​​the inner contour; S9: Connecting the geometric centers of the first rectangle and the second rectangle to obtain a line segment; S10: Determine the center point on the obtained line segment according to the area ratio relationship between the first rectangle and the second rectangle, align the coordinate origin of the processing equipment with the center point, and complete the visual positioning of the product.

2. The method according to claim 1, characterized in that For any captured image, intercepting a sub-image of a set size at the center of the image includes: Establishing a plane coordinate system on the image; Delimiting a first set range on the image; For any pixel in the first set range, the pre-distortion coordinates of the pixel are calculated according to the current coordinates of the pixel, and the pixel is moved to the pre-distortion coordinates; Delimiting a second set range on the image, wherein the second set range is smaller than the first set range and the second set range is completely within the first set range; The image surrounded by the second set range is cut out to obtain a sub-image.

3. The method according to claim 2, characterized in that The horizontal coordinate of the pixel before distortion is calculated in reverse by the following set of equations: Among them, x d is the current horizontal coordinate, x is the horizontal coordinate before distortion, y is d is the current ordinate, y is the ordinate before distortion, p1 is the first distortion coefficient, p2 is the second distortion coefficient, r is the distance parameter, r satisfies the condition r 2 =x 2 +y 2 .

4. The method according to claim 1, characterized in that: After obtaining the target image, decolorizing the target image to improve the contrast of the target image; The first quadrilateral is generated according to the outer contour in the target image, that is, a quadrilateral having the smallest average distance from pixels on the outer contour of the product is generated; The second quadrilateral is generated according to the inner contour in the target image, that is, a quadrilateral having the smallest average distance from pixels on the inner contour of the product is generated.

5. The method according to claim 4, characterized in that The average distance between the pixels on the contour and the edge of the quadrilateral is calculated by the following formula: Among them, D a is the average distance, n is the total number of pixels on the outermost side of the contour, d i is the distance between the outermost pixel of the i-th contour and the edge of the quadrilateral.

6. The method according to claim 4, characterized in that Generating the first rectangle according to the first quadrilateral and the contour area of ​​the outer contour comprises: Determine a frame area that can just enclose the contour line of the outer contour; Determine a rectangle that is completely within the frame area and has the smallest sum of angles with each side of the first quadrilateral as the first rectangle; After the first rectangle is generated, the first rectangle is adjusted, including: Select a corner point of the first rectangle, and adjust the corner point of the opposite corner so that the average distance between the rectangular side intersecting at the corner point of the opposite corner and the pixels on the outer contour is minimized while keeping the first rectangle always rectangular; The selected corner point is adjusted to change the length of the side of the rectangle intersecting the selected corner point, so as to minimize the difference in area between the first rectangle and the first quadrilateral while keeping the first rectangle always a rectangle.

7. The method according to claim 4, characterized in that Generating the second rectangle according to the second quadrilateral and the contour area of ​​the outer contour comprises: Determine a frame area that can just enclose the contour line of the inner contour; Determine a rectangle that is completely within the frame area and has the smallest sum of angles with each side of the second quadrilateral as the second rectangle; After the second rectangle is generated, the second rectangle is adjusted, including: Select a corner point of the second rectangle, and adjust the corner point of the opposite corner so that the average distance between the rectangular side intersecting at the corner point of the opposite corner and the pixels on the inner contour is minimized while keeping the second rectangle always rectangular; The selected corner point is adjusted to change the length of the side of the rectangle intersecting the selected corner point, so as to minimize the difference in area between the second rectangle and the second quadrilateral while keeping the second rectangle always a rectangle.

8. The method according to claim 1, characterized in that Determining the center point on the obtained line segment according to the area ratio relationship between the first rectangle and the second rectangle includes: A center point is determined on a line connecting the geometric center of the first rectangle and the geometric center of the second rectangle, so that the ratio of the distance from the geometric center of the first rectangle to the center point to the distance from the geometric center of the second rectangle is equal to the area ratio of the first rectangle to the second rectangle.

9. A machine vision positioning device, characterized in that: The device comprises: An image acquisition module is used to move the camera along a plane parallel to the cutting surface of the product and acquire a number of images; An image capture module is used to capture a sub-image of a set size at the center of any captured image; An image combination module, used for combining the sub-images to obtain a target image; A first processing module, for identifying an outer contour and an inner contour of a product in a target image; A second processing module, used for generating a first quadrilateral according to an outer contour in the target image; A third processing module, configured to generate a first rectangle according to the first quadrilateral and the contour area of ​​the outer contour; A fourth processing module, used for generating a second quadrilateral according to an inner contour in the target image; A fifth processing module, configured to generate a second rectangle according to the second quadrilateral and the contour area of ​​the inner contour; A sixth processing module, used to connect the geometric centers of the first rectangle and the second rectangle to obtain a line segment; The positioning module is used to determine the center point on the obtained line segment according to the area ratio relationship between the first rectangle and the second rectangle, so as to align the coordinate origin of the processing equipment with the center point and complete the visual positioning of the product.

10. A machine vision positioning system, characterized in that: The system comprises: A camera, used to capture product images; A computer device, connected to a camera, is used to execute the machine vision positioning method as described in any one of claims 1 to 8.

Citation Information

Cited By

  • Deviation early warning and positioning system using machine vision

    CN121921368A