CN113284157A - Large-breadth leather contour detection and track optimization method - Google Patents

Large-breadth leather contour detection and track optimization method Download PDF

Info

Publication number
CN113284157A
CN113284157A CN202110580574.0A CN202110580574A CN113284157A CN 113284157 A CN113284157 A CN 113284157A CN 202110580574 A CN202110580574 A CN 202110580574A CN 113284157 A CN113284157 A CN 113284157A
Authority
CN
China
Prior art keywords
point
arc
straight line
segment
points
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.)
Granted
Application number
CN202110580574.0A
Other languages
Chinese (zh)
Other versions
CN113284157B (en
Inventor
刘建群
刘洋
高伟强
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Guangdong University of Technology
Original Assignee
Guangdong University of Technology
Priority date (The priority date 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 date listed.)
Filing date
Publication date
Application filed by Guangdong University of Technology filed Critical Guangdong University of Technology
Priority to CN202110580574.0A priority Critical patent/CN113284157B/en
Publication of CN113284157A publication Critical patent/CN113284157A/en
Application granted granted Critical
Publication of CN113284157B publication Critical patent/CN113284157B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/10Segmentation; Edge detection
    • G06T7/13Edge detection
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T5/00Image enhancement or restoration
    • G06T5/20Image enhancement or restoration using local operators
    • G06T5/30Erosion or dilatation, e.g. thinning
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T5/00Image enhancement or restoration
    • G06T5/50Image enhancement or restoration using two or more images, e.g. averaging or subtraction
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T5/00Image enhancement or restoration
    • G06T5/70Denoising; Smoothing
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/10Segmentation; Edge detection
    • G06T7/136Segmentation; Edge detection involving thresholding
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/80Analysis of captured images to determine intrinsic or extrinsic camera parameters, i.e. camera calibration
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02PCLIMATE CHANGE MITIGATION TECHNOLOGIES IN THE PRODUCTION OR PROCESSING OF GOODS
    • Y02P90/00Enabling technologies with a potential contribution to greenhouse gas [GHG] emissions mitigation
    • Y02P90/30Computing systems specially adapted for manufacturing

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 discloses a method for detecting and optimizing a large-breadth leather contour, which is characterized by acquiring a leather image by using a camera lens, extracting a contour, and performing linear arc fitting and trajectory optimization on the extracted processing contour to obtain a processing trajectory curve capable of being processed quickly. The invention solves the problems that the technology for extracting the actual contour size of the irregular large-breadth leather raw material in the existing leather film covering and cutting technology is immature, the sawtooth-shaped contour is difficult to process, the 'lifting, turning and cutting' are required to be frequently carried out, and the like, and obviously improves the processing efficiency of leather film covering and cutting.

Description

Large-breadth leather contour detection and track optimization method
Technical Field
The invention relates to the technical field of leather cutting machines, in particular to a large-breadth leather contour detection and track optimization method.
Background
The leather products are widely applied in human life, and leather clothing, shoes, hats, bags and the like are common. The leather is divided into a first layer leather, a second layer leather and the like, the second layer leather is the part of the whole cowhide which is left after the first layer leather is removed, the texture is softer, and the leather can be further processed only by covering a PVC or PU film. However, in the current leather coating cutting, a long time is needed to be invested for detecting the leather surface, the accuracy of the detection result has a great relation with the experience of workers, and meanwhile, the serrated outline and the sharp corner exist on the leather edge, so that the auxiliary processing time for cutting by the leather cutting machine is greatly increased. In order to change such a situation, it is necessary to improve the automation level of the leather contour coating cutting.
The two layers of skins related by the invention are all irregular in shape and large in area, so that a large amount of time is needed for direct detection, and the accuracy only depends on the experience of workers; meanwhile, the detected leather profile has a serrated edge and a sharp corner, and a leather cutting machine on the market can only cut according to the detected cutting track, so that the serrated edge is difficult to process. And because the cutter of the cutting machine is a directional blade or a circular saw cutter, in order to protect the cutter and ensure the cutting quality, when the corner is cut in a too small track, the subsequent cutting can be carried out only by carrying out the operations of lifting, turning and dropping, and the corners in the composition of the contour line segment of the whole leather are many, so that the operations of lifting, turning and dropping are frequently carried out, and a large amount of auxiliary processing time is increased.
Disclosure of Invention
The invention aims to overcome the defects of the prior art, provides a method for detecting and optimizing the profile and the track of large-format leather, solves the problems that the technology for extracting the actual profile size of an irregular large-format leather raw material in the prior leather film covering and cutting technology is immature, the sawtooth-shaped profile is difficult to process, the cutter lifting, turning and cutter dropping are required to be frequently carried out, and the like, and obviously improves the processing efficiency of leather film covering and cutting.
In order to achieve the purpose, the technical scheme provided by the invention is as follows:
a large-breadth leather contour detection and track optimization method comprises the following steps:
s1, performing light source lighting and camera calibration;
s2, acquiring a large-format leather image through a camera;
s3, carrying out graying and binarization processing on the collected large-breadth leather image to obtain an image f (x, y);
s4, performing threshold segmentation on the image f (x, y) and extracting the image f of the area where the leather is located1(x, y); and carrying out corrosion operation on the extracted leather binary image to obtain an original contour image f1(x, y) and the eroded image f2(x, y) performing image subtraction to extract a leather profile f with a width of three pixels3(x,y);
S5, thinning and tracing the outline of the large-format leather to obtain a sequential pixel point set;
s6, selecting and optimizing the segmentation points of the point set;
s7, performing straight line circular arc fitting on the segmentation point set;
s8, performing smooth transition processing on the fit-to-synthesis track;
and S9, obtaining a processed file.
Further, the specific process of step S5 is as follows:
first, the definition is as follows:
(1) the end points belong to the boundary points, and at least one of the 8 neighborhoods is a target point;
(2) note the current center point as P;
(3) target point is marked 1 and background point is marked 0;
(4) n (P) is the number of nonzero pixels in the 8 fields of the current point P;
(5) s (P) is the number of times that the pixels change from 0 to 1 in clockwise order in an 8-domain centered on P;
the refining algorithm comprises the following steps:
a1. finding 8 fields with the boundary point as a central point, marking the central point as P, and firstly marking the boundary point meeting the following conditions:
1) n (P1) is more than or equal to 2 and less than or equal to 6, and N (P1) represents the number of foreground pixels in 8 pixels adjacent to P1;
2) s (P1) ═ 1, S (P1) indicates the number of pairs between P2-P9-P2 in the order of 0 and 1, respectively;
3).P2*P4*P6=0;
4).P4*P6*P8=0;
when all the boundary points are checked, removing all the marked points, namely changing the pixel values of the marked points from 1 to 0;
P2-P9 are eight adjacent points that surround P1 and are distributed clockwise;
a2. repeating step a1, but changing condition 3) to P2 by P4 by P8 by 0; condition 4) was changed to P2 × P6 × P8 ═ 0;
finishing the thinning operation after traversing all the pixel points;
and (3) carrying out contour tracing by using a chain code algorithm on the basis of refinement, and changing the sequence of the point sets row by row and column by column into a sequential point set from the starting point along the shape trend of the contour.
Further, the specific process of the chain code algorithm is as follows:
b1. traversing and accessing all pixel points from (0,0), and setting a starting point as a first current point P when the pixel value is changed into 1;
b2. searching a pixel point with the next pixel value of 1 on the contour in the direction of the 8-neighborhood of the P, rotating clockwise by 45 degrees according to the current searching direction if the pixel point is not found, and repeating the step to continue searching;
b3. setting the pixel value of the current P point to be 0 according to the fact that the pixel point in the neighborhood of the current P point in the direction is 1, namely the contour point, taking the searched boundary point as a next starting point Q, recording the coordinate of the current Q point and the current direction numerical value, and rotating the direction numerical value by 90 degrees anticlockwise;
b4. repeating the operations of the steps b2 and b3 in the 8-neighborhood of the Q point, finding the next boundary point and recording; similarly, the pixel coordinates of each boundary point on the communication channel can be obtained in sequence and recorded; until the end point is tracked, finishing the tracking of the outer contour of the large-format leather; if the Q point has 8 neighborhood points and 4 neighborhood points, the 4 neighborhood points are skipped.
Further, the specific process of step S6 is as follows:
firstly, using curvature as a threshold value, reserving segmentation points with large curvature change, and reducing the number of point sets; the curvature in the plane geometry refers to the rotation rate of the tangent direction angle to the arc length at a certain point on a curve, and the curvature calculation formula is expressed by differentiation:
Figure BDA0003085883630000041
the inclination angle variation of the tangent slope; Δ s is the arc length of the curve segment; let the current point be PiExpressed as the ith point, a vector P is calculated in units of k pixel distancesiPi-kSum vector PiPi+kThe cosine values that make up the angle;
let the coordinate of the current point be (x)i,yi) Vector PiPi-k=(xi-xi-k,yi-yi-k) Vector PiPi+k=(xi-xi+k,yi-yi+k) Let cos θiIs a vector PiPi-kSum vector PiPi+kAngle therebetween, cos θiThe characteristic quantity is obtained, all the pixel points on the traversal contour respectively calculate and record the characteristic quantity of each pixel point, and a proper threshold value is set to select the segmentation point;
cos θ was calculated using the following formulai
Figure BDA0003085883630000042
Optimizing the preliminarily extracted segmentation points; calculating the distance d between each segmentation point and the included angle theta' formed by each segmentation point and the front segmentation point and the rear segmentation point, traversing the segmentation point set, and enabling the distance d to be larger than a threshold value d0Or the included angle theta' is smaller than the threshold value theta0The point of' is proposed as the final segmentation point.
Further, the optimizing further comprises:
aiming at the problem that the segment fitting curves are not connected end to end, segment connection is carried out through a ruler and gauge mapping algorithm, and the method specifically comprises the following steps:
suppose P1、P2、P3For the segmentation points, the black line segment is a least-squares fitted circular arc, o1、R1Is the center and radius of the first arc, o2、R2The center and the radius of the second section of arc; with R1As radii, respectively, by P1、P2Making a circle as the center of the circle, intersecting the two circles to obtain two intersection points, and selecting the distance o1The point at which the distance is short is taken as o1', then o1' as a center, R1To make a circle with a radius, the resulting circle would pass through P1、P2Point, get the circle o in the same way2' Via P2、P3Point, P2The junction point is obtained.
Further, the specific process of performing the straight-line arc fitting on the segmentation point set in step S7 is as follows:
c1. dividing the original contour point set into a plurality of segment point sets by segment points, namely, first-stage segmentation, connecting head and tail points of the point sets into straight lines in each segment point set, and respectively traversing and calculating the distance error err from each point in the segment point set to the fitted straight line1=d1And distance error err to the center of the fitted arc2=d2R, R is the radius of the circular arc, and the maximum error of the fitting is set as err;
c2. if err1<err2And err1<err, fitting the segmented point set by using a straight line;
if err2<err1And err2<err, fitting the segmented point set by using a least square circular arc;
if err1>err, and err2>err, performing secondary segmentation on the segmentation point set by using a dichotomy;
c3. taking the middle point of the point set as a new segmentation point, respectively carrying out least square fitting and line segment head-to-tail connection on the newly segmented two point sets, and respectively judging whether the condition of c2 is met; if not, performing three-stage segmentation on the unsatisfied point set, performing least square fitting and line segment head-to-tail connection on the newly segmented two-segment point set, and judging whether the two-segment point set is satisfied or notC2, and so on until all points satisfy the condition (err)1<err2And err1<err) or (err)2<err1And err2<err)。
Further, the corner transition algorithm is specifically as follows:
d1. marking points fitting the straight line circular arc with 0 and 1; 0 represents an arc, 1 represents a straight line, and if the point i is marked as 01, the point i represents that the front wiring segment is an arc and the rear wiring segment is a straight line in a clockwise traversal manner; traversing from the 1 st point and marking all points;
d2. traversal from point 1, such as to (? Representing 0 or 1, the corner type is a straight line and a straight line;
suppose a circular arc p1p2For inserted circular arc segments, p1Tangent to the circle o by a line ab, p2Is the tangent point of the straight line bc and the circle o, o is the center of the inserted arc, r is the radius of the inserted arc, d0The distance from the starting point of the insertion arc to the angle point, d1Is the length of the straight line segment ab, d2The length of a straight line segment bc, theta is an angle forming an included angle, and xi is the maximum error allowed between an inserted arc and a straight line corner; based on the parameters xi and theta, the r of the inserted arc is calculated by adopting the following formula:
Figure BDA0003085883630000061
combined upper type, distance d from starting point of inserted arc to angle point0To ensure that the start and end points of the inserted arc do not cross the limits of the constituent corner segments, (r + δ) · cos (θ/2), d is compared0And d1、d2If d is a value of0>d1Or d0>d2Then get d0=min[d1、d2](ii) a In combination with the sizes and the maximum corners of different cutters, an appropriate minimum limit value should be set for the radius r of the inserted arc, so that the cutters can stably pass through the corners;
calculate the starting point p using the formula1(x, y), end point p2Coordinates of (x, y):
Figure BDA0003085883630000062
Figure BDA0003085883630000063
Figure BDA0003085883630000064
Figure BDA0003085883630000065
based on the determined starting point p1(x, y), end point p2Coordinates of (x, y) and calculating a straight line op1And a straight line op2Equation (2)
Figure BDA0003085883630000066
Then obtaining the coordinates of the circle center o (x, y) of the arc;
d3. traversing from the 1 st point, such as traversing to three points which are continuous (;
assuming ab as a circular arc segment, bc as a straight line segment, bd as a tangential direction vector of the circular arc segment, o as a circle center of the circular arc segment, and theta as an included angle between the straight line segment and a tangent of the circular arc segment;
the two corners are inserted into the arc line segments, the two arc line segments have two conditions of internal tangent and external tangent, and the two quantities jointly judge whether the inserted arc is internal tangent or external tangent by calculating the space vector forming the corner arc ab and the included angle theta formed by the tangent of the arc ab and the straight line segment bc;
firstly, calculating a space vector of an arc segment, and preliminarily judging whether the space vector of the arc segment points inwards or outwards by a Cartesian coordinate system right-hand rule, wherein the vector can be calculated by a feature point set according to the anticlockwise traversal of a contour track; recording a vector bo as a vector A, a vector oa as a vector B and a space vector as a vector C;
the vector product of vector A, B is calculated using the following equation:
A×B=(A.y·B.z-B.y·A.z,B.x·A.z-A.x·B.z,A.x·B.y-B.x·A.y)
then C is A.x, B.y-B.x, A.y, or C is<0 then the space vector C points outward, C>0 then space vector C points inward; based on the coordinates of vector bc and vector bd, the azimuth angle θ of vector bc and vector bd is calculated using the following equationbc、θbd
Figure BDA0003085883630000071
θbdAnd thetabcThe calculation formulas are consistent;
the included angle theta is equal to thetabdbc
Due to the maximum turning angle theta of the toolmaxEach type of tool having a respective thetamaxIn order to maximize the processing efficiency, when the included angle theta between the straight line segment and the tangent line of the circular arc segment does not reach thetamaxWhen the arc segment is not inserted, the arc segment is not inserted;
maximum steering angle theta of tool based on parametermaxSpace vector C, draw conclusions about selecting either an endo or an exo:
Figure BDA0003085883630000081
after determining the inserted arc type internal tangent or external tangent, calculating the coordinates of the circle center, the starting point and the end point of the tangent arc section inserted in the straight line and the arc, the arc and the straight line;
if the tangent is determined, let ab be a circular arc segment, bc be a straight-line segment, bd be a tangential vector of the circular arc segment, o1To be inserted into the center of the arc, r1To insert into the radius of the arc, o2Is the center of a circular arc line segment r2Is a radius of a circular arc line segment, p1Is a straight line ab and a circle o2Tangent point of (p)2Is a straight line bc and a circle o1Is L is o1A straight line that is point and parallel to the straight line bc;
firstly, a straight line bc parallel to the straight line and a distance r are made1Is a distance r from the straight line bc1Two straight lines can appear, which straight line is judged and selected to be the required straight line L, and then the distance o from the center of the circular arc is calculated on the straight line L2A distance r1+r2Due to separation from o2A distance r1+r2Will find two, based on the equation y-k of the parameter line L2*x+b2Radius of insertion arc r1Form the arc radius r of the corner2Calculating the center o of the inserted arc by using the following formula1(x, y) coordinates:
Figure BDA0003085883630000082
o1.y=k2·o1.x+b2
circle center o inserted into arc based on parameters1Coordinate, radius of insertion arc r1Radius r of arc line segment2Equation y ═ k for straight line bc1*x+b1Straight line o1p1K is3*x+b3Calculating the starting point p of the tangent arc segment inserted into the arc and the straight line by using the following formula1End point p2The coordinates of (a):
Figure BDA0003085883630000083
Figure BDA0003085883630000091
Figure BDA0003085883630000092
p2.y=p2.x·k1+b1
d4. finding out corner points of arcs connected with arcs, adding num and num1 attributes to each point, assigning an initial value of 0, setting static variable int n to be 1 to represent the nth arc to be synthesized, setting variable j to be 1 to represent the number of points of the first three points which are necessary for fitting each circle and additionally meet the condition of fitting the circle, and when circular traversal is performed for arc fitting, when the ith point is traversed to meet the condition of arc fitting, n + +;
judging that if num of the ith point is equal to 0, the num of the ith point is equal to n;
judging that if num of the ith point is not equal to 0, num1 of the ith point is equal to n;
judging that if num of the (i + j + 1) th point is equal to 0, the num of the (i + j + 1) th point is equal to n;
if the judgment condition is that num of the (i + j + 1) th point is not equal to 0, num1 of the (i + j + 1) th point is equal to n;
when the arc corner point is connected with the arc, if the num of the ith point is smaller than num1 of the ith point under the judgment condition, the ith point is the arc corner point connected with the arc.
Compared with the prior art, the principle and the advantages of the scheme are as follows:
the scheme uses the camera lens to collect leather images and extract the outline, and linear arc fitting and track optimization are carried out on the extracted processing outline to obtain a processing track curve capable of being processed quickly.
The scheme solves the problems that the technology for extracting the actual contour size of the irregular large-breadth leather raw material in the existing leather film covering and cutting technology is immature, the sawtooth-shaped contour is difficult to process, and the problems of frequently carrying out 'lifting, turning and cutting' and the like are solved, and the processing efficiency of leather film covering and cutting is obviously improved.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the services required for the embodiments or the technical solutions in the prior art will be briefly described below, it is obvious that the drawings in the following description are only some embodiments of the present invention, and for those skilled in the art, other drawings can be obtained according to these drawings without creative efforts.
FIG. 1 is a schematic flow chart of a method for detecting and optimizing a large-width leather contour according to the present invention;
FIG. 2 is a schematic view of a nine-point calibration plate;
FIG. 3 is a schematic view of leather on a black and white background board, respectively;
FIG. 4 is a schematic diagram of an extracted leather binarization image;
FIG. 5 is a one-level segmentation point diagram;
FIG. 6 is a schematic diagram of a least squares circular arc fit;
FIG. 7 is a schematic of a ruler plotting algorithm;
FIG. 8 is a schematic comparison of a fitted curve and an original contour through a first-stage segmentation;
FIG. 9 is a schematic comparison of a fitted curve subjected to two-stage segmentation with an original profile of FIG. 1;
FIG. 10 is a schematic comparison of a fitted curve subjected to two-stage segmentation with an original profile FIG. 2;
FIG. 11 is a schematic view of the radius of the inset arc;
FIG. 12 is a schematic view of an included angle between a straight line and a circular arc;
FIG. 13 is a schematic view of the center of a calculated insertion arc;
FIG. 14 is a schematic view of four inserted arcs with arcs joining the arcs;
FIG. 15 is a schematic view of an included angle between a circular arc and a circular arc;
FIG. 16 is a schematic illustration of an area error analysis;
FIG. 17 is a schematic view of a processing trajectory after fitting of a straight circular arc;
FIG. 18 is a schematic view of a processing trajectory after trajectory optimization;
fig. 19 is a schematic diagram showing the relationship between the XY plane movement speed and time before and after the trajectory optimization.
Detailed Description
The invention will be further illustrated with reference to specific examples:
as shown in fig. 1, a method for detecting a large-format leather profile and optimizing a track according to an embodiment of the present invention includes the following steps:
s1, performing light source lighting and camera calibration;
the image collected by the camera is only pixels and needs to be converted with actual coordinates, so that the conversion from a camera coordinate system to a machining coordinate system needs to be performed, and the nine-point calibration method is adopted in the embodiment, and coordinates of nine points are respectively collected under the pixel coordinate system and the machining coordinate system by using the nine-point calibration plate shown in fig. 2;
Figure BDA0003085883630000111
calculating an affine transformation matrix M between coordinates using the following formula3×3
Figure BDA0003085883630000112
S2, acquiring a large-format leather image through a camera;
s3, in order to enhance the contrast between different leathers and background plates, as shown in FIG. 3, preparing a black-white background plate, firstly carrying out graying processing on the collected image to obtain a grayscale image, and then carrying out binarization processing on the grayscale image by taking a proper threshold value to obtain an image f (x, y) shown in FIG. 4;
s4, performing threshold segmentation on the image f (x, y) and extracting the image f of the area where the leather is located1(x, y); and carrying out corrosion operation on the extracted leather binary image to obtain an original contour image f1(x, y) and the eroded image f2(x, y) performing image subtraction to extract a leather profile f with a width of three pixels3(x,y),f3(x,y)=f1(x,y)-f2(x, y), where the number of pixel point sets is 3985;
s5, for preliminary filtering out leather contour f3Redundant pixel points in (x, y) and under the premise of ensuring that the contour pixel points are at least 8 communicated with each other, the leather is treatedContour f3(x, y) carrying out thinning treatment, wherein the specific process is as follows:
first, the definition is as follows:
(1) the end points belong to the boundary points, and at least one of the 8 neighborhoods is a target point;
(2) note the current center point as P;
(3) target point is marked 1 and background point is marked 0;
(4) n (P) is the number of nonzero pixels in the 8 fields of the current point P;
(5) s (P) is the number of times that the pixels change from 0 to 1 in clockwise order in an 8-domain centered on P;
the refining algorithm comprises the following steps:
a1. finding 8 fields with the boundary point as a central point, marking the central point as P, and firstly marking the boundary point meeting the following conditions:
1) n (P1) is more than or equal to 2 and less than or equal to 6, and N (P1) represents the number of foreground pixels in 8 pixels adjacent to P1;
2) s (P1) ═ 1, S (P1) indicates the number of pairs between P2-P9-P2 in the order of 0 and 1, respectively;
3).P2*P4*P6=0;
4).P4*P6*P8=0;
when all the boundary points are checked, removing all the marked points, namely changing the pixel values of the marked points from 1 to 0;
P2-P9 are eight adjacent points that surround P1 and are distributed clockwise;
a2. repeating step a1, but changing condition 3) to P2 by P4 by P8 by 0; condition 4) was changed to P2 × P6 × P8 ═ 0;
finishing the thinning operation after traversing all the pixel points, wherein the number of the point sets is changed from 3985 to 1352;
the contour tracing is carried out by using a chain code algorithm on the basis of the refinement, the sequence of the point sets row by row and column by column is changed into a sequence point set from the starting point along the shape trend of the contour, and the contour point optimization is facilitated;
the chain code algorithm specifically comprises the following steps:
b1. traversing and accessing all pixel points from (0,0), and setting a starting point as a first current point P when the pixel value is changed into 1;
b2. searching a pixel point with the next pixel value of 1 on the contour in the direction of the 8-neighborhood of the P, rotating clockwise by 45 degrees according to the current searching direction if the pixel point is not found, and repeating the step to continue searching;
b3. setting the pixel value of the current P point to be 0 according to the fact that the pixel point in the neighborhood of the current P point in the direction is 1, namely the contour point, taking the searched boundary point as a next starting point Q, recording the coordinate of the current Q point and the current direction numerical value, and rotating the direction numerical value by 90 degrees anticlockwise;
b4. repeating the operations of the steps b2 and b3 in the 8-neighborhood of the Q point, finding the next boundary point and recording; similarly, the pixel coordinates of each boundary point on the communication channel can be obtained in sequence and recorded; until the end point is tracked, finishing the tracking of the outer contour of the large-format leather; if the Q point has 8 neighborhood points and 4 neighborhood points at the same time, the 4 neighborhood points are skipped, so that the number of the time set is changed from 1352 to 1151;
s6, carrying out segmentation point selection and optimization on the point set:
firstly, using curvature as a threshold value, reserving segmentation points with large curvature change, and reducing the number of point sets; the curvature in the plane geometry refers to the rotation rate of the tangent direction angle to the arc length at a certain point on a curve, and the curvature calculation formula is expressed by differentiation:
Figure BDA0003085883630000131
the inclination angle variation of the tangent slope; Δ s is the arc length of the curve segment; let the current point be PiExpressed as the ith point, a vector P is calculated in units of k pixel distancesiPi-kSum vector PiPi+kThe cosine values that make up the angle;
let the coordinate of the current point be (x)i,yi) Vector PiPi-k=(xi-xi-k,yi-yi-k) Vector PiPi+k=(xi-xi+k,yi-yi+k) Let cos θiIs a vectorPiPi-kSum vector PiPi+kAngle therebetween, cos θiNamely the characteristic quantity, respectively calculating the characteristic quantity of each pixel point by traversing all the pixel points on the contour, recording the characteristic quantity, setting a proper threshold value to select segmentation points, and changing the number of point sets from 1151 to 117 after the segmentation points are extracted;
cos θ was calculated using the following formulai
Figure BDA0003085883630000132
The extracted points retain the characteristics of the contour shape, but a series of points are extracted at a place where the curvature changes severely, and in order to improve the processing speed, the number of line segments constituting the processing track must be reduced, but after the continuous points are fitted as segmentation points, the number of line segments constituting the track is greatly increased. Therefore, the segmentation points extracted preliminarily are optimized; calculating the distance d between each segmentation point and the included angle theta' formed by each segmentation point and the front segmentation point and the rear segmentation point, traversing the segmentation point set, and enabling the distance d to be larger than a threshold value d0Or the included angle theta' is smaller than the threshold value theta0The point of' is proposed as the final segmentation point. As shown in fig. 5, the larger black dots are a total of 40 segment dots.
The segmentation points divide the original contour point set into small point sets, and the least square method fitting circular arc is performed on each point set to obtain a fitting curve as shown in the following fig. 6. Aiming at the problem that the segment fitting curves are not connected end to end, the segment fitting is carried out through a ruler-ruler plotting algorithm.
As shown in FIG. 7, P1、P2、P3For the segmentation points, the black line segment is a least-squares fitted circular arc, o1、R1Is the center and radius of the first arc, o2、R2The center and radius of the second section of arc are R1As radii, respectively, by P1、P2Making a circle as the center of the circle, two circlesIntersecting to obtain two intersection points, and selecting the distance o1The point at which the distance is short is taken as o1', then o1' as a circle center R1To make a circle with a radius, the resulting circle would pass through P1、P2Point, get the circle o in the same way2' Via P2、P3Point, P2The junction point is obtained.
S7, performing straight line circular arc fitting on the segmentation point set:
c1. dividing the original contour point set into a plurality of segment point sets by segment points, namely, first-stage segmentation, connecting head and tail points of the point sets into straight lines in each segment point set, and respectively traversing and calculating the distance error err from each point in the segment point set to the fitted straight line1=d1And distance error err to the center of the fitted arc2=d2R, R is the radius of the circular arc, and the maximum error of the fitting is set as err;
c2. if err1<err2And err1<err, fitting the segmented point set by using a straight line;
if err2<err1And err2<err, fitting the segmented point set by using a least square circular arc;
if err1>err, and err2>err, performing secondary segmentation on the segmentation point set by using a dichotomy;
c3. taking the middle point of the point set as a new segmentation point, respectively carrying out least square fitting and line segment head-to-tail connection on the newly segmented two point sets, and respectively judging whether the condition of c2 is met; if not, performing three-stage segmentation on the unsatisfied point set, performing least square fitting and line segment head-to-tail connection on the newly segmented two-stage point set, judging whether the c2 condition is met, and so on until all the points meet the condition (err)1<err2And err1<err) or (err)2<err1And err2<err)。
The comparison of the fitted curve after the first-order segmentation with the original profile is shown in fig. 8. The comparison of the fitted curve after the second-order segmentation with the original contour is shown in fig. 9 and 10, and the hollow points are the second-order segmentation points. Since all points after the second-level segmentation have met the set accuracy requirement, there are no third-level segmentation points.
The actual size calculated for one pixel is about 2.929 mm. In the case where the primary segmentation point selection threshold is set to 172 °:
fig. 9 shows that the maximum fitting error threshold is 3 pixels, i.e., 8.789mm accuracy, with 40 primary segmentation points, 5 secondary segmentation points, and 0 tertiary segmentation points, totaling 45 line segments.
FIG. 10 shows a maximum fitting error threshold of 2 pixels, i.e., 5.859mm accuracy, with 40 primary segmentation points, 8 secondary segmentation points, and 0 tertiary segmentation points, totaling 48 line segments.
It can be seen that with the improvement of precision, the requirement can be satisfied only by continuously increasing the high-level segmentation points.
S8, performing smooth transition processing on the synthetic track, namely inserting a small segment of circular arc with proper length between two line segments to replace the original corner when the included angle formed by the straight line and the straight line, the straight line and the circular arc, the circular arc and the tangent line of the two end points of the circular arc and the corner is small and the maximum steering angle of the cutter is large; the types of line segments forming the track corner are divided into four types, corresponding transition curves are constructed according to different corner types through a corner transition algorithm, and the functions of intelligently identifying the corner types and inserting corresponding arcs in numerical control cutting are achieved.
The corner transition algorithm is specifically as follows:
d1. marking points fitting the straight line circular arc with 0 and 1; 0 represents an arc, 1 represents a straight line, and if the point i is marked as 01, the point i represents that the front wiring segment is an arc and the rear wiring segment is a straight line in a clockwise traversal manner; traversing from the 1 st point and marking all points;
d2. traversal from point 1, such as to (? Representing 0 or 1, the corner type is a straight line and a straight line;
as shown in FIG. 11, assume a circular arc p1p2For inserted circular arc segments, p1Tangent to line ab and circle oPoint, p2Is the tangent point of the straight line bc and the circle o, o is the center of the inserted arc, r is the radius of the inserted arc, d0The distance from the starting point of the insertion arc to the angle point, d1Is the length of the straight line segment ab, d2The length of a straight line segment bc, theta is an angle forming an included angle, and xi is the maximum error allowed between an inserted arc and a straight line corner; based on the parameters xi and theta, the r of the inserted arc is calculated by adopting the following formula:
Figure BDA0003085883630000161
combined upper type, distance d from starting point of inserted arc to angle point0To ensure that the start and end points of the inserted arc do not cross the limits of the constituent corner segments, (r + δ) · cos (θ/2), d is compared0And d1、d2If d is a value of0>d1Or d0>d2Then get d0=min[d1、d2](ii) a In combination with the sizes and the maximum corners of different cutters, an appropriate minimum limit value should be set for the radius r of the inserted arc, so that the cutters can stably pass through the corners;
calculate the starting point p using the formula1(x, y), end point p2Coordinates of (x, y):
Figure BDA0003085883630000162
Figure BDA0003085883630000163
Figure BDA0003085883630000164
Figure BDA0003085883630000165
based on the determined starting point p1(x, y), end point p2Coordinates of (x, y) and calculating a straight line op1And a straight line op2Equation (2)
Figure BDA0003085883630000166
Then obtaining the coordinates of the circle center o (x, y) of the arc;
d3. traversing from the 1 st point, such as traversing to three points which are continuous (;
as shown in fig. 12, it is assumed that ab is a circular arc segment, bc is a straight line segment, bd is a tangential direction vector of the circular arc segment, o is a circle center of the circular arc segment, and θ is an included angle between the straight line segment and a tangent of the circular arc segment;
the two corners are inserted into the arc line segments, the two arc line segments have two conditions of internal tangent and external tangent, and the two quantities jointly judge whether the inserted arc is internal tangent or external tangent by calculating the space vector forming the corner arc ab and the included angle theta formed by the tangent of the arc ab and the straight line segment bc;
firstly, calculating a space vector of an arc segment, and preliminarily judging whether the space vector of the arc segment points inwards or outwards by a Cartesian coordinate system right-hand rule, wherein the vector can be calculated by a feature point set according to the anticlockwise traversal of a contour track; recording a vector bo as a vector A, a vector oa as a vector B and a space vector as a vector C;
the vector product of vector A, B is calculated using the following equation:
A×B=(A.y·B.z-B.y·A.z,B.x·A.z-A.x·B.z,A.x·B.y-B.x·A.y)
then C is A.x, B.y-B.x, A.y, or C is<0 then the space vector C points outward, C>0 then space vector C points inward; based on the coordinates of vector bc and vector bd, the azimuth angle θ of vector bc and vector bd is calculated using the following equationbc、θbd
Figure BDA0003085883630000171
θbdAnd thetabcThe calculation formulas are consistent;
the included angle theta is equal to thetabdbc
Due to the maximum turning angle theta of the toolmaxEach type of tool having a respective thetamaxIn order to maximize the processing efficiency, when the included angle theta between the straight line segment and the tangent line of the circular arc segment does not reach thetamaxWhen the arc segment is not inserted, the arc segment is not inserted;
maximum steering angle theta of tool based on parametermaxSpace vector C, draw conclusions about selecting either an endo or an exo:
Figure BDA0003085883630000172
after determining the inserted arc type internal tangent or external tangent, calculating the coordinates of the circle center, the starting point and the end point of the tangent arc section inserted in the straight line and the arc, the arc and the straight line;
as shown in FIG. 13, if the tangent is defined here, ab is a circular arc segment, bc is a straight line segment, bd is a tangential vector of the circular arc segment, o1To be inserted into the center of the arc, r1To insert into the radius of the arc, o2Is the center of a circular arc line segment r2Is a radius of a circular arc line segment, p1Is a straight line ab and a circle o2Tangent point of (p)2Is a straight line bc and a circle o1Is L is o1A straight line that is point and parallel to the straight line bc;
firstly, a straight line bc parallel to the straight line and a distance r are made1Is a distance r from the straight line bc1Two straight lines can appear, which straight line is judged and selected to be the required straight line L, and then the distance o from the center of the circular arc is calculated on the straight line L2A distance r1+r2Due to separation from o2A distance r1+r2Will find two, based on the equation y-k of the parameter line L2*x+b2Radius of insertion arc r1Form the arc radius r of the corner2Calculating the center o of the inserted arc by using the following formula1(x, y) coordinates:
Figure BDA0003085883630000181
o1.y=k2·o1.x+b2
circle center o inserted into arc based on parameters1Coordinate, radius of insertion arc r1Radius r of arc line segment2Equation y ═ k for straight line bc1*x+b1Straight line o1p1K is3*x+b3Calculating the starting point p of the tangent arc segment inserted into the arc and the straight line by using the following formula1End point p2The coordinates of (a):
Figure BDA0003085883630000182
Figure BDA0003085883630000183
Figure BDA0003085883630000191
p2.y=p2.x·k1+b1
d4. finding out corner points of arcs connected with arcs, adding num and num1 attributes to each point, assigning an initial value of 0, setting static variable int n to be 1 to represent the nth arc to be synthesized, setting variable j to be 1 to represent the number of points of the first three points which are necessary for fitting each circle and additionally meet the condition of fitting the circle, and when circular traversal is performed for arc fitting, when the ith point is traversed to meet the condition of arc fitting, n + +;
judging that if num of the ith point is equal to 0, the num of the ith point is equal to n;
judging that if num of the ith point is not equal to 0, num1 of the ith point is equal to n;
judging that if num of the (i + j + 1) th point is equal to 0, the num of the (i + j + 1) th point is equal to n;
if the judgment condition is that num of the (i + j + 1) th point is not equal to 0, num1 of the (i + j + 1) th point is equal to n;
when the arc corner point is connected with the arc, if the num of the ith point is smaller than num1 of the ith point under the judgment condition, the ith point is the arc corner point connected with the arc.
Taking the example shown in fig. 14 as an example, it can be seen that there are four cases 1, 2, 3 and 4 in the way that the arc-connecting arc is inserted into the tangent arc segment. Taking the example shown in FIG. 12, the straight line connecting the arc is recorded
Figure BDA0003085883630000192
Is a vector A,
Figure BDA0003085883630000193
As vector B, the preceding arc is denoted as o1,o1Has a space vector of C1The inscribed arc is o2,o2Has a space vector of C2Space vector C1、C2Is connected with the arc in a straight line.
If C1*C2>0, the insertion of the tangent arc segments is 1 and 4;
if C1*C2<0, the insertion of the tangent arc segments is 2 and 3;
in the case where the inserted arc is judged to be 1 or 4, taking the example shown in fig. 15,
Figure BDA0003085883630000194
the tangent vector of the bc arc segment,
Figure BDA0003085883630000195
Tangent vector of ab arc segment, θ: extending to an included angle formed by the point d and the point e in the tangential direction by the included angle point b, ab: front connected with arc o1: circle center of the front connecting arc, bc: rear connecting arc o2: and then connects with the center of the circular arc. Then theta equals thetabebd
When theta is less than 0, representing that the tangent bd is inserted into the arc line segment at the position of the tangent be clockwise theta to be the case 1;
when theta is greater than 0, representing that the tangent be is inserted into the arc line segment at the position of the tangent bd anticlockwise theta, and taking the situation as 4;
on the basis of judging that the cases of inserting the circular arc are 1 and 4,
when C is present1<When 0, the space vector is directed inwards, and the circular arc line segment is inserted to be the case 2;
when C is present1>When 0, the space vector points outwards, and the circular arc segment is inserted as a case 3;
radius r of the insertion arc at this time3The same straight line is connected with the straight line.
Making a straight line segment o1o2And o2o3Respectively having a length of d1、d2For the four cases 1, 2, 3 and 4
d1=r1-r3、d2=r2-r 3 1
d1=r1-r3、d2=r2+r 3 2
d1=r1+r3、d2=r2-r 3 3
d1=r1+r3、d2=r2+r 3 4
Based on the parameter d1、d2、o1、o2Calculating the center o of the inserted arc by using the following formula3The coordinates x and y of (a):
Figure BDA0003085883630000201
writing the above formula to o for convenient calculation3.y=k*o3.x+b;
In combination with the above formula, the following formula is used to calculate the center o of the inserted arc3Coordinates of (2)
Figure BDA0003085883630000202
o3.y=k·o3.x+b
And calculating the starting point and the end point of the inserted arc, and connecting the starting point and the end point with the straight line to form the arc.
And S9, multiplying the track optimized in smooth transition by an affine transformation matrix to obtain the track information of actual processing, and finally generating a new processing track.
Fig. 17 is a processing track selected and fitted by feature points, fig. 18 is a processing track which is smoothly processed, and an original track is difficult to process, and then processing tests are performed on fig. 17 and fig. 18, in the test, pixels of a shot leather image are 512 by 512, and the length, width and actual size ratio of each pixel point is 1 according to the equipment size and the camera placement height: 2.929mm, 106812 pixels in leather area, 916344.524mm area2The interval k is set to 5, the curvature theta is 172 DEG, and the maximum error err is obtainedmaxSet to 5.859mm, the smooth transition error ζ is set to 5mm, and the leather size is about 1500mm × 1500 mm. The interpolation period of machine tool parameter setting is 0.1ms, the limit speed of the XY motion platform is 800ms/s, the limit acceleration is 3200ms/s, the cutter lifting limit speed is 300ms/s, and the limit acceleration is 1200 ms/s.
The original track is difficult to process, the processing time of the track after the characteristic point selection and the fitting is 19.09s, the processing time after the smooth transition optimization is 15.2s, 3.89s is shortened, the optimization efficiency is 20.3% compared with the track without smooth processing, and meanwhile, the area loss rate of the leather area of the processed track after the final processing is verified to be 0.48% compared with the area loss rate of the original leather outline, so that the processing time is shown in fig. 16. The machining trajectory speed is reduced in the interval of 0 in the xy direction, which is shown in fig. 19, and represents that the actions of raising the tool, turning and dropping the tool are reduced, and the machining speed in the corner transition region is kept at a higher level, and the speed change amplitude is smaller, which are main reasons for improving the machining efficiency.
By applying the scheme, the actual contour information of the leather can be conveniently, quickly and accurately extracted, the automatic production efficiency is improved, meanwhile, the characteristic point extraction, fitting and optimization are carried out on the contour, the problems that the technology for extracting the actual contour size of irregular leather raw materials in the existing leather film covering and cutting technology is not mature, the sawtooth-shaped contour is difficult to process, the cutter lifting, turning and cutting are frequently carried out and the like are solved, and the processing efficiency of leather film covering and cutting is obviously improved.
The above-mentioned embodiments are merely preferred embodiments of the present invention, and the scope of the present invention is not limited thereto, so that variations based on the shape and principle of the present invention should be covered within the scope of the present invention.

Claims (8)

1. A large-breadth leather contour detection and track optimization method is characterized by comprising the following steps:
s1, performing light source lighting and camera calibration;
s2, acquiring a large-format leather image through a camera;
s3, carrying out graying and binarization processing on the collected large-breadth leather image to obtain an image f (x, y);
s4, performing threshold segmentation on the image f (x, y) and extracting the image f of the area where the leather is located1(x, y); and carrying out corrosion operation on the extracted leather binary image to obtain an original contour image f1(x, y) and the eroded image f2(x, y) performing image subtraction to extract a leather profile f with a width of three pixels3(x,y);
S5, thinning and tracing the outline of the large-format leather to obtain a sequential pixel point set;
s6, selecting and optimizing the segmentation points of the point set;
s7, performing straight line circular arc fitting on the segmentation point set;
s8, performing smooth transition processing on the fit-to-synthesis track;
and S9, obtaining a processed file.
2. The method as claimed in claim 1, wherein the specific process of step S5 is as follows:
first, the definition is as follows:
(1) the end points belong to the boundary points, and at least one of the 8 neighborhoods is a target point;
(2) note the current center point as P;
(3) target point is marked 1 and background point is marked 0;
(4) n (P) is the number of nonzero pixels in the 8 fields of the current point P;
(5) s (P) is the number of times that the pixels change from 0 to 1 in clockwise order in an 8-domain centered on P;
the refining algorithm comprises the following steps:
a1. finding 8 fields with the boundary point as a central point, marking the central point as P, and firstly marking the boundary point meeting the following conditions:
1) n (P1) is more than or equal to 2 and less than or equal to 6, and N (P1) represents the number of foreground pixels in 8 pixels adjacent to P1;
2) s (P1) ═ 1, S (P1) indicates the number of pairs between P2-P9-P2 in the order of 0 and 1, respectively;
3).P2*P4*P6=0;
4).P4*P6*P8=0;
when all the boundary points are checked, removing all the marked points, namely changing the pixel values of the marked points from 1 to 0;
P2-P9 are eight adjacent points that surround P1 and are distributed clockwise;
a2. repeating step a1, but changing condition 3) to P2 by P4 by P8 by 0; condition 4) was changed to P2 × P6 × P8 ═ 0;
finishing the thinning operation after traversing all the pixel points;
and (3) carrying out contour tracing by using a chain code algorithm on the basis of refinement, and changing the sequence of the point sets row by row and column by column into a sequential point set from the starting point along the shape trend of the contour.
3. The method as claimed in claim 2, wherein the chain code algorithm comprises the following steps:
b1. traversing and accessing all pixel points from (0,0), and setting a starting point as a first current point P when the pixel value is changed into 1;
b2. searching a pixel point with the next pixel value of 1 on the contour in the direction of the 8-neighborhood of the P, rotating clockwise by 45 degrees according to the current searching direction if the pixel point is not found, and repeating the step to continue searching;
b3. setting the pixel value of the current P point to be 0 according to the fact that the pixel point in the neighborhood of the current P point in the direction is 1, namely the contour point, taking the searched boundary point as a next starting point Q, recording the coordinate of the current Q point and the current direction numerical value, and rotating the direction numerical value by 90 degrees anticlockwise;
b4. repeating the operations of the steps b2 and b3 in the 8-neighborhood of the Q point, finding the next boundary point and recording; similarly, the pixel coordinates of each boundary point on the communication channel can be obtained in sequence and recorded; until the end point is tracked, finishing the tracking of the outer contour of the large-format leather; if the Q point has 8 neighborhood points and 4 neighborhood points, the 4 neighborhood points are skipped.
4. The method as claimed in claim 1, wherein the specific process of step S6 is as follows:
firstly, using curvature as a threshold value, reserving segmentation points with large curvature change, and reducing the number of point sets; the curvature in the plane geometry refers to the rotation rate of the tangent direction angle to the arc length at a certain point on a curve, and the curvature calculation formula is expressed by differentiation:
Figure FDA0003085883620000031
Figure FDA0003085883620000032
the inclination angle variation of the tangent slope; Δ s is the arc length of the curve segment; let the current point be PiExpressed as the ith point, a vector P is calculated in units of k pixel distancesiPi-kSum vector PiPi+kThe cosine values that make up the angle;
let the coordinate of the current point be (x)i,yi) Vector PiPi-k=(xi-xi-k,yi-yi-k), vector PiPi+k=(xi-xi+k,yi-yi+k) Let cos θiIs a vector PiPi-kSum vector PiPi+kAngle therebetween, cos θiThe characteristic quantity is obtained, all the pixel points on the traversal contour respectively calculate and record the characteristic quantity of each pixel point, and a proper threshold value is set to select the segmentation point;
cos θ was calculated using the following formulai
Figure FDA0003085883620000033
Optimizing the preliminarily extracted segmentation points; calculating the distance d between each segmentation point and the included angle theta' formed by each segmentation point and the front segmentation point and the rear segmentation point, traversing the segmentation point set, and enabling the distance d to be larger than a threshold value d0Or the included angle theta' is smaller than the threshold value theta0The point of' is proposed as the final segmentation point.
5. The method as claimed in claim 4, wherein the optimizing further comprises:
aiming at the problem that the segment fitting curves are not connected end to end, segment connection is carried out through a ruler and gauge mapping algorithm, and the method specifically comprises the following steps:
suppose P1、P2、P3For the segmentation points, the black line segment is a least-squares fitted circular arc, o1、R1Is the center and radius of the first arc, o2、R2The center and the radius of the second section of arc; with R1As radii, respectively, by P1、P2Making a circle as the center of the circle, intersecting the two circles to obtain two intersection points, and selecting the distance o1The point at which the distance is short is taken as o1', then o1' as a center, R1Rounding off the radius, obtainedThe circle will pass through P1、P2Point, get the circle o in the same way2' Via P2、P3Point, P2The junction point is obtained.
6. The method as claimed in claim 1, wherein the step S7 of fitting the segment point set with a straight circular arc includes the following steps:
c1. dividing the original contour point set into a plurality of segment point sets by segment points, namely, first-stage segmentation, connecting head and tail points of the point sets into straight lines in each segment point set, and respectively traversing and calculating the distance error err from each point in the segment point set to the fitted straight line1=d1And distance error err to the center of the fitted arc2=d2R, R is the radius of the circular arc, and the maximum error of the fitting is set as err;
c2. if err1<err2And err1<err, fitting the segmented point set by using a straight line;
if err2<err1And err2<err, fitting the segmented point set by using a least square circular arc;
if err1>err, and err2>err, performing secondary segmentation on the segmentation point set by using a dichotomy;
c3. taking the middle point of the point set as a new segmentation point, respectively carrying out least square fitting and line segment head-to-tail connection on the newly segmented two point sets, and respectively judging whether the condition of c2 is met; if not, performing three-stage segmentation on the unsatisfied point set, performing least square fitting and line segment head-to-tail connection on the newly segmented two-segment point set, judging whether the c2 condition is met, and repeating the steps until all the points meet the err condition1<err2And err1<err or err2<err1And err2<err。
7. The method for detecting and optimizing the profile of large-breadth leather according to claim 1, wherein the step S8 is performed to perform smooth transition processing on the synthetic trajectory, that is, when an included angle formed by a straight line and a straight line, a straight line and an arc, an arc and a straight line, and two end point tangents of the arc and the arc forming the corner is small and the maximum turning angle of the cutter is small, a small segment of arc with a proper length is inserted between the two line segments to replace the original corner; the types of line segments forming the track corner are divided into four types, corresponding transition curves are constructed according to different corner types through a corner transition algorithm, and the functions of intelligently identifying the corner types and inserting corresponding arcs in numerical control cutting are achieved.
8. The method as claimed in claim 7, wherein the corner transition algorithm is as follows:
d1. marking points fitting the straight line circular arc with 0 and 1; 0 represents an arc, 1 represents a straight line, and if the point i is marked as 01, the point i represents that the front wiring segment is an arc and the rear wiring segment is a straight line in a clockwise traversal manner; traversing from the 1 st point and marking all points;
d2. traversal from point 1, such as to (? Representing 0 or 1, the corner type is a straight line and a straight line;
suppose a circular arc p1p2For inserted circular arc segments, p1Tangent to the circle o by a line ab, p2Is the tangent point of the straight line bc and the circle o, o is the center of the inserted arc, r is the radius of the inserted arc, d0The distance from the starting point of the insertion arc to the angle point, d1Is the length of the straight line segment ab, d2The length of a straight line segment bc, theta is an angle forming an included angle, and xi is the maximum error allowed between an inserted arc and a straight line corner; based on the parameters xi and theta, the r of the inserted arc is calculated by adopting the following formula:
Figure FDA0003085883620000051
combined upper type, distance from starting point of inserted arc to angle pointFrom d0To ensure that the start and end points of the inserted arc do not cross the limits of the constituent corner segments, (r + δ) · cos (θ/2), d is compared0And d1、d2If d is a value of0>d1Or d0>d2Then get d0=min[d1、d2](ii) a In combination with the sizes and the maximum corners of different cutters, an appropriate minimum limit value should be set for the radius r of the inserted arc, so that the cutters can stably pass through the corners;
calculate the starting point p using the formula1(x, y), end point p2Coordinates of (x, y):
Figure FDA0003085883620000052
Figure FDA0003085883620000053
Figure FDA0003085883620000054
Figure FDA0003085883620000061
based on the determined starting point p1(x, y), end point p2Coordinates of (x, y) and calculating a straight line op1And a straight line op2Equation (2)
Figure FDA0003085883620000062
Then obtaining the coordinates of the circle center o (x, y) of the arc;
d3. traversing from the 1 st point, such as traversing to three points which are continuous (;
assuming ab as a circular arc segment, bc as a straight line segment, bd as a tangential direction vector of the circular arc segment, o as a circle center of the circular arc segment, and theta as an included angle between the straight line segment and a tangent of the circular arc segment;
the two corners are inserted into the arc line segments, the two arc line segments have two conditions of internal tangent and external tangent, and the two quantities jointly judge whether the inserted arc is internal tangent or external tangent by calculating the space vector forming the corner arc ab and the included angle theta formed by the tangent of the arc ab and the straight line segment bc;
firstly, calculating a space vector of an arc segment, and preliminarily judging whether the space vector of the arc segment points inwards or outwards by a Cartesian coordinate system right-hand rule, wherein the vector can be calculated by a feature point set according to the anticlockwise traversal of a contour track; recording a vector bo as a vector A, a vector oa as a vector B and a space vector as a vector C;
the vector product of vector A, B is calculated using the following equation:
A×B=(A.y·B.z-B.y·A.z,B.x·A.z-A.x·B.z,A.x·B.y-B.x·A.y)
then C is A.x, B.y-B.x, A.y, or C is<0 then the space vector C points outward, C>0 then space vector C points inward; based on the coordinates of vector bc and vector bd, the azimuth angle θ of vector bc and vector bd is calculated using the following equationbc、θbd
Figure FDA0003085883620000071
The included angle theta is equal to thetabdbc
Due to the maximum turning angle theta of the toolmaxEach type of tool having a respective thetamaxIn order to maximize the processing efficiency, when the included angle theta between the straight line segment and the tangent line of the circular arc segment does not reach thetamaxWhen the arc segment is not inserted, the arc segment is not inserted;
maximum steering angle theta of tool based on parametermaxSpace vector C, draw conclusions about selecting either an endo or an exo:
arc connecting straight line
Figure FDA0003085883620000072
After determining the inserted arc type internal tangent or external tangent, calculating the coordinates of the circle center, the starting point and the end point of the tangent arc section inserted in the straight line and the arc, the arc and the straight line;
if the tangent is determined, let ab be a circular arc segment, bc be a straight-line segment, bd be a tangential vector of the circular arc segment, o1To be inserted into the center of the arc, r1To insert into the radius of the arc, o2Is the center of a circular arc line segment r2Is a radius of a circular arc line segment, p1Is a straight line ab and a circle o2Tangent point of (p)2Is a straight line bc and a circle o1Is L is o1A straight line that is point and parallel to the straight line bc;
firstly, a straight line bc parallel to the straight line and a distance r are made1Is a distance r from the straight line bc1Two straight lines can appear, which straight line is judged and selected to be the required straight line L, and then the distance o from the center of the circular arc is calculated on the straight line L2A distance r1+r2Due to separation from o2A distance r1+r2Will find two, based on the equation y-k of the parameter line L2*x+b2Radius of insertion arc r1Form the arc radius r of the corner2Calculating the center o of the inserted arc by using the following formula1(x, y) coordinates:
Figure FDA0003085883620000081
o1.y=k2·o1.x+b2
circle center o inserted into arc based on parameters1Coordinate, radius of insertion arc r1Radius r of arc line segment2Equation y ═ k for straight line bc1*x+b1Straight line o1p1K is3*x+b3Calculating the starting point p of the tangent arc segment inserted into the arc and the straight line by using the following formula1End point p2The coordinates of (a):
Figure FDA0003085883620000082
Figure FDA0003085883620000083
Figure FDA0003085883620000084
p2.y=p2.x·k1+b1
d4. finding out corner points of arcs connected with arcs, adding num and num1 attributes to each point, assigning an initial value of 0, setting static variable int n to be 1 to represent the nth arc to be synthesized, setting variable j to be 1 to represent the number of points of the first three points which are necessary for fitting each circle and additionally meet the condition of fitting the circle, and when circular traversal is performed for arc fitting, when the ith point is traversed to meet the condition of arc fitting, n + +;
judging that if num of the ith point is equal to 0, the num of the ith point is equal to n;
judging that if num of the ith point is not equal to 0, num1 of the ith point is equal to n;
judging that if num of the (i + j + 1) th point is equal to 0, the num of the (i + j + 1) th point is equal to n;
if the judgment condition is that num of the (i + j + 1) th point is not equal to 0, num1 of the (i + j + 1) th point is equal to n;
when the arc corner point is connected with the arc, if the num of the ith point is smaller than num1 of the ith point under the judgment condition, the ith point is the arc corner point connected with the arc.
CN202110580574.0A 2021-05-26 2021-05-26 Large-breadth leather contour detection and track optimization method Active CN113284157B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110580574.0A CN113284157B (en) 2021-05-26 2021-05-26 Large-breadth leather contour detection and track optimization method

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110580574.0A CN113284157B (en) 2021-05-26 2021-05-26 Large-breadth leather contour detection and track optimization method

Publications (2)

Publication Number Publication Date
CN113284157A true CN113284157A (en) 2021-08-20
CN113284157B CN113284157B (en) 2023-06-02

Family

ID=77281804

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110580574.0A Active CN113284157B (en) 2021-05-26 2021-05-26 Large-breadth leather contour detection and track optimization method

Country Status (1)

Country Link
CN (1) CN113284157B (en)

Cited By (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114504170A (en) * 2022-03-07 2022-05-17 知守科技(杭州)有限公司 Method and system for spraying glue on soles of flaky soles and storage medium
CN114535792A (en) * 2022-03-24 2022-05-27 大族激光科技产业集团股份有限公司 Construction method for machining track corner transition arc, machining equipment and storage medium
CN115647575A (en) * 2022-12-28 2023-01-31 歌尔股份有限公司 Laser processing control method, device, equipment and storage medium
CN116540516A (en) * 2023-05-10 2023-08-04 天王电子(深圳)有限公司 Watch automatic assembly method and watch assembly equipment
CN116704209A (en) * 2023-08-08 2023-09-05 山东顺发重工有限公司 Quick flange contour extraction method and system
CN117428582A (en) * 2023-12-22 2024-01-23 泉州装备制造研究所 Machining method and medium for special-shaped workpiece

Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2009269113A (en) * 2008-05-02 2009-11-19 Shima Seiki Mfg Ltd Cutting device, and method of extracting contour of object to be cut by cutting device
CN104625428A (en) * 2014-12-19 2015-05-20 天津市芭而蒂服饰有限公司 Leather laser cutting machine and leather processing method
CN107179057A (en) * 2017-05-12 2017-09-19 浙江工业大学 Leather dimensional measurement method based on image
CN107798413A (en) * 2017-06-07 2018-03-13 温州大学 The more contour machining F.F. method for optimizing route of leather
CN108711158A (en) * 2018-03-14 2018-10-26 武汉科技大学 The image of gauge with pointer recognition methods based on contour fitting and radially divided
CN110400321A (en) * 2019-07-26 2019-11-01 广东工业大学 The extracting method of leather material profile based on machine vision and actual size
CN110930355A (en) * 2019-10-10 2020-03-27 江苏科技大学 Micron-sized puffer fish epidermis somatic thorn contour modeling method based on image processing

Patent Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2009269113A (en) * 2008-05-02 2009-11-19 Shima Seiki Mfg Ltd Cutting device, and method of extracting contour of object to be cut by cutting device
CN104625428A (en) * 2014-12-19 2015-05-20 天津市芭而蒂服饰有限公司 Leather laser cutting machine and leather processing method
CN107179057A (en) * 2017-05-12 2017-09-19 浙江工业大学 Leather dimensional measurement method based on image
CN107798413A (en) * 2017-06-07 2018-03-13 温州大学 The more contour machining F.F. method for optimizing route of leather
CN108711158A (en) * 2018-03-14 2018-10-26 武汉科技大学 The image of gauge with pointer recognition methods based on contour fitting and radially divided
CN110400321A (en) * 2019-07-26 2019-11-01 广东工业大学 The extracting method of leather material profile based on machine vision and actual size
CN110930355A (en) * 2019-10-10 2020-03-27 江苏科技大学 Micron-sized puffer fish epidermis somatic thorn contour modeling method based on image processing

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
张江雯: "皮革轮廓智能跟踪及测量的技术研究", 《中国优秀硕士学位论文全文数据库 信息科技辑》 *

Cited By (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114504170A (en) * 2022-03-07 2022-05-17 知守科技(杭州)有限公司 Method and system for spraying glue on soles of flaky soles and storage medium
CN114535792A (en) * 2022-03-24 2022-05-27 大族激光科技产业集团股份有限公司 Construction method for machining track corner transition arc, machining equipment and storage medium
CN114535792B (en) * 2022-03-24 2023-11-07 大族激光科技产业集团股份有限公司 Construction method of processing track corner transition arc, processing equipment and storage medium
CN115647575A (en) * 2022-12-28 2023-01-31 歌尔股份有限公司 Laser processing control method, device, equipment and storage medium
CN116540516A (en) * 2023-05-10 2023-08-04 天王电子(深圳)有限公司 Watch automatic assembly method and watch assembly equipment
CN116704209A (en) * 2023-08-08 2023-09-05 山东顺发重工有限公司 Quick flange contour extraction method and system
CN116704209B (en) * 2023-08-08 2023-10-17 山东顺发重工有限公司 Quick flange contour extraction method and system
CN117428582A (en) * 2023-12-22 2024-01-23 泉州装备制造研究所 Machining method and medium for special-shaped workpiece
CN117428582B (en) * 2023-12-22 2024-03-15 泉州装备制造研究所 Machining method and medium for special-shaped workpiece

Also Published As

Publication number Publication date
CN113284157B (en) 2023-06-02

Similar Documents

Publication Publication Date Title
CN113284157A (en) Large-breadth leather contour detection and track optimization method
CN107798330B (en) Weld image feature information extraction method
CN101334263B (en) Circular target circular center positioning method
CN110728667B (en) Automatic accurate measuring method for cutter abrasion loss based on gray image probability
CN101487838B (en) Extraction method for dimension shape characteristics of profiled fiber
CN111035115B (en) Sole gluing path planning method and device based on 3D vision
CN113112496B (en) Sub-pixel shaft part size measurement method based on self-adaptive threshold
CN113538486B (en) Method for improving identification and positioning accuracy of automobile sheet metal workpiece
CN112529858A (en) Welding seam image processing method based on machine vision
KR20140020837A (en) Method for the pre-processing of a three-dimensional image of the surface of a tyre for use in the inspection of said surface
JPS63145577A (en) Pattern data generating method
CN112871587B (en) Gluing path planning method and gluing system based on 3D visual guidance
CN111077844A (en) Part accurate machining method based on measured data feature guidance
CN110942107B (en) Automatic composite grinding processing characteristic identification method based on part engineering image
CN111311618A (en) Circular arc workpiece matching and positioning method based on high-precision geometric primitive extraction
CN111445482A (en) Segmentation and identification method of overlapped agaricus bisporus
CN104778458A (en) Textile pattern retrieval method based on textural features
CN111401449A (en) Image matching method based on machine vision
CN110415304A (en) A kind of vision calibration method and system
CN113096147A (en) MATLAB-based automatic laser marking shadow generation method
CN117496401A (en) Full-automatic identification and tracking method for oval target points of video measurement image sequences
CN116452826A (en) Coal gangue contour estimation method based on machine vision under shielding condition
CN113658171A (en) Automatic extraction method of steel bar processing information based on digital image processing
CN113674198A (en) Incomplete cross mark point visual identification method based on integral graph
CN112633393B (en) Automatic classification method and device for ceramic tile textures

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