CN113298834B - Visual edge finding image processing method and device for metal plate - Google Patents
Visual edge finding image processing method and device for metal plate Download PDFInfo
- Publication number
- CN113298834B CN113298834B CN202110476015.5A CN202110476015A CN113298834B CN 113298834 B CN113298834 B CN 113298834B CN 202110476015 A CN202110476015 A CN 202110476015A CN 113298834 B CN113298834 B CN 113298834B
- Authority
- CN
- China
- Prior art keywords
- angle
- image
- template
- vertex
- binary image
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Active
Links
- 239000002184 metal Substances 0.000 title claims abstract description 55
- 230000000007 visual effect Effects 0.000 title claims abstract description 30
- 238000003672 processing method Methods 0.000 title claims abstract description 17
- 238000012545 processing Methods 0.000 claims abstract description 37
- 238000007781 pre-processing Methods 0.000 claims abstract description 28
- 238000012216 screening Methods 0.000 claims abstract description 22
- 238000005070 sampling Methods 0.000 claims abstract description 7
- 238000000034 method Methods 0.000 claims description 37
- 230000006870 function Effects 0.000 claims description 21
- 230000000877 morphologic effect Effects 0.000 claims description 20
- 238000001914 filtration Methods 0.000 claims description 14
- 238000004458 analytical method Methods 0.000 claims description 8
- 230000011218 segmentation Effects 0.000 claims description 6
- 238000012360 testing method Methods 0.000 claims description 6
- 238000011161 development Methods 0.000 description 3
- 230000018109 developmental process Effects 0.000 description 3
- 238000003698 laser cutting Methods 0.000 description 3
- 238000010586 diagram Methods 0.000 description 2
- 238000005259 measurement Methods 0.000 description 2
- 230000009286 beneficial effect Effects 0.000 description 1
- 238000001514 detection method Methods 0.000 description 1
- 238000005516 engineering process Methods 0.000 description 1
- 238000004519 manufacturing process Methods 0.000 description 1
- 238000012986 modification Methods 0.000 description 1
- 230000004048 modification Effects 0.000 description 1
- 230000003287 optical effect Effects 0.000 description 1
- 238000003860 storage Methods 0.000 description 1
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T7/00—Image analysis
- G06T7/10—Segmentation; Edge detection
- G06T7/13—Edge detection
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T5/00—Image enhancement or restoration
- G06T5/20—Image enhancement or restoration using local operators
- G06T5/30—Erosion or dilatation, e.g. thinning
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T7/00—Image analysis
- G06T7/10—Segmentation; Edge detection
- G06T7/136—Segmentation; Edge detection involving thresholding
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T7/00—Image analysis
- G06T7/10—Segmentation; Edge detection
- G06T7/155—Segmentation; Edge detection involving morphological operators
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T7/00—Image analysis
- G06T7/10—Segmentation; Edge detection
- G06T7/194—Segmentation; Edge detection involving foreground-background segmentation
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T7/00—Image analysis
- G06T7/70—Determining position or orientation of objects or cameras
- G06T7/73—Determining position or orientation of objects or cameras using feature-based methods
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T2207/00—Indexing scheme for image analysis or image enhancement
- G06T2207/30—Subject of image; Context of image processing
- G06T2207/30108—Industrial image inspection
- G06T2207/30136—Metal
Landscapes
- Engineering & Computer Science (AREA)
- Physics & Mathematics (AREA)
- General Physics & Mathematics (AREA)
- Theoretical Computer Science (AREA)
- Computer Vision & Pattern Recognition (AREA)
- Image Analysis (AREA)
Abstract
The invention provides a visual edge-finding image processing method and device for a metal plate, which are used for preprocessing an acquired vertex angle image of the metal plate to obtain a binary image; extracting outline information of all characteristic regions in the binary image, performing polygon fitting, and screening out vertex angle characteristics of the plate; performing down-sampling processing on the binary image only containing the vertex angle characteristics to obtain a binary image to be matched, drawing right-angle binary images with different rotation angles as templates, and performing template matching by using a template matching algorithm to obtain the position and the angle of the vertex angle coarse positioning of the plate; selecting areas where the two right-angle sides are located from a binary image containing only the vertex angle characteristics, and fitting straight lines where the two right-angle sides are located; and calculating the intersection point of the two straight lines according to a fitting linear equation of the two right-angle sides, namely the position of the top angle of the plate, and calculating the average deflection angle according to the slopes of the two straight lines, namely the deflection angle of the plate. The invention can realize the visual automatic edge searching of the metal plate with high efficiency and high precision.
Description
Technical Field
The invention relates to the field of automatic edge searching of a plane laser cutting machine, in particular to a method and a device for processing a visual edge searching image of a metal plate.
Background
With the continuous development of the laser cutting industry, the development of the automatic edge searching function of the metal plate in the laser industry is more and more mature. The automatic edge searching method widely applied in the market at present mainly adopts two modes of capacitance edge searching and photoelectric edge searching. The two methods save labor cost and time cost to a certain extent, manual intervention is still not left, the edge searching precision is not high, the time required for edge searching is relatively long, and the working efficiency of the machine tool is influenced. Along with the increasingly intense market competition of the laser cutting industry, the edge searching efficiency of the plate is improved, and the realization of high-efficiency high-precision full-automatic edge searching is an urgent demand at present.
Machine vision is to use a machine to replace human eyes for measurement and judgment, is an important branch of automation and intelligent development, and is widely applied to various fields in production and life. In the industrial field, machine vision is mainly used for aspects such as part detection, feature recognition, dimension measurement and positioning guidance, and has the characteristics of high precision, strong flexibility, high efficiency, adaptability to special environments and the like.
The machine vision technology is applied to the plate edge searching, so that the edge searching efficiency can be greatly improved, the edge searching accuracy is ensured, manual intervention can be completely separated, and a stable and effective metal plate edge searching visual image processing method is found out as a core task of visual edge searching.
Disclosure of Invention
The invention aims to provide a method and a device for processing a visual edge finding image of a metal plate, so as to realize high-efficiency and high-precision visual automatic edge finding of the metal plate.
The invention is realized by the following steps:
in one aspect, the invention provides a visual edge finding image processing method for a metal plate, which comprises the following steps:
preprocessing the collected metal plate vertex angle image, preliminarily filtering out interference characteristics, and separating out a target and a background to obtain a binary image;
extracting outline information of all feature areas in the binary image, then performing polygon fitting on the outline, further screening vertex angle features of the plate according to the fitted polygon information, and obtaining a binary image only containing the vertex angle features;
performing down-sampling processing on the binary image only containing the vertex angle characteristics to obtain a binary image to be matched, drawing a right-angle binary image with different rotation angles by using an opencv drawing function as a template, and performing template matching by using a template matching algorithm to obtain the rotation angle of a right angle in the corresponding template image when the matching degree is highest and the position of template matching, namely the position and the angle of the board vertex angle coarse positioning;
selecting areas where two right-angle sides are located in a binary image frame only containing the characteristics of the top angle according to the position and the angle of the top angle coarse positioning, performing morphological processing on the areas, removing interference points in the direction perpendicular to the right-angle sides, and fitting straight lines where the two right-angle sides are located by using a least square method;
and calculating the intersection point of the two straight lines according to a fitting linear equation of the two right-angle sides, namely the position of the top angle of the plate, and calculating the average deflection angle according to the slopes of the two straight lines, namely the deflection angle of the plate.
Further, the preprocessing the collected metal plate vertex angle image specifically comprises:
and preprocessing the collected metal plate vertex angle image by a median filtering method, a threshold segmentation method and a morphological processing method in sequence.
Further, further screening out panel apex angle characteristics according to the information of the polygon of fitting specifically includes:
calculating the area and the perimeter of each polygon and the width and the height of the minimum circumscribed rectangle of each polygon, calculating the ratio K of the area to the perimeter and the width-to-height ratio K1 of the minimum circumscribed rectangle, setting an area-perimeter ratio threshold Kn and a minimum circumscribed rectangle width-to-height ratio threshold Kn1 according to the actual working condition test result, and selecting the polygon with the largest area from all the polygons which satisfy K > Kn and have the condition that K1< Kn1, wherein the corresponding characteristic is the vertex angle characteristic.
Further, the step of drawing the right-angle binary images with different rotation angles by using the opencv drawing function as a template, and performing template matching by using a template matching algorithm to obtain the rotation angle of the right angle in the corresponding template image with the highest matching degree and the position matched with the template, namely the position and the angle for roughly positioning the top angle of the plate, specifically comprises the steps of:
setting Span as 45 degrees and step length as 2 degrees, drawing a right-angle binary image in real time by using opencv drawing functions, rotating right angles in the template once every 2 degrees within the range of-45-45 degrees to obtain a template image, and performing template matching operation on the template image and an image to be matched to obtain a group of correlation coefficients; and after completing all template matching operation, comparing all correlation coefficients, and selecting the global maximum correlation coefficient R, wherein the corresponding template matching position and the right-angle rotation angle in the template are the position and the angle for roughly positioning the top angle of the plate.
Further, according to the position and the angle of the vertex angle coarse positioning, selecting an area where two right-angle sides are located in a binary image containing only vertex angle features, performing morphological processing on the area, and removing interference points perpendicular to the direction of the right-angle sides specifically comprises:
according to the position and the angle of the vertex angle coarse positioning, selecting areas where a horizontal right-angle side and a vertical right-angle side are located in a binary image only containing vertex angle characteristics, counting effective point sets in the areas, performing corrosion-first expansion treatment on the point set of the fitting vertical right-angle side by adopting a 1 x n structural element, performing corrosion-first expansion treatment on the point set of the fitting horizontal right-angle side by adopting an n x 1 structural element, wherein n is 1/100 of the image size.
On the other hand, the invention also provides a visual edge finding image processing device for the metal plate, which comprises:
the image preprocessing module is used for preprocessing the collected metal plate vertex angle image, preliminarily filtering out interference characteristics, and separating out a target and a background to obtain a binary image;
the contour analysis screening module is used for extracting contour information of all the characteristic regions in the binary image, then performing polygon fitting on the contour, further screening vertex angle characteristics of the plate according to the fitted polygon information, and obtaining the binary image only containing the vertex angle characteristics;
the template matching vertex angle coarse positioning module is used for performing down-sampling processing on the binary image only containing vertex angle features to obtain a binary image to be matched, drawing right-angle binary images of different rotation angles by using opencv drawing functions as templates, and performing template matching by using a template matching algorithm to obtain the rotation angle of a right angle in the corresponding template image when the matching degree is highest and the position matched with the template, namely the position and the angle for coarsely positioning the vertex angle of the plate;
the straight line fitting module is used for selecting areas where two right-angle sides are located in a binary image only containing vertex angle characteristics according to the position and the angle of the vertex angle coarse positioning, performing morphological processing on the areas, removing interference points in the direction perpendicular to the right-angle sides, and fitting straight lines where the two right-angle sides are located by using a least square method;
the top angle fine positioning module is used for calculating the intersection point of two straight lines according to a fitting linear equation of the two right-angle sides, namely the position of the top angle of the plate, and calculating the average deflection angle according to the slopes of the two straight lines, namely the deflection angle of the plate;
further, the preprocessing the collected metal plate vertex angle image by the image preprocessing module specifically comprises:
and preprocessing the collected metal plate vertex angle image by using a median filtering method, a threshold segmentation method and a morphological processing method in sequence.
Further, the step of further screening the vertex angle characteristics of the plate according to the fitted polygonal information by the contour analysis screening module specifically comprises:
calculating the area and the perimeter of each polygon and the width and the height of the minimum circumscribed rectangle, calculating the ratio K of the area to the perimeter and the width-height ratio K1 of the minimum circumscribed rectangle, setting an area-perimeter ratio threshold Kn and a minimum circumscribed rectangle width-height ratio threshold Kn1 according to the test result of the actual working condition, selecting the polygon with the largest area from all the polygons which meet K > Kn and K1< Kn1, and taking the corresponding characteristic as the vertex angle characteristic.
Further, the template matching vertex angle coarse positioning module draws a right angle binary image with different rotation angles by using an opencv drawing function as a template, performs template matching by using a template matching algorithm, and obtains a rotation angle of a right angle in a corresponding template image when the matching degree is the highest and a template matching position, namely the position and the angle for the plate vertex angle coarse positioning specifically include:
setting Span as 45 degrees and step length as 2 degrees, drawing a right-angle binary image in real time by using opencv drawing functions, rotating right angles in the template once every 2 degrees within the range of-45-45 degrees to obtain a template image, and performing template matching operation on the template image and an image to be matched to obtain a group of correlation coefficients; and after completing all template matching operation, comparing all correlation coefficients, and selecting the global maximum correlation coefficient R, wherein the corresponding template matching position and the right-angle rotation angle in the template are the position and the angle for roughly positioning the top angle of the plate.
Further, the straight line fitting module selects the area where two right-angle sides are located in the binary image middle frame only containing the vertex angle characteristics according to the position and the angle of the vertex angle coarse positioning, the area is subjected to morphological processing, and the removal of the interference points in the direction perpendicular to the right-angle sides specifically comprises:
according to the position and the angle of the vertex angle coarse positioning, selecting areas where a horizontal right-angle side and a vertical right-angle side are located in a binary image only containing vertex angle characteristics, counting effective point sets in the areas, performing corrosion-first expansion treatment on the point set of the fitting vertical right-angle side by adopting a 1 x n structural element, performing corrosion-first expansion treatment on the point set of the fitting horizontal right-angle side by adopting an n x 1 structural element, wherein n is 1/100 of the image size.
Compared with the prior art, the invention has the following beneficial effects:
the invention provides a method and a device for processing a visual edge-finding image of a metal plate, which are used for preprocessing an acquired vertex angle image of the metal plate, preliminarily filtering out interference characteristics, and separating a target and a background to obtain a binary image; extracting outline information of all characteristic areas in the binary image, then performing polygon fitting on the outline, further screening the vertex angle characteristics of the plate according to the fitted polygon information, and obtaining the binary image only containing the vertex angle characteristics; performing down-sampling processing on the binary image only containing the vertex angle characteristics to obtain a binary image to be matched, drawing a right-angle binary image with different rotation angles by using an opencv drawing function as a template, and performing template matching by using a template matching algorithm to obtain the rotation angle of a right angle in the corresponding template image when the matching degree is highest and the position of template matching, namely the position and the angle of the board vertex angle coarse positioning; selecting areas where two right-angle sides are located in a binary image frame only containing the characteristics of the top angle according to the position and the angle of the top angle coarse positioning, performing morphological processing on the areas, removing interference points in the direction perpendicular to the right-angle sides, and fitting straight lines where the two right-angle sides are located by using a least square method; and calculating the intersection point of the two straight lines according to a fitting linear equation of the two right-angle sides, namely the position of the top angle of the plate, and calculating the average deflection angle according to the slopes of the two straight lines, namely the deflection angle of the plate. The method can effectively remove interference information in the image, quickly and accurately position the position and the deflection angle of the metal plate vertex angle in the image, and realize high-efficiency and high-precision visual automatic edge finding of the metal plate.
Drawings
Fig. 1 is a flowchart of a visual edge finding image processing method for a metal plate according to an embodiment of the present invention;
FIG. 2 is a flow chart of a profile analysis screening provided by an embodiment of the present invention;
fig. 3 is a flowchart of template matching vertex angle coarse positioning according to an embodiment of the present invention;
FIG. 4 is a template diagram drawn in template matching provided by an embodiment of the present invention;
fig. 5 is a block diagram of a visual edge finding image processing apparatus for a metal plate according to an embodiment of the present invention.
Detailed Description
The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
As shown in fig. 1, an embodiment of the present invention provides a method for processing a visual edge finding image of a metal plate, including the following steps:
s1, image preprocessing: preprocessing the collected metal plate vertex angle image, preliminarily filtering out interference characteristics, and separating out a target and a background to obtain a binary image;
s2, contour analysis and screening: extracting outline information of all feature areas in the binary image, then performing polygon fitting on the outline, further screening vertex angle features of the plate according to the fitted polygon information, and obtaining a binary image only containing the vertex angle features;
s3, roughly positioning a template matching vertex angle: performing down-sampling processing on the binary image only containing the vertex angle characteristics to obtain a binary image to be matched, drawing a right-angle binary image with different rotation angles by using an opencv drawing function as a template, and performing template matching by using a template matching algorithm to obtain the rotation angle of a right angle in the corresponding template image when the matching degree is highest and the position of template matching, namely the position and the angle of the board vertex angle coarse positioning;
s4, fitting a straight line: selecting areas where two right-angle sides are located in a binary image frame only containing the characteristics of the top angle according to the position and the angle of the top angle coarse positioning, performing morphological processing on the areas, removing interference points in the direction perpendicular to the right-angle sides, and fitting straight lines where the two right-angle sides are located by using a least square method;
s5, top angle fine positioning: and calculating the intersection point of the two straight lines according to a fitting linear equation of the two right-angle sides, namely the position of the top angle of the plate, and calculating the average deflection angle according to the slopes of the two straight lines, namely the deflection angle of the plate.
By the method, the interference information in the image can be effectively removed, the position and the deflection angle of the metal plate vertex angle in the image can be quickly and accurately positioned, and the efficient and high-precision visual automatic edge finding of the metal plate is realized.
The above steps will be described in detail below.
The preprocessing of the collected metal plate vertex angle image in the step S1 specifically includes:
preprocessing the collected metal plate vertex angle image by a median filtering method, a threshold segmentation method and a morphological processing method in sequence, filtering out interference features preliminarily after preprocessing, separating out a target and a background, and obtaining a binary image.
As shown in fig. 2, the further screening of the vertex angle characteristics of the board according to the information of the fitted polygon in step S2 specifically includes:
calculating the area and the perimeter of each polygon and the width and the height of the minimum circumscribed rectangle, calculating the ratio K of the area to the perimeter and the width-height ratio K1 of the minimum circumscribed rectangle, setting an area-perimeter ratio threshold Kn and a minimum circumscribed rectangle width-height ratio threshold Kn1 according to the test result of the actual working condition, selecting the polygon with the largest area from all the polygons which meet K > Kn and have the K1< Kn1, wherein the corresponding characteristic contour is a target contour, and the corresponding characteristic is a vertex angle characteristic.
As shown in fig. 3 and 4, in step S3, the binary image containing only corner features is downsampled, and the salient size is reduced to obtain a binary image to be matched. The method comprises the following steps of drawing right-angle binary images with different rotation angles by using opencv drawing functions as templates, and performing template matching by using a template matching algorithm to obtain the rotation angle of a right angle in a corresponding template image when the matching degree is the highest and the position of template matching, namely the position and the angle of the board vertex angle coarse positioning, wherein the method specifically comprises the following steps:
setting Span to be 45 degrees, setting the rotation angle range of the right angle in the template to be-45 degrees, setting the step length to be 2 degrees, namely rotating the right angle in the template once every 2 degrees and performing template matching once, drawing a drawing function by using opencv, drawing a right angle binary image in real time, rotating the right angle in the template once every 2 degrees within the range of-45 degrees to obtain a template image, and performing template matching operation with the image to be matched to obtain a group of correlation coefficients; and after completing all template matching operation, comparing all correlation coefficients, and selecting the global maximum correlation coefficient R, wherein the corresponding template matching position and the right-angle rotation angle in the template are the position and the angle for roughly positioning the top angle of the plate.
In step S4, according to the position and angle of the vertex angle coarse positioning, selecting an area where two right-angle sides are located in the binary image only including the vertex angle feature, performing morphological processing on the area, and removing the interference points in the direction perpendicular to the right-angle sides specifically includes:
according to the position and the angle of the vertex angle coarse positioning, selecting areas where a horizontal right-angle side and a vertical right-angle side are located in a binary image only containing vertex angle characteristics, counting effective point sets in the areas, performing corrosion-first expansion treatment on the point set of the fitting vertical right-angle side by adopting a 1 x n structural element, performing corrosion-first expansion treatment on the point set of the fitting horizontal right-angle side by adopting an n x 1 structural element, wherein n is 1/100 of the image size.
And finally, performing linear fitting on the filtered point set by adopting a least square method, and respectively fitting straight lines where a horizontal right-angle side and a numerical right-angle side are located. And calculating the intersection point of the two straight lines according to a fitting linear equation of the two right-angle sides, namely the position of the top angle of the plate, and calculating the average deflection angle according to the slopes of the two straight lines, namely the deflection angle of the plate.
Based on the same inventive concept, the embodiment of the invention also provides a visual edge finding image processing device for a metal plate, and as the principle of the problem solved by the device is similar to the method of the embodiment, the implementation of the device can refer to the implementation of the method, and repeated details are not repeated.
As shown in fig. 5, a visual edge finding image processing apparatus for a metal plate provided in an embodiment of the present invention may be used to perform the above method embodiment, and the apparatus includes:
the image preprocessing module is used for preprocessing the collected metal plate vertex angle image, preliminarily filtering out interference characteristics, and separating out a target and a background to obtain a binary image;
the contour analysis screening module is used for extracting contour information of all the characteristic regions in the binary image, then performing polygon fitting on the contour, further screening vertex angle characteristics of the plate according to the fitted polygon information, and obtaining the binary image only containing the vertex angle characteristics;
the template matching vertex angle coarse positioning module is used for performing downsampling processing on the binary image only containing the vertex angle characteristics to obtain a binary image to be matched, drawing right-angle binary images with different rotation angles by using opencv drawing functions as templates, performing template matching by using a template matching algorithm, and obtaining the rotation angle of a right angle in the corresponding template image when the matching degree is highest and the position matched with the template, namely the position and the angle for coarsely positioning the vertex angle of the plate;
the straight line fitting module is used for selecting areas where two right-angle sides are located in a binary image only containing vertex angle characteristics according to the position and the angle of the vertex angle coarse positioning, performing morphological processing on the areas, removing interference points in the direction perpendicular to the right-angle sides, and fitting straight lines where the two right-angle sides are located by using a least square method;
the top angle fine positioning module is used for calculating the intersection point of two straight lines according to a fitting linear equation of the two right-angle sides, namely the position of the top angle of the plate, and calculating the average deflection angle according to the slopes of the two straight lines, namely the deflection angle of the plate;
further, the preprocessing the collected metal plate vertex angle image by the image preprocessing module specifically comprises:
and preprocessing the collected metal plate vertex angle image by a median filtering method, a threshold segmentation method and a morphological processing method in sequence.
Further, the step of further screening the vertex angle characteristics of the plate according to the fitted polygonal information by the contour analysis screening module specifically comprises:
calculating the area and the perimeter of each polygon and the width and the height of the minimum circumscribed rectangle, calculating the ratio K of the area to the perimeter and the width-height ratio K1 of the minimum circumscribed rectangle, setting an area-perimeter ratio threshold Kn and a minimum circumscribed rectangle width-height ratio threshold Kn1 according to the test result of the actual working condition, selecting the polygon with the largest area from all the polygons which meet K > Kn and K1< Kn1, and taking the corresponding characteristic as the vertex angle characteristic.
Further, the template matching vertex angle coarse positioning module utilizes opencv drawing functions to draw right-angle binary images with different rotation angles as templates, and utilizes a template matching algorithm to perform template matching, so that the rotation angle of the right angle in the corresponding template image when the matching degree is the highest and the position where the template is matched are obtained, namely, the position and the angle for the plate vertex angle coarse positioning specifically include:
setting Span as 45 degrees and step length as 2 degrees, drawing a right-angle binary image in real time by using opencv drawing functions, rotating right angles in the template once every 2 degrees within the range of-45-45 degrees to obtain a template image, and performing template matching operation on the template image and an image to be matched to obtain a group of correlation coefficients; and after completing all template matching operation, comparing all correlation coefficients, and selecting the global maximum correlation coefficient R, wherein the corresponding template matching position and the right-angle rotation angle in the template are the position and the angle for roughly positioning the top angle of the plate.
Further, the straight line fitting module selects the area where two right-angle sides are located in the binary image middle frame only containing the vertex angle characteristics according to the position and the angle of the vertex angle coarse positioning, the area is subjected to morphological processing, and the removal of the interference points in the direction perpendicular to the right-angle sides specifically comprises:
according to the position and the angle of the vertex angle coarse positioning, selecting areas where a horizontal right-angle side and a vertical right-angle side are located in a binary image only containing vertex angle characteristics, counting effective point sets in the areas, performing corrosion-first expansion treatment on the point set of the fitting vertical right-angle side by adopting a 1 x n structural element, performing corrosion-first expansion treatment on the point set of the fitting horizontal right-angle side by adopting an n x 1 structural element, wherein n is 1/100 of the image size.
In summary, the method and the device for processing the visual edge-finding image of the metal plate provided by the invention preprocess the collected image of the top angle of the metal plate, preliminarily filter out interference characteristics, separate out a target and a background, and obtain a binary image; extracting outline information of all feature areas in the binary image, then performing polygon fitting on the outline, further screening vertex angle features of the plate according to the fitted polygon information, and obtaining a binary image only containing the vertex angle features; performing down-sampling processing on the binary image only containing the vertex angle characteristics to obtain a binary image to be matched, drawing a right-angle binary image with different rotation angles by using an opencv drawing function as a template, and performing template matching by using a template matching algorithm to obtain the rotation angle of a right angle in the corresponding template image when the matching degree is highest and the position of template matching, namely the position and the angle of the board vertex angle coarse positioning; selecting areas where two right-angle sides are located in a binary image frame only containing the characteristics of the top angle according to the position and the angle of the top angle coarse positioning, performing morphological processing on the areas, removing interference points in the direction perpendicular to the right-angle sides, and fitting straight lines where the two right-angle sides are located by using a least square method; and calculating the intersection point of the two straight lines according to a fitting linear equation of the two right-angle sides, namely the position of the top angle of the plate, and calculating the average deflection angle according to the slopes of the two straight lines, namely the deflection angle of the plate. The method can effectively remove interference information in the image, quickly and accurately position the position and the deflection angle of the metal plate vertex angle in the image, and realize high-efficiency and high-precision visual automatic edge finding of the metal plate.
Those of ordinary skill in the art will appreciate that all or part of the steps of the various methods of the embodiments may be implemented by associated hardware as instructed by a program, which may be stored on a computer-readable storage medium, which may include: read Only Memory (ROM), Random Access Memory (RAM), magnetic or optical disks, and the like.
The above description is only for the purpose of illustrating the preferred embodiments of the present invention and is not to be construed as limiting the invention, and any modifications, equivalents, improvements and the like that fall within the spirit and principle of the present invention are intended to be included therein.
Claims (10)
1. A visual edge finding image processing method for a metal plate is characterized by comprising the following steps:
preprocessing the collected metal plate vertex angle image, preliminarily filtering out interference characteristics, and separating out a target and a background to obtain a binary image;
extracting outline information of all feature areas in the binary image, then performing polygon fitting on the outline, further screening vertex angle features of the plate according to the fitted polygon information, and obtaining a binary image only containing the vertex angle features;
performing down-sampling processing on the binary image only containing the vertex angle characteristics to obtain a binary image to be matched, drawing a right-angle binary image with different rotation angles by using an opencv drawing function as a template, and performing template matching by using a template matching algorithm to obtain the rotation angle of a right angle in the corresponding template image when the matching degree is highest and the position of template matching, namely the position and the angle of the board vertex angle coarse positioning;
selecting areas where two right-angle sides are located in a binary image frame only containing the characteristics of the top angle according to the position and the angle of the top angle coarse positioning, performing morphological processing on the areas, removing interference points in the direction perpendicular to the right-angle sides, and fitting straight lines where the two right-angle sides are located by using a least square method;
and calculating the intersection point of the two straight lines according to a fitting linear equation of the two right-angle sides, namely the position of the top angle of the plate, and calculating the average deflection angle according to the slopes of the two straight lines, namely the deflection angle of the plate.
2. The visual edge-finding image processing method of the metal plate as claimed in claim 1, wherein the preprocessing of the collected top angle image of the metal plate specifically comprises:
and preprocessing the collected metal plate vertex angle image by a median filtering method, a threshold segmentation method and a morphological processing method in sequence.
3. The visual edge-finding image processing method of the metal plate as claimed in claim 1, wherein the further screening of the plate vertex angle characteristics according to the fitted polygon information specifically comprises:
calculating the area and the perimeter of each polygon and the width and the height of the minimum circumscribed rectangle of each polygon, calculating the ratio K of the area to the perimeter and the width-to-height ratio K1 of the minimum circumscribed rectangle, setting an area-perimeter ratio threshold Kn and a minimum circumscribed rectangle width-to-height ratio threshold Kn1 according to the actual working condition test result, and selecting the polygon with the largest area from all the polygons which satisfy K > Kn and have the condition that K1< Kn1, wherein the corresponding characteristic is the vertex angle characteristic.
4. The visual edge-finding image processing method for the metal plate as claimed in claim 1, wherein the step of drawing the right-angle binary image with different rotation angles by using an opencv drawing function as a template and performing template matching by using a template matching algorithm to obtain the rotation angle of the right angle in the template image and the position of template matching corresponding to the highest matching degree, namely the position and the angle of the coarse positioning of the vertex angle of the plate, specifically comprises the steps of:
setting Span as 45 degrees and step length as 2 degrees, drawing a right-angle binary image in real time by using opencv drawing functions, rotating right angles in the template once every 2 degrees within the range of-45-45 degrees to obtain a template image, and performing template matching operation on the template image and an image to be matched to obtain a group of correlation coefficients; and after completing all template matching operation, comparing all correlation coefficients, and selecting the global maximum correlation coefficient R, wherein the corresponding template matching position and the right-angle rotation angle in the template are the position and the angle for roughly positioning the top angle of the plate.
5. The visual edge-finding image processing method of the metal plate as claimed in claim 1, wherein the area where the two right-angle sides are located is selected from the binary image only containing the vertex angle features according to the position and the angle of the vertex angle coarse positioning, the area is subjected to morphological processing, and the removing of the interference points in the direction perpendicular to the right-angle sides specifically comprises:
according to the position and the angle of the vertex angle coarse positioning, selecting areas where a horizontal right-angle side and a vertical right-angle side are located in a binary image only containing vertex angle characteristics, counting effective point sets in the areas, performing corrosion-first expansion treatment on the point set of the fitting vertical right-angle side by adopting a 1 x n structural element, performing corrosion-first expansion treatment on the point set of the fitting horizontal right-angle side by adopting an n x 1 structural element, wherein n is 1/100 of the image size.
6. The utility model provides a sheet metal vision seeks limit image processing apparatus which characterized in that includes:
the image preprocessing module is used for preprocessing the collected metal plate vertex angle image, preliminarily filtering out interference characteristics, and separating out a target and a background to obtain a binary image;
the contour analysis screening module is used for extracting contour information of all the characteristic regions in the binary image, then performing polygon fitting on the contour, further screening vertex angle characteristics of the plate according to the fitted polygon information, and obtaining the binary image only containing the vertex angle characteristics;
the template matching vertex angle coarse positioning module is used for performing downsampling processing on the binary image only containing the vertex angle characteristics to obtain a binary image to be matched, drawing right-angle binary images with different rotation angles by using opencv drawing functions as templates, performing template matching by using a template matching algorithm, and obtaining the rotation angle of a right angle in the corresponding template image when the matching degree is highest and the position matched with the template, namely the position and the angle for coarsely positioning the vertex angle of the plate;
the straight line fitting module is used for selecting an area where two right-angle sides are located in a binary image frame only containing vertex angle characteristics according to the position and the angle of the vertex angle coarse positioning, performing morphological processing on the area, removing interference points in the direction perpendicular to the right-angle sides, and fitting straight lines where the two right-angle sides are located by using a least square method;
and the vertex angle fine positioning module is used for calculating the intersection point of the two straight lines according to the fitting linear equation of the two right-angle sides, namely the position of the vertex angle of the plate, and calculating the average deflection angle according to the slope of the two straight lines, namely the deflection angle of the plate.
7. The visual edge finding image processing device for the metal sheet as claimed in claim 6, wherein the image preprocessing module for preprocessing the collected top angle image of the metal sheet specifically comprises:
and preprocessing the collected metal plate vertex angle image by using a median filtering method, a threshold segmentation method and a morphological processing method in sequence.
8. The visual edge finding image processing device for the metal sheet as claimed in claim 6, wherein the contour analysis screening module further screens out the features of the top corners of the sheet according to the fitted polygon information specifically comprises:
calculating the area and the perimeter of each polygon and the width and the height of the minimum circumscribed rectangle, calculating the ratio K of the area to the perimeter and the width-height ratio K1 of the minimum circumscribed rectangle, setting an area-perimeter ratio threshold Kn and a minimum circumscribed rectangle width-height ratio threshold Kn1 according to the test result of the actual working condition, selecting the polygon with the largest area from all the polygons which meet K > Kn and K1< Kn1, and taking the corresponding characteristic as the vertex angle characteristic.
9. The visual edge-finding image processing device for metal plates as claimed in claim 6, wherein the template matching vertex angle coarse positioning module draws a right-angle binary image with different rotation angles by using opencv drawing functions as a template, and performs template matching by using a template matching algorithm, and obtaining the rotation angle of the right angle in the corresponding template image and the position where the template is matched when the matching degree is the highest, namely the position and the angle of the plate vertex angle coarse positioning specifically comprises:
setting Span as 45 degrees and step length as 2 degrees, drawing a right-angle binary image in real time by using opencv drawing functions, rotating right angles in the template once every 2 degrees within the range of-45-45 degrees to obtain a template image, and performing template matching operation on the template image and an image to be matched to obtain a group of correlation coefficients; and after completing all template matching operation, comparing all correlation coefficients, and selecting the global maximum correlation coefficient R, wherein the corresponding template matching position and the right-angle rotation angle in the template are the position and the angle for roughly positioning the top angle of the plate.
10. The sheet metal visual edge-seeking image processing device as claimed in claim 6, wherein the straight line fitting module selects an area where two right-angle edges are located in a binary image containing only the vertex angle features according to the position and angle of the vertex angle coarse positioning, performs morphological processing on the area, and removes interference points in the direction perpendicular to the right-angle edges specifically comprises:
according to the position and the angle of the vertex angle coarse positioning, selecting areas where a horizontal right-angle side and a vertical right-angle side are located in a binary image only containing vertex angle characteristics, counting effective point sets in the areas, performing corrosion-first expansion treatment on the point set of the fitting vertical right-angle side by adopting a 1 x n structural element, performing corrosion-first expansion treatment on the point set of the fitting horizontal right-angle side by adopting an n x 1 structural element, wherein n is 1/100 of the image size.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202110476015.5A CN113298834B (en) | 2021-04-29 | 2021-04-29 | Visual edge finding image processing method and device for metal plate |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202110476015.5A CN113298834B (en) | 2021-04-29 | 2021-04-29 | Visual edge finding image processing method and device for metal plate |
Publications (2)
Publication Number | Publication Date |
---|---|
CN113298834A CN113298834A (en) | 2021-08-24 |
CN113298834B true CN113298834B (en) | 2022-07-05 |
Family
ID=77321787
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202110476015.5A Active CN113298834B (en) | 2021-04-29 | 2021-04-29 | Visual edge finding image processing method and device for metal plate |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN113298834B (en) |
Families Citing this family (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN113828948B (en) * | 2021-11-23 | 2022-03-08 | 济南邦德激光股份有限公司 | Plate edge searching method, calibration system and edge searching system of laser cutting machine |
Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CA2061313A1 (en) * | 1991-03-20 | 1992-09-21 | Arthur F. Griffin | Rectilinear object image matcher |
CN102628682A (en) * | 2012-04-24 | 2012-08-08 | 重庆大学 | Volume measurement method based on industrial CT scanning technology |
CN104981105A (en) * | 2015-07-09 | 2015-10-14 | 广东工业大学 | Detecting and error-correcting method capable of rapidly and accurately obtaining element center and deflection angle |
CN110175621A (en) * | 2019-03-18 | 2019-08-27 | 上海柏楚电子科技股份有限公司 | One kind being based on the matched laser cutting vision positioning method of any template |
CN112085033A (en) * | 2020-08-19 | 2020-12-15 | 浙江华睿科技有限公司 | Template matching method and device, electronic equipment and storage medium |
-
2021
- 2021-04-29 CN CN202110476015.5A patent/CN113298834B/en active Active
Patent Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CA2061313A1 (en) * | 1991-03-20 | 1992-09-21 | Arthur F. Griffin | Rectilinear object image matcher |
CN102628682A (en) * | 2012-04-24 | 2012-08-08 | 重庆大学 | Volume measurement method based on industrial CT scanning technology |
CN104981105A (en) * | 2015-07-09 | 2015-10-14 | 广东工业大学 | Detecting and error-correcting method capable of rapidly and accurately obtaining element center and deflection angle |
CN110175621A (en) * | 2019-03-18 | 2019-08-27 | 上海柏楚电子科技股份有限公司 | One kind being based on the matched laser cutting vision positioning method of any template |
CN112085033A (en) * | 2020-08-19 | 2020-12-15 | 浙江华睿科技有限公司 | Template matching method and device, electronic equipment and storage medium |
Non-Patent Citations (2)
Title |
---|
Efficient technique for circle detection using hypothesis filtering and hough transform;WCY Lam, et al.;《IEEE Proceedings:Vision,Image and Signal Processing》;19961031;292-299 * |
全自动裁切机定位系统的设计与实现;赵亮亮;《中国优秀博硕士学位论文全文数据库(硕士)工程科技辑》;20190915;20-57 * |
Also Published As
Publication number | Publication date |
---|---|
CN113298834A (en) | 2021-08-24 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN108364311B (en) | Automatic positioning method for metal part and terminal equipment | |
CN107169487B (en) | Salient object detection method based on superpixel segmentation and depth feature positioning | |
CN109409355B (en) | Novel transformer nameplate identification method and device | |
CN105678213B (en) | Dual-mode mask person event automatic detection method based on video feature statistics | |
CN110276759B (en) | Mobile phone screen bad line defect diagnosis method based on machine vision | |
CN102999886A (en) | Image edge detector and ruler raster grid line precision detection system | |
CN103175844A (en) | Detection method for scratches and defects on surfaces of metal components | |
CN113298834B (en) | Visual edge finding image processing method and device for metal plate | |
CN108564573B (en) | Automatic fish head and tail image identification method for spanish mackerel cutting machine | |
CN110348461A (en) | A kind of Surface Flaw feature extracting method | |
CN114494226B (en) | Method for detecting greasy dirt defect of spinning cake based on graph centroid tracking algorithm | |
CN113588656A (en) | Novel bolt appearance size detection method | |
CN114529715B (en) | Image identification method and system based on edge extraction | |
AU2021368390B2 (en) | Multi-target recognition system and method for follow-up robot based on coded thermal infrared mark | |
CN113436102A (en) | Method for detecting surface defects of machined part | |
Bodnár et al. | A novel method for barcode localization in image domain | |
CN110276260B (en) | Commodity detection method based on depth camera | |
CN116977893A (en) | Shoal state detection method based on improved sobel and piecewise linear transformation | |
CN116596987A (en) | Workpiece three-dimensional size high-precision measurement method based on binocular vision | |
WO2019237560A1 (en) | Border and page number scanning system | |
CN112288049B (en) | Pointer meter reading method based on template matching and limitation of connected domain pointer positioning | |
CN111598901B (en) | Method for estimating processing progress of dental restoration product based on depth image | |
CN113554695A (en) | Intelligent part hole site identification and positioning method | |
CN111652221A (en) | ROI extraction method and system for USB plug surface defect detection | |
CN113505811A (en) | Machine vision imaging method for hub production |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
GR01 | Patent grant | ||
GR01 | Patent grant |