CN107204019B - Method for generating processing code according to photo - Google Patents

Method for generating processing code according to photo Download PDF

Info

Publication number
CN107204019B
CN107204019B CN201710400665.5A CN201710400665A CN107204019B CN 107204019 B CN107204019 B CN 107204019B CN 201710400665 A CN201710400665 A CN 201710400665A CN 107204019 B CN107204019 B CN 107204019B
Authority
CN
China
Prior art keywords
coordinate
curve
processing
generating
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.)
Active
Application number
CN201710400665.5A
Other languages
Chinese (zh)
Other versions
CN107204019A (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.)
Tongren Wanshan Danfeng Cinnabar Handicraft Research And Development Detection Identification Center Co ltd
Original Assignee
Tongren Wanshan Danfeng Cinnabar Handicraft Research And Development Detection Identification Center Co ltd
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 Tongren Wanshan Danfeng Cinnabar Handicraft Research And Development Detection Identification Center Co ltd filed Critical Tongren Wanshan Danfeng Cinnabar Handicraft Research And Development Detection Identification Center Co ltd
Priority to CN201710400665.5A priority Critical patent/CN107204019B/en
Publication of CN107204019A publication Critical patent/CN107204019A/en
Application granted granted Critical
Publication of CN107204019B publication Critical patent/CN107204019B/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
    • G06T9/00Image coding
    • G06T9/20Contour coding, e.g. using detection of edges
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T11/002D [Two Dimensional] image generation
    • G06T11/20Drawing from basic elements, e.g. lines or circles
    • G06T11/203Drawing of straight lines or curves
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/10Segmentation; Edge detection
    • G06T7/13Edge detection

Landscapes

  • Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Theoretical Computer Science (AREA)
  • Multimedia (AREA)
  • Computer Vision & Pattern Recognition (AREA)
  • Image Processing (AREA)
  • Processing Or Creating Images (AREA)

Abstract

The invention provides a method for generating a processing code according to a photo, which comprises the following steps: acquiring an image: acquiring an image of an artwork design drawing through image acquisition equipment; collecting a curve: extracting a processing boundary curve from an image of an artwork design drawing; generating a path: fitting and calculating according to the machining boundary curve to obtain a machining path; and fourthly, merging the codes: calculating according to the machining path to obtain a machining operation code; and code encapsulation: and packaging the processing operation code into a file. The invention can effectively realize automatic generation of the operation codes according to the design drawing images through the steps of collecting curves, generating paths, combining codes and the like.

Description

Method for generating processing code according to photo
Technical Field
The invention relates to a method for generating a machining code from a photo.
Background
For the design of the self-designed cinnabar artware, after the design is generally finished, the cinnabar artware can only be processed step by referring to a drawing by a special technician, and an operation code for automatic processing cannot be directly generated.
Disclosure of Invention
In order to solve the technical problem, the invention provides a method for generating a processing code according to a photo, and the method for generating the processing code according to the photo can effectively realize automatic generation of an operation code according to a design drawing image through steps of collecting a curve, generating a path, combining codes and the like.
The invention is realized by the following technical scheme.
The invention provides a method for generating a processing code according to a photo, which comprises the following steps:
acquiring an image: acquiring an image of an artwork design drawing through image acquisition equipment;
collecting a curve: extracting a processing boundary curve from an image of an artwork design drawing;
generating a path: fitting and calculating according to the machining boundary curve to obtain a machining path;
and fourthly, merging the codes: calculating according to the machining path to obtain a machining operation code;
and code encapsulation: and packaging the processing operation code into a file.
The step II comprises the following steps:
(2.1), image input: acquiring a cinnabar artwork design drawing from the transmitted parameters in a function calling mode from the system;
(2.2) removing background: converting the background pure color grids in the design drawing into colorless color grids or white color grids;
(2.3), black and white treatment: carrying out black-white processing on the acquired design drawing;
(2.4) extracting sidelines: extracting a product side line in the design drawing under the condition that the color lattice is non-empty or non-zero;
(2.5) generating a curve: and smoothing the obtained product side line to obtain a processing operation curve, and returning the obtained processing operation curve.
The third step includes the following steps:
(3.1) obtaining a curve: acquiring a curve path to be processed from an incoming parameter in a function calling mode from a system;
(3.2) curve decoding: projecting a curve path to be processed into a plane coordinate system, and decoding the curve path into a coordinate point set of the plane coordinate system in sequence;
(3.3) curve segmentation: dividing the set of coordinate points into a plurality of coordinate subsets based on differences between adjacent coordinate points;
(3.4), generating section by section: performing linear fitting on each coordinate subset to obtain a plurality of fitting curves;
(3.5), synthetic route: and arranging the fitted curves into a processing curve path set in sequence, and returning data by taking the processing curve path set as a function.
The step IV comprises the following steps:
(4.1), obtaining a path: acquiring a processing curve path set from an incoming parameter in a function calling mode from a system;
(4.2) slope calculation: calculating the slope of each curve connecting position in the processing curve path set to form a slope set;
(4.3) judging the segments: judging the possibility of the processing scheme for each curve in the processing curve path set, and selecting the processing scheme with the highest possibility calculation result as a selected scheme;
(4.4) stepwise synthesis: calculating a handover scheme according to each two adjacent selected schemes and a slope calculation result corresponding to the slope set;
(4.5) generating a code: and generating an operation code corresponding to the selected scheme and the handover scheme, and returning the operation code.
The step (3.3) comprises the following steps:
(3.3.1) reading a difference value set value from the parameter table, and setting the first coordinate point as a current coordinate point;
(3.3.2) calculating a coordinate difference value between the current coordinate point and the next coordinate point until no next coordinate point exists in the coordinate point set;
(3.3.3) calculating the difference value between each coordinate difference value and the next coordinate difference value, and if the calculated difference value is greater than the difference value set value, marking the current coordinate point corresponding to the coordinate difference value as a breakpoint;
(3.3.4) taking the next coordinate point as the current coordinate point, returning to the step (3.3.2), and entering the next step if the next coordinate point does not exist in the coordinate point set;
and (3.3.5) adding all coordinate points between the starting point and the ending point into a first coordinate subset by taking the first coordinate point as the starting point and the breakpoint as the ending point, then taking the next coordinate point of each breakpoint as the starting point and taking the breakpoint or the last coordinate point as the ending point, and respectively adding all coordinate points between each segment of the starting point and the ending point into the coordinate subsets in sequence. .
The step (4.4) of calculating the handover scheme includes the steps of:
(4.4.1) taking the adjacent end points of the two adjacent curves as handover end points;
(4.4.2) taking points between the connection end points on the traversal slope straight line by an approximation method, so that the arc lines determined by the connection end points and the three points of the points can be tangent to the two adjacent curves;
and (4.4.3) taking an arc line as a processing operation path, and taking the processing tool in the selected scheme to pass through the processing operation path twice respectively as a handover scheme. .
The steps I to fifthly are realized by independent chips respectively.
The slope straight line is a linear function taking the slope calculation result as a proportionality coefficient.
The image of the artwork design drawing acquired in the step I is an RGB pixel map with the bottom color being a pure color background.
The invention has the beneficial effects that: by the steps of collecting curves, generating paths, combining codes and the like, the automatic generation of operation codes according to the images of the design drawing can be effectively realized.
Drawings
FIG. 1 is a schematic flow diagram of the present invention.
Detailed Description
The technical solution of the present invention is further described below, but the scope of the claimed invention is not limited to the described.
A method for generating a finishing code from a photograph as shown in fig. 1, comprising the steps of:
acquiring an image: acquiring an image of an artwork design drawing through image acquisition equipment;
collecting a curve: extracting a processing boundary curve from an image of an artwork design drawing;
generating a path: fitting and calculating according to the machining boundary curve to obtain a machining path;
and fourthly, merging the codes: calculating according to the machining path to obtain a machining operation code;
and code encapsulation: and packaging the processing operation code into a file.
The step II comprises the following steps:
(2.1), image input: acquiring a cinnabar artwork design drawing from the transmitted parameters in a function calling mode from the system;
(2.2) removing background: converting the background pure color grids in the design drawing into colorless color grids or white color grids;
(2.3), black and white treatment: carrying out black-white processing on the acquired design drawing;
(2.4) extracting sidelines: extracting a product side line in the design drawing under the condition that the color lattice is non-empty or non-zero;
(2.5) generating a curve: and smoothing the obtained product side line to obtain a processing operation curve, and returning the obtained processing operation curve.
The third step includes the following steps:
(3.1) obtaining a curve: acquiring a curve path to be processed from an incoming parameter in a function calling mode from a system;
(3.2) curve decoding: projecting a curve path to be processed into a plane coordinate system, and decoding the curve path into a coordinate point set of the plane coordinate system in sequence;
(3.3) curve segmentation: dividing the set of coordinate points into a plurality of coordinate subsets based on differences between adjacent coordinate points;
(3.4), generating section by section: performing linear fitting on each coordinate subset to obtain a plurality of fitting curves;
(3.5), synthetic route: and arranging the fitted curves into a processing curve path set in sequence, and returning data by taking the processing curve path set as a function.
The step IV comprises the following steps:
(4.1), obtaining a path: acquiring a processing curve path set from an incoming parameter in a function calling mode from a system;
(4.2) slope calculation: calculating the slope of each curve connecting position in the processing curve path set to form a slope set;
(4.3) judging the segments: judging the possibility of the processing scheme for each curve in the processing curve path set, and selecting the processing scheme with the highest possibility calculation result as a selected scheme;
(4.4) stepwise synthesis: calculating a handover scheme according to each two adjacent selected schemes and a slope calculation result corresponding to the slope set;
(4.5) generating a code: and generating an operation code corresponding to the selected scheme and the handover scheme, and returning the operation code.
The step (3.3) comprises the following steps:
(3.3.1) reading a difference value set value from the parameter table, and setting the first coordinate point as a current coordinate point;
(3.3.2) calculating a coordinate difference value between the current coordinate point and the next coordinate point until no next coordinate point exists in the coordinate point set;
(3.3.3) calculating the difference value between each coordinate difference value and the next coordinate difference value, and if the calculated difference value is greater than the difference value set value, marking the current coordinate point corresponding to the coordinate difference value as a breakpoint;
(3.3.4) taking the next coordinate point as the current coordinate point, returning to the step (3.3.2), and entering the next step if the next coordinate point does not exist in the coordinate point set;
and (3.3.5) adding all coordinate points between the starting point and the ending point into a first coordinate subset by taking the first coordinate point as the starting point and the breakpoint as the ending point, then taking the next coordinate point of each breakpoint as the starting point and taking the breakpoint or the last coordinate point as the ending point, and respectively adding all coordinate points between each segment of the starting point and the ending point into the coordinate subsets in sequence. .
The step (4.4) of calculating the handover scheme includes the steps of:
(4.4.1) taking the adjacent end points of the two adjacent curves as handover end points;
(4.4.2) taking points between the connection end points on the traversal slope straight line by an approximation method, so that the arc lines determined by the connection end points and the three points of the points can be tangent to the two adjacent curves;
and (4.4.3) taking an arc line as a processing operation path, and taking the processing tool in the selected scheme to pass through the processing operation path twice respectively as a handover scheme. .
The steps I to fifthly are realized by independent chips respectively.
The slope straight line is a linear function taking the slope calculation result as a proportionality coefficient.
The image of the artwork design drawing acquired in the step I is an RGB pixel map with the bottom color being a pure color background.
Therefore, as long as the artwork designer aims the design drawing at the image acquisition equipment, the system can obtain the corresponding artwork processing operation scheme by adopting the method provided by the invention, and the processing operation scheme is a file, so that the artwork processing operation scheme is convenient to store and implement for multiple times.

Claims (6)

1. A method of generating a tooling code from a photograph, comprising: the method comprises the following steps:
acquiring an image: acquiring an image of an artwork design drawing through image acquisition equipment;
collecting a curve: extracting a processing boundary curve from an image of an artwork design drawing;
generating a path: fitting and calculating according to the machining boundary curve to obtain a machining path;
and fourthly, merging the codes: calculating according to the machining path to obtain a machining operation code;
and code encapsulation: packaging the processing operation code into a file;
the step II comprises the following steps:
(2.1), image input: acquiring a cinnabar artwork design drawing from the transmitted parameters in a function calling mode from the system;
(2.2) removing background: converting the background pure color grids in the design drawing into colorless color grids or white color grids;
(2.3), black and white treatment: carrying out black-white processing on the acquired design drawing;
(2.4) extracting sidelines: extracting a product side line in the design drawing under the condition that the color lattice is non-empty or non-zero;
(2.5) generating a curve: smoothing the obtained product side line to obtain a processing operation curve, and returning the obtained processing operation curve;
the third step includes the following steps:
(3.1) obtaining a curve: acquiring a curve path to be processed from an incoming parameter in a function calling mode from a system;
(3.2) curve decoding: projecting a curve path to be processed into a plane coordinate system, and decoding the curve path into a coordinate point set of the plane coordinate system in sequence;
(3.3) curve segmentation: dividing the set of coordinate points into a plurality of coordinate subsets based on differences between adjacent coordinate points;
(3.4), generating section by section: performing linear fitting on each coordinate subset to obtain a plurality of fitting curves;
(3.5), synthetic route: arranging the fitted curves into a processing curve path set in sequence, and taking the processing curve path set as a function to return data;
the step IV comprises the following steps:
(4.1), obtaining a path: acquiring a processing curve path set from an incoming parameter in a function calling mode from a system;
(4.2) slope calculation: calculating the slope of each curve connecting position in the processing curve path set to form a slope set;
(4.3) judging the segments: judging the possibility of the processing scheme for each curve in the processing curve path set, and selecting the processing scheme with the highest possibility calculation result as a selected scheme;
(4.4) stepwise synthesis: calculating a handover scheme according to each two adjacent selected schemes and a slope calculation result corresponding to the slope set;
(4.5) generating a code: and generating an operation code corresponding to the selected scheme and the handover scheme, and returning the operation code.
2. A method of generating an elaboration code on the basis of photographs according to claim 1, characterized in that: the step (3.3) comprises the following steps:
(3.3.1) reading a difference value set value from the parameter table, and setting the first coordinate point as a current coordinate point;
(3.3.2) calculating a coordinate difference value between the current coordinate point and the next coordinate point until no next coordinate point exists in the coordinate point set;
(3.3.3) calculating the difference value between each coordinate difference value and the next coordinate difference value, and if the calculated difference value is greater than the difference value set value, marking the current coordinate point corresponding to the coordinate difference value as a breakpoint;
(3.3.4) taking the next coordinate point as the current coordinate point, returning to the step (3.3.2), and entering the next step if the next coordinate point does not exist in the coordinate point set;
and (3.3.5) adding all coordinate points between the starting point and the ending point into a first coordinate subset by taking the first coordinate point as the starting point and the breakpoint as the ending point, then taking the next coordinate point of each breakpoint as the starting point and taking the breakpoint or the last coordinate point as the ending point, and respectively adding all coordinate points between each segment of the starting point and the ending point into the coordinate subsets in sequence.
3. A method of generating an elaboration code on the basis of photographs according to claim 1, characterized in that: the step (4.4) of calculating the handover scheme includes the steps of:
(4.4.1) taking the adjacent end points of the two adjacent curves as handover end points;
(4.4.2) taking points between the connection end points on the traversal slope straight line by an approximation method, so that the arc lines determined by the connection end points and the three points of the points can be tangent to the two adjacent curves;
and (4.4.3) taking an arc line as a processing operation path, and taking the processing tool in the selected scheme to pass through the processing operation path twice respectively as a handover scheme.
4. A method of generating an elaboration code on the basis of photographs according to claim 1, characterized in that: the steps I to fifthly are realized by independent chips respectively.
5. A method of generating a tooling code from a photograph as recited in claim 3, wherein: the slope straight line is a linear function taking the slope calculation result as a proportionality coefficient.
6. A method of generating an elaboration code on the basis of photographs according to claim 1, characterized in that: the image of the artwork design drawing acquired in the step I is an RGB pixel map with the bottom color being a pure color background.
CN201710400665.5A 2017-05-31 2017-05-31 Method for generating processing code according to photo Active CN107204019B (en)

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 CN107204019A (en) 2017-09-26
CN107204019B true 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 (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104714477A (en) * 2015-03-13 2015-06-17 江俊逢 Machining file planning system and machining file generating method
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

Family Cites Families (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7881556B2 (en) * 2007-10-10 2011-02-01 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
CN103949963B (en) * 2014-04-25 2016-03-09 湖南大学 A kind of random walk generation method traveling through continuous polishing surface
CN204759169U (en) * 2015-06-09 2015-11-11 三明学院 CNC engraving machine of direct reading working drawing
CN106020120A (en) * 2016-07-29 2016-10-12 芜湖哈特机器人产业技术研究院有限公司 Method for generating G code by using image based on ios system
CN106780412B (en) * 2016-11-28 2020-04-14 西安精雕软件科技有限公司 Method for generating machining path by utilizing handwritten body skeleton line

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104714477A (en) * 2015-03-13 2015-06-17 江俊逢 Machining file planning system and machining file generating method
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

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
应用Auto CAD实现数控加工曲线拟合的研究;张国栋 等;《全国第十四届计算机科学及其在仪器仪表中的应用学术交流会论文集》;20011201;64-67 *

Also Published As

Publication number Publication date
CN107204019A (en) 2017-09-26

Similar Documents

Publication Publication Date Title
CN109145922B (en) Automatic cutout system
US9990534B2 (en) Image processing device and image processing method
TW201724026A (en) Generating a merged, fused three-dimensional point cloud based on captured images of a scene
JP4958302B2 (en) Multi-viewpoint image depth value extraction apparatus, method and program thereof
CN105096283A (en) Panoramic image acquisition method and device
CN106020120A (en) Method for generating G code by using image based on ios system
US20160323505A1 (en) Photographing processing method, device and computer storage medium
CN109858452A (en) Architectural drawing automatic comparison method and device
JPWO2009020047A1 (en) Composition analysis method, image apparatus having composition analysis function, composition analysis program, and computer-readable recording medium
CN107578410B (en) Automatic identification method for notch image of point switch
US8300939B2 (en) Image processing method, image processing apparatus, and program
CN102609950A (en) Two-dimensional video depth map generation process
CN111861880A (en) Image super-fusion method based on regional information enhancement and block self-attention
US20170069072A1 (en) Image processing apparatus, image processing system, and image processing method
CN111107337A (en) Depth information complementing method and device, monitoring system and storage medium
US10379528B2 (en) Method and apparatus for generating machining codes of workpieces from a paper engineering drawing
CN107204019B (en) Method for generating processing code according to photo
JP5862635B2 (en) Image processing apparatus, three-dimensional data generation method, and program
CN103530843B (en) A kind of photo watermark embedding based on color information compression and removing method
JP2010205095A (en) Three-dimensional object recognition device, three-dimensional object recognition program, and computer readable recording medium having program recorded therein
CN110288531B (en) Method and tool for assisting operator in making standard identity card photo
KR20120035360A (en) Apparatus for recognizing character and method thereof
CN107610070B (en) Free stereo matching method based on three-camera collection
EP4275152A1 (en) Method of training a neural network configured for converting 2d images into 3d models
CN105282534A (en) System and method for embedding stereo imagery

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