Method and electronic device for flotation foam image segmentation, medium, and device
By combining clustering and watershed segmentation algorithms, the problem of bubble edge information loss in flotation foam image segmentation was solved, achieving high-precision foam image segmentation and improving the stability and effectiveness of the flotation process.
Patent Information
- Authority / Receiving Office
- WO · WO
- Patent Type
- Applications
- Current Assignee / Owner
- Filing Date
- 2025-03-11
- Publication Date
- 2026-04-16
AI Technical Summary
In existing technologies, bubble edge information is severely lost during flotation foam image segmentation, affecting flotation accuracy.
A combination of clustering and watershed segmentation algorithms is used to preprocess, cluster, reconstruct, and label flotation foam images, extract unknown regions, segment them, and obtain bubble contours.
It effectively removes noise, enhances edge information, improves the segmentation accuracy of flotation foam images, and ensures the stability and accuracy of the flotation process.
Smart Images

Figure CN2025081761_16042026_PF_FP_ABST
Abstract
Description
A method for segmenting flotation foam images, electronic equipment, media, and equipment. Cross-reference to related applications
[0001] This application claims priority to Chinese patent application No. 202411408957.X, filed on October 10, 2024, the entire contents of which are incorporated herein by reference. Technical Field
[0002] This disclosure relates to the field of foam image segmentation technology, and in particular to a method, electronic device, medium and apparatus for segmenting flotation foam images. Background Technology
[0003] Flotation is the most widely used separation method in mineral processing, characterized by strong nonlinearity and strong coupling. In industrial production, the stability of the flotation process is primarily determined by manually observing the froth state in the flotation cell, allowing for adjustments to ensure optimal flotation results. However, manual observation is highly arbitrary and uncertain, making it difficult to guarantee that the flotation process is in its optimal state, thus wasting already limited mineral resources. Therefore, image analysis is now widely used to analyze flotation froth images, which helps improve mineral utilization and stabilize the production process.
[0004] However, for flotation froth image processing, image segmentation is a crucial step in studying the image's characteristic parameters. Analysis of mineral flotation froth images collected from industrial sites reveals the following characteristics:
[0005] (1) "Full foreground, no background" means that the entire bubble image is almost entirely composed of bubbles.
[0006] (2) Uneven lighting results in local brightness differences in the image and obvious noise.
[0007] (3) Each bubble surface has a clear highlight near the center. The grayscale variation between bubbles is small. The grayscale variation in the middle of the bubble is large.
[0008] Given the complex characteristics of the images above, traditional image detection algorithms (such as edge detection algorithms) can only segment the bright spots in the middle of the bubbles, resulting in a significant loss of bubble edge information, which in turn affects the flotation accuracy. Summary of the Invention
[0009] To address the problems existing in the prior art, this disclosure provides a flotation foam image segmentation method, electronic device, medium, and apparatus to solve or partially solve the technical problem in the prior art where severe loss of bubble edge information occurs during flotation foam image segmentation, thereby affecting flotation accuracy.
[0010] A first aspect of this disclosure provides a flotation foam image segmentation method for use in an electronic device. The method includes: preprocessing an original flotation foam image to obtain a first flotation foam image; clustering the first flotation foam image using a clustering algorithm to obtain internal labeled regions, and processing the clustered first flotation foam image based on the internal labeled regions to obtain a second flotation foam image; reconstructing the second flotation foam image to obtain a grayscale reconstructed image; extracting unknown regions of the second flotation foam image based on the second flotation foam image and the grayscale reconstructed image; marking the second flotation foam image with octagonal connected components and unknown regions to obtain a target labeled image; and using the target labeled image as marker points for a watershed segmentation algorithm to segment the second flotation foam image to obtain the contours of each flotation foam, and adding the contours of each flotation foam to the original foam image to complete the segmentation of the original flotation foam image.
[0011] A second aspect of this disclosure provides an electronic device for segmenting flotation foam images. The electronic device includes: a preprocessing unit for preprocessing an original flotation foam image to obtain a first flotation foam image; a clustering unit for clustering the first flotation foam image based on a clustering algorithm to obtain internal labeled regions, and processing the clustered first flotation foam image based on the internal labeled regions to obtain a second flotation foam image; a reconstruction unit for reconstructing the second flotation foam image to obtain a grayscale reconstructed image; extracting unknown regions of the second flotation foam image based on the second flotation foam image and the grayscale reconstructed image; a labeling unit for labeling the second flotation foam image with octagonal connections and unknown regions to obtain a target label map; and a segmentation unit for segmenting the second flotation foam image using the target label map as label points in a watershed segmentation algorithm to obtain the contours of each flotation foam, adding the contour of each flotation foam to the original foam image to complete the segmentation of the original flotation foam image.
[0012] A third aspect of this disclosure provides a computer-readable storage medium having a computer program stored thereon. When executed by a processor, the computer program implements the steps of the method described in the first aspect.
[0013] A fourth aspect of this disclosure provides a computer device including a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, it implements the steps of the method described in the first aspect. Attached Figure Description
[0014] Various other advantages and benefits will become apparent to those skilled in the art upon reading the following detailed description of preferred embodiments. The accompanying drawings are for illustrative purposes only and are not intended to limit the scope of this disclosure. Furthermore, the same reference numerals denote the same parts throughout the drawings. In the drawings:
[0015] Figure 1 shows a schematic diagram of a flotation foam image segmentation system according to an embodiment of the present disclosure;
[0016] Figure 2 shows a schematic diagram of the original flotation foam image according to an embodiment of the present disclosure;
[0017] Figure 3 shows a schematic flowchart of a flotation foam image segmentation method according to an embodiment of the present disclosure;
[0018] Figure 4 shows a grayscale histogram of the original flotation foam image according to an embodiment of the present disclosure;
[0019] Figure 5 shows a grayscale histogram obtained after preprocessing the original flotation foam image by CHALE according to an embodiment of the present disclosure.
[0020] Figure 6 shows a schematic diagram of a first preprocessed image obtained after one preprocessing step according to an embodiment of the present disclosure;
[0021] Figure 7 shows a schematic diagram of a second preprocessed image obtained after preprocessing according to an embodiment of the present disclosure;
[0022] Figure 8 shows a schematic diagram of a first flotation foam image according to an embodiment of the present disclosure;
[0023] Figure 9 shows a schematic diagram of an image obtained by clustering a first flotation foam image according to an embodiment of the present disclosure;
[0024] Figure 10 shows a schematic diagram of an image segmented by a watershed algorithm according to an embodiment of the present disclosure;
[0025] Figure 11 shows a schematic diagram of the overall structure of a flotation foam image segmentation electronic device according to an embodiment of the present disclosure. Detailed Implementation
[0026] Exemplary embodiments of the present disclosure will now be described in more detail with reference to the accompanying drawings. While exemplary embodiments of the present disclosure are shown in the drawings, it should be understood that the present disclosure may be implemented in various forms and should not be limited to the embodiments set forth herein. Rather, these embodiments are provided so that this disclosure will be thorough and complete, and will fully convey the scope of the disclosure to those skilled in the art.
[0027] To better understand the technical solution of this application, the flotation foam image segmentation system is introduced here first. As shown in Figure 1, the system includes: an industrial camera 1, a foam flotation device 2, and electronic equipment 3.
[0028] An industrial camera 1 is mounted above the foam flotation device 2 to acquire raw flotation foam images and send them to an electronic device 3.
[0029] After receiving the original flotation foam image, electronic device 3 preprocesses the original flotation foam image to obtain a first flotation foam image; it then performs clustering processing on the first flotation foam image based on a clustering algorithm to obtain internal labeled regions, and processes the clustered first flotation foam image based on the internal labeled regions to obtain a second flotation foam image; it then reconstructs the second flotation foam image to obtain a grayscale reconstructed image; it extracts the unknown regions of the second flotation foam image based on the second flotation foam image and the grayscale reconstructed image; it performs octet labeling and unknown region labeling on the second flotation foam image to obtain a target label map; it uses the target label map as the label points of the watershed segmentation algorithm to segment the second flotation foam image to obtain the contours of each flotation foam, and adds the contours of each flotation foam to the original foam image to complete the segmentation of the original flotation foam image.
[0030] Since the ambient temperature during the flotation process is above 30℃, the industrial camera 1 must have a temperature resistance of at least 40℃ to ensure reliable operation at the flotation site. In addition, the industrial camera 1 has the following performance characteristics:
[0031] (1) Long transmission distance;
[0032] (2) Pixel height;
[0033] (3) High frame rate acquisition, and reasonable frame rate control can prevent jitter; and
[0034] (4) It has a secondary development interface. It enables data and image interaction with the analysis system.
[0035] In some embodiments, the industrial camera 1 should be perpendicular to the liquid surface to avoid uneven lighting affecting subsequent image analysis; a preset installation distance should be maintained between the industrial camera 1 and the liquid surface to prevent slurry vapor from causing lens fogging and affecting image analysis results. Furthermore, a light source with a stable emission frequency (not shown in Figure 1) is installed near the industrial camera 1 to reduce the impact of lighting changes on image grayscale. The raw flotation foam image acquired by the industrial camera 1 is shown in Figure 2.
[0036] In some embodiments, electronic device 3 may be a computer with an image analysis algorithm installed, or it may be a server with an image analysis algorithm; there is no limitation on this.
[0037] The specific method for segmenting the original flotation foam image by electronic device 3 can be found in the implementation method of the electronic device, so it will not be repeated here.
[0038] Based on the same inventive concept as the foregoing embodiments, this disclosure also provides a flotation foam image segmentation method, as shown in Figure 3, which mainly includes steps S310-S314.
[0039] In step S310, the original flotation foam image is preprocessed to obtain the first flotation foam image.
[0040] As shown in Figure 2, the original flotation foam image captured by the industrial camera has low contrast. To ensure a uniform distribution of pixel grayscale values, clear visibility of foam image edges, enhanced contrast between foam particles, and to remove image noise and reduce the impact of bright edges on subsequent internal marker extraction, this disclosure requires preprocessing the original flotation foam image to obtain a first flotation foam image. The process is as follows:
[0041] The original flotation foam image was preprocessed once (contrast enhancement) using the Contrast Limited Adaptive Histogram Equalization (CHALE) algorithm to obtain the first preprocessed image.
[0042] The preprocessed image is filtered using a pre-constructed cascaded filter to obtain a second preprocessed image; and
[0043] The second preprocessed image is subjected to erosion, dilation, and opening operations in sequence to obtain the first flotation foam image.
[0044] In some embodiments, the grayscale histogram of the original flotation foam image is shown in Figure 4. As can be seen from Figure 4, the grayscale value distribution of the pixels in the original flotation foam image is uneven. The grayscale histogram obtained after CHALE preprocessing the original flotation foam image is shown in Figure 5. As can be seen from Figure 5, the grayscale details of the flotation foam image are stretched after the first preprocessing. It achieves both the effect of global histogram equalization for a more harmonious grayscale distribution and the characteristic of local histogram equalization to adapt to differences in grayscale distribution in different parts of the image. The first preprocessed image obtained after the first preprocessing is shown in Figure 6.
[0045] The first preprocessed image contains a significant amount of noise. The noise primarily consists of Gaussian noise and salt-and-pepper noise, originating from sensor noise introduced by high temperature and uneven lighting, and the superposition of discrete pulse signals, respectively. Gaussian noise in the image is characterized by extremely small noise points and a Gaussian distribution; salt-and-pepper noise, on the other hand, has larger noise points and a scattered distribution. A single filter cannot meet the denoising requirements of the acquired image. Therefore, this disclosure utilizes a pre-constructed cascaded filter to filter the preprocessed image, obtaining a second preprocessed image.
[0046] For the first preprocessed image, wavelet filtering is first applied to remove Gaussian noise. Then, median filtering is used to remove salt-and-pepper noise. The noise size is 3 pixels × 3 pixels. The gray value of each pixel within the noise size is set to the median gray value of all pixels within the selected window size.
[0047] The cascaded filter can not only effectively eliminate noise in the second preprocessed image, but also completely preserve the bubble image shape information such as contours and bright spots.
[0048] In some embodiments, the second preprocessed image may be as shown in FIG7.
[0049] To reduce the impact of bright spots at the image edges on the subsequent extraction of internal markers, the second preprocessed image needs to be subjected to erosion, dilation, and opening operations in sequence to obtain the first flotation foam image.
[0050] In some embodiments, the corrosion formula (fΘb)(s,t)=min{f(s+x,t+y)-b(x,y)|(s+x),(t+y)∈D is used. f (x,y)∈D b The second preprocessed image is subjected to an erosion operation to obtain an eroded image.
[0051] Here, Θ is the erosion operator, which means sliding the structuring element b(x,y) across the image f(x,y) to find the minimum difference between the two at all positions, i.e., finding a local minimum within a local region of the image. s and t are used to represent the offset of the sliding window, which determines the relationship between the image and the structuring element at different positions, i.e., the position used to select sub-regions in the second preprocessed image.
[0052] Then use the expansion formula A dilation operation is performed on the eroded image to obtain a dilated image.
[0053] in, This is the dilation operator, which means sliding the structuring element b(x,y) across the image f(x,y) to find the maximum sum of the two values at all positions, i.e., finding a local maximum within a local region of the image. Df It is the domain of the image, representing the coordinates of all valid pixels in the image, D. b It is the domain of the structuring element b(x,y), representing the range of all valid pixel coordinates in the structuring element b(x,y).
[0054] In some embodiments, narrow, bright bands also appear at the boundaries between bubbles. The grayscale value changes around the boundaries differ from those around the bubble apex, generally exhibiting abrupt changes without a transition region. The generation of these bright bands severely affects subsequent marker extraction; therefore, this disclosure further requires performing an opening operation (erosion followed by dilation) on the aforementioned dilated image to finally obtain the first flotation bubble image. The first flotation bubble image is shown in Figure 8. Since the opening operation can remove two smaller points (relative to the structuring element) and the image's grayscale level remains unchanged, the first flotation bubble image obtained after the opening operation also has a relatively stable gradient.
[0055] In step S311, the first flotation foam image is clustered using a clustering algorithm to obtain internal labeled regions. The clustered first flotation foam image is then processed based on these internal labeled regions to obtain a second flotation foam image.
[0056] In one implementation, the first flotation foam image is clustered based on a clustering algorithm to obtain internal labeled regions, including:
[0057] In the current iteration, the membership degree of each pixel in the first flotation bubble image to the k-th class is determined. The initial membership degree matrix is updated according to the membership degree of each pixel to the k-th class to obtain the updated membership degree matrix. The new cluster center of each class is determined according to the updated membership matrix. If the difference between the new cluster center and the cluster center corresponding to the current iteration is less than or equal to a preset threshold, the iteration is stopped and the preset number of cluster centers is output.
[0058] The first flotation foam image is clustered into corresponding pixel regions based on the cluster centers; and
[0059] The region with the highest grayscale value in the pixel region is defined as the internal marker region.
[0060] In some embodiments, the number of clusters k = 3, meaning that 3 types of pixel regions need to be divided in the end. An iteration termination threshold ε > 0 is set; convergence conditions are also set.
[0061] Then, based on the number of clusters, three initial cluster centers are randomly selected from the first flotation bubble image. The membership matrix is initialized to obtain the initialized membership matrix.
[0062] In each iteration, the membership degree of each pixel in the first flotation bubble image to k classes is determined. The initial membership matrix is updated based on the membership degree of each pixel to the k classes, resulting in an updated membership matrix. The new cluster centers for each class are determined based on the updated membership matrix.
[0063] The formula |c(n)-c(n-1)| is used to determine whether the difference between the new cluster center c(n) obtained in the current iteration and the cluster center c(n-1) obtained in the previous iteration is less than the iteration termination threshold. If it is less, the iteration stops and the final cluster center is output.
[0064] Since the pre-set cluster size is 3, the cluster centers are also 3. Therefore, the first flotation foam image can be divided into 3 pixel regions. The image obtained after clustering of the first flotation foam image is shown in Figure 9.
[0065] Obtain the grayscale values of three pixel regions (each pixel region has one grayscale value). The pixel region with the highest grayscale value is identified as the internal marker region.
[0066] After identifying the internal labeled regions, the clustered first flotation foam image is processed based on these regions to obtain the second flotation foam image, which includes:
[0067] The first flotation foam image after clustering is segmented by threshold binarization based on the internal labeled region to obtain a binarized image; the binarized image is the second flotation foam image.
[0068] In some embodiments, binarization segmentation is performed using the grayscale value of the internal marked region as a threshold. Grayscale values less than the threshold are set to 0. Grayscale values greater than or equal to the threshold are set to 255. This yields a binarized image, which is the second float bubble image.
[0069] In step S312, the second flotation foam image is reconstructed to obtain a grayscale reconstructed image; the unknown region of the second flotation foam image is extracted based on the second flotation foam image and the grayscale reconstructed image.
[0070] In one embodiment, reconstructing the second flotation foam image to obtain a grayscale reconstructed image includes:
[0071] Invert the grayscale value of each pixel in the second flotation foam image to obtain the inverted image;
[0072] Perform a distance transform operation on the inverted image to obtain a distance image; and
[0073] The distance image is processed with 256 gray levels to obtain a gray-scale reconstructed image.
[0074] In some embodiments, when inverting the grayscale value of each pixel in the second flotation bubble image, assuming the grayscale value of the current pixel is t, then 255-t can be used to invert the grayscale value of the current pixel. After inverting each pixel, the inverted image is finally obtained.
[0075] After obtaining the inverted image, for each pixel in the inverted image, calculate the Euclidean distance between that pixel and its nearest non-zero pixel (grayscale value not equal to 0). After all calculations are completed, a distance image is obtained. This distance image allows for the preliminary identification of the background region.
[0076] Then, for each pixel in the distance image, the distance to that pixel is converted into a grayscale value according to the formula 255*s, thus obtaining the grayscale reconstructed image. Here, s is the Euclidean distance to each pixel in the distance image.
[0077] Once the grayscale reconstructed image is determined, the unknown regions of the second flotation bubble image can be extracted based on the second flotation bubble image and the grayscale reconstructed image.
[0078] In some embodiments, the grayscale reconstructed image and the second flotation foam image are the same size. In order to remove the background region in the internal marker image and improve the accuracy of subsequent foam boundary segmentation, it is also necessary to perform pixel-by-pixel subtraction on the grayscale reconstructed image and the second flotation foam image to extract the unknown region.
[0079] In some embodiments, the subtract() function from an open-source vision algorithm library can be called to perform pixel subtraction on the grayscale reconstructed image and the second flotation bubble image. The image after subtraction is the unknown region of the second flotation bubble image.
[0080] In step S313, the second flotation foam image is marked with eight connected regions and unknown regions to obtain a target marking map.
[0081] To improve the segmentation accuracy of the subsequent watershed algorithm, it is necessary to label the second flotation foam image with 8-connected regions and unknown regions to obtain a target label map. This target label map is then used as the segmentation basis for the watershed segmentation algorithm.
[0082] In one implementation, the second flotation foam image is labeled with eight connected regions and unknown regions to obtain a target labeling map, including:
[0083] Create an initial marker image, the size of which is the same as the size of the second flotation bubble image;
[0084] Iterate through each pixel of the second flotation bubble image. For any current pixel, if it is determined to be a foreground pixel and has not been marked, then mark the current pixel as the current connected component and update the initial label value corresponding to the current pixel to the first label value in the initial labeling map. Check the eight neighboring pixels of the current pixel. If it is determined that all eight neighboring pixels are foreground pixels and have not been marked, then update the initial label value corresponding to the neighboring pixels to the first label value in the initial labeling map.
[0085] Once all pixels in the current connected component have been labeled, continue searching for the next connected component. In the initial labeling map, update the initial label values of all pixels in the next connected component to the second label values; continue until all foreground pixels have been labeled; and
[0086] In the initial label map, the initial label value corresponding to the unknown area is updated to the third label value, and the initial label map after labeling is determined as the target label map.
[0087] In some embodiments, an initial marker map needs to be created. The initial marker map can be understood as a matrix. The size of the initial marker map must be exactly the same as the size of the second flotation bubble image. Therefore, each pixel in the second flotation bubble image has a corresponding position in the initial marker map.
[0088] Then, the second floating image is scanned according to a preset scanning order. For each pixel in the second floating image, if it is determined that the pixel is a foreground pixel (grayscale value 255) and it is determined that the pixel has not been marked (the value of the pixel in the initial marking image is still 0), then the pixel is determined as a new current connected component label (corresponding to the first label value in the initial marking image, numbered 1). Using a queue method, the pixel (coordinates) is stored in the queue, and the 8 neighboring pixels of the pixel are checked. For any neighboring pixel, if it is determined that the neighboring pixel is also a foreground pixel (grayscale value 255) and the neighboring pixel has not been marked, then the initial value of the neighboring pixel in the initial marking image is also updated to the first label value, and the coordinates of the neighboring pixel are also stored in the queue, and the subsequent pixels are checked.
[0089] After all pixels within the current connected component have been labeled, continue searching for pixels in the next connected component and set the value of the next connected component's pixel in the initial labeling map to the second label value (the second label value is incremented by 1 compared to the first label value, and the second label value is 2).
[0090] Repeat the above process, continuously scanning the pixels in the second flotation bubble image until all foreground pixels have been marked.
[0091] In this way, each connected component in the initial labeling map has a unique label value to distinguish different regions. Finally, a third label value needs to be added to the pixels in the unknown regions of the initial labeling map. The third label value can be 0.
[0092] After all pixels in the second flotation bubble image have been marked, the initial marked image is output. At this point, the initial marked image is the target marked image.
[0093] In step S314, the target marker map is used as the marker points of the watershed segmentation algorithm to segment the second flotation foam image, obtaining the contours of each flotation foam. The contour of each flotation foam is added to the original foam image to complete the segmentation of the original flotation foam image.
[0094] It can be seen that the foreground and unknown regions are clearly marked in the target marker map. Therefore, the target marker map can be used as the marker points for the watershed segmentation algorithm to segment the second flotation foam image, obtaining the contours of each flotation foam. The contour of each flotation foam is then added to the original foam image, completing the segmentation of the original flotation foam image.
[0095] In one implementation, the target marker map is used as marker points in a watershed segmentation algorithm to segment the second flotation foam image, obtaining the contours of each flotation foam, including:
[0096] Each non-zero label value in the target marker map is used as a seed point, and water is injected based on these seed points. When water flows from different seed points meet, the watershed formed by the meeting is obtained, and the watershed is determined as the dividing boundary.
[0097] The target label map is updated based on the determined segmentation boundaries. The initial label values of pixels located on the segmentation boundaries are updated to fourth label values, which are negative.
[0098] The contours of each flotation bubble in the second flotation bubble image are extracted based on the updated target marker map.
[0099] The watershed algorithm, when performing image segmentation, needs to divide the second flotation foam image into boundaries based on the labels in the target label image. The same label value (usually different numbers or colors) in the target label image represents a region in the second flotation foam image. The watershed algorithm uses these labels to guide the water immersion process, ensuring that water from different regions does not interpenetrate, thus forming a clear watershed (boundary) at the point of intersection.
[0100] In some embodiments, pixels with non-zero label values are used as seed points (minimum values). Water is then spread outwards from all seed points, filling the entire second flotation foam image. When water flows from different seed points meet, a watershed is formed at the boundary. The watershed serves as the dividing boundary between different regions. The implementation principle of the above algorithm is as follows:
[0101] For each pixel through which the water flow passes, determine the distance between that pixel and each seed point. Assign that pixel to the nearest seed point. If a pixel is equidistant from two or more seed points, it is considered a boundary point, and is marked as such. All boundary points form a watershed (dividing the boundary).
[0102] Then, the initial label values corresponding to the boundary points in the target label map are updated to the fourth label value (e.g., -1). The final target label map then contains both the boundary regions and the foreground regions of each bubble. Therefore, the bubbles can be segmented based on the updated target label map to obtain the outlines of each flotation bubble. The outlines of each flotation bubble are then added to the original bubble image, completing the segmentation of the original flotation bubble image. The final segmented image is shown in Figure 10.
[0103] This disclosure first preprocesses the original flotation foam image to effectively remove noise and reduce the impact of image edge highlights on the extraction of internal markers. Based on a clustering method, the differences between image gray levels are analyzed to classify the image gray levels. Clustering optimization is used to extract internal markers from the foam image, providing accurate segmentation labels for the subsequent watershed segmentation algorithm. This ensures the accuracy of the watershed segmentation algorithm in segmenting each foam contour, thereby ensuring flotation accuracy.
[0104] Based on the same inventive concept as in the foregoing embodiments, this embodiment also provides a flotation foam image segmentation electronic device, as shown in FIG11, including:
[0105] Preprocessing unit 111 is used to preprocess the original flotation foam image to obtain a first flotation foam image;
[0106] Clustering processing unit 112 performs clustering processing on the first flotation foam image based on a clustering algorithm to obtain internal labeled regions, and processes the clustered first flotation foam image based on the internal labeled regions to obtain a second flotation foam image.
[0107] The reconstruction unit 113 is used to reconstruct the second flotation foam image to obtain a grayscale reconstructed image; and to extract the unknown regions of the second flotation foam image based on the second flotation foam image and the grayscale reconstructed image.
[0108] Marking unit 114 is used to mark eight connected regions and unknown regions on the second flotation foam image to obtain a target marking map; and
[0109] The segmentation unit 115 is used to segment the second flotation foam image by using the target marker map as marker points for the watershed segmentation algorithm, thereby obtaining the contours of each flotation foam. The contour of each flotation foam is then added to the original foam image to complete the segmentation of the original flotation foam image.
[0110] Since the electronic device described in this disclosure is used to implement the flotation foam image segmentation method of this disclosure, those skilled in the art can understand the specific structure and variations of the device based on the method described in this disclosure, and therefore will not be described in detail here. All devices used in the methods of this disclosure fall within the scope of protection of this disclosure.
[0111] Based on the same inventive concept, this embodiment provides a computer device, including a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, it implements any step of the method described above.
[0112] Based on the same inventive concept, this embodiment provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the steps of any of the methods described above.
[0113] Through one or more embodiments of this disclosure, this disclosure has at least the following beneficial effects or advantages:
[0114] This disclosure provides a method, apparatus, medium, and device for flotation foam image segmentation. The flotation foam image segmentation method includes: preprocessing an original flotation foam image to obtain a first flotation foam image; clustering the first flotation foam image using a clustering algorithm to obtain internal labeled regions, and processing the clustered first flotation foam image based on the internal labeled regions to obtain a second flotation foam image; reconstructing the second flotation foam image to obtain a grayscale reconstructed image; extracting unknown regions of the second flotation foam image based on the second flotation foam image and the grayscale reconstructed image; labeling the second flotation foam image with octet connections and unknown regions to obtain a target label map; and using the target label map as marker points for a watershed segmentation algorithm to segment the second flotation foam image to obtain the contours of each flotation foam, adding the contours of each flotation foam to the original foam image to complete the segmentation of the original flotation foam image. Thus, preprocessing the original flotation foam image effectively removes noise from the original image and reduces the impact of image edge highlights on the extraction of internal labels. Based on the differences in image gray levels, clustering methods are used to analyze the gray levels and classify them. Clustering optimization is then used to extract internal markers from the foam image, providing accurate segmentation labels for the subsequent watershed segmentation algorithm. This ensures the accuracy of the watershed segmentation algorithm in segmenting each foam contour, thereby guaranteeing flotation accuracy.
[0115] The algorithms and displays provided herein are not inherently related to any particular computer, virtual system, or other device. Various general-purpose systems can also be used in conjunction with the teachings herein. The required structure for constructing such systems is apparent from the above description. Furthermore, this disclosure is not directed to any particular programming language. It should be understood that the contents of this disclosure described herein can be implemented using various programming languages, and the above description of specific languages is for the purpose of disclosing the best mode of implementation of this disclosure.
[0116] Numerous specific details are set forth in the specification provided herein. However, it will be understood that embodiments of this disclosure may be practiced without these specific details. In some instances, well-known methods, structures, and techniques have not been shown in detail so as not to obscure the understanding of this specification.
[0117] Similarly, it should be understood that, in order to simplify this disclosure and aid in understanding one or more of the various inventive aspects, in the above description of exemplary embodiments of this disclosure, various features of this disclosure are sometimes grouped together in a single embodiment, figure, or description thereof. However, this approach to disclosure should not be construed as reflecting an intention that the claimed disclosure requires more features than are expressly recited in each claim. Rather, as reflected in the following claims, inventive aspects lie in fewer than all features of a single foregoing disclosed embodiment. Therefore, the claims following the detailed description are hereby expressly incorporated into that detailed description, wherein each claim itself is a separate embodiment of this disclosure.
[0118] Those skilled in the art will understand that modules in the device of the embodiments can be adaptively changed and placed in one or more devices different from that embodiment. Modules, units, or components in the embodiments can be combined into a single module, unit, or component, and further, they can be divided into multiple sub-modules, sub-units, or sub-components. Except where at least some of such features and / or processes or units are mutually exclusive, any combination can be used to combine all features disclosed in this specification (including the accompanying claims, abstract, and drawings) and all processes or units of any method or device so disclosed. Unless expressly stated otherwise, each feature disclosed in this specification (including the accompanying claims, abstract, and drawings) may be replaced by an alternative feature that serves the same, equivalent, or similar purpose.
[0119] Furthermore, those skilled in the art will understand that although some embodiments herein include certain features included in other embodiments but not others, combinations of features from different embodiments are intended to be within the scope of this disclosure and form different embodiments. For example, in the following claims, any of the claimed embodiments can be used in any combination.
[0120] The various component embodiments of this disclosure can be implemented in hardware, or as software modules running on one or more processors, or a combination thereof. Those skilled in the art will understand that microprocessors or digital signal processors (DSPs) can be used in practice to implement some or all of the functions of some or all of the components in the gateway, proxy electronics, or system according to embodiments of this disclosure. This disclosure can also be implemented as a device or apparatus program (e.g., a computer program and computer program product) for performing some or all of the methods described herein. Such an implementation of this disclosure can be stored on a computer-readable medium or can take the form of one or more signals. Such signals can be downloaded from an Internet website, provided on a carrier signal, or provided in any other form.
[0121] It should be noted that the above embodiments are illustrative of this disclosure and not restrictive, and that alternative embodiments can be devised by those skilled in the art without departing from the scope of the appended claims. In the claims, any reference signs placed between parentheses should not be construed as limiting the claims. The word "comprising" does not exclude the presence of elements or steps not listed in the claims. The word "a" or "an" preceding an element does not exclude the presence of a plurality of such elements. This disclosure can be implemented by means of hardware comprising several different elements and by means of a suitably programmed computer. In the unit claims enumerating several means, several of these means may be embodied by the same item of hardware. The use of the words first, second, and third, etc., does not indicate any order. These words can be interpreted as names.
[0122] Although preferred embodiments of this disclosure have been described, those skilled in the art, upon learning the basic inventive concept, can make other changes and modifications to these embodiments. Therefore, the appended claims are intended to be interpreted as including the preferred embodiments as well as all changes and modifications falling within the scope of this disclosure.
[0123] The above description is merely a preferred embodiment of this disclosure and is not intended to limit the scope of protection of this disclosure. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of this disclosure should be included within the scope of protection of this disclosure.
Claims
1. A method for segmenting flotation foam images, applied in electronic devices, comprising: The original flotation foam image is preprocessed to obtain the first flotation foam image; The first flotation foam image is clustered based on a clustering algorithm to obtain internal labeled regions. The clustered first flotation foam image is then processed based on the internal labeled regions to obtain a second flotation foam image. The second flotation foam image is reconstructed to obtain a grayscale reconstructed image, and the unknown regions of the second flotation foam image are extracted based on the second flotation foam image and the grayscale reconstructed image. The second flotation foam image is labeled with eight connected regions and unknown regions to obtain the target labeling image; as well as The target marker map is used as the marker point of the watershed segmentation algorithm to segment the second flotation foam image, thereby obtaining the outline of each flotation foam. The outline of each flotation foam is then added to the original foam image to complete the segmentation of the original flotation foam image.
2. The method as described in claim 1, wherein, The preprocessing of the original flotation foam image to obtain the first flotation foam image includes: The original flotation foam image is preprocessed once using a finite contrast adaptive histogram equalization algorithm to obtain a first preprocessed image; The preprocessed image is filtered using a pre-constructed cascaded filter to obtain a second preprocessed image; and The second preprocessed image is subjected to erosion, dilation, and opening operations in sequence to obtain the first flotation foam image.
3. The method as described in claim 1, wherein, The clustering process of the first flotation foam image based on the clustering algorithm to obtain internal labeled regions includes: In the current iteration, the membership degree of each pixel in the first flotation bubble image to k classes is determined, and the initial membership degree matrix is updated according to the membership degree of each pixel to k classes to obtain the updated membership degree matrix; the new cluster center of each class is determined according to the updated membership degree matrix; if the difference between the new cluster center and the cluster center corresponding to the current iteration is less than or equal to a preset threshold, the iteration is stopped, and the preset number of cluster centers is output. The first flotation foam image is clustered into corresponding pixel regions based on the cluster centers; and The region with the highest grayscale value in the pixel region is defined as the internal marker region.
4. The method of claim 1, wherein, The process of processing the first flotation foam image after clustering based on the internal labeled regions to obtain the second flotation foam image includes: The first flotation foam image after clustering is segmented by threshold binarization based on the internal labeled region to obtain a binarized image; the binarized image is the second flotation foam image.
5. The method of claim 1, wherein, The step of reconstructing the second flotation foam image to obtain a grayscale reconstructed image includes: Invert the grayscale value of each pixel in the second flotation foam image to obtain an inverted image; Perform a distance transform operation on the inverted image to obtain a distance image; and The distance image is processed in grayscale to obtain the grayscale reconstructed image.
6. The method of claim 1, wherein, The step of performing octagonal region labeling and unknown region labeling on the second flotation foam image to obtain a target labeling map includes: Create an initial marker image, the size of which is the same as the size of the second flotation foam image; Traverse each pixel of the second flotation bubble image. For any current pixel, if it is determined that the current pixel is a foreground pixel and that the current pixel has not been marked, then the current pixel is determined as the current connected component marker, and the initial marker value corresponding to the current pixel is updated to the first label value in the initial marker image. Check the eight neighboring pixels of the current pixel. If it is determined that the eight neighboring pixels are all foreground pixels and that the eight neighboring pixels have not been marked, then the initial marker value corresponding to the neighboring pixels is updated to the first label value in the initial marker image. Once all pixels in the current connected component have been labeled, continue searching for the next connected component. In the initial labeling map, update the initial label values of all pixels in the next connected component to the second label values; continue until all foreground pixels have been labeled; and In the initial marking map, the initial label value corresponding to the unknown area is updated to the third label value, and the marked initial marking map is determined as the target marking map.
7. The method of claim 1, wherein, The target marker map is used as the marker points in the watershed segmentation algorithm to segment the second flotation foam image, obtaining the contours of each flotation foam, including: Each non-zero label value in the target marker map is used as a seed point, and water is injected based on the seed points. When the water flows from different seed points meet, the watershed formed by the meeting is obtained, and the watershed is determined as the dividing boundary. The target label map is updated based on the determined segmentation boundaries. The initial label values of pixels located on the segmentation boundaries in the target label map are updated to fourth label values, where the fourth label value is negative. The contours of each flotation bubble in the second flotation bubble image are extracted based on the updated target marker map.
8. An electronic device for flotation foam image segmentation, comprising: The preprocessing unit is used to preprocess the original flotation foam image to obtain the first flotation foam image; The clustering processing unit performs clustering processing on the first flotation foam image based on a clustering algorithm to obtain internal labeled regions, and processes the clustered first flotation foam image based on the internal labeled regions to obtain a second flotation foam image. The reconstruction unit is used to reconstruct the second flotation foam image to obtain a grayscale reconstructed image; and to extract the unknown regions of the second flotation foam image based on the second flotation foam image and the grayscale reconstructed image. A marking unit is used to mark eight connected regions and unknown regions on the second flotation foam image to obtain a target marking map; as well as The segmentation unit is used to segment the second flotation foam image by using the target marker map as the marker point of the watershed segmentation algorithm to obtain the outline of each flotation foam, and then add the outline of each flotation foam to the original foam image to complete the segmentation of the original flotation foam image.
9. A computer-readable storage medium comprising storing thereon a computer program that, when executed by a processor, implements the steps of the method according to any one of claims 1-7.
10. A computer device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor, when executing the computer program, implements the steps of the method according to any one of claims 1-7.
Citation Information
Cited By
A compressor casting quality evaluation method and system based on metallographic analysis
CN122200204A