CN107204019A - A kind of method that machining code is generated according to photo - Google Patents
A kind of method that machining code is generated according to photo Download PDFInfo
- Publication number
- CN107204019A CN107204019A CN201710400665.5A CN201710400665A CN107204019A CN 107204019 A CN107204019 A CN 107204019A CN 201710400665 A CN201710400665 A CN 201710400665A CN 107204019 A CN107204019 A CN 107204019A
- Authority
- CN
- China
- Prior art keywords
- curve
- coordinate
- code
- processing
- path
- 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
Links
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T9/00—Image coding
- G06T9/20—Contour coding, e.g. using detection of edges
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T11/00—2D [Two Dimensional] image generation
- G06T11/20—Drawing from basic elements, e.g. lines or circles
- G06T11/203—Drawing of straight lines or curves
-
- 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
Abstract
The invention provides a kind of method that machining code is generated according to photo, comprise the following steps:1. image is obtained:By image capture device, the image of handicraft design drawing is obtained;2. curve is gathered:Processing boundary curve is extracted from the image of handicraft design drawing;3. path is generated:Machining path is obtained according to processing boundary curve the Fitting Calculation;4. code is merged:Calculated according to machining path and obtain process operation code;5. code wrap:Process operation code wrap is turned into file.The present invention can effectively realize by gathering curve, generation path, merging the steps such as code and automatically generate operation code according to design drawing image.
Description
Technical field
The present invention relates to a kind of method that machining code is generated according to photo.
Background technology
For the cinnabar handicraft design of designed, designed, drawing can only be compareed by dedicated technician after being typically designed
Progressively process, it is impossible to directly generate the operation code of automation processing, automation of the prior art generates machining code, also only
It is the processing compared in real time against drawing by interpolation mode, and cinnabar handicraft airborne dust in processing is larger, compares in real time
Sensor used (such as video is first-class) be able to can not be accurately identified because of airborne dust, so that real-time comparison can not be correctly completed, only
It can depend on first all to generate operation code before processing starts and be only possible to accurately complete to process.
The content of the invention
In order to solve the above technical problems, the invention provides a kind of method that machining code is generated according to photo, the basis
The method of photo generation machining code can effectively realize that basis is set by gathering curve, generation path, merging the steps such as code
Meter figure image automatically generates operation code.
The present invention is achieved by the following technical programs.
A kind of method that machining code is generated according to photo that the present invention is provided, comprises the following steps:
1. image is obtained:By image capture device, the image of handicraft design drawing is obtained;
2. curve is gathered:Processing boundary curve is extracted from the image of handicraft design drawing;
3. path is generated:Machining path is obtained according to processing boundary curve the Fitting Calculation;
4. code is merged:Calculated according to machining path and obtain process operation code;
5. code wrap:Process operation code wrap is turned into file.
2. the step comprises the following steps:
(2.1), image is inputted:Cinnabar handicraft is obtained from system from incoming parameter by way of function call to set
Meter figure;
(2.2) background, is removed:Background pure color color lattice in design drawing are switched into colorless chromogenic lattice or white color lattice;
(2.3), black and white is handled:The design drawing got is subjected to black whitening processing;
(2.4) sideline, is extracted:Using color lattice non-NULL or non-zero as condition, product sideline in design drawing is extracted;
(2.5), formation curve:Smoothing processing is made to obtained product sideline, obtain process operation curve, and will obtain
Process operation curve is returned.
3. the step comprises the following steps:
(3.1) curve, is obtained:Obtain curve to be processed from incoming parameter by way of function call from system
Path;
(3.2), curve is decoded:Curved path to be processed is projected into plane coordinate system, plane seat is sequentially decoded as
Mark the coordinate point set of system;
(3.3), curve segmentation:Based on difference between adjacent coordinates point, to coordinate point set is divided into multiple coordinate subsets;
(3.4), generation paragraph by paragraph:To each coordinate subset, linear fit is carried out, multiple matched curves are obtained;
(3.5), synthesis path:Matched curve arranged in sequence is turned into processing curve path set, by processing curve path set
It is used as function returned data.
4. the step comprises the following steps:
(4.1), acquisition approach:Obtain processing curve path from incoming parameter by way of function call from system
Collection;
(4.2), slope is calculated:To each curve delivery position in processing curve path set, slope calculations are to form slope
Collection;
(4.3), segmentation judges:Processing scheme possibility is judged respectively to each curve in processing curve path set, and selected
Possibility result of calculation highest processing scheme is taken as selected scheme;
(4.4), synthesis paragraph by paragraph:Corresponding slope result of calculation is concentrated according to every adjacent two sections of selected schemes and slope,
Calculate handing-over scheme;
(4.5) code, is generated:The selected scheme of correspondence and handing-over schemes generation operation code, and operation code is returned.
The step (3.3) comprises the following steps:
(3.3.1), difference setting value is read from parameter list, and the first coordinate points are set to changing coordinates point;
Coordinate difference between (3.3.2), calculating changing coordinates point and next coordinate points, until coordinate points are concentrated without under
One coordinate points;
(3.3.3), to each coordinate difference, its difference between next coordinate difference, the difference such as calculated is calculated
Value is more than difference setting value, then the corresponding changing coordinates point of the coordinate difference is labeled as into breakpoint;
(3.3.4), a coordinate points are removed for changing coordinates point, be back to step (3.3.2), such as coordinate points are concentrated without under
One coordinate points, then into next step;
(3.3.5), using the first coordinate points as starting point, using breakpoint as end point, by starting point to the institute between end point
There are coordinate points to be added to the first coordinate subset, thereafter using next coordinate points of each breakpoint as starting point, breakpoint or last
Individual coordinate points are end point, by each section of all coordinate points between starting point and end point respectively sequentially added to coordinate
Collection..
Handing-over scheme is calculated in the step (4.4) to comprise the following steps:
(4.4.1), the adjacent end points of two adjacent curves is taken to be handing-over end points;
(4.4.2), with approximatioss, taken a little on position between handing-over end points on traversal slope straight line so that handing-over end
Put and this takes 3 points of camber lines determined a little can be tangent with two adjacent curves;
(4.4.3), using camber line as process operation path, to select the machining tool processed operation twice respectively in scheme
Path, is used as handing-over scheme..
The step 1.~5. realized respectively by individual chips.
The slope straight line is the linear function using slope result of calculation as proportionality coefficient.
The image of the step 1. handicraft design drawing of middle acquisition, is the rgb pixel figure that background color is solid background.
The beneficial effects of the present invention are:, can be effectively real by gathering curve, generation path, merging the steps such as code
Operation code is now automatically generated according to design drawing image.
Brief description of the drawings
Fig. 1 is the schematic flow sheet of the present invention.
Embodiment
Be described further below technical scheme, but claimed scope be not limited to it is described.
A kind of method that machining code is generated according to photo as shown in Figure 1, comprises the following steps:
1. image is obtained:By image capture device, the image of handicraft design drawing is obtained;
2. curve is gathered:Processing boundary curve is extracted from the image of handicraft design drawing;
3. path is generated:Machining path is obtained according to processing boundary curve the Fitting Calculation;
4. code is merged:Calculated according to machining path and obtain process operation code;
5. code wrap:Process operation code wrap is turned into file.
2. the step comprises the following steps:
(2.1), image is inputted:Cinnabar handicraft is obtained from system from incoming parameter by way of function call to set
Meter figure;
(2.2) background, is removed:Background pure color color lattice in design drawing are switched into colorless chromogenic lattice or white color lattice;
(2.3), black and white is handled:The design drawing got is subjected to black whitening processing;
(2.4) sideline, is extracted:Using color lattice non-NULL or non-zero as condition, product sideline in design drawing is extracted;
(2.5), formation curve:Smoothing processing is made to obtained product sideline, obtain process operation curve, and will obtain
Process operation curve is returned.
3. the step comprises the following steps:
(3.1) curve, is obtained:Obtain curve to be processed from incoming parameter by way of function call from system
Path;
(3.2), curve is decoded:Curved path to be processed is projected into plane coordinate system, plane seat is sequentially decoded as
Mark the coordinate point set of system;
(3.3), curve segmentation:Based on difference between adjacent coordinates point, to coordinate point set is divided into multiple coordinate subsets;
(3.4), generation paragraph by paragraph:To each coordinate subset, linear fit is carried out, multiple matched curves are obtained;
(3.5), synthesis path:Matched curve arranged in sequence is turned into processing curve path set, by processing curve path set
It is used as function returned data.
4. the step comprises the following steps:
(4.1), acquisition approach:Obtain processing curve path from incoming parameter by way of function call from system
Collection;
(4.2), slope is calculated:To each curve delivery position in processing curve path set, slope calculations are to form slope
Collection;
(4.3), segmentation judges:Processing scheme possibility is judged respectively to each curve in processing curve path set, and selected
Possibility result of calculation highest processing scheme is taken as selected scheme;
(4.4), synthesis paragraph by paragraph:Corresponding slope result of calculation is concentrated according to every adjacent two sections of selected schemes and slope,
Calculate handing-over scheme;
(4.5) code, is generated:The selected scheme of correspondence and handing-over schemes generation operation code, and operation code is returned.
The step (3.3) comprises the following steps:
(3.3.1), difference setting value is read from parameter list, and the first coordinate points are set to changing coordinates point;
Coordinate difference between (3.3.2), calculating changing coordinates point and next coordinate points, until coordinate points are concentrated without under
One coordinate points;
(3.3.3), to each coordinate difference, its difference between next coordinate difference, the difference such as calculated is calculated
Value is more than difference setting value, then the corresponding changing coordinates point of the coordinate difference is labeled as into breakpoint;
(3.3.4), a coordinate points are removed for changing coordinates point, be back to step (3.3.2), such as coordinate points are concentrated without under
One coordinate points, then into next step;
(3.3.5), using the first coordinate points as starting point, using breakpoint as end point, by starting point to the institute between end point
There are coordinate points to be added to the first coordinate subset, thereafter using next coordinate points of each breakpoint as starting point, breakpoint or last
Individual coordinate points are end point, by each section of all coordinate points between starting point and end point respectively sequentially added to coordinate
Collection..
Handing-over scheme is calculated in the step (4.4) to comprise the following steps:
(4.4.1), the adjacent end points of two adjacent curves is taken to be handing-over end points;
(4.4.2), with approximatioss, taken a little on position between handing-over end points on traversal slope straight line so that handing-over end
Put and this takes 3 points of camber lines determined a little can be tangent with two adjacent curves;
(4.4.3), using camber line as process operation path, to select the machining tool processed operation twice respectively in scheme
Path, is used as handing-over scheme..
The step 1.~5. realized respectively by individual chips.
The slope straight line is the linear function using slope result of calculation as proportionality coefficient.
The image of the step 1. handicraft design drawing of middle acquisition, is the rgb pixel figure that background color is solid background.
Thus, as long as design drawing is directed at image capture device by handicraft designer, system is provided using the present invention
Method is that can obtain corresponding handicraft process operation scheme, and process operation scheme is file, is easy to preserve and repeatedly implements.
Claims (9)
1. a kind of method that machining code is generated according to photo, it is characterised in that:Comprise the following steps:
1. image is obtained:By image capture device, the image of handicraft design drawing is obtained;
2. curve is gathered:Processing boundary curve is extracted from the image of handicraft design drawing;
3. path is generated:Machining path is obtained according to processing boundary curve the Fitting Calculation;
4. code is merged:Calculated according to machining path and obtain process operation code;
5. code wrap:Process operation code wrap is turned into file.
2. the method as claimed in claim 1 that machining code is generated according to photo, it is characterised in that:2. the step is included such as
Lower step:
(2.1), image is inputted:Obtain the design of cinnabar handicraft from incoming parameter by way of function call from system
Figure;
(2.2) background, is removed:Background pure color color lattice in design drawing are switched into colorless chromogenic lattice or white color lattice;
(2.3), black and white is handled:The design drawing got is subjected to black whitening processing;
(2.4) sideline, is extracted:Using color lattice non-NULL or non-zero as condition, product sideline in design drawing is extracted;
(2.5), formation curve:Smoothing processing is made to obtained product sideline, process operation curve is obtained, and by obtained processing
Operating curve is returned.
3. the method as claimed in claim 1 that machining code is generated according to photo, it is characterised in that:3. the step is included such as
Lower step:
(3.1) curve, is obtained:Obtain curve road to be processed from incoming parameter by way of function call from system
Footpath;
(3.2), curve is decoded:Curved path to be processed is projected into plane coordinate system, plane coordinate system is sequentially decoded as
Coordinate point set;
(3.3), curve segmentation:Based on difference between adjacent coordinates point, to coordinate point set is divided into multiple coordinate subsets;
(3.4), generation paragraph by paragraph:To each coordinate subset, linear fit is carried out, multiple matched curves are obtained;
(3.5), synthesis path:By matched curve arranged in sequence turn into processing curve path set, using processing curve path set as
Function returned data.
4. the method as claimed in claim 1 that machining code is generated according to photo, it is characterised in that:4. the step is included such as
Lower step:
(4.1), acquisition approach:Obtain processing curve path set from incoming parameter by way of function call from system;
(4.2), slope is calculated:To each curve delivery position in processing curve path set, slope calculations are to form slope collection;
(4.3), segmentation judges:Processing scheme possibility is judged each curve in processing curve path set respectively, and selection can
Energy property result of calculation highest processing scheme is used as selected scheme;
(4.4), synthesis paragraph by paragraph:Corresponding slope result of calculation is concentrated according to every adjacent two sections of selected schemes and slope, calculated
Go out handing-over scheme;
(4.5) code, is generated:The selected scheme of correspondence and handing-over schemes generation operation code, and operation code is returned.
5. the method as claimed in claim 3 that machining code is generated according to photo, it is characterised in that:Step (3.3) bag
Include following steps:
(3.3.1), difference setting value is read from parameter list, and the first coordinate points are set to changing coordinates point;
Coordinate difference between (3.3.2), calculating changing coordinates point and next coordinate points, sits until coordinate points are concentrated without next
Punctuate;
(3.3.3), to each coordinate difference, its difference between next coordinate difference is calculated, the difference such as calculated is big
In difference setting value, then the corresponding changing coordinates point of the coordinate difference is labeled as breakpoint;
(3.3.4), a coordinate points being removed for changing coordinates point, being back to step (3.3.2), such as coordinate points are concentrated sits without next
Punctuate, then into next step;
(3.3.5), using the first coordinate points as starting point, using breakpoint as end point, by starting point to all seats between end point
Punctuate is added to the first coordinate subset, regard next coordinate points of each breakpoint as starting point, breakpoint or last seat thereafter
Punctuate is end point, and each section of all coordinate points between starting point and end point are sequentially added into coordinate subset respectively..
6. the method as claimed in claim 4 that machining code is generated according to photo, it is characterised in that:In the step (4.4)
Handing-over scheme is calculated to comprise the following steps:
(4.4.1), the adjacent end points of two adjacent curves is taken to be handing-over end points;
(4.4.2), with approximatioss, taken a little on position between handing-over end points on traversal slope straight line so that handing-over end points and
This takes 3 points of camber lines determined a little can be tangent with two adjacent curves;
(4.4.3), using camber line as process operation path, to select the processed operation road twice of the machining tool difference in scheme
Footpath, is used as handing-over scheme..
7. the method as claimed in claim 1 that machining code is generated according to photo, it is characterised in that:The step 1.~5. divide
Not realized by individual chips.
8. the method as claimed in claim 6 that machining code is generated according to photo, it is characterised in that:The slope straight line be with
Slope result of calculation is the linear function of proportionality coefficient.
9. the method as claimed in claim 1 that machining code is generated according to photo, it is characterised in that:The step is 1. middle to be obtained
Handicraft design drawing image, be the rgb pixel figure that background color is solid background.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201710400665.5A CN107204019B (en) | 2017-05-31 | 2017-05-31 | Method for generating processing code according to photo |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201710400665.5A CN107204019B (en) | 2017-05-31 | 2017-05-31 | Method for generating processing code according to photo |
Publications (2)
Publication Number | Publication Date |
---|---|
CN107204019A true CN107204019A (en) | 2017-09-26 |
CN107204019B CN107204019B (en) | 2021-01-05 |
Family
ID=59907994
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201710400665.5A Active CN107204019B (en) | 2017-05-31 | 2017-05-31 | Method for generating processing code according to photo |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN107204019B (en) |
Citations (9)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20090097747A1 (en) * | 2007-10-10 | 2009-04-16 | Himax Technologies Limited | Method of image processing and device thereof |
CN101957609B (en) * | 2010-08-11 | 2012-12-19 | 北京数码大方科技有限公司 | C-axis code generation method and device for multiple-section characteristic processing |
CN103949963A (en) * | 2014-04-25 | 2014-07-30 | 湖南大学 | Method for generating random path for traversing continuously-polished surface |
CN104714477A (en) * | 2015-03-13 | 2015-06-17 | 江俊逢 | Machining file planning system and machining file generating method |
CN204759169U (en) * | 2015-06-09 | 2015-11-11 | 三明学院 | CNC engraving machine of direct reading working drawing |
CN105676776A (en) * | 2016-01-15 | 2016-06-15 | 广东工业大学 | Profile curve numerical control code generation method based on particle swarm algorithm and numerical control machine tool |
CN105868498A (en) * | 2016-04-20 | 2016-08-17 | 南京航空航天大学 | Scanning line point cloud based skin boundary feature reconstruction method |
CN106020120A (en) * | 2016-07-29 | 2016-10-12 | 芜湖哈特机器人产业技术研究院有限公司 | Method for generating G code by using image based on ios system |
CN106780412A (en) * | 2016-11-28 | 2017-05-31 | 西安精雕软件科技有限公司 | A kind of method that utilization handwritten form skeleton line generates machining path |
-
2017
- 2017-05-31 CN CN201710400665.5A patent/CN107204019B/en active Active
Patent Citations (9)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20090097747A1 (en) * | 2007-10-10 | 2009-04-16 | Himax Technologies Limited | Method of image processing and device thereof |
CN101957609B (en) * | 2010-08-11 | 2012-12-19 | 北京数码大方科技有限公司 | C-axis code generation method and device for multiple-section characteristic processing |
CN103949963A (en) * | 2014-04-25 | 2014-07-30 | 湖南大学 | Method for generating random path for traversing continuously-polished surface |
CN104714477A (en) * | 2015-03-13 | 2015-06-17 | 江俊逢 | Machining file planning system and machining file generating method |
CN204759169U (en) * | 2015-06-09 | 2015-11-11 | 三明学院 | CNC engraving machine of direct reading working drawing |
CN105676776A (en) * | 2016-01-15 | 2016-06-15 | 广东工业大学 | Profile curve numerical control code generation method based on particle swarm algorithm and numerical control machine tool |
CN105868498A (en) * | 2016-04-20 | 2016-08-17 | 南京航空航天大学 | Scanning line point cloud based skin boundary feature reconstruction method |
CN106020120A (en) * | 2016-07-29 | 2016-10-12 | 芜湖哈特机器人产业技术研究院有限公司 | Method for generating G code by using image based on ios system |
CN106780412A (en) * | 2016-11-28 | 2017-05-31 | 西安精雕软件科技有限公司 | A kind of method that utilization handwritten form skeleton line generates machining path |
Non-Patent Citations (1)
Title |
---|
张国栋 等: "应用Auto CAD实现数控加工曲线拟合的研究", 《全国第十四届计算机科学及其在仪器仪表中的应用学术交流会论文集》 * |
Also Published As
Publication number | Publication date |
---|---|
CN107204019B (en) | 2021-01-05 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
Liang et al. | Learning for disparity estimation through feature constancy | |
CN105158272B (en) | A kind of method for detecting textile defect | |
CN108492291B (en) | CNN segmentation-based solar photovoltaic silicon wafer defect detection system and method | |
CN102542275A (en) | Automatic identification method for identification photo background and system thereof | |
CN105096283A (en) | Panoramic image acquisition method and device | |
CN109961399A (en) | Optimal stitching line method for searching based on Image distance transform | |
CN102609950A (en) | Two-dimensional video depth map generation process | |
CN105069751A (en) | Depth image missing data interpolation method | |
CN102982524B (en) | Splicing method for corn ear order images | |
CN106340010A (en) | Corner detection method based on second-order contour difference | |
CN111684462B (en) | Image matching method and vision system | |
CN107204019A (en) | A kind of method that machining code is generated according to photo | |
CN102663787B (en) | Method and system for image path generation | |
CN111985436B (en) | Workshop ground marking recognition fitting method based on LSD | |
CN111368637B (en) | Transfer robot target identification method based on multi-mask convolutional neural network | |
CN105915881A (en) | Stereoscopic video frame rate improvement method based on significance detection | |
US20150234086A1 (en) | Method of processing a marine gravity data and a processing apparatus for the same | |
CN116541912A (en) | Method and device for generating wiring diagram based on CAD image recognition | |
CN105069773A (en) | Self-adapting edge detection calculating method based on combination of mask film and canny algorithm | |
KR101524074B1 (en) | Method for Image Processing | |
CN107204022A (en) | A kind of method that machining path is obtained according to processing curve | |
CN107065780B (en) | A method of operation code is generated according to machining path | |
KR102112019B1 (en) | Apparatus and method for generating intermediate view image | |
JP2000074643A (en) | Method and device for converting three-dimensional distance data and storing medium storing program for data conversion | |
CN111104553B (en) | Efficient motor complementary neural network system |
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 |