技术领域Technical field
本发明涉及自动机床的运动和加工技术领域,尤其涉及一种基于图像处理的G代码控制轴组运动方法及系统。The present invention relates to the technical field of movement and processing of automatic machine tools, and in particular to a method and system for controlling the movement of an axis group based on G code based on image processing.
背景技术Background technique
G代码是一种利用预设的轨迹进行运动的技术,广泛应用于工业、艺术、教育等领域,主要用于控制自动机床的运动和加工。目前生成G代码的途径主要有两种,一种是基于矢量图形的方法,即将目标图形用线段、曲线等几何元素表示,然后根据几何元素的坐标、方向、长度等属性生成G代码;另一种是基于位图图形的方法,即将目标图形用像素点阵表示,然后根据像素点的灰度值或颜色值生成G代码。这两种方法各有优缺点,基于矢量图形的方法能保持图形的清晰度和精度,但对于复杂或不规则的图形难以表示;基于位图图形的方法能表示任意图形,但会造成图形的失真和锯齿效果。G code is a technology that uses preset trajectories to move. It is widely used in industry, art, education and other fields. It is mainly used to control the movement and processing of automatic machine tools. At present, there are two main ways to generate G code. One is a method based on vector graphics, which means that the target graphic is represented by geometric elements such as line segments and curves, and then the G code is generated based on the coordinates, direction, length and other attributes of the geometric elements; the other is The first is a method based on bitmap graphics, that is, the target graphics is represented by a pixel matrix, and then the G code is generated based on the gray value or color value of the pixel. Both methods have their own advantages and disadvantages. The method based on vector graphics can maintain the clarity and accuracy of graphics, but it is difficult to represent complex or irregular graphics; the method based on bitmap graphics can represent arbitrary graphics, but it will cause distortion of graphics. Distortion and aliasing effects.
博图软件是西门子推出的一款集成式自动化工程软件,用于开发和管理工业自动化应用。博图软件支持PLC编程、HMI开发、驱动器配置等功能,可以实现对自动化系统的全面控制。然而,博图软件也存在一些问题,其中之一就是无法自己快速大批量生成连续运动路径,需要浪费大量人力来示教轴点位。这意味着用户如果要做一个复杂的图形运动需要手动设置每个轴的运动参数,如速度、加速度、位置等,然后通过示教器或触摸屏来控制轴的运动,并记录下每个点位的数据。这样做不仅效率低下,而且容易出错,还增加了人力成本和维护难度。因此,亟需一种高效的运动路径生成方法。Botu software is an integrated automation engineering software launched by Siemens for developing and managing industrial automation applications. Botu software supports PLC programming, HMI development, driver configuration and other functions, which can achieve comprehensive control of the automation system. However, Botu software also has some problems. One of them is that it cannot quickly generate continuous motion paths in large batches by itself, and it requires a lot of manpower to teach axis points. This means that if the user wants to make a complex graphic movement, he or she needs to manually set the movement parameters of each axis, such as speed, acceleration, position, etc., and then control the movement of the axis through the teach pendant or touch screen, and record each point. The data. This is not only inefficient and error-prone, but also increases labor costs and maintenance difficulty. Therefore, an efficient motion path generation method is urgently needed.
发明内容Contents of the invention
为此,本发明实施例提供了一种基于图像处理的G代码控制轴组运动方法及系统,用于解决现有技术中博图软件无法自己快速大批量生成连续运动路径,需要浪费大量人力来示教轴点位;不仅效率低下,而且容易出错,还增加了人力成本和维护难度等问题。To this end, embodiments of the present invention provide an image processing-based G code control axis group movement method and system, which is used to solve the problem in the existing technology that Botu software cannot quickly generate continuous movement paths in large quantities by itself, and needs to waste a lot of manpower to display Teaching axis points is not only inefficient and error-prone, but also increases labor costs and maintenance difficulty.
为了解决上述问题,本发明实施例提供一种基于图像处理的G代码控制轴组运动方法,所述方法包括:In order to solve the above problems, embodiments of the present invention provide a method for controlling the movement of an axis group based on G code based on image processing. The method includes:
步骤S1:获取目标图片;Step S1: Obtain the target image;
步骤S2:将所述目标图片转换成灰度图;Step S2: Convert the target image into a grayscale image;
步骤S3:将灰度图中的黑色部分描摹成矢量路径,得到由线段和曲线组成的轮廓,并设置合适的图片阈值,调整描摹后图片中黑色部分和白色部分的比例;Step S3: Trace the black part in the grayscale image into a vector path to obtain an outline composed of line segments and curves, set an appropriate image threshold, and adjust the ratio of the black part to the white part in the traced image;
步骤S4:将描摹后图片中的矢量路径分解成单独的线段和曲线,并去除重复或多余的部分;Step S4: Decompose the vector path in the traced image into separate line segments and curves, and remove duplicate or redundant parts;
步骤S5:根据分解后图片中的线段和曲线生成相应的G代码,并保存为G代码文本文件;Step S5: Generate the corresponding G code based on the line segments and curves in the decomposed picture, and save it as a G code text file;
步骤S6:从G代码文本文件中提取出轴组需要的位置信息;Step S6: Extract the position information required for the axis group from the G code text file;
步骤S7:将位置信息转换成轴组能识别和执行的数据块,并保存为二进制文件,将数据块二进制文件传输给轴组,生成轴组运动路径。Step S7: Convert the position information into a data block that can be recognized and executed by the axis group, and save it as a binary file. Transfer the data block binary file to the axis group to generate the motion path of the axis group.
优选地,在步骤S2中,将所述目标图片转换成灰度图的方法为:Preferably, in step S2, the method of converting the target picture into a grayscale image is:
使用Adobe Illustrator软件中的灰度模式功能,将目标图片转换成灰度图,所述灰度图为仅包括黑白两种颜色的图片。Use the grayscale mode function in Adobe Illustrator software to convert the target image into a grayscale image. The grayscale image is a picture that only includes black and white.
优选地,在步骤S3中,将灰度图中的黑色部分描摹成矢量路径,得到由线段和曲线组成的轮廓的方法:Preferably, in step S3, the black part in the grayscale image is traced into a vector path to obtain an outline composed of line segments and curves:
使用Adobe Illustrator软件中的描摹功能,将灰度图中的黑色部分描摹成矢量路径,得到由线段和曲线组成的轮廓。Use the tracing function in Adobe Illustrator software to trace the black part of the grayscale image into a vector path to obtain an outline composed of line segments and curves.
优选地,在步骤S3中,设置合适的图片阈值,调整描摹后图片中黑色部分和白色部分的比例的方法为:Preferably, in step S3, an appropriate image threshold is set, and the method for adjusting the ratio of the black part and the white part in the traced image is:
使用Adobe Illustrator软件中的阈值功能,调整描摹后图片中黑色部分和白色部分的比例,使得描摹后图片更加清晰和简洁。Use the threshold function in Adobe Illustrator software to adjust the ratio of black and white parts in the traced image to make the traced image clearer and more concise.
优选地,在步骤S4中,将描摹后图片中的矢量路径分解成单独的线段和曲线,并去除重复或多余的部分的方法为:Preferably, in step S4, the method of decomposing the vector path in the traced picture into separate line segments and curves, and removing duplicate or redundant parts is:
使用CAD软件中的分解功能,将描摹后图片中的矢量路径分解成单独的线段和曲线,并去除重复或多余的部分。Use the decomposition function in the CAD software to decompose the vector path in the traced picture into separate line segments and curves, and remove duplicate or redundant parts.
优选地,在步骤S5中,根据分解后图片中的线段和曲线生成相应的G代码,并保存为G代码文本文件的方法为:Preferably, in step S5, the method of generating corresponding G codes based on the line segments and curves in the decomposed picture and saving them as G code text files is:
使用Codesys软件中的G代码生成功能,根据分解后图片中的线段和曲线生成相应的G代码,并保存为G代码文本文件。Use the G code generation function in Codesys software to generate corresponding G codes based on the line segments and curves in the decomposed pictures, and save them as G code text files.
优选地,在步骤S6中,从G代码文本文件中提取出轴组需要的位置信息的方法为:Preferably, in step S6, the method for extracting the position information required for the axis group from the G code text file is:
使用EXCEL软件中的数据处理功能,从G代码文本文件中提取出轴组需要的位置信息。Use the data processing function in EXCEL software to extract the position information required for the axis group from the G code text file.
优选地,所述位置信息包括每个线段或曲线起始点和终止点的坐标。Preferably, the position information includes the coordinates of the starting point and the ending point of each line segment or curve.
优选地,在步骤S7中,将位置信息转换成轴组能识别和执行的数据块,并保存为二进制文件的方法为:Preferably, in step S7, the method of converting the position information into a data block that can be recognized and executed by the axis group and saving it as a binary file is:
使用G-Code_to_mypath软件中的转换功能,将位置信息转换成轴组能识别和执行的数据块,并保存为二进制文件。Use the conversion function in the G-Code_to_mypath software to convert the position information into a data block that the axis group can recognize and execute, and save it as a binary file.
本发明实施例还提供了一种基于图像处理的G代码控制轴组运动系统,用于实现上述所述的基于图像处理的G代码控制轴组运动方法,所述系统包括:Embodiments of the present invention also provide an image processing-based G code control axis group motion system for implementing the above image processing-based G code control axis group motion method. The system includes:
图片获取模块,用于获取目标图片;Image acquisition module, used to acquire target images;
图片灰度化模块,用于将所述目标图片转换成灰度图;A picture grayscale module, used to convert the target picture into a grayscale image;
轮廓描摹模块,用于将灰度图中的黑色部分描摹成矢量路径,得到由线段和曲线组成的轮廓,并设置合适的图片阈值,调整描摹后图片中黑色部分和白色部分的比例;The contour tracing module is used to trace the black part in the grayscale image into a vector path to obtain an outline composed of line segments and curves, set an appropriate image threshold, and adjust the ratio of the black part to the white part in the traced image;
图片分解模块,用于将描摹后图片中的矢量路径分解成单独的线段和曲线,并去除重复或多余的部分;The image decomposition module is used to decompose the vector path in the traced image into separate line segments and curves, and remove duplicate or redundant parts;
G代码生成模块,用于根据分解后图片中的线段和曲线生成相应的G代码,并保存为G代码文本文件;The G code generation module is used to generate corresponding G codes based on the line segments and curves in the decomposed pictures and save them as G code text files;
位置信息提取模块,用于从G代码文本文件中提取出轴组需要的位置信息;The position information extraction module is used to extract the position information required by the axis group from the G code text file;
轴组运动路径生成模块,用于将位置信息转换成轴组能识别和执行的数据块,并保存为二进制文件,将数据块二进制文件传输给轴组,生成轴组运动路径。The axis group motion path generation module is used to convert the position information into a data block that the axis group can recognize and execute, and save it as a binary file. The data block binary file is transferred to the axis group to generate the axis group motion path.
本发明实施例还提供了一种电子装置,所述电子装置包括处理器、存储器和总线系统,所述处理器和存储器通过该总线系统相连,所述存储器用于存储指令,所述处理器用于执行存储器存储的指令,以实现上述所述的基于图像处理的G代码控制轴组运动方法。An embodiment of the present invention also provides an electronic device. The electronic device includes a processor, a memory and a bus system. The processor and the memory are connected through the bus system. The memory is used to store instructions, and the processor is used to store instructions. Execute the instructions stored in the memory to implement the above-mentioned image processing-based G code control axis group movement method.
本发明实施例还提供了一种计算机存储介质,所述计算机存储介质存储有计算机软件产品,所述计算机软件产品包括的若干指令,用以使得一台计算机设备执行上述所述的基于图像处理的G代码控制轴组运动方法。Embodiments of the present invention also provide a computer storage medium, which stores computer software products. The computer software products include several instructions to cause a computer device to execute the above-mentioned image processing-based method. G code controls the movement method of the axis group.
从以上技术方案可以看出,本发明申请具有以下优点:It can be seen from the above technical solutions that the application of the present invention has the following advantages:
本发明实施例提供了一种基于图像处理的G代码控制轴组运动方法及系统,本发明能够将任意图片转换为G代码,并用轴组进行绘制,实现了图像处理和轴组运动的融合,提高了轴组运动的灵活性和效率;本发明利用Adobe Illustrator软件中的灰度模式、描摹、阈值等功能,对目标图片进行了优化处理,使得图片更加清晰和简洁,减少了图形的失真和锯齿效果;本发明利用CAD软件中的分解功能,将描摹后图片中的矢量路径分解成单独的线段和曲线,并去除重复或多余的部分,减少了G代码的数量和复杂度;本发明利用Codesys软件中的G代码生成功能,根据分解后图片中的线段和曲线生成相应的G代码,并保存为文本文件,方便了后续的数据处理和传输;本发明利用EXCEL软件中的数据处理功能,从G代码文本文件中提取出轴组需要的位置信息,即每个线段或曲线起始点和终止点的坐标,简化了数据格式和内容;本发明利用G-Code_to_mypath软件中的转换功能,将位置信息转换成轴组能识别和执行的数据块,并保存为二进制文件,实现了数据与轴组之间的有效对接。本发明能够根据用户的图形需求,自动生成连续运动路径,并自动分配轴点位。因此,用户只需要提供一张符合标准的图形,就可以得到一个优化的运动方案,无需进行繁琐的示教操作。本发明不仅可以提高生产效率和质量,还可以节省人力资源和时间。Embodiments of the present invention provide a method and system for controlling the motion of an axis group based on G code based on image processing. The present invention can convert any picture into a G code and use the axis group for drawing, realizing the integration of image processing and axis group motion. The flexibility and efficiency of the movement of the axis group are improved; the present invention utilizes the grayscale mode, tracing, threshold and other functions in the Adobe Illustrator software to optimize the target picture, making the picture clearer and more concise, and reducing the distortion and distortion of the graphics. Jagged effect; this invention uses the decomposition function in CAD software to decompose the vector path in the traced picture into separate line segments and curves, and removes duplicate or redundant parts, reducing the number and complexity of G codes; this invention uses The G code generation function in Codesys software generates corresponding G codes based on the line segments and curves in the decomposed pictures and saves them as text files, which facilitates subsequent data processing and transmission; the present invention uses the data processing function in EXCEL software to The position information required for the axis group is extracted from the G code text file, that is, the coordinates of the starting point and ending point of each line segment or curve, which simplifies the data format and content; the present invention uses the conversion function in the G-Code_to_mypath software to convert the position The information is converted into data blocks that can be recognized and executed by the axis group, and saved as a binary file, realizing effective connection between the data and the axis group. The invention can automatically generate a continuous motion path and automatically assign axis points according to the user's graphics requirements. Therefore, users only need to provide a graphic that meets the standard to get an optimized motion plan without the need for cumbersome teaching operations. The invention can not only improve production efficiency and quality, but also save human resources and time.
附图说明Description of the drawings
为了更清楚地说明本发明实施案例或现有技术中的技术方案,下边将对实施例中所需要使用的附图做简单说明,通过参考附图会更清楚的理解本发明的特征和优点,附图是示意性的而不应该理解为对本发明进行任何限制,对于本领域普通技术人员来讲,在不付出创造性劳动的前提下,可以根据这些附图获得其他的附图。其中:In order to more clearly illustrate implementation examples of the present invention or technical solutions in the prior art, the following will briefly describe the drawings required in the embodiments. The features and advantages of the present invention will be more clearly understood by referring to the drawings. The drawings are schematic and should not be construed as limiting the invention in any way. For those of ordinary skill in the art, other drawings can be obtained based on these drawings without exerting creative efforts. in:
图1为根据实施例中提供的一种基于图像处理的G代码控制轴组运动方法的流程图;Figure 1 is a flow chart of a method for controlling the motion of an axis group based on G code based on image processing provided in the embodiment;
图2为根据实施例中提供的一种基于图像处理的G代码控制轴组运动系统的框图。FIG. 2 is a block diagram of a G-code control axis group motion system based on image processing provided in the embodiment.
说明书附图标记:10、图片获取模块;20、图片灰度化模块;30、轮廓描摹模块;40、图片分解模块;50、G代码生成模块;60、位置信息提取模块;70、轴组运动路径生成模块。Reference numbers in the manual: 10. Image acquisition module; 20. Image grayscale module; 30. Contour tracing module; 40. Image decomposition module; 50. G code generation module; 60. Position information extraction module; 70. Axis group movement Path generation module.
具体实施方式Detailed ways
为使本发明实施例的目的、技术方案与优点更加清楚,下面将结合本发明实施例中的附图,对本发明实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例是本发明一部分实施例,而不是全部的实施例。基于本发明中的实施例,本领域普通技术人员在没有做出创造性劳动前提下所获得的所有其他实施例,都属于本发明保护的范围。In order to make the purpose, technical solutions and advantages of the embodiments of the present invention clearer, the technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention. Obviously, the described embodiments These are some embodiments of the present invention, rather than all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those of ordinary skill in the art without creative efforts fall within the scope of protection of the present invention.
实施例一Embodiment 1
针对博图软件无法自己快速大批量生成连续运动路径,需要浪费大量人力来示教轴点位;不仅效率低下,而且容易出错,还增加了人力成本和维护难度等问题。如图1所示,本发明实施例提出一种基于图像处理的G代码控制轴组运动方法,该方法包括:As Botu software cannot generate continuous motion paths quickly and in large quantities, it requires a lot of manpower to teach axis points. This is not only inefficient, but also error-prone, and also increases labor costs and maintenance difficulty. As shown in Figure 1, an embodiment of the present invention proposes a method for controlling the movement of an axis group based on G code based on image processing. The method includes:
步骤S1:获取目标图片;Step S1: Obtain the target image;
步骤S2:将所述目标图片转换成灰度图;Step S2: Convert the target image into a grayscale image;
步骤S3:将灰度图中的黑色部分描摹成矢量路径,得到由线段和曲线组成的轮廓,并设置合适的图片阈值,调整描摹后图片中黑色部分和白色部分的比例;Step S3: Trace the black part in the grayscale image into a vector path to obtain an outline composed of line segments and curves, set an appropriate image threshold, and adjust the ratio of the black part to the white part in the traced image;
步骤S4:将描摹后图片中的矢量路径分解成单独的线段和曲线,并去除重复或多余的部分;Step S4: Decompose the vector path in the traced image into separate line segments and curves, and remove duplicate or redundant parts;
步骤S5:根据分解后图片中的线段和曲线生成相应的G代码,并保存为G代码文本文件;Step S5: Generate the corresponding G code based on the line segments and curves in the decomposed picture, and save it as a G code text file;
步骤S6:从G代码文本文件中提取出轴组需要的位置信息;Step S6: Extract the position information required for the axis group from the G code text file;
步骤S7:将位置信息转换成轴组能识别和执行的数据块,并保存为二进制文件,将数据块二进制文件传输给轴组,生成轴组运动路径。Step S7: Convert the position information into a data block that can be recognized and executed by the axis group, and save it as a binary file. Transfer the data block binary file to the axis group to generate the motion path of the axis group.
从以上技术方案可知,本发明提供了一种基于图像处理的G代码控制轴组运动方法,本发明利用Adobe Illustrator软件中的灰度模式、描摹、阈值等功能,对目标图片进行了优化处理,使得图片更加清晰和简洁,减少了图形的失真和锯齿效果;利用CAD软件中的分解功能,将描摹后图片中的矢量路径分解成单独的线段和曲线,并去除重复或多余的部分,减少了G代码的数量和复杂度;利用Codesys软件中的G代码生成功能,根据分解后图片中的线段和曲线生成相应的G代码,并保存为文本文件,方便了后续的数据处理和传输;利用EXCEL软件中的数据处理功能,从G代码文本文件中提取出轴组需要的位置信息,即每个线段或曲线起始点和终止点的坐标,简化了数据格式和内容;利用G-Code_to_mypath软件中的转换功能,将位置信息转换成轴组能识别和执行的数据块,并保存为二进制文件,实现了数据与轴组之间的有效对接。本发明能够将任意图片转换为G代码,并用轴组进行绘制,实现了图像处理和轴组运动的融合,提高了轴组运动的灵活性和效率。本发明能够根据用户的图形需求,自动生成连续运动路径,并自动分配轴点位。因此,用户只需要提供一张符合标准的图形,就可以得到一个优化的运动方案,无需进行繁琐的示教操作。本发明不仅可以提高生产效率和质量,还可以节省人力资源和时间。It can be seen from the above technical solutions that the present invention provides a G code control axis group movement method based on image processing. The present invention uses the grayscale mode, tracing, threshold and other functions in Adobe Illustrator software to optimize the target picture. It makes the picture clearer and more concise, reducing the distortion and jagged effects of the graphics; using the decomposition function in the CAD software, the vector path in the traced picture is decomposed into separate line segments and curves, and the repeated or redundant parts are removed, reducing the The number and complexity of G codes; use the G code generation function in Codesys software to generate corresponding G codes based on the line segments and curves in the decomposed pictures, and save them as text files, which facilitates subsequent data processing and transmission; use EXCEL The data processing function in the software extracts the position information required for the axis group from the G-code text file, that is, the coordinates of the starting point and ending point of each line segment or curve, simplifying the data format and content; use the G-Code_to_mypath software The conversion function converts the position information into a data block that can be recognized and executed by the axis group, and saves it as a binary file, realizing effective connection between the data and the axis group. The invention can convert any picture into G code and use the axis group for drawing, realizes the integration of image processing and axis group movement, and improves the flexibility and efficiency of the axis group movement. The invention can automatically generate a continuous motion path and automatically assign axis points according to the user's graphics requirements. Therefore, users only need to provide a graphic that meets the standard to get an optimized motion plan without the need for cumbersome teaching operations. The invention can not only improve production efficiency and quality, but also save human resources and time.
在本实施例中,在步骤S1中,根据用户的实际的图形需求,获取目标图片。In this embodiment, in step S1, the target picture is obtained according to the user's actual graphic requirements.
在本实施例中,在步骤S2中,使用Adobe Illustrator软件中的灰度模式功能,将目标图片转换成灰度图,所述灰度图为仅包括黑白两种颜色的图片。In this embodiment, in step S2, the grayscale mode function in Adobe Illustrator software is used to convert the target picture into a grayscale image. The grayscale image is a picture including only black and white.
在本实施例中,在步骤S3中,使用Adobe Illustrator软件中的描摹功能,将灰度图中的黑色部分描摹成矢量路径,得到由线段和曲线组成的轮廓。In this embodiment, in step S3, the tracing function in Adobe Illustrator software is used to trace the black part in the grayscale image into a vector path to obtain an outline composed of line segments and curves.
在本实施例中,在步骤S4中,使用Adobe Illustrator软件中的阈值功能,调整描摹后图片中黑色部分和白色部分的比例,使得描摹后图片更加清晰和简洁。In this embodiment, in step S4, the threshold function in Adobe Illustrator software is used to adjust the ratio of the black part and the white part in the traced picture, so that the traced picture is clearer and more concise.
本发明利用Adobe Illustrator软件中的灰度模式、描摹、阈值等功能,对目标图片进行了优化处理,使得图片更加清晰和简洁,减少了图形的失真和锯齿效果。The present invention utilizes the grayscale mode, tracing, threshold and other functions in Adobe Illustrator software to optimize the target picture, making the picture clearer and more concise, and reducing the distortion and jagged effects of the graphics.
在本实施例中,在步骤S5中,使用CAD软件中的分解功能,将描摹后图片中的矢量路径分解成单独的线段和曲线,并去除重复或多余的部分,减少了G代码的数量和复杂度。In this embodiment, in step S5, the decomposition function in the CAD software is used to decompose the vector path in the traced picture into separate line segments and curves, and remove duplicate or redundant parts, reducing the number of G codes and the complexity.
在本实施例中,在步骤S6中,使用EXCEL软件中的数据处理功能,从G代码文本文件中提取出轴组需要的位置信息,其中,位置信息包括每个线段或曲线起始点和终止点的坐标,简化了数据格式和内容。In this embodiment, in step S6, the data processing function in EXCEL software is used to extract the position information required for the axis group from the G code text file, where the position information includes the starting point and ending point of each line segment or curve. coordinates, simplifying data format and content.
在本实施例中,在步骤S7中,使用G-Code_to_mypath软件中的转换功能,将位置信息转换成轴组能识别和执行的数据块,并保存为二进制文件,实现了数据与轴组之间的有效对接。将数据块二进制文件传输给轴组,生成轴组运动路径,并自动分配轴点位。In this embodiment, in step S7, the conversion function in the G-Code_to_mypath software is used to convert the position information into a data block that can be recognized and executed by the axis group, and saved as a binary file, realizing the connection between the data and the axis group. effective connection. Transfer the data block binary file to the axis group, generate the axis group motion path, and automatically assign axis points.
实施例二Embodiment 2
如图2所示,本发明提供一种基于图像处理的G代码控制轴组运动系统,该系统包括:As shown in Figure 2, the present invention provides a G code control axis group motion system based on image processing. The system includes:
图片获取模块10,用于获取目标图片;Image acquisition module 10, used to acquire target images;
图片灰度化模块20,用于将所述目标图片转换成灰度图;Image grayscale module 20, used to convert the target image into a grayscale image;
轮廓描摹模块30,用于将灰度图中的黑色部分描摹成矢量路径,得到由线段和曲线组成的轮廓,并设置合适的图片阈值,调整描摹后图片中黑色部分和白色部分的比例;The contour tracing module 30 is used to trace the black part in the grayscale image into a vector path, obtain an outline composed of line segments and curves, set an appropriate image threshold, and adjust the ratio of the black part and the white part in the traced image;
图片分解模块40,用于将描摹后图片中的矢量路径分解成单独的线段和曲线,并去除重复或多余的部分;The picture decomposition module 40 is used to decompose the vector path in the traced picture into separate line segments and curves, and remove duplicate or redundant parts;
G代码生成模块50,用于根据分解后图片中的线段和曲线生成相应的G代码,并保存为G代码文本文件;The G code generation module 50 is used to generate corresponding G codes based on the line segments and curves in the decomposed pictures, and save them as G code text files;
位置信息提取模块60,用于从G代码文本文件中提取出轴组需要的位置信息;The position information extraction module 60 is used to extract the position information required for the axis group from the G code text file;
轴组运动路径生成模块70,用于将位置信息转换成轴组能识别和执行的数据块,并保存为二进制文件,将数据块二进制文件传输给轴组,生成轴组运动路径。The axis group motion path generation module 70 is used to convert the position information into a data block that the axis group can recognize and execute, and save it as a binary file. The data block binary file is transferred to the axis group to generate the axis group motion path.
本实施例的一种基于图像处理的G代码控制轴组运动系统,用于实现前述的基于图像处理的G代码控制轴组运动方法,因此基于图像处理的G代码控制轴组运动系统中的具体实施方式可见前文基于图像处理的G代码控制轴组运动方法的实施例部分,例如,图片获取模块10,图片灰度化模块20,轮廓描摹模块30,图片分解模块40,G代码生成模块50,位置信息提取模块60,轴组运动路径生成模块,分别用于实现上述基于图像处理的G代码控制轴组运动方法中步骤S1,S2,S3,S4,S5,S6,S7,所以,其具体实施方式可以参照相应的各个部分实施例的描述,为了避免冗余,在此不再赘述。The G code control axis group motion system based on image processing in this embodiment is used to implement the aforementioned G code control axis group motion method based on image processing. Therefore, the specific steps in the G code control axis group motion system based on image processing are The implementation can be seen from the embodiments of the G code control axis group movement method based on image processing, for example, the image acquisition module 10, the image grayscale module 20, the contour tracing module 30, the image decomposition module 40, and the G code generation module 50. The position information extraction module 60 and the axis group motion path generation module are respectively used to implement steps S1, S2, S3, S4, S5, S6, S7 in the above image processing-based G code control axis group motion method. Therefore, its specific implementation For the method, reference may be made to the descriptions of the corresponding partial embodiments, and to avoid redundancy, they will not be described again here.
实施例三Embodiment 3
本发明实施例还提供了一种电子装置,所述电子装置包括处理器、存储器和总线系统,所述处理器和存储器通过该总线系统相连,所述存储器用于存储指令,所述处理器用于执行存储器存储的指令,以实现上述所述的基于图像处理的G代码控制轴组运动方法。An embodiment of the present invention also provides an electronic device. The electronic device includes a processor, a memory and a bus system. The processor and the memory are connected through the bus system. The memory is used to store instructions, and the processor is used to store instructions. Execute the instructions stored in the memory to implement the above-mentioned image processing-based G code control axis group movement method.
实施例四Embodiment 4
本发明实施例还提供了一种计算机存储介质,所述计算机存储介质存储有计算机软件产品,所述计算机软件产品包括的若干指令,用以使得一台计算机设备执行上述所述的基于图像处理的G代码控制轴组运动方法。Embodiments of the present invention also provide a computer storage medium, which stores computer software products. The computer software products include several instructions to cause a computer device to execute the above-mentioned image processing-based method. G code controls the movement method of the axis group.
注意,上述仅为本发明的较佳实施例及所运用技术原理。本领域技术人员会理解,本发明不限于这里所述的特定实施例,对本领域技术人员来说能够进行各种明显的变化、重新调整和替代而不会脱离本发明的保护范围。因此,虽然通过以上实施例对本发明进行了较为详细的说明,但是本发明不仅仅限于以上实施例,在不脱离本发明构思的情况下,还可以包括更多其他等效实施例,而本发明的范围由所附的权利要求范围决定。Note that the above are only the preferred embodiments of the present invention and the technical principles used. Those skilled in the art will understand that the present invention is not limited to the specific embodiments described herein, and that various obvious changes, readjustments and substitutions can be made to those skilled in the art without departing from the scope of the invention. Therefore, although the present invention has been described in detail through the above embodiments, the present invention is not limited to the above embodiments. Without departing from the concept of the present invention, it can also include more other equivalent embodiments, and the present invention The scope is determined by the scope of the appended claims.
本领域内的技术人员应明白,本申请的实施例可提供为方法、系统、或计算机程序产品。因此,本申请可采用完全硬件实施例、完全软件实施例、或结合软件和硬件方面的实施例的形式。而且,本申请可采用在一个或多个其中包含有计算机可用程序代码的计算机可用存储介质(包括但不限于磁盘存储器、CD-ROM、光学存储器等)上实施的计算机程序产品的形式。Those skilled in the art will understand that embodiments of the present application may be provided as methods, systems, or computer program products. Accordingly, the present application may take the form of an entirely hardware embodiment, an entirely software embodiment, or an embodiment that combines software and hardware aspects. Furthermore, the present application may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, etc.) having computer-usable program code embodied therein.
本申请是参照根据本申请实施例的方法、设备(系统)、和计算机程序产品的流程图和/或方框图来描述的。应理解可由计算机程序指令实现流程图和/或方框图中的每一流程和/或方框、以及流程图和/或方框图中的流程和/或方框的结合。可提供这些计算机程序指令到通用计算机、专用计算机、嵌入式处理机或其他可编程数据处理设备的处理器以产生一个机器,使得通过计算机或其他可编程数据处理设备的处理器执行的指令产生用于实现在流程图一个流程或多个流程和/或方框图一个方框或多个方框中指定的功能的装置。The present application is described with reference to flowchart illustrations and/or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the application. It will be understood that each process and/or block in the flowchart illustrations and/or block diagrams, and combinations of processes and/or blocks in the flowchart illustrations and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable data processing device to produce a machine, such that the instructions executed by the processor of the computer or other programmable data processing device produce a use A device for realizing the functions specified in one process or multiple processes of the flowchart and/or one block or multiple blocks of the block diagram.
这些计算机程序指令也可存储在能引导计算机或其他可编程数据处理设备以特定方式工作的计算机可读存储器中,使得存储在该计算机可读存储器中的指令产生包括指令装置的制造品,该指令装置实现在流程图一个流程或多个流程和/或方框图一个方框或多个方框中指定的功能。这些计算机程序指令也可装载到计算机或其他可编程数据处理设备上,使得在计算机或其他可编程设备上执行一系列操作步骤以产生计算机实现的处理,从而在计算机或其他可编程设备上执行的指令提供用于实现在流程图一个流程或多个流程和/或方框图一个方框或多个方框中指定的功能的步骤。These computer program instructions may also be stored in a computer-readable memory that causes a computer or other programmable data processing apparatus to operate in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including the instruction means, the instructions The device implements the functions specified in a process or processes of the flowchart and/or a block or blocks of the block diagram. These computer program instructions may also be loaded onto a computer or other programmable data processing device, causing a series of operating steps to be performed on the computer or other programmable device to produce computer-implemented processing, thereby executing on the computer or other programmable device. Instructions provide steps for implementing the functions specified in a process or processes of a flowchart diagram and/or a block or blocks of a block diagram.
显然,上述实施例仅仅是为清楚地说明所作的举例,并非对实施方式的限定。对于所属领域的普通技术人员来说,在上述说明的基础上还可以做出其它不同形式变化或变动。这里无需也无法对所有的实施方式予以穷举。而由此所引申出的显而易见的变化或变动仍处于本发明创造的保护范围之中。Obviously, the above-mentioned embodiments are only examples for clear explanation and are not intended to limit the implementation. For those of ordinary skill in the art, other changes or modifications may be made based on the above description. An exhaustive list of all implementations is neither necessary nor possible. The obvious changes or modifications derived therefrom are still within the protection scope of the present invention.
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN202311358324.8ACN117453191A (en) | 2023-10-19 | 2023-10-19 | A method and system for controlling axis group movement using G code based on image processing |
| PCT/CN2023/141748WO2025081654A1 (en) | 2023-10-19 | 2023-12-26 | Method and system for using g codes to control shaft group movement on the basis of image processing |
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN202311358324.8ACN117453191A (en) | 2023-10-19 | 2023-10-19 | A method and system for controlling axis group movement using G code based on image processing |
| Publication Number | Publication Date |
|---|---|
| CN117453191Atrue CN117453191A (en) | 2024-01-26 |
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| CN202311358324.8APendingCN117453191A (en) | 2023-10-19 | 2023-10-19 | A method and system for controlling axis group movement using G code based on image processing |
| Country | Link |
|---|---|
| CN (1) | CN117453191A (en) |
| WO (1) | WO2025081654A1 (en) |
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN106020120A (en)* | 2016-07-29 | 2016-10-12 | 芜湖哈特机器人产业技术研究院有限公司 | Method for generating G code by using image based on ios system |
| US20180060045A1 (en)* | 2016-08-25 | 2018-03-01 | Arnie Foxx | Automatic graphical user interface programming system |
| CN108765378A (en)* | 2018-05-07 | 2018-11-06 | 上海理工大学 | The machine vision detection method of lower workpiece profile overlap protrusion is guided based on G code |
| CN112748700A (en)* | 2020-12-18 | 2021-05-04 | 深圳市显控科技股份有限公司 | Numerical control code generation method and device, electronic equipment and storage medium |
| CN114187276A (en)* | 2021-12-13 | 2022-03-15 | 大连理工大学 | Carbon tube array honeycomb surface shape precision calculation method based on G code processing guidance |
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| KR101665908B1 (en)* | 2016-01-29 | 2016-10-12 | 동국대학교 산학협력단 | Pre-visualization method for 3d printing |
| CN107856292B (en)* | 2017-12-20 | 2020-07-21 | 武汉星客智行科技有限公司 | A method for 3D printing based on image processing |
| CN113752544B (en)* | 2021-08-19 | 2023-11-10 | 苏州同异三维打印科技有限公司 | Bionic 3D printing method based on wood grains |
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN106020120A (en)* | 2016-07-29 | 2016-10-12 | 芜湖哈特机器人产业技术研究院有限公司 | Method for generating G code by using image based on ios system |
| US20180060045A1 (en)* | 2016-08-25 | 2018-03-01 | Arnie Foxx | Automatic graphical user interface programming system |
| CN108765378A (en)* | 2018-05-07 | 2018-11-06 | 上海理工大学 | The machine vision detection method of lower workpiece profile overlap protrusion is guided based on G code |
| CN112748700A (en)* | 2020-12-18 | 2021-05-04 | 深圳市显控科技股份有限公司 | Numerical control code generation method and device, electronic equipment and storage medium |
| CN114187276A (en)* | 2021-12-13 | 2022-03-15 | 大连理工大学 | Carbon tube array honeycomb surface shape precision calculation method based on G code processing guidance |
| CN114549521A (en)* | 2021-12-13 | 2022-05-27 | 大连理工大学 | Carbon tube array honeycomb surface shape precision calculation method based on G code processing guidance |
| Publication number | Publication date |
|---|---|
| WO2025081654A1 (en) | 2025-04-24 |
| Publication | Publication Date | Title |
|---|---|---|
| JPH04104324A (en) | Program generating device | |
| CN112669308B (en) | Image generation method, system, device and storage medium based on style migration | |
| TWI682645B (en) | Hybrid rendering hmi (human machine interface) terminal device | |
| CN101419715A (en) | Method and device for generating character or graphic dot matrix | |
| CN114266945B (en) | Training method of target detection model, target detection method and related device | |
| CN111459501A (en) | SVG-based Web configuration picture storage and display system, method and medium | |
| CN104391683A (en) | Method and device for educing model cartoon in three-dimensional software based on 3Dmax script | |
| CN112132916B (en) | Seal cutting work customized design generating device for generating countermeasure network | |
| CN117453191A (en) | A method and system for controlling axis group movement using G code based on image processing | |
| CN117253231B (en) | Oil-gas station image processing method and device, electronic equipment and storage medium | |
| CN112434763A (en) | Chinese character skeleton generating method based on computer | |
| CN112307923A (en) | Partitioned expression migration method and system | |
| CN113902018B (en) | Image sample generation method, device, computer readable medium and electronic device | |
| CN117671107A (en) | Three-dimensional model lightweight rendering method, device, electronic product and medium | |
| CN110232724A (en) | A kind of Chinese character style image vector representation method | |
| JP3211417B2 (en) | Page description language processor | |
| JP2714100B2 (en) | How to make a video | |
| CN117557240B (en) | Method, system, device and storage medium for reading jobs | |
| KR20250010763A (en) | Apparatus and method for desing building plan | |
| CN115373690A (en) | Conversion method and system for converting Emerson over into iplat configuration | |
| CN120070629A (en) | Method, device, equipment and medium for generating full-connection character plate production vector diagram of cutting process | |
| JP3004993B2 (en) | Image processing device | |
| CN120259486A (en) | A method and system for producing streaming e-commerce picture materials based on AIGC | |
| CN119399509A (en) | Efficient fine-tuning method, device, server and storage medium for pre-trained model | |
| CN118397133A (en) | Method and device for drawing, terminal equipment and computer readable storage medium |
| 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 |