A method for locating the positioning holes of a workpiece target and determining its posture
Through the preprocessing of workpiece target images and incision rectangular detection, the problem of robot visual sorting being sensitive to workpiece position and posture changes is solved, efficient workpiece positioning and attitude determination is achieved, and production efficiency and product quality are improved.
Patent Information
- Application Number
- CN202111305787.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-11-05
- Publication Date
- 2025-07-04
- Estimated Expiration
- 2041-11-05
AI Technical Summary
Traditional robot sorting based on robot vision is sensitive to changes in workpiece position and posture, resulting in inefficient grabbing and sorting.
By obtaining the workpiece target image, marking the circumference profile and center of the positioning hole after preprocessing, detecting whether the minimum tangent rectangle is a square, calculating the inclination and rotation angles, and realizing the positioning and attitude determination of the workpiece target.
It improves the positioning accuracy of workpiece targets and the accuracy of posture judgment, reduces labor costs, ensures product quality and improves production efficiency.
Smart Images

Figure CN114037676B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of pattern recognition, and particularly to a method for positioning and attitude determination of a positioning hole of a workpiece target. Background Art
[0002] With the continuous development of the intelligent manufacturing technology industry, robot technology has become the main technical support for intelligent production in the industrial field. Traditional robot sorting based on robot vision is carried out by simply teaching the robot, which has strict requirements for information such as the placement position and attitude of the robot and the workpiece (including the rotation angle and tilt angle of the workpiece target). Once the position, attitude, and tilt angle of the workpiece target change, it will greatly affect the efficiency of grasping and sorting. Summary of the Invention
[0003] The purpose of the present invention is to provide a method for positioning and attitude determination of a positioning hole of a workpiece target, aiming to solve the technical problem of low sorting efficiency of traditional robot sorting based on robot vision.
[0004] To achieve the above purpose, the present invention provides a method for positioning and attitude determination of a positioning hole of a workpiece target, including the following steps:
[0005] Step 1: Obtain an image of the workpiece target;
[0006] Step 2: Preprocess the image of the workpiece target;
[0007] Step 3: Mark the circumferential contour and the center of the positioning hole of the workpiece target;
[0008] Step 4: Obtain the circumferential information of the positioning hole and the center coordinates;
[0009] Step 5: Repeat Step 1 to Step 4 to obtain the circumferential contour of the positioning hole of the workpiece target, and mark the minimum circumscribed rectangle of the circumferential contour of the positioning hole of the workpiece target;
[0010] Step 6: Detect whether the minimum circumscribed rectangle is a square,
[0011] If the detection result is a square, the workpiece target is not tilted relative to the XY-axis plane of the image coordinate system;
[0012] If the detection result is negative, execute Step 7;
[0013] Step 7: Calculate and obtain the tilt angle and rotation angle of the workpiece target to complete the attitude determination of the workpiece target.
[0014] Among them, Step 1 to Step 4 are the positioning process of the positioning hole of the workpiece target, and Step 5 to Step 7 are the attitude determination process of the workpiece target.
[0015] Among them, in the process of preprocessing the target image of the workpiece, preprocessing is performed by enhancing the image contrast and histogram processing.
[0016] Among them, the process of detecting whether the minimum circumscribed rectangle is a square includes the following steps:
[0017] Detect the lengths of two adjacent sides of the minimum circumscribed rectangle;
[0018] Compare whether the lengths of the two adjacent sides are equal,
[0019] If they are equal, the detection result is a square;
[0020] If they are not equal, the detection result is no.
[0021] Among them, calculating and obtaining the tilt angle and rotation angle of the workpiece target includes the following steps:
[0022] Determine that the minimum circumscribed rectangle is a rectangle, and mark the lengths of the long side and the short side of the rectangle respectively;
[0023] Calculate the tilt angle relative to the XY-axis plane of the image coordinate system by using the length of the long side and the length of the short side;
[0024] Obtain the included angle between the long side of the rectangle and the positive direction of the X-axis of the image coordinate system;
[0025] Calculate the rotation angle according to the included angle.
[0026] Among them, the length of the long side is the diameter length of the circumferential contour of the positioning hole.
[0027] Among them, the process of calculating the rotation angle according to the included angle includes the following steps:
[0028] Judge the size of the included angle and 90°,
[0029] If the included angle is less than or equal to 90°, the tilt angle of the workpiece relative to the X-axis is equal to the included angle;
[0030] If the included angle is greater than 90°, the tilt angle of the workpiece relative to the X-axis is equal to 180° minus the included angle.
[0031] A method for positioning and attitude determination of the positioning hole of the workpiece target of the present invention is implemented in two steps, including two processes of positioning the positioning hole of the workpiece target and determining the attitude of the workpiece target. First, by detecting and identifying the positioning hole of the workpiece target, the position of the positioning hole of the workpiece target is determined, and then the rotation angle, tilt angle, diameter of the positioning hole and other information of the workpiece target are determined by detecting the change of the side length of the circumscribed rectangle of the positioning hole, which is of great significance for reducing labor costs, ensuring product quality and improving production efficiency. BRIEF DESCRIPTION OF THE DRAWINGS
[0032] In order to more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the following will briefly introduce the drawings required for the description of the embodiments or the prior art. Obviously, the following drawings are only some embodiments of the present invention. For those of ordinary skill in the art, other drawings can be obtained based on these drawings without creative efforts.
[0033] Figure 1 It is a schematic flow chart of a method for positioning and attitude determination of a workpiece target positioning hole according to the present invention.
[0034] Figure 2 It is a schematic diagram of the specific execution steps of a method for positioning and attitude determination of a workpiece target positioning hole according to the present invention. DETAILED DESCRIPTION OF THE EMBODIMENTS
[0035] The following will describe in detail the embodiments of the present invention. The examples of the embodiments are shown in the drawings, where the same or similar reference numerals represent the same or similar elements or elements with the same or similar functions from beginning to end. The embodiments described below with reference to the drawings are exemplary and are intended to explain the present invention, but should not be construed as a limitation of the present invention.
[0036] Please refer to Figure 1 , the present invention provides a method for positioning and attitude determination of a workpiece target positioning hole, including the following steps:
[0037] S1: Obtain the workpiece target image;
[0038] S2: Preprocess the workpiece target image;
[0039] S3: Mark the circumferential contour and the center of the workpiece target positioning hole;
[0040] S4: Obtain the circumferential information of the positioning hole and the center coordinates;
[0041] S5: Repeat S1 to S4 to obtain the circumferential contour of the workpiece target positioning hole, and mark the minimum circumscribed rectangle of the circumferential contour of the workpiece target positioning hole;
[0042] S6: Detect whether the minimum circumscribed rectangle is a square,
[0043] If the detection result is a square, the workpiece target is not tilted relative to the XY axis plane of the image coordinate system;
[0044] If the detection result is negative, execute S7;
[0045] S7: Calculate and obtain the tilt angle and rotation angle of the workpiece target to complete the attitude determination of the workpiece target.
[0046] In this embodiment, the workpiece target image can be obtained by a Hikvision industrial camera, and the workpiece target is projected as the foreground on the XY-axis plane of the image coordinate system.
[0047] Steps S1 to S4 are the positioning process of the positioning holes of the workpiece target, and steps S5 to S7 are the attitude determination process of the workpiece target.
[0048] In the process of preprocessing the workpiece target image, preprocessing is performed by enhancing the image contrast and histogram processing.
[0049] The method for positioning the positioning holes and determining the attitude of the workpiece target is specifically implemented in two steps. The execution process can be referred to Figure 2 , in the first step, the positioning holes of the workpiece target are first located. By detecting the positioning holes of the foreground workpiece target obtained, the circumferential contour and the center of the circle of the workpiece target positioning holes are marked, and information such as the circumference of the positioning holes and the center coordinates is obtained; the second step is the attitude determination process of the workpiece target. By obtaining the projection of the workpiece target, the inclination angle and rotation angle information of the foreground workpiece target are obtained, so as to realize the attitude determination of the workpiece target.
[0050] The specific process of determining the attitude of the workpiece target is as follows:
[0051] Obtain the circumferential contour of the workpiece target positioning hole, and mark the minimum circumscribed rectangle of the circumferential contour of the workpiece target positioning hole.
[0052] If it is verified that the minimum circumscribed rectangle is a square, the workpiece target is not inclined relative to the XY-axis plane of the image coordinate system.
[0053] The process of detecting whether the minimum circumscribed rectangle is a square includes the following steps:
[0054] Detect the lengths of two adjacent sides of the minimum circumscribed rectangle;
[0055] Compare whether the lengths of the two adjacent sides are equal,
[0056] If they are equal, the detection result is a square;
[0057] If they are not equal, the detection result is no.
[0058] If they are not equal, it can be determined that the minimum circumscribed rectangle is a rectangle, and the length of the long side of the rectangle is marked as "R", and the length of the short side is marked as "r".
[0059] According to the spatial geometric relationship, the diameter of the circumferential contour of the positioning hole can be obtained, which is R, that is, equal to the length of the long side of the rectangle described in step 10. The theoretical basis is as follows: No matter how the circle A is tilted, when it is irradiated with light perpendicular to a certain plane XY, a projection is formed on the plane XY. When the circle A is tilted, its projection is an ellipse B, and the major axis of the ellipse B is the same as the diameter R of the circle A; when the circle A is not tilted, that is, the plane of the circle A is parallel to the XY plane, the projection at this time is a circle C, and the diameter of the circle C is the same as the diameter of the circle A; similarly, the smallest circumscribed rectangle of the ellipse B is a rectangle D, and the side length d of this rectangle is the same as the major axis of the ellipse B, so the side length d of this rectangle is the same as the diameter R of the circle A; the projection is a circle C, and its smallest circumscribed rectangle is a square K, the side length of the square K is h, and the side length h is the same as the diameter of the circle C, and the diameter of the circle C is the same as the diameter R of the circle A, so the side length h is also the same as the diameter R of the circle A; in summary: the length of the long side of the smallest circumscribed rectangle of the circular contour of the positioning hole in the image is the diameter length of the actual circle.
[0060] When the foreground workpiece target is tilted, the tilt angle of the workpiece relative to the XY axis plane of the image coordinate system can be obtained through the spatial geometric relationship
[0061] Through the projection mark, the included angle α between the side R of the rectangle and the positive direction of the X axis of the image coordinate system can be obtained;
[0062] The rotation angle β is determined by comparing the size of the included angle α with 90°.
[0063] If α ≤ 90°, then the tilt angle of the workpiece relative to the X axis (the workpiece rotation angle) β = α;
[0064] If α > 90°, then the tilt angle of the workpiece relative to the X axis (the workpiece rotation angle) β = 180° - α;
[0065] Through the above steps, the tilt angle θ and rotation angle β information of the foreground workpiece target are obtained, so as to realize the determination of the workpiece target posture.
[0066] The above-disclosed is only a preferred embodiment of the present invention. Of course, the scope of the rights of the present invention cannot be limited by this. Those of ordinary skill in the art can understand all or part of the processes of implementing the above embodiments, and the equivalent changes made according to the claims of the present invention still fall within the scope covered by the present invention.
Claims
1. A method for positioning a target positioning hole of a workpiece and determining its attitude, characterized in that, It includes the following steps: Step 1: Obtain the target image of the workpiece; Step 2: Preprocess the target image of the workpiece; Step 3: Mark the circumferential contour and the center of the positioning hole of the workpiece target; Step 4: Obtain the circumferential information of the positioning hole and the coordinates of the center of the circle; Step 5: Repeat Steps 1 to 4 to obtain the circumferential contour of the positioning hole of the workpiece target, and mark the minimum circumscribed rectangle of the circumferential contour of the positioning hole of the workpiece target; Step 6: Detect whether the minimum circumscribed rectangle is a square, If the detection result is a square, the workpiece target is not tilted relative to the XY-axis plane of the image coordinate system; If the detection result is no, execute Step 7; Step 7: Calculate and obtain the tilt angle and the rotation angle of the workpiece target to complete the determination of the posture of the workpiece target; Calculating and obtaining the tilt angle and the rotation angle of the workpiece target includes the following steps: Determine that the minimum circumscribed rectangle is a rectangle, and mark the length of the long side and the length of the short side of the rectangle respectively; Calculate the tilt angle relative to the XY-axis plane of the image coordinate system by using the length of the long side and the length of the short side; Mark the length of the long side of the rectangle as "R" and the length of the short side as "r"; The inclination angle of the workpiece relative to the XY-axis plane of the image coordinate system Obtain the included angle between the long side of the rectangle and the positive direction of the X-axis of the image coordinate system; Calculate the rotation angle according to the included angle.
2. The method for positioning and posture determination of the positioning hole of the workpiece target according to claim 1, wherein Steps 1 to 4 are the positioning process of the positioning hole of the workpiece target, and Steps 5 to 7 are the posture determination process of the workpiece target.
3. The method for positioning and posture determination of the positioning hole of the workpiece target according to claim 1, wherein In the process of preprocessing the target image of the workpiece, preprocessing is performed by using the method of enhancing image contrast and histogram processing.
4. The method for positioning and posture determination of the positioning hole of the workpiece target according to claim 1, wherein The process of detecting whether the minimum circumscribed rectangle is a square includes the following steps: Detect the lengths of two adjacent sides of the minimum circumscribed rectangle; Compare whether the lengths of the two adjacent sides are equal, If they are equal, the detection result is a square; If they are not equal, the detection result is no.
5. The method for positioning and posture determination of the positioning hole of the workpiece target according to claim 1, wherein The length of the long side is the diameter length of the circumferential contour of the positioning hole.
6. The method for positioning and posture determination of the positioning hole of the workpiece target according to claim 1, wherein The process of calculating the rotation angle according to the included angle includes the following steps: Judge the size of the included angle and 90°, If the included angle is less than or equal to 90°, the tilt angle of the workpiece relative to the X-axis is equal to the included angle; If the included angle is greater than 90°, the tilt angle of the workpiece relative to the X-axis is equal to 180° minus the included angle.
Citation Information
Patent Citations
Visual positioning sorting method
CN103706571A
Quick locating and detection method for code area in label of packaging box
CN109724990A