CN110356151A - A kind of automatic generation method and device in jade carving path - Google Patents

A kind of automatic generation method and device in jade carving path Download PDF

Info

Publication number
CN110356151A
CN110356151A CN201910449830.5A CN201910449830A CN110356151A CN 110356151 A CN110356151 A CN 110356151A CN 201910449830 A CN201910449830 A CN 201910449830A CN 110356151 A CN110356151 A CN 110356151A
Authority
CN
China
Prior art keywords
carved
region
matrix
coordinate
pattern matrix
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.)
Pending
Application number
CN201910449830.5A
Other languages
Chinese (zh)
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.)
Hefei Huaiyue Technology Co Ltd
Original Assignee
Hefei Huaiyue Technology 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 Hefei Huaiyue Technology Co Ltd filed Critical Hefei Huaiyue Technology Co Ltd
Priority to CN201910449830.5A priority Critical patent/CN110356151A/en
Publication of CN110356151A publication Critical patent/CN110356151A/en
Pending legal-status Critical Current

Links

Classifications

    • BPERFORMING OPERATIONS; TRANSPORTING
    • B44DECORATIVE ARTS
    • B44BMACHINES, APPARATUS OR TOOLS FOR ARTISTIC WORK, e.g. FOR SCULPTURING, GUILLOCHING, CARVING, BRANDING, INLAYING
    • B44B1/00Artist's machines or apparatus equipped with tools or work holders moving or able to be controlled three-dimensionally for making single sculptures or models
    • B44B1/006Artist's machines or apparatus equipped with tools or work holders moving or able to be controlled three-dimensionally for making single sculptures or models using computer control means
    • BPERFORMING OPERATIONS; TRANSPORTING
    • B44DECORATIVE ARTS
    • B44BMACHINES, APPARATUS OR TOOLS FOR ARTISTIC WORK, e.g. FOR SCULPTURING, GUILLOCHING, CARVING, BRANDING, INLAYING
    • B44B1/00Artist's machines or apparatus equipped with tools or work holders moving or able to be controlled three-dimensionally for making single sculptures or models
    • B44B1/06Accessories
    • BPERFORMING OPERATIONS; TRANSPORTING
    • B44DECORATIVE ARTS
    • B44BMACHINES, APPARATUS OR TOOLS FOR ARTISTIC WORK, e.g. FOR SCULPTURING, GUILLOCHING, CARVING, BRANDING, INLAYING
    • B44B3/00Artist's machines or apparatus equipped with tools or work holders moving or able to be controlled substantially two- dimensionally for carving, engraving, or guilloching shallow ornamenting or markings
    • B44B3/009Artist's machines or apparatus equipped with tools or work holders moving or able to be controlled substantially two- dimensionally for carving, engraving, or guilloching shallow ornamenting or markings using a computer control means
    • BPERFORMING OPERATIONS; TRANSPORTING
    • B44DECORATIVE ARTS
    • B44BMACHINES, APPARATUS OR TOOLS FOR ARTISTIC WORK, e.g. FOR SCULPTURING, GUILLOCHING, CARVING, BRANDING, INLAYING
    • B44B3/00Artist's machines or apparatus equipped with tools or work holders moving or able to be controlled substantially two- dimensionally for carving, engraving, or guilloching shallow ornamenting or markings
    • B44B3/06Accessories, e.g. tool or work holders

Abstract

The invention discloses the automatic generation methods and device in a kind of jade carving path, which comprises 1), obtains the apex coordinate in region to be carved on jade;2) picture containing engraving content, is loaded into matrix, obtains pattern matrix;3), the coordinate in region to be carved and pattern to be carved are transformed into the same coordinate system, whether is located in pattern matrix after mapping according to the apex coordinate in region to be carved, judges whether to need to be extended pattern matrix;4), if so, extension pattern matrix;5), the corresponding pixel points in pattern matrix are mapped in region to be carved, the coordinate of the pixel after obtaining mapping, path is carved according to Coordinate generation of the pixel after mapping in region to be carved.Using the embodiment of the present invention, the formation efficiency in engraving path can be improved.

Description

A kind of automatic generation method and device in jade carving path
Technical field
The present invention relates to a kind of generation method and device for carving path, be more particularly to a kind of jade carving path from Dynamic generation method and device.
Background technique
Currently, China is jade consumption big country, possess the world's largest jade consumption market.It reforms and opens up to the outside world in the past 40 years, Chinese jewels and jade industry achieves great development, and the engraving technology of jade shows unique characteristics, and jade product is dazzling, and category is numerous It is more.With the continuous improvement of people's living standard, more and more people buy jade product.
Currently, the production of jadeware product is all responsible for by jade carving teacher, carved from being designed into, then finished product to the end, It can be described as whole control, this is most common situation.It is also few to determine jade carving teacher even if consumer has special demand The case where mentality of designing, it may be said that the idea of jade carving teacher is to occupy the status of governance property forever in jade carving production 's.However nowadays like and buy the customer group of jadeware gradually to transformation after 80s, after 90s, their consumption pattern tends to Personalization, while pursuing quality inside with strong personal preference, pursue personalized jade carving it is private it is customized can To meet their consumption demand.There is no the jewelry jade objects as Cartier, Tiffany with distinct design style in China Brand.But jade is customized just to can be good at meeting personalized consumption demand, consumer can be according to oneself economic shape The targetedly customized jadeware for being suitble to them such as condition, occupation, identity, makings, age.Jade is customized because meeting consumer's Individual demand and it is more and more popular with consumers.Therefore, how to meet the individual demand of client is technology urgently to be resolved Problem.
Consumer is often desirable to for name, pattern or motto etc. being engraved on jade, still, if consumer personalization When what is customized is the figure of hand-written word or Freehandhand-drawing, needs manually to pass through finishing impression Software Create engraving path, cause to carve path Formation efficiency it is lower.
Summary of the invention
Technical problem to be solved by the present invention lies in provide the automatic generation method and dress in a kind of jade carving path It sets, to improve the formation efficiency in engraving path.
The present invention is to solve above-mentioned technical problem by the following technical programs:
The embodiment of the invention provides a kind of automatic generation methods in jade carving path for this, which comprises
1) apex coordinate in region to be carved on jade, is obtained;
2) picture containing engraving content, is loaded into matrix, obtains pattern matrix;
3), the coordinate in region to be carved and pattern to be carved are transformed into the same coordinate system, according to region to be carved Whether apex coordinate is located in pattern matrix after mapping, judges whether to need to be extended pattern matrix;
4), if so, extension pattern matrix;
5), the corresponding pixel points in pattern matrix are mapped in region to be carved, the seat of the pixel after obtaining mapping Mark carves path according to Coordinate generation of the pixel after mapping in region to be carved.
Optionally, before step 2), the method also includes:
Judge that can the apex coordinate in region to be carved form setting shape, if so, executing step 2), is held if it is not, returning Row step 1), wherein the shape that sets is rectangle.
Optionally, the step 2), comprising:
Pattern to be carved is obtained, according to setting the scale bar of image to be carved for the pattern Mapping to be carved to matrix In, wherein the scale bar is the ratio between the scale and regional scale to be carved of image to be carved.
Optionally, the step 3), comprising:
The apex coordinate in region to be carved is mapped in pattern matrix, using formula,Coordinate of the vertex in region to be carved in pattern matrix is obtained, and Obtain the abscissa minimum value of respective coordinates of the apex coordinate in region to be carved in pattern matrix and the maximum of ordinate Value, wherein
PiIt .x is the abscissa N with i-th point after mappingi.x corresponding abscissa;P00.x former for the coordinate of CNC model The abscissa of point corresponding point in pattern matrix;NiIt .x is i-th point of abscissa;I is serial number a little;image_scale For the scale bar of picture;PiIt .y is the ordinate N with i-th point after mappingi.x corresponding ordinate;P00It .y is CNC model Coordinate origin corresponding point in pattern matrix ordinate;NiIt .y is i-th point of ordinate;N is region to be carved top The quantity of point;
The minimum value and ordinate for judging the abscissa of respective coordinates of the apex coordinate in pattern matrix are most Whether big value is in the range of pattern matrix;If it is not, determining to need to extend pattern matrix, and execute step 5);If so, sentencing Surely extension pattern matrix is not needed, step 4) is then executed.
Optionally, during extending pattern matrix, the columns of the pixel of extended matrix is updated using following formula:
Its In,
Mat_extend.cols is the columns of the pixel of extended matrix;NDst_rect_min_x is region to be carved The abscissa minimum value of respective coordinates of the apex coordinate in pattern matrix;Mat_src.cols is the pixel point range of pattern matrix Number;
The line number of the pixel of extended matrix is updated using following formula:
Wherein,
Mat_extend.rows is the line number of the pixel of extended matrix;NDst_rect_max_y is region to be carved The ordinate maximum value of respective coordinates of the apex coordinate in pattern matrix;Mat_src.rows is the pixel row of pattern matrix Number.
Optionally, the step 5), comprising:
The noise in extended matrix is removed, and gray processing, binary conversion treatment are carried out to extended matrix, obtains two-value Gray Moment Battle array;
Obtain the minimum circumscribed rectangle of the pixel corresponding with engraving content in the two-value gray matrix;
According to the height in the region wide, to be carved in region to be carved, minimum circumscribed rectangle is wide and the height of minimum circumscribed rectangle, Using formula,Obtain area to be carved The height of the wide wide ratio and region to be carved relative to the minimum circumscribed rectangle in domain is relative to the minimum circumscribed rectangle High ratio, wherein
Width_scale is the wide wide ratio relative to minimum circumscribed rectangle in region to be carved; rRect_ Dst.size.width is the width in region to be carved;Min_distance is minimum safe distance;Image_scale is picture Scale bar;RRect_before.size.width is the width of minimum circumscribed rectangle;Height_scale is the height in region to be carved High ratio relative to minimum circumscribed rectangle;RRect_dst.size.height is the height in region to be carved; rRect_ Before.size.height is the height of minimum circumscribed rectangle;
The height of the wide wide ratio and region to be carved relative to the minimum circumscribed rectangle in region to be carved is opposite Scaling of the smaller value as pattern matrix in the high ratio of the minimum circumscribed rectangle, and according to the scaling And the size of the minimum circumscribed rectangle of pattern matrix, using formula,Obtain the central point of target rectangle The width and height of coordinate and target rectangle, wherein
RRect_after.angle is the angle of target rectangle;RRect_dst.angle is the angle in region to be carved; RRect_after.center is the center of target rectangle;RRect_dst.center is the center in region to be carved;rRect_ After.size.width is the width of target rectangle;RRect_before.size.width is the width of minimum circumscribed rectangle; Shrink_scale is scaling;RR ec t_a f t.e r.s is the height of target rectangle; rRect_ Before.size.height is the height of minimum circumscribed rectangle;
According to the corresponding relationship between target rectangle and minimum circumscribed rectangle, obtain target rectangle and minimum circumscribed rectangle it Between affine transformation matrix, and radiation transformation is carried out to minimum circumscribed rectangle according to the affine transformation matrix;
Path is carved according to the Coordinate generation of the pixel of the minimum circumscribed rectangle after affine transformation.
The embodiment of the invention provides a kind of automatically generating device in jade carving path, described device includes:
First obtains module, for obtaining the apex coordinate in region to be carved on jade;
The picture containing engraving content is loaded into matrix, obtains pattern matrix;
First judgment module, for the coordinate in region to be carved and pattern to be carved to be transformed into the same coordinate system, root Whether it is located in pattern matrix after mapping according to the apex coordinate in region to be carved, judges whether to need to carry out pattern matrix Extension;
Expansion module, for extending pattern matrix in the case where the judging result of first judgment module, which is, is;
Second obtains module, for the corresponding pixel points in pattern matrix to be mapped in region to be carved, obtains mapping The coordinate of pixel afterwards carves path according to Coordinate generation of the pixel after mapping in region to be carved.
Optionally, described first module is obtained, is used for:
Judge that can the apex coordinate in region to be carved form setting shape, if so, obtaining region to be carved on jade Apex coordinate, if it is not, load containing engraving content picture into matrix, obtain pattern matrix, wherein it is described set shape as Rectangle.
A kind of automatic generation method and device in jade carving path, described first obtains module, is used for:
Pattern to be carved is obtained, according to setting the scale bar of image to be carved for the pattern Mapping to be carved to matrix In, wherein the scale bar is the ratio between the scale and regional scale to be carved of image to be carved.
Optionally, the first judgment module, is used for:
The apex coordinate in region to be carved is mapped in pattern matrix, using formula,Coordinate of the vertex in region to be carved in pattern matrix is obtained, and Obtain the abscissa minimum value of respective coordinates of the apex coordinate in region to be carved in pattern matrix and the maximum of ordinate Value, wherein
PiIt .x is the abscissa N with i-th point after mappingi.x corresponding abscissa;P00.x former for the coordinate of CNC model The abscissa of point corresponding point in pattern matrix;NiIt .x is i-th point of abscissa;I is serial number a little;image_scale For the scale bar of picture;PiIt .y is the ordinate N with i-th point after mappingi.x corresponding ordinate;P00It .y is CNC model Coordinate origin corresponding point in pattern matrix ordinate;NiIt .y is i-th point of ordinate;N is region to be carved top The quantity of point;
The minimum value and ordinate for judging the abscissa of respective coordinates of the apex coordinate in pattern matrix are most Whether big value is in the range of pattern matrix;If it is not, determining to need to extend pattern matrix, and execute step 5);If so, sentencing Surely extension pattern matrix is not needed, step 4) is then executed.
Optionally, expansion module is used for:
Using formula, the columns of the pixel of extended matrix is updated
Its In,
Mat_extend.cols is the columns of the pixel of extended matrix;NDst_rect_min_x is region to be carved The abscissa minimum value of respective coordinates of the apex coordinate in pattern matrix;Mat_src.cols is the pixel point range of pattern matrix Number;
The line number of the pixel of extended matrix is updated using following formula:
Wherein,
Mat_extend.rows is the line number of the pixel of extended matrix;NDst_rect_max_y is region to be carved The ordinate maximum value of respective coordinates of the apex coordinate in pattern matrix;Mat_src.rows is the pixel row of pattern matrix Number.
Optionally, described second module is obtained, is used for:
The noise in extended matrix is removed, and gray processing, binary conversion treatment are carried out to extended matrix, obtains two-value Gray Moment Battle array;
Obtain the minimum circumscribed rectangle of the pixel corresponding with engraving content in the two-value gray matrix;
According to the height in the region wide, to be carved in region to be carved, minimum circumscribed rectangle is wide and the height of minimum circumscribed rectangle, Using formula,Obtain area to be carved The height of the wide wide ratio and region to be carved relative to the minimum circumscribed rectangle in domain is relative to the minimum circumscribed rectangle High ratio, wherein
Width_scale is the wide wide ratio relative to minimum circumscribed rectangle in region to be carved; rRect_ Dst.size.width is the width in region to be carved;Min_distance minimum safe distance;Image_scale is the ratio of picture Example ruler;RRect_before.size.width is the width of minimum circumscribed rectangle;Height_scale is the high phase in region to be carved For the high ratio of minimum circumscribed rectangle;RRect_dst.size.height is the height in region to be carved; rRect_ Before.size.height is the height of minimum circumscribed rectangle;
The height of the wide wide ratio and region to be carved relative to the minimum circumscribed rectangle in region to be carved is opposite Scaling of the smaller value as pattern matrix in the high ratio of the minimum circumscribed rectangle, and according to the scaling And the size of the minimum circumscribed rectangle of pattern matrix, using formula,Obtain the central point of target rectangle The width and height of coordinate and target rectangle, wherein
RRect_after.angle is the angle of target rectangle;RRect_dst.angle is the angle in region to be carved; RRect_after.center is the center of target rectangle;RRect_dst.center is the center in region to be carved; rRect_ After.size.width is the width of target rectangle;RRect_before.size.width is the width of minimum circumscribed rectangle; Shrink_scale is scaling;RR ec t_a f t.e r.s is the height of target rectangle; rRect_ Before.size.height is the height of minimum circumscribed rectangle;
According to the corresponding relationship between target rectangle and minimum circumscribed rectangle, obtain target rectangle and minimum circumscribed rectangle it Between affine transformation matrix, and radiation transformation is carried out to minimum circumscribed rectangle according to the affine transformation matrix;
Path is carved according to the Coordinate generation of the pixel of the minimum circumscribed rectangle after affine transformation.
The present invention has the advantage that compared with prior art
Using the embodiment of the present invention, by the way that the coordinate in region to be carved and pattern to be carved are transformed into the same coordinate system In, whether it is located in pattern matrix after mapping according to the apex coordinate in region to be carved, pattern matrix is extended, it will Pattern to be carved extends to area size to be carved, and then the pixel in extended matrix is mapped in region to be carved, into And the coordinate of the pixel after available mapping, it is finally raw according to the coordinate in region to be carved of the pixel after mapping At engraving path, compared with the existing technology in manually generated engraving path, the embodiment of the present invention executed automatically by machine, improved The formation efficiency in engraving path.
Detailed description of the invention
Fig. 1 is a kind of flow diagram of the automatic generation method in jade carving path provided in an embodiment of the present invention;
Fig. 2 is a kind of schematic illustration of the automatic generation method in jade carving path provided in an embodiment of the present invention;
Fig. 3 is a kind of structural schematic diagram of the automatically generating device in jade carving path provided in an embodiment of the present invention;
Fig. 4 is a kind of structural schematic diagram of the automatic creation system in jade carving path provided in an embodiment of the present invention.
Specific embodiment
It elaborates below to the embodiment of the present invention, the present embodiment carries out under the premise of the technical scheme of the present invention Implement, the detailed implementation method and specific operation process are given, but protection scope of the present invention is not limited to following implementation Example.
The embodiment of the invention provides the automatic generation methods and device in a kind of jade carving path, first below with regard to this hair A kind of automatic generation method in jade carving path that bright embodiment provides is introduced.
Fig. 1 is a kind of flow diagram of the automatic generation method in jade carving path provided in an embodiment of the present invention;Fig. 2 For a kind of schematic illustration of the automatic generation method in jade carving path provided in an embodiment of the present invention;Such as Fig. 1 and Fig. 2 institute Show, which comprises
S101: the apex coordinate in region to be carved on jade is obtained.
Specifically, being inputted in CNC (Computerized Numerical Control, computer numerical control) system first Rectangular area to be carved, i.e., coordinate of the four of the target rectangle region vertex in CNC model, unit are millimeter, are denoted as respectively N1、N2、N3And N4, the origin of CNC model coordinate systems only needs in the upper right side of target rectangle, without recording origin at this time Specific coordinate.
S102: the picture containing engraving content is loaded into matrix, obtains pattern matrix.
In practical applications, text included in pattern to be carved, pattern etc. can be referred to as to engraving content, engraving Content is generally black.In pattern to be carved, other than engraving content is black or approximate black, other regions are white Or broken white, i.e. picture is " in black and white ".
Then, the picture containing engraving content is read into matrix using the cv::read () function in OpenCV, obtain Pattern matrix, and pattern matrix is denoted as mat_src.
It is understood that is obtained is exactly a two-dimensional matrix, a width when using cv::read () to read picture Image is also to be indicated in the form of two-dimensional matrix in a computer, the pixel (i, j) in image and the element in matrix (i, j) is one-to-one.
S103: the coordinate in region to be carved and pattern to be carved are transformed into the same coordinate system, according to region to be carved Apex coordinate by mapping after whether be located at pattern matrix in, judge whether to need to be extended pattern matrix;If so, holding Row S104 step.
Illustratively, the apex coordinate in region to be carved can be mapped in pattern matrix, and obtains region to be carved Respective coordinates of the apex coordinate in pattern matrix abscissa minimum value and ordinate maximum value.
By the apex coordinate N in region to be carved1、N2、N3And N4It is mapped in pattern matrix, using formula,The vertex in region to be carved is obtained in pattern matrix mat_src Corresponding coordinate points, are denoted as P1、P2、P3And P4, and obtain corresponding points P of the apex coordinate in region to be carved in pattern matrix1、 P2、P3And P4Coordinate abscissa minimum value and ordinate maximum value, wherein
PiIt .x is the abscissa N with i-th point after mappingi.x corresponding abscissa;P00.x former for the coordinate of CNC model The abscissa of point corresponding point in pattern matrix;NiIt .x is i-th point of abscissa;I is serial number a little;image_scale For the scale bar of picture;PiIt .y is the ordinate N with i-th point after mappingi.x corresponding ordinate;P00It .y is CNC model Coordinate origin corresponding point in pattern matrix ordinate;NiIt .y is i-th point of ordinate;N is region to be carved top The quantity of point, and when region to be carved is rectangle, n=4;
In practical applications, the coordinate origin of calculating CNC model corresponding point in pattern matrix.Use P00Indicate CNC mould The coordinate origin of type corresponding point in pattern matrix mat_src, by P00It is set as (mat_src.cols, 0).
Then, judge the minimum value and ordinate of the abscissa of respective coordinates of the apex coordinate in pattern matrix Maximum value whether be in the range of pattern matrix;
Specifically, can be by P1、P2、P3And P4The minimum value of middle abscissa is labeled as nDst_rect_min_x;By P1、 P2、P3And P4The maximum value of middle ordinate is labeled as nDst_rect_max_y;By the maximum coordinates on the line direction of pattern matrix Labeled as mat_src.rows;It, can be in nDst_rect_ when the origin of pattern matrix is located at the upper left side of pattern matrix In the case where min_x > 0 and mat_src.rows > nDst_rect_max_y, top of the region to be carved after mapping is determined Point is respectively positioned in the range of pattern matrix, then the judging result of S103 step is no, i.e. P1、P2、P3And P4All in pattern matrix In, then it is judged to not needing extending pattern matrix, directly execution step S105;
If vertex of the region to be carved after mapping has exceeded the range of pattern matrix, i.e. P1、P2、P3And P4Not all exist In pattern matrix, then the judging result of S103 step is yes, needs to extend pattern matrix, executes step S104.
It is understood that scale bar refer to pixel distance (unit: pixel) of two pixels in picture and this two The ratio of the space length (unit: millimeter) of point is known as the scale bar of picture, may be generally referred to as resolution ratio, is denoted as image_ scale。
S104: the pixel in extended matrix is mapped in region to be carved, after obtaining mapping by extension pattern matrix The coordinate of pixel carves path according to Coordinate generation of the pixel after mapping in region to be carved.
Extension gained matrix is denoted as mat_extend, the type of matrix mat_extend is with pattern matrix mat_src's Type is consistent.
It can use the columns that following formula updates the pixel of extended matrix:
Its In,
Mat_extend.cols is the columns of the pixel of extended matrix;NDst_rect_min_x is region to be carved The abscissa minimum value of respective coordinates of the apex coordinate in pattern matrix;Mat_src.cols is the pixel point range of pattern matrix Number;
The line number of the pixel of extended matrix is updated using following formula:
Wherein,
Mat_extend.rows is the line number of the pixel of extended matrix;NDst_rect_max_y is region to be carved The ordinate maximum value of respective coordinates of the apex coordinate in pattern matrix;Mat_src.rows is the pixel row of pattern matrix Number;
Then white (255,255,255) are set by the value of all pixels point in extended matrix mat_extend.Again will Pattern matrix mat_src covers the most upper right corner rectangular area of extended matrix mat_extend, capped rectangular area It is wide high high consistent with the width of mat_src.
Recycle formula, Pj.x=Pi.x-mat_src.cols+mat_extend.cols point P is updated respectively1、P2、P3With P4Abscissa, wherein
PjIt .x is the abscissa on updated j-th of vertex, and j ∈ [Isosorbide-5-Nitrae];PiIt .x is the cross on i-th of vertex before update Coordinate, and i=j;Mat_src.cols is the columns of the pattern matrix before updating;Mat_extend.cols is extended matrix Columns.
The value of matrix mat_src is copied in mat_extend, meanwhile, by point P00Coordinate be updated to (mat_ src.cols,0)。
Then using extended matrix as new pattern matrix, and engraving path is generated, process is as follows:
Illustratively, the noise in pattern matrix can be removed, and gray processing, binary conversion treatment are carried out to pattern matrix, Obtain two-value gray matrix.
In practical applications, the noise in mean filter function cv::blur () removal matrix mat_src can be used.
Then, the minimum circumscribed rectangle of the pixel corresponding with engraving content in the two-value gray matrix is obtained;It will Matrix ma_ts is converted to grayscale image, then using the function cv::adaptiveThreshold () of OpenCV to gained gray scale Figure carries out the binary conversion treatment based on adaptive threshold, and gained matrix is denoted as:
mat_src_binary_gray。
All black pixel points for corresponding to engraving content in two-value gray matrix mat_src_binary_gray are imitated It penetrates and transforms in pattern matrix corresponding in the matrix in region to be carved, construct a new two-value gray matrix, and by phase It closes point and is set as black.
Two-value gray matrix mat_src_binary_gray is traversed, its all black pixel points is obtained, is denoted as Pblacki, wherein [1, N] i ∈, N are black pixel point total number.
The minimum circumscribed rectangle that function cv::minAreaRect () obtains all black pixel points is reused, is denoted as rRect_before.Reuse four vertex of function cv::RotatedRect::points () acquisition rRect_before Coordinate is denoted as P respectivelyb1、Pb2、Pb3And Pb4, the sequence on this four vertex at this time are as follows: and bottomLeft, topLeft, TopRight, bottomRight.
It in practical applications, can be according to P1、P2And P3, use cv::RotatedRect::RotatedRect () function To obtain the corresponding rectangle rRect_dst in the region to be carved in matrix.
Then, according to the height in the region wide, to be carved in region to be carved, minimum circumscribed rectangle is wide and minimum circumscribed rectangle Height, using formula,
Obtain area to be carved The height of the wide wide ratio and region to be carved relative to the minimum circumscribed rectangle in domain is relative to the minimum circumscribed rectangle High ratio, wherein
Width_scale is the wide wide ratio relative to minimum circumscribed rectangle in region to be carved; rRect_ Dst.size.width is the width in region to be carved;Min_distance is minimum safe distance, and unit is millimeter; image_ Scale is the scale bar of picture;It rRect_before.size. is the width of the small h boundary rectangle of wi most dt;Height_sca is le The high high ratio relative to minimum circumscribed rectangle in region to be carved;RRect_dst.size.height is region to be carved It is high;RRect_before.size.height is the height of minimum circumscribed rectangle;
Then, formula, shrink_scale=min (width_scale, height_scale), by area to be carved are utilized The height of the wide wide ratio and region to be carved relative to the minimum circumscribed rectangle in domain is relative to the minimum circumscribed rectangle High ratio in scaling of the smaller value as pattern matrix, wherein
Min () is minimum value value finding function.
Then, according to the scaling and the size of the minimum circumscribed rectangle of pattern matrix, using formula,Obtain the central point of target rectangle The width and height of coordinate and target rectangle, wherein
RRect_after.angle is the angle of target rectangle;RRect_dst.angle is the angle in region to be carved; RRect_after.center is the center of target rectangle;RRect_dst.center is the center in region to be carved; rRect_ After.size.width is the width of target rectangle;RRect_before.size.width is the width of minimum circumscribed rectangle; Shrink_scale is scaling;RR ec t_a f t.e r.s is the height of target rectangle; rRect_ Before.size.height is the height of minimum circumscribed rectangle.
In practical applications, function cv::RotatedRect::points () can be used and obtain target rectangle rRect_ Four apex coordinates of after, are denoted as P respectivelya1、Pa2、Pa3And Pa4, the sequence on this four vertex is successively at this time are as follows: BottomLeft, topLeft, topRight, bottomRight.
Then, it according to the corresponding relationship between target rectangle and minimum circumscribed rectangle, obtains target rectangle and minimum is external Affine transformation matrix between rectangle, and affine transformation is carried out to minimum circumscribed rectangle according to the affine transformation matrix.
It in practical applications, can be according to Pb1、Pb2、Pb3、Pb4And Pa1、Pa2、Pa3、Pa4, use function cv:: GetAffineTransform () acquires the affine transformation matrix between the two rectangles, is denoted as M, M=(aij)2×3:
For resulting each black pixel pointUsing formula,
Calculating acquires its resulting point after affine transformationWherein,
I ∈ [1, N], N are black pixel point total number.
Matrix of the construction one as matrix mat_src_binary_gray size, type, is denoted as mat_binary_ Gray_shrinked, and white (value 255) is set by its all pixels point.Finally in matrix mat_binary_gray_ It will point P in shrinkedb'lackiIt is both configured to black (value 0).At this time in matrix mat_binary_gray_shrinked Engraving content has been precisely located in target area.
Finally, according to the black picture element in the target rectangle in two-value gray matrix mat_binary_gray_shrinked The Coordinate generation of point carves path.
Specifically, can be according to matrix mat_binary_gray_shrinked, point P00, photo resolution image_ Scale, depth and cutter lifting height are cut to generate the corresponding engraving path of engraving content.
In addition, the file header of NC file can be fixed up after engraving machine type determines, carve as used in the present invention The NC file header of machine is as shown in table 1, and table 1 is the file header in the embodiment of the present invention.
Table 1
Table 2 is parameter name, meaning and the value that every row carves path in CNC file, as shown in table 2:
Table 2
Such as: N4075X-30Y-32.5Z-0.5.
From left to right, Ergodic Matrices mat_binary_gray_shrinked from top to bottom, if the point of current accessed is Pi,j, wherein i ∈ [0, mat_binary_gray_shrinked.rows), j ∈ [0, mat_binary_gray_ shrinked.cols)。
Such as fruit dot Pi,jWhen for black, then formula is utilized,By Pi,jConversion For the point in CNC model coordinate systems, it is denoted as NCi,j, wherein
NCi,jIt .x is point Pi,jIt is transformed into the abscissa of the point in CNC model coordinate systems;J is pixel Pi,jUnder the column at place Mark;I is pixel Pi,jThe row subscript at place;P00.x for CNC model coordinate origin in pattern matrix mat_src corresponding points Abscissa;NCi,jIt .y is point Pi,jIt is transformed into the ordinate of the point in CNC model coordinate system;P00It .y is the coordinate of CNC model The ordinate of origin corresponding points in pattern matrix mat_src.
Regenerate corresponding engraving path and be inserted into NC file: the value of parameter N is specific line number, and the value of parameter X is NCi,j.x, the value of parameter Y is NCi,j.y, the corresponding parameter Z of black pixel point is expressed as carving depth, and value can be set to- 0.5。
If next point Pi,j+1In the presence of and Pi,j+1For white, then cutter lifting path insertion NC file is regenerated: parameter N's Value is specific line number, and the value of parameter X is NCi,j.x, the value of parameter Y is NCi,j.y, the table of the corresponding parameter Z of white pixel point Show that cutter lifting height, value can be set to 1 millimeter.
After the completion of carving coordinates measurement, the corresponding end-of-file of engraving path NC file is generated.When engraving machine type determines Afterwards, the end-of-file of NC file is also that can be fixed up.Table 3 is that the embodiment of the invention provides the NC end-of-file of engraving machine column Table, as shown in table 3:
Table 3
Wherein, i is the line number where the pixel to be carved, and value is determined by carving path line number.
Finally, generating complete engraving path.To carve the file header of path NC file, the corresponding engraving path of content with And end-of-file is successively stitched together, and just constitutes final complete engraving path.
By practical evaluation and test, engraving content can be carved in jade by the engraving path generated using present invention automation Specified region in, engraving content it is full, content is clear, the average minimum range apart from boundary be 0.95 millimeter, carve content Wide, high direction it is consistent with wide, the high direction of target area, engraving effect is fine.
S105: the corresponding pixel points in pattern matrix are mapped in region to be carved, the pixel after obtaining mapping Coordinate carves path according to Coordinate generation of the pixel after mapping in region to be carved.
It is emphasized that the corresponding pixel points in pattern matrix, can be the pixel of the content in composition pattern matrix Point, such as the obtained black pixel point after binaryzation.In addition, carrying out the mapping of pixel in this step and carving the life in path Identical with S104 step at process, details are not described herein for the embodiment of the present invention.
It is same by the way that the coordinate in region to be carved to be transformed into pattern to be carved using embodiment illustrated in fig. 1 of the present invention In coordinate system, whether it is located in pattern matrix after mapping according to the apex coordinate in region to be carved, pattern matrix is carried out Extension, extends to area size to be carved for pattern to be carved, the pixel in extended matrix is then mapped to area to be carved In domain, and then the coordinate of the pixel after available mapping, finally according to the pixel after mapping in region to be carved Coordinate generation carve path, compared with the existing technology in manually generated engraving path, the embodiment of the present invention by machine it is automatic It executes, improves the formation efficiency in engraving path.
In another specific embodiment of the embodiment of the present invention, before step S102, the method also includes:
Judge that can the apex coordinate in region to be carved form setting shape, if so, step S102 is executed, if it is not, returning Execute step S101, wherein the shape that sets is rectangle.
Illustratively, when region to be carved is necessary for rectangle, four vertex for setting rectangle are respectively ABCD.
Then existAndAndWhen, determine region to be carved for rectangle.
If can make up rectangle, it is sequentially recorded four vertex in rank results;If all rank results are all Can not organize it is rectangular, then error exit.
Using the above embodiment of the present invention, it is possible to determine that whether region to be carved is rectangular area, is avoided to non-rectangle area It is carved in domain.
It is corresponding with embodiment illustrated in fig. 1 of the present invention, the embodiment of the invention also provides a kind of jade carving path from Dynamic generating means.
Fig. 3 is a kind of structural schematic diagram of the automatically generating device in jade carving path provided in an embodiment of the present invention, such as Shown in Fig. 3, described device includes:
First obtains module 301, for obtaining the apex coordinate in region to be carved on jade;
The picture containing engraving content is loaded into matrix, obtains pattern matrix;
First judgment module 302, for the coordinate in region to be carved and pattern to be carved to be transformed into the same coordinate system, Whether be located in pattern matrix after mapping according to the apex coordinate in region to be carved, judge whether to need to pattern matrix into Row extension;
Expansion module 303, for extending pattern matrix in the case where the judging result of first judgment module 302, which is, is;
Second obtains module 304, and for the corresponding pixel points in pattern matrix to be mapped in region to be carved, acquisition is reflected The coordinate of pixel after penetrating carves path according to Coordinate generation of the pixel after mapping in region to be carved.
It is same by the way that the coordinate in region to be carved to be transformed into pattern to be carved using embodiment illustrated in fig. 3 of the present invention In coordinate system, whether it is located in pattern matrix after mapping according to the apex coordinate in region to be carved, pattern matrix is carried out Extension, extends to area size to be carved for pattern to be carved, the pixel in extended matrix is then mapped to area to be carved In domain, and then the coordinate of the pixel after available mapping, finally according to the pixel after mapping in region to be carved Coordinate generation carve path, compared with the existing technology in manually generated engraving path, the embodiment of the present invention by machine it is automatic It executes, improves the formation efficiency in engraving path.
In a kind of specific embodiment of the embodiment of the present invention, described first obtains module 301, is used for:
Judge that can the apex coordinate in region to be carved form setting shape, if so, obtaining region to be carved on jade Apex coordinate, if it is not, load containing engraving content picture into matrix, obtain pattern matrix, wherein it is described set shape as Rectangle.
In a kind of specific embodiment of the embodiment of the present invention, the first judgment module 302 is used for:
The apex coordinate in region to be carved is mapped in pattern matrix, using formula,
The vertex in region to be carved is obtained in pattern matrix Coordinate, and obtain respective coordinates of the apex coordinate in region to be carved in pattern matrix, wherein
PiIt .x is the abscissa N with i-th point after mappingi.x corresponding abscissa;P00.x former for the coordinate of CNC model The abscissa of point corresponding point in pattern matrix;NiIt .x is i-th point of abscissa;I is serial number a little;image_scale For the scale bar of picture;PiIt .y is the ordinate N with i-th point after mappingi.x corresponding ordinate;P00It .y is CNC model Coordinate origin corresponding point in pattern matrix ordinate;NiIt .y is i-th point of ordinate;N is region to be carved top The quantity of point;
The minimum value and ordinate for judging the abscissa of respective coordinates of the apex coordinate in pattern matrix are most Whether big value is in the range of pattern matrix;If it is not, determining to need to extend pattern matrix, and trigger expansion module 303;If It is that judgement does not need extension pattern matrix, then triggers second and obtain module 304. in a kind of specific reality of the embodiment of the present invention It applies in mode, expansion module 303 is used for:
Using formula, the columns of the pixel of extended matrix is updated
Its In,
Mat_extend.cols is the columns of the pixel of extended matrix;NDst_rect_min_x is region to be carved The abscissa minimum value of respective coordinates of the apex coordinate in pattern matrix;Mat_src.cols is the pixel point range of pattern matrix Number;
The line number of the pixel of extended matrix is updated using following formula:
Wherein,
Mat_extend.rows is the line number of the pixel of extended matrix;NDst_rect_max_y is region to be carved The ordinate maximum value of respective coordinates of the apex coordinate in pattern matrix;Mat_src.rows is the pixel row of pattern matrix Number.
In a kind of specific embodiment of the embodiment of the present invention, described second obtains module 304, is used for:
The noise in extended matrix is removed, and gray processing, binary conversion treatment are carried out to extended matrix, obtains two-value Gray Moment Battle array;
Obtain the minimum circumscribed rectangle of the pixel corresponding with engraving content in the two-value gray matrix;
According to the height in the region wide, to be carved in region to be carved, minimum circumscribed rectangle is wide and the height of minimum circumscribed rectangle, Using formula,Obtain area to be carved The height of the wide wide ratio and region to be carved relative to the minimum circumscribed rectangle in domain is relative to the minimum circumscribed rectangle High ratio, wherein
Width_scale is the wide wide ratio relative to minimum circumscribed rectangle in region to be carved; rRect_ Dst.size.width is the width in region to be carved;Min_distance is minimum safe distance;Image_scale is image Scale bar;RRect_before.size.width is the width of minimum circumscribed rectangle;Height_scale is the height in region to be carved High ratio relative to minimum circumscribed rectangle;RRect_dst.size.height is the height in region to be carved; rRect_ Before.size.height is the height of minimum circumscribed rectangle;
The height of the wide wide ratio and region to be carved relative to the minimum circumscribed rectangle in region to be carved is opposite Scaling of the smaller value as pattern matrix in the high ratio of the minimum circumscribed rectangle, and according to the scaling And the size of the minimum circumscribed rectangle of pattern matrix, using formula,Obtain the central point of target rectangle The width and height of coordinate and target rectangle, wherein
RRect_after.angle is the angle of target rectangle;RRect_dst.angle is the angle in region to be carved; RRect_after.center is the center of target rectangle;RRect_dst.center is the center in region to be carved; rRect_ After.size.width is the width of target rectangle;RRect_before.size.width is the width of minimum circumscribed rectangle; Shrink_scale is scaling;RR ec t_a f t.e r.s is the height of target rectangle; rRect_ Before.size.height is the height of minimum circumscribed rectangle;
According to the corresponding relationship between target rectangle and minimum circumscribed rectangle, obtain target rectangle and minimum circumscribed rectangle it Between affine transformation matrix, and radiation transformation is carried out to minimum circumscribed rectangle according to the affine transformation matrix;
Path is carved according to the Coordinate generation of the pixel of the minimum circumscribed rectangle after affine transformation.
Corresponding to embodiment illustrated in fig. 1 of the present invention, the embodiment of the invention also provides a kind of the automatic of jade carving path Generation system.
Fig. 4 is a kind of structural schematic diagram of the automatic creation system in jade carving path provided in an embodiment of the present invention, As shown in figure 4, system include: parameter verification module, image processing module, CNC model coordinate point and matrix model coordinate points it Between conversion module, picture affine transformation processing module and automation generate engraving path module, wherein
Parameter verification module, for arranging four incoming vertex, can every kind of rank results of verification constitute square Shape.
Image processing module, for being filtered using cv::blur () function to image;Use cv:: CvtColor () function converts the image into grayscale image;Base is carried out to image using cv::adaptiveThreshold () function In the binary conversion treatment of adaptive threshold;The external square of minimum of engraving content is obtained using cv::minAreaRect () function Shape and other image processing functions.
Conversion module between CNC model coordinate point and matrix model coordinate points, for realizing CNC model coordinate point and square Mutually converting between battle array model coordinate point.
Picture affine transformation processing module, for using function cv::getAffineTransform (), according at least 3 groups The vertex of correspondence is converted to obtain affine transformation matrix M;According to affine transformation matrix M, target point P is acquired by affine change Change rear resulting point P'.
Automation generates engraving path module: generating the corresponding file header in engraving path and end-of-file;It is carved according to containing Two-value gray matrix, the point P of content00, photo resolution image_scale, cut depth and cutter lifting height to generate in engraving Hold corresponding engraving path.Finally file header, the corresponding engraving path of engraving content and end-of-file are stitched together, collectively constituted One complete engraving path file, i.e. CNC file.
In practical applications, embodiment illustrated in fig. 4 of the present invention be preferably applied to according to only containing engraving content " blank sheet of paper is black Word " picture will carve the region to be carved of content being carved on jade.
It is emphasized that referring in black and white, in the pattern to be carved containing engraving content, other than carving content Pixel region be white, engraving content be black picture element.
The method that the automation based on adaptive threshold that the purpose of the present invention is to provide a kind of generates engraving path, so that Engraving path (CNC file) can be automatically generated according only to " in black and white " picture, and engraving content is carved in specified area Domain guarantees that engraving effect is good.
And whole process is not necessarily to the participation of designer, significantly reduces the workload of designer, improves processing efficiency.
The foregoing is merely illustrative of the preferred embodiments of the present invention, is not intended to limit the invention, all in essence of the invention Made any modifications, equivalent replacements, and improvements etc., should all be included in the protection scope of the present invention within mind and principle.

Claims (10)

1. a kind of automatic generation method in jade carving path, which is characterized in that the described method includes:
1) apex coordinate in region to be carved on jade, is obtained;
2) picture containing engraving content, is loaded into matrix, obtains pattern matrix;
3), the coordinate in region to be carved and pattern to be carved are transformed into the same coordinate system, according to the vertex in region to be carved Whether coordinate is located in pattern matrix after mapping, judges whether to need to be extended pattern matrix;
4), if so, extension pattern matrix, the pixel in extended matrix is mapped in region to be carved, after obtaining mapping The coordinate of pixel carves path according to Coordinate generation of the pixel after mapping in region to be carved;
5), the corresponding pixel points in pattern matrix are mapped in region to be carved, the coordinate of the pixel after obtaining mapping, root Path is carved according to Coordinate generation of the pixel after mapping in region to be carved.
2. a kind of automatic generation method in jade carving path according to claim 1, which is characterized in that step 2) it Before, the method also includes:
Judge that can the apex coordinate in region to be carved form setting shape, if so, executing step 2), executes step if it is not, returning It is rapid 1), wherein the shape that sets is rectangle.
3. a kind of automatic generation method in jade carving path according to claim 1, which is characterized in that the step 3), comprising:
The apex coordinate in region to be carved is mapped in pattern matrix, using formula,
Obtain seat of the vertex in region to be carved in pattern matrix Mark, and obtain respective coordinates of the apex coordinate in region to be carved in pattern matrix, wherein
PiIt .x is the abscissa N with i-th point after mappingi.x corresponding abscissa;P00.x exist for the coordinate origin of CNC model The abscissa of corresponding point in pattern matrix;NiIt .x is i-th point of abscissa;I is serial number a little;Image_scale is figure The scale bar of piece;PiIt .y is the ordinate N with i-th point after mappingi.x corresponding ordinate;P00It .y is the seat of CNC model Mark the ordinate of origin corresponding point in pattern matrix;NiIt .y is i-th point of ordinate;N is region vertex to be carved Quantity;
Judge the minimum value of the abscissa of respective coordinates of the apex coordinate in pattern matrix and the maximum value of ordinate Whether it is in the range of pattern matrix;If it is not, determining to need to extend pattern matrix, and execute step 5);If so, determining not It needs to extend pattern matrix, then executes step 4).
4. a kind of automatic generation method in jade carving path according to claim 1, which is characterized in that in extension pattern During matrix, the columns of the pixel of extended matrix is updated using following formula:
Wherein,
Mat_extend.cols is the columns of the pixel of extended matrix;NDst_rect_min_x is the vertex in region to be carved The abscissa minimum value of respective coordinates of the coordinate in pattern matrix;Mat_src.cols is the pixel columns of pattern matrix;
The line number of the pixel of extended matrix is updated using following formula:
Wherein,
Mat_extend.rows is the line number of the pixel of extended matrix;NDst_rect_max_y is the vertex in region to be carved The ordinate maximum value of respective coordinates of the coordinate in pattern matrix;Mat_src.rows is the pixel line number of pattern matrix.
5. a kind of automatic generation method in jade carving path according to claim 1, which is characterized in that the step 5), comprising:
The noise in extended matrix is removed, and gray processing, binary conversion treatment are carried out to extended matrix, obtains two-value gray matrix;
Obtain the minimum circumscribed rectangle of the pixel corresponding with engraving content in the two-value gray matrix;
According to the height in the region wide, to be carved in region to be carved, minimum circumscribed rectangle is wide and the height of minimum circumscribed rectangle, utilizes Formula,Obtain region to be carved High height relative to the minimum circumscribed rectangle of the width relative to the wide ratio and region to be carved of the minimum circumscribed rectangle Ratio, wherein
Width_scale is the wide wide ratio relative to minimum circumscribed rectangle in region to be carved;rRect_ Dst.size.width is the width in region to be carved;Min_distance is minimum safe distance;Image_scale is picture Scale bar;RRect_before.size.width is the width of minimum circumscribed rectangle;Height_scale is the height in region to be carved High ratio relative to minimum circumscribed rectangle;RRect_dst.size.height is the height in region to be carved;rRect_ Before.size.height is the height of minimum circumscribed rectangle;
By the height of the wide wide ratio and region to be carved relative to the minimum circumscribed rectangle in region to be carved relative to institute State scaling of the smaller value in the high ratio of minimum circumscribed rectangle as pattern matrix, and according to the scaling and The size of the minimum circumscribed rectangle of pattern matrix, using formula,Obtain the central point of target rectangle The width and height of coordinate and target rectangle, wherein
RRect_after.angle is the angle of target rectangle;RRect_dst.angle is the angle in region to be carved; RRect_after.center is the center of target rectangle;RRect_dst.center is the center in region to be carved;rRect_ After.size.width is the width of target rectangle;RRect_before.size.width is the width of minimum circumscribed rectangle; Shrink_scale is scaling;For the height of target rectangle;rRect_ Before.size.height is the height of minimum circumscribed rectangle;
According to the corresponding relationship between target rectangle and minimum circumscribed rectangle, obtain between target rectangle and minimum circumscribed rectangle Affine transformation matrix, and radiation transformation is carried out to minimum circumscribed rectangle according to the affine transformation matrix;
Path is carved according to the Coordinate generation of the pixel of the minimum circumscribed rectangle after affine transformation.
6. a kind of automatically generating device in jade carving path, which is characterized in that described device includes:
First obtains module, for obtaining the apex coordinate in region to be carved on jade;
The picture containing engraving content is loaded into matrix, obtains pattern matrix;
First judgment module, for the coordinate in region to be carved and pattern to be carved to be transformed into the same coordinate system, according to Whether the apex coordinate of carving area is located in pattern matrix after mapping, judges whether to need to expand pattern matrix Exhibition;
Expansion module, for extending pattern matrix in the case where the judging result of first judgment module, which is, is;
Second obtains module, for the corresponding pixel points in pattern matrix to be mapped in region to be carved, after obtaining mapping The coordinate of pixel carves path according to Coordinate generation of the pixel after mapping in region to be carved.
7. a kind of automatically generating device in jade carving path according to claim 6, which is characterized in that described first obtains Modulus block, is used for:
Judge that can the apex coordinate in region to be carved form setting shape, if so, obtaining the vertex in region to be carved on jade Coordinate obtains pattern matrix, wherein the shape that sets is square if it is not, loading the picture containing engraving content into matrix Shape.
8. a kind of automatically generating device in jade carving path according to claim 6, which is characterized in that described first sentences Disconnected module, is used for:
The apex coordinate in region to be carved is mapped in pattern matrix, using formula,Coordinate of the vertex in region to be carved in pattern matrix is obtained, and Obtain the abscissa minimum value of respective coordinates of the apex coordinate in region to be carved in pattern matrix and the maximum of ordinate Value, wherein
PiIt .x is the abscissa N with i-th point after mappingi.x corresponding abscissa;P00.x exist for the coordinate origin of CNC model The abscissa of corresponding point in pattern matrix;NiIt .x is i-th point of abscissa;I is serial number a little;Image_scale is figure The scale bar of piece;PiIt .y is the ordinate N with i-th point after mappingi.x corresponding ordinate;P00It .y is the seat of CNC model Mark the ordinate of origin corresponding point in pattern matrix;NiIt .y is i-th point of ordinate;N is region vertex to be carved Quantity;
Judge the minimum value of the abscissa of respective coordinates of the apex coordinate in pattern matrix and the maximum value of ordinate Whether it is in the range of pattern matrix;If it is not, determining to need to extend pattern matrix, and execute step 5);If so, determining not It needs to extend pattern matrix, then executes step 4).
9. a kind of automatically generating device in jade carving path according to claim 6, which is characterized in that expansion module, For:
Using formula, the columns of the pixel of extended matrix is updated
Wherein,
Mat_extend.cols is the columns of the pixel of extended matrix;NDst_rect_min_x is the vertex in region to be carved The abscissa minimum value of respective coordinates of the coordinate in pattern matrix;Mat_src.cols is the pixel columns of pattern matrix;
The line number of the pixel of extended matrix is updated using following formula:
Wherein,
Mat_extend.rows is the line number of the pixel of extended matrix;NDst_rect_max_y is the vertex in region to be carved The ordinate maximum value of respective coordinates of the coordinate in pattern matrix;Mat_src.rows is the pixel line number of pattern matrix.
10. a kind of automatically generating device in jade carving path according to claim 6, which is characterized in that described second Module is obtained, is used for:
The noise in extended matrix is removed, and gray processing, binary conversion treatment are carried out to extended matrix, obtains two-value gray matrix;
Obtain the minimum circumscribed rectangle of the pixel corresponding with engraving content in the two-value gray matrix;
According to the height in the region wide, to be carved in region to be carved, minimum circumscribed rectangle is wide and the height of minimum circumscribed rectangle, utilizes Formula,Obtain region to be carved High height relative to the minimum circumscribed rectangle of the width relative to the wide ratio and region to be carved of the minimum circumscribed rectangle Ratio, wherein
Width_scale is the wide wide ratio relative to minimum circumscribed rectangle in region to be carved;rRect_ Dst.size.width is the width in region to be carved;Min_distance is minimum safe distance;Image_scale is picture Scale bar;RRect_before.size.width is the width of minimum circumscribed rectangle;Height_scale is the height in region to be carved High ratio relative to minimum circumscribed rectangle;RRect_dst.size.height is the height in region to be carved;rRect_ Before.size.height is the height of minimum circumscribed rectangle;
By the height of the wide wide ratio and region to be carved relative to the minimum circumscribed rectangle in region to be carved relative to institute State scaling of the smaller value in the high ratio of minimum circumscribed rectangle as pattern matrix, and according to the scaling and The size of the minimum circumscribed rectangle of pattern matrix, using formula,Obtain the central point of target rectangle The width and height of coordinate and target rectangle, wherein
RRect_after.angle is the angle of target rectangle;RRect_dst.angle is the angle in region to be carved; RRect_after.center is the center of target rectangle;RRect_dst.center is the center in region to be carved;rRect_ After.size.width is the width of target rectangle;RRect_before.size.width is the width of minimum circumscribed rectangle; Shrink_scale is scaling;For the height of target rectangle;rRect_ Before.size.height is the height of minimum circumscribed rectangle;
According to the corresponding relationship between target rectangle and minimum circumscribed rectangle, obtain between target rectangle and minimum circumscribed rectangle Affine transformation matrix, and radiation transformation is carried out to minimum circumscribed rectangle according to the affine transformation matrix;
Path is carved according to the Coordinate generation of the pixel of the minimum circumscribed rectangle after affine transformation.
CN201910449830.5A 2019-05-28 2019-05-28 A kind of automatic generation method and device in jade carving path Pending CN110356151A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201910449830.5A CN110356151A (en) 2019-05-28 2019-05-28 A kind of automatic generation method and device in jade carving path

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201910449830.5A CN110356151A (en) 2019-05-28 2019-05-28 A kind of automatic generation method and device in jade carving path

Publications (1)

Publication Number Publication Date
CN110356151A true CN110356151A (en) 2019-10-22

Family

ID=68214923

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201910449830.5A Pending CN110356151A (en) 2019-05-28 2019-05-28 A kind of automatic generation method and device in jade carving path

Country Status (1)

Country Link
CN (1) CN110356151A (en)

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112991221A (en) * 2021-03-30 2021-06-18 珠海必要工业科技股份有限公司 Method and device for correcting UV expansion diagram of specially-shaped customized area
CN113836770A (en) * 2021-09-28 2021-12-24 方丽颖 Method and device for tool breakpoint resuming processing, computer device and computer readable storage medium
CN114550541A (en) * 2022-03-07 2022-05-27 苏州探寻文化科技有限公司 Digital calligraphy experience equipment and system
CN115846890A (en) * 2023-03-01 2023-03-28 深圳市镭沃自动化科技有限公司 Control method of laser etching equipment, laser etching equipment and computer readable storage medium

Citations (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101593362A (en) * 2008-05-26 2009-12-02 新奥特(北京)视频技术有限公司 A kind of path construction method of figure
CN104143209A (en) * 2014-06-20 2014-11-12 浙江工业大学 Method for engraving three-dimensional model based on line pattern
CN104268337A (en) * 2014-09-24 2015-01-07 中广核(北京)仿真技术有限公司 Method and system for generating path of simulation support platform image connecting line
US20160210768A1 (en) * 2015-01-15 2016-07-21 Qualcomm Incorporated Text-based image resizing
CN107507258A (en) * 2017-08-11 2017-12-22 西安精雕软件科技有限公司 It is a kind of that path generating method is carved based on a curve for string fitting
CN107909544A (en) * 2017-10-31 2018-04-13 珠海丹德图像技术有限公司 A kind of method for correcting image and system
CN108762195A (en) * 2018-07-19 2018-11-06 沈阳工程学院 A kind of path generating method of curved surface dynamic compensation engraving
CN108932387A (en) * 2018-07-06 2018-12-04 广东三维家信息科技有限公司 A method of gate is simulated based on feed path in real time
CN109624574A (en) * 2018-11-20 2019-04-16 广东智媒云图科技股份有限公司 A kind of engraving path generating method and device for leaf carving

Patent Citations (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101593362A (en) * 2008-05-26 2009-12-02 新奥特(北京)视频技术有限公司 A kind of path construction method of figure
CN104143209A (en) * 2014-06-20 2014-11-12 浙江工业大学 Method for engraving three-dimensional model based on line pattern
CN104268337A (en) * 2014-09-24 2015-01-07 中广核(北京)仿真技术有限公司 Method and system for generating path of simulation support platform image connecting line
US20160210768A1 (en) * 2015-01-15 2016-07-21 Qualcomm Incorporated Text-based image resizing
CN107507258A (en) * 2017-08-11 2017-12-22 西安精雕软件科技有限公司 It is a kind of that path generating method is carved based on a curve for string fitting
CN107909544A (en) * 2017-10-31 2018-04-13 珠海丹德图像技术有限公司 A kind of method for correcting image and system
CN108932387A (en) * 2018-07-06 2018-12-04 广东三维家信息科技有限公司 A method of gate is simulated based on feed path in real time
CN108762195A (en) * 2018-07-19 2018-11-06 沈阳工程学院 A kind of path generating method of curved surface dynamic compensation engraving
CN109624574A (en) * 2018-11-20 2019-04-16 广东智媒云图科技股份有限公司 A kind of engraving path generating method and device for leaf carving

Cited By (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112991221A (en) * 2021-03-30 2021-06-18 珠海必要工业科技股份有限公司 Method and device for correcting UV expansion diagram of specially-shaped customized area
CN112991221B (en) * 2021-03-30 2022-10-18 必要鸿源(北京)科技有限公司 Method and device for correcting UV expansion diagram of specially-shaped customized area
CN113836770A (en) * 2021-09-28 2021-12-24 方丽颖 Method and device for tool breakpoint resuming processing, computer device and computer readable storage medium
CN113836770B (en) * 2021-09-28 2023-09-12 方丽颖 Method, apparatus, computer device and computer readable storage medium for tool breakpoint resume processing
CN114550541A (en) * 2022-03-07 2022-05-27 苏州探寻文化科技有限公司 Digital calligraphy experience equipment and system
CN115846890A (en) * 2023-03-01 2023-03-28 深圳市镭沃自动化科技有限公司 Control method of laser etching equipment, laser etching equipment and computer readable storage medium

Similar Documents

Publication Publication Date Title
CN110356151A (en) A kind of automatic generation method and device in jade carving path
CN106875546B (en) A kind of recognition methods of VAT invoice
US9449253B2 (en) Learning painting styles for painterly rendering
CN108764195A (en) Handwriting model training method, hand-written character recognizing method, device, equipment and medium
CN1234565A (en) Identifying method and system for handwritten characters
CN101615244A (en) Handwritten plate blank numbers automatic identifying method and recognition device
CN109871851A (en) A kind of Chinese-character writing normalization determination method based on convolutional neural networks algorithm
CN103279936A (en) Human face fake photo automatic combining and modifying method based on portrayal
CN106446885A (en) Paper-based Braille recognition method and system
CN111144270B (en) Neural network-based handwritten text integrity evaluation method and evaluation device
CN105459719A (en) Manufacturing method and device for three-dimensional oil painting
CN106056055A (en) Sanskrit Tibetan online handwritten sample generation method based on component combination
CN103021025A (en) Image generating method by means of computer program
CN111583412B (en) Method for constructing calligraphy relief deep learning network and method for constructing calligraphy relief
CN106204683A (en) The ocean density map method for drafting with meta graph recognition is rendered based on GIS symbol
CN107122785A (en) Text identification method for establishing model and device
KR100308856B1 (en) Method and apparatus for character recognition
CN108897912B (en) Hole decorative plate design and arrangement method based on circular piles
CN107480379B (en) A kind of manufacturing method of the evaluation optimization decorative panel based on picture structure similitude
CN105335685A (en) Image identification method and apparatus
KR101008950B1 (en) A method for manufacturing of calligraphy-woodcarving artwork using anatomical micro structure of wood
CN112765935B (en) Character appearance personalized processing method and system
CN112434763A (en) Chinese character skeleton generating method based on computer
Stamati et al. Using Poxels for reproducing traditional pierced Byzantine jewellery
CN112765935A (en) Character shape personalization processing method and 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