HK40023655B - Method for processing medical images, method and device for processing images - Google Patents
Method for processing medical images, method and device for processing images Download PDFInfo
- Publication number
- HK40023655B HK40023655B HK42020013888.1A HK42020013888A HK40023655B HK 40023655 B HK40023655 B HK 40023655B HK 42020013888 A HK42020013888 A HK 42020013888A HK 40023655 B HK40023655 B HK 40023655B
- Authority
- HK
- Hong Kong
- Prior art keywords
- image
- pixel
- image data
- processed
- pixel value
- Prior art date
Links
Description
技术领域Technical Field
本申请涉及人工智能领域,尤其涉及一种医学图像处理的方法、图像处理的方法及装置。This application relates to the field of artificial intelligence, and in particular to a method for medical image processing, an image processing method and apparatus.
背景技术Background Technology
随着医疗技术的发展,基于全视野数字切片(Whole Slide Image,WSI)图像的识别和分析在医疗方面起到了重要的作用。由于WSI图像的边长通常有几万像素,因此,需要将这类图像缩放或者切割为小尺寸图像进行分析,在这个过程中,WSI图像的大部分背景区域需要去除,而分割出具有病理组织切片的区域进行后续图像分析。With the development of medical technology, the recognition and analysis of whole-slide images (WSI) have played an important role in the medical field. Since WSI images typically have sides of tens of thousands of pixels, they need to be scaled or segmented into smaller images for analysis. In this process, most of the background area of the WSI image needs to be removed, while the area containing pathological tissue sections is segmented for subsequent image analysis.
目前,在WSI图像上提取病理组织区域的方式主要为,先将WSI图像缩小到一定尺度后再转化为灰度图像,然后在灰度图像上进行图像的进一步处理,例如图像二值化处理,空洞去除处理等,最后在处理后的图像上提取病理组织区域。Currently, the main method for extracting pathological tissue regions from WSI images is to first reduce the WSI image to a certain scale and then convert it into a grayscale image. Then, further image processing is performed on the grayscale image, such as image binarization and hole removal. Finally, the pathological tissue regions are extracted from the processed image.
然而,上述方式在尺度变换之后,直接将彩色图像转换为灰度图像会丢失色彩信息,而色彩信息也是一个重要的图像特征,因此,会导致提取到的病理组织区域不够准确,从而容易对后续的图像分析产生偏差。However, after scaling, directly converting a color image to a grayscale image will result in the loss of color information, which is an important image feature. Therefore, the extracted pathological tissue areas will not be accurate enough, which can easily lead to deviations in subsequent image analysis.
发明内容Summary of the Invention
本申请实施例提供了一种医学图像处理的方法、图像处理的方法及装置,用于对图像进行二值化处理之前,先利用不同通道的色彩信息生成差值图像,从而有效地利用了图像中的色彩信息,基于差值图像提取到的病理组织区域更为准确,且对后续的图像分析产生积极影响。This application provides a medical image processing method, image processing method and apparatus, which generates a difference image using color information from different channels before binarizing the image, thereby effectively utilizing the color information in the image. The pathological tissue region extracted based on the difference image is more accurate and has a positive impact on subsequent image analysis.
有鉴于此,本申请第一方面提供一种医学图像处理的方法,包括:In view of the above, the first aspect of this application provides a method for medical image processing, comprising:
获取待处理医学图像,其中,待处理医学图像为彩色图像,且待处理医学图像包括第一图像数据、第二图像数据以及第三图像数据,且第一图像数据、第二图像数据以及是第三图像数据分别对应于不同属性下的色彩信息;Acquire a medical image to be processed, wherein the medical image to be processed is a color image, and the medical image to be processed includes first image data, second image data and third image data, and the first image data, second image data and third image data respectively correspond to color information under different attributes;
根据待处理医学图像中所包括的第一图像数据、第二图像数据以及第三图像数据,生成差值图像;A difference image is generated based on the first image data, the second image data, and the third image data included in the medical image to be processed.
对差值图像进行二值化处理,得到二值化图像;The difference image is binarized to obtain a binary image;
根据二值化图像生成待处理医学图像所对应的前景分割结果。Generate the foreground segmentation result corresponding to the medical image to be processed based on the binarized image.
本申请第二方面提供一种图像处理的方法,包括:A second aspect of this application provides an image processing method, comprising:
获取第一待处理图像以及第二待处理图像,其中,第一待处理图像为彩色图像,且第一待处理图像包括第一图像数据、第二图像数据以及第三图像数据,且第一图像数据、第二图像数据以及是第三图像数据分别对应于不同通道下的色彩信息;Acquire a first image to be processed and a second image to be processed, wherein the first image to be processed is a color image and includes first image data, second image data and third image data, and the first image data, second image data and third image data respectively correspond to color information under different channels;
根据第一待处理图像中所包括的第一图像数据、第二图像数据以及第三图像数据,生成差值图像;A difference image is generated based on the first image data, the second image data, and the third image data included in the first image to be processed.
对差值图像进行二值化处理,得到二值化图像;The difference image is binarized to obtain a binary image;
根据二值化图像生成第一待处理图像所对应的前景分割结果;Generate the foreground segmentation result corresponding to the first image to be processed based on the binarized image;
根据前景分割结果,从第一待处理图像中提取目标对象;Based on the foreground segmentation results, the target object is extracted from the first image to be processed;
根据目标对象以及第二待处理图像,生成合成图像,其中,目标对象位于第一图层,第二待处理图像位于第二图层,第一图层覆盖于第二图层之上。A composite image is generated based on the target object and the second image to be processed, wherein the target object is located in the first layer, the second image to be processed is located in the second layer, and the first layer overlaps the second layer.
本申请第三方面提供一种医学图像处理装置,包括:A third aspect of this application provides a medical image processing apparatus, comprising:
获取模块,用于获取待处理医学图像,其中,待处理医学图像为彩色图像,且待处理医学图像包括第一图像数据、第二图像数据以及第三图像数据,且第一图像数据、第二图像数据以及是第三图像数据分别对应于不同通道下的色彩信息;The acquisition module is used to acquire the medical image to be processed, wherein the medical image to be processed is a color image, and the medical image to be processed includes first image data, second image data and third image data, and the first image data, second image data and third image data respectively correspond to color information under different channels;
生成模块,用于根据待处理医学图像中所包括的第一图像数据、第二图像数据以及第三图像数据,生成差值图像;The generation module is used to generate a difference image based on the first image data, the second image data, and the third image data included in the medical image to be processed;
处理模块,用于对差值图像进行二值化处理,得到二值化图像;The processing module is used to binarize the difference image to obtain a binary image;
生成模块,还用于根据二值化图像生成待处理医学图像所对应的前景分割结果。The generation module is also used to generate the foreground segmentation result corresponding to the medical image to be processed based on the binarized image.
在一种可能的设计中,在本申请实施例的第三方面的一种实现方式中,In one possible design, in one implementation of the third aspect of the embodiments of this application,
生成模块,具体用于根据待处理医学图像中所包括的第一图像数据、第二图像数据以及第三图像数据,生成最大值图像;The generation module is specifically used to generate a maximum value image based on the first image data, the second image data, and the third image data included in the medical image to be processed.
根据待处理医学图像中所包括的第一图像数据、第二图像数据以及第三图像数据,生成最小值图像;A minimum value image is generated based on the first image data, the second image data, and the third image data included in the medical image to be processed.
根据最大值图像以及最小值图像,生成差值图像。Generate a difference image based on the maximum and minimum value images.
在一种可能的设计中,在本申请实施例的第三方面的另一实现方式中,In one possible design, in another implementation of the third aspect of the embodiments of this application,
生成模块,具体用于根据待处理医学图像中所包括的第一图像数据、第二图像数据以及第三图像数据,从第一像素值、第二像素值以及第三像素值中确定目标像素点所对应的最大像素值,其中,第一像素值为第一图像数据中第一像素位置所对应的像素值,第二像素值为第二图像数据中第二像素位置所对应的像素值,第三像素值为第三图像数据中第三像素位置所对应的像素值,目标像素点为最大值图像中第四像素位置所对应的像素值,第一像素位置、第二像素位置、第三像素位置以及第四像素位置均对应于待处理医学图像中同一个像素点的位置;The generation module is specifically used to determine the maximum pixel value corresponding to the target pixel from the first pixel value, the second pixel value, and the third pixel value included in the first image data, the second image data, and the third image data in the medical image to be processed. The first pixel value is the pixel value corresponding to the first pixel position in the first image data, the second pixel value is the pixel value corresponding to the second pixel position in the second image data, the third pixel value is the pixel value corresponding to the third pixel position in the third image data, and the target pixel is the pixel value corresponding to the fourth pixel position in the maximum value image. The first pixel position, the second pixel position, the third pixel position, and the fourth pixel position all correspond to the position of the same pixel in the medical image to be processed.
生成模块,具体用于根据待处理医学图像中所包括的第一图像数据、第二图像数据以及第三图像数据,从第一像素值、第二像素值以及第三像素值中确定目标像素点所对应的最小像素值;The generation module is specifically used to determine the minimum pixel value corresponding to the target pixel from the first pixel value, the second pixel value, and the third pixel value based on the first image data, the second image data, and the third image data included in the medical image to be processed.
生成模块,具体用于将最大值图像中目标像素点所对应的最大像素值,与最大值图像中目标像素点所对应的最小像素值相减,得到差值图像中目标像素点所对应的差值像素值。The generation module is specifically used to subtract the maximum pixel value corresponding to the target pixel in the maximum value image from the minimum pixel value corresponding to the target pixel in the maximum value image, so as to obtain the difference pixel value corresponding to the target pixel in the difference image.
在一种可能的设计中,在本申请实施例的第三方面的另一实现方式中,In one possible design, in another implementation of the third aspect of the embodiments of this application,
生成模块,具体用于根据待处理医学图像中所包括的第一图像数据、第二图像数据以及第三图像数据,生成待处理差值图像;The generation module is specifically used to generate a difference image to be processed based on the first image data, the second image data, and the third image data included in the medical image to be processed.
对待处理差值图像进行高斯模糊处理,得到差值图像。Gaussian blur is applied to the difference image to obtain the difference image.
在一种可能的设计中,在本申请实施例的第三方面的另一实现方式中,医学图像处理装置还包括确定模块;In one possible design, in another implementation of the third aspect of the embodiments of this application, the medical image processing apparatus further includes a determining module;
确定模块,用于根据差值图像确定分割阈值;The determination module is used to determine the segmentation threshold based on the difference image;
确定模块,还用于若差值图像中像素点所对应的像素值大于或等于分割阈值,则将像素点确定为二值化图像的前景像素点;The determination module is also used to determine the pixel as the foreground pixel of the binarized image if the pixel value corresponding to the pixel in the difference image is greater than or equal to the segmentation threshold.
确定模块,还用于若差值图像中像素点所对应的像素值小于分割阈值,则将像素点确定为二值化图像的背景像素点。The determination module is also used to determine the pixel as the background pixel of the binarized image if the pixel value corresponding to the pixel in the difference image is less than the segmentation threshold.
在一种可能的设计中,在本申请实施例的第三方面的另一实现方式中,In one possible design, in another implementation of the third aspect of the embodiments of this application,
确定模块,具体用于根据差值图像获取N个像素点所对应的N个像素值,其中,像素值与像素点具有一一对应的关系,N为大于1的整数;The determination module is specifically used to obtain N pixel values corresponding to N pixels based on the difference image, where there is a one-to-one correspondence between pixel values and pixel points, and N is an integer greater than 1.
从N个像素值中确定待处理像素值,其中,待处理像素值为N个像素值中的最大值;Determine the pixel value to be processed from N pixel values, where the pixel value to be processed is the maximum value among the N pixel values;
根据待处理像素值以及比例阈值,计算得到分割阈值。The segmentation threshold is calculated based on the pixel value to be processed and the ratio threshold.
在一种可能的设计中,在本申请实施例的第三方面的另一实现方式中,In one possible design, in another implementation of the third aspect of the embodiments of this application,
生成模块,具体用于采用泛洪算法检测二值化图像中的背景区域,其中,背景区域包括多个背景像素点;The generation module is specifically used to detect the background region in the binarized image using a flooding algorithm, wherein the background region includes multiple background pixels;
根据二值化图像以及二值化图像中的背景区域,获取二值化图像中的前景区域内的背景像素点,其中,前景区域包括多个前景像素点;Based on the binarized image and the background region in the binarized image, obtain the background pixels within the foreground region of the binarized image, wherein the foreground region includes multiple foreground pixels;
将二值化图像中的前景区域内的背景像素点变更为前景像素点,得到空洞填补图像;By replacing background pixels in the foreground region of a binarized image with foreground pixels, a hole-filling image is obtained.
对空洞填补图像进行中值滤波处理,得到待处理医学图像所对应的前景分割结果。Median filtering is applied to the hole-filling image to obtain the foreground segmentation result corresponding to the medical image to be processed.
在一种可能的设计中,在本申请实施例的第三方面的另一实现方式中,In one possible design, in another implementation of the third aspect of the embodiments of this application,
处理模块,具体用于对空洞填补图像进行中值滤波处理,得到滤波图像,其中,滤波图像包括待处理前景区域;The processing module is specifically used to perform median filtering on the hole-filling image to obtain a filtered image, wherein the filtered image includes the foreground region to be processed;
获取待处理前景区域的边界线,其中,边界线包括M个像素点,M为大于1的整数;Obtain the boundary line of the foreground region to be processed, where the boundary line consists of M pixels, M being an integer greater than 1;
针对边界线上M个像素点中的每个像素点,向外延伸K个像素点,得到前景分割结果,其中,K为大于或等于1的整数。For each of the M pixels on the boundary line, extend outward by K pixels to obtain the foreground segmentation result, where K is an integer greater than or equal to 1.
在一种可能的设计中,在本申请实施例的第三方面的另一实现方式中,In one possible design, in another implementation of the third aspect of the embodiments of this application,
获取模块,具体用于获取原始医学图像;The acquisition module is specifically used to acquire raw medical images;
采用滑动窗口从原始医学图像中提取医学子图像;A sliding window method is used to extract medical sub-images from the original medical image;
若检测到医学子图像中包括病理组织区域,则确定为待处理医学图像;If a medical sub-image is detected to contain a pathological tissue region, it is identified as a medical image to be processed.
若检测到医学子图像中未包括病理组织区域,则将医学子图像确定为背景图像,且去除背景图像。If a medical sub-image is found to not include a pathological tissue region, the medical sub-image is identified as a background image and removed.
在一种可能的设计中,在本申请实施例的第三方面的另一实现方式中,图像处理装置还包括训练模块;In one possible design, in another implementation of the third aspect of the embodiments of this application, the image processing apparatus further includes a training module;
生成模块,还用于根据前景分割结果生成目标正样本图像,其中,目标正样本图像属于正样本集合中的一个正样本图像,且每个正样本图像包含病理组织区域;The generation module is also used to generate target positive sample images based on the foreground segmentation results, wherein the target positive sample image belongs to a positive sample image in the positive sample set, and each positive sample image contains a pathological tissue region;
获取模块,还用于获取负样本集合,其中,负样本集合包括至少一个负样本图像,且每个负样本图像不包含病理组织区域;The acquisition module is also used to acquire a negative sample set, wherein the negative sample set includes at least one negative sample image, and each negative sample image does not contain a pathological tissue region;
训练模块,用于基于正样本集合以及负样本集合,对图像分割模型进行训练。The training module is used to train the image segmentation model based on the positive and negative sample sets.
本申请第四方面提供一种图像处理装置,包括:A fourth aspect of this application provides an image processing apparatus, comprising:
获取模块,用于获取第一待处理图像以及第二待处理图像,其中,第一待处理图像为彩色图像,且第一待处理图像包括第一图像数据、第二图像数据以及第三图像数据,且第一图像数据、第二图像数据以及是第三图像数据分别对应于不同通道下的色彩信息;The acquisition module is used to acquire a first image to be processed and a second image to be processed. The first image to be processed is a color image and includes first image data, second image data and third image data. The first image data, second image data and third image data correspond to color information under different channels.
生成模块,用于根据第一待处理图像中所包括的第一图像数据、第二图像数据以及第三图像数据,生成差值图像;The generation module is used to generate a difference image based on the first image data, the second image data, and the third image data included in the first image to be processed;
处理模块,用于对差值图像进行二值化处理,得到二值化图像;The processing module is used to binarize the difference image to obtain a binary image;
生成模块,还用于根据二值化图像生成第一待处理图像所对应的前景分割结果;The generation module is also used to generate the foreground segmentation result corresponding to the first image to be processed based on the binarized image;
提取模块,用于根据前景分割结果,从第一待处理图像中提取目标对象;The extraction module is used to extract the target object from the first image to be processed based on the foreground segmentation results;
生成模块,还用于根据目标对象以及第二待处理图像,生成合成图像,其中,目标对象位于第一图层,第二待处理图像位于第二图层,第一图层覆盖于第二图层之上。The generation module is also used to generate a composite image based on the target object and the second image to be processed, wherein the target object is located in the first layer, the second image to be processed is located in the second layer, and the first layer covers the second layer.
本申请的第五方面提供了一种计算机可读存储介质,计算机可读存储介质中存储有指令,当其在计算机上运行时,使得计算机执行上述各方面的方法。The fifth aspect of this application provides a computer-readable storage medium storing instructions that, when executed on a computer, cause the computer to perform the methods described above.
从以上技术方案可以看出,本申请实施例具有以下优点:As can be seen from the above technical solutions, the embodiments of this application have the following advantages:
本申请实施例中,提供了一种医学图像处理的方法,首先可以获取到为彩色图像的待处理医学图像,并且该待处理医学图像包括第一图像数据、第二图像数据以及第三图像数据,其中第一图像数据、第二图像数据以及是第三图像数据分别对应于不同属性下的色彩信息,然后根据该待处理医学图像中所包括的第一图像数据、第二图像数据以及第三图像数据,生成差值图像,进一步地对差值图像进行二值化处理,得到二值化图像,最后根据二值化图像生成待处理医学图像所对应的前景分割结果。通过上述方式,由于灰度像素点在不同通道下的色彩信息差异较小,而彩色像素点在不同通道下的色彩信息差异较大,因此,在对图像进行二值化处理之前,先利用不同通道的色彩信息生成差值图像,从而有效地利用了图像中的色彩信息,基于差值图像提取到的病理组织区域更为准确,且对后续的图像分析产生积极影响。This application provides a method for medical image processing. First, a color medical image to be processed is acquired, comprising first image data, second image data, and third image data. The first, second, and third image data correspond to color information under different attributes. Then, a difference image is generated based on the first, second, and third image data included in the medical image to be processed. This difference image is further binarized to obtain a binarized image. Finally, a foreground segmentation result corresponding to the medical image to be processed is generated based on the binarized image. Through this method, since the color information difference of grayscale pixels in different channels is small, while the color information difference of color pixels in different channels is large, a difference image is generated using the color information of different channels before binarizing the image. This effectively utilizes the color information in the image, resulting in more accurate extraction of pathological tissue regions based on the difference image, and positively impacting subsequent image analysis.
附图说明Attached Figure Description
图1为本申请实施例中医学图像处理系统的一个架构示意图;Figure 1 is a schematic diagram of the architecture of a medical image processing system in an embodiment of this application;
图2为本申请实施例中医学图像处理的方法一个实施例示意图;Figure 2 is a schematic diagram of an embodiment of the medical image processing method in this application;
图3为本申请实施例中待处理医学图像一个实施例示意图;Figure 3 is a schematic diagram of an embodiment of the medical image to be processed in this application;
图4为本申请实施例中差值图像一个实施例示意图;Figure 4 is a schematic diagram of an embodiment of the difference image in this application;
图5为本申请实施例中二值化图像一个实施例示意图;Figure 5 is a schematic diagram of an embodiment of the binarized image in this application;
图6为本申请实施例中前景分割结果一个实施例示意图;Figure 6 is a schematic diagram of a foreground segmentation result in an embodiment of this application;
图7为本申请实施例中前景分割结果另一实施例示意图;Figure 7 is a schematic diagram of another embodiment of the foreground segmentation result in this application;
图8为本申请实施例中获取待处理医学图像一个实施例示意图;Figure 8 is a schematic diagram of an embodiment of acquiring a medical image to be processed in this application;
图9为本申请实施例中医学图像处理的方法一个流程示意图;Figure 9 is a flowchart illustrating a medical image processing method in an embodiment of this application.
图10为本申请实施例中前景分割结果一个实施例示意图;Figure 10 is a schematic diagram of a foreground segmentation result in an embodiment of this application;
图11为本申请实施例中图像处理的方法一个实施例示意图;Figure 11 is a schematic diagram of an embodiment of the image processing method in this application;
图12为本申请实施例中医学图像处理装置一个实施例示意图;Figure 12 is a schematic diagram of one embodiment of the medical image processing device in this application;
图13为本申请实施例中图像处理装置一个实施例示意图;Figure 13 is a schematic diagram of an embodiment of the image processing device in this application;
图14是本申请实施例提供的一种服务器结构示意图。Figure 14 is a schematic diagram of a server structure provided in an embodiment of this application.
具体实施方式Detailed Implementation
本申请实施例提供了一种医学图像处理的方法、图像处理的方法及装置,用于对图像进行二值化处理之前,先利用不同通道的色彩信息生成差值图像,从而有效地利用了图像中的色彩信息,基于差值图像提取到的病理组织区域更为准确,且对后续的图像分析产生积极影响。This application provides a medical image processing method, image processing method and apparatus, which generates a difference image using color information from different channels before binarizing the image, thereby effectively utilizing the color information in the image. The pathological tissue region extracted based on the difference image is more accurate and has a positive impact on subsequent image analysis.
本申请的说明书和权利要求书及上述附图中的术语“第一”、“第二”、“第三”、“第四”等(如果存在)是用于区别类似的对象,而不必用于描述特定的顺序或先后次序。应该理解这样使用的数据在适当情况下可以互换,以便这里描述的本申请的实施例例如能够以除了在这里图示或描述的那些以外的顺序实施。此外,术语“包括”和“对应于”以及他们的任何变形,意图在于覆盖不排他的包含,例如,包含了一系列步骤或单元的过程、方法、系统、产品或设备不必限于清楚地列出的那些步骤或单元,而是可包括没有清楚地列出的或对于这些过程、方法、产品或设备固有的其它步骤或单元。The terms “first,” “second,” “third,” “fourth,” etc. (if present) in the specification, claims, and accompanying drawings of this application are used to distinguish similar objects and are not necessarily used to describe a particular order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments of this application described herein can be implemented, for example, in orders other than those illustrated or described herein. Furthermore, the terms “comprising” and “corresponding to,” and any variations thereof, are intended to cover a non-exclusive inclusion; for example, a process, method, system, product, or apparatus that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or apparatus.
应理解,本申请实施例可以应用于对图像进行处理的场景中,图像作为人类感知世界的视觉基础,是人类获取信息、表达信息和传递信息的重要手段。图像处理可以对图像进行分析以达到所需结果的技术,图像处理一般指对数字图像进行处理,而数字图像是指用工业相机、摄像机以及扫描仪设备经过拍摄得到的一个大的二维数组,该数组的元素称为像素,其值称为灰度值。图像处理技术可以帮助人们更客观并且准确地认识世界,人的视觉系统可以帮助人类从外界获取大量的信息,而图像、图形又是所有视觉信息的载体,尽管人眼的鉴别力很高,可以识别上千种颜色,但很多情况下,图像对于人眼来说是模糊的甚至是不可见的,因此通过图像处理技术,可以使模糊甚至不可见的图像变得清晰。具体地,图像处理技术可以包括但不限于图像变换、图像编码压缩、图像增强和复原、图像分割、图像描述、抠图技术以及图像分类。It should be understood that the embodiments of this application can be applied to scenarios involving image processing. Images, as the visual basis for human perception of the world, are an important means for humans to acquire, express, and transmit information. Image processing is a technique that analyzes images to achieve desired results. Image processing generally refers to the processing of digital images, which are large two-dimensional arrays obtained by capturing images using industrial cameras, video cameras, and scanners. The elements of this array are called pixels, and their values are called grayscale values. Image processing technology can help people understand the world more objectively and accurately. The human visual system helps humans acquire a large amount of information from the outside world, and images and graphics are the carriers of all visual information. Although the human eye has high discrimination ability and can recognize thousands of colors, in many cases, images are blurry or even invisible to the human eye. Therefore, image processing technology can make blurry or even invisible images clear. Specifically, image processing technology can include, but is not limited to, image transformation, image encoding and compression, image enhancement and restoration, image segmentation, image description, image matting, and image classification.
具体地,本申请提供的图像处理方法可以应用于医学领域的场景中,其中,可以进行分割的医学图像包括但不限于脑图像、心脏图像、胸部图像以及细胞图像,而医学图像可能会受到噪音、场偏移效应、局部体效应以及组织运动的影响。由于生物的个体与个体之间也具有差别,并且组织结构形状复杂,因此,医学图像与普通图像相比通常模糊度较高,且具有不均匀性。本申请涉及的医学图像为彩色图像,可以是彩超图像或者全视野数字病理切片(whole slide image,WSI)图像,也可以包括从显微镜获得的彩色数字图像,以WSI图像为例,WSI图像的边长通常在1万像素至10万像素,对于WSI图像而言往往需要缩放或者切割成小尺寸图像来进一步处理,在对图像进行处理的过程中,需要分割出有病理组织切片的区域,进而根据该区域来进行病理分析,例如细胞核定量分析,细胞膜定量分析,细胞质定量分析,组织微脉管分析以及组织微脉管分析等。因此,基于医学图像的特点,通过本申请医学图像处理的方法,可以获取到待处理医学图像,并且根据该待处理医学图像中所包括的第一图像数据、第二图像数据以及第三图像数据,生成差值图像,其中第一图像数据、第二图像数据以及是第三图像数据分别对应于不同属性下的色彩信息,进一步地对差值图像进行二值化处理,得到二值化图像,最后根据二值化图像生成待处理医学图像所对应的前景分割结果。由于灰度像素点在不同通道下的色彩信息差异较小,而彩色像素点在不同通道下的色彩信息差异较大,因此在对图像进行二值化处理之前,先利用不同通道的色彩信息生成差值图像,从而有效地利用了图像中的色彩信息,基于差值图像提取到的病理组织区域更为准确,且对后续的图像分析产生积极影响。Specifically, the image processing method provided in this application can be applied to medical scenarios. The segmentable medical images include, but are not limited to, brain images, heart images, chest images, and cell images. Medical images may be affected by noise, field shift effects, local volume effects, and tissue motion. Due to the differences between individual organisms and the complex shapes of tissue structures, medical images typically have higher blurriness and non-uniformity compared to ordinary images. The medical images involved in this application are color images, which can be color ultrasound images or whole-slide images (WSI) images, or color digital images obtained from a microscope. Taking WSI images as an example, the side length of WSI images is typically between 10,000 and 100,000 pixels. WSI images often need to be scaled or cropped into smaller images for further processing. During image processing, it is necessary to segment the areas containing pathological tissue sections, and then perform pathological analysis based on these areas, such as quantitative analysis of cell nuclei, cell membranes, cytoplasm, and tissue microvascular analysis. Therefore, based on the characteristics of medical images, the medical image processing method of this application can acquire the medical image to be processed, and generate a difference image based on the first image data, second image data, and third image data included in the medical image to be processed. The first image data, second image data, and third image data correspond to color information under different attributes, respectively. The difference image is further binarized to obtain a binarized image. Finally, the foreground segmentation result corresponding to the medical image to be processed is generated based on the binarized image. Since the color information difference of grayscale pixels in different channels is small, while the color information difference of color pixels in different channels is large, a difference image is generated using the color information of different channels before binarizing the image. This effectively utilizes the color information in the image, resulting in more accurate extraction of pathological tissue regions based on the difference image, and positively impacting subsequent image analysis.
在又一示例中,例如图像处理还可以应用于遥感领域的场景中。由于信息技术、空间技术的飞速发展和卫星空间分辨率的不断提高,高分辨率遥感图像可以应用于海洋监测、土地覆盖监测、海洋污染以及海事救援中,而高分辨率遥感图像有着图像细节信息丰富、地物几何结构显著、以及目标结构复杂的特点,例如在高分辨率遥感图像中海岸线的物体阴影复杂、植被覆盖面积大或者明暗的人工设施分割不够明确,由于高分辨率遥感图像与普通图像相比通常细节更多并且更为复杂,当需要对高分辨率遥感图像中植被覆盖面积进行确定时,可以将植被从高分辨率遥感图像中扣除,从而确定所对应的面积。因此基于高分辨率遥感图像的特点,通过本申请图像处理的方法,可以根据第一待处理图像中所包括的第一图像数据、第二图像数据以及第三图像数据,生成差值图像,其中第一待处理图像为彩色图像,第一待处理图像所包括的第一图像数据、第二图像数据以及第三图像数据分别对应于不同通道下的色彩信息,然后对生成的差值图像进行二值化处理,得到二值化图像,并根据二值化图像生成第一待处理图像所对应的前景分割结果,进而根据前景分割结果,从第一待处理图像中提取出目标对象(如植被区域)。在对图像进行二值化处理之前,先利用不同通道的色彩信息生成差值图像,由于灰度像素点在不同通道下的色彩信息差异较小,而彩色像素点在不同通道下的色彩信息差异较大,因此可以有效地利用图像中的色彩信息,基于差值图像提取到的目标对象更为准确,可以更精确的得到高分辨率遥感图像中的细节,从而提升高分辨率遥感图像处理的准确率。In another example, image processing can also be applied to remote sensing scenarios. Due to the rapid development of information technology and space technology, and the continuous improvement of satellite spatial resolution, high-resolution remote sensing images can be applied to marine monitoring, land cover monitoring, marine pollution control, and maritime rescue. High-resolution remote sensing images are characterized by rich image detail, significant geometric structures of ground features, and complex target structures. For example, in high-resolution remote sensing images, the shadows of objects along the coastline are complex, the vegetation coverage area is large, or the distinction between light and dark man-made structures is not clear. Because high-resolution remote sensing images are usually more detailed and complex than ordinary images, when it is necessary to determine the vegetation coverage area in a high-resolution remote sensing image, the vegetation can be subtracted from the high-resolution remote sensing image to determine the corresponding area. Therefore, based on the characteristics of high-resolution remote sensing images, the image processing method of this application can generate a difference image based on the first image data, second image data, and third image data included in the first image to be processed. The first image to be processed is a color image, and the first image data, second image data, and third image data included in the first image to be processed correspond to color information in different channels. Then, the generated difference image is binarized to obtain a binarized image. Based on the binarized image, a foreground segmentation result corresponding to the first image to be processed is generated. Furthermore, based on the foreground segmentation result, the target object (such as a vegetation area) is extracted from the first image to be processed. Before binarizing the image, a difference image is generated using the color information of different channels. Since the color information difference of grayscale pixels in different channels is small, while the color information difference of color pixels in different channels is large, the color information in the image can be effectively utilized. The target object extracted based on the difference image is more accurate, and the details in the high-resolution remote sensing image can be obtained more precisely, thereby improving the accuracy of high-resolution remote sensing image processing.
本申请实施例以应用于医学领域的场景为示例进行说明,为了在医学领域的场景中,提升提取的病理组织区域的准确性,且对后续的图像分析产生积极影响。本申请提出了一种医学图像处理的方法,该方法应用于图1所示的医学图像处理系统,请参阅图1,图1为本申请实施例中医学图像处理系统的一个架构示意图,如图所示,图像处理系统中包括服务器和终端设备。而医学图像处理装置可以部署于服务器,也可以部署于具有较高计算力的终端设备。This application uses a medical field scenario as an example for illustration. To improve the accuracy of extracted pathological tissue regions in a medical setting and positively impact subsequent image analysis, this application proposes a medical image processing method. This method is applied to the medical image processing system shown in Figure 1. Figure 1 is a schematic diagram of the architecture of the medical image processing system in this application embodiment. As shown, the image processing system includes a server and terminal devices. The medical image processing device can be deployed on the server or on a terminal device with high computing power.
以医学图像处理装置部署于服务器为例,服务器获取待处理医学图像,然后服务器根据该待处理医学图像中所包括的第一图像数据、第二图像数据以及第三图像数据,生成差值图像,进一步地对差值图像进行二值化处理,得到二值化图像,最后服务器根据二值化图像生成待处理医学图像所对应的前景分割结果。服务器可以基于前景分割结果进行医学图像分析。Taking a medical image processing device deployed on a server as an example, the server acquires the medical image to be processed. Then, based on the first image data, second image data, and third image data included in the medical image to be processed, the server generates a difference image. Further, the difference image is binarized to obtain a binarized image. Finally, the server generates the foreground segmentation result corresponding to the medical image to be processed based on the binarized image. The server can then perform medical image analysis based on the foreground segmentation result.
以医学图像处理装置部署于终端设备为例,终端设备获取待处理医学图像,然后终端设备根据该待处理医学图像中所包括的第一图像数据、第二图像数据以及第三图像数据,生成差值图像,进一步地对差值图像进行二值化处理,得到二值化图像,最后终端设备根据二值化图像生成待处理医学图像所对应的前景分割结果。终端设备可以基于前景分割结果进行医学图像分析。Taking a medical image processing device deployed on a terminal device as an example, the terminal device acquires the medical image to be processed. Then, based on the first image data, second image data, and third image data included in the medical image to be processed, the terminal device generates a difference image. Further, the difference image is binarized to obtain a binarized image. Finally, the terminal device generates the foreground segmentation result corresponding to the medical image to be processed based on the binarized image. The terminal device can then perform medical image analysis based on the foreground segmentation result.
其中,图1中的服务器可以是一台服务器或多台服务器组成的服务器集群或云计算中心等,具体此处均不限定。终端设备可以为图1中示出的平板电脑、笔记本电脑、掌上电脑、手机、个人电脑(personal computer,PC)及语音交互设备,也可以为监控设备、人脸识别设备等,此处不做限定。In Figure 1, the server can be a single server, a server cluster consisting of multiple servers, or a cloud computing center, etc., and there are no specific limitations here. The terminal device can be a tablet computer, laptop computer, PDA, mobile phone, personal computer (PC), or voice interaction device shown in Figure 1, or it can be a monitoring device, facial recognition device, etc., and there are no limitations here.
虽然图1中仅示出了五个终端设备和一个服务器,但应当理解,图1中的示例仅用于理解本方案,具体终端设备和服务器的数量均应当结合实际情况灵活确定。Although only five terminal devices and one server are shown in Figure 1, it should be understood that the example in Figure 1 is only for understanding this scheme, and the specific number of terminal devices and servers should be flexibly determined based on the actual situation.
由于本申请实施例是应用于人工智能领域的,在对本申请实施例提供的模型训练的方法开始介绍之前,先对人工智能领域的一些基础概念进行介绍。人工智能(ArtificialIntelligence,AI)是利用数字计算机或者数字计算机控制的机器模拟、延伸和扩展人的智能,感知环境、获取知识并使用知识获得最佳结果的理论、方法、技术及应用系统。换句话说,人工智能是计算机科学的一个综合技术,它企图了解智能的实质,并生产出一种新的能以人类智能相似的方式做出反应的智能机器。人工智能也就是研究各种智能机器的设计原理与实现方法,使机器具有感知、推理与决策的功能。人工智能技术是一门综合学科,涉及领域广泛,既有硬件层面的技术也有软件层面的技术。人工智能基础技术一般包括如传感器、专用人工智能芯片、云计算、分布式存储、大数据处理技术、操作/交互系统、机电一体化等技术。人工智能软件技术主要包括计算机视觉技术、语音处理技术、自然语言处理技术以及机器学习/深度学习等几大方向。而机器学习(Machine Learning,ML)是一门多领域交叉学科,涉及概率论、统计学、逼近论、凸分析、算法复杂度理论等多门学科。专门研究计算机怎样模拟或实现人类的学习行为,以获取新的知识或技能,重新组织已有的知识结构使之不断改善自身的性能。机器学习是人工智能的核心,是使计算机具有智能的根本途径,其应用遍及人工智能的各个领域。机器学习和深度学习通常包括人工神经网络、置信网络、强化学习、迁移学习、归纳学习、式教学习等技术。Since the embodiments of this application are applied to the field of artificial intelligence, before introducing the model training method provided in the embodiments of this application, some basic concepts in the field of artificial intelligence will be introduced first. Artificial Intelligence (AI) is the theory, method, technology, and application system that uses digital computers or machines controlled by digital computers to simulate, extend, and expand human intelligence, perceive the environment, acquire knowledge, and use knowledge to obtain optimal results. In other words, artificial intelligence is a comprehensive technology of computer science that attempts to understand the essence of intelligence and produce a new kind of intelligent machine that can react in a way similar to human intelligence. Artificial intelligence studies the design principles and implementation methods of various intelligent machines, enabling machines to have the functions of perception, reasoning, and decision-making. Artificial intelligence technology is a comprehensive discipline involving a wide range of fields, including both hardware and software technologies. Basic artificial intelligence technologies generally include sensors, dedicated artificial intelligence chips, cloud computing, distributed storage, big data processing technology, operating/interactive systems, mechatronics, and other technologies. Artificial intelligence software technologies mainly include computer vision technology, speech processing technology, natural language processing technology, and machine learning/deep learning. Machine learning (ML) is a multidisciplinary field involving probability theory, statistics, approximation theory, convex analysis, and algorithm complexity theory, among others. It specifically studies how computers can simulate or implement human learning behavior to acquire new knowledge or skills and reorganize existing knowledge structures to continuously improve their performance. Machine learning is the core of artificial intelligence and the fundamental way to endow computers with intelligence; its applications span all areas of artificial intelligence. Machine learning and deep learning typically include techniques such as artificial neural networks, belief networks, reinforcement learning, transfer learning, inductive learning, and instructional learning.
随着人工智能技术研究和进步,人工智能技术在多种方向展开研究,计算机视觉技术(Computer Vision,CV)就是人工智能技术的多种研究方向中研究如何使机器“看”的科学,更进一步的说,就是指用摄影机和电脑代替人眼对目标进行识别、跟踪和测量等机器视觉,并进一步做图形处理,使电脑处理成为更适合人眼观察或传送给仪器检测的图像。作为一个科学学科,计算机视觉研究相关的理论和技术,试图建立能够从图像或者多维数据中获取信息的人工智能系统。计算机视觉技术通常包括图像处理、图像识别、图像语义理解、图像检索、光学字符识别(Optical Character Recognition,OCR)、视频处理、视频语义理解、视频内容/行为识别、三维物体重建、3D技术、虚拟现实、增强现实、同步定位与地图构建等技术,还包括常见的人脸识别、指纹识别等生物特征识别技术。With the research and advancement of artificial intelligence (AI) technology, AI research has expanded into various directions. Computer vision (CV) is one such research area within AI, studying how to enable machines to "see." More specifically, it refers to machine vision, which uses cameras and computers to replace human eyes in tasks such as target recognition, tracking, and measurement, and further performs image processing to create images more suitable for human observation or transmission to instruments. As a scientific discipline, computer vision researches related theories and technologies, attempting to establish AI systems capable of extracting information from images or multidimensional data. Computer vision technologies typically include image processing, image recognition, image semantic understanding, image retrieval, optical character recognition (OCR), video processing, video semantic understanding, video content/behavior recognition, 3D object reconstruction, 3D technology, virtual reality, augmented reality, simultaneous localization and mapping (SLAM), and common biometric recognition technologies such as facial recognition and fingerprint recognition.
本申请实施例提供的方案涉及人工智能的图像处理技术,结合上述介绍,下面将对本申请中医学图像处理的方法进行介绍,请参阅图2,图2为本申请实施例中医学图像处理的方法一个实施例示意图,如图所示本申请实施例中对医学图像处理的方法一个实施例包括:The solutions provided in this application relate to image processing technology using artificial intelligence. Based on the above description, the method for medical image processing in this application will be described below. Please refer to Figure 2, which is a schematic diagram of an embodiment of the medical image processing method in this application. As shown in the figure, an embodiment of the medical image processing method in this application includes:
101、获取待处理医学图像,其中,待处理医学图像为彩色图像,且待处理医学图像包括第一图像数据、第二图像数据以及第三图像数据,且第一图像数据、第二图像数据以及是第三图像数据分别对应于不同通道下的色彩信息;101. Acquire a medical image to be processed, wherein the medical image to be processed is a color image, and the medical image to be processed includes first image data, second image data and third image data, and the first image data, second image data and third image data correspond to color information under different channels respectively;
本实施例中,医学图像处理装置可以获取到为彩色图像的待处理医学图像,该待处理医学图像可以包括第一图像数据、第二图像数据以及第三图像数据,并且第一图像数据、第二图像数据以及是第三图像数据分别对应于不同通道下的色彩信息。其中,待处理医学图像可以为医学图像处理装置通过有线网络接收到的医学图像,还可以为医学图像处理装置本身存储的医学图像。In this embodiment, the medical image processing device can acquire a color medical image to be processed. This medical image may include first image data, second image data, and third image data, each corresponding to color information in a different channel. The medical image to be processed can be a medical image received by the medical image processing device via a wired network, or a medical image stored within the medical image processing device itself.
具体地,待处理医学图像可以为WSI图像中截取下来的一个区域,该WSI图像可以通过显微镜对成片进行扫描,由于成片指的就是苏木精或者其他染色方法之后做好的玻片,通过显微镜对成片进行扫描后所得到的WSI图像即为彩色图像。其中,彩色图像的图像色彩模式包含但不仅限于红绿蓝(red green blue,RGB)色彩模式,色调-饱和度-明度(luminance bandwidth chrominance,YUV)色彩模式,色调-饱和度-明度(Hue-Saturation-Value,HSV)色彩模式,而色彩信息可以表示为不同通道下的像素值,例如R通道的像素值,G通道的像素值,B通道的像素值。Specifically, the medical image to be processed can be a region cropped from a WSI image. This WSI image can be obtained by scanning a slide under a microscope. Since the slide refers to a glass slide prepared after staining with hematoxylin or other methods, the WSI image obtained after scanning the slide under a microscope is a color image. The color mode of the color image includes, but is not limited to, the red-green-blue (RGB) color mode, the luminance-bandwidth-chrominance (YUV) color mode, and the hue-saturation-value (HSV) color mode. Color information can be represented as pixel values in different channels, such as the pixel values of the R channel, G channel, and B channel.
WSI图像的格式包括但不限于SVS以及NDPI等文件格式,而WSI图像的长宽通常在几万像素范围内,图像尺寸较大,直接对该WSI图像进行处理需要较大内存,因此,需要对WSI图像进行切割。通常可以采用python的openslide工具读取WSI图像,openslide工具可以实现文件格式的转换,还可以将WSI图像中截取下来的一个区域存储为分辨率12*12的图像,在实际情况下包括但不限于存储为分辨率15*15以及50*50等分辨率,多个图像均存在同一个WSI图像文件中,在实际应用中读取WSI图像文件中分辨率最大的图像为待处理图像。并且本实施例可以在缩小的WSI图像上截取待处理医学图像,且WSI图像可以缩小任意倍数,例如20倍或10倍,缩小后的WSI图像的长宽在几千像素范围内,应理解,由于缩小倍数为人为定义的,因此具体缩小倍数应当结合实际情况灵活确定。WSI images come in formats including, but not limited to, SVS and NDPI. Since WSI images are typically tens of thousands of pixels in length and width, their large size necessitates significant memory usage for direct processing. Therefore, WSI image cropping is necessary. Python's OpenSlide tool can be used to read WSI images. OpenSlide can convert file formats and store a cropped region as a 12x12 resolution image. In practice, this includes, but is not limited to, storing it at resolutions of 15x15 and 50x50. Multiple images can reside in the same WSI image file. In practical applications, the image with the highest resolution in the WSI image file is selected as the image to be processed. Furthermore, this embodiment can crop the medical image to be processed from a reduced WSI image, and the WSI image can be reduced by any factor, such as 20x or 10x. The length and width of the reduced WSI image are within the range of several thousand pixels. It should be understood that since the reduction factor is manually defined, the specific reduction factor should be flexibly determined based on the actual situation.
为了便于理解,请参阅图3,图3为本申请实施例中待处理医学图像一个实施例示意图,如图所示,待处理医学图像包括病例组织区域,并且没有其他灰度背景或纯白背景对该待处理医学图像进行干扰。为了进一步理解本实施例,以待处理医学图像的图像色彩模式为RGB为示例进行说明,由于待处理医学图像包括的第一图像数据、第二图像数据以及第三图像数据分别对应于不同通道下的色彩信息,若彩色图像对应的RGB为(200,100,60),则第一图像数据可以为R通道对应像素值200,第二图像数据可以为G通道对应像素值100,第三图像数据可以为B通道对应像素值60。若彩色图像对应的RGB为(100,80,40),则第一图像数据可以为R通道对应像素值100,第二图像数据可以为G通道对应像素值800,第三图像数据可以为B通道对应像素值40。For ease of understanding, please refer to Figure 3. Figure 3 is a schematic diagram of an embodiment of the medical image to be processed in this application. As shown in the figure, the medical image to be processed includes a case tissue area, and there are no other grayscale or pure white backgrounds interfering with the medical image to be processed. To further understand this embodiment, we will use RGB as an example for illustration. Since the first image data, second image data, and third image data included in the medical image to be processed correspond to color information under different channels, if the RGB corresponding to the color image is (200, 100, 60), then the first image data can be the pixel value 200 corresponding to the R channel, the second image data can be the pixel value 100 corresponding to the G channel, and the third image data can be the pixel value 60 corresponding to the B channel. If the RGB corresponding to the color image is (100, 80, 40), then the first image data can be the pixel value 100 corresponding to the R channel, the second image data can be the pixel value 800 corresponding to the G channel, and the third image data can be the pixel value 40 corresponding to the B channel.
需要说明的是,对于HSV图像或者YUV图像而言,可以先将HSV图像或者YUV图像转换为RGB图像,再进行后续处理。It should be noted that for HSV or YUV images, you can first convert the HSV or YUV image to an RGB image before performing subsequent processing.
应理解,在实际应用中,第一图像数据、第二图像数据以及第三图像数据具体对应的色彩信息均应当结合实际情况灵活确定。并且医学图像处理装置可以部署于服务器,也可以部署于具有较高计算力的终端设备,本实施例以医学图像处理装置部署于服务器为例进行介绍。It should be understood that in practical applications, the specific color information corresponding to the first, second, and third image data should be flexibly determined based on the actual situation. Furthermore, the medical image processing device can be deployed on a server or on a terminal device with high computing power; this embodiment uses the deployment of the medical image processing device on a server as an example.
102、根据待处理医学图像中所包括的第一图像数据、第二图像数据以及第三图像数据,生成差值图像;102. Generate a difference image based on the first image data, the second image data, and the third image data included in the medical image to be processed;
本实施例中,医学图像处理装置可以根据第一图像数据、第二图像数据以及第三图像数据,生成差值图像。具体地,该差值图像表现为灰度图像。为了便于理解,请参阅图4,图4为本申请实施例中差值图像一个实施例示意图,如图所示,根据图4中(A)所示出包括的第一图像数据、第二图像数据以及第三图像数据的待处理医学图像,可以生成图4中(B)所示出的差值图像。该差值图像可以为图中所示包括病理组织区域的图像,由于用到了对应于不同通道下的色彩信息,区别出像素值,以待处理医学图像的图像色彩模式为RGB为示例进行说明,若待处理医学图像为灰色的话RGB比较相近,待处理医学图像为彩色的话RGB之间差值很大,存在病理组织的地方有较大的色差。In this embodiment, the medical image processing device can generate a difference image based on the first image data, the second image data, and the third image data. Specifically, the difference image is a grayscale image. For ease of understanding, please refer to Figure 4, which is a schematic diagram of an embodiment of the difference image in this application. As shown in the figure, based on the medical image to be processed, including the first image data, the second image data, and the third image data shown in Figure 4 (A), the difference image shown in Figure 4 (B) can be generated. This difference image can be an image including pathological tissue areas as shown in the figure. Since color information corresponding to different channels is used to distinguish pixel values, taking the image color mode of the medical image to be processed as RGB as an example, if the medical image to be processed is grayscale, the RGB values are relatively similar; if the medical image to be processed is color, the difference between RGB values is large, and there is a large color difference in the areas where pathological tissue exists.
103、对差值图像进行二值化处理,得到二值化图像;103. Perform binarization on the difference image to obtain a binarized image;
本实施例中,医学图像处理装置可以对步骤102所生成的差值图像进行二值化处理,得到二值化图像。为了便于理解,请参阅图5,图5为本申请实施例中二值化图像一个实施例示意图,如图所示,根据图5中(A)所示出的差值图像,由于差值图像为灰度图像,可以使用基于灰度图像的分割,具体地,本实施例中采用自适应二值化方式来进行前景分割,即对差值图像进行二值化处理,从而的得到图5中(B)所示出的二值化图像。并且该二值化图像中,白色为包括病理组织区域的前景区域,而黑色为不包括病理组织区域的背景区域。In this embodiment, the medical image processing device can binarize the difference image generated in step 102 to obtain a binarized image. For ease of understanding, please refer to Figure 5, which is a schematic diagram of an embodiment of the binarized image in this application. As shown in Figure 5(A), since the difference image is a grayscale image, grayscale-based segmentation can be used. Specifically, in this embodiment, an adaptive binarization method is used for foreground segmentation, that is, the difference image is binarized to obtain the binarized image shown in Figure 5(B). Furthermore, in this binarized image, white represents the foreground region including the pathological tissue region, while black represents the background region excluding the pathological tissue region.
104、根据二值化图像生成待处理医学图像所对应的前景分割结果。104. Generate the foreground segmentation result corresponding to the medical image to be processed based on the binarized image.
本实施例中,医学图像处理装置可以根据步骤103所得到的二值化图像,生成待处理医学图像所对应的前景分割结果。为了便于理解,请参阅图6,图6为本申请实施例中前景分割结果一个实施例示意图,如图所示,根据图6中(A)所示出的二值化图像,由于白色为包括病理组织区域的前景区域,而黑色为不包括病理组织区域的背景区域,由此可以根据该二值化图像,生成如图6中(B)所示出待处理医学图像所对应的前景分割结果。In this embodiment, the medical image processing device can generate a foreground segmentation result corresponding to the medical image to be processed based on the binarized image obtained in step 103. For ease of understanding, please refer to Figure 6, which is a schematic diagram of an embodiment of the foreground segmentation result in this application. As shown in the figure, based on the binarized image shown in Figure 6(A), since white represents the foreground region including the pathological tissue region and black represents the background region excluding the pathological tissue region, the foreground segmentation result corresponding to the medical image to be processed shown in Figure 6(B) can be generated based on the binarized image.
本申请实施例中,提供了一种医学图像处理的方法,通过上述方式,由于灰度像素点在不同通道下的色彩信息差异较小,而彩色像素点在不同通道下的色彩信息差异较大,因此,在对图像进行二值化处理之前,先利用不同通道的色彩信息生成差值图像,从而有效地利用了图像中的色彩信息,基于差值图像提取到的病理组织区域更为准确,且对后续的图像分析产生积极影响。In this embodiment of the application, a method for medical image processing is provided. In this method, since the color information difference of grayscale pixels in different channels is small, while the color information difference of color pixels in different channels is large, before binarizing the image, a difference image is generated using the color information of different channels. This effectively utilizes the color information in the image, and the pathological tissue region extracted based on the difference image is more accurate, which has a positive impact on subsequent image analysis.
可选地,在上述图2对应的实施例的基础上,本申请实施例提供的医学图像处理的方法一个可选实施例中,根据待处理医学图像中所包括的第一图像数据、第二图像数据以及第三图像数据,生成差值图像,可以包括:Optionally, based on the embodiment corresponding to Figure 2 above, in an optional embodiment of the medical image processing method provided in this application, generating a difference image according to the first image data, second image data, and third image data included in the medical image to be processed may include:
根据待处理医学图像中所包括的第一图像数据、第二图像数据以及第三图像数据,生成最大值图像;A maximum value image is generated based on the first image data, the second image data, and the third image data included in the medical image to be processed.
根据待处理医学图像中所包括的第一图像数据、第二图像数据以及第三图像数据,生成最小值图像;A minimum value image is generated based on the first image data, the second image data, and the third image data included in the medical image to be processed.
根据最大值图像以及最小值图像,生成差值图像。Generate a difference image based on the maximum and minimum value images.
本实施例中,医学图像处理装置在获取到待处理医学图像之后,可以根据待处理医学图像中所包括的第一图像数据、第二图像数据以及第三图像数据,生成最大值图像,然后再根据待处理医学图像中所包括的第一图像数据、第二图像数据以及第三图像数据,生成最小值图像,最后根据最大值图像以及最小值图像,即可生成差值图像。In this embodiment, after acquiring the medical image to be processed, the medical image processing device can generate a maximum value image based on the first image data, the second image data, and the third image data included in the medical image to be processed. Then, it can generate a minimum value image based on the first image data, the second image data, and the third image data included in the medical image to be processed. Finally, a difference image can be generated based on the maximum value image and the minimum value image.
具体地,以待处理医学图像的图像色彩模式为RGB为示例进行说明,由于待处理医学图像包括的第一图像数据、第二图像数据以及第三图像数据分别对应于不同通道下的色彩信息,色彩信息表示为通过R通道,G通道以及B通道所对应的像素值,确定在R通道,G通道以及B通道中的最大值,通过该最大值以确定最大值图像,同理,可确定在R通道,G通道以及B通道中的最小值,通过该最小值可以确定最小值图像,然后将最大值图像中每个像素点与最小值图像中对应位置上的每个像素点进行相减,得到差值图像。Specifically, taking the RGB color mode of the medical image to be processed as an example, since the first image data, the second image data, and the third image data of the medical image to be processed correspond to color information in different channels, the color information is represented by the pixel values corresponding to the R channel, G channel, and B channel. The maximum value in the R channel, G channel, and B channel is determined, and the maximum value image is determined by the maximum value. Similarly, the minimum value in the R channel, G channel, and B channel can be determined, and the minimum value image can be determined by the minimum value. Then, each pixel in the maximum value image is subtracted from each pixel in the corresponding position in the minimum value image to obtain the difference image.
本申请实施例中,提供了一种生成差值图像的方法,通过上述方式,根据第一图像数据、第二图像数据以及第三图像数据生成最大值图像以及最小值图像,由于不同图像数据对应的色彩信息不同,根据不同图像数据所确定的最大值图像以及最小值图像,所包括的待处理医学图像的色彩信息准确度较高,从而提升差值图像生成的准确度。In this embodiment of the application, a method for generating a difference image is provided. By means of the above method, a maximum value image and a minimum value image are generated based on the first image data, the second image data, and the third image data. Since the color information corresponding to different image data is different, the maximum value image and the minimum value image determined based on different image data include color information of the medical image to be processed with high accuracy, thereby improving the accuracy of the difference image generation.
可选地,在上述图2对应的实施例的基础上,本申请实施例提供的医学图像处理的方法另一可选实施例中,根据待处理医学图像中所包括的第一图像数据、第二图像数据以及第三图像数据,生成最大值图像,可以包括:Optionally, based on the embodiment corresponding to Figure 2 above, in another optional embodiment of the medical image processing method provided in this application, generating a maximum value image based on the first image data, second image data, and third image data included in the medical image to be processed may include:
根据待处理医学图像中所包括的第一图像数据、第二图像数据以及第三图像数据,从第一像素值、第二像素值以及第三像素值中确定目标像素点所对应的最大像素值,其中,第一像素值为第一图像数据中第一像素位置所对应的像素值,第二像素值为第二图像数据中第二像素位置所对应的像素值,第三像素值为第三图像数据中第三像素位置所对应的像素值,目标像素点为最大值图像中第四像素位置所对应的像素值,第一像素位置、第二像素位置、第三像素位置以及第四像素位置均对应于待处理医学图像中同一个像素点的位置;Based on the first image data, second image data, and third image data included in the medical image to be processed, the maximum pixel value corresponding to the target pixel is determined from the first pixel value, the second pixel value, and the third pixel value. The first pixel value is the pixel value corresponding to the first pixel position in the first image data, the second pixel value is the pixel value corresponding to the second pixel position in the second image data, the third pixel value is the pixel value corresponding to the third pixel position in the third image data, and the target pixel is the pixel value corresponding to the fourth pixel position in the maximum value image. The first pixel position, the second pixel position, the third pixel position, and the fourth pixel position all correspond to the position of the same pixel in the medical image to be processed.
根据待处理医学图像中所包括的第一图像数据、第二图像数据以及第三图像数据,生成最小值图像,可以包括:Generating a minimum value image based on the first image data, second image data, and third image data included in the medical image to be processed may include:
根据待处理医学图像中所包括的第一图像数据、第二图像数据以及第三图像数据,从第一像素值、第二像素值以及第三像素值中确定目标像素点所对应的最小像素值;Based on the first image data, second image data, and third image data included in the medical image to be processed, determine the minimum pixel value corresponding to the target pixel from the first pixel value, second pixel value, and third pixel value;
根据最大值图像以及最小值图像,生成差值图像,可以包括:Generating a difference image based on the maximum and minimum value images can include:
将最大值图像中目标像素点所对应的最大像素值,与最大值图像中目标像素点所对应的最小像素值相减,得到差值图像中目标像素点所对应的差值像素值。Subtract the maximum pixel value corresponding to the target pixel in the maximum value image from the minimum pixel value corresponding to the target pixel in the maximum value image to obtain the difference pixel value corresponding to the target pixel in the difference image.
本实施例中,医学图像处理装置可以根据待处理医学图像中所包括的第一图像数据、第二图像数据以及第三图像数据,确定目标像素点所对应的最大像素值。其次,还可以根据待处理医学图像中所包括的第一图像数据、第二图像数据以及第三图像数据,确定目标像素点所对应的最小像素值,然后根据所确定的最大像素值以及最小像素值。最后将最大值图像中目标像素点所对应的最大像素值,与最大值图像中目标像素点所对应的最小像素值相减,得到差值图像中目标像素点所对应的差值像素值。In this embodiment, the medical image processing device can determine the maximum pixel value corresponding to the target pixel based on the first image data, second image data, and third image data included in the medical image to be processed. Secondly, it can also determine the minimum pixel value corresponding to the target pixel based on the first image data, second image data, and third image data included in the medical image to be processed. Then, based on the determined maximum and minimum pixel values, the maximum pixel value corresponding to the target pixel in the maximum value image is subtracted from the minimum pixel value corresponding to the target pixel in the maximum value image to obtain the difference pixel value corresponding to the target pixel in the difference image.
为了便于理解,以待处理医学图像的图像色彩模式为RGB为示例进行说明,对于包括的第一图像数据、第二图像数据以及第三图像数据的待处理医学图像而言,对于该待处理医学图像的每一个像素点,均在R通道,G通道以及B通道有对应的图像数据,例如像素点在R通道的图像数据为第一像素值,在G通道的图像数据为第二像素值,在B通道的图像数据为第三像素值,根据第一像素值,第二像素值以及第三像素值可以确定在R通道,G通道以及B通道中的最大像素值。同理,根据第一像素值,第二像素值以及第三像素值可以确定在R通道,G通道以及B通道中的最小像素值。For ease of understanding, let's take an RGB color mode medical image as an example. For the medical image containing first, second, and third image data, each pixel has corresponding image data in the R, G, and B channels. For example, the pixel's image data in the R channel is the first pixel value, in the G channel is the second pixel value, and in the B channel is the third pixel value. Based on these values, the maximum pixel value in the R, G, and B channels can be determined. Similarly, the minimum pixel value in the R, G, and B channels can be determined based on these values.
进一步地,可以通过下式对像素点位置(x,y)的最大像素值以及最小像素值进行计算:Furthermore, the maximum and minimum pixel values at pixel position (x, y) can be calculated using the following formula:
Imax(x,y)=Max[Ir(x,y),Ig(x,y),Ib(x,y)];Imax(x,y)=Max[Ir(x,y),Ig(x,y),Ib(x,y)];
Imin(x,y)=Min[Ir(x,y),Ig(x,y),Ib(x,y)];Imin(x,y)=Min[Ir(x,y),Ig(x,y),Ib(x,y)];
其中,Imax(x,y)表示最大像素值,Imin(x,y)表示最小像素值,Ir(x,y)表示第一像素值,Ig(x,y)表示第二像素值,Ib(x,y)表示第三像素值。Where Imax(x, y) represents the maximum pixel value, Imin(x, y) represents the minimum pixel value, Ir(x, y) represents the first pixel value, Ig(x, y) represents the second pixel value, and Ib(x, y) represents the third pixel value.
本实施例中用到了对应于不同通道下的色彩信息,区别出像素值,再次以待处理医学图像的图像色彩模式为RGB为示例进行说明,若待处理医学图像为灰色的话RGB比较相近,待处理医学图像为彩色的话RGB之间差值很大,存在病理组织的地方有颜色,有颜色的值就是本实施例所需的像素值。应理解,前述公式仅以二维图像对应的像素点作为示例进行说明,在实际应用中,前述公式也适用于多维图像计算最大像素值以及最小像素值,例如三维(3dimensions,3D)图像以及四维(4dimensions,4D)图像等。This embodiment uses color information corresponding to different channels to distinguish pixel values. Again, taking the RGB color mode of the medical image to be processed as an example, if the medical image is grayscale, the RGB values are relatively similar; if the medical image is color, the differences between RGB values are large. Areas containing pathological tissue have color, and the values with color are the pixel values required in this embodiment. It should be understood that the aforementioned formula is only used as an example for pixels corresponding to a two-dimensional image. In practical applications, the aforementioned formula is also applicable to calculating the maximum and minimum pixel values of multi-dimensional images, such as three-dimensional (3D) images and four-dimensional (4D) images.
为了进一步理解本实施例,以像目标像素点位置为(x1,y1),且待处理医学图像的图像色彩模式为RGB作为一种示例进行说明,目标像素点位置(x1,y1)的第一像素值Ir(x1,y1)为100,目标像素点位置(x1,y1)的第二像素值Ig(x1,y1)为200,目标像素点位置(x1,y1)的第三像素值Ib(x1,y1)为150,通过前述公式可知,目标像素点位置(x1,y1)的最大像素值Imax(x1,y1)为第二像素值Ig(x1,y1)所对应的像素值200,目标像素点位置(x1,y1)的最小像素值Imin(x1,y1)为第一像素值Ir(x1,y1)所对应的像素值100。其次,以目标像素点位置为(x2,y2),且待处理医学图像的图像色彩模式为RGB作为另一种示例进行说明,目标像素点位置(x2,y2)的第一像素值Ir(x2,y2)为30,目标像素点位置(x2,y2)的第二像素值Ig(x2,y2)为80,目标像素点位置(x2,y2)的第三像素值Ib(x2,y2)为120,通过前述公式可知,目标像素点位置(x2,y2)的最大像素值Imax(x2,y2)为第三像素值Ib(x2,y2)所对应的像素值120,目标像素点位置(x2,y2)的最小像素值Imin(x2,y2)为第一像素值Ir(x2,y2)所对应的像素值30。再次,以待处理医学图像的图像色彩模式为RGB,且该待处理医学图像为3D图像,目标像素点位置为(x3,y3,z3)作为另一种示例进行说明,目标像素点位置为(x3,y3,z3)的第一像素值Ir(x3,y3,z3)为200,目标像素点位置(x3,y3,z3)的第二像素值Ig(x3,y3,z3)为10,目标像素点位置(x3,y3,z3)的第三像素值Ib(x3,y3,z3)为60,通过前述公式可知,目标像素点位置(x3,y3,z3)的最大像素值Imax(x3,y3,z3)为第一像素值Ir(x3,y3,z3)所对应的像素值200,目标像素点位置(x3,y3,z3)的最小像素值Imin(x3,y3,z3)为第二像素值Ig(x3,y3,z3)所对应的像素值10。To further understand this embodiment, we will use an example where the target pixel position is (x1, y1) and the color mode of the medical image to be processed is RGB. The first pixel value Ir(x1, y1) of the target pixel position (x1, y1) is 100, the second pixel value Ig(x1, y1) of the target pixel position (x1, y1) is 200, and the third pixel value Ib(x1, y1) of the target pixel position (x1, y1) is 150. According to the aforementioned formula, the maximum pixel value Imax(x1, y1) of the target pixel position (x1, y1) is the pixel value 200 corresponding to the second pixel value Ig(x1, y1), and the minimum pixel value Imin(x1, y1) of the target pixel position (x1, y1) is the pixel value 100 corresponding to the first pixel value Ir(x1, y1). Secondly, taking the target pixel position (x2, y2) and the image color mode of the medical image to be processed as another example, the first pixel value Ir(x2, y2) of the target pixel position (x2, y2) is 30, the second pixel value Ig(x2, y2) of the target pixel position (x2, y2) is 80, and the third pixel value Ib(x2, y2) of the target pixel position (x2, y2) is 120. According to the aforementioned formula, the maximum pixel value Imax(x2, y2) of the target pixel position (x2, y2) is the pixel value of 120 corresponding to the third pixel value Ib(x2, y2), and the minimum pixel value Imin(x2, y2) of the target pixel position (x2, y2) is the pixel value of 30 corresponding to the first pixel value Ir(x2, y2). Furthermore, taking a medical image to be processed as an example, with the image color mode being RGB and the image being a 3D image, and the target pixel position being (x3, y3, z3), the first pixel value Ir(x3, y3, z3) at the target pixel position (x3, y3, z3) is 200, and the second pixel value Ig(x3, y3, z3) at the target pixel position (x3, y3, z3) is 10. 3) The third pixel value Ib(x3, y3, z3) is 60. According to the aforementioned formula, the maximum pixel value Imax(x3, y3, z3) at the target pixel position (x3, y3, z3) is the pixel value 200 corresponding to the first pixel value Ir(x3, y3, z3), and the minimum pixel value Imin(x3, y3, z3) at the target pixel position (x3, y3, z3) is the pixel value 10 corresponding to the second pixel value Ig(x3, y3, z3).
再进一步地,当得到目标像素点位置对应的最大像素值以及最小像素值之后,可以将该最大像素值与该最小像素值相减,从而得到差值图像中目标像素点位置所对应的差值像素值。具体地,可以通过下式根据最大像素值Imax(x,y)以及最小像素值Imin(x,y)计算得到差值像素值,并假设待处理医学图像中包括有1万个像素点:Furthermore, after obtaining the maximum and minimum pixel values corresponding to the target pixel location, the maximum and minimum pixel values can be subtracted to obtain the difference pixel value corresponding to the target pixel location in the difference image. Specifically, the difference pixel value can be calculated using the following formula based on the maximum pixel value Imax(x, y) and the minimum pixel value Imin(x, y), assuming that the medical image to be processed contains 10,000 pixels:
Idiff(x,y)=Imax(x,y)-Imin(x,y);Idiff(x,y)=Imax(x,y)-Imin(x,y);
其中,Imax(x,y)表示最大像素值,Imin(x,y)表示最小像素值,Idiff(x,y)表示在(x,y)位置的差值像素值。Where Imax(x, y) represents the maximum pixel value, Imin(x, y) represents the minimum pixel value, and Idiff(x, y) represents the difference pixel value at position (x, y).
为了便于理解,以目标像素点位置为(x1,y1),且待处理医学图像的图像色彩模式为RGB作为一种示例进行说明,目标像素点位置(x1,y1)的最大像素值Imax(x1,y1)为200,目标像素点位置(x1,y1)的最小像素值Imin(x1,y1)为100,将最大像素值Imax(x1,y1)与最小像素值Imin(x1,y1)相减,即可得到目标像素点位置(x1,y1)所对应的差值像素值为100。其次,以目标像素点位置为(x2,y2),且待处理医学图像的图像色彩模式为RGB作为另一种示例进行说明,目标像素点位置(x2,y2)的最大像素值Imax(x2,y2)为120,目标像素点位置(x2,y2)的最小像素值Imin(x2,y2)为30,将最大像素值Imax(x2,y2)与最小像素值Imin(x2,y2)相减,即可得到目标像素点位置(x2,y2)所对应的差值像素值为90。For ease of understanding, we will use the target pixel position (x1, y1) and the color mode of the medical image to be processed as an example. The maximum pixel value Imax(x1, y1) at the target pixel position (x1, y1) is 200, and the minimum pixel value Imin(x1, y1) at the target pixel position (x1, y1) is 100. Subtracting the maximum pixel value Imax(x1, y1) from the minimum pixel value Imin(x1, y1) will give us the difference pixel value of 100 at the target pixel position (x1, y1). Secondly, taking the target pixel position (x2, y2) and the image color mode of the medical image to be processed as another example, the maximum pixel value Imax(x2, y2) at the target pixel position (x2, y2) is 120, and the minimum pixel value Imin(x2, y2) at the target pixel position (x2, y2) is 30. Subtracting the maximum pixel value Imax(x2, y2) from the minimum pixel value Imin(x2, y2) gives the difference pixel value corresponding to the target pixel position (x2, y2) as 90.
可选地,以待处理医学图像的图像色彩模式为RGB,且该待处理医学图像为3D图像,目标像素点位置为(x3,y3,z3)作为另一种示例进行说明。基于上述公式,可以推导出以下公式:Optionally, another example is provided, where the medical image to be processed is in RGB color mode and is a 3D image, with the target pixel position being (x3, y3, z3). Based on the above formula, the following formula can be derived:
Imax(x,y,z)=Max[Ir(x,y,z),Ig(x,y,z),Ib(x,y,z)];Imax(x,y,z)=Max[Ir(x,y,z),Ig(x,y,z),Ib(x,y,z)];
Imin(x,y,z)=Min[Ir(x,y,z),Ig(x,y,z),Ib(x,y,z)];Imin(x,y,z)=Min[Ir(x,y,z),Ig(x,y,z),Ib(x,y,z)];
Idiff(x,y,z)=Imax(x,y,z)-Imin(x,y,z);Idiff(x,y,z)=Imax(x,y,z)-Imin(x,y,z);
假设目标像素点位置(x3,y3,z3)的最大像素值Imax(x3,y3,z3)为200,目标像素点位置(x3,y3,z3)的最小像素值Imin(x3,y3,z3)为10,将最大像素值Imax(x3,y3,z3)与最小像素值Imin(x3,y3,z3)相减,即可得到目标像素点位置(x3,y3,z3)所对应的差值像素值为190。Assuming the maximum pixel value Imax(x3, y3, z3) at the target pixel position (x3, y3, z3) is 200, and the minimum pixel value Imin(x3, y3, z3) at the target pixel position (x3, y3, z3) is 10, subtracting the maximum pixel value Imax(x3, y3, z3) from the minimum pixel value Imin(x3, y3, z3) yields a difference pixel value of 190 corresponding to the target pixel position (x3, y3, z3).
具体地,当待处理医学图像的差值像素值较小时,则说明该待处理医学图像的第一像素值,第二像素值以及第三像素值较为相近,可以说明该待处理医学图像类似为灰色图像,而当待处理医学图像的差值像素值较大时,则说明该待处理医学图像的第一像素值,第二像素值以及第三像素值相差较大,可以说明该待处理医学图像类似为彩色图像,而存在病理组织区域的图像常为有颜色的图像,因此可以根据该差值像素值初步判断该待处理医学图像是否包括病理组织区域。Specifically, when the difference pixel value of the medical image to be processed is small, it indicates that the first, second, and third pixel values of the medical image to be processed are relatively similar, which means that the medical image to be processed is similar to a grayscale image. When the difference pixel value of the medical image to be processed is large, it indicates that the first, second, and third pixel values of the medical image to be processed are significantly different, which means that the medical image to be processed is similar to a color image. Since images containing pathological tissue areas are often colored images, the difference pixel value can be used to make a preliminary judgment on whether the medical image to be processed includes pathological tissue areas.
本申请实施例中,提供了一种生成最大值图像的方法,通过上述方式,通过第一图像数据、第二图像数据以及第三图像数据对应目标像素点的像素值,确定最大像素值以及最小像素值,最大像素值以及最小像素值不同程度的反映待处理医学图像的色彩信息,并由最大像素值以及最小像素值相减得到差值像素值,使得该差值像素值能够准确的反映待处理医学图像的色彩信息,从而提升差值图像生成的准确度。In this embodiment of the application, a method for generating a maximum value image is provided. In the above manner, the maximum pixel value and the minimum pixel value are determined by the pixel values of the target pixel points corresponding to the first image data, the second image data, and the third image data. The maximum pixel value and the minimum pixel value reflect the color information of the medical image to be processed to different degrees. The difference pixel value is obtained by subtracting the maximum pixel value and the minimum pixel value, so that the difference pixel value can accurately reflect the color information of the medical image to be processed, thereby improving the accuracy of the difference image generation.
可选地,在上述图2对应的实施例的基础上,本申请实施例提供的医学图像处理的方法另一可选实施例中,根据待处理医学图像中所包括的第一图像数据、第二图像数据以及第三图像数据,生成差值图像,可以包括:Optionally, based on the embodiment corresponding to Figure 2 above, in another optional embodiment of the medical image processing method provided in this application, generating a difference image according to the first image data, second image data, and third image data included in the medical image to be processed may include:
根据待处理医学图像中所包括的第一图像数据、第二图像数据以及第三图像数据,生成待处理差值图像;Based on the first image data, second image data, and third image data included in the medical image to be processed, a difference image to be processed is generated.
对待处理差值图像进行高斯模糊处理,得到差值图像。Gaussian blur is applied to the difference image to obtain the difference image.
本实施例中,医学图像处理装置可以根据待处理医学图像中所包括的第一图像数据、第二图像数据以及第三图像数据,生成待处理差值图像,然后再对待处理差值图像进行高斯模糊处理,从而得到差值图像。In this embodiment, the medical image processing device can generate a difference image to be processed based on the first image data, the second image data, and the third image data included in the medical image to be processed, and then perform Gaussian blur processing on the difference image to be processed to obtain the difference image.
具体地,模糊可以理解成对待处理差值图像的每一个像素点都取其周边像素点的平均值,当像素点取其周边像素点的平均值时,在像素点的数值取值上,可以趋于平滑化,而在待处理差值图像上,就相当于产生模糊效果,该像素点会失去细节。对于待处理差值图像而言,其中像素点都是连续的,因此越靠近的像素点关系越密切,越远离的像素点关系越疏远。因此本实施例中对模糊采用的算法为高斯模糊(Gaussian Blur),高斯模糊可以将正态分布(高斯分布)用于待处理差值图像处理,使得像素点之间的加权平均更合理,距离越近的像素点权重越大,距离越远的像素点权重越小。Specifically, blurring can be understood as taking the average of the surrounding pixels for each pixel in the difference image to be processed. When a pixel takes the average of its surrounding pixels, the pixel value tends to be smoothed out. However, in the difference image to be processed, this is equivalent to producing a blurring effect, causing the pixel to lose detail. In the difference image to be processed, the pixels are continuous; therefore, pixels closer together are more closely related, and pixels farther apart are less related. Therefore, this embodiment uses Gaussian blur as the blurring algorithm. Gaussian blur applies a normal distribution (Gaussian distribution) to the difference image to be processed, making the weighted average between pixels more reasonable, with closer pixels having a higher weight and farther pixels having a lower weight.
进一步地,以像素点为(x,y)为示例进行说明,对于像素点(x,y)而言,该像素点为二维像素点,由此可以通过以下公式计算得到二维高斯函数:Furthermore, taking pixel (x, y) as an example, for pixel (x, y), this pixel is a two-dimensional pixel, and the two-dimensional Gaussian function can be calculated using the following formula:
其中,(x,y)表示像素点,G(x,y)表示像素点的二维高斯函数,σ表示正态分布的标准偏差。Where (x, y) represents a pixel, G(x, y) represents the two-dimensional Gaussian function of the pixel, and σ represents the standard deviation of the normal distribution.
为了便于理解,以该像素点具体为(0,0)为示例进行说明,那么像素点(0,0)其周边8个像素点可以为(-1,1),(0,1),(1,1),(-1,0),(1,0),(-1,-1),(0,-1)以及(1,-1),为了进一步地计算权重矩阵,需要设定σ的值。假定σ=1.5,则可以得到模糊半径为1的权重矩阵,例如在权重矩阵中像素点(0,0)对应的权重为0.0707,像素点(-1,1)对应的权重为0.0453,像素点(0,1)对应的权重为0.0566,像素点(1,1)对应的权重为0.0453,像素点(-1,0)对应的权重为0.0566,像素点(1,0)对应的权重为0.0566,像素点(-1,-1)对应的权重为0.0453,像素点(0,-1)对应的权重为0.0566以及像素点(1,-1)对应的权重为0.0453,像素点(0,0)其周边8个像素点这9个点的权重总和约等于0.479,若仅计算这9个点的加权平均,需要必须让它们的权重之和等于1,也就是对权重总和进行归一化,即可以将权重矩阵对应的9个值分别除以权重总和0.479,从而得到归一化之后的权重矩阵,即像素点(0,0)归一化后所对应的权重为0.147,像素点(-1,1)归一化后所对应的权重为0.0947,像素点(0,1)归一化后所对应的权重为0.0118,像素点(1,1)归一化后所对应的权重为0.0947,像素点(-1,0)归一化后所对应的权重为0.0118,像素点(1,0)归一化后所对应的权重为0.0118,像素点(-1,-1)归一化后所对应的权重为0.0947,像素点(0,-1)归一化后所对应的权重为0.0118,以及像素点(1,-1)归一化后所对应的权重为0.0947。由于使用权重总和大于1的权重矩阵会让差值图像偏亮,而使用权重总和小于1的权重矩阵会让差值图像偏暗,因此进行归一化后的权重矩阵能够使得差值图像所呈现的病理组织区域更为准确。For ease of understanding, let's take the pixel (0, 0) as an example. Then, the eight pixels surrounding the pixel (0, 0) can be (-1, 1), (0, 1), (1, 1), (-1, 0), (1, 0), (-1, -1), (0, -1), and (1, -1). To further calculate the weight matrix, we need to set the value of σ. Assuming σ = 1.5, we can obtain a weight matrix with a blur radius of 1. For example, in the weight matrix, the weight corresponding to pixel (0, 0) is 0.0707, the weight corresponding to pixel (-1, 1) is 0.0453, the weight corresponding to pixel (0, 1) is 0.0566, the weight corresponding to pixel (1, 1) is 0.0453, the weight corresponding to pixel (-1, 0) is 0.0566, the weight corresponding to pixel (1, 0) is 0.0566, the weight corresponding to pixel (-1, -1) is 0.0453, the weight corresponding to pixel (0, -1) is 0.0566, and the weight corresponding to pixel (1, -1) is 0.0453. The sum of the weights of the 8 pixels surrounding pixel (0, 0) is approximately 0.479. If we only calculate the weighted average of these 9 points, we need to make their weight sum equal to 1, that is... Normalizing the sum of weights involves dividing each of the nine values in the weight matrix by the sum of weights, 0.479, to obtain the normalized weight matrix. Specifically, the normalized weight for pixel (0,0) is 0.147, for (-1,1) it's 0.0947, for (0,1) it's 0.0118, for (1,1) it's 0.0947, for (-1,0) it's 0.0118, for (1,0) it's 0.0118, for (-1,-1) it's 0.0947, for (0,-1) it's 0.0118, and for (1,-1) it's 0.0947. Since using a weight matrix with a total weight greater than 1 will make the difference image brighter, while using a weight matrix with a total weight less than 1 will make the difference image darker, the normalized weight matrix can make the pathological tissue area presented by the difference image more accurate.
进一步地,当获取到归一化后的权重矩阵后,即可以对该像素点进行高斯模糊计算,例如灰度值为0至255的情况下,在权重矩阵中像素点(0,0)对应的灰度值为25,像素点(-1,1)对应的灰度值为14,像素点(0,1)对应的灰度值为15,像素点(1,1)对应的灰度值为16,像素点(-1,0)对应的灰度值为24,像素点(1,0)对应的灰度值为26,像素点(-1,-1)对应的灰度值为34,像素点(0,-1)对应的灰度值为35以及像素点(1,-1)对应的灰度值为36。每个像素点对应的灰度值点乘每个像素点对应的权重,可以得到9个值,即像素点(0,0)可以得到3.69,像素点(-1,1)对可以得到1.32,像素点(0,1)可以得到1.77,像素点(1,1)可以得到1.51,像素点(-1,0)可以得到2.83,像素点(1,0)可以得到3.07,像素点(-1,-1)可以得到3.22,像素点(0,-1)可以得到4.14以及像素点(1,-1)可以得到3.41。然后将这9个值加起来,就是像素点(0,0)的高斯模糊的值。Furthermore, once the normalized weight matrix is obtained, Gaussian blur can be calculated for the pixel. For example, when the gray value is between 0 and 255, in the weight matrix, the gray value corresponding to pixel (0, 0) is 25, the gray value corresponding to pixel (-1, 1) is 14, the gray value corresponding to pixel (0, 1) is 15, the gray value corresponding to pixel (1, 1) is 16, the gray value corresponding to pixel (-1, 0) is 24, the gray value corresponding to pixel (1, 0) is 26, the gray value corresponding to pixel (-1, -1) is 34, the gray value corresponding to pixel (0, -1) is 35, and the gray value corresponding to pixel (1, -1) is 36. Multiplying the grayscale value of each pixel by its corresponding weight yields nine values: 3.69 for pixel (0,0), 1.32 for pixel (-1,1), 1.77 for pixel (0,1), 1.51 for pixel (1,1), 2.83 for pixel (-1,0), 3.07 for pixel (1,0), 3.22 for pixel (-1,-1), 4.14 for pixel (0,-1), and 3.41 for pixel (1,-1). Adding these nine values together gives the Gaussian blur value for pixel (0,0).
再进一步地,对待处理差值图像中所包括的所有像素点重复前述像素点(0,0)类似的步骤,即可得到进行高斯模糊处理后的差值图像。Furthermore, by repeating the steps similar to those for pixel (0,0) for all pixels in the difference image to be processed, the difference image after Gaussian blur processing can be obtained.
本申请实施例中,提供了另一种生成差值图像的方法,通过上述方式,对生成待处理差值图像行高斯模糊处理,由于高斯模糊处理可以提升分割鲁棒性,由此所得到的差值图像有较好的分割鲁棒性,从而提升成差值图像的稳定性。In this embodiment of the application, another method for generating a difference image is provided. In this method, the difference image to be processed is subjected to Gaussian blur processing. Since Gaussian blur processing can improve segmentation robustness, the resulting difference image has better segmentation robustness, thereby improving the stability of the difference image.
可选地,在上述图2对应的实施例的基础上,本申请实施例提供的医学图像处理的方法另一可选实施例中,对差值图像进行二值化处理,得到二值化图像,可以包括:Optionally, based on the embodiment corresponding to Figure 2 above, in another optional embodiment of the medical image processing method provided in this application, binarizing the difference image to obtain a binarized image may include:
根据差值图像确定分割阈值;Determine the segmentation threshold based on the difference image;
若差值图像中像素点所对应的像素值大于或等于分割阈值,则将像素点确定为二值化图像的前景像素点;If the pixel value corresponding to a pixel in the difference image is greater than or equal to the segmentation threshold, then the pixel is determined as the foreground pixel of the binarized image.
若差值图像中像素点所对应的像素值小于分割阈值,则将像素点确定为二值化图像的背景像素点。If the pixel value corresponding to a pixel in the difference image is less than the segmentation threshold, then the pixel is determined as the background pixel of the binarized image.
本实施例中,医学图像处理装置可以根据差值图像确定分割阈值,当差值图像中像素点所对应的像素值大于或等于分割阈值时,则将像素点确定为二值化图像的前景像素点,当差值图像中像素点所对应的像素值小于分割阈值时,则将像素点确定为二值化图像的背景像素点。In this embodiment, the medical image processing device can determine the segmentation threshold based on the difference image. When the pixel value corresponding to a pixel in the difference image is greater than or equal to the segmentation threshold, the pixel is determined as the foreground pixel of the binarized image. When the pixel value corresponding to a pixel in the difference image is less than the segmentation threshold, the pixel is determined as the background pixel of the binarized image.
具体地,通过设定分割阈值,对差值图像进行二值化处理可以把灰度图像变成0或者1取值的二值化图像,也就是说差值图像的二值化可以通过设定分割阈值,把差值图像变换成仅用两个值(0或1)来分别表示的图像前景和图像背景的二值化图像,其中前景取值为1,背景值取值为0,而在实际应用中,0对应于RGB值均为0,1对应于RGB值均为255,差值图像经过二值化处理后所得的二值化图像,再对二值化图像作进一步处理时,由于二值化图像的几何性质只与0和1的位置有关,不再涉及到像素的灰度值,使得对二值化图像的处理变得简单,从而可以提升图像处理效率。而确定分割阈值的方法可以分为全局阈值和局部阈值。其中,全局阈值是对整个差值图像采用一个阈值进行划分。但对于不同的差值图像,差值图像的灰度深度是存在差异的,并且对于同一差值图像,不同部位其明暗分布也可以是不同的,因此,我们本实施例中采用动态阈值二值化方法确定分割阈值。Specifically, by setting a segmentation threshold, binarizing the difference image can transform a grayscale image into a binary image with values of 0 or 1. In other words, binarizing the difference image can be achieved by setting a segmentation threshold, transforming it into a binary image where the foreground and background are represented by only two values (0 or 1), where the foreground value is 1 and the background value is 0. In practical applications, 0 corresponds to all RGB values being 0, and 1 corresponds to all RGB values being 255. After binarization, the resulting binary image can be further processed because its geometric properties depend only on the positions of 0 and 1, no longer involving the pixel's grayscale value. This simplifies the processing of the binary image and improves image processing efficiency. Methods for determining the segmentation threshold can be divided into global thresholding and local thresholding. Global thresholding divides the entire difference image using a single threshold. However, the grayscale depth of different difference images varies, and the brightness distribution of different parts of the same difference image can also be different. Therefore, in this embodiment, we use a dynamic threshold binarization method to determine the segmentation threshold.
当根据差值图像确定分割阈值后,对差值图像中像素点所对应的像素值与分割阈值进行判断,当差值图像中像素点所对应的像素值大于或等于分割阈值时,则将像素点确定为二值化图像的前景像素点。当差值图像中像素点所对应的像素值小于分割阈值时,则将像素点确定为二值化图像的背景像素点。例如,当像素点A所对应的像素值大于分割阈值,则将该像素点A确定为二值化图像的前景像素点,即像素值为1,也就是该像素点A处于前景区域,在图像为RGB模式时,显示为白色。而当像素点B所对应的像素值小于分割阈值,则将该像素点B确定为二值化图像的背景像素点,即像素值为0,也就是该像素点B处于背景区域,在图像为RGB模式时,显示为黑色。After determining the segmentation threshold based on the difference image, the pixel values corresponding to pixels in the difference image are compared with the segmentation threshold. If the pixel value is greater than or equal to the segmentation threshold, the pixel is designated as a foreground pixel in the binarized image. If the pixel value is less than the segmentation threshold, the pixel is designated as a background pixel in the binarized image. For example, if the pixel value of pixel A is greater than the segmentation threshold, pixel A is designated as a foreground pixel in the binarized image (i.e., a pixel value of 1), meaning pixel A is in the foreground region and will appear white in RGB mode. Conversely, if the pixel value of pixel B is less than the segmentation threshold, pixel B is designated as a background pixel in the binarized image (i.e., a pixel value of 0), meaning pixel B is in the background region and will appear black in RGB mode.
本申请实施例中,提供了一种得到二值化图像的方法,通过上述方式,根据二值化处理生成二值化图像,由于二值化图像的几何性质不涉及到像素的灰度值,可以使得后续对二值化图像的处理变得简单,从而可以提升生成前景分割结果的效率。In this embodiment of the application, a method for obtaining a binarized image is provided. By means of the above method, a binarized image is generated according to the binarization process. Since the geometric properties of the binarized image do not involve the gray values of the pixels, the subsequent processing of the binarized image can be simplified, thereby improving the efficiency of generating foreground segmentation results.
可选地,在上述图2对应的实施例的基础上,本申请实施例提供的医学图像处理的方法另一可选实施例中,根据差值图像确定分割阈值,可以包括:Optionally, based on the embodiment corresponding to Figure 2 above, in another optional embodiment of the medical image processing method provided in this application, determining the segmentation threshold based on the difference image may include:
根据差值图像获取N个像素点所对应的N个像素值,其中,像素值与像素点具有一一对应的关系,N为大于1的整数;Obtain N pixel values corresponding to N pixels from the difference image, where there is a one-to-one correspondence between pixel values and pixel points, and N is an integer greater than 1.
从N个像素值中确定待处理像素值,其中,待处理像素值为N个像素值中的最大值;Determine the pixel value to be processed from N pixel values, where the pixel value to be processed is the maximum value among the N pixel values;
根据待处理像素值以及比例阈值,计算得到分割阈值。The segmentation threshold is calculated based on the pixel value to be processed and the ratio threshold.
本实施例中,医学图像处理装置可以根据差值图像获取N个像素点所对应的N个像素值,并且该像素值与像素点具有一一对应的关系,然后从N个像素值中确定待处理像素值,该待处理像素值为N个像素值中的最大值,最后可以根据待处理像素值以及比例阈值,计算得到分割阈值,其中N为大于1的整数。In this embodiment, the medical image processing device can obtain N pixel values corresponding to N pixels based on the difference image, and the pixel value has a one-to-one correspondence with the pixel. Then, it determines the pixel value to be processed from the N pixel values. The pixel value to be processed is the maximum value among the N pixel values. Finally, it calculates the segmentation threshold based on the pixel value to be processed and the ratio threshold, where N is an integer greater than 1.
具体地,本实施例中分割阈值是根据差值图像所确定的,由于差值图像可以根据待处理医学图像中的最大值图像与最小值图像相减生成,并且差值图像中的像素值与像素点具有一一对应的关系,因此可以获取差值图像中多个像素点对应像素值,然后将多个像素值中的最大值确定为待处理像素值,然后根据待处理像素值以及比例阈值计算得到分割阈值。为了便于理解,本实施例以比例阈值为10%为示例进行说明,例如WSI图像缩小后的图像的长宽在几千像素范围内,假设缩小后的图像包括100*100个像素点,即需要在10000个像素点对应像素值中找出最大的值,例如最大值为150,即可以确定该最大值150为待处理像素值,然后根据待处理像素值150与相乘比例阈值10%,即可得到分割阈值15。应理解,在实际应用中,比例阈值还可以为其他百分比所对应的值,具体比例阈值应当结合实际情况灵活确定。Specifically, in this embodiment, the segmentation threshold is determined based on the difference image. Since the difference image can be generated by subtracting the maximum and minimum value images from the medical image to be processed, and there is a one-to-one correspondence between pixel values and pixels in the difference image, multiple pixel values can be obtained from the difference image. Then, the maximum value among these multiple pixel values is determined as the pixel value to be processed. The segmentation threshold is then calculated based on the pixel value to be processed and a proportional threshold. For ease of understanding, this embodiment uses a proportional threshold of 10% as an example. For instance, if the width and height of the WSI image after reduction are within a few thousand pixels, assuming the reduced image includes 100*100 pixels, the largest value needs to be found among the 10,000 pixel values. For example, if the maximum value is 150, then this maximum value of 150 can be determined as the pixel value to be processed. Then, by multiplying the pixel value to be processed (150) by the proportional threshold of 10%, the segmentation threshold of 15 is obtained. It should be understood that in practical applications, the proportional threshold can also be other percentage values, and the specific proportional threshold should be flexibly determined based on the actual situation.
本申请实施例中,提供了另一种得到分割阈值的方法,通过上述方式,可以通过由最大像素值确定的待处理像素值以及比例阈值的分割阈值,由于差值图像灰度深度是存在差异的,并且不同区域其明暗分布也可以是不同的,因此,可以通过调整比例阈值灵活确定分割阈值,提升阈值准确度以及灵活性,从而提升二值化图像生成的准确度。In this embodiment of the application, another method for obtaining the segmentation threshold is provided. In the above manner, the segmentation threshold can be determined by the pixel value to be processed by the maximum pixel value and the ratio threshold. Since the gray depth of the difference image is different and the brightness distribution of different regions can also be different, the segmentation threshold can be flexibly determined by adjusting the ratio threshold, thereby improving the accuracy and flexibility of the threshold and thus improving the accuracy of binarized image generation.
可选地,在上述图2对应的实施例的基础上,本申请实施例提供的医学图像处理的方法另一可选实施例中,根据二值化图像生成待处理医学图像所对应的前景分割结果,可以包括:Optionally, based on the embodiment corresponding to Figure 2 above, in another optional embodiment of the medical image processing method provided in this application, generating the foreground segmentation result corresponding to the medical image to be processed based on the binarized image may include:
采用泛洪算法检测二值化图像中的背景区域,其中,背景区域包括多个背景像素点;A flooding algorithm is used to detect background regions in a binarized image, where the background region includes multiple background pixels.
根据二值化图像以及二值化图像中的背景区域,获取二值化图像中的前景区域内的背景像素点,其中,前景区域包括多个前景像素点;Based on the binarized image and the background region in the binarized image, obtain the background pixels within the foreground region of the binarized image, wherein the foreground region includes multiple foreground pixels;
将二值化图像中的前景区域内的背景像素点变更为前景像素点,得到空洞填补图像;By replacing background pixels in the foreground region of a binarized image with foreground pixels, a hole-filling image is obtained.
对空洞填补图像进行中值滤波处理,得到待处理医学图像所对应的前景分割结果。Median filtering is applied to the hole-filling image to obtain the foreground segmentation result corresponding to the medical image to be processed.
本实施例中,医学图像处理装置可以采用泛洪算法检测二值化图像中的背景区域,该背景区域可以包括多个背景像素点,然后根据二值化图像以及二值化图像中的背景区域,获取二值化图像中的前景区域内的背景像素点,该前景区域可以包括多个前景像素点,进而将二值化图像中的前景区域内的背景像素点变更为前景像素点,得到空洞填补图像,最后对空洞填补图像进行中值滤波处理,即可得到待处理医学图像所对应的前景分割结果。In this embodiment, the medical image processing device can use a flooding algorithm to detect the background region in the binarized image. The background region may include multiple background pixels. Then, based on the binarized image and the background region in the binarized image, the background pixels in the foreground region of the binarized image are obtained. The foreground region may include multiple foreground pixels. Then, the background pixels in the foreground region of the binarized image are changed into foreground pixels to obtain a hole-filling image. Finally, the hole-filling image is subjected to median filtering to obtain the foreground segmentation result corresponding to the medical image to be processed.
具体地,对差值图像进行二值化处理后,所得到二值化图像中,可能出现二值化图像中前景区域是黑色空洞,作为前景区域,需要将该黑色空洞检测出来。为了便于理解,请参阅图7,图7为本申请实施例中前景分割结果另一实施例示意图,如图所示,图7中(A)所示出的二值化图像,在呈现白色的前景区域中包括有多个背景像素点,其中区域A1至区域A5所框出黑点均由背景像素点组成,将区域A1至区域A5所框出黑点由背景像素点变更为前景像素点,而其中区域A6与区域A7所框出白点由前景像素点组成,将区域A6与区域A7所框出白点由前景像素点变更为背景像素点,即可得到图7中(B)所示出的空洞填补图像。Specifically, after binarizing the difference image, the resulting binarized image may contain black holes in the foreground region. These black holes need to be detected. For clarity, please refer to Figure 7, which is a schematic diagram of another embodiment of the foreground segmentation result in this application. As shown in Figure 7(A), the binarized image includes multiple background pixels in the white foreground region. The black dots enclosed in regions A1 to A5 are all composed of background pixels. By changing the black dots enclosed in regions A1 to A5 from background pixels to foreground pixels, and the white dots enclosed in regions A6 and A7 from foreground pixels, the hole-filling image shown in Figure 7(B) can be obtained.
进一步地,然后对图7中(B)所示出的空洞填补图像进行中值滤波处理,还可以进一步进行形态学处理,即可以得到图7中(C)所示出的待处理医学图像所对应的前景分割结果。其中滤波处理即在尽量保留空洞填补图像细节特征的条件下对待处理医学图像的噪声进行抑制,通过滤波处理可以提升后续前景分割结果处理和分析的有效性和可靠性。消除空洞填补图像中的噪声成分即为滤波操作,空洞填补图像的能量大部分集中在幅度谱的低频和中频段,而在较高频段,空洞填补图像的信息经常被噪声影响,因此可以对空洞填补图像进行滤波操作适应图像处理的要求,消除图像数字化时所混入的噪声。而中值滤波处理是一种典型的非线性滤波,是基于排序统计理论的一种能够有效抑制噪声的非线性信号处理技术,中值滤波处理可以用像素点邻域灰度值的中值来代替该像素点的灰度值,让周围的像素值接近真实的值从而消除孤立的噪声点。Furthermore, median filtering is then applied to the hole-filling image shown in Figure 7(B), and morphological processing can be further performed to obtain the foreground segmentation result corresponding to the medical image to be processed, as shown in Figure 7(C). The filtering process aims to suppress noise in the medical image to be processed while preserving as much detail as possible in the hole-filling image. Filtering improves the effectiveness and reliability of subsequent foreground segmentation processing and analysis. Eliminating noise components in the hole-filling image is the filtering operation. The energy of the hole-filling image is mostly concentrated in the low and mid-frequency bands of the amplitude spectrum, while in higher frequency bands, the information in the hole-filling image is often affected by noise. Therefore, filtering can be applied to the hole-filling image to meet the requirements of image processing and eliminate noise introduced during image digitization. Median filtering is a typical nonlinear filtering technique based on ranking statistics theory, which effectively suppresses noise. Median filtering uses the median gray value of a pixel's neighborhood to replace the pixel's gray value, making the surrounding pixel values closer to the true values, thereby eliminating isolated noise points.
本申请实施例中,提供了一种生成前景分割结果的方法,通过上述方式,将前景区域内的背景像素点变更为前景像素点,所得到空洞填补图像具有较好的可靠性,其次,通过中值滤波处理,能够在不损坏图像的轮廓及边缘等特征信息的基础上,使得待处理医学图像所对应的前景分割结果清晰并且视觉效果好。In this embodiment of the application, a method for generating foreground segmentation results is provided. By changing the background pixels in the foreground region to foreground pixels in the above manner, the resulting hole-filling image has good reliability. Secondly, by median filtering, the foreground segmentation result corresponding to the medical image to be processed can be clear and have good visual effect without damaging the contour and edge features of the image.
可选地,在上述图2对应的实施例的基础上,本申请实施例提供的医学图像处理的方法另一可选实施例中,对空洞填补图像进行中值滤波处理,得到待处理医学图像所对应的前景分割结果,可以包括:Optionally, based on the embodiment corresponding to Figure 2 above, in another optional embodiment of the medical image processing method provided in this application, performing median filtering on the hole-filling image to obtain the foreground segmentation result corresponding to the medical image to be processed may include:
对空洞填补图像进行中值滤波处理,得到滤波图像,其中,滤波图像包括待处理前景区域;The hole-filling image is subjected to median filtering to obtain a filtered image, which includes the foreground region to be processed.
获取待处理前景区域的边界线,其中,边界线包括M个像素点,M为大于1的整数;Obtain the boundary line of the foreground region to be processed, where the boundary line consists of M pixels, M being an integer greater than 1;
针对边界线上M个像素点中的每个像素点,向外延伸K个像素点,得到前景分割结果,其中,K为大于或等于1的整数。For each of the M pixels on the boundary line, extend outward by K pixels to obtain the foreground segmentation result, where K is an integer greater than or equal to 1.
本实施例中,医学图像处理装置对空洞填补图像进行中值滤波处理,得到滤波图像,该滤波图像可以包括待处理前景区域,获取待处理前景区域的边界线,并且该边界线包括M个像素点,进而针对边界线上M个像素点中的每个像素点,向外延伸K个像素点,得到前景分割结果,其中M为大于1的整数,K为大于或等于1的整数。具体地,中值滤波处理可以用像素点邻域灰度值的中值来代替该像素点的灰度值,让周围的像素值接近真实的值从而消除孤立的噪声点,通过中值滤波处理在取出脉冲噪声、椒盐噪声的同时,得到保留图像的边缘细节的滤波图像。In this embodiment, the medical image processing device performs median filtering on the hole-filling image to obtain a filtered image. This filtered image may include a foreground region to be processed. The boundary line of the foreground region is obtained, and this boundary line includes M pixels. Then, for each of the M pixels on the boundary line, K pixels are extended outwards to obtain the foreground segmentation result, where M is an integer greater than 1 and K is an integer greater than or equal to 1. Specifically, median filtering can replace the gray value of a pixel with the median of its neighborhood gray values, making the surrounding pixel values closer to the true values, thereby eliminating isolated noise points. Through median filtering, while removing impulse noise and salt-and-pepper noise, a filtered image that preserves the edge details of the image is obtained.
进一步地,通过泛洪算法(Flood Fill)填充具有不同颜色的连接的,颜色相似的区域,泛洪算法的基本原理就是从一个像素点出发,以此向周边的像素点扩充着色,直到图形的边界。泛洪算法需要采用三个参数:起始节点(start node),目标颜色(target color)以及替换颜色(replacement color)。泛洪算法通过目标颜色的路径连接到起始节点的所有节点,并将它们更改为替换颜色,应理解,在实际应用中,可以通过多种方式构建泛洪算法,但多种方式都明确地或隐式地使用队列或堆栈数据结构。例如,四邻域泛洪算法,八邻域泛洪算法,描绘线算法(Scanline Fill)以及大规模行为(Large-scale behaviour)。其中,传统的四邻域泛洪算法的思想是对于像素点(x,y),将其着色之后将其周围的上下左右四个点分别进行着色,而递归方式较为消耗内存,若所需着色的面积非常大,会导致溢出现象,因此,可以采用非递归方式的四邻域泛洪算法。而八邻域泛洪算法是将一个像素点的上下左右,左上,左下,右上,右下都进行着色。描绘线算法可以利用填充线来加速算法,可以先将一条线上的像素点进行着色,然后依次向上下扩张,直到着色完成。大规模行为以数据为中心,或者以流程为中心。Furthermore, a flood fill algorithm is used to fill connected, similarly colored regions with different colors. The basic principle of the flood fill algorithm is to start from a pixel and expand the coloring outwards to surrounding pixels until the boundary of the graphic. The flood fill algorithm requires three parameters: a start node, a target color, and a replacement color. The flood fill algorithm connects all nodes to the start node along the path of the target color and changes them to the replacement color. It should be understood that in practical applications, flood fill algorithms can be constructed in various ways, but many methods explicitly or implicitly use queue or stack data structures. Examples include four-neighborhood flood fill, eight-neighborhood flood fill, scanline fill, and large-scale behavior. The traditional four-neighbor flooding algorithm colors a pixel (x, y) and then colors its four surrounding pixels (up, down, left, and right). However, this recursive approach is memory-intensive, and can lead to overflow if the area to be colored is very large. Therefore, a non-recursive four-neighbor flooding algorithm can be used. The eight-neighbor flooding algorithm, on the other hand, colors all four sides of a pixel: up, down, left, right, top-left, bottom-left, top-right, and bottom-right. Line drawing algorithms can be accelerated by using fill lines. Pixels along a line can be colored first, and then the coloring can be expanded upwards and downwards until all pixels are colored. Large-scale operations are data-centric or process-centric.
由于空洞填补图像的边界线不规则,因此本实施例中采用描绘线算法,以待处理前景区域包括1000个像素点的边界线为示例进行说明,利用形态学处理的方式,将1000个像素点分别向外延伸K个像素点,假设K为2,则在原来的1000个像素点之外增加了2000个像素点作为前景分割区域,从而得到前景分割结果。应理解,在实际应用中,具体M个像素点以及K个像素点均应当结合实际情况灵活确定。Because the boundary lines of the hole-filling image are irregular, this embodiment uses a line-drawing algorithm. Taking the boundary line of the foreground region to be processed, which includes 1000 pixels, as an example, morphological processing is used to extend each of the 1000 pixels outward by K pixels. Assuming K is 2, this adds 2000 pixels outside the original 1000 pixels as the foreground segmentation region, thus obtaining the foreground segmentation result. It should be understood that in practical applications, the specific M pixels and K pixels should be flexibly determined based on the actual situation.
本申请实施例中,提供了另一种生成前景分割结果的方法,通过上述方式,通过中值滤波处理,能够在不损坏图像的轮廓及边缘等特征信息的基础上,使得滤波图像清晰并且视觉效果好。其次,通过泛洪算法对滤波图像进行形态学处理,提升前景分割结果的准确度以及一体性。This application provides another method for generating foreground segmentation results. Through median filtering, the filtered image is clear and has good visual quality without damaging the image's contours and edges. Furthermore, a flooding algorithm is used to perform morphological processing on the filtered image, improving the accuracy and uniformity of the foreground segmentation results.
可选地,在上述图2对应的实施例的基础上,本申请实施例提供的医学图像处理的方法另一可选实施例中,获取待处理医学图像,可以包括:Optionally, based on the embodiment corresponding to Figure 2 above, in another optional embodiment of the medical image processing method provided in this application, acquiring the medical image to be processed may include:
获取原始医学图像;Acquire raw medical images;
采用滑动窗口从原始医学图像中提取医学子图像;A sliding window method is used to extract medical sub-images from the original medical image;
若检测到医学子图像中包括病理组织区域,则确定为待处理医学图像;If a pathological tissue region is detected in a medical sub-image, it is identified as a medical image to be processed.
若检测到医学子图像中未包括病理组织区域,则将医学子图像确定为背景图像,且去除背景图像。If a medical sub-image is found to not include a pathological tissue region, the medical sub-image is identified as a background image and removed.
本实施例中,医学图像处理装置可以先获取到原始医学图像,然后采用滑动窗口从原始医学图像中提取医学子图像,当检测到医学子图像中包括病理组织区域时,则确定为待处理医学图像,当检测到医学子图像中未包括病理组织区域时,则将医学子图像确定为背景图像,且去除该背景图像。具体地,其中原始医学图像可以为医学图像处理装置通过有线网络接收到的图像,还可以为医学图像处理装置本身存储的图像。In this embodiment, the medical image processing device first acquires the original medical image, and then uses a sliding window to extract medical sub-images from the original medical image. When a medical sub-image is detected to contain a pathological tissue region, it is determined to be a medical image to be processed. When a medical sub-image is detected not to contain a pathological tissue region, it is determined to be a background image and removed. Specifically, the original medical image can be an image received by the medical image processing device through a wired network, or it can be an image stored by the medical image processing device itself.
为了便于理解,请参阅图8,图8为本申请实施例中获取待处理医学图像一个实施例示意图,如图所示,图8中(A)所示出的为原始医学图像,采用滑动窗口从原始医学图像中提取医学子图像,其中B1至B3所框出的区域即为从原始医学图像中提取医学子图像,从而B1可以对应得到如图8中(B)所示出医学子图像,B2可以对应得到如图8中(C)所示出医学子图像,B3可以对应得到如图8中(D)所示出医学子图像,由此可见,图8中(B)以及(C)中所示出医学子图像中包括病理组织区域,因此可以将图8中(B)以及(C)所示出医学子图像确定为待处理医学图像,而图8中(D)所示出医学子图像中未包括病理组织区域,因此可以将图8中(D)所示出医学子图像确定为背景图像,且去除背景图像。For ease of understanding, please refer to Figure 8. Figure 8 is a schematic diagram of an embodiment of obtaining a medical image to be processed in this application. As shown in the figure, (A) in Figure 8 shows the original medical image. A sliding window is used to extract medical sub-images from the original medical image. The areas enclosed by B1 to B3 are the medical sub-images extracted from the original medical image. Thus, B1 can be obtained as the medical sub-image shown in Figure 8 (B), B2 can be obtained as the medical sub-image shown in Figure 8 (C), and B3 can be obtained as the medical sub-image shown in Figure 8 (D). It can be seen that the medical sub-images shown in Figure 8 (B) and (C) include pathological tissue areas. Therefore, the medical sub-images shown in Figure 8 (B) and (C) can be identified as the medical images to be processed. The medical sub-image shown in Figure 8 (D) does not include pathological tissue areas. Therefore, the medical sub-image shown in Figure 8 (D) can be identified as the background image and the background image is removed.
本申请实施例中,提供了一种获取待处理医学图像的方法,通过上述方式,通过检测医学子图像是否包括有病理组织区域,确定待处理医学图像,使得包括有病理组织区域的待处理医学图像通过前述步骤,能够获取的待处理医学图像所对应的前景分割结果,并且前景分割结果包括有病理组织区域,便于后续对该前景分割结果中病理组织区域的处理以及分析。其次,将为包括有病理组织区域的医学子图像确定为背景图像,且去除该背景图像,减少资源占用率。This application provides a method for acquiring a medical image to be processed. By detecting whether a medical sub-image includes a pathological tissue region, the medical image to be processed is determined. This ensures that the medical image containing a pathological tissue region can be segmented into a foreground segmentation result through the aforementioned steps. Furthermore, the foreground segmentation result includes the pathological tissue region, facilitating subsequent processing and analysis of this pathological tissue region. Secondly, the medical sub-image containing the pathological tissue region is designated as a background image and removed to reduce resource consumption.
可选地,在上述图2对应的实施例的基础上,本申请实施例提供的医学图像处理的方法另一可选实施例中,根据二值化图像生成待处理医学图像所对应的前景分割结果之后,医学图像处理的方法还可以包括:Optionally, based on the embodiment corresponding to Figure 2 above, in another optional embodiment of the medical image processing method provided in this application, after generating the foreground segmentation result corresponding to the medical image to be processed based on the binarized image, the medical image processing method may further include:
根据前景分割结果生成目标正样本图像,其中,目标正样本图像属于正样本集合中的一个正样本图像,且每个正样本图像包含病理组织区域;The target positive sample image is generated based on the foreground segmentation result. The target positive sample image belongs to a positive sample image in the positive sample set, and each positive sample image contains a pathological tissue region.
获取负样本集合,其中,负样本集合包括至少一个负样本图像,且每个负样本图像不包含病理组织区域;Obtain a negative sample set, wherein the negative sample set includes at least one negative sample image, and each negative sample image does not contain a pathological tissue region;
基于正样本集合以及负样本集合,对图像分割模型进行训练。The image segmentation model is trained based on the positive and negative sample sets.
本实施例中,在根据二值化图像生成待处理医学图像所对应的前景分割结果之后,医学图像处理装置还可以根据前景分割结果生成目标正样本图像,该目标正样本图像属于正样本集合中的一个正样本图像,并且每个正样本图像包含病理组织区域,同时,还可以获取负样本集合,该负样本集合包括至少一个负样本图像,并且每个负样本图像不包含病理组织区域,最后可以基于所获取的正样本集合以及负样本集合,对图像分割模型进行训练。该图像分割模型能够基于一张彩色的医学图像分割出相应的病理组织区域。In this embodiment, after generating the foreground segmentation result corresponding to the medical image to be processed based on the binarized image, the medical image processing device can also generate a target positive sample image based on the foreground segmentation result. This target positive sample image belongs to a positive sample image in a set of positive samples, and each positive sample image contains a pathological tissue region. Simultaneously, a negative sample set can be obtained, which includes at least one negative sample image, and each negative sample image does not contain a pathological tissue region. Finally, the image segmentation model can be trained based on the obtained positive and negative sample sets. This image segmentation model can segment the corresponding pathological tissue region based on a color medical image.
本申请实施例中,提供了一种训练图像分割模型的方法,通过上述方式,通过包含病理组织区域的正样本图像合集,以及不包含病理组织区域的负样本集合对图像分割模型进行训练,提升图像分割模型的准确度以及可靠性,从而提升图像处理的效率以及准确度。In this embodiment of the application, a method for training an image segmentation model is provided. By using the above method, the image segmentation model is trained with a set of positive sample images containing pathological tissue regions and a set of negative sample images not containing pathological tissue regions, thereby improving the accuracy and reliability of the image segmentation model and thus improving the efficiency and accuracy of image processing.
具体地,本申请实施例可以提升提取的病理组织区域的准确性,且对后续的图像分析产生积极影响,为了便于理解本申请实施例,请参阅图9,图9为本申请实施例中医学图像处理的方法一个流程示意图,具体地:Specifically, the embodiments of this application can improve the accuracy of extracted pathological tissue regions and have a positive impact on subsequent image analysis. For easier understanding of the embodiments of this application, please refer to Figure 9, which is a flowchart of a medical image processing method in the embodiments of this application. Specifically:
在步骤S1中,获取原始医学图像;In step S1, the original medical image is acquired;
在步骤S2中,基于原始医学图像,获取待处理医学图像;In step S2, the medical image to be processed is obtained based on the original medical image;
在步骤S3中,根据待处理医学图像生成差值图像;In step S3, a difference image is generated based on the medical image to be processed;
在步骤S4中,对差值图像差进行二值化处理,得到二值化图像;In step S4, the difference image is binarized to obtain a binarized image;
在步骤S5中,基于二值化图像得到空洞填补图像;In step S5, a hole-filling image is obtained based on the binarized image;
在步骤S6中,对空洞填补图像进行中值滤波处理,得到前景分割结果。In step S6, the hole-filling image is subjected to median filtering to obtain the foreground segmentation result.
其中,在步骤S1中可以获取到如图9中(A)所示出的原始医学图像,然后在步骤S2中采用滑动窗口从图9中(A)所示出的原始医学图像中提取医学子图像,当检测到医学子图像中包括病理组织区域,则确定为待处理医学图像,从而获取到如图9中(B)所示出的待处理医学图像,进一步地,在步骤S3中,可以根据待处理医学图像中所包括的第一图像数据、第二图像数据以及第三图像数据,从第一像素值、第二像素值以及第三像素值中确定目标像素点所对应的最大像素值以及最小像素值,从而生成最大值图像以及最小值图像,然后根据最大值图像以及最小值图像得到如图9中(C)所示出的差值图像。再进一步地,在步骤S4中,可以根据如图9中(C)所示出的差值图像获取N个像素点所对应的N个像素值,该像素值与像素点具有一一对应的关系,将N个像素值中的最大值确定为待处理像素值,通过根据待处理像素值以及比例阈值,计算得到分割阈值,并且当差值图像中像素点所对应的像素值大于或等于分割阈值时,则将像素点确定为二值化图像的前景像素点,当差值图像中像素点所对应的像素值小于分割阈值时,则将像素点确定为二值化图像的背景像素点,从而可以得到如图9中(D)所示出的二值化图像。在步骤S5中,采用泛洪算法检测二值化图像中包括多个背景像素点的背景区域,然后根据二值化图像以及二值化图像中的背景区域,获取二值化图像中的前景区域内的背景像素点,将二值化图像中的前景区域内的背景像素点变更为前景像素点,从而可以得到如图9中(E)所示出空洞填补图像。在步骤S6中,对空洞填补图像进行中值滤波处理,得到包括待处理前景区域的滤波图像获取待处理前景区域包括M个像素点的边界线,针对边界线上M个像素点中的每个像素点,向外延伸K个像素点,从而得到如图9中(F)所示出的前景分割结果,其中N为大于1的整数。In step S1, the original medical image shown in Figure 9(A) can be obtained. Then, in step S2, a sliding window is used to extract a medical sub-image from the original medical image shown in Figure 9(A). When a pathological tissue region is detected in the medical sub-image, it is determined to be a medical image to be processed, thereby obtaining the medical image to be processed shown in Figure 9(B). Further, in step S3, the maximum and minimum pixel values corresponding to the target pixel can be determined from the first pixel value, the second pixel value, and the third pixel value according to the first image data, the second image data, and the third image data included in the medical image to be processed, thereby generating a maximum value image and a minimum value image. Then, the difference image shown in Figure 9(C) is obtained based on the maximum value image and the minimum value image. Furthermore, in step S4, N pixel values corresponding to N pixels can be obtained from the difference image shown in Figure 9(C). These pixel values have a one-to-one correspondence with the pixels. The maximum value among the N pixel values is determined as the pixel value to be processed. A segmentation threshold is calculated based on the pixel value to be processed and a proportional threshold. When the pixel value corresponding to a pixel in the difference image is greater than or equal to the segmentation threshold, the pixel is determined as a foreground pixel in the binarized image. When the pixel value corresponding to a pixel in the difference image is less than the segmentation threshold, the pixel is determined as a background pixel in the binarized image, thus obtaining the binarized image shown in Figure 9(D). In step S5, a flooding algorithm is used to detect background regions containing multiple background pixels in the binarized image. Then, based on the binarized image and the background regions in the binarized image, background pixels within the foreground region of the binarized image are obtained. These background pixels within the foreground region of the binarized image are changed to foreground pixels, thus obtaining the hole-filling image shown in Figure 9(E). In step S6, the hole-filling image is subjected to median filtering to obtain a filtered image including the foreground region to be processed. The boundary line of the foreground region to be processed, which includes M pixels, is obtained. For each of the M pixels on the boundary line, K pixels are extended outward to obtain the foreground segmentation result shown in Figure 9(F), where N is an integer greater than 1.
进一步地,对不同的待处理医学图像可以生成前景分割结果,请参阅图10,图10为本申请实施例中前景分割结果一个实施例示意图,如图所示,图10中(A)所示出的存在纯白和灰色的待处理医学图像,通过本申请实施例所提供的医学图像处理方法,可以得到如图10中(B)所示出的前景分割结果。而图10中(C)所示出的存在规律性竖条纹的待处理医学图像,该规律性竖条纹通过为扫描仪扫描玻片所产生的条纹,该规律性竖条纹的产生取决于扫描设备,然后通过本申请实施例所提供的医学图像处理方法,可以得到如图10中(D)所示出的前景分割结果。其次,图10中(E)所示出的存在黑白条纹的待处理医学图像,该黑白条纹可以为格式转换所生成的,也可以为扫描仪扫描玻片所产生的不清楚的区域,该区域部分就增加黑白条纹,然后通过本申请实施例所提供的医学图像处理方法,可以得到如图10中(F)所示出的前景分割结果。可以看到,在对图像进行二值化处理之前,先利用不同通道的色彩信息生成差值图像,由于灰度像素点在不同通道下的色彩信息差异较小,而彩色像素点在不同通道下的色彩信息差异较大,可以有效地利用图10中所出现的各种待处理医学图像中的色彩信息,基于差值图像提取到的病理组织区域更为准确,且对后续的图像分析产生积极影响。Furthermore, foreground segmentation results can be generated for different medical images to be processed. Please refer to Figure 10, which is a schematic diagram of an embodiment of the foreground segmentation result in this application. As shown in Figure 10, (A) shows a medical image to be processed containing pure white and gray areas. Through the medical image processing method provided in this application, the foreground segmentation result shown in Figure 10 (B) can be obtained. Figure 10 (C) shows a medical image to be processed containing regular vertical stripes. These regular vertical stripes are generated by the scanner scanning the slide. The generation of these regular vertical stripes depends on the scanning device. Then, through the medical image processing method provided in this application, the foreground segmentation result shown in Figure 10 (D) can be obtained. Secondly, Figure 10 (E) shows a medical image to be processed containing black and white stripes. These black and white stripes can be generated by format conversion or by unclear areas generated by the scanner scanning the slide, where black and white stripes are added. Then, through the medical image processing method provided in this application, the foreground segmentation result shown in Figure 10 (F) can be obtained. As can be seen, before binarizing the image, a difference image is generated using the color information of different channels. Since the color information of grayscale pixels differs little in different channels, while the color information of colored pixels differs much in different channels, the color information in the various medical images to be processed shown in Figure 10 can be effectively utilized. The pathological tissue regions extracted based on the difference image are more accurate and have a positive impact on subsequent image analysis.
结合上述介绍,下面将对本申请中图像处理的方法进行介绍,请参阅图11,图11为本申请实施例中图像处理的方法一个实施例示意图,如图所示,本申请实施例中对图像处理的方法一个实施例包括:Based on the above description, the image processing method in this application will be described below. Please refer to Figure 11, which is a schematic diagram of an embodiment of the image processing method in this application. As shown in the figure, an embodiment of the image processing method in this application includes:
201、获取第一待处理图像以及第二待处理图像,其中,第一待处理图像为彩色图像,且第一待处理图像包括第一图像数据、第二图像数据以及第三图像数据,且第一图像数据、第二图像数据以及是第三图像数据分别对应于不同通道下的色彩信息;201. Obtain a first image to be processed and a second image to be processed, wherein the first image to be processed is a color image, and the first image to be processed includes first image data, second image data and third image data, and the first image data, second image data and third image data respectively correspond to color information under different channels;
本实施例中,图像处理装置可以获取到第一待处理图像以及第二待处理图像,该第一待处理图像可以包括第一图像数据、第二图像数据以及第三图像数据,并且第一图像数据、第二图像数据以及是第三图像数据分别对应于不同通道下的色彩信息。其中第一待处理图像以及第二待处理图像可以为图像处理装置通过有线网络接收到的图像,还可以为图像处理装置本身存储的图像。具体地,第一待处理图像与前述步骤101中所描述的待处理医学图像类似,在此不再赘述。In this embodiment, the image processing device can acquire a first image to be processed and a second image to be processed. The first image to be processed may include first image data, second image data, and third image data, and the first image data, second image data, and third image data respectively correspond to color information under different channels. The first image to be processed and the second image to be processed can be images received by the image processing device through a wired network, or images stored by the image processing device itself. Specifically, the first image to be processed is similar to the medical image to be processed described in step 101 above, and will not be repeated here.
应理解,在实际应用中,第一图像数据、第二图像数据以及第三图像数据具体对应的色彩信息均应当结合实际情况灵活确定。并且图像处理装置可以部署于服务器,也可以部署于具有较高计算力的终端设备,本实施例以图像处理装置部署于服务器为例进行介绍。It should be understood that in practical applications, the specific color information corresponding to the first image data, the second image data, and the third image data should be flexibly determined based on the actual situation. Furthermore, the image processing device can be deployed on a server or on a terminal device with high computing power; this embodiment uses the deployment of the image processing device on a server as an example.
具体地,假设第一待处理图像为阴天拍摄的一张照片,该照片的背景是阴天,还包括一辆红色的小汽车。第二待处理图像则是一张蓝天大海的照片。Specifically, suppose the first image to be processed is a photograph taken on a cloudy day, with a cloudy background and a red car. The second image to be processed is a photograph of a blue sky and a sea.
202、根据第一待处理图像中所包括的第一图像数据、第二图像数据以及第三图像数据,生成差值图像;202. Generate a difference image based on the first image data, the second image data, and the third image data included in the first image to be processed;
本实施例中,图像处理装置可以根据步骤201所获取的第一待处理图像中所包括的第一图像数据、第二图像数据以及第三图像数据,生成差值图像。具体地,该差值图像为灰度图像。本实施例中生成差值图像的方法与前述图2对应实施例类似,在此不再赘述。In this embodiment, the image processing device can generate a difference image based on the first image data, second image data, and third image data included in the first image to be processed obtained in step 201. Specifically, the difference image is a grayscale image. The method for generating the difference image in this embodiment is similar to that in the embodiment corresponding to FIG2 above, and will not be described again here.
具体地,此时生成的差值图像能够看出小汽车的轮廓。Specifically, the resulting difference image reveals the outline of the car.
203、对差值图像进行二值化处理,得到二值化图像;203. Perform binarization on the difference image to obtain a binarized image;
本实施例中,图像处理装置可以对步骤202所生成的差值图像进行二值化处理,得到二值化图像。具体地,本实施例中采用自适应二值化方式来进行前景分割,即对差值图像进行二值化处理,从而的得到二值化图像。本实施中生成二值化图像的方法与前述图2对应实施例类似,在此不再赘述。In this embodiment, the image processing device can binarize the difference image generated in step 202 to obtain a binarized image. Specifically, this embodiment uses adaptive binarization for foreground segmentation, that is, binarizing the difference image to obtain a binarized image. The method for generating the binarized image in this embodiment is similar to the embodiment corresponding to Figure 2 above, and will not be described again here.
具体地,此时生成的二值化图像能够准确地展示出小汽车的轮廓。Specifically, the generated binarized image can accurately show the outline of the car.
204、根据二值化图像生成第一待处理图像所对应的前景分割结果;204. Generate the foreground segmentation result corresponding to the first image to be processed based on the binarized image;
本实施例中,图像处理装置可以根据步骤203所得到的据二值化图像生成第一待处理图像所对应的前景分割结果。本实施中生成前景分割结果的方法与前述图2对应实施例类似,在此不再赘述。In this embodiment, the image processing device can generate a foreground segmentation result corresponding to the first image to be processed based on the binarized image obtained in step 203. The method for generating the foreground segmentation result in this embodiment is similar to the embodiment corresponding to Figure 2 above, and will not be described again here.
205、根据前景分割结果,从第一待处理图像中提取目标对象;205. Based on the foreground segmentation results, extract the target object from the first image to be processed;
本实施例中,图像处理装置可以根据步骤204所生成的前景分割结果,从第一待处理图像中提取目标对象。若第一待处理图像为医学图像,则目标对象可以为病理组织区域。若第一待处理图像为高分辨率遥感图像,则目标对象可以为植被区域。若第一待处理图像为实时路况监控图像,则目标对象可以为自行车或者汽车。In this embodiment, the image processing device can extract the target object from the first image to be processed based on the foreground segmentation result generated in step 204. If the first image to be processed is a medical image, the target object can be a pathological tissue area. If the first image to be processed is a high-resolution remote sensing image, the target object can be a vegetation area. If the first image to be processed is a real-time traffic monitoring image, the target object can be a bicycle or a car.
具体地,此时可以从第一待处理图像中抠除小汽车的图像,即小汽车的图像即为目标对象。Specifically, at this point, the image of the car can be extracted from the first image to be processed, meaning the image of the car is the target object.
206、根据目标对象以及第二待处理图像,生成合成图像,其中,目标对象位于第一图层,第二待处理图像位于第二图层,第一图层覆盖于第二图层之上。206. Generate a composite image based on the target object and the second image to be processed, wherein the target object is located in the first layer, the second image to be processed is located in the second layer, and the first layer covers the second layer.
本实施例中,图像处理装置将把目标对象设置为第一图层,第二待处理图像设置为第二图层,并且将第一图层覆盖于第二图层之上,从而生成合成图像。In this embodiment, the image processing device sets the target object as the first layer, sets the second image to be processed as the second layer, and overlays the first layer on top of the second layer to generate a composite image.
具体地,将小汽车的图像覆盖于蓝天白云照片之上,形成一张合成后的图像,在该图像上可以看到小汽车的背景不再是阴天,而是蓝天白云。Specifically, an image of a car is overlaid on a photo of blue sky and white clouds to create a composite image. In this composite image, the background of the car is no longer cloudy, but rather blue sky and white clouds.
本申请实施例中,提供了一种图像处理的方法,通过上述方式,由于灰度像素点在不同通道下的色彩信息差异较小,而彩色像素点在不同通道下的色彩信息差异较大,因此,在对图像进行二值化处理之前,先利用不同通道的色彩信息生成差值图像,从而有效地利用了图像中的色彩信息,基于差值图像提取到的目标对象更为准确,从而根据该目标对象所在图层覆盖于第二待处理图像所在图层,所生成的合成图像汇总目标对象准确,从而提升合成图像的准确度,并可以对后续的图像分析产生积极影响。In this embodiment of the application, an image processing method is provided. Using the above method, since the color information differences between grayscale pixels in different channels are small, while the color information differences between color pixels in different channels are large, a difference image is generated using the color information of different channels before binarizing the image. This effectively utilizes the color information in the image, and the target object extracted based on the difference image is more accurate. Since the layer containing the target object is overlaid on the layer containing the second image to be processed, the resulting composite image accurately summarizes the target object, thereby improving the accuracy of the composite image and positively impacting subsequent image analysis.
下面对本申请中的医学图像处理装置进行详细描述,请参阅图12,图12为本申请实施例中医学图像处理装置一个实施例示意图,医学图像处理装置300包括:The medical image processing apparatus of this application is described in detail below. Please refer to Figure 12, which is a schematic diagram of one embodiment of the medical image processing apparatus in this application. The medical image processing apparatus 300 includes:
获取模块301,用于获取待处理医学图像,其中,待处理医学图像为彩色图像,且待处理医学图像包括第一图像数据、第二图像数据以及第三图像数据,且第一图像数据、第二图像数据以及是第三图像数据分别对应于不同通道下的色彩信息;The acquisition module 301 is used to acquire a medical image to be processed, wherein the medical image to be processed is a color image, and the medical image to be processed includes first image data, second image data and third image data, and the first image data, second image data and third image data respectively correspond to color information under different channels;
生成模块302,用于根据待处理医学图像中所包括的第一图像数据、第二图像数据以及第三图像数据,生成差值图像;The generation module 302 is used to generate a difference image based on the first image data, the second image data, and the third image data included in the medical image to be processed;
处理模块303,用于对差值图像进行二值化处理,得到二值化图像;Processing module 303 is used to perform binarization processing on the difference image to obtain a binarized image;
生成模块302,还用于根据二值化图像生成待处理医学图像所对应的前景分割结果。The generation module 302 is also used to generate the foreground segmentation result corresponding to the medical image to be processed based on the binarized image.
本申请实施例中,提供了一种医学图像处理的方法,通过上述方式,由于灰度像素点在不同通道下的色彩信息差异较小,而彩色像素点在不同通道下的色彩信息差异较大,因此,在对图像进行二值化处理之前,先利用不同通道的色彩信息生成差值图像,从而有效地利用了图像中的色彩信息,基于差值图像提取到的病理组织区域更为准确,且对后续的图像分析产生积极影响。In this embodiment of the application, a method for medical image processing is provided. In this method, since the color information difference of grayscale pixels in different channels is small, while the color information difference of color pixels in different channels is large, before binarizing the image, a difference image is generated using the color information of different channels. This effectively utilizes the color information in the image, and the pathological tissue region extracted based on the difference image is more accurate, which has a positive impact on subsequent image analysis.
可选地,在上述图12所对应的实施例的基础上,本申请实施例提供的医学图像处理装置300的另一实施例中,Optionally, based on the embodiment corresponding to FIG12 above, in another embodiment of the medical image processing apparatus 300 provided in this application,
生成模块302,具体用于根据待处理医学图像中所包括的第一图像数据、第二图像数据以及第三图像数据,生成最大值图像;The generation module 302 is specifically used to generate a maximum value image based on the first image data, the second image data, and the third image data included in the medical image to be processed.
根据待处理医学图像中所包括的第一图像数据、第二图像数据以及第三图像数据,生成最小值图像;A minimum value image is generated based on the first image data, the second image data, and the third image data included in the medical image to be processed.
根据最大值图像以及最小值图像,生成差值图像。Generate a difference image based on the maximum and minimum value images.
本申请实施例中,提供了一种生成差值图像的方法,通过上述方式,根据第一图像数据、第二图像数据以及第三图像数据生成最大值图像以及最小值图像,由于不同图像数据对应的色彩信息不同,根据不同图像数据所确定的最大值图像以及最小值图像,所包括的待处理医学图像的色彩信息准确度较高,从而提升差值图像生成的准确度。In this embodiment of the application, a method for generating a difference image is provided. By means of the above method, a maximum value image and a minimum value image are generated based on the first image data, the second image data, and the third image data. Since the color information corresponding to different image data is different, the maximum value image and the minimum value image determined based on different image data include color information of the medical image to be processed with high accuracy, thereby improving the accuracy of the difference image generation.
可选地,在上述图12所对应的实施例的基础上,本申请实施例提供的医学图像处理装置300的另一实施例中,Optionally, based on the embodiment corresponding to FIG12 above, in another embodiment of the medical image processing apparatus 300 provided in this application,
生成模块302,具体用于根据待处理医学图像中所包括的第一图像数据、第二图像数据以及第三图像数据,从第一像素值、第二像素值以及第三像素值中确定目标像素点所对应的最大像素值,其中,第一像素值为第一图像数据中第一像素位置所对应的像素值,第二像素值为第二图像数据中第二像素位置所对应的像素值,第三像素值为第三图像数据中第三像素位置所对应的像素值,目标像素点为最大值图像中第四像素位置所对应的像素值,第一像素位置、第二像素位置、第三像素位置以及第四像素位置均对应于待处理医学图像中同一个像素点的位置;The generation module 302 is specifically used to determine the maximum pixel value corresponding to the target pixel from the first pixel value, the second pixel value, and the third pixel value according to the first image data, the second image data, and the third image data included in the medical image to be processed. The first pixel value is the pixel value corresponding to the first pixel position in the first image data, the second pixel value is the pixel value corresponding to the second pixel position in the second image data, the third pixel value is the pixel value corresponding to the third pixel position in the third image data, and the target pixel is the pixel value corresponding to the fourth pixel position in the maximum value image. The first pixel position, the second pixel position, the third pixel position, and the fourth pixel position all correspond to the position of the same pixel in the medical image to be processed.
生成模块302,具体用于根据待处理医学图像中所包括的第一图像数据、第二图像数据以及第三图像数据,从第一像素值、第二像素值以及第三像素值中确定目标像素点所对应的最小像素值;The generation module 302 is specifically used to determine the minimum pixel value corresponding to the target pixel from the first pixel value, the second pixel value, and the third pixel value based on the first image data, the second image data, and the third image data included in the medical image to be processed.
生成模块302,具体用于将最大值图像中目标像素点所对应的最大像素值,与最大值图像中目标像素点所对应的最小像素值相减,得到差值图像中目标像素点所对应的差值像素值。The generation module 302 is specifically used to subtract the maximum pixel value corresponding to the target pixel in the maximum value image from the minimum pixel value corresponding to the target pixel in the maximum value image to obtain the difference pixel value corresponding to the target pixel in the difference image.
本申请实施例中,提供了一种生成最大值图像的方法,通过上述方式,通过第一图像数据、第二图像数据以及第三图像数据对应目标像素点的像素值,确定最大像素值以及最小像素值,最大像素值以及最小像素值不同程度的反映待处理医学图像的色彩信息,并由最大像素值以及最小像素值相减得到差值像素值,使得该差值像素值能够准确的反映待处理医学图像的色彩信息,从而提升差值图像生成的准确度。In this embodiment of the application, a method for generating a maximum value image is provided. In the above manner, the maximum pixel value and the minimum pixel value are determined by the pixel values of the target pixel points corresponding to the first image data, the second image data, and the third image data. The maximum pixel value and the minimum pixel value reflect the color information of the medical image to be processed to different degrees. The difference pixel value is obtained by subtracting the maximum pixel value and the minimum pixel value, so that the difference pixel value can accurately reflect the color information of the medical image to be processed, thereby improving the accuracy of the difference image generation.
可选地,在上述图12所对应的实施例的基础上,本申请实施例提供的医学图像处理装置300的另一实施例中,Optionally, based on the embodiment corresponding to FIG12 above, in another embodiment of the medical image processing apparatus 300 provided in this application,
生成模块302,具体用于根据待处理医学图像中所包括的第一图像数据、第二图像数据以及第三图像数据,生成待处理差值图像;The generation module 302 is specifically used to generate a difference image to be processed based on the first image data, the second image data, and the third image data included in the medical image to be processed.
对待处理差值图像进行高斯模糊处理,得到差值图像。Gaussian blur is applied to the difference image to obtain the difference image.
本申请实施例中,提供了另一种生成差值图像的方法,通过上述方式,对生成待处理差值图像行高斯模糊处理,由于高斯模糊处理可以提升分割鲁棒性,由此所得到的差值图像有较好的分割鲁棒性,从而提升成差值图像的稳定性。In this embodiment of the application, another method for generating a difference image is provided. In this method, the difference image to be processed is subjected to Gaussian blur processing. Since Gaussian blur processing can improve segmentation robustness, the resulting difference image has better segmentation robustness, thereby improving the stability of the difference image.
可选地,在上述图12所对应的实施例的基础上,本申请实施例提供的医学图像处理装置300的另一实施例中,医学图像处理装置300还包括确定模块304;Optionally, based on the embodiment corresponding to FIG12 above, in another embodiment of the medical image processing device 300 provided in this application, the medical image processing device 300 further includes a determination module 304;
确定模块304,用于根据差值图像确定分割阈值;The determination module 304 is used to determine the segmentation threshold based on the difference image;
确定模块304,还用于若差值图像中像素点所对应的像素值大于或等于分割阈值,则将像素点确定为二值化图像的前景像素点;The determining module 304 is further configured to determine the pixel as the foreground pixel of the binarized image if the pixel value corresponding to the pixel in the difference image is greater than or equal to the segmentation threshold.
确定模块304,还用于若差值图像中像素点所对应的像素值小于分割阈值,则将像素点确定为二值化图像的背景像素点。The determination module 304 is also used to determine the pixel as the background pixel of the binarized image if the pixel value corresponding to the pixel in the difference image is less than the segmentation threshold.
本申请实施例中,提供了一种得到二值化图像的方法,通过上述方式,根据二值化处理生成二值化图像,由于二值化图像的几何性质不涉及到像素的灰度值,可以使得后续对二值化图像的处理变得简单,从而可以提升生成前景分割结果的效率。In this embodiment of the application, a method for obtaining a binarized image is provided. By means of the above method, a binarized image is generated according to the binarization process. Since the geometric properties of the binarized image do not involve the gray values of the pixels, the subsequent processing of the binarized image can be simplified, thereby improving the efficiency of generating foreground segmentation results.
可选地,在上述图12所对应的实施例的基础上,本申请实施例提供的医学图像处理装置300的另一实施例中,Optionally, based on the embodiment corresponding to FIG12 above, in another embodiment of the medical image processing apparatus 300 provided in this application,
确定模块304,具体用于根据差值图像获取N个像素点所对应的N个像素值,其中,像素值与像素点具有一一对应的关系,N为大于1的整数;The determination module 304 is specifically used to obtain N pixel values corresponding to N pixels based on the difference image, wherein there is a one-to-one correspondence between pixel values and pixel points, and N is an integer greater than 1;
从N个像素值中确定待处理像素值,其中,待处理像素值为N个像素值中的最大值;Determine the pixel value to be processed from N pixel values, where the pixel value to be processed is the maximum value among the N pixel values;
根据待处理像素值以及比例阈值,计算得到分割阈值。The segmentation threshold is calculated based on the pixel value to be processed and the ratio threshold.
本申请实施例中,提供了另一种得到分割阈值的方法,通过上述方式,可以通过由最大像素值确定的待处理像素值以及比例阈值的分割阈值,由于差值图像灰度深度是存在差异的,并且不同区域其明暗分布也可以是不同的,因此,可以通过调整比例阈值灵活确定分割阈值,提升阈值准确度以及灵活性,从而提升二值化图像生成的准确度。In this embodiment of the application, another method for obtaining the segmentation threshold is provided. In the above manner, the segmentation threshold can be determined by the pixel value to be processed by the maximum pixel value and the ratio threshold. Since the gray depth of the difference image is different and the brightness distribution of different regions can also be different, the segmentation threshold can be flexibly determined by adjusting the ratio threshold, thereby improving the accuracy and flexibility of the threshold and thus improving the accuracy of binarized image generation.
可选地,在上述图12所对应的实施例的基础上,本申请实施例提供的医学图像处理装置300的另一实施例中,Optionally, based on the embodiment corresponding to FIG12 above, in another embodiment of the medical image processing apparatus 300 provided in this application,
生成模块302,具体用于采用泛洪算法检测二值化图像中的背景区域,其中,背景区域包括多个背景像素点;The generation module 302 is specifically used to detect the background region in the binarized image using a flooding algorithm, wherein the background region includes multiple background pixels;
根据二值化图像以及二值化图像中的背景区域,获取二值化图像中的前景区域内的背景像素点,其中,前景区域包括多个前景像素点;Based on the binarized image and the background region in the binarized image, obtain the background pixels within the foreground region of the binarized image, wherein the foreground region includes multiple foreground pixels;
将二值化图像中的前景区域内的背景像素点变更为前景像素点,得到空洞填补图像;By replacing background pixels in the foreground region of a binarized image with foreground pixels, a hole-filling image is obtained.
对空洞填补图像进行中值滤波处理,得到待处理医学图像所对应的前景分割结果。Median filtering is applied to the hole-filling image to obtain the foreground segmentation result corresponding to the medical image to be processed.
本申请实施例中,提供了一种生成前景分割结果的方法,通过上述方式,将前景区域内的背景像素点变更为前景像素点,所得到空洞填补图像具有较好的可靠性,其次,通过中值滤波处理,能够在不损坏图像的轮廓及边缘等特征信息的基础上,使得待处理医学图像所对应的前景分割结果清晰并且视觉效果好。In this embodiment of the application, a method for generating foreground segmentation results is provided. By changing the background pixels in the foreground region to foreground pixels in the above manner, the resulting hole-filling image has good reliability. Secondly, by median filtering, the foreground segmentation result corresponding to the medical image to be processed can be clear and have good visual effect without damaging the contour and edge features of the image.
可选地,在上述图12所对应的实施例的基础上,本申请实施例提供的医学图像处理装置300的另一实施例中,Optionally, based on the embodiment corresponding to FIG12 above, in another embodiment of the medical image processing apparatus 300 provided in this application,
处理模块303,具体用于对空洞填补图像进行中值滤波处理,得到滤波图像,其中,滤波图像包括待处理前景区域;The processing module 303 is specifically used to perform median filtering on the hole-filling image to obtain a filtered image, wherein the filtered image includes the foreground region to be processed;
获取待处理前景区域的边界线,其中,边界线包括M个像素点,M为大于1的整数;Obtain the boundary line of the foreground region to be processed, where the boundary line consists of M pixels, M being an integer greater than 1;
针对边界线上M个像素点中的每个像素点,向外延伸K个像素点,得到前景分割结果,其中,K为大于或等于1的整数。For each of the M pixels on the boundary line, extend outward by K pixels to obtain the foreground segmentation result, where K is an integer greater than or equal to 1.
本申请实施例中,提供了另一种生成前景分割结果的方法,通过上述方式,通过中值滤波处理,能够在不损坏图像的轮廓及边缘等特征信息的基础上,使得滤波图像清晰并且视觉效果好。其次,通过泛洪算法对滤波图像进行形态学处理,提升前景分割结果的准确度以及一体性。This application provides another method for generating foreground segmentation results. Through median filtering, the filtered image is clear and has good visual quality without damaging the image's contours and edges. Furthermore, a flooding algorithm is used to perform morphological processing on the filtered image, improving the accuracy and uniformity of the foreground segmentation results.
可选地,在上述图12所对应的实施例的基础上,本申请实施例提供的医学图像处理装置300的另一实施例中,Optionally, based on the embodiment corresponding to FIG12 above, in another embodiment of the medical image processing apparatus 300 provided in this application,
获取模块301,具体用于获取原始医学图像;Acquisition module 301 is specifically used to acquire raw medical images;
采用滑动窗口从原始医学图像中提取医学子图像;A sliding window method is used to extract medical sub-images from the original medical image;
若检测到医学子图像中包括病理组织区域,则确定为待处理医学图像;If a pathological tissue region is detected in a medical sub-image, it is identified as a medical image to be processed.
若检测到医学子图像中未包括病理组织区域,则将医学子图像确定为背景图像,且去除背景图像。If a medical sub-image is found to not include a pathological tissue region, the medical sub-image is identified as a background image and removed.
本申请实施例中,提供了一种获取待处理医学图像的方法,通过上述方式,通过检测医学子图像是否包括有病理组织区域,确定待处理医学图像,使得包括有病理组织区域的待处理医学图像通过前述步骤,能够获取的待处理医学图像所对应的前景分割结果,并且前景分割结果包括有病理组织区域,便于后续对该前景分割结果中病理组织区域的处理以及分析。其次,将为包括有病理组织区域的医学子图像确定为背景图像,且去除该背景图像,减少资源占用率。This application provides a method for acquiring a medical image to be processed. By detecting whether a medical sub-image includes a pathological tissue region, the medical image to be processed is determined. This ensures that the medical image containing a pathological tissue region can be segmented into a foreground segmentation result through the aforementioned steps. Furthermore, the foreground segmentation result includes the pathological tissue region, facilitating subsequent processing and analysis of this pathological tissue region. Secondly, the medical sub-image containing the pathological tissue region is designated as a background image and removed to reduce resource consumption.
可选地,在上述图12所对应的实施例的基础上,本申请实施例提供的医学图像处理装置300的另一实施例中,图像处理装置还包括训练模块305;Optionally, based on the embodiment corresponding to FIG12 above, in another embodiment of the medical image processing device 300 provided in this application, the image processing device further includes a training module 305;
生成模块302,还用于根据前景分割结果生成目标正样本图像,其中,目标正样本图像属于正样本集合中的一个正样本图像,且每个正样本图像包含病理组织区域;The generation module 302 is also used to generate a target positive sample image based on the foreground segmentation result, wherein the target positive sample image belongs to a positive sample image in the positive sample set, and each positive sample image contains a pathological tissue region;
获取模块301,还用于获取负样本集合,其中,负样本集合包括至少一个负样本图像,且每个负样本图像不包含病理组织区域;The acquisition module 301 is also used to acquire a negative sample set, wherein the negative sample set includes at least one negative sample image, and each negative sample image does not contain a pathological tissue region;
训练模块305,用于基于正样本集合以及负样本集合,对图像分割模型进行训练。Training module 305 is used to train the image segmentation model based on the positive sample set and the negative sample set.
本申请实施例中,提供了一种训练图像分割模型的方法,通过上述方式,通过包含病理组织区域的正样本图像合集,以及不包含病理组织区域的负样本集合对图像分割模型进行训练,提升图像分割模型的准确度以及可靠性,从而提升图像处理的效率以及准确度。In this embodiment of the application, a method for training an image segmentation model is provided. By using the above method, the image segmentation model is trained with a set of positive sample images containing pathological tissue regions and a set of negative sample images not containing pathological tissue regions, thereby improving the accuracy and reliability of the image segmentation model and thus improving the efficiency and accuracy of image processing.
下面对本申请中的图像处理装置进行详细描述,请参阅图13,图13为本申请实施例中图像处理装置一个实施例示意图,图像处理装置400包括:The image processing apparatus of this application is described in detail below. Please refer to FIG13, which is a schematic diagram of an embodiment of the image processing apparatus in this application. The image processing apparatus 400 includes:
获取模块401,用于获取第一待处理图像以及第二待处理图像,其中,第一待处理图像为彩色图像,且第一待处理图像包括第一图像数据、第二图像数据以及第三图像数据,且第一图像数据、第二图像数据以及是第三图像数据分别对应于不同通道下的色彩信息;The acquisition module 401 is used to acquire a first image to be processed and a second image to be processed, wherein the first image to be processed is a color image and includes first image data, second image data and third image data, and the first image data, second image data and third image data respectively correspond to color information under different channels;
生成模块402,用于根据第一待处理图像中所包括的第一图像数据、第二图像数据以及第三图像数据,生成差值图像;The generation module 402 is used to generate a difference image based on the first image data, the second image data, and the third image data included in the first image to be processed;
处理模块403,用于对差值图像进行二值化处理,得到二值化图像;Processing module 403 is used to perform binarization processing on the difference image to obtain a binarized image;
生成模块402,还用于根据二值化图像生成第一待处理图像所对应的前景分割结果;The generation module 402 is also used to generate a foreground segmentation result corresponding to the first image to be processed based on the binarized image;
提取模块404,用于根据前景分割结果,从第一待处理图像中提取目标对象;Extraction module 404 is used to extract the target object from the first image to be processed based on the foreground segmentation result;
生成模块402,还用于根据目标对象以及第二待处理图像,生成合成图像,其中,目标对象位于第一图层,第二待处理图像位于第二图层,第一图层覆盖于第二图层之上。The generation module 402 is also used to generate a composite image based on the target object and the second image to be processed, wherein the target object is located in the first layer, the second image to be processed is located in the second layer, and the first layer covers the second layer.
本申请实施例中,提供了一种图像处理的方法,通过上述方式,由于灰度像素点在不同通道下的色彩信息差异较小,而彩色像素点在不同通道下的色彩信息差异较大,因此,在对图像进行二值化处理之前,先利用不同通道的色彩信息生成差值图像,从而有效地利用了图像中的色彩信息,基于差值图像提取到的目标对象更为准确,从而根据该目标对象所在图层覆盖于第二待处理图像所在图层,所生成的合成图像汇总目标对象准确,从而提升合成图像的准确度,并可以对后续的图像分析产生积极影响。In this embodiment of the application, an image processing method is provided. Using the above method, since the color information differences between grayscale pixels in different channels are small, while the color information differences between color pixels in different channels are large, a difference image is generated using the color information of different channels before binarizing the image. This effectively utilizes the color information in the image, and the target object extracted based on the difference image is more accurate. Since the layer containing the target object is overlaid on the layer containing the second image to be processed, the resulting composite image accurately summarizes the target object, thereby improving the accuracy of the composite image and positively impacting subsequent image analysis.
图14是本申请实施例提供的一种服务器结构示意图,该服务器500可因配置或性能不同而产生比较大的差异,可以包括一个或一个以上中央处理器(central processingunits,CPU)522(例如,一个或一个以上处理器)和存储器532,一个或一个以上存储应用程序542或数据544的存储介质530(例如一个或一个以上海量存储设备)。其中,存储器532和存储介质530可以是短暂存储或持久存储。存储在存储介质530的程序可以包括一个或一个以上模块(图示没标出),每个模块可以包括对服务器中的一系列指令操作。更进一步地,中央处理器522可以设置为与存储介质530通信,在服务器500上执行存储介质530中的一系列指令操作。Figure 14 is a schematic diagram of a server structure provided in an embodiment of this application. The server 500 can vary significantly due to different configurations or performance. It may include one or more central processing units (CPUs) 522 (e.g., one or more processors) and memory 532, and one or more storage media 530 (e.g., one or more mass storage devices) for storing application programs 542 or data 544. The memory 532 and storage media 530 can be temporary or persistent storage. The program stored in the storage media 530 may include one or more modules (not shown in the figure), each module including a series of instruction operations on the server. Furthermore, the CPU 522 may be configured to communicate with the storage media 530 and execute the series of instruction operations in the storage media 530 on the server 500.
服务器500还可以包括一个或一个以上电源525,一个或一个以上有线或无线网络接口550,一个或一个以上输入输出接口558,和/或,一个或一个以上操作系统541,例如Windows ServerTM,Mac OS XTM,UnixTM,LinuxTM,FreeBSDTM等等。Server 500 may also include one or more power supplies 525, one or more wired or wireless network interfaces 550, one or more input/output interfaces 558, and/or one or more operating systems 541, such as Windows Server ™ , Mac OS X ™ , Unix ™ , Linux ™ , FreeBSD ™ , etc.
上述实施例中由服务器所执行的步骤可以基于该图14所示的服务器结构。The steps performed by the server in the above embodiments can be based on the server structure shown in Figure 14.
本实施例中,CPU 522用于执行图2对应的实施例中医学图像处理装置执行的步骤,CPU 522还用于执行图1对应的实施例中图像处理装置执行的步骤。In this embodiment, CPU 522 is used to execute the steps performed by the medical image processing device in the embodiment corresponding to FIG2, and CPU 522 is also used to execute the steps performed by the image processing device in the embodiment corresponding to FIG1.
所属领域的技术人员可以清楚地了解到,为描述的方便和简洁,上述描述的系统,装置和单元的具体工作过程,可以参考前述方法实施例中的对应过程,在此不再赘述。Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the specific working processes of the systems, devices, and units described above can be referred to the corresponding processes in the foregoing method embodiments, and will not be repeated here.
在本申请所提供的几个实施例中,应该理解到,所揭露的系统,装置和方法,可以通过其它的方式实现。例如,以上所描述的装置实施例仅仅是示意性的,例如,所述单元的划分,仅仅为一种逻辑功能划分,实际实现时可以有另外的划分方式,例如多个单元或组件可以结合或者可以集成到另一个系统,或一些特征可以忽略,或不执行。另一点,所显示或讨论的相互之间的耦合或直接耦合或通信连接可以是通过一些接口,装置或单元的间接耦合或通信连接,可以是电性,机械或其它的形式。In the several embodiments provided in this application, it should be understood that the disclosed systems, apparatuses, and methods can be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative; for instance, the division of units is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be an indirect coupling or communication connection between apparatuses or units through some interfaces, and may be electrical, mechanical, or other forms.
所述作为分离部件说明的单元可以是或者也可以不是物理上分开的,作为单元显示的部件可以是或者也可以不是物理单元,即可以位于一个地方,或者也可以分布到多个网络单元上。可以根据实际的需要选择其中的部分或者全部单元来实现本实施例方案的目的。The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.
另外,在本申请各个实施例中的各功能单元可以集成在一个处理单元中,也可以是各个单元单独物理存在,也可以两个或两个以上单元集成在一个单元中。上述集成的单元既可以采用硬件的形式实现,也可以采用软件功能单元的形式实现。Furthermore, the functional units in the various embodiments of this application can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit.
所述集成的单元如果以软件功能单元的形式实现并作为独立的产品销售或使用时,可以存储在一个计算机可读取存储介质中。基于这样的理解,本申请的技术方案本质上或者说对现有技术做出贡献的部分或者该技术方案的全部或部分可以以软件产品的形式体现出来,该计算机软件产品存储在一个存储介质中,包括若干指令用以使得一台计算机设备(可以是个人计算机,服务器,或者网络设备等)执行本申请各个实施例所述方法的全部或部分步骤。而前述的存储介质包括:U盘、移动硬盘、只读存储器(read-only memory,ROM)、随机存取存储器(random access memory,RAM)、磁碟或者光盘等各种可以存储程序代码的介质。If the integrated unit is implemented as a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or all or part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.
以上所述,以上实施例仅用以说明本申请的技术方案,而非对其限制;尽管参照前述实施例对本申请进行了详细的说明,本领域的普通技术人员应当理解:其依然可以对前述各实施例所记载的技术方案进行修改,或者对其中部分技术特征进行等同替换;而这些修改或者替换,并不使相应技术方案的本质脱离本申请各实施例技术方案的精神和范围。The above-described embodiments are only used to illustrate the technical solutions of this application, and are not intended to limit them. Although this application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features. Such modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of this application.
Claims (11)
Publications (2)
| Publication Number | Publication Date |
|---|---|
| HK40023655A HK40023655A (en) | 2020-12-04 |
| HK40023655B true HK40023655B (en) | 2023-10-27 |
Family
ID=
Similar Documents
| Publication | Publication Date | Title |
|---|---|---|
| KR102874690B1 (en) | Medical image processing method, image processing method and device | |
| Yeh et al. | Lightweight deep neural network for joint learning of underwater object detection and color conversion | |
| US11830230B2 (en) | Living body detection method based on facial recognition, and electronic device and storage medium | |
| US20210118144A1 (en) | Image processing method, electronic device, and storage medium | |
| CN112614136B (en) | Infrared small target real-time instance segmentation method and device | |
| Anvari et al. | Dehaze-GLCGAN: unpaired single image de-hazing via adversarial training | |
| TW202014984A (en) | Image processing method, electronic device, and storage medium | |
| CN112561813B (en) | Face image enhancement method and device, electronic equipment and storage medium | |
| CN116664462A (en) | Infrared and visible light image fusion method based on MS-DSC and I_CBAM | |
| CN101853513B (en) | Time and space significance visual attention method based on entropy | |
| Cai et al. | Perception preserving decolorization | |
| Xu et al. | DANet-SMIW: An improved model for island waterline segmentation based on DANet | |
| CN110766609B (en) | Depth-of-field map super-resolution reconstruction method for ToF camera | |
| Ayub et al. | CNN and Gaussian Pyramid-Based Approach For Enhance Multi-Focus Image Fusion | |
| CN116977243A (en) | Method, device and equipment for converting unsupervised infrared image into visible light image | |
| Yang et al. | Face Recognition Implementation Based on Image Processing Techniques | |
| Zhang et al. | Novel approaches to enhance coral reefs monitoring with underwater image segmentation | |
| CN115115509B (en) | Image generation method, device, electronic equipment and storage medium | |
| HK40023655B (en) | Method for processing medical images, method and device for processing images | |
| Molina et al. | Semantic segmentation of satellite images using a U-shaped fully connected network with dense residual blocks | |
| HK40023655A (en) | Method for processing medical images, method and device for processing images | |
| CN120953858B (en) | A method for small target recognition in UAVs based on wavelet decomposition and motion vectors | |
| CN112070041A (en) | A method and device for live face detection based on CNN deep learning model | |
| CN119810438B (en) | Retina blood vessel image segmentation method based on edge and detail co-conduction topology perception | |
| Mishra et al. | Image Refinement and Reconstruction using Machine Learning |