[go: up one dir, main page]

CN115588018A - Image processing method and device, electronic equipment and storage medium - Google Patents

Image processing method and device, electronic equipment and storage medium Download PDF

Info

Publication number
CN115588018A
CN115588018A CN202211236456.9A CN202211236456A CN115588018A CN 115588018 A CN115588018 A CN 115588018A CN 202211236456 A CN202211236456 A CN 202211236456A CN 115588018 A CN115588018 A CN 115588018A
Authority
CN
China
Prior art keywords
image
pixel value
processed
cutting line
segmented
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
CN202211236456.9A
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.)
Fitow Tianjin Detection Technology Co Ltd
Original Assignee
Fitow Tianjin Detection 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 Fitow Tianjin Detection Technology Co Ltd filed Critical Fitow Tianjin Detection Technology Co Ltd
Priority to CN202211236456.9A priority Critical patent/CN115588018A/en
Publication of CN115588018A publication Critical patent/CN115588018A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/10Segmentation; Edge detection
    • G06T7/11Region-based segmentation
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/70Determining position or orientation of objects or cameras
    • G06T7/73Determining position or orientation of objects or cameras using feature-based methods
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T2207/00Indexing scheme for image analysis or image enhancement
    • G06T2207/20Special algorithmic details
    • G06T2207/20112Image segmentation details
    • G06T2207/20132Image cropping

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Vision & Pattern Recognition (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Theoretical Computer Science (AREA)
  • Image Processing (AREA)
  • Image Analysis (AREA)

Abstract

本申请提供一种图像处理方法、装置、电子设备及存储介质,所述方法包括:获得待处理图像的原始像素区域、切割线像素值以及重叠区域宽度;根据原始像素值、切割线像素值以及重叠区域宽度,生成待处理图像的每一切分图像像素区域;以及根据每一切分图像像素区域对待处理图像进行切分,获得切分图像。待处理图像的每一切分图像像素区域对应一个切分图像,根据每一切分图像的像素区域对待处理图像进行切分,获得待处理图像对应的多个切分图像。使得待处理图像的切分图像之间具有一定的重叠区域宽度,避免待处理图像中的目标被分割,从而避免出现误检以及漏检的情况,提高图像处理的效果。

Figure 202211236456

The present application provides an image processing method, device, electronic equipment, and storage medium. The method includes: obtaining the original pixel area, cutting line pixel value, and overlapping area width of the image to be processed; according to the original pixel value, cutting line pixel value, and The width of the overlapping area is used to generate each segmented image pixel area of the image to be processed; and the image to be processed is segmented according to each segmented image pixel area to obtain a segmented image. Each segmented image pixel area of the image to be processed corresponds to a segmented image, and the image to be processed is segmented according to the pixel area of each segmented image to obtain multiple segmented images corresponding to the image to be processed. The segmented images of the to-be-processed image have a certain overlap area width, so as to prevent the objects in the to-be-processed image from being segmented, thereby avoiding false detection and missed detection, and improving the effect of image processing.

Figure 202211236456

Description

一种图像处理方法、装置、电子设备及存储介质Image processing method, device, electronic device and storage medium

技术领域technical field

本申请涉及图像处理技术领域,具体而言,涉及一种图像处理方法、装置、电子设备及存储介质。The present application relates to the technical field of image processing, and in particular, to an image processing method, device, electronic equipment, and storage medium.

背景技术Background technique

利用深度神经网络模型进行图像处理的应用领域涉及人类生活和工作的方方面面,通常将待处理图片输入模型,使用模型进行特征提取、分析、检测等,得出处理结果。但如果是将拍摄到的清晰的图像直接输入检测模型,会造成图像丢失的信息较多,进而影响检测结果。目前的解决方案通常是将原图进行裁剪,分成小图输入网络,但目前的处理方式容易出现误检以及漏检的情况。The application field of image processing using the deep neural network model involves all aspects of human life and work. Usually, the image to be processed is input into the model, and the model is used for feature extraction, analysis, detection, etc., and the processing result is obtained. However, if the captured clear image is directly input into the detection model, more information will be lost in the image, which will affect the detection result. The current solution is usually to crop the original image and divide it into small images for input to the network, but the current processing method is prone to false detection and missed detection.

发明内容Contents of the invention

本发明实施例的目的在于一种图像处理方法、装置、电子设备及存储介质,通过根据原始像素值、切割线像素值以及重叠区域宽度,生成待处理图像的每一切分图像像素区域,每一切分图像像素区域对应一个切分图像,根据每一切分图像的像素区域对待处理图像进行切分,获得待处理图像对应的多个切分图像。使得待处理图像的切分图像之间具有一定的重叠区域宽度,避免待处理图像中的目标被分割,从而避免出现误检以及漏检的情况,提高图像处理的效果。The purpose of the embodiment of the present invention is an image processing method, device, electronic equipment and storage medium, by generating each segmented image pixel area of the image to be processed according to the original pixel value, the cutting line pixel value and the width of the overlapping area, each segment The pixel area of the segmented image corresponds to one segmented image, and the image to be processed is segmented according to the pixel area of each segmented image to obtain a plurality of segmented images corresponding to the image to be processed. The segmented images of the to-be-processed image have a certain width of the overlapping area, and the target in the to-be-processed image is prevented from being segmented, thereby avoiding false detection and missed detection, and improving the effect of image processing.

第一方面,本申请实施例提供了一种图像处理方法,包括:获得待处理图像的原始像素区域、切割线像素值以及重叠区域宽度;根据原始像素值、切割线像素值以及重叠区域宽度,生成待处理图像的每一切分图像像素区域;以及根据每一切分图像像素区域对待处理图像进行切分,获得切分图像。In the first aspect, the embodiment of the present application provides an image processing method, including: obtaining the original pixel area of the image to be processed, the pixel value of the cutting line, and the width of the overlapping area; according to the original pixel value, the pixel value of the cutting line, and the width of the overlapping area, generating each segmented image pixel area of the image to be processed; and segmenting the image to be processed according to each segmented image pixel area to obtain a segmented image.

在上述的实现过程中,通过根据原始像素值、切割线像素值以及重叠区域宽度,生成待处理图像的每一切分图像像素区域,切割线两侧的切分图像像素区域之间具有一定的重叠区域宽度,根据切分图像像素区域对待处理图像进行切分,能够避免待处理图像中的目标被分割,提高图像处理准确率。In the above implementation process, each segmented image pixel area of the image to be processed is generated according to the original pixel value, the cutting line pixel value and the width of the overlapping area, and there is a certain overlap between the segmented image pixel areas on both sides of the cutting line The area width is used to segment the image to be processed according to the pixel area of the segmented image, which can prevent the target in the image to be processed from being segmented and improve the accuracy of image processing.

可选地,在本申请实施例中,获得待处理图像的原始像素区域、切割线像素值以及重叠区域宽度,包括:根据原始像素区域和后续处理像素区域生成切割线像素值;其中,后续处理像素区域表征待处理图像在进行后续处理时,需符合的像素区域;将待处理图像输入预设的关键点检测模型,获得待处理图像中待检测目标的边缘关键点;根据切割线像素值以及待检测目标的边缘关键点,获得重叠区域宽度。Optionally, in the embodiment of the present application, obtaining the original pixel area of the image to be processed, the pixel value of the cutting line, and the width of the overlapping area includes: generating the pixel value of the cutting line according to the original pixel area and the subsequent processing pixel area; wherein, the subsequent processing The pixel area represents the pixel area that needs to be conformed to in the subsequent processing of the image to be processed; input the image to be processed into the preset key point detection model to obtain the edge key points of the target to be detected in the image to be processed; according to the pixel value of the cutting line and Edge key points of the target to be detected to obtain the width of the overlapping area.

在上述的实现过程中,根据原始像素区域和后续处理像素区域,生成切割线像素值,即根据原始像素区域和后续处理像素区域的像素区域大小关系生成切割线像素值,后续处理像素区域为待处理图像在进行后续处理时需符合的像素区域。确定好切割线像素值后,根据切割线像素值以及待检测目标的边缘关键点获得重叠区域宽度。使得沿切割线像素值两侧的切分图像具有重叠区域宽度,以避免位于切割线的目标被分割,以造成后续处理时的信息丢失。In the above implementation process, the cutting line pixel value is generated according to the original pixel area and the subsequent processing pixel area, that is, the cutting line pixel value is generated according to the pixel area size relationship between the original pixel area and the subsequent processing pixel area, and the subsequent processing pixel area is Process the pixel area that the image needs to conform to during subsequent processing. After the pixel value of the cutting line is determined, the width of the overlapping area is obtained according to the pixel value of the cutting line and the edge key points of the target to be detected. Make the segmented image on both sides of the pixel value along the cutting line have an overlapping area width, so as to prevent the target located on the cutting line from being segmented, resulting in information loss during subsequent processing.

可选地,在本申请实施例中,在根据每一切分图像像素区域对待处理图像进行切分,获得切分图像之后,方法还包括:获得切分图像的坐标信息;将切分图像的坐标信息进行转换,获得切分图像的还原坐标信息;其中,还原坐标信息表征在由多个切分图像拼接得到的待处理图像中的坐标信息。Optionally, in the embodiment of the present application, after segmenting the image to be processed according to each segmented image pixel area and obtaining the segmented image, the method further includes: obtaining coordinate information of the segmented image; The information is converted to obtain restored coordinate information of the segmented image; wherein, the restored coordinate information represents the coordinate information in the image to be processed obtained by splicing multiple segmented images.

在上述的实现过程中,将待处理图像进行切分后,获得切分图像的坐标信息,将切分图像的信息转换为由切分图像进行对应的重叠拼接得到待处理图像中的还原坐标信息。通过坐标的转换使得每一切分图像的坐标与待处理图像中的还原坐标相对应,完成对待处理图像的处理。In the above implementation process, after the image to be processed is segmented, the coordinate information of the segmented image is obtained, and the information of the segmented image is converted into the corresponding overlapping stitching of the segmented image to obtain the restored coordinate information in the image to be processed . Through coordinate transformation, the coordinates of each segmented image correspond to the restored coordinates in the image to be processed, and the processing of the image to be processed is completed.

可选地,在本申请实施例中,将切分图像的坐标信息进行转换,获得切分图像的还原坐标信息,包括:将多个切分图像按照切分图像的索引号,依次输入预设的检测模型,获得检测结果;其中,检测结果包括每一切分图像的坐标信息,索引号根据切分图像在待处理图像中的位置关系获得;通过坐标转换公式,将切分图像的坐标信息进行转换,获得切分图像的还原坐标信息;坐标转换公式包括:Y=y-hi+(H/N)*i;其中,Y为还原坐标信息中切分方向的坐标值,y为坐标信息中切分方向的坐标值,hi为索引号为i的切分图像对应的重叠区域宽度,H为待处理图像在切分方向上的像素值,N为待处理图像的切分数量;i为切分图像的索引号,i∈[0,N-1]。Optionally, in the embodiment of the present application, converting the coordinate information of the segmented image to obtain the restored coordinate information of the segmented image includes: sequentially inputting multiple segmented images into the preset according to the index numbers of the segmented images The detection model is used to obtain the detection result; wherein, the detection result includes the coordinate information of each segmented image, and the index number is obtained according to the positional relationship of the segmented image in the image to be processed; through the coordinate conversion formula, the coordinate information of the segmented image is carried out Conversion, to obtain the restoration coordinate information of the segmented image; the coordinate conversion formula includes: Y=y-hi+(H/N)*i; wherein, Y is the coordinate value of the segmentation direction in the restoration coordinate information, and y is the cutting direction in the coordinate information The coordinate value of the split direction, hi is the width of the overlapping area corresponding to the split image with the index number i, H is the pixel value of the image to be processed in the split direction, N is the number of splits of the image to be processed; i is the split The index number of the image, i∈[0,N-1].

在上述的实现过程中,通过坐标转换公式实现将切分图像的坐标信息进行转换,获得切分图像的还原坐标信息,将每一切分图像进行统一转换,方便后续处理。In the above implementation process, the coordinate information of the segmented image is converted through the coordinate transformation formula, the restored coordinate information of the segmented image is obtained, and each segmented image is uniformly converted to facilitate subsequent processing.

可选地,在本申请实施例中,其中,原始像素区域包括待处理图像在切分方向上的像素值;切分图像包括第一切分图像和第二切分图像;根据原始像素值、切割线像素值以及重叠区域宽度,生成待处理图像的每一切分图像像素区域,包括:根据切割线像素值以及重叠区域宽度,通过划分公式生成待处理图像的每一切分图像像素区域;划分公式包括:第一切分图像的像素区域为:[0,(H/2)+hi];第二切分图像的像素区域为:[(H/2)-hi,H];其中,H为待处理图像在切分方向上的像素值;H/2为切割线像素值;hi为切分图像对应的为重叠区域宽度。Optionally, in the embodiment of the present application, wherein, the original pixel area includes pixel values of the image to be processed in the segmentation direction; the segmented image includes the first segmented image and the second segmented image; according to the original pixel value, The pixel value of the cutting line and the width of the overlapping area are used to generate each segmented image pixel area of the image to be processed, including: according to the pixel value of the cutting line and the width of the overlapping area, each segmented image pixel area of the image to be processed is generated by a division formula; the division formula Including: the pixel area of the first segmented image is: [0, (H/2)+hi]; the pixel area of the second segmented image is: [(H/2)-hi, H]; wherein, H is The pixel value of the image to be processed in the segmentation direction; H/2 is the pixel value of the cutting line; h i is the width of the overlapping area corresponding to the segmented image.

在上述的实现过程中,通过划分公式生成待处理图像的每一切分图像像素区域,每一切分图像像素区域对应一个切分图像,对切分图像的像素区域进行划分,避免按照切割线对待处理图像进行切分使得目标被切分。In the above implementation process, each segmented image pixel area of the image to be processed is generated by the division formula, each segmented image pixel area corresponds to a segmented image, and the pixel area of the segmented image is divided to avoid processing according to the cutting line The image is segmented such that the target is segmented.

可选地,在本申请实施例中,方法还包括:分别获得切割线像素值两侧对应的待检测目标的边缘关键点;根据切割线像素值,以及切割线像素值两侧对应的待检测目标的边缘关键点,获得切割线像素值两侧的每一切分图像对应的重叠区域宽度。Optionally, in the embodiment of the present application, the method further includes: separately obtaining the edge key points of the object to be detected corresponding to both sides of the pixel value of the cutting line; The key point of the edge of the target, and the width of the overlapping area corresponding to each segmented image on both sides of the pixel value of the cutting line is obtained.

在上述的实现过程中,通过根据切割线像素值,以及切割线像素值两侧对应的待检测目标的边缘关键点,可以分别确定切割线像素值两侧的每一切分图像对应的重叠区域宽度,灵活的确定每一切分图像的重叠区域宽度,使得每一切分图像具有准确的重叠区域宽度。In the above implementation process, according to the pixel value of the cutting line and the edge key points of the target to be detected corresponding to the pixel value of the cutting line, the width of the overlapping area corresponding to each segmented image on both sides of the pixel value of the cutting line can be determined respectively , to flexibly determine the overlapping area width of each segmented image, so that each segmented image has an accurate overlapping area width.

可选地,在本申请实施例中,其中,待处理图像包括齿轮齿面图像;重叠区域宽度包括第一重叠区域宽度和第二重叠区域宽度;待检测目标包括齿轮;边缘关键点包括齿轮齿面中每一齿的顶点和每一齿的底点;根据切割线像素值以及待检测目标的边缘关键点,获得重叠区域宽度,包括:根据切割线像素值、齿轮齿面中每一齿的顶点和每一齿的底点,分别获得距离切割线像素值最接近的齿轮第一关键点和距离切割线像素值最接近的齿轮第二关键点;其中,齿轮第一关键点和齿轮第二关键点分别位于切割线像素值的两侧;根据齿轮第一关键点到切割线像素值的距离,获得第一重叠区域宽度;以及根据齿轮第二关键点到切割线像素值的距离,获得第二重叠区域宽度。Optionally, in the embodiment of the present application, wherein the image to be processed includes a gear tooth surface image; the width of the overlapping area includes a first overlapping area width and a second overlapping area width; the target to be detected includes a gear; the edge key point includes a gear tooth The vertex of each tooth in the surface and the bottom point of each tooth; according to the pixel value of the cutting line and the edge key point of the target to be detected, the width of the overlapping area is obtained, including: according to the pixel value of the cutting line, the value of each tooth in the gear tooth surface The vertex and the bottom point of each tooth respectively obtain the first key point of the gear closest to the pixel value of the cutting line and the second key point of the gear closest to the pixel value of the cutting line; among them, the first key point of the gear and the second key point of the gear The key points are located on both sides of the pixel value of the cutting line; according to the distance from the first key point of the gear to the pixel value of the cutting line, the width of the first overlapping area is obtained; and according to the distance from the second key point of the gear to the pixel value of the cutting line, the second Two overlapping area width.

在上述的实现过程中,待处理图像包括齿轮齿面图像;对于一条切割线的两侧,分别有第一重叠区域宽度和第二重叠区域宽度,待检测目标包括齿轮;根据齿轮齿面图像齿轮齿面中每一齿的顶点和每一齿的底点,分别获得距离切割线像素值最接近的齿轮第一关键点和距离切割线像素值最接近的齿轮第二关键点,以此确定齿轮齿面图像中第一重叠区域宽度和第二重叠区域宽度,以确保齿轮每一齿都不被切割,从而确保齿轮图像在被后续处理时的信息的完整性。In the above implementation process, the image to be processed includes a gear tooth surface image; for both sides of a cutting line, there are respectively a first overlapping area width and a second overlapping area width, and the target to be detected includes a gear; according to the gear tooth surface image gear The vertex of each tooth and the bottom point of each tooth in the tooth surface obtain the first key point of the gear closest to the pixel value of the cutting line and the second key point of the gear closest to the pixel value of the cutting line respectively, so as to determine the gear The width of the first overlapping area and the width of the second overlapping area in the tooth surface image ensure that each tooth of the gear is not cut, thereby ensuring the integrity of the information of the gear image when it is subsequently processed.

第二方面,本申请实施例还提供了一种图像处理装置,包括:获取模块,用于获得待处理图像的原始像素区域、切割线像素值以及重叠区域宽度;生成像素区域模块,用于根据原始像素值、切割线像素值以及重叠区域宽度,生成待处理图像的每一切分图像像素区域;以及切分模块,用于根据每一切分图像像素区域对待处理图像进行切分,获得切分图像。In the second aspect, the embodiment of the present application also provides an image processing device, including: an acquisition module, used to obtain the original pixel area of the image to be processed, the pixel value of the cutting line, and the width of the overlapping area; The original pixel value, the cutting line pixel value and the width of the overlapping area generate each segmented image pixel area of the image to be processed; and the segmentation module is used to segment the image to be processed according to each segmented image pixel area to obtain the segmented image .

第三方面,本申请实施例还提供了一种电子设备,包括:处理器和存储器,存储器存储有处理器可执行的机器可读指令,机器可读指令被处理器执行时执行如上面描述的方法。In the third aspect, the embodiment of the present application also provides an electronic device, including: a processor and a memory, the memory stores machine-readable instructions executable by the processor, and when the machine-readable instructions are executed by the processor, they are executed as described above method.

第四方面,本申请实施例还提供了一种计算机可读存储介质,该计算机可读存储介质上存储有计算机程序,该计算机程序被处理器运行时执行上面描述的方法。In a fourth aspect, the embodiment of the present application further provides a computer-readable storage medium, where a computer program is stored on the computer-readable storage medium, and when the computer program is run by a processor, the method described above is executed.

采用本申请提供图像处理方法、装置、电子设备及存储介质,根据切分图像像素区域对待处理图像进行切分,使得待处理图像的切分图像之间具有一定的重叠区域宽度,能够避免待处理图像中的目标被分割,提高图像处理准确率。通过坐标转换公式实现将切分图像的坐标信息进行转换,获得切分图像的还原坐标信息,将每一切分图像进行统一转换,方便后续处理。Using the image processing method, device, electronic equipment, and storage medium provided by the present application, the image to be processed is segmented according to the pixel area of the segmented image, so that the segmented images of the image to be processed have a certain overlapping area width, and the image to be processed can be avoided. The target in the image is segmented to improve the accuracy of image processing. The coordinate information of the segmented image is converted through the coordinate conversion formula, the restored coordinate information of the segmented image is obtained, and each segmented image is uniformly converted to facilitate subsequent processing.

附图说明Description of drawings

为了更清楚地说明本申请实施例的技术方案,下面将对本申请实施例中所需要使用的附图作简单地介绍,应当理解,以下附图仅示出了本申请的某些实施例,因此不应被看作是对范围的限定,对于本领域普通技术人员来讲,在不付出创造性劳动的前提下,还可以根据这些附图获得其他相关的附图。In order to more clearly illustrate the technical solutions of the embodiments of the present application, the accompanying drawings that need to be used in the embodiments of the present application will be briefly introduced below. It should be understood that the following drawings only show some embodiments of the present application, so It should not be regarded as a limitation on the scope, and those skilled in the art can also obtain other related drawings according to these drawings without creative work.

图1为本申请实施例提供的一种图像处理方法的流程示意图;FIG. 1 is a schematic flow diagram of an image processing method provided in an embodiment of the present application;

图2为本申请实施例提供的重叠区域宽度示意图;FIG. 2 is a schematic diagram of the width of overlapping regions provided by the embodiment of the present application;

图3为本申请实施例提供的齿轮齿面图像重叠区域宽度示意图;Fig. 3 is a schematic diagram of the width of the overlapping area of the gear tooth surface image provided by the embodiment of the present application;

图4为本申请实施例提供的图像处理装置的结构示意图;FIG. 4 is a schematic structural diagram of an image processing device provided in an embodiment of the present application;

图5为本申请实施例提供的电子设备的结构示意图。FIG. 5 is a schematic structural diagram of an electronic device provided by an embodiment of the present application.

具体实施方式detailed description

下面将结合附图对本申请技术方案的实施例进行详细的描述。以下实施例仅用于更加清楚地说明本申请的技术方案,因此只作为示例,而不能以此来限制本申请的保护范围。Embodiments of the technical solutions of the present application will be described in detail below in conjunction with the accompanying drawings. The following examples are only used to illustrate the technical solution of the present application more clearly, and therefore are only examples, rather than limiting the protection scope of the present application.

除非另有定义,本文所使用的所有的技术和科学术语与属于本申请的技术领域的技术人员通常理解的含义相同;本文中所使用的术语只是为了描述具体的实施例的目的,不是旨在于限制本申请。Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by those skilled in the technical field of the application; the terms used herein are only for the purpose of describing specific embodiments, and are not intended to Limit this application.

在本申请实施例的描述中,技术术语“第一”、“第二”等仅用于区别不同对象,而不能理解为指示或暗示相对重要性或者隐含指明所指示的技术特征的数量、特定顺序或主次关系。在本申请实施例的描述中,“多个”的含义是两个及以上,除非另有明确具体的限定。In the description of the embodiments of the present application, the technical terms "first", "second" and so on are only used to distinguish different objects, and should not be understood as indicating or implying relative importance or implicitly indicating the number of indicated technical features, A specific order or primary-secondary relationship. In the description of the embodiments of the present application, "plurality" means two or more, unless otherwise specifically defined.

在通过模型对图像进行处理时,模型具有固定输入图像大小,假设模型固定输入图像大小为800*800,即宽方向和高方向分别由800像素值,假设原始图像大小为2048*3125,即图像宽有2048个像素值,高有3125个像素值。如果直接将原始图像输入模型进行处理,原始图像由2048*3125压缩为800*800,宽方向上单像素精度会损失2048/800=2.56倍,高方向上单像素精度会损失3125/800=3.9倍。单像素精度的损失体现在图像上是图像特征的丢失,而图像的特征对于模型训练和推理来说是至关重要的。先将原始图像裁剪为两张或多张切分图像,再将切分图像输入模型中进行训练和推理,则相比直接压缩原图,牺牲掉的特征会变少。图像保留越多的特征,模型的学习程度就越好,检出就越准确。另外,若对原始图像进行剪裁,若原始图像中有目标位于切割线,在则有可能将原始图像中的目标进行切分,造成任何一张切分图像都识别不出该目标,造成延时图像中的信息丢失,从而在后续的处理中出现漏检和误检的情况。因此本申请提供一种图像处理方法,解决上述目标被裁剪的问题。When the image is processed by the model, the model has a fixed input image size, assuming that the fixed input image size of the model is 800*800, that is, the width direction and the height direction are respectively composed of 800 pixel values, assuming that the original image size is 2048*3125, that is, the image The width has 2048 pixel values and the height has 3125 pixel values. If the original image is directly input to the model for processing, the original image is compressed from 2048*3125 to 800*800, the single-pixel accuracy in the width direction will be lost by 2048/800=2.56 times, and the single-pixel accuracy in the high direction will be lost by 3125/800=3.9 times. The loss of single-pixel precision is reflected in the loss of image features on the image, and the features of the image are crucial for model training and reasoning. First crop the original image into two or more segmented images, and then input the segmented images into the model for training and inference. Compared with directly compressing the original image, fewer features will be sacrificed. The more features the image retains, the better the model learns and the more accurate the detection. In addition, if the original image is clipped, if there is a target in the original image located on the cutting line, it is possible to segment the target in the original image, causing any segmented image to fail to recognize the target, resulting in delay The information in the image is lost, resulting in missed detection and false detection in subsequent processing. Therefore, the present application provides an image processing method to solve the above-mentioned problem that the object is clipped.

请参见图1示出的本申请实施例提供的一种图像处理方法的流程示意图。Please refer to FIG. 1 which is a schematic flowchart of an image processing method provided by an embodiment of the present application.

步骤S110:获得待处理图像的原始像素区域、切割线像素值以及重叠区域宽度。Step S110: Obtain the original pixel area of the image to be processed, the pixel value of the cutting line, and the width of the overlapping area.

上述步骤S110的实施方式包括:获得待处理图像的原始像素区域,待处理图像可以是包含目标的完整图像,例如摄像机拍到的零件图像;待处理图像的原始像素区域为未经剪裁处理的待处理图像的像素区域范围,以表征待处理图像的尺寸大小。切割线像素值是待处理图像预切割的切割线的像素值,即通过切割线像素值在待处理图像中定位出切割线的位置。切割线像素值可以根据待处理图像需要切分的数量以及切分图像的尺寸进行确定,也可以设置为确定值。重叠区域宽度为待处理图像中切分图像之间相互重叠部分的宽度,重叠区域宽度可以设置为确定值,也可以根据分图像中的目标计算生成;且每一切分图像的重叠区域宽度可以是一样的,而可以根据每一切分图像中的目标分别设置。The implementation of the above step S110 includes: obtaining the original pixel area of the image to be processed, the image to be processed may be a complete image including the target, such as a part image captured by a camera; the original pixel area of the image to be processed is an image to be Process the pixel area range of the image to represent the size of the image to be processed. The pixel value of the cutting line is the pixel value of the cutting line of the pre-cut image to be processed, that is, the position of the cutting line is located in the image to be processed by the pixel value of the cutting line. The pixel value of the cutting line can be determined according to the number of segments to be processed and the size of the segmented image, or can be set as a certain value. The width of the overlapping area is the width of the overlapping part between the segmented images in the image to be processed, and the width of the overlapping area can be set to a certain value, or can be calculated and generated according to the target in the segmented image; and the width of the overlapping area of each segmented image can be The same, but can be set separately according to the target in each segmented image.

步骤S120:根据原始像素值、切割线像素值以及重叠区域宽度,生成待处理图像的每一切分图像像素区域。Step S120: Generate each segmented image pixel area of the image to be processed according to the original pixel value, the cutting line pixel value and the width of the overlapping area.

上述步骤S120的实施方式包括:待处理图像的每一切分图像像素区域包括,每一切分图像在待处理图像中的位置信息和尺寸信息。根据原始像素值、切割线像素值以及重叠区域宽度,生成待处理图像的每一切分图像像素区域可以为:根据原始像素值以及切割线像素值先确定切分图像的原始像素区域,再根据获得重叠区域宽度,对切分图像的原始像素区域进行扩充,使得对待处理图像进行切分后,切割线像素值两侧的切分图像具有重叠区域。The implementation of the above step S120 includes: each segmented image pixel region of the image to be processed includes position information and size information of each segmented image in the image to be processed. According to the original pixel value, the pixel value of the cutting line and the width of the overlapping region, generating each segmented image pixel area of the image to be processed can be: first determine the original pixel area of the segmented image according to the original pixel value and the pixel value of the cutting line, and then according to the obtained The width of the overlapping area is to expand the original pixel area of the segmented image, so that after the image to be processed is segmented, the segmented image on both sides of the pixel value of the cutting line has an overlapping area.

具体例如:待处理图像的尺寸W*H,W为宽度方向的像素值,H为高度方向的像素值。在H方向进行图像切分,设切割线像素值为H/2处的像素值,切分图像A的原始像素范围为[0,H/2],切分图像B的原始像素范围为[(H/2)+1,H]。获得到重叠区域宽度为h,则将切分图像A的原始像素范围在H方向上增加重叠区域宽度h对应的像素,获得切分图像A像素区域;将切分图像B的原始像素范围在H方向上增加重叠区域宽度对应的像素,获得切分图像B像素区域。A specific example: the size of the image to be processed is W*H, W is the pixel value in the width direction, and H is the pixel value in the height direction. Segment the image in the H direction, set the pixel value of the cutting line as the pixel value at H/2, the original pixel range of the segmented image A is [0, H/2], and the original pixel range of the segmented image B is [( H/2)+1,H]. If the width of the overlapping area is obtained, then the original pixel range of the segmented image A is increased in the H direction by the pixels corresponding to the overlapping area width h, and the pixel area of the segmented image A is obtained; the original pixel range of the segmented image B is H Increase the pixel corresponding to the width of the overlapping area in the direction to obtain the B pixel area of the segmented image.

步骤S130:根据每一切分图像像素区域对待处理图像进行切分,获得切分图像。Step S130: Segment the image to be processed according to each segmented image pixel area to obtain a segmented image.

上述步骤S130的实施方式包括:确定了每一切分图像像素区域,即确定了切分图像在待处理图像中的像素位置和尺寸,根据每一切分图像像素区域对待处理图像进行切分,获得待处理图像的切分图像。The implementation of the above-mentioned step S130 includes: after determining the pixel area of each segmented image, that is, determining the pixel position and size of the segmented image in the image to be processed, segmenting the image to be processed according to each segmented image pixel area, and obtaining Segmented image processing image.

在上述的实现过程中,通过根据原始像素值、切割线像素值以及重叠区域宽度,生成待处理图像的每一切分图像像素区域,切割线两侧的切分图像像素区域之间具有一定的重叠区域宽度,根据切分图像像素区域对待处理图像进行切分,能够避免待处理图像中的目标被分割,提高图像处理准确率。In the above implementation process, each segmented image pixel area of the image to be processed is generated according to the original pixel value, the cutting line pixel value and the width of the overlapping area, and there is a certain overlap between the segmented image pixel areas on both sides of the cutting line The area width is used to segment the image to be processed according to the pixel area of the segmented image, which can prevent the target in the image to be processed from being segmented and improve the accuracy of image processing.

可选地,在本申请实施例中,获得待处理图像的原始像素区域、切割线像素值以及重叠区域宽度,包括:根据原始像素区域和后续处理像素区域生成切割线像素值;其中,后续处理像素区域表征待处理图像在进行后续处理时,需符合的像素区域;将待处理图像输入预设的关键点检测模型,获得待处理图像中待检测目标的边缘关键点;根据切割线像素值以及待检测目标的边缘关键点,获得重叠区域宽度。Optionally, in the embodiment of the present application, obtaining the original pixel area of the image to be processed, the pixel value of the cutting line, and the width of the overlapping area includes: generating the pixel value of the cutting line according to the original pixel area and the subsequent processing pixel area; wherein, the subsequent processing The pixel area represents the pixel area that needs to be conformed to in the subsequent processing of the image to be processed; input the image to be processed into the preset key point detection model to obtain the edge key points of the target to be detected in the image to be processed; according to the pixel value of the cutting line and Edge key points of the target to be detected to obtain the width of the overlapping area.

上述步骤的实施方式例如:根据原始像素区域和后续处理像素区域生成切割线像素值,后续处理像素区域表征待处理图像在进行后续处理时,需符合的像素区域。后续处理可以为将切分图像所输入的模型,需符合的像素区域可以为模型的固定输入图像。后续处理还可以是其他对切分图像尺寸或像素区域有要求的处理方式。根据原始像素区域和后续处理像素区域生成切割线像素值,具体例如,待处理图像的宽有700个像素值,高有1400像素值,后续处理的模型的输入图像为800*800,即宽800个像素值,高800像素值。则可以将切割线确定在高为700像素值,以使根据切割线进行切分的两个切分图像的原始像素值为700*700,符合模型固定输入的大小。需要说明的是,确定切割线像素值时,需为切分图像预留出重叠区域宽度的位置,以使切分图像的原始像素值增加上重叠区域宽度,仍符合后续处理的像素区域要求。The implementation of the above steps is, for example: generating the pixel value of the cutting line according to the original pixel area and the subsequent processing pixel area, and the subsequent processing pixel area represents the pixel area to be conformed to when the image to be processed is subjected to subsequent processing. Subsequent processing can be a model that will input the segmented image, and the pixel area to be matched can be a fixed input image of the model. Subsequent processing can also be other processing methods that have requirements on the size of the segmented image or the pixel area. The pixel value of the cutting line is generated according to the original pixel area and the subsequent processing pixel area. For example, the image to be processed has a width of 700 pixel values and a height of 1400 pixel values. The input image of the subsequent processing model is 800*800, that is, the width is 800 pixel value, up to 800 pixel value. Then, the cutting line can be determined at a height of 700 pixels, so that the original pixel value of the two segmented images segmented according to the cutting line is 700*700, which conforms to the fixed input size of the model. It should be noted that when determining the pixel value of the cutting line, it is necessary to reserve a position for the width of the overlapping area for the segmented image, so that the original pixel value of the segmented image increases the width of the upper overlapping area, which still meets the pixel area requirements for subsequent processing.

将待处理图像输入预设的关键点检测模型,获得待处理图像中待检测目标的边缘关键点,若待处理图像中包括多个待检测目标,则获得每一待检测目标的边缘关键点,待检测目标的边缘关键点可以为待检测目标的轮廓点,根据待检测目标的边缘关键点和切割线像素值的位置关系,获得重叠区域宽度。具体例如,若检测到多个边缘关键点,获得距离切割线像素值最近的边缘关键点,以距离切割线像素值最近的边缘关键点,到切割线像素值的垂直距离为重叠区域宽度。可以理解的,也可以使用距离切割线像素值第二接近的边缘关键点,作为确定重叠区域宽度的边缘关键点。Input the image to be processed into the preset key point detection model to obtain the edge key points of the target to be detected in the image to be processed, if the image to be processed includes multiple targets to be detected, then obtain the edge key points of each target to be detected, The edge key points of the target to be detected may be contour points of the target to be detected, and the width of the overlapping region is obtained according to the positional relationship between the key points of the edge of the target to be detected and the pixel values of the cutting line. Specifically, for example, if multiple edge key points are detected, the edge key point closest to the pixel value of the cutting line is obtained, and the vertical distance from the edge key point closest to the pixel value of the cutting line to the pixel value of the cutting line is the width of the overlapping area. It can be understood that the edge key point that is second closest to the pixel value of the cutting line may also be used as the edge key point for determining the width of the overlapping region.

在上述的实现过程中,根据原始像素区域和后续处理像素区域,生成切割线像素值,即根据原始像素区域和后续处理像素区域的像素区域大小关系生成切割线像素值,后续处理像素区域为待处理图像在进行后续处理时需符合的像素区域。确定好切割线像素值后,根据切割线像素值以及待检测目标的边缘关键点获得重叠区域宽度。使得沿切割线像素值两侧的切分图像具有重叠区域宽度,以避免位于切割线的目标被分割。In the above implementation process, the cutting line pixel value is generated according to the original pixel area and the subsequent processing pixel area, that is, the cutting line pixel value is generated according to the pixel area size relationship between the original pixel area and the subsequent processing pixel area, and the subsequent processing pixel area is Process the pixel area that the image needs to conform to during subsequent processing. After the pixel value of the cutting line is determined, the width of the overlapping area is obtained according to the pixel value of the cutting line and the edge key points of the target to be detected. Make the segmented image on both sides of the pixel value along the cutting line have an overlapping area width, so as to avoid the target located on the cutting line from being segmented.

可选地,在本申请实施例中,在根据每一切分图像像素区域对待处理图像进行切分,获得切分图像之后,方法还包括:获得切分图像的坐标信息;将切分图像的坐标信息进行转换,获得切分图像的还原坐标信息;其中,还原坐标信息表征在由多个切分图像拼接得到的待处理图像中的坐标信息。Optionally, in the embodiment of the present application, after segmenting the image to be processed according to each segmented image pixel area and obtaining the segmented image, the method further includes: obtaining coordinate information of the segmented image; The information is converted to obtain restored coordinate information of the segmented image; wherein, the restored coordinate information represents the coordinate information in the image to be processed obtained by splicing multiple segmented images.

上述步骤的实施方式例如:获得切分图像的坐标信息,坐标信息可以为切分图像的中心坐标,中心坐标可以为将切分图像输入缺陷检测模型进行缺陷检测之后,得到的切分图像的检出框中心坐标,由于切割线两侧的切分图像是具有重叠区域的,因此切分图像的中心坐标,若需要在待处理图像中表示,则需要进行转换为还原坐标信息,还原坐标信息表征在由多个切分图像拼接得到的待处理图像中的坐标信息。待处理图像为未进行切分的图像,待处理图像中的坐标信息可以为未进行切分的图像的检出框中心坐标。切分图像拼接得到待处理图像的方式可以为根据切分图像的像素区域,对切分图像进行拼接或重叠拼接,以获得拼接后的完整的待处理图像。The implementation of the above steps is for example: obtain the coordinate information of the segmented image, the coordinate information may be the center coordinate of the segmented image, and the center coordinate may be the detection index of the segmented image obtained after inputting the segmented image into the defect detection model for defect detection. Out-of-frame center coordinates, since the segmented images on both sides of the cutting line have overlapping areas, so if the center coordinates of the segmented images need to be represented in the image to be processed, they need to be converted into restored coordinate information, and the restored coordinate information represents The coordinate information in the image to be processed obtained by splicing multiple segmented images. The image to be processed is an image that has not been segmented, and the coordinate information in the image to be processed may be the center coordinates of the detection frame of the image that has not been segmented. The image to be processed may be obtained by splicing the segmented images by splicing or overlapping splicing of the segmented images according to the pixel areas of the segmented images to obtain a complete image to be processed after splicing.

在上述的实现过程中,将待处理图像进行切分后,获得切分图像的坐标信息,将切分图像的信息转换为由切分图像进行对应的重叠拼接得到待处理图像中的还原坐标信息。通过坐标的转换使得每一切分图像的坐标与待处理图像中的还原坐标相对应,完成对待处理图像的处理。In the above implementation process, after the image to be processed is segmented, the coordinate information of the segmented image is obtained, and the information of the segmented image is converted into the corresponding overlapping stitching of the segmented image to obtain the restored coordinate information in the image to be processed . Through coordinate transformation, the coordinates of each segmented image correspond to the restored coordinates in the image to be processed, and the processing of the image to be processed is completed.

可选地,在本申请实施例中,将切分图像的坐标信息进行转换,获得切分图像的还原坐标信息,包括:将多个切分图像按照切分图像的索引号,依次输入预设的检测模型,获得检测结果;其中,检测结果包括每一切分图像的坐标信息,索引号根据切分图像在待处理图像中的位置关系获得;通过坐标转换公式,将切分图像的坐标信息进行转换,获得切分图像的还原坐标信息;坐标转换公式包括:Y=y-hi+(H/N)*i;其中,Y为还原坐标信息中切分方向的坐标值,y为坐标信息中切分方向的坐标值,hi为索引号为i的切分图像对应的重叠区域宽度,H为待处理图像在切分方向上的像素值,N为待处理图像的切分数量;i为切分图像的索引号,i∈[0,N-1]。Optionally, in the embodiment of the present application, converting the coordinate information of the segmented image to obtain the restored coordinate information of the segmented image includes: sequentially inputting multiple segmented images into the preset according to the index numbers of the segmented images The detection model is used to obtain the detection result; wherein, the detection result includes the coordinate information of each segmented image, and the index number is obtained according to the positional relationship of the segmented image in the image to be processed; through the coordinate conversion formula, the coordinate information of the segmented image is carried out Conversion, to obtain the restoration coordinate information of the segmented image; the coordinate conversion formula includes: Y=y-hi+(H/N)*i; wherein, Y is the coordinate value of the segmentation direction in the restoration coordinate information, and y is the cutting direction in the coordinate information The coordinate value of the split direction, hi is the width of the overlapping area corresponding to the split image with the index number i, H is the pixel value of the image to be processed in the split direction, N is the number of splits of the image to be processed; i is the split The index number of the image, i∈[0,N-1].

上述步骤的实施方式例如:切分图像输入预设的检测模型具有顺序,可以根据切分图像的索引号,依次将切分图像输入预设的检测模型,索引号根据切分图像在待处理图像中的位置关系获得。具体例如,一组切分图像被称为一个batch,一组切分图像内切分图像的数目称为batchsize。模型每次取一个batch的切分图像进行处理,按batch内切分图像的顺序输出检测结果。若待处理图像的尺寸为W*H,W为宽度方向的像素值,H为高度方向的像素值。将待处理图像切分为N个切分图像,设置模型的batchsize=N,即模型每次取N张切分图像进行处理。N张切分图像分别具有索引号,按照索引号将The implementation of the above steps is for example: the input of the segmented image into the preset detection model has an order, and the segmented image can be input into the preset detection model in sequence according to the index number of the segmented image, and the index number is based on the index number of the segmented image in the image to be processed The positional relationship in is obtained. For example, a group of segmented images is called a batch, and the number of segmented images in a group of segmented images is called batchsize. The model takes a batch of segmented images each time for processing, and outputs the detection results in the order of the segmented images in the batch. If the size of the image to be processed is W*H, W is the pixel value in the width direction, and H is the pixel value in the height direction. The image to be processed is divided into N segmented images, and the batchsize of the model is set to N, that is, the model takes N segmented images each time for processing. The N sliced images have index numbers respectively, and according to the index numbers, the

切分图像输入预设的检测模型后,获得检测结果。检测结果包括每一切分图像的坐标信息,其中,切分图像的坐标信息可以为将切分图像输入缺陷检测模型进行缺陷检测之后,得到的切分图像的检出框中心坐标。具体例如,检测结果可以为由五个元素组成的一维张量,即[x,y,w,h,t],其中,(x,y)为切分图像的中心坐标,(w,h)为切分图像中图像检测框宽度和图像检测框高度,t为置信度信息。After the segmented image is input into the preset detection model, the detection result is obtained. The detection result includes coordinate information of each segmented image, where the coordinate information of the segmented image may be the center coordinates of the detection frame of the segmented image obtained after inputting the segmented image into the defect detection model for defect detection. For example, the detection result can be a one-dimensional tensor composed of five elements, namely [x, y, w, h, t], where (x, y) are the center coordinates of the segmented image, (w, h ) is the width and height of the image detection frame in the segmented image, and t is the confidence information.

通过坐标转换公式,将切分图像的坐标信息进行转换,获得切分图像的还原坐标信息;坐标转换公式包括:Y=y-hi+(H/N)*i;其中,Y为还原坐标信息中切分方向的坐标值,y为坐标信息中切分方向的坐标值,hi为索引号为i的切分图像对应的重叠区域宽度,H为待处理图像在切分方向上的像素值,N为待处理图像的切分数量;i为切分图像的索引号,i∈[0,N-1]。Through the coordinate conversion formula, the coordinate information of the segmented image is converted to obtain the restored coordinate information of the segmented image; the coordinate conversion formula includes: Y=y-hi+(H/N)*i; wherein, Y is in the restored coordinate information The coordinate value of the segmentation direction, y is the coordinate value of the segmentation direction in the coordinate information, hi is the width of the overlapping area corresponding to the segmentation image with the index number i, H is the pixel value of the image to be processed in the segmentation direction, N is the number of segmented images to be processed; i is the index number of the segmented image, i∈[0,N-1].

其中,hi为索引号为i的切分图像对应的重叠区域宽度,具体例如,索引号为1的切分图像对应的重叠区域宽度为h1,索引号为2的切分图像对应的重叠区域宽度为h2Among them, h i is the width of the overlapping area corresponding to the segmented image with index number i. Specifically, for example, the width of the overlapping area corresponding to the segmented image with index number 1 is h 1 , and the overlapping area corresponding to the segmented image with index number 2 is The region width is h 2 .

需要说明的是,本申请实施例是以在H方向上进行切分为例,另一方向W不进行切分,则切分图像的坐标信息中的x,与还原坐标信息中的X相等,即X=x;其中,X为还原坐标信息中不进行切分的方向的坐标值,x为坐标信息中不进行切分的方向的坐标值。It should be noted that the embodiment of the present application is based on the example of performing segmentation in the H direction, and the other direction W does not perform segmentation, then the x in the coordinate information of the segmented image is equal to the X in the restored coordinate information, That is, X=x; wherein, X is the coordinate value of the direction in which segmentation is not performed in the restored coordinate information, and x is the coordinate value of the direction in which segmentation is not performed in the coordinate information.

在上述的实现过程中,通过坐标转换公式实现将切分图像的坐标信息进行转换,获得切分图像的还原坐标信息,将每一切分图像进行统一转换,方便后续处理。In the above implementation process, the coordinate information of the segmented image is converted through the coordinate transformation formula, the restored coordinate information of the segmented image is obtained, and each segmented image is uniformly converted to facilitate subsequent processing.

可选地,在本申请实施例中,其中,原始像素区域包括待处理图像在切分方向上的像素值;切分图像包括第一切分图像和第二切分图像;根据原始像素值、切割线像素值以及重叠区域宽度,生成待处理图像的每一切分图像像素区域,包括:根据切割线像素值以及重叠区域宽度,通过划分公式生成待处理图像的每一切分图像像素区域;划分公式包括:第一切分图像的像素区域为:[0,(H/2)+hi];第二切分图像的像素区域为:[(H/2)-hi,H];其中,H为待处理图像在切分方向上的像素值;H/2为切割线像素值;hi为切分图像对应的为重叠区域宽度。Optionally, in the embodiment of the present application, wherein, the original pixel area includes pixel values of the image to be processed in the segmentation direction; the segmented image includes the first segmented image and the second segmented image; according to the original pixel value, The pixel value of the cutting line and the width of the overlapping area are used to generate each segmented image pixel area of the image to be processed, including: according to the pixel value of the cutting line and the width of the overlapping area, each segmented image pixel area of the image to be processed is generated by a division formula; the division formula Including: the pixel area of the first segmented image is: [0, (H/2)+hi]; the pixel area of the second segmented image is: [(H/2)-hi, H]; wherein, H is The pixel value of the image to be processed in the segmentation direction; H/2 is the pixel value of the cutting line; h i is the width of the overlapping area corresponding to the segmented image.

上述步骤的实施方式例如:始像素区域包括待处理图像在切分方向上的像素值,若对待处理图像进行H方向的切分,则切分方向上的像素值为H方向上的像素值。若待处理图像包括一条切割线,将待处理图像切分为两个切分图像,切分图像包括第一切分图像和第二切分图像。The implementation of the above steps is for example: the initial pixel area includes pixel values in the segmentation direction of the image to be processed, and if the image to be processed is segmented in the H direction, the pixel values in the segmentation direction are pixel values in the H direction. If the image to be processed includes a cutting line, the image to be processed is segmented into two segmented images, and the segmented images include a first segmented image and a second segmented image.

根据切割线像素值以及重叠区域宽度,通过划分公式生成待处理图像的每一切分图像像素区域;划分公式包括:第一切分图像的像素区域为:[0,(H/2)+hi];其中,H为待处理图像在切分方向上的像素值;H/2为切割线像素值;hi为切分图像对应的为重叠区域宽度。在一个实施例中,第一切分图像位于待处理图像下方,第一切分图像的原始像素区域为(0,(H/2)),将原始像素区域加上第一切分图像对应的为重叠区域宽度hi,则第一切分图像的像素区域为:[0,(H/2)+hi]。According to the pixel value of the cutting line and the width of the overlapping area, the pixel area of each segmented image of the image to be processed is generated by a division formula; the division formula includes: the pixel area of the first segmented image is: [0, (H/2)+hi] ; Among them, H is the pixel value of the image to be processed in the segmentation direction; H/2 is the pixel value of the cutting line; h i is the width of the overlapping area corresponding to the segmentation image. In one embodiment, the first segmented image is located below the image to be processed, the original pixel area of the first segmented image is (0, (H/2)), and the original pixel area is added to the first segmented image corresponding to is the overlapping area width h i , then the pixel area of the first segmented image is: [0, (H/2)+hi].

第二切分图像的像素区域为:[(H/2)-hi,H];其中,H为待处理图像在切分方向上的像素值;H/2为切割线像素值;hi为切分图像对应的为重叠区域宽度。第一切分图像的原始像素区域为((H/2),H),将原始像素区域加上第二切分图像对应的为重叠区域宽度hi,由于第二切分图像位于待处理图像上方,第二切分图像的像素区域为:[(H/2)-hi,H]。The pixel region of the second segmented image is: [(H/2)-hi, H]; Wherein, H is the pixel value of the image to be processed in the segmenting direction; H/2 is the pixel value of the cutting line; h i is The segmented image corresponds to the overlapping area width. The original pixel area of the first segmented image is ((H/2), H), and the original pixel area plus the second segmented image corresponds to the overlapping area width h i , since the second segmented image is located in the image to be processed Above, the pixel area of the second segmented image is: [(H/2)-hi,H].

在上述的实现过程中,通过划分公式生成待处理图像的每一切分图像像素区域,每一切分图像像素区域对应一个切分图像,对切分图像的像素区域进行划分,避免按照切割线对待处理图像进行切分使得目标被切分。In the above implementation process, each segmented image pixel area of the image to be processed is generated by the division formula, each segmented image pixel area corresponds to a segmented image, and the pixel area of the segmented image is divided to avoid processing according to the cutting line The image is segmented such that the target is segmented.

请参见图2示出的本申请实施例提供的重叠区域宽度示意图。Please refer to FIG. 2 , which is a schematic diagram showing the width of overlapping regions provided by the embodiment of the present application.

可选地,在本申请实施例中,方法还包括:分别获得切割线像素值两侧对应的待检测目标的边缘关键点;根据切割线像素值,以及切割线像素值两侧对应的待检测目标的边缘关键点,获得切割线像素值两侧的每一切分图像对应的重叠区域宽度。Optionally, in the embodiment of the present application, the method further includes: separately obtaining the edge key points of the object to be detected corresponding to both sides of the pixel value of the cutting line; The key point of the edge of the target, and the width of the overlapping area corresponding to each segmented image on both sides of the pixel value of the cutting line is obtained.

上述步骤的实施方式例如:分别获得切割线像素值两侧对应的待检测目标的边缘关键点,若待处理图像有一条切割线,则获得该条切割线像素值两侧对应的待检测目标的边缘关键点;若待处理图像有多条切割线,则获得每一条切割线像素值两侧对应的待检测目标的边缘关键点。The implementation of the above steps is for example: respectively obtain the edge key points of the object to be detected corresponding to both sides of the pixel value of the cutting line, if the image to be processed has a cutting line, then obtain the corresponding edge points of the object to be detected on both sides of the pixel value of the cutting line Edge key points; if the image to be processed has multiple cutting lines, then obtain the edge key points of the object to be detected corresponding to both sides of the pixel value of each cutting line.

根据切割线像素值,以及切割线像素值切割线像素值两侧对应的待检测目标的边缘关键点,如图2所示,切割线像素值在待处理图像的H/2处,获取切割线像素值上方的边缘关键点,分别为第一关键点和第三关键点,其中,第一关键点为距离切割线像素值最近的关键点,作为一种实施方式,可以以第一关键点,到切割线像素值的垂直距离为第一重叠区域宽度,即切割线像素值上方切分图像的重叠区域宽度。也可以使用第三关键点到切割线像素值的垂直距离为第一重叠区域宽度。According to the pixel value of the cutting line, and the edge key points of the object to be detected corresponding to the two sides of the pixel value of the cutting line, as shown in Figure 2, the pixel value of the cutting line is at H/2 of the image to be processed, and the cutting line is obtained The edge key points above the pixel value are respectively the first key point and the third key point, wherein the first key point is the key point closest to the pixel value of the cutting line. As an implementation, the first key point, The vertical distance to the pixel value of the cutting line is the width of the first overlapping area, that is, the width of the overlapping area of the segmented image above the pixel value of the cutting line. It is also possible to use the vertical distance from the third key point to the pixel value of the cutting line as the width of the first overlapping area.

以及获取切割线像素值下方的边缘关键点,分别为第二关键点和第四关键点。第二关键点为距离切割线像素值最近的关键点,以第二关键点,到切割线像素值的垂直距离为第二重叠区域宽度,即切割线像素值下方切分图像的重叠区域宽度。实现获得切割线像素值两侧的每一切分图像对应的重叠区域宽度。And obtain the edge key points below the pixel value of the cutting line, which are respectively the second key point and the fourth key point. The second key point is the key point closest to the pixel value of the cutting line, and the vertical distance from the second key point to the pixel value of the cutting line is the width of the second overlapping area, which is the width of the overlapping area of the segmented image below the pixel value of the cutting line. To achieve the width of the overlapping area corresponding to each segmented image on both sides of the pixel value of the cutting line.

切割线的方向以及像素值的位置可以根据实际情况设定,本申请实施例对此不做限定,例如,若切割线的方向为横向,则分别获得切割线上下两侧的切分图像对应的重叠区域宽度;若切割线的方向为竖向,则分别获得切割线左右两侧的切分图像对应的重叠区域宽度。The direction of the cutting line and the position of the pixel value can be set according to the actual situation, which is not limited in the embodiment of the present application. For example, if the direction of the cutting line is horizontal, the corresponding values of the segmented images on the upper and lower sides of the cutting line are respectively obtained. The width of the overlapping area; if the direction of the cutting line is vertical, then obtain the width of the overlapping area corresponding to the segmented images on the left and right sides of the cutting line.

在上述的实现过程中,通过根据切割线像素值,以及切割线像素值两侧对应的待检测目标的边缘关键点,可以分别确定切割线像素值两侧的每一切分图像对应的重叠区域宽度,灵活的确定每一切分图像的重叠区域宽度,使得每一切分图像具有准确的重叠区域宽度。In the above implementation process, according to the pixel value of the cutting line and the edge key points of the target to be detected corresponding to the pixel value of the cutting line, the width of the overlapping area corresponding to each segmented image on both sides of the pixel value of the cutting line can be determined respectively , to flexibly determine the overlapping area width of each segmented image, so that each segmented image has an accurate overlapping area width.

可选地,在本申请实施例中,其中,待处理图像包括齿轮齿面图像;重叠区域宽度包括第一重叠区域宽度和第二重叠区域宽度;待检测目标包括齿轮;边缘关键点包括齿轮齿面中每一齿的顶点和每一齿的底点;根据切割线像素值以及待检测目标的边缘关键点,获得重叠区域宽度,包括:根据切割线像素值、齿轮齿面中每一齿的顶点和每一齿的底点,分别获得距离切割线像素值最接近的齿轮第一关键点和距离切割线像素值最接近的齿轮第二关键点;其中,齿轮第一关键点和齿轮第二关键点分别位于切割线像素值的两侧;根据齿轮第一关键点到切割线像素值的距离,获得第一重叠区域宽度;以及根据齿轮第二关键点到切割线像素值的距离,获得第二重叠区域宽度。Optionally, in the embodiment of the present application, wherein the image to be processed includes a gear tooth surface image; the width of the overlapping area includes a first overlapping area width and a second overlapping area width; the target to be detected includes a gear; the edge key point includes a gear tooth The vertex of each tooth in the surface and the bottom point of each tooth; according to the pixel value of the cutting line and the edge key point of the target to be detected, the width of the overlapping area is obtained, including: according to the pixel value of the cutting line, the value of each tooth in the gear tooth surface The vertex and the bottom point of each tooth respectively obtain the first key point of the gear closest to the pixel value of the cutting line and the second key point of the gear closest to the pixel value of the cutting line; among them, the first key point of the gear and the second key point of the gear The key points are located on both sides of the pixel value of the cutting line; according to the distance from the first key point of the gear to the pixel value of the cutting line, the width of the first overlapping area is obtained; and according to the distance from the second key point of the gear to the pixel value of the cutting line, the second Two overlapping area width.

请参见图3示出的本申请实施例提供的齿轮齿面图像重叠区域宽度示意图。Please refer to FIG. 3 , which is a schematic diagram showing the width of overlapping regions of gear tooth surface images provided by the embodiment of the present application.

上述步骤的实施方式例如:待处理图像包括齿轮齿面图像;重叠区域宽度包括第一重叠区域宽度和第二重叠区域宽度,其中,第一重叠区域宽度和第二重叠区域宽度分别是切割线像素值两侧的切分图像对应的重叠区域宽度。The implementation of the above steps is for example: the image to be processed includes a gear tooth surface image; the overlapping area width includes a first overlapping area width and a second overlapping area width, wherein the first overlapping area width and the second overlapping area width are cutting line pixels respectively The width of the overlapping region corresponding to the split image on both sides of the value.

如图3所示,待检测目标包括齿轮,具体为齿轮中的每一个齿;边缘关键点包括齿轮齿面中每一齿的顶点和每一齿的底点;齿轮齿面图像中每一个齿为斜线排列,一条斜线的顶点和底点分别为一个齿的顶点和底点。具体例如,齿轮齿面中每一齿的顶点和每一齿的底点包括:第一齿底点、第二齿底点、第三齿底点、第四齿顶点和底点、第五齿顶点和底点、第六齿顶点以及第七齿顶点。As shown in Figure 3, the target to be detected includes the gear, specifically each tooth in the gear; the edge key points include the vertex and the bottom point of each tooth in the gear tooth surface; each tooth in the gear tooth surface image Arranged as slashes, the vertex and bottom point of a slash line are respectively the vertex and bottom point of a tooth. Specifically, for example, the apex of each tooth and the bottom point of each tooth in the gear tooth surface include: the first tooth bottom point, the second tooth bottom point, the third tooth bottom point, the fourth tooth top and bottom point, the fifth tooth bottom point Top and bottom points, sixth tooth apex, and seventh tooth apex.

在本实施例中,切割线像素值的第一侧为切割线像素值下方侧,切割线像素值的第二侧为切割线像素值上方侧。获得第一侧中,距离切割线像素值最接近的齿轮第一关键点,即第四齿底点;以及获得第二侧中,距离切割线像素值最接近的齿轮第二关键点,即第四齿顶点;其中,第一侧和第二侧分别为切割线像素值的两侧,相应的,齿轮第一关键点和齿轮第二关键点也分别位于切割线像素值的两侧。In this embodiment, the first side of the pixel value of the cutting line is the lower side of the pixel value of the cutting line, and the second side of the pixel value of the cutting line is the upper side of the pixel value of the cutting line. Obtain the first key point of the gear that is closest to the pixel value of the cutting line on the first side, that is, the fourth tooth bottom point; and obtain the second key point of the gear that is the closest to the pixel value of the cutting line on the second side, that is, the first Four-tooth vertex; wherein, the first side and the second side are the two sides of the pixel value of the cutting line, and correspondingly, the first key point of the gear and the second key point of the gear are also located on both sides of the pixel value of the cutting line.

根据齿轮第一关键点,即第三齿底点到切割线像素值的距离,获得第一重叠区域宽度;以及根据齿轮第二关键点,即第五齿顶点到切割线像素值的距离,获得第二重叠区域宽度。需要说明的是,若第一重叠区域宽度在切割线像素值的第一侧,则第一重叠区域宽度为切割线像素值的第二侧的切分图像对应的重叠区域宽度。According to the first key point of the gear, that is, the distance from the third tooth bottom point to the pixel value of the cutting line, the width of the first overlapping area is obtained; and according to the second key point of the gear, that is, the distance from the fifth tooth apex to the pixel value of the cutting line, to obtain Second overlap area width. It should be noted that if the first overlapping area width is on the first side of the cutting line pixel value, then the first overlapping area width is the overlapping area width corresponding to the segmented image on the second side of the cutting line pixel value.

在上述的实现过程中,待处理图像包括齿轮齿面图像;对于一条切割线的两侧,分别有第一重叠区域宽度和第二重叠区域宽度,待检测目标包括齿轮;根据齿轮齿面图像齿轮齿面中每一齿的顶点和每一齿的底点,分别获得距离切割线像素值最接近的齿轮第一关键点和距离切割线像素值最接近的齿轮第二关键点,以此确定齿轮齿面图像中第一重叠区域宽度和第二重叠区域宽度,以确保齿轮每一齿都不被切割,从而保证传递至后续处理模块的齿轮图像信息的完整性。In the above implementation process, the image to be processed includes a gear tooth surface image; for both sides of a cutting line, there are respectively a first overlapping area width and a second overlapping area width, and the target to be detected includes a gear; according to the gear tooth surface image gear The vertex of each tooth and the bottom point of each tooth in the tooth surface obtain the first key point of the gear closest to the pixel value of the cutting line and the second key point of the gear closest to the pixel value of the cutting line respectively, so as to determine the gear The width of the first overlapping area and the width of the second overlapping area in the tooth surface image ensure that each tooth of the gear is not cut, thereby ensuring the integrity of the gear image information transmitted to the subsequent processing module.

在一个优选实施例中,可以根据多条切割线像素值,将待处理图像切分为多个切分图像,切分方式可以为等分,也可以为不等分。若切分方式为等分,具体例如,若切分方向为H方向,共切分N个切分图像,则需要N-1条切割线的切割线像素值,切割线像素值分别为:第一切割线像素值为H/N、第二切割线像素值为(2*H)/N......第N-1切割线像素值为((N-1)*H)/N。分别根据每一条切割线像素值两侧的距离切割线像素值最近的边缘关键点,计算每一条切割线两侧切分图像对应的重叠区域宽度。需要注意的是,若将待处理图像切分为多个切分图像,则在中间区域的切分图像分别具有切分方向H上两个重叠区域宽度,则确定切分图像像素区域时,需要在原始像素区域上分别在切分方向的两侧加上对应的重叠区域宽度,形成切分图像像素区域。In a preferred embodiment, the image to be processed can be segmented into a plurality of segmented images according to the pixel values of the plurality of cutting lines, and the segmenting method can be equal or unequal. If the segmentation method is equal, for example, if the segmentation direction is the H direction, and a total of N segmentation images are segmented, then the pixel values of the cutting lines of N-1 cutting lines are required, and the pixel values of the cutting lines are: The pixel value of the first cutting line is H/N, the pixel value of the second cutting line is (2*H)/N...the pixel value of the N-1th cutting line is ((N-1)*H)/N . According to the edge key points closest to the pixel value of the cutting line on both sides of the pixel value of each cutting line, the width of the overlapping area corresponding to the segmented image on both sides of each cutting line is calculated. It should be noted that if the image to be processed is divided into a plurality of segmented images, the segmented images in the middle area respectively have two overlapping area widths in the segmenting direction H, and when determining the pixel area of the segmented image, it is necessary to The corresponding overlapping region widths are added to the original pixel region on both sides of the splitting direction to form a split image pixel region.

请参见图4示出的本申请实施例提供的图像处理装置的结构示意图;本申请实施例提供了一种图像处理装置200,包括:Please refer to the schematic structural diagram of the image processing device provided by the embodiment of the present application shown in FIG. 4; the embodiment of the present application provides an image processing device 200, including:

获取模块210,用于获得待处理图像的原始像素区域、切割线像素值以及重叠区域宽度;An acquisition module 210, configured to acquire the original pixel area of the image to be processed, the pixel value of the cutting line, and the width of the overlapping area;

生成像素区域模块220,用于根据原始像素值、切割线像素值以及重叠区域宽度,生成待处理图像的每一切分图像像素区域;Generate pixel area module 220, for generating each segmented image pixel area of the image to be processed according to the original pixel value, the cutting line pixel value and the width of the overlapping area;

切分模块230,用于根据每一切分图像像素区域对待处理图像进行切分,获得切分图像。The segmentation module 230 is configured to segment the image to be processed according to each pixel region of the segmented image to obtain a segmented image.

可选地,在本申请实施例中,图像处理装置200,获取模块210,具体用于根据原始像素区域和后续处理像素区域生成切割线像素值;其中,后续处理像素区域表征待处理图像在进行后续处理时,需符合的像素区域;将待处理图像输入预设的关键点检测模型,获得待处理图像中待检测目标的边缘关键点;根据切割线像素值以及待检测目标的边缘关键点,获得重叠区域宽度。Optionally, in the embodiment of the present application, the image processing device 200 and the acquisition module 210 are specifically configured to generate cutting line pixel values according to the original pixel area and the subsequent processing pixel area; wherein, the subsequent processing pixel area indicates that the image to be processed is being processed During subsequent processing, the pixel area that needs to be matched; input the image to be processed into the preset key point detection model to obtain the edge key points of the target to be detected in the image to be processed; according to the pixel value of the cutting line and the edge key point of the target to be detected, Get the overlapping area width.

可选地,在本申请实施例中,图像处理装置200,还包括:还原模块,用于获得切分图像的坐标信息;将切分图像的坐标信息进行转换,获得切分图像的还原坐标信息;其中,还原坐标信息表征在由多个切分图像拼接得到的待处理图像中的坐标信息。Optionally, in the embodiment of the present application, the image processing device 200 further includes: a restoration module, configured to obtain coordinate information of the segmented image; convert the coordinate information of the segmented image to obtain restored coordinate information of the segmented image ; Wherein, the restored coordinate information represents the coordinate information in the image to be processed obtained by splicing multiple segmented images.

可选地,在本申请实施例中,图像处理装置200,还原模块,具体用于将多个切分图像按照切分图像的索引号,依次输入预设的检测模型,获得检测结果;其中,检测结果包括每一切分图像的坐标信息,索引号根据切分图像在待处理图像中的位置关系获得;通过坐标转换公式,将切分图像的坐标信息进行转换,获得切分图像的还原坐标信息;坐标转换公式包括:Y=y-hi+(H/N)*i;其中,Y为还原坐标信息中切分方向的坐标值,y为坐标信息中切分方向的坐标值,hi为索引号为i的切分图像对应的重叠区域宽度,H为待处理图像在切分方向上的像素值,N为待处理图像的切分数量;i为切分图像的索引号,i∈[0,N-1]。Optionally, in the embodiment of the present application, the image processing device 200, the restoring module, is specifically configured to sequentially input the multiple segmented images into the preset detection model according to the index numbers of the segmented images to obtain the detection results; wherein, The detection result includes the coordinate information of each segmented image, and the index number is obtained according to the positional relationship of the segmented image in the image to be processed; through the coordinate conversion formula, the coordinate information of the segmented image is converted to obtain the restored coordinate information of the segmented image ;The coordinate transformation formula includes: Y=y-hi+(H/N)*i; wherein, Y is the coordinate value of the segmentation direction in the restored coordinate information, y is the coordinate value of the segmentation direction in the coordinate information, and h i is an index The width of the overlapping area corresponding to the segmented image numbered i, H is the pixel value of the image to be processed in the segmenting direction, N is the number of segments of the image to be processed; i is the index number of the segmented image, i∈[0 ,N-1].

可选地,在本申请实施例中,图像处理装置200,其中,原始像素区域包括待处理图像在切分方向上的像素值;切分图像包括第一切分图像和第二切分图像;生成像素区域模块220,具体用于根据切割线像素值以及重叠区域宽度,通过划分公式生成待处理图像的每一切分图像像素区域;划分公式包括:第一切分图像的像素区域为:[0,(H/2)+hi];第二切分图像的像素区域为:[(H/2)-hi,H];其中,H为待处理图像在切分方向上的像素值;H/2为切割线像素值;hi为切分图像对应的为重叠区域宽度。Optionally, in the embodiment of the present application, the image processing apparatus 200, wherein the original pixel area includes pixel values of the image to be processed in the segmentation direction; the segmented image includes a first segmented image and a second segmented image; Generate the pixel area module 220, specifically for generating each segmented image pixel area of the image to be processed according to the cutting line pixel value and the width of the overlapping area by a division formula; the division formula includes: the pixel area of the first segmented image is: [0 ,(H/2)+hi]; the pixel area of the second segmented image is: [(H/2)-hi, H]; wherein, H is the pixel value of the image to be processed in the segmented direction; H/ 2 is the pixel value of the cutting line; h i is the width of the overlapping area corresponding to the segmented image.

可选地,在本申请实施例中,图像处理装置200,还包括:重叠区域获取模块,用于分别获得切割线像素值两侧对应的待检测目标的边缘关键点;根据切割线像素值,以及切割线像素值两侧对应的待检测目标的边缘关键点,获得切割线像素值两侧的每一切分图像对应的重叠区域宽度。Optionally, in the embodiment of the present application, the image processing device 200 further includes: an overlapping area acquisition module, configured to respectively obtain edge key points of the target to be detected corresponding to both sides of the pixel value of the cutting line; according to the pixel value of the cutting line, and the edge key points of the object to be detected corresponding to both sides of the pixel value of the cutting line, and obtain the overlapping area width corresponding to each segmented image on both sides of the pixel value of the cutting line.

可选地,在本申请实施例中,图像处理装置200,其中,待处理图像包括齿轮齿面图像;重叠区域宽度包括第一重叠区域宽度和第二重叠区域宽度;待检测目标包括齿轮;边缘关键点包括齿轮齿面中每一齿的顶点和每一齿的底点;获取模块210,还用于根据切割线像素值、齿轮齿面中每一齿的顶点和每一齿的底点,分别获得距离切割线像素值最接近的齿轮第一关键点和距离切割线像素值最接近的齿轮第二关键点;其中,齿轮第一关键点和齿轮第二关键点分别位于切割线像素值的两侧;根据齿轮第一关键点到切割线像素值的距离,获得第一重叠区域宽度;以及根据齿轮第二关键点到切割线像素值的距离,获得第二重叠区域宽度。Optionally, in the embodiment of the present application, the image processing device 200, wherein the image to be processed includes a gear tooth surface image; the width of the overlapping area includes a first overlapping area width and a second overlapping area width; the target to be detected includes a gear; the edge Key points include the apex of each tooth and the bottom point of each tooth in the gear tooth surface; the acquisition module 210 is also used to, according to the pixel value of the cutting line, the apex of each tooth in the gear tooth surface and the bottom point of each tooth, The first key point of the gear closest to the pixel value of the cutting line and the second key point of the gear closest to the pixel value of the cutting line are respectively obtained; wherein, the first key point of the gear and the second key point of the gear are respectively located at the pixel value of the cutting line Both sides; according to the distance from the first key point of the gear to the pixel value of the cutting line, the first overlapping area width is obtained; and according to the distance from the second key point of the gear to the pixel value of the cutting line, the second overlapping area width is obtained.

应理解的是,该装置与上述的图像处理方法实施例对应,能够执行上述方法实施例涉及的各个步骤,该装置具体的功能可以参见上文中的描述,为避免重复,此处适当省略详细描述。该装置包括至少一个能以软件或固件(firmware)的形式存储于存储器中或固化在装置的操作系统(operating system,OS)中的软件功能模块。It should be understood that the device corresponds to the above-mentioned embodiment of the image processing method, and can perform various steps involved in the above-mentioned method embodiment. The specific functions of the device can refer to the description above. To avoid repetition, detailed descriptions are appropriately omitted here. . The device includes at least one software function module that can be stored in a memory in the form of software or firmware (firmware) or solidified in an operating system (operating system, OS) of the device.

请参见图5示出的本申请实施例提供的电子设备的结构示意图。本申请实施例提供的一种电子设备300,包括:处理器310和存储器320,存储器320存储有处理器310可执行的机器可读指令,机器可读指令被处理器310执行时执行如上的方法。Please refer to FIG. 5 , which is a schematic structural diagram of an electronic device provided by an embodiment of the present application. An electronic device 300 provided in an embodiment of the present application includes: a processor 310 and a memory 320. The memory 320 stores machine-readable instructions executable by the processor 310. When the machine-readable instructions are executed by the processor 310, the above methods are executed. .

本申请实施例还提供了一种存储介质,该存储介质上存储有计算机程序,该计算机程序被处理器运行时执行如上的方法。The embodiment of the present application also provides a storage medium, on which a computer program is stored, and when the computer program is run by a processor, the above method is executed.

其中,存储介质可以由任何类型的易失性或非易失性存储设备或者它们的组合实现,如静态随机存取存储器(Static Random Access Memory,简称SRAM),电可擦除可编程只读存储器(Electrically Erasable Programmable Read-Only Memory,简称EEPROM),可擦除可编程只读存储器(Erasable Programmable Read Only Memory,简称EPROM),可编程只读存储器(Programmable Red-Only Memory,简称PROM),只读存储器(Read-OnlyMemory,简称ROM),磁存储器,快闪存储器,磁盘或光盘。Wherein, the storage medium can be realized by any type of volatile or non-volatile storage device or their combination, such as Static Random Access Memory (Static Random Access Memory, referred to as SRAM), Electrically Erasable Programmable Read-Only Memory (Electrically Erasable Programmable Read-Only Memory, referred to as EEPROM), Erasable Programmable Read-Only Memory (Erasable Programmable Read Only Memory, referred to as EPROM), Programmable Read-Only Memory (Programmable Red-Only Memory, referred to as PROM), read-only Memory (Read-Only Memory, ROM for short), magnetic memory, flash memory, magnetic disk or optical disk.

本申请实施例所提供的几个实施例中,应该理解到,所揭露的装置和方法,也可以通过其他的方式实现。以上所描述的装置实施例仅仅是示意性的,例如,附图中的流程图和框图显示了根据本申请实施例的多个实施例的装置、方法和计算机程序产品的可能实现的体系架构、功能和操作。在这点上,流程图或框图中的每个方框可以代表一个模块、程序段或代码的一部分,模块、程序段或代码的一部分包含一个或多个用于实现规定的逻辑功能的可执行指令。也应当注意,在有些作为替换的实现方式中,方框中所标注的功能也可以不同于附图中所标注的顺序发生。例如,两个连续的方框实际上可以基本并行地执行,它们有时也可以按相反的顺序执行,这依所涉及的功能而定。也要注意的是,框图和/或流程图中的每个方框、以及框图和/或流程图中的方框的组合,可以用执行规定的功能或动作的专用的基于硬件的系统来实现,或者可以用专用硬件与计算机指令的组合来实现。In the several embodiments provided in the embodiments of the present application, it should be understood that the disclosed devices and methods may also be implemented in other ways. The device embodiments described above are only illustrative. For example, the flowcharts and block diagrams in the accompanying drawings show possible implementation architectures of devices, methods, and computer program products according to multiple embodiments of the embodiments of the present application. function and operation. In this regard, each block in a flowchart or block diagram may represent a module, program segment, or portion of code that contains one or more executable instruction. It should also be noted that, in some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks in succession may, in fact, be executed substantially concurrently, or they may sometimes be executed in the reverse order, depending upon the functionality involved. It should also be noted that each block of the block diagrams and/or flowchart illustrations, and combinations of blocks in the block diagrams and/or flowchart illustrations, can be implemented by a dedicated hardware-based system that performs the specified function or action , or may be implemented by a combination of dedicated hardware and computer instructions.

另外,在本申请实施例各个实施例中的各功能模块可以集成在一起形成一个独立的部分,也可以是各个模块单独存在,也可以两个或两个以上模块集成形成一个独立的部分。In addition, each functional module in each embodiment of the embodiment of the present application may be integrated to form an independent part, each module may exist independently, or two or more modules may be integrated to form an independent part.

以上的描述,仅为本申请实施例的可选实施方式,但本申请实施例的保护范围并不局限于此,任何熟悉本技术领域的技术人员在本申请实施例揭露的技术范围内,可轻易想到变化或替换,都应涵盖在本申请实施例的保护范围之内。The above description is only an optional implementation of the embodiment of the present application, but the scope of protection of the embodiment of the present application is not limited thereto. Anyone familiar with the technical field can Changes or substitutions that can easily be thought of should fall within the scope of protection of the embodiments of the present application.

Claims (10)

1. An image processing method, comprising:
obtaining an original pixel area, a cutting line pixel value and an overlapping area width of an image to be processed;
generating each segmentation image pixel area of the image to be processed according to the original pixel value, the cutting line pixel value and the width of the overlapping area; and
and segmenting the image to be processed according to the pixel area of each segmented image to obtain a segmented image.
2. The method of claim 1, wherein obtaining the original pixel area, the cut-line pixel value, and the overlap area width of the image to be processed comprises:
generating the cutting line pixel value according to the original pixel area and the subsequent processing pixel area; the subsequent processing pixel area represents a pixel area which needs to be met when the image to be processed is subjected to subsequent processing;
inputting the image to be processed into a preset key point detection model to obtain edge key points of a target to be detected in the image to be processed;
and obtaining the width of the overlapping area according to the cutting line pixel value and the edge key point of the target to be detected.
3. The method according to claim 1, wherein after the segmenting the image to be processed according to the each segmented image pixel region to obtain the segmented image, the method further comprises:
obtaining coordinate information of the segmented image;
converting the coordinate information of the segmented image to obtain reduced coordinate information of the segmented image; and the reduced coordinate information represents the coordinate information in the image to be processed obtained by splicing the plurality of segmented images.
4. The method according to claim 3, wherein the converting the coordinate information of the sliced image to obtain the restored coordinate information of the sliced image comprises:
sequentially inputting a plurality of the segmentation images into a preset detection model according to the index numbers of the segmentation images to obtain a detection result; the detection result comprises coordinate information of each segmented image, and the index number is obtained according to the position relation of the segmented images in the image to be processed;
converting the coordinate information of the segmented image through a coordinate conversion formula to obtain the reduced coordinate information of the segmented image;
the coordinate conversion formula includes: y = Y-hi + (H/N) × i;
y is a coordinate value of a segmentation direction in the restored coordinate information, Y is a coordinate value of the segmentation direction in the coordinate information, hi is the width of an overlapping area corresponding to the segmented image with the index number i, H is a pixel value of the image to be processed in the segmentation direction, and N is the segmentation quantity of the image to be processed; i is the index number of the segmentation image, and i belongs to [0,N-1].
5. The method according to claim 1, wherein the original pixel region comprises pixel values of the image to be processed in a slicing direction; the segmentation image comprises a first segmentation image and a second segmentation image; generating each segmentation image pixel area of the image to be processed according to the original pixel value, the cutting line pixel value and the width of the overlapping area, wherein the method comprises the following steps:
generating each segmentation image pixel area of the image to be processed through a division formula according to the cutting line pixel value and the width of the overlapping area; the division formula includes:
the pixel area of the first cut image is: [0, (H/2) + hi ];
the pixel area of the second segmentation image is: [ (H/2) -hi, H](ii) a H is a pixel value of the image to be processed in the segmentation direction; h/2 is the cutting line pixel value; h is a total of i The width of the overlapping area corresponds to the cutting image.
6. The method of claim 2, further comprising:
respectively obtaining edge key points of the target to be detected corresponding to two sides of the pixel value of the cutting line;
and obtaining the width of an overlapping area corresponding to each of the segmentation images at two sides of the cutting line pixel value according to the cutting line pixel value and the edge key points of the target to be detected corresponding to the two sides of the cutting line pixel value.
7. The method of claim 2, wherein the image to be processed comprises a gear tooth surface image; the overlap region width comprises a first overlap region width and a second overlap region width; the target to be detected comprises a gear; the edge key points include a top point of each tooth and a bottom point of each tooth in the gear tooth surface;
the obtaining the width of the overlapping area according to the cutting line pixel value and the edge key point of the target to be detected comprises:
according to the cutting line pixel value, the top point of each tooth in the tooth surface of the gear and the bottom point of each tooth, respectively obtaining a first key point of the gear closest to the cutting line pixel value and a second key point of the gear closest to the cutting line pixel value; the first key point and the second key point of the gear are respectively positioned at two sides of the pixel value of the cutting line;
obtaining the width of the first overlapping area according to the distance from the first key point of the gear to the pixel value of the cutting line; and
and obtaining the width of the second overlapping area according to the distance from the second key point of the gear to the pixel value of the cutting line.
8. An image processing apparatus characterized by comprising:
the acquisition module is used for acquiring an original pixel area, a cutting line pixel value and an overlapping area width of an image to be processed;
a pixel area generating module, configured to generate each split image pixel area of the to-be-processed image according to the original pixel value, the cutting line pixel value, and the width of the overlapping area; and
and the segmentation module is used for segmenting the image to be processed according to each segmented image pixel area to obtain a segmented image.
9. An electronic device, comprising: a processor and a memory, the memory storing machine-readable instructions executable by the processor, the machine-readable instructions, when executed by the processor, performing the method of any of claims 1 to 7.
10. A computer-readable storage medium, having stored thereon a computer program which, when being executed by a processor, is adapted to carry out the method of any one of claims 1 to 7.
CN202211236456.9A 2022-10-10 2022-10-10 Image processing method and device, electronic equipment and storage medium Pending CN115588018A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202211236456.9A CN115588018A (en) 2022-10-10 2022-10-10 Image processing method and device, electronic equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202211236456.9A CN115588018A (en) 2022-10-10 2022-10-10 Image processing method and device, electronic equipment and storage medium

Publications (1)

Publication Number Publication Date
CN115588018A true CN115588018A (en) 2023-01-10

Family

ID=84780058

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202211236456.9A Pending CN115588018A (en) 2022-10-10 2022-10-10 Image processing method and device, electronic equipment and storage medium

Country Status (1)

Country Link
CN (1) CN115588018A (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116660273A (en) * 2023-07-28 2023-08-29 菲特(天津)检测技术有限公司 Chain piece missing detection method in chain and electronic equipment
CN118506182A (en) * 2024-05-13 2024-08-16 广州中科云图智能科技有限公司 Remote sensing image detection method, device, electronic equipment and storage medium

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109493281A (en) * 2018-11-05 2019-03-19 北京旷视科技有限公司 Image processing method, device, electronic equipment and computer readable storage medium
CN112348835A (en) * 2020-11-30 2021-02-09 广联达科技股份有限公司 Method and device for detecting material quantity, electronic equipment and storage medium

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109493281A (en) * 2018-11-05 2019-03-19 北京旷视科技有限公司 Image processing method, device, electronic equipment and computer readable storage medium
CN112348835A (en) * 2020-11-30 2021-02-09 广联达科技股份有限公司 Method and device for detecting material quantity, electronic equipment and storage medium

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116660273A (en) * 2023-07-28 2023-08-29 菲特(天津)检测技术有限公司 Chain piece missing detection method in chain and electronic equipment
CN116660273B (en) * 2023-07-28 2023-10-27 菲特(天津)检测技术有限公司 Chain piece missing detection method in chain and electronic equipment
CN118506182A (en) * 2024-05-13 2024-08-16 广州中科云图智能科技有限公司 Remote sensing image detection method, device, electronic equipment and storage medium

Similar Documents

Publication Publication Date Title
US12367573B2 (en) Image processing apparatus, image processing method, and program for detecting defect from image
CN112801088B (en) Method and related device for correcting distorted text line image
CN115588018A (en) Image processing method and device, electronic equipment and storage medium
CN102800075A (en) Image splicing method and device based on linear array camera shooting
EP4336444B1 (en) Corner point detection method and apparatus
CN113284154B (en) Steel coil end face image segmentation method and device and electronic equipment
US11049268B2 (en) Superimposing position correction device and superimposing position correction method
JP5772675B2 (en) Gray image edge extraction method, edge extraction device, and gray image edge extraction program
US20230419468A1 (en) Image processing apparatus, image processing method, and image processing program
EP3185208A1 (en) Method for determining missing values in a depth map, corresponding device, computer program product and non-transitory computer-readable carrier medium
CN114092941A (en) A serial number identification method, device, electronic device and readable storage medium
US12444153B2 (en) Scanned data processing method and apparatus, device, and medium
US20250037259A1 (en) Information processing apparatus and control method thereof
US20250220145A1 (en) Parallax information generation device, parallax information generation method, and parallax information generation program
CN111337036A (en) Overlap region data optimization method and device and terminal equipment
CN108460384B (en) A character segmentation method for offline handwritten text
CN110686687A (en) Method, robot and chip for visual robot to construct map
CN116912532A (en) A substation equipment object segmentation method, device, equipment and storage medium
CN115880442B (en) Three-dimensional model reconstruction method and system based on laser scanning
CN111986111B (en) An Image Segmentation Method
CN119991817B (en) X corner point positioning method and device
US20240355114A1 (en) Area correction device, area correction method, and program
CN118657885B (en) Three-dimensional scanning reconstruction method and system
CN114240890B (en) A method, device, equipment and storage medium for removing blank space from text image
CN114723688B (en) Image processing method and system for pneumonia recognition in CT images

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