CN117011531A - Method, device and equipment for extracting adhesion bubbles from dynamic ice image based on watershed segmentation - Google Patents
Method, device and equipment for extracting adhesion bubbles from dynamic ice image based on watershed segmentation Download PDFInfo
- Publication number
- CN117011531A CN117011531A CN202311101039.8A CN202311101039A CN117011531A CN 117011531 A CN117011531 A CN 117011531A CN 202311101039 A CN202311101039 A CN 202311101039A CN 117011531 A CN117011531 A CN 117011531A
- Authority
- CN
- China
- Prior art keywords
- image
- bubbles
- distance
- bubble
- watershed
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Pending
Links
- 238000000034 method Methods 0.000 title claims abstract description 46
- 230000011218 segmentation Effects 0.000 title claims abstract description 15
- 230000009466 transformation Effects 0.000 claims abstract description 37
- 239000011159 matrix material Substances 0.000 claims description 37
- 238000003062 neural network model Methods 0.000 claims description 19
- 239000000284 extract Substances 0.000 claims description 14
- 238000000605 extraction Methods 0.000 claims description 2
- 230000000694 effects Effects 0.000 abstract description 9
- 239000003550 marker Substances 0.000 description 8
- 238000010586 diagram Methods 0.000 description 5
- 238000005516 engineering process Methods 0.000 description 5
- 239000000853 adhesive Substances 0.000 description 4
- 230000001070 adhesive effect Effects 0.000 description 4
- 230000006870 function Effects 0.000 description 4
- 239000002245 particle Substances 0.000 description 4
- 230000008569 process Effects 0.000 description 4
- 238000004422 calculation algorithm Methods 0.000 description 3
- 230000001131 transforming effect Effects 0.000 description 3
- XLYOFNOQVPJJNP-UHFFFAOYSA-N water Substances O XLYOFNOQVPJJNP-UHFFFAOYSA-N 0.000 description 3
- 230000008859 change Effects 0.000 description 2
- 238000004891 communication Methods 0.000 description 2
- 238000012986 modification Methods 0.000 description 2
- 230000004048 modification Effects 0.000 description 2
- 230000000704 physical effect Effects 0.000 description 2
- 239000011148 porous material Substances 0.000 description 2
- 238000006467 substitution reaction Methods 0.000 description 2
- 238000004364 calculation method Methods 0.000 description 1
- 238000013500 data storage Methods 0.000 description 1
- 230000007547 defect Effects 0.000 description 1
- 230000007774 longterm Effects 0.000 description 1
- 230000007246 mechanism Effects 0.000 description 1
- 238000001000 micrograph Methods 0.000 description 1
- 238000007781 pre-processing Methods 0.000 description 1
- 239000000758 substrate Substances 0.000 description 1
- 238000011426 transformation method Methods 0.000 description 1
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06V—IMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
- G06V10/00—Arrangements for image or video recognition or understanding
- G06V10/20—Image preprocessing
- G06V10/26—Segmentation of patterns in the image field; Cutting or merging of image elements to establish the pattern region, e.g. clustering-based techniques; Detection of occlusion
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T5/00—Image enhancement or restoration
- G06T5/40—Image enhancement or restoration using histogram techniques
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T7/00—Image analysis
- G06T7/10—Segmentation; Edge detection
- G06T7/11—Region-based segmentation
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06V—IMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
- G06V10/00—Arrangements for image or video recognition or understanding
- G06V10/20—Image preprocessing
- G06V10/28—Quantising the image, e.g. histogram thresholding for discrimination between background and foreground patterns
Landscapes
- Engineering & Computer Science (AREA)
- Physics & Mathematics (AREA)
- General Physics & Mathematics (AREA)
- Theoretical Computer Science (AREA)
- Multimedia (AREA)
- Computer Vision & Pattern Recognition (AREA)
- Image Processing (AREA)
Abstract
Description
本申请为该申请人在先申请的分案申请,该在先申请的申请号为CN202210638584.X,申请名称为一种从动态冰图像中提取粘连气泡的方法、装置及设备。This application is a divisional application of the applicant's earlier application. The application number of the earlier application is CN202210638584.X, and the application title is a method, device and equipment for extracting adhesion bubbles from dynamic ice images.
技术领域Technical field
本申请涉及图像处理技术领域,更具体地,涉及一种基于分水岭分割的从动态冰图像中提取粘连气泡的方法、装置及设备。The present application relates to the field of image processing technology, and more specifically, to a method, device and equipment for extracting adhesion bubbles from dynamic ice images based on watershed segmentation.
背景技术Background technique
飞机穿越云层时,过冷水滴撞击到机体后,可能发生相变并导致结冰现象。结冰会改变飞机的外形与绕流流场,破坏气动性能,降低操纵性与稳定性,威胁飞行安全,严重时导致空难事故。飞机结冰实质是过冷水滴的动态结冰过程。过冷水撞击低温基底结冰,形成的带有非均匀分布的气泡的冰即动态冰。动态冰中的气泡是决定动态冰物理特性的根本因素。通过分析动态冰微观结构中的气泡含量、分布、孔径等特征,研究动态冰的物理特性,可以建立科学有效的结冰防护手段,保障飞机飞行安全。When an aircraft passes through clouds, when supercooled water droplets hit the aircraft body, a phase change may occur and lead to icing. Icing will change the shape and flow field of the aircraft, destroy aerodynamic performance, reduce maneuverability and stability, threaten flight safety, and in serious cases lead to air crashes. Aircraft icing is essentially a dynamic icing process of supercooled water droplets. Supercooled water hits the low-temperature substrate and freezes, and the ice with non-uniformly distributed bubbles formed is dynamic ice. Bubbles in dynamic ice are the fundamental factor that determines the physical properties of dynamic ice. By analyzing the bubble content, distribution, pore size and other characteristics in the microstructure of dynamic ice and studying the physical properties of dynamic ice, scientific and effective icing protection methods can be established to ensure the safety of aircraft flight.
研究动态冰微观结构中的气泡含量、分布、孔径等特征,需要得到动态冰中的气泡图像,但是动态冰中存在粘连的气泡,在从动态冰图像中提取气泡时,粘连气泡提取较为困难。目前,可以使用基于标记控制的分水岭算法对粘连的气泡或颗粒进行分割,该种方法在气泡或颗粒大小一样时分割效果较好。但是,在动态冰中的粘连气泡大小相差较大时,难以对小气泡进行标记,因此难以将粘连的多个小气泡进行分割。并且,在动态冰中的粘连气泡附近存在面积大于粘连气泡的较大气泡时,难以对粘连气泡进行标记,因此难以对粘连气泡进行分割。To study the bubble content, distribution, pore size and other characteristics of dynamic ice microstructure, it is necessary to obtain bubble images in dynamic ice. However, there are adhesive bubbles in dynamic ice. When extracting bubbles from dynamic ice images, it is difficult to extract adhesive bubbles. Currently, the watershed algorithm based on mark control can be used to segment adhering bubbles or particles. This method has better segmentation results when the bubbles or particles are of the same size. However, when the sizes of adhering bubbles in dynamic ice vary greatly, it is difficult to mark the small bubbles, and therefore it is difficult to separate multiple adhering small bubbles. Furthermore, when there are large bubbles with an area larger than that of the adhesion bubbles in the vicinity of the adhesion bubbles in the dynamic ice, it is difficult to mark the adhesion bubbles and therefore it is difficult to divide the adhesion bubbles.
因此,现有技术在从动态冰图像中提取粘连气泡时,存在分割粘连气泡的效果较差的问题。Therefore, when extracting adhesion bubbles from dynamic ice images, the existing technology has a problem of poor performance in segmenting adhesion bubbles.
发明内容Contents of the invention
本申请发明人在通过长期实践发现,基于标记控制的分水岭算法根据预处理二值图中的气泡像素点到背景的最小距离,得到距离图像,再对距离图像进行标记。以对距离图像中的局部极小值所在的点进行标记为例,其中,距离图像的距离矩阵中的数值与距离图像中气泡大小有关,气泡越大,气泡中心部分离背景的最小距离越远,取反后,距离矩阵中气泡中心部分的数值越小,在距离图像中大气泡的中心亮度越低。在对距离图像中的局部极小值进行标记时,局部区域中,大气泡中心部分的数值小于小气泡中心部分的数值,因此小气泡的中心部分不会被标记,难以对粘连的小气泡进行分割。基于此,本申请提出了一种从动态冰图像中提取粘连气泡的方法,根据预处理二值图中的气泡像素点到背景的最小距离,得到距离图像;对所述距离图像进行直方图均衡化,调整距离图像的距离矩阵中每个气泡中心部分的数值,得到调整图像;从所述调整图像的图像矩阵中获取满足预设条件的数值,并在所述调整图像中对所述满足预设条件的数值所在的点进行标记,得到标记图像,该标记图像包括所有气泡的中心部分的标记点,根据所述标记图像中的标记点,对所述预处理二值图进行分水岭变换,得到粘连气泡的分割图像。如此,可以有效解决现有技术在从动态冰图像中提取粘连气泡时,存在的分割粘连气泡效果较差的问题。The inventor of the present application discovered through long-term practice that the watershed algorithm based on mark control obtains a distance image based on the minimum distance from the bubble pixels in the preprocessed binary image to the background, and then marks the distance image. Take marking the point where the local minimum value in the distance image is located as an example. The value in the distance matrix of the distance image is related to the size of the bubble in the distance image. The larger the bubble, the farther the minimum distance between the center of the bubble and the background is. , after inversion, the smaller the value of the bubble center part in the distance matrix, the lower the brightness of the center of the large bubble in the distance image. When marking local minima in the distance image, in the local area, the value of the central part of the large bubble is smaller than the value of the central part of the small bubble. Therefore, the central part of the small bubble will not be marked, and it is difficult to detect the stuck small bubbles. segmentation. Based on this, this application proposes a method for extracting adhesion bubbles from dynamic ice images. According to the minimum distance from the bubble pixels in the preprocessed binary image to the background, a distance image is obtained; the distance image is subjected to histogram equalization. , adjust the value of the center part of each bubble in the distance matrix of the distance image to obtain an adjustment image; obtain the values that satisfy the preset conditions from the image matrix of the adjustment image, and add the values that meet the preset conditions in the adjustment image. Assume that the points where the numerical values of the conditions are located are marked to obtain a marked image. The marked image includes the marked points of the central parts of all bubbles. According to the marked points in the marked image, the preprocessed binary image is subjected to watershed transformation to obtain Segmentation image of adhesion bubbles. In this way, the problem of poor segmentation effect of adhesion bubbles existing in the existing technology when extracting adhesion bubbles from dynamic ice images can be effectively solved.
第一方面,本申请实施例提供了一种从动态冰图像中提取粘连气泡的方法,该方法包括:S110.根据预处理二值图中的气泡像素点到背景的最小距离,得到距离图像;S120.对所述距离图像进行直方图均衡化,得到调整图像;S130.从所述调整图像的图像矩阵中获取满足预设条件的数值,并在所述调整图像中对所述满足预设条件的数值所在的点进行标记,得到标记图像;S140.根据所述标记图像中的标记点,对所述预处理二值图进行分水岭变换,得到粘连气泡的分割图像。In the first aspect, embodiments of the present application provide a method for extracting adhesion bubbles from dynamic ice images. The method includes: S110. Obtain a distance image based on the minimum distance from the bubble pixels in the preprocessed binary image to the background; S120. Perform histogram equalization on the distance image to obtain an adjusted image; S130. Obtain the values that satisfy the preset conditions from the image matrix of the adjusted image, and add the values that satisfy the preset conditions in the adjusted image. Mark the points where the numerical values are located to obtain a marked image; S140. According to the marked points in the marked image, perform a watershed transformation on the preprocessed binary image to obtain a segmented image of adhering bubbles.
第二方面,本申请实施例还提供了一种从动态冰图像中提取粘连气泡的系统,该系统包括距离获取单元,用于根据预处理二值图中的气泡像素点到背景的最小距离,得到距离图像;调整单元,用于对所述距离图像进行直方图均衡化,得到调整图像;标记单元,用于从所述调整图像的图像矩阵中获取满足预设条件的数值,并在所述调整图像中对所述满足预设条件的数值所在的点进行标记,得到标记图像;分水岭变换单元,用于根据所述标记图像中的标记点,对所述标记图像进行分水岭变换,得到粘连气泡的分割图像。In a second aspect, embodiments of the present application also provide a system for extracting adhesion bubbles from dynamic ice images. The system includes a distance acquisition unit for determining the minimum distance from the bubble pixels in the preprocessed binary image to the background. Obtain a distance image; an adjustment unit is used to perform histogram equalization on the distance image to obtain an adjustment image; a marking unit is used to obtain a value that satisfies the preset condition from the image matrix of the adjustment image, and in the Mark the points in the adjusted image where the values that meet the preset conditions are located to obtain a marked image; a watershed transformation unit is used to perform watershed transformation on the marked image according to the marked points in the marked image to obtain adhesion bubbles segmented image.
第三方面,本申请实施例还提供了一种电子设备,该电子设备包括一个或多个处理器;存储器;屏幕,用于显示前述方法中的图像;一个或多个应用程序,其中所述一个或多个应用程序被存储在所述存储器中并被配置为由所述一个或多个处理器执行,所述一个或多个程序配置用于执行前述方法。In a third aspect, embodiments of the present application also provide an electronic device, which includes one or more processors; a memory; a screen for displaying images in the foregoing method; and one or more application programs, wherein the One or more application programs are stored in the memory and configured to be executed by the one or more processors, the one or more programs configured to perform the aforementioned methods.
综上所述,本申请至少具有如下技术效果:To sum up, this application has at least the following technical effects:
1.以将预处理二值图进行距离变换并取反得到距离图像为例,本申请通过对需要标记的距离图像进行直方图均衡化,使距离图像中大气泡的中心亮度变高,小气泡的中心亮度变低,也就是使距离矩阵中大气泡中心部分的数值变大,小气泡中心部分的数值变小,在对局部极小值所在的点进行标记时,避免了因气泡大小不同而导致局部区域内的气泡的中心部分的数值大小不同,而不将小气泡中心部分的数值识别为局部极小值,从而无法标记小气泡中心部分所在的点。使用本申请提供的从动态冰图像中提取粘连气泡的方法,在动态冰中的粘连气泡大小相差较大时,以及在动态冰中的粘连气泡附近存在面积大于粘连气泡的较大气泡时,都可以对粘连的小气泡的中心部分所在的点进行标记,从而使分割粘连气泡的效果更好。1. Taking the distance transformation and inversion of the preprocessed binary image to obtain a distance image as an example, this application performs histogram equalization on the distance image that needs to be marked, so that the center brightness of the large bubbles in the distance image becomes higher and the center brightness of the small bubbles becomes higher. The brightness of the center of the distance matrix becomes lower, that is, the value of the center part of the large bubble in the distance matrix becomes larger, and the value of the center part of the small bubble becomes smaller. When marking the point where the local minimum value is located, the difference due to different bubble sizes is avoided. As a result, the value of the central part of the bubble in the local area is different, and the value of the central part of the small bubble is not recognized as a local minimum value, so that the point where the central part of the small bubble is located cannot be marked. Using the method provided by this application to extract adhesion bubbles from dynamic ice images, when the adhesion bubbles in the dynamic ice have a large difference in size, and when there are larger bubbles near the adhesion bubbles in the dynamic ice that have an area larger than the adhesion bubbles, the method can be used to extract adhesion bubbles from dynamic ice images. The point where the center part of the small adhering bubbles is located can be marked, so that the effect of dividing the adhering bubbles is better.
2.本申请通过预设神经网络模型直接从原始图像中提取气泡,提取到包含完整大气泡的第一中间图像,再将原始图像进行分割,通过预设神经网络模型从第二分割图像块中提取气泡,得到包含完整小气泡的第二中间图像,将第一中间图像和第二中间图像进行或运算,得到既包含完整大气泡又包含完整小气泡的预处理二值图,避免了将动态冰图像中的纹理识别为气泡、气泡边界识别不清晰、大量小气泡会被遗漏、提取到的大气泡中有孔洞等问题,使预处理二值图提取到的气泡效果更好,为提升分割粘连气泡的效果建立了基础。2. This application uses a preset neural network model to directly extract bubbles from the original image, extracts the first intermediate image containing complete large bubbles, then segments the original image, and uses the preset neural network model to extract the first intermediate image from the second segmented image block. Extract bubbles and obtain a second intermediate image containing complete small bubbles. OR the first intermediate image and the second intermediate image to obtain a preprocessed binary image containing both complete large bubbles and complete small bubbles, thus avoiding the need to combine dynamic The texture in the ice image is identified as bubbles, the bubble boundary identification is not clear, a large number of small bubbles will be missed, and there are holes in the extracted large bubbles. This makes the bubbles extracted from the preprocessed binary image better and improves segmentation. The effect of sticking bubbles establishes the basis.
因此,本申请提供的方案可以有效解决现有技术在从动态冰图像中提取粘连气泡时,存在的分割粘连气泡效果较差的问题。Therefore, the solution provided by this application can effectively solve the problem of poor segmentation of adhesion bubbles in the existing technology when extracting adhesion bubbles from dynamic ice images.
附图说明Description of the drawings
为了更清楚地说明本申请实施例中的技术方案,下面将对实施例描述中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图仅仅是本申请的一些实施例,对于本领域技术人员来讲,在不付出创造性劳动的前提下,还可以根据这些附图获得其他的附图。In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings needed to be used in the description of the embodiments will be briefly introduced below. Obviously, the drawings in the following description are only some embodiments of the present application. For those skilled in the art, other drawings can also be obtained based on these drawings without exerting creative efforts.
图1示出了本申请实施例1提供的从动态冰图像中提取粘连气泡的方法的流程示意图;Figure 1 shows a schematic flow chart of a method for extracting adhesion bubbles from dynamic ice images provided in Embodiment 1 of the present application;
图2示出了本申请实施例1提供的动态冰中的粘连气泡的显微图;Figure 2 shows a micrograph of adhering bubbles in dynamic ice provided in Example 1 of the present application;
图3示出了本申请实施例1提供的动态冰微观结构的原始图像;Figure 3 shows the original image of the dynamic ice microstructure provided in Example 1 of the present application;
图4示出了本申请实施例1提供的将预处理二值图进行距离变换并取反得到的距离图像;Figure 4 shows the distance image obtained by distance transforming and inverting the preprocessed binary image provided in Embodiment 1 of the present application;
图5示出了本申请实施例1提供的对距离图像进行直方图均衡化得到的调整图像;Figure 5 shows the adjusted image obtained by performing histogram equalization on the distance image provided in Embodiment 1 of the present application;
图6示出了本申请实施例1提供的在调整图像中对局部极小值所在的点进行标记得到的标记图像;Figure 6 shows a marked image obtained by marking the point where the local minimum value is located in the adjusted image provided in Embodiment 1 of the present application;
图7示出了本申请实施例1提供的不进行直方图均衡化得到的标记图像;Figure 7 shows a marked image obtained without histogram equalization provided in Embodiment 1 of the present application;
图8示出了本申请实施例1提供的使用直方图均衡化得到的粘连气泡的分割图像;Figure 8 shows a segmented image of adhesion bubbles obtained using histogram equalization provided in Embodiment 1 of the present application;
图9示出了本申请实施例1提供的不进行直方图均衡化得到的粘连气泡的分割图像;Figure 9 shows a segmented image of adhering bubbles obtained without histogram equalization provided in Embodiment 1 of the present application;
图10示出了本申请实施例2提供的从动态冰图像中提取粘连气泡的系统的框图;Figure 10 shows a block diagram of a system for extracting adhesion bubbles from dynamic ice images provided in Embodiment 2 of the present application;
图11示出了本申请实施例3提供的一种用于执行本申请实施例的从动态冰图像中提取粘连气泡的方法的电子设备的框图。Figure 11 shows a block diagram of an electronic device for executing the method of extracting adhesion bubbles from dynamic ice images according to the embodiment of the present application provided in Embodiment 3 of the present application.
具体实施方式Detailed ways
为了使本技术领域的人员更好地理解本申请方案,下面将结合本申请实施例中的附图,对本申请实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例仅仅是本申请一部分实施例,而不是全部的实施例。基于本申请中的实施例,本领域普通技术人员在没有作出创造性劳动前提下所获得的所有其他实施例,都属于本申请保护的范围。In order to enable those in the technical field to better understand the solutions of the present application, the technical solutions in the embodiments of the present application will be clearly and completely described below in conjunction with the accompanying drawings in the embodiments of the present application. Obviously, the described embodiments are only These are part of the embodiments of this application, but not all of them. Based on the embodiments in this application, all other embodiments obtained by those of ordinary skill in the art without creative efforts fall within the scope of protection of this application.
目前,可以使用基于标记控制的分水岭算法对粘连的气泡或颗粒进行分割,该种方法在气泡或颗粒大小一样时分割效果较好。但是,在动态冰中的粘连气泡大小相差较大时,难以对小气泡进行标记,因此难以将粘连的多个小气泡进行分割。并且,在动态冰中的粘连气泡附近存在面积大于粘连气泡的较大气泡时,难以对粘连气泡进行标记,因此难以对粘连气泡进行分割。Currently, the watershed algorithm based on mark control can be used to segment adhering bubbles or particles. This method has better segmentation results when the bubbles or particles are of the same size. However, when the sizes of adhering bubbles in dynamic ice vary greatly, it is difficult to mark the small bubbles, and therefore it is difficult to separate multiple adhering small bubbles. Furthermore, when there are large bubbles with an area larger than that of the adhesion bubbles in the vicinity of the adhesion bubbles in the dynamic ice, it is difficult to mark the adhesion bubbles and therefore it is difficult to divide the adhesion bubbles.
因此,为了解决上述缺陷,本申请实施例提供了从动态冰图像中提取粘连气泡的方法,该方法包括:根据预处理二值图中的气泡像素点到背景的最小距离,得到距离图像;对所述距离图像进行直方图均衡化,调整距离图像的距离矩阵中,每个气泡中心部分的数值,得到调整图像;从所述调整图像的图像矩阵中获取满足预设条件的数值,并在所述调整图像中对所述满足预设条件的数值所在的点进行标记,得到标记图像,该标记图像包括所有气泡的中心部分的标记点,根据所述标记图像中的标记点,对所述预处理二值图进行分水岭变换,得到粘连气泡的分割图像。如此,可以有效解决现有技术在从动态冰图像中提取粘连气泡时,存在的分割粘连气泡效果较差的问题。Therefore, in order to solve the above defects, embodiments of the present application provide a method for extracting adhesive bubbles from dynamic ice images. The method includes: obtaining a distance image based on the minimum distance from the bubble pixels in the preprocessed binary image to the background; The distance image is subjected to histogram equalization, and the value in the center part of each bubble is adjusted in the distance matrix of the distance image to obtain an adjusted image; the value that satisfies the preset conditions is obtained from the image matrix of the adjustment image, and is Mark the points where the values that meet the preset conditions are located in the adjustment image to obtain a marked image. The marked image includes the marked points of the central parts of all bubbles. According to the marked points in the marked image, the preset Process the binary image and perform watershed transformation to obtain the segmented image of adhering bubbles. In this way, the problem of poor segmentation effect of adhesion bubbles existing in the existing technology when extracting adhesion bubbles from dynamic ice images can be effectively solved.
下面对本申请所涉及到的从动态冰图像中提取粘连气泡的方法进行介绍。The method of extracting adhesion bubbles from dynamic ice images involved in this application is introduced below.
实施例1Example 1
请参照图1和图2,图1为本申请实施例1提供的一种从动态冰图像中提取粘连气泡的方法的流程示意图,图2为动态冰中的粘连气泡的显微示意图。本实施例中,该从动态冰图像中提取粘连气泡的方法可以包括以下步骤:Please refer to Figures 1 and 2. Figure 1 is a schematic flow chart of a method for extracting adhesion bubbles from dynamic ice images provided in Embodiment 1 of the present application. Figure 2 is a microscopic schematic diagram of adhesion bubbles in dynamic ice. In this embodiment, the method for extracting adhesion bubbles from dynamic ice images may include the following steps:
步骤S110:根据预处理二值图中的气泡像素点到背景的最小距离,得到距离图像。Step S110: Obtain a distance image based on the minimum distance from the bubble pixels in the preprocessed binary image to the background.
如图3所示,图3为动态冰微观结构的原始图像。对该原始图像进行预处理,可以得到预处理二值图。As shown in Figure 3, Figure 3 is an original image of the dynamic ice microstructure. By preprocessing the original image, the preprocessed binary image can be obtained.
在图3中,上面方框中示出了动态冰中的粘连气泡大小相差较大的情形,具体地,三个大小不同的气泡粘连在一起,这三个粘连气泡中,最上面的气泡最大,中间的气泡第二大,最下面的气泡最小。In Figure 3, the upper box shows the situation where the sizes of adhesion bubbles in dynamic ice are quite different. Specifically, three bubbles of different sizes are adhering together. Among these three adhesion bubbles, the topmost bubble is the largest. , the bubble in the middle is the second largest, and the bubble at the bottom is the smallest.
在图3中,下面方框中示出了动态冰中的粘连气泡附近存在较大气泡的情形,具体地,三个气泡粘连在一起,且附近存在的较大气泡的直径大于该三个粘连气泡中的任意一个,在该种情况中,三个粘连气泡的大小可以相同,也可以不同,为了方便描述,图3示出的是三个粘连气泡大小相同的情形。In Figure 3, the lower box shows the situation where larger bubbles exist near the adhesion bubbles in dynamic ice. Specifically, three bubbles are adhered together, and the diameter of the larger bubbles existing nearby is larger than the three adhesion bubbles. Any one of the bubbles. In this case, the sizes of the three adhesion bubbles can be the same or different. For convenience of description, Figure 3 shows the situation where the three adhesion bubbles are the same size.
作为一种可选实施方式,所述步骤S110还包括子步骤S111。As an optional implementation, step S110 also includes sub-step S111.
子步骤S111:将所述预处理二值图进行距离变换,根据所述预处理二值图中的气泡像素点到背景的最小距离,得到所述距离图像。Sub-step S111: Perform distance transformation on the preprocessed binary image, and obtain the distance image based on the minimum distance from the bubble pixels in the preprocessed binary image to the background.
在示例性实施例中,所述距离变换可以为欧式距离变换,也可以为曼哈顿距离变换,还可以为其他距离变换方式。In an exemplary embodiment, the distance transformation may be a Euclidean distance transformation, a Manhattan distance transformation, or other distance transformation methods.
其中,预处理二值图中的气泡越大,该气泡中心部分像素点到背景的最小距离越大,在距离图像的距离矩阵中,该气泡中心部分的数值越大,在距离图像中该气泡的中心亮度越高。Among them, the larger the bubble in the preprocessed binary image is, the greater the minimum distance between the pixels in the center of the bubble and the background is. In the distance matrix of the distance image, the value of the center part of the bubble is larger. In the distance image, the value of the bubble is larger. The center brightness is higher.
作为另一种可选实施方式,所述步骤S110还包括子步骤S112。As another optional implementation, step S110 also includes sub-step S112.
子步骤S112:将所述预处理二值图进行距离变换并取反,根据所述预处理二值图中的气泡像素点到背景的最小距离的相反数,得到所述距离图像。Sub-step S112: Perform distance transformation and inversion on the preprocessed binary image, and obtain the distance image based on the inverse of the minimum distance between the bubble pixels in the preprocessed binary image and the background.
其中,预处理二值图中的气泡越大,该气泡中心部分像素点到背景的最小距离的相反数越小,距离图像的距离矩阵中,该气泡中心部分的数值越小,在距离图像中该气泡的中心亮度越低。如图4所示,图4为将预处理二值图进行距离变换并取反得到的距离图像。Among them, the larger the bubble in the preprocessed binary image is, the smaller the inverse number of the minimum distance from the pixel in the center of the bubble to the background is. In the distance matrix of the distance image, the smaller the value in the center of the bubble is. In the distance image The center of the bubble is less bright. As shown in Figure 4, Figure 4 is a distance image obtained by distance transforming and inverting the preprocessed binary image.
从图4可以看出,上面方框的三个粘连气泡中,最上面的气泡的中心部分的亮度最低,中间的气泡的中心部分的亮度第二低,最下面的气泡的中心部分的亮度最高,也就是,在距离图像的距离矩阵中,最上面的气泡的中心部分的数值最小,中间的气泡的中心部分的数值第二小,最下面的气泡的中心部分的数值最大。As can be seen from Figure 4, among the three adhesion bubbles in the upper box, the brightness of the center part of the uppermost bubble is the lowest, the brightness of the center part of the middle bubble is the second lowest, and the brightness of the center part of the bottom bubble is the highest. , that is, in the distance matrix of the distance image, the value of the center part of the uppermost bubble is the smallest, the value of the center part of the middle bubble is the second smallest, and the value of the center part of the bottom bubble is the largest.
从图4可以看出,下面方框的三个粘连气泡和附近存在的较大气泡中,三个粘连的气泡的中心部分的亮度一样高,且都高于附近存在的较大气泡的中心部分的亮度,也就是,在距离图像的距离矩阵中,三个粘连气泡的中心部分的数值一样大,且都高于附近存在的较大气泡的中心部分的数值。As can be seen from Figure 4, among the three adhering bubbles in the box below and the larger bubbles nearby, the brightness of the center parts of the three adhering bubbles is equally high, and both are higher than the center parts of the larger bubbles nearby. The brightness of , that is, in the distance matrix of the distance image, the values of the central parts of the three adhesion bubbles are equally large, and are all higher than the values of the central parts of the larger bubbles that exist nearby.
在本申请实施例中,取反也可以是在步骤S120之后。In the embodiment of the present application, the negation may also be performed after step S120.
步骤S120:对所述距离图像进行直方图均衡化,得到调整图像。Step S120: Perform histogram equalization on the distance image to obtain an adjusted image.
以将预处理二值图进行距离变换并取反得到距离图像为例进行说明,对需要该种情况下的距离图像进行直方图均衡化,使距离图像中大气泡的中心亮度变高,小气泡的中心亮度变低,也就是使距离矩阵中大气泡中心部分的数值变大,小气泡中心部分的数值变小,从而得到调整图像。如图5所示,图5为对距离图像进行直方图均衡化得到的调整图像。Taking the distance transformation and inversion of the preprocessed binary image to obtain a distance image as an example, perform histogram equalization on the distance image in this case, so that the center brightness of the large bubbles in the distance image becomes higher, and the center brightness of the small bubbles becomes higher. The brightness of the center becomes lower, that is, the value of the center part of the large bubble in the distance matrix becomes larger, and the value of the center part of the small bubble becomes smaller, thereby obtaining the adjusted image. As shown in Figure 5, Figure 5 is an adjusted image obtained by performing histogram equalization on the distance image.
从图5可以看出,上面方框的三个粘连气泡中,三个粘连气泡的中心部分的亮度一样高,也就是,在调整图像的图像矩阵中,三个粘连气泡的中心部分的数值一样大。As can be seen from Figure 5, among the three adhesion bubbles in the box above, the brightness of the center parts of the three adhesion bubbles is the same. That is, in the image matrix of the adjusted image, the values of the center parts of the three adhesion bubbles are the same. big.
从图5可以看出,下面方框的三个粘连气泡和附近存在的较大气泡中,三个粘连的气泡的中心部分的亮度和附近存在的较大气泡的中心部分的亮度一样高,也就是,在调整图像的图像矩阵中,三个粘连的气泡的中心部分的数值和附近存在的较大气泡的中心部分的数值一样大。As can be seen from Figure 5, among the three adhering bubbles in the box below and the larger bubbles nearby, the brightness of the center parts of the three adhering bubbles is as high as the brightness of the center parts of the larger bubbles nearby. That is, in the image matrix of the adjusted image, the value of the center part of the three stuck bubbles is the same as the value of the center part of the larger bubble existing nearby.
步骤S130:从所述调整图像的图像矩阵中获取满足预设条件的数值,并在所述调整图像中对所述满足预设条件的数值所在的点进行标记,得到标记图像。Step S130: Obtain the values that satisfy the preset conditions from the image matrix of the adjustment image, and mark the points where the values that meet the preset conditions are located in the adjustment image to obtain a marked image.
作为一种可选实施方式,若所述步骤S110包括子步骤S111,所述预设条件为局部极大值,则所述步骤S130包括子步骤S131。As an optional implementation manner, if step S110 includes sub-step S111 and the preset condition is a local maximum, then step S130 includes sub-step S131.
子步骤S131:从所述调整图像的图像矩阵中获取所述局部极大值,并在所述调整图像中对所述局部极大值所在的点进行标记,得到所述标记图像。Sub-step S131: Obtain the local maximum value from the image matrix of the adjustment image, and mark the point where the local maximum value is located in the adjustment image to obtain the marked image.
局部极大值可以是:在调整图像的图像矩阵中,在局部区域内的数值的最大值。其中,局部区域可以是刚好能覆盖该调整图像中的最大气泡的区域,如图5所示的方框,也可以是比刚好能覆盖该调整图像中的最大气泡的区域稍大一些的区域,本申请对此不做限制。The local maximum value can be: the maximum value of the value in the local area in the image matrix of the adjusted image. The local area can be an area that just covers the largest bubble in the adjusted image, such as the box shown in Figure 5, or it can be a slightly larger area than the area that just covers the largest bubble in the adjusted image. This application does not limit this.
将局部区域在调整图像的图像矩阵进行迭代计算,并获取每一次迭代计算时的局部极大值。Iteratively calculate the image matrix of the local area in the adjusted image, and obtain the local maximum value in each iterative calculation.
在对距离图像进行直方图均衡化得到调整图像之后,调整图像的局部区域内的气泡的中心部分的亮度一致,调整图像的图像矩阵的局部区域内的气泡的中心部分的数值一致,因此,每个气泡的中心部分的数值都是局部区域内的最大值,每个气泡的中心部分所在的点均可以被标记。After performing histogram equalization on the distance image to obtain the adjusted image, the brightness of the central part of the bubble in the local area of the adjusted image is consistent, and the value of the central part of the bubble in the local area of the image matrix of the adjusted image is consistent. Therefore, each The values in the center of each bubble are the maximum values in the local area, and the point where the center of each bubble is located can be marked.
若不进行直方图均衡化,直接从将预处理二值图进行距离变换得到的距离图像的距离矩阵中获取局部极大值,并在该距离图像中对局部极大值所在的点进行标记,由于距离图像的局部区域内的气泡的中心部分的亮度不一致,距离图像的距离矩阵的局部区域内的气泡的中心部分的数值也不一致,因此,只有中心部分的数值最大的气泡可以被标记出,中心部分的数值不是最大的气泡会被遗漏。If histogram equalization is not performed, the local maximum value is obtained directly from the distance matrix of the distance image obtained by distance transforming the preprocessed binary image, and the point where the local maximum value is located is marked in the distance image. Since the brightness of the central part of the bubble in the local area of the distance image is inconsistent, the value of the central part of the bubble in the local area of the distance matrix of the distance image is also inconsistent. Therefore, only the bubble with the largest value in the central part can be marked. Bubbles whose central value is not the largest will be missed.
作为另一种可选实施方式,若所述步骤S110包括子步骤S112,所述预设条件为局部极小值,则所述步骤S130包括子步骤S132。As another optional implementation, if step S110 includes sub-step S112 and the preset condition is a local minimum, then step S130 includes sub-step S132.
子步骤S132:从所述调整图像的图像矩阵中获取所述局部极小值,并在所述调整图像中对所述局部极小值所在的点进行标记,得到所述标记图像。Sub-step S132: Obtain the local minimum value from the image matrix of the adjustment image, and mark the point where the local minimum value is located in the adjustment image to obtain the marked image.
局部极小值可以是:在调整图像的图像矩阵中,在局部区域内的数值的最小值。其中,局部区域以及获取局部极小值的内容可以参照子步骤S131中的局部区域以及获取局部极大值的内容,本申请在此不再赘述。The local minimum can be: the minimum value of the value in the local area in the image matrix of the adjusted image. For the local area and the content of obtaining the local minimum value, please refer to the local area and the content of obtaining the local maximum value in sub-step S131, which will not be described again in this application.
在对距离图像进行直方图均衡化得到调整图像之后,调整图像的局部区域内的气泡的中心部分的亮度一致,调整图像的图像矩阵的局部区域内的气泡的中心部分的数值一致,因此,每个气泡的中心部分的数值都是局部区域内的最小值,每个气泡的中心部分所在的点均可以被标记。After performing histogram equalization on the distance image to obtain the adjusted image, the brightness of the central part of the bubble in the local area of the adjusted image is consistent, and the value of the central part of the bubble in the local area of the image matrix of the adjusted image is consistent. Therefore, each The values in the center of each bubble are the minimum values in the local area, and the point where the center of each bubble is located can be marked.
如图6所示,图6为使用本申请的方法得到的标记图像。As shown in Figure 6, Figure 6 is a marked image obtained using the method of the present application.
从图6可以看出,上面方框的三个粘连气泡中,三个粘连气泡的中心部分所在的点均被标记出。As can be seen from Figure 6, among the three adhesion bubbles in the upper box, the points where the central parts of the three adhesion bubbles are are marked.
从图6可以看出,下面方框的三个粘连气泡和附近存在的较大气泡中,三个粘连的气泡的中心部分所在的点,和附近存在的较大气泡的中心部分所在的点均被标记出。It can be seen from Figure 6 that among the three adhering bubbles in the box below and the larger bubbles nearby, the points where the center parts of the three adhering bubbles are located and the points where the center parts of the larger bubbles are nearby are both. is marked out.
若不进行直方图均衡化,直接从如图4所示的距离图像的距离矩阵中获取局部极小值,并在该距离图像中对局部极小值所在的点进行标记,由于距离图像的局部区域内的气泡的中心部分的亮度不一致,距离图像的距离矩阵的局部区域内的气泡的中心部分的数值也不一致,因此,只有中心部分的数值最小的气泡可以被标记出,中心部分的数值不是最小的气泡会被遗漏。若不进行直方图均衡化,得到的标记图像如图7所示。If histogram equalization is not performed, the local minimum value is obtained directly from the distance matrix of the distance image as shown in Figure 4, and the point where the local minimum value is located is marked in the distance image. The brightness of the central part of the bubble in the area is inconsistent, and the value of the central part of the bubble in the local area of the distance matrix of the distance image is also inconsistent. Therefore, only the bubble with the smallest value in the central part can be marked, and the value in the central part is not The smallest air bubble will be missed. If histogram equalization is not performed, the resulting labeled image is shown in Figure 7.
从从图7可以看出,上面方框的三个粘连气泡中,只有最上面的最大的气泡的中心部分所在的点被标记出,中间的第二大的气泡和最下面的最小的气泡的中心部分所在的点均被遗漏。As can be seen from Figure 7, among the three adhesion bubbles in the upper box, only the central point of the largest bubble at the top is marked, the second largest bubble in the middle and the smallest bubble at the bottom are marked. The points where the central part is located are all missed.
从图7可以看出,下面方框的三个粘连气泡和附近存在的较大气泡中,只有附近存在的较大气泡的中心部分所在的点被标记出,三个粘连的气泡的中心部分所在的点均被遗漏。As can be seen from Figure 7, among the three adhering bubbles in the box below and the larger bubbles nearby, only the point where the center part of the larger bubble exists nearby is marked, and the center part of the three adhering bubbles is points are missed.
步骤S140:根据所述标记图像中的标记点,对所述预处理二值图进行分水岭变换,得到粘连气泡的分割图像。Step S140: Perform watershed transformation on the preprocessed binary image according to the marker points in the marker image to obtain a segmented image of adhesion bubbles.
作为一种可选实施方式,若所述步骤S110包括子步骤S111,则所述步骤S140包括子步骤S141。As an optional implementation manner, if step S110 includes sub-step S111, then step S140 includes sub-step S141.
子步骤S141:根据所述标记图像中的标记点,对所述预处理二值图进行分水岭变换,得到基于标记点的分水岭分割线,将所述分水岭分割线与预处理二值图进行或运算,得到粘连气泡的分割图像。Sub-step S141: Perform watershed transformation on the preprocessed binary image according to the marked points in the marked image to obtain a watershed dividing line based on the marked points, and perform an OR operation on the watershed dividing line and the preprocessed binary image. , obtain the segmented image of adhesion bubbles.
在本申请实施例中,由于每个气泡的中心部分所在的点均被标记出,根据每个气泡的标记点,对预处理二值图进行分水岭变换,可以得到每个气泡的分水岭分割线,将每个气泡的分水岭分割线与预处理二值图进行或运算,从而将粘连气泡进行分割。In the embodiment of this application, since the point where the central part of each bubble is located is marked, the watershed dividing line of each bubble can be obtained by performing watershed transformation on the preprocessed binary image according to the marked point of each bubble. The watershed dividing line of each bubble is ORed with the preprocessed binary map to segment the adhesive bubbles.
作为另一种可选实施方式,若所述步骤S110包括子步骤S112,则所述步骤S140包括子步骤S142。As another optional implementation manner, if step S110 includes sub-step S112, then step S140 includes sub-step S142.
子步骤S142:根据所述标记图像中的标记点,对所述预处理二值图进行分水岭变换,得到基于标记点的分水岭分割线,将所述分水岭分割线取反,并与预处理二值图进行或运算,得到粘连气泡的分割图像。Sub-step S142: Perform watershed transformation on the preprocessed binary image according to the marked points in the marked image to obtain a watershed dividing line based on the marked points, invert the watershed dividing line and combine it with the preprocessed binary image. Perform an OR operation on the graph to obtain the segmented image of the adhesion bubbles.
在本申请实施例中,由于每个气泡的中心部分所在的点均被标记出,根据每个气泡的标记点,对预处理二值图进行分水岭变换,可以得到每个气泡的分水岭分割线,将每个气泡的分水岭分割线取反,再与预处理二值图进行或运算,从而将粘连气泡进行分割。In the embodiment of this application, since the point where the central part of each bubble is located is marked, the watershed dividing line of each bubble can be obtained by performing watershed transformation on the preprocessed binary image according to the marked point of each bubble. The watershed dividing line of each bubble is inverted, and then ORed with the preprocessed binary map to segment the adhering bubbles.
如图8所示,图8为使用本申请的方法得到的粘连气泡的分割图像。As shown in Figure 8, Figure 8 is a segmented image of adhesion bubbles obtained using the method of the present application.
从图8可以看出,上面方框的三个粘连气泡中,三个粘连气泡均被分割。As can be seen from Figure 8, among the three adhesion bubbles in the upper box, all three adhesion bubbles are divided.
从图8可以看出,下面方框的三个粘连气泡中,三个粘连气泡均被分割。As can be seen from Figure 8, among the three adhesion bubbles in the box below, all three adhesion bubbles are divided.
若不进行直方图均衡化,得到的粘连气泡的分割图像如图9所示。If histogram equalization is not performed, the segmented image of the stuck bubbles obtained is shown in Figure 9.
从图9可以看出,上面方框的三个粘连气泡中,由于只有最上面的气泡的中心部分所在的点被标记出,中间的气泡和最下面的气泡的中心部分所在的点均未被标记出,因此只有最上面的气泡被分割,中间的气泡和最下面的气泡没有被分割,依然粘连在一起。As can be seen from Figure 9, among the three adhesion bubbles in the upper box, since only the point where the center part of the uppermost bubble is located is marked, the points where the center part of the middle bubble and the bottom bubble are are not marked. Marked so that only the top bubble is divided, the middle bubble and the bottom bubble are not divided and are still stuck together.
从图9可以看出,下面方框的三个粘连气泡中,由于三个粘连气泡的中心部分所在的点均未被标记出,因此三个粘连气泡均没有被分割,依然粘连在一起。As can be seen from Figure 9, among the three adhesion bubbles in the box below, since the points where the central parts of the three adhesion bubbles are are not marked, the three adhesion bubbles have not been divided and are still stuck together.
本申请通过对需要标记的距离图像进行直方图均衡化,避免了因气泡大小不同而导致局部区域内的气泡的中心部分的数值大小不同,而不将小气泡中心部分的数值识别为满足预设条件的数值,从而无法标记小气泡中心部分所在的点。使用本申请提供的从动态冰图像中提取粘连气泡的方法,在动态冰中的粘连气泡大小相差较大时,以及在动态冰中的粘连气泡附近存在面积大于粘连气泡的较大气泡时,都可以对粘连的小气泡的中心部分所在的点进行标记,从而使分割粘连气泡的效果更好。By performing histogram equalization on the distance image that needs to be marked, this application avoids the different numerical sizes of the central parts of the bubbles in the local area due to different bubble sizes, and does not identify the numerical values of the central parts of the small bubbles as satisfying the preset The value of the condition makes it impossible to mark the point where the center part of the small bubble is located. Using the method provided by this application to extract adhesion bubbles from dynamic ice images, when the adhesion bubbles in the dynamic ice have a large difference in size, and when there are larger bubbles near the adhesion bubbles in the dynamic ice that have an area larger than the adhesion bubbles, the method can be used to extract adhesion bubbles from dynamic ice images. The point where the center part of the small adhering bubbles is located can be marked, so that the effect of dividing the adhering bubbles is better.
在示例性实施例中,所述步骤S110之前,还包括步骤S101至步骤S104。In an exemplary embodiment, before step S110, steps S101 to S104 are also included.
步骤S101:通过预设神经网络模型从原始图像中提取气泡,得到第一中间图像。Step S101: Extract bubbles from the original image through a preset neural network model to obtain a first intermediate image.
在本申请实施例中,动态冰的原始图像可以是显微图像,也可以是手机摄像头拍摄动态冰得到的图像,原始图像可以是彩色图像,也可以是灰度图像。In the embodiment of the present application, the original image of the dynamic ice may be a microscopic image or an image obtained by photographing the dynamic ice with a mobile phone camera. The original image may be a color image or a grayscale image.
作为一种可选实施方式,若原始图像的尺寸等于预设尺寸,则通过预设神经网络模型从原始图像中提取气泡,得到第一中间图像。As an optional implementation, if the size of the original image is equal to the preset size, bubbles are extracted from the original image through the preset neural network model to obtain the first intermediate image.
作为另一种可选实施方式,若所述原始图像的尺寸不等于预设尺寸,则将所述原始图像的尺寸调整为所述预设尺寸,并通过所述预设神经网络模型从调整为所述预设尺寸的原始图像中提取气泡,得到第一提取图像,并将所述第一提取图像还原为所述原始图像的尺寸,得到所述第一中间图像。As another optional implementation, if the size of the original image is not equal to the preset size, the size of the original image is adjusted to the preset size, and the preset neural network model is used to adjust the size from Extract bubbles from the original image of the preset size to obtain a first extracted image, and restore the first extracted image to the size of the original image to obtain the first intermediate image.
其中,若原始图像的尺寸小于预设尺寸,则将原始图像的尺寸放大为预设尺寸,并通过预设神经网络模型从放大为所述预设尺寸的原始图像中提取气泡,得到第一提取图像,并将第一提取图像缩小为原始图像的尺寸,得到第一中间图像。Wherein, if the size of the original image is smaller than the preset size, the size of the original image is enlarged to the preset size, and bubbles are extracted from the original image enlarged to the preset size through a preset neural network model to obtain the first extraction image, and reduce the first extracted image to the size of the original image to obtain a first intermediate image.
若原始图像的尺寸大于预设尺寸,则将原始图像的尺寸缩小为预设尺寸,并通过预设神经网络模型从缩小为所述预设尺寸的原始图像中提取气泡,得到第一提取图像,并将第一提取图像放大为原始图像的尺寸,得到第一中间图像。If the size of the original image is larger than the preset size, reduce the size of the original image to the preset size, and extract bubbles from the original image reduced to the preset size through the preset neural network model to obtain the first extracted image, The first extracted image is enlarged to the size of the original image to obtain a first intermediate image.
作为又一种可选实施方式,若原始图像的尺寸小于预设尺寸,则通过预设神经网络模型从原始图像中提取气泡,得到第一中间图像。As another optional implementation, if the size of the original image is smaller than the preset size, bubbles are extracted from the original image through a preset neural network model to obtain the first intermediate image.
其中,预设尺寸可以是根据计算机资源限制而设定的尺寸,如256*256或者512*512。The default size may be a size set according to computer resource limitations, such as 256*256 or 512*512.
其中,放大或缩小原始图像的方式可以是插值的方式,将第一提取图像缩小为原始图像的尺寸或将第一提取图像放大为原始图像的尺寸的方式,也可以是插值的方式。The method of enlarging or reducing the original image may be an interpolation method, a method of reducing the first extracted image to the size of the original image or enlarging the first extracted image to the size of the original image, or an interpolation method.
通过在原始图像的尺寸不等于预设尺寸时,将原始图像调整为预设尺寸,避免由于计算机资源的限制而无法对原始图像进行图像识别,并将第一提取图像还原为原始图像的尺寸,避免由于尺寸调整而损失第一中间图像的精度。By adjusting the original image to the preset size when the size of the original image is not equal to the preset size, avoiding the inability to perform image recognition on the original image due to limitations of computer resources, and restoring the first extracted image to the size of the original image, Avoid loss of accuracy of the first intermediate image due to resizing.
在本申请实施例中,预设神经网络模型可以是加入注意力机制的U-net网络模型,也可以是R2U-net模型,还可以是其他神经网络模型,本申请对此不做限制。In the embodiment of this application, the preset neural network model may be a U-net network model with an attention mechanism added, or it may be an R2U-net model, or it may be other neural network models, which this application does not limit.
本申请通过预设的神经网络模型从动态冰图像中提取气泡,避免了将动态冰图像中的纹理识别为气泡,以及气泡边界识别不清晰等问题,为提取效果更好的气泡提供基础。This application extracts bubbles from dynamic ice images through a preset neural network model, avoiding problems such as identifying textures in dynamic ice images as bubbles and unclear bubble boundary identification, and provides a basis for extracting bubbles with better effects.
作为一种可选实施方式,若所述原始图像的形状不满足所述预设神经网络模型的输入形状,则将所述原始图像填充为所述预设神经网络模型的输入形状,再执行步骤S101。As an optional implementation, if the shape of the original image does not satisfy the input shape of the preset neural network model, fill the original image with the input shape of the preset neural network model, and then perform steps S101.
步骤S102:将所述原始图像分割成n个第二分割图像块,且n≥2,并通过所述预设神经网络模型分别从所述n个第二分割图像块中提取气泡,得到n个第二提取图像块。Step S102: Divide the original image into n second divided image blocks, and n≥2, and extract bubbles from the n second divided image blocks respectively through the preset neural network model to obtain n Secondly extract image blocks.
本申请通过将动态冰图像分割成尺寸较小的第二分割图像块,并用预设神经网络模型分别从每个第二分割图像块中提取气泡,避免原始图像尺寸太大而气泡太小时遗漏小气泡,使提取到的气泡效果更好。This application divides the dynamic ice image into second segmented image blocks with smaller sizes, and uses a preset neural network model to extract bubbles from each second segmented image block respectively to avoid missing small ones when the original image size is too large and the bubbles are too small. Bubbles make the extracted bubbles better.
步骤S103:将所述n个第二提取图像块按照分割位置排列顺序拼接成第二中间图像,所述分割位置排列顺序为将所述原始图像分割成所述n个第二分割图像块时,每个第二分割图像块在所述原始图像中的位置的排列顺序。Step S103: Splice the n second extracted image blocks into a second intermediate image according to the order of division positions. When the original image is divided into the n second divided image blocks, The arrangement order of the position of each second segmented image block in the original image.
在本申请实施例中,可以先执行获取第一中间图像的步骤,再执行获取第二中间图像的步骤,也可以先执行获取第二中间图像的步骤,再执行获取第一中间图像的步骤,还可以同时执行获取第一中间图像的步骤和获取第二中间图像的步骤。In the embodiment of the present application, the step of obtaining the first intermediate image may be performed first, and then the step of obtaining the second intermediate image may be performed, or the step of obtaining the second intermediate image may be performed first, and then the step of obtaining the first intermediate image may be performed. The steps of acquiring the first intermediate image and the steps of acquiring the second intermediate image may also be performed simultaneously.
步骤S104:将所述第一中间图像和所述第二中间图像进行或运算,得到预处理二值图。Step S104: Perform an OR operation on the first intermediate image and the second intermediate image to obtain a preprocessed binary image.
具体地,第一中间图像中的小气泡被遗漏,第二中间图像中的大气泡有孔洞,将第一中间图像和第二中间图像进行或运算,补上被遗漏的小气泡和大气泡中的孔洞,得到预处理二值图,且该预处理二值图中包含完整的小气泡和完整的大气泡。Specifically, the small bubbles in the first intermediate image are missing, and the large bubbles in the second intermediate image have holes. The first intermediate image and the second intermediate image are ORed to fill in the missing small bubbles and large bubbles. holes, a preprocessed binary image is obtained, and the preprocessed binary image contains complete small bubbles and complete large bubbles.
作为一种可选实施方式,将步骤S104得到的预处理二值图进行开运算,得到消除噪点后的预处理二值图。As an optional implementation manner, perform an opening operation on the preprocessed binary image obtained in step S104 to obtain a preprocessed binary image after eliminating noise.
本申请通过预设神经网络模型直接从原始图像中提取气泡,提取到包含完整大气泡的第一中间图像,再将原始图像进行分割,通过预设神经网络模型从第二分割图像块中提取气泡,得到包含完整小气泡的第二中间图像,将第一中间图像和第二中间图像进行或运算,得到既包含完整大气泡又包含完整小气泡的预处理二值图,使预处理二值图提取到的气泡效果更好,为提升分割粘连气泡的效果建立了基础。This application directly extracts bubbles from the original image through a preset neural network model, extracts the first intermediate image containing complete large bubbles, then segments the original image, and extracts bubbles from the second segmented image block through the preset neural network model. , obtain the second intermediate image containing complete small bubbles, perform an OR operation on the first intermediate image and the second intermediate image, and obtain a preprocessed binary image containing both complete large bubbles and complete small bubbles, so that the preprocessed binary image The extracted bubbles are better, which lays the foundation for improving the effect of segmenting stuck bubbles.
实施例2Example 2
请参照图10,图10为本申请实施例2提供的一种从动态冰图像中提取粘连气泡的系统1000的结构框图。该系统可以包括:距离获取单元1010、调整单元1020、标记单元1030、分水岭变换单元1040。Please refer to FIG. 10 , which is a structural block diagram of a system 1000 for extracting adhesion bubbles from dynamic ice images provided in Embodiment 2 of the present application. The system may include: a distance acquisition unit 1010, an adjustment unit 1020, a marking unit 1030, and a watershed transformation unit 1040.
距离获取单元1010,用于根据预处理二值图中的气泡像素点到背景的最小距离,得到距离图像。The distance acquisition unit 1010 is used to obtain a distance image based on the minimum distance from the bubble pixels in the preprocessed binary image to the background.
调整单元1020,用于对所述距离图像进行直方图均衡化,得到调整图像。The adjustment unit 1020 is used to perform histogram equalization on the distance image to obtain an adjusted image.
标记单元1030,用于从所述调整图像的图像矩阵中获取满足预设条件的数值,并在所述调整图像中对所述满足预设条件的数值所在的点进行标记,得到标记图像。The marking unit 1030 is configured to obtain a value that satisfies a preset condition from the image matrix of the adjusted image, and mark the point in the adjusted image where the value that satisfies the preset condition is located, to obtain a marked image.
分水岭变换单元1040,用于根据所述标记图像中的标记点,对所述标记图像进行分水岭变换,得到粘连气泡的分割图像。The watershed transformation unit 1040 is configured to perform watershed transformation on the marked image according to the marked points in the marked image to obtain segmented images of adhering bubbles.
作为一种可选实施方式,所述距离获取单元1010包括第一距离获取子单元,用于将所述预处理二值图进行距离变换,根据所述预处理二值图中的气泡像素点到背景的最小距离,得到所述距离图像。As an optional implementation manner, the distance acquisition unit 1010 includes a first distance acquisition subunit, which is used to perform distance transformation on the preprocessed binary image. According to the bubble pixel points in the preprocessed binary image, Minimum distance from the background to obtain the distance image.
所述标记单元1030包括第一标记子单元,用于从所述调整图像的图像矩阵中获取局部极大值,并在所述调整图像中对所述局部极大值所在的点进行标记,得到所述标记图像。The marking unit 1030 includes a first marking subunit, which is used to obtain the local maximum value from the image matrix of the adjustment image, and mark the point where the local maximum value is located in the adjustment image, to obtain The labeled image.
所述分水岭变换单元1040包括第一分水岭变换子单元,用于根据所述标记图像中的标记点,对所述预处理二值图进行分水岭变换,得到基于标记点的分水岭分割线,将所述分水岭分割线与预处理二值图进行或运算,得到粘连气泡的分割图像。The watershed transformation unit 1040 includes a first watershed transformation subunit, which is used to perform watershed transformation on the preprocessed binary image according to the marker points in the marker image to obtain a watershed dividing line based on the marker points, and convert the The watershed dividing line is ORed with the preprocessed binary image to obtain the segmented image of the adhesion bubbles.
作为另一种可选实施方式,所述距离获取单元1010还包括第二距离获取子单元,用于将所述预处理二值图进行距离变换并取反,根据所述预处理二值图中的气泡像素点到背景的最小距离的相反数,得到所述距离图像。As another optional implementation, the distance acquisition unit 1010 also includes a second distance acquisition subunit, which is used to distance transform and invert the preprocessed binary image. According to the preprocessed binary image, The distance image is obtained by taking the opposite number of the minimum distance from the bubble pixel to the background.
所述标记单元1030还包括第二标记子单元,用于从所述调整图像的图像矩阵中获取局部极小值,并在所述调整图像中对所述局部极小值所在的点进行标记,得到所述标记图像。The marking unit 1030 also includes a second marking subunit, used to obtain the local minimum value from the image matrix of the adjustment image, and mark the point where the local minimum value is located in the adjustment image, Obtain the labeled image.
所述分水岭变换单元1040包括第二分水岭变换子单元,用于根据所述标记图像中的标记点,对所述预处理二值图进行分水岭变换,得到基于标记点的分水岭分割线,将所述分水岭分割线取反,并与预处理二值图进行或运算,得到粘连气泡的分割图像。The watershed transformation unit 1040 includes a second watershed transformation subunit, which is used to perform watershed transformation on the preprocessed binary image according to the marker points in the marker image to obtain a watershed dividing line based on the marker points, and convert the The watershed dividing line is inverted and ORed with the preprocessed binary image to obtain the segmented image of the adhesion bubbles.
所属领域的技术人员可以清楚地了解到,为描述的方便和简洁,上述描述系统和单元的具体工作过程,可以参考前述方法实施例中的对应过程,在此不再赘述。Those skilled in the art can clearly understand that for the convenience and simplicity of description, the specific working processes of the above-described systems and units can be referred to the corresponding processes in the foregoing method embodiments, and will not be described again here.
另外,在本申请各个实施例中的各功能模块可以集成在一个处理模块中,也可以是各个模块单独物理存在,也可以两个或两个以上模块集成在一个模块中。上述集成的模块既可以采用硬件的形式实现,也可以采用软件功能模块的形式实现。In addition, each functional module in each embodiment of the present application can be integrated into one processing module, or each module can exist physically alone, or two or more modules can be integrated into one module. The above integrated modules can be implemented in the form of hardware or software function modules.
实施例3Example 3
请参照图11,图11为本申请实施例3提供的一种电子设备1100的结构框图。本申请中的电子设备1100可以包括一个或多个如下部件:存储器1110、处理器1120、屏幕1130以及一个或多个应用程序,其中一个或多个应用程序可以被存储在存储器1110中并被配置为由一个或多个处理器1120执行,一个或多个程序配置用于执行如前述方法实施例所描述的方法。Please refer to FIG. 11 , which is a structural block diagram of an electronic device 1100 provided in Embodiment 3 of the present application. The electronic device 1100 in this application may include one or more of the following components: a memory 1110, a processor 1120, a screen 1130, and one or more application programs, where one or more application programs may be stored in the memory 1110 and configured. For execution by one or more processors 1120, one or more programs are configured to perform the method as described in the preceding method embodiments.
存储器1110可以包括随机存储器(Random Access Memory,RAM),也可以包括只读存储器(Read-Only Memory,ROM)。存储器1110可用于存储指令、程序、代码、代码集或指令集。存储器1110可包括存储程序区和存储数据区,其中,存储程序区可存储用于实现操作系统的指令、用于实现至少一个功能的指令(比如直方图均衡化功能等)、用于实现下述各个方法实施例的指令等。存储数据区还可以存储电子设备1100在使用中所创建的数据(比如图像矩阵数据等)。The memory 1110 may include Random Access Memory (RAM) or Read-Only Memory (ROM). Memory 1110 may be used to store instructions, programs, codes, sets of codes, or sets of instructions. The memory 1110 may include a program storage area and a data storage area, where the program storage area may store instructions for implementing the operating system, instructions for implementing at least one function (such as a histogram equalization function, etc.), and instructions for implementing the following Instructions for various method embodiments, etc. The storage data area can also store data created during use of the electronic device 1100 (such as image matrix data, etc.).
处理器1120可以包括一个或者多个处理核。处理器1120利用各种接口和线路连接整个电子设备1100内的各个部分,通过运行或执行存储在存储器1110内的指令、程序、代码集或指令集,以及调用存储在存储器1110内的数据,执行电子设备1100的各种功能和处理数据。可选地,处理器1120可以采用数字信号处理(Digital Signal Processing,DSP)、现场可编程门阵列(Field-Programmable Gate Array,FPGA)、可编程逻辑阵列(Programmable Logic Array,PLA)中的至少一种硬件形式来实现。处理器1120可集成中央处理器(Central Processing Unit,CPU)和调制解调器等中的一种或几种的组合。其中,CPU主要处理操作系统和应用程序等;调制解调器用于处理无线通信。可以理解的是,上述调制解调器也可以不集成到处理器1120中,单独通过一块通信芯片进行实现。Processor 1120 may include one or more processing cores. The processor 1120 uses various interfaces and lines to connect various parts of the entire electronic device 1100, and executes by running or executing instructions, programs, code sets or instruction sets stored in the memory 1110, and calling data stored in the memory 1110. Various functions and processing data of the electronic device 1100. Optionally, the processor 1120 may adopt at least one of digital signal processing (Digital Signal Processing, DSP), field-programmable gate array (Field-Programmable Gate Array, FPGA), and programmable logic array (Programmable Logic Array, PLA). implemented in hardware form. The processor 1120 may integrate one or a combination of a central processing unit (CPU) and a modem. Among them, the CPU mainly handles operating systems and applications, etc.; the modem is used to handle wireless communications. It can be understood that the above modem may not be integrated into the processor 1120 and may be implemented solely through a communication chip.
最后应说明的是:以上实施例仅用以说明本申请的技术方案,而非对其限制;尽管参照前述实施例对本申请进行了详细的说明,本领域的普通技术人员当理解:其依然可以对前述各实施例所记载的技术方案进行修改,或者对其中部分技术特征进行等同替换;而这些修改或者替换,并不驱使相应技术方案的本质脱离本申请各实施例技术方案的精神和范围。Finally, it should be noted that the above embodiments are only used to illustrate the technical solution of the present application, but not to limit it; although the present application has been described in detail with reference to the foregoing embodiments, those of ordinary skill in the art will understand that: it can still Modifications are made to the technical solutions described in the foregoing embodiments, or equivalent substitutions are made to some of the technical features; however, these modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions in the embodiments of the present application.
Claims (5)
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202311101039.8A CN117011531A (en) | 2022-06-08 | 2022-06-08 | Method, device and equipment for extracting adhesion bubbles from dynamic ice image based on watershed segmentation |
Applications Claiming Priority (2)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202210638584.XA CN114821071B (en) | 2022-06-08 | 2022-06-08 | A method, device and equipment for extracting adhesion bubbles from dynamic ice images |
CN202311101039.8A CN117011531A (en) | 2022-06-08 | 2022-06-08 | Method, device and equipment for extracting adhesion bubbles from dynamic ice image based on watershed segmentation |
Related Parent Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202210638584.XA Division CN114821071B (en) | 2022-06-08 | 2022-06-08 | A method, device and equipment for extracting adhesion bubbles from dynamic ice images |
Publications (1)
Publication Number | Publication Date |
---|---|
CN117011531A true CN117011531A (en) | 2023-11-07 |
Family
ID=82521913
Family Applications (2)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202210638584.XA Active CN114821071B (en) | 2022-06-08 | 2022-06-08 | A method, device and equipment for extracting adhesion bubbles from dynamic ice images |
CN202311101039.8A Pending CN117011531A (en) | 2022-06-08 | 2022-06-08 | Method, device and equipment for extracting adhesion bubbles from dynamic ice image based on watershed segmentation |
Family Applications Before (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202210638584.XA Active CN114821071B (en) | 2022-06-08 | 2022-06-08 | A method, device and equipment for extracting adhesion bubbles from dynamic ice images |
Country Status (1)
Country | Link |
---|---|
CN (2) | CN114821071B (en) |
Family Cites Families (7)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
TWI496112B (en) * | 2013-09-13 | 2015-08-11 | Univ Nat Cheng Kung | Cell image segmentation method and a nuclear-to-cytoplasmic ratio evaluation method using the same |
CN103679796B (en) * | 2013-11-27 | 2016-12-07 | 上海交通大学 | Bidimensional based on range conversion watershed algorithm transmission function body data identification method |
CN105160668B (en) * | 2015-08-26 | 2018-01-09 | 爱威科技股份有限公司 | Image partition method, system and cell image segmentation method, system |
CN106780504B (en) * | 2017-01-22 | 2019-11-01 | 中国农业大学 | It is a kind of based on distance keep level set beef image in carry on the back long flesh automatic division method |
CN108193661B (en) * | 2018-01-25 | 2019-08-20 | 四川大学 | A Method for Accurately Calculating the Weight of Soil Strips in the Slice Method of Slope Stability Analysis |
CN112365494B (en) * | 2020-11-30 | 2022-12-13 | 北京理工大学 | Ore material image segmentation method based on deep learning prediction edge |
CN114549545B (en) * | 2022-01-13 | 2025-01-28 | 南华大学 | Method, device and medium for adaptive segmentation of blast pile images based on rock shape |
-
2022
- 2022-06-08 CN CN202210638584.XA patent/CN114821071B/en active Active
- 2022-06-08 CN CN202311101039.8A patent/CN117011531A/en active Pending
Also Published As
Publication number | Publication date |
---|---|
CN114821071A (en) | 2022-07-29 |
CN114821071B (en) | 2023-09-22 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US11373305B2 (en) | Image processing method and device, computer apparatus, and storage medium | |
WO2020007118A1 (en) | Display screen peripheral circuit detection method and device, electronic equipment and storage medium | |
CN114240961B (en) | A U-Net++ cell segmentation network system, method, device and terminal | |
WO2021129466A1 (en) | Watermark detection method, device, terminal and storage medium | |
CN113361535B (en) | Image segmentation model training, image segmentation method and related device | |
CN111462098B (en) | Method, device, equipment and medium for detecting overlapping of shadow areas of objects to be detected | |
CN111062964A (en) | Image segmentation method and related device | |
CN113537037A (en) | Pavement disease identification method, system, electronic device and storage medium | |
CN110852327A (en) | Image processing method, device, electronic device and storage medium | |
CN114862642A (en) | Method for removing short video visible watermark and computer readable storage medium | |
CN111383191B (en) | Image processing method and device for vascular fracture repair | |
CN113505702A (en) | Pavement disease identification method and system based on double neural network optimization | |
CN110349161A (en) | Image partition method, device, electronic equipment and storage medium | |
CN115620081B (en) | Training method of target detection model and target detection method and device | |
CN116740355A (en) | Automatic driving image segmentation method, device, equipment and storage medium | |
CN109242854A (en) | A kind of image significance detection method based on FLIC super-pixel segmentation | |
CN114821071B (en) | A method, device and equipment for extracting adhesion bubbles from dynamic ice images | |
CN111462220B (en) | Method, device, equipment and medium for extracting shadow area of object to be detected | |
CN113032071B (en) | Page element positioning method, page testing method, device, equipment and medium | |
CN112949731A (en) | Target detection method, device, storage medium and equipment based on multi-expert model | |
CN116403245B (en) | A method and system for analyzing poultry breeding data | |
CN117557777A (en) | Sample image determining method and device, electronic equipment and storage medium | |
CN117011658A (en) | Image processing method, apparatus, device, storage medium, and computer program product | |
CN114494302B (en) | Image processing method, device, equipment and storage medium | |
CN114240935B (en) | Space-frequency domain feature fusion medical image feature identification method and device |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination |