Method, processor and device for determining the orientation of a connecting component
Through image processing technology, the orientation of the connecting parts is automatically measured, which solves the problem of manual measurement time, achieves fast and accurate measurement, and improves assembly efficiency.
Patent Information
- Application Number
- CN202111621626.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-12-28
- Publication Date
- 2025-06-13
- Estimated Expiration
- 2041-12-28
AI Technical Summary
During the assembly process of mechanical equipment, it takes time to measure the orientation of the connecting parts manually using special angle measurement tools, which affects the assembly efficiency.
By acquiring the image of the connecting component captured by the image acquisition device, performing binarization processing, determining the deflection angle of the maximum communication domain and the minimum external rectangle, a linear angle is obtained, and the orientation of the connecting component is determined based on the straight angle and deflection angle.
This method can quickly and accurately measure the orientation of the connecting parts, reduce the time cost of manual measurement, improve assembly efficiency, and reduce the need for manual labeling of data.
Smart Images

Figure CN114463195B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the fields of measurement and image processing, and in particular, to a method, a processor, and a device for determining the orientation of a connecting component. Background Art
[0002] Connecting components are relatively common in the assembly process of mechanical equipment. For example, a joint used to connect a valve and a pipeline. Usually, when installing the joint, it is necessary to measure whether the orientation of the joint is within the allowable error range. Excessive deviation in the joint orientation may cause pipeline interference. The prior art usually measures manually using a special angle measurement tool, but it takes a long time and affects the assembly efficiency. Summary of the Invention
[0003] An object of an embodiment of the present invention is to provide a method, a processor, a device, and a storage medium for determining the orientation of a connecting component to improve the assembly efficiency.
[0004] To achieve the above object, a first aspect of the present invention provides a method for determining the orientation of a connecting component, the method including:
[0005] Obtaining an image including a connecting component collected by an image acquisition device;
[0006] Based on a parameter range corresponding to the color information of the pre-stored connecting component, performing binary processing on the image to obtain a binary image;
[0007] Determining the largest connected component of the binary image;
[0008] Determining the deflection angle of the minimum circumscribed rectangle of the largest connected component;
[0009] Obtaining the line angles of multiple lines in the binary image;
[0010] Determining the orientation of the connecting component according to the line angles and the deflection angle.
[0011] In an embodiment of the present invention, determining the orientation of the connecting component according to the line angles and the deflection angle includes: filtering the multiple lines according to the line angles and the deflection angle to obtain filtered lines; determining the mean value of the line angles of the filtered lines to obtain the orientation of the connecting component.
[0012] In an embodiment of the present invention, filtering the multiple lines according to the line angles and the deflection angle to obtain filtered lines includes: determining the angle difference between the line angle and the deflection angle; determining the mean value of the angle differences of the multiple angle differences; filtering the lines with an angle difference greater than the mean value of the angle differences among the multiple lines to obtain filtered lines.
[0013] In an embodiment of the present invention, the minimum bounding rectangle includes a long side and a short side, and the deflection angle includes the long-side deflection angle of the long side and the short-side deflection angle of the short side; determining the angle difference between the straight line angle and the deflection angle includes: determining a first angle difference between the straight line angle and the long-side deflection angle respectively, and a second angle difference between the straight line angle and the short-side deflection angle; determining the smaller value between the first angle difference and the second angle difference to obtain the angle difference between the straight line angle and the deflection angle.
[0014] In an embodiment of the present invention, determining the mean value of the straight line angles of the filtered straight lines to obtain the orientation of the connecting component includes: determining the straight line angles among the straight line angles of the filtered straight lines where the second angle difference is less than the first angle difference; performing angle conversion on the straight line angles where the second angle difference is less than the first angle difference to obtain the converted straight line angles, wherein the second angle difference of the converted straight line angles is greater than the first angle difference; determining the average value of the converted straight line angles and the straight line angles of the filtered straight lines that have not undergone angle conversion to obtain the orientation of the connecting component.
[0015] In an embodiment of the present invention, the method further includes: performing denoising processing on the binary image to obtain the denoised binary image.
[0016] In an embodiment of the present invention, obtaining the straight line angles of multiple straight lines in the binary image includes: detecting edge information of the binary image to obtain multiple straight lines; determining the straight line angles of each straight line according to the endpoints of each straight line.
[0017] A second aspect of the present invention provides a processor configured to execute the method for determining the orientation of a connecting component according to the above.
[0018] A third aspect of the present invention provides a device for determining the orientation of a connecting component, including: an image acquisition device; and a processor according to the above.
[0019] A fourth aspect of the present invention provides a machine-readable storage medium, on which instructions are stored, and when the instructions are executed by a processor, the processor is caused to execute the method for determining the orientation of a connecting component according to the above.
[0020] In the above technical solution, an image including a connecting component collected by an image acquisition device is obtained, and based on a parameter range corresponding to the color information of the pre-stored connecting component, the image is binarized to obtain a binary image. Then, the largest connected component of the binary image is determined, and the deflection angle of the minimum circumscribed rectangle of the largest connected component is determined. The straight line angles of multiple straight lines in the binary image are obtained, so as to determine the orientation of the connecting component according to the straight line angle and the deflection angle. This solution measures the orientation of the connecting component according to visual features, does not require manual use of measuring equipment for orientation measurement, has a low time cost, high measurement efficiency, high accuracy of measurement results, reduces the workload of manually labeling data by using deep learning methods, and improves the assembly efficiency.
[0021] Other features and advantages of the embodiments of the present invention will be described in detail in the subsequent specific implementation section. BRIEF DESCRIPTION OF THE DRAWINGS
[0022] The drawings are used to provide a further understanding of the embodiments of the present invention, and constitute a part of the specification. They are used together with the following specific implementation to explain the embodiments of the present invention, but do not constitute a limitation to the embodiments of the present invention. In the drawings:
[0023] Figure 1 Schematically shows a flowchart of a method for determining the orientation of a connecting component in an embodiment of the present invention;
[0024] Figure 2 Schematically shows a schematic diagram of an image including a connecting component in an embodiment of the present invention;
[0025] Figure 3 Schematically shows a schematic diagram of a binary image in an embodiment of the present invention;
[0026] Figure 4 Schematically shows a schematic diagram of the result of a morphological opening operation in an embodiment of the present invention;
[0027] Figure 5 Schematically shows a schematic diagram of the largest connected component in an embodiment of the present invention;
[0028] Figure 6 Schematically shows a schematic diagram of the minimum circumscribed rectangle in an embodiment of the present invention;
[0029] Figure 7 Schematically shows a schematic diagram of edge straight lines in an embodiment of the present invention;
[0030] Figure 8 Schematically shows a schematic diagram of the filtered edge straight lines in an embodiment of the present invention;
[0031] Figure 9A schematic diagram showing the final orientation of the connecting component in an embodiment of the present invention;
[0032] Figure 10 A structural block diagram of a device for determining the orientation of a connecting component in an embodiment of the present invention is schematically shown. Detailed implementation manners
[0033] The following details the specific implementation manners of the embodiments of the present invention in conjunction with the accompanying drawings. It should be understood that the specific implementation manners described herein are only used to illustrate and explain the embodiments of the present invention, and are not used to limit the embodiments of the present invention.
[0034] The existing methods for determining the orientation of a connecting component usually include the following: 1. Manually measure using professional equipment, with high measurement accuracy, but time-consuming and cumbersome, interrupting the assembly rhythm of workers and having a great impact on the assembly speed; 2. Manual visual inspection, with the accuracy not meeting the requirements and large randomness; 3. Measuring based on deep learning methods, which requires labeled data, with a large workload and relatively poor applicability.
[0035] To solve the above problems, Figure 1 A flowchart of a method for determining the orientation of a connecting component in an embodiment of the present invention is schematically shown. As Figure 1 shown, in an embodiment of the present invention, a method for determining the orientation of a connecting component is provided. Taking the application of this method to a processor as an example for illustration, the method includes:
[0036] Step S102, obtaining an image including the connecting component collected by an image acquisition device.
[0037] It can be understood that the connecting component is a component or device for connection, such as a joint for connecting a valve and a pipeline. Usually, the connecting component is a rigid object and has an obvious color difference from the background. The image acquisition device is a device for image acquisition, such as a camera, which can be used to collect an image including the connecting component. For example, when the connecting component is used to connect a valve and a pipeline, the image includes the connecting component, and may also include the valve and / or the pipeline.
[0038] Specifically, the processor can obtain an image including the connecting component collected by the image acquisition device, that is, the image collected by the image acquisition device contains the connecting component.
[0039] Step S104, performing binary processing on the image based on the parameter range corresponding to the color information of the pre-stored connecting component to obtain a binary image.
[0040] It can be understood that the color information may include information such as the hue, saturation, and lightness of the color. Further, the parameter ranges corresponding to the color information (including hue, saturation, and lightness) of the connecting component can be stored in advance. That is to say, for the connecting component, there are corresponding parameter value ranges for its color information. A binary image refers to an image in which each pixel has only two possible values or gray-level states. For example, an image in which each pixel is either black or white.
[0041] Specifically, the processor can perform binarization processing on the image according to the parameter range corresponding to the color information of the connecting component stored in advance, so as to obtain the processed binary image. Specifically, the processor can first obtain the numerical values of the color information of the pixels of the image, that is, the specific numerical values of the hue, saturation, and lightness, and assign the gray value of the pixels whose numerical values of the color information of the pixels in the image are within the parameter range corresponding to the color information of the connecting component to 1, and assign the gray value of the pixels not within the parameter range to 0. For example, the gray value of the pixels within the interval where the parameter range is located is assigned to 1, and the gray value of the pixels not within the interval where the parameter range is located is assigned to 0, then a binary image can be obtained. Further, in some embodiments, the gray value of the pixel value of the binary image can also be other numerical values other than 0 and 1, such as 0 and 255.
[0042] Step S106, determine the largest connected region of the binary image.
[0043] It can be understood that the connected points form a region, while the unconnected points form different regions. The set composed of the connected points can be called a connected region.
[0044] Specifically, the processor can traverse the binary image using a connected region labeling algorithm to determine the connected regions of the binary image, and then determine the largest connected region among the connected regions as the largest connected region.
[0045] Step S108, determine the deflection angle of the minimum circumscribed rectangle of the largest connected region.
[0046] It can be understood that the minimum circumscribed rectangle of the largest connected region is the smallest bounding rectangle that contains the largest connected region.
[0047] Specifically, after obtaining the largest connected region, the processor can determine the deflection angle of the minimum circumscribed rectangle of the largest connected region. For example, if the minimum circumscribed rectangle includes a long side, the angle of the long side of the minimum circumscribed rectangle can be determined as the deflection angle of the minimum circumscribed rectangle.
[0048] Step S110, obtain the line angles of multiple lines in the binary image.
[0049] Specifically, the processor can first determine multiple straight lines in the binary image, and then determine the straight line angles corresponding to the multiple straight lines.
[0050] Step S112, determine the orientation of the connecting component according to the straight line angle and the deflection angle.
[0051] Specifically, the processor can determine the orientation of the connecting component according to the straight line angles corresponding to the multiple straight lines and the deflection angle of the minimum bounding rectangle.
[0052] The above method for determining the orientation of the connecting component obtains an image including the connecting component collected by the image acquisition device, and based on the parameter range corresponding to the color information of the pre-stored connecting component, performs binary processing on the image to obtain a binary image, then determines the largest connected component of the binary image, and determines the deflection angle of the minimum bounding rectangle of the largest connected component, and obtains the straight line angles of multiple straight lines in the binary image, so as to determine the orientation of the connecting component according to the straight line angle and the deflection angle. This solution measures the orientation of the connecting component according to visual features, does not require manual use of measuring equipment for orientation measurement, has a low time cost, high measurement efficiency, high accuracy of measurement results, reduces the workload of manually labeling data using deep learning methods, and improves the assembly efficiency.
[0053] In one embodiment, determining the orientation of the connecting component according to the straight line angle and the deflection angle includes: filtering the multiple straight lines according to the straight line angle and the deflection angle to obtain filtered straight lines; determining the mean value of the straight line angles of the filtered straight lines to obtain the orientation of the connecting component.
[0054] Specifically, the processor can filter the multiple straight lines according to the straight line angle and the deflection angle to obtain filtered straight lines, and then determine the mean value of the straight line angles of the filtered straight lines to obtain the orientation of the connecting component.
[0055] In the embodiment of the present invention, by first filtering the multiple straight lines, a part of the straight lines with large errors can be filtered out, reducing the workload of the processor for subsequently determining the orientation of the connecting component.
[0056] In one embodiment, filtering the multiple straight lines according to the straight line angle and the deflection angle to obtain filtered straight lines includes: determining the angle difference between the straight line angle and the deflection angle; determining the mean value of the angle differences of the multiple angle differences; filtering out the straight lines with an angle difference greater than the mean value of the angle differences among the multiple straight lines to obtain filtered straight lines.
[0057] Specifically, the processor may first determine the angular difference between the straight line angle and the deflection angle, further calculate the average value of multiple angular differences, that is, the mean angular difference, and filter the straight lines among multiple straight lines whose angular differences are greater than the mean angular difference to obtain the filtered straight lines. At this time, the angular difference between the filtered straight lines and the deflection angle is not greater than the mean angular difference, which can reduce the error of the orientation result of the connecting component.
[0058] In one embodiment, the minimum bounding rectangle includes a long side and a short side, and the deflection angle includes a long side deflection angle of the long side and a short side deflection angle of the short side; determining the angular difference between the straight line angle and the deflection angle includes: determining a first angular difference between the straight line angle and the long side deflection angle respectively, and a second angular difference between the straight line angle and the short side deflection angle; determining the smaller value between the first angular difference and the second angular difference to obtain the angular difference between the straight line angle and the deflection angle.
[0059] It can be understood that the long side deflection angle is the deflection angle of the long side of the minimum bounding rectangle, and the short side deflection angle is the deflection angle of the short side of the minimum bounding rectangle. The first angular difference is the angular difference between the straight line angle and the long side deflection angle, and the second angular difference is the angular difference between the straight line angle and the short side deflection angle.
[0060] Specifically, the processor may first determine the first angular difference between each straight line angle and the long side deflection angle respectively, and the second angular difference between the straight line angle and the short side deflection angle, and then determine the smaller value between the first angular difference and the second angular difference to obtain the angular difference between the straight line angle and the deflection angle. That is to say, the angular difference between the straight line angle and the deflection angle takes the smaller value of the first angular difference and the second angular difference. That is, the angular difference between the straight line angle of the straight line closer to the short side and the deflection angle takes the angular difference between the straight line angle and the short side deflection angle, and the angular difference between the straight line angle of the straight line closer to the long side and the deflection angle takes the angular difference between the straight line angle and the long side deflection angle.
[0061] In one embodiment, determining the mean of the straight line angles of the filtered straight lines to obtain the orientation of the connecting component includes: determining the straight line angles among the straight line angles of the filtered straight lines where the second angular difference is less than the first angular difference; performing angular conversion on the straight line angles where the second angular difference is less than the first angular difference to obtain the converted straight line angles, where the second angular difference of the converted straight line angles is greater than the first angular difference; determining the average value of the converted straight line angles and the straight line angles among the straight line angles of the filtered straight lines that have not been angularly converted to obtain the orientation of the connecting component.
[0062] Specifically, if there is a straight-line angle in the straight-line angles of the filtered straight lines where the second angular difference is less than the first angular difference, that is, there is a straight-line angle that is closer to the deflection angle of the short side, at this time, the straight-line angle can be subjected to angle conversion to obtain the converted straight-line angle. The converted second angular difference is greater than the first angular difference, that is, the converted straight-line angle is closer to the long side of the minimum bounding rectangle. At this time, the processor can calculate the average value of the straight-line angle after angle conversion and the straight-line angle of the straight lines in the filtered straight lines that have not been subjected to angle conversion, that is, the average value of the straight-line angle after angle conversion and the straight-line angle that has not been subjected to angle conversion, so as to obtain the orientation of the connecting component.
[0063] In one embodiment, the method for determining the orientation of the connecting component further includes: performing denoising processing on the binary image to obtain the denoised binary image.
[0064] It can be understood that the denoising processing can remove noise or small noise points.
[0065] Specifically, the processor can perform denoising processing on the binary image, that is, remove redundant noise and small noise points, so as to obtain the denoised binary image.
[0066] In one embodiment, obtaining the straight-line angles of multiple straight lines in the binary image includes: detecting edge information of the binary image to obtain multiple straight lines; determining the straight-line angles of the straight lines according to the endpoints of each straight line.
[0067] Specifically, the processor can detect the edge information of the binary image to obtain multiple straight lines, and then can determine the straight-line angles of each straight line according to the endpoints of the straight lines. A specific edge information detection algorithm can be, for example, the Sobel operator. The Sobel operator is the weighted difference of the gray values of the upper, lower, left, and right four neighborhoods of each pixel in the image, and reaches an extreme value at the edge to detect the edge.
[0068] In a specific embodiment, a method for determining the orientation of a connecting component is provided, which may specifically include the following steps:
[0069] 1. Extract the color region according to the threshold and perform binarization.
[0070] It can be understood that before this step, it is necessary to first obtain an image or video including the joint collected by the image acquisition device, such as Figure 2As shown in the figure, if it is a video, each frame of the video can be regarded as an image. The purpose of this step is to extract the area where the connecting components (such as joints) are located and filter out the background area. Specifically, according to the hue (H), saturation (S), and value (V) interval values of the joint color, the joint area can be extracted. The value of the hue (H), saturation (S), and value (V) interval values of the joint is 1, otherwise it is 0, so as to obtain a binary image, as Figure 3 shown
[0071] 2. Morphological opening operation
[0072] Specifically, a 3*3 kernel can be taken and the opening operation can be continuously performed a specified number of times to remove small noise points, as Figure 4 shown. That is to say, this step is mainly used to remove noise
[0073] 3. Take the largest connected component, remove other connected components, and form a new binary image
[0074] It can be understood that the function of this step is still to remove noise. As Figure 5 shown, the connected component shown is the largest connected component with the largest area
[0075] 4. Extract the minimum bounding rectangle of the largest connected component
[0076] Specifically, the processor can extract the minimum bounding rectangle of the largest connected component, as Figure 6 shown
[0077] 5. Connected component line detection
[0078] Specifically, as Figure 7 shown, the gradient map of the binary image can be obtained first to obtain edge information, and then all the lines on the edge can be detected. The Sobel gradient is calculated in the height direction and the width direction respectively for the gradient, and then added. The Sobel gradient calculation is to subtract adjacent pixels, and the gradient result is the edge information. For the specific definition of the Sobel operator, please refer to the relevant content. Line detection can use the Hough transform. The basic principle of the Hough transform is to transform the curves (including lines) in the image space to the parameter space, and by detecting the extreme points in the parameter space, the description parameters of the curve are determined, so as to extract the regular curves in the image
[0079] 6. Filter lines
[0080] Specifically, the average value of the angle differences between all the lines and the sides of the minimum bounding rectangle can be calculated first, and then the lines with the angle difference exceeding the average value can be filtered out. As Figure 8 shown, the lines with large deviations are filtered out
[0081] It can be understood that a rectangle has a long side and a short side which are also straight lines. All straight lines have angles. The angle difference between the straight line and the two sides is taken as the smaller one.
[0082] 7. Calculate the average value of the angles of the filtered straight lines as the final angle. For a straight line whose angle is closer to the angle of the short side of the rectangle, convert the angle of the straight line to the angle with respect to the long side of the rectangle (plus or minus 90 degrees) and then calculate the average value, so as to obtain the orientation of the connecting component (such as a joint), as Figure 9 shown.
[0083] The technical solution of the embodiment of the present invention uses traditional visual features to measure the orientation of the joint, with fast speed, high accuracy, good applicability, and no need for data annotation. Traditional visual features refer to features defined manually, and corresponding features need to be designed manually according to the corresponding scenario.
[0084] The embodiment of the present invention provides a processor configured to execute the method for determining the orientation of the connecting component according to the above embodiments.
[0085] Figure 10 Schematically shows a structural block diagram of a device for determining the orientation of a connecting component in an embodiment of the present invention. As Figure 10 shown, in the embodiment of the present invention, a device 1000 for determining the orientation of a connecting component is provided, including: an image acquisition device 1010 and a processor 1020, where:
[0086] The image acquisition device 1010 is configured to acquire an image including a connecting component;
[0087] The processor 1020 is configured to: acquire the image including the connecting component acquired by the image acquisition device 1010; perform binarization processing on the image based on the parameter range corresponding to the color information of the pre-stored connecting component to obtain a binary image; determine the largest connected region of the binary image; determine the deflection angle of the minimum circumscribed rectangle of the largest connected region; acquire the straight line angles of multiple straight lines in the binary image; and determine the orientation of the connecting component according to the straight line angles and the deflection angle.
[0088] The above-described apparatus 1000 for determining the orientation of a connecting component. The processor 1020 acquires an image including the connecting component collected by the image acquisition device 1010, performs binarization processing on the image based on a parameter range corresponding to the pre-stored color information of the connecting component to obtain a binary image, then determines the largest connected region of the binary image, determines the deflection angle of the minimum bounding rectangle of the largest connected region, and acquires the line angles of multiple lines in the binary image, so as to determine the orientation of the connecting component according to the line angles and the deflection angle. This solution measures the orientation of the connecting component based on visual features, does not require manual use of measuring equipment for orientation measurement, has a low time cost, high measurement efficiency, high accuracy of measurement results, reduces the workload of manually labeling data using deep learning methods, and improves the assembly efficiency.
[0089] In one embodiment, the processor 1020 is further configured to: filter the multiple lines according to the line angles and the deflection angle to obtain filtered lines; determine the mean of the line angles of the filtered lines to obtain the orientation of the connecting component.
[0090] In one embodiment, the processor 1020 is further configured to: determine the angle difference between the line angle and the deflection angle; determine the mean of the angle differences of multiple angle differences; filter the lines in which the angle difference is greater than the mean of the angle differences to obtain filtered lines.
[0091] In one embodiment, the minimum bounding rectangle includes a long side and a short side, and the deflection angle includes a long side deflection angle of the long side and a short side deflection angle of the short side; the processor 1020 is further configured to: determine a first angle difference between the line angle and the long side deflection angle and a second angle difference between the line angle and the short side deflection angle; determine the smaller value between the first angle difference and the second angle difference to obtain the angle difference between the line angle and the deflection angle.
[0092] In one embodiment, the processor 1020 is further configured to: determine the line angles in which the second angle difference among the line angles of the filtered lines is less than the first angle difference; perform angle conversion on the line angles in which the second angle difference is less than the first angle difference to obtain converted line angles, where the second angle difference of the converted line angles is greater than the first angle difference; determine the average value of the converted line angles and the line angles of the filtered lines that have not been angle-converted to obtain the orientation of the connecting component.
[0093] In one embodiment, the processor 1020 is further configured to: perform denoising processing on the binary image to obtain a denoised binary image.
[0094] In one embodiment, the processor 1020 is further configured to: detect edge information of a binary image to obtain a plurality of straight lines; and determine a straight line angle of each straight line according to the endpoints of each straight line.
[0095] An embodiment of the present invention provides a machine-readable storage medium, on which instructions are stored, and when the instructions are executed by a processor, the processor is caused to execute the method for determining the orientation of a connecting component according to the above-described embodiment.
[0096] Those skilled in the art should understand that the embodiments of the present application may be provided as a method, a system, or a computer program product. Therefore, the present application may take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware aspects. Moreover, the present application may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0097] The present application is described with reference to the flowcharts and / or block diagrams of methods, apparatuses (systems), and computer program products according to the embodiments of the present application. It should be understood that each flow and / or block in the flowcharts and / or block diagrams, and the combination of flows and / or blocks in the flowcharts and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to the processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing devices to generate a machine, such that the instructions executed by the processor of the computer or other programmable data processing devices generate means for implementing the functions specified in one Figure 1 one flow or multiple flows and / or blocks Figure 1 one block or multiple blocks.
[0098] These computer program instructions can also be stored in a computer-readable memory that can direct a computer or other programmable data processing device to work in a specific manner, such that the instructions stored in the computer-readable memory generate a manufactured article including an instruction device, and the instruction device implements the functions specified in one Figure 1 one flow or multiple flows and / or blocks Figure 1 one block or multiple blocks.
[0099] These computer program instructions can also be loaded onto a computer or other programmable data processing device, such that a series of operation steps are executed on the computer or other programmable device to generate a computer-implemented process, so that the instructions executed on the computer or other programmable device provide steps for implementing the functions specified in one Figure 1 one flow or multiple flows and / or blocks Figure 1 one block or multiple blocks.
[0100] In a typical configuration, a computing device includes one or more processors (CPU), input / output interfaces, network interfaces, and memory.
[0101] The memory may include non-permanent memory in a computer-readable medium, random access memory (RAM) and / or non-volatile memory in the form of read-only memory (ROM) or flash RAM. The memory is an example of a computer-readable medium.
[0102] Computer readable media include permanent and non-permanent, removable and non-removable media that can be implemented by any method or technology to store information. Information can be computer readable instructions, data structures, program modules or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technology, compact disk read-only memory (CD-ROM), digital versatile disk (DVD) or other optical storage, magnetic cassettes, magnetic tape magnetic disk storage or other magnetic storage devices or any other non-transmission media that can be used to store information that can be accessed by a computing device. As defined herein, computer readable media does not include temporary computer readable media (transitory media), such as modulated data signals and carrier waves.
[0103] It should also be noted that the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, commodity or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, commodity or device. In the absence of more restrictions, the elements defined by the sentence "comprises a ..." do not exclude the existence of other identical elements in the process, method, commodity or device including the elements.
[0104] The above are only embodiments of the present application and are not intended to limit the present application. For those skilled in the art, the present application may have various changes and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application should be included within the scope of the claims of the present application.
Claims
1. A method for determining the orientation of a connecting component, characterized in that, the method comprises: acquiring an image including the connecting component collected by an image acquisition device; performing binarization processing on the image based on a parameter range corresponding to color information of the pre-stored connecting component to obtain a binary image; determining the largest connected region of the binary image; determining the deflection angle of the minimum circumscribed rectangle of the largest connected region; acquiring the line angles of multiple lines in the binary image; determining the orientation of the connecting component according to the line angles and the deflection angle; wherein, the determining the orientation of the connecting component according to the line angles and the deflection angle includes: filtering the multiple lines according to the line angles and the deflection angle to obtain filtered lines; determining the mean value of the line angles of the filtered lines to obtain the orientation of the connecting component; the filtering the multiple lines according to the line angles and the deflection angle to obtain filtered lines includes: determining the angle difference between the line angle and the deflection angle; determining the mean value of the angle differences of multiple angle differences; filtering the lines in the multiple lines with the angle difference greater than the mean value of the angle differences to obtain filtered lines.
2. The method according to claim 1, characterized in that, the minimum circumscribed rectangle includes a long side and a short side, and the deflection angle includes a long side deflection angle of the long side and a short side deflection angle of the short side; the determining the angle difference between the line angle and the deflection angle includes: determining a first angle difference between the line angle and the long side deflection angle respectively, and a second angle difference between the line angle and the short side deflection angle; determining the smaller value between the first angle difference and the second angle difference to obtain the angle difference between the line angle and the deflection angle.
3. The method according to claim 2, characterized in that, the determining the mean value of the line angles of the filtered lines to obtain the orientation of the connecting component includes: determining the line angles in the line angles of the filtered lines where the second angle difference is less than the first angle difference; performing angle conversion on the line angles where the second angle difference is less than the first angle difference to obtain converted line angles, wherein the second angle difference of the converted line angles is greater than the first angle difference; determining the average value of the converted line angles and the line angles in the line angles of the filtered lines that have not undergone angle conversion to obtain the orientation of the connecting component.
4. The method according to claim 1, characterized in that, the method further comprises: performing denoising processing on the binary image to obtain a denoised binary image.
5. The method according to claim 1, characterized in that, the acquiring the line angles of multiple lines in the binary image includes: detecting edge information of the binary image to obtain the multiple lines; determining the line angles of the multiple lines according to the endpoints of each line.
6. A processor, characterized in that, configured to perform the method for determining the orientation of a connecting component according to any one of claims 1 to 5.
7. An apparatus for determining the orientation of a connecting component, characterized in that comprising: an image acquisition device; and a processor according to claim 6.
8. A machine-readable storage medium having instructions stored thereon, characterized in that the instructions, when executed by a processor, cause the processor to perform the method for determining the orientation of a connecting component according to any one of claims 1 to 5.
Citation Information
Patent Citations
Workpiece positioning and identification method based on image segmentation
CN106651825A
Stacked workpiece posture recognizing and picking method based on RGBD camera
CN108555908A