Flotation froth image segmentation method, electronic equipment, medium and equipment
The flotation foam image is optimized through preprocessing and clustering algorithms, and combined with the watershed segmentation algorithm, the problem of bubble edge information loss in flotation foam image segmentation is solved, and the flotation accuracy is improved.
Patent Information
- Application Number
- CN202411408957.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-10
- Publication Date
- 2025-01-17
AI Technical Summary
In the prior art, bubble edge information is seriously lost during flotation foam image segmentation, which affects the flotation accuracy.
The pretreatment technology is adopted, including finite contrast adaptability histogram equalization algorithm, cascade filter, corrosion, expansion and on-operation, combined with clustering algorithm and watershed segmentation algorithm, and the contour of the foam is extracted through eight-connected domain markings and unknown area markings.
Effectively remove noise, reduce the influence of image edge highlights, improve image grayscale uniformity, ensure the accuracy of the watershed segmentation algorithm, and thus improve flotation accuracy.
Smart Images

Figure CN119323674A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of foam image segmentation, and in particular to a flotation foam image segmentation method, electronic equipment, medium and equipment. Background Art
[0002] Flotation is the most widely used sorting method in the field of mineral processing, with strong nonlinearity and strong coupling. In industrial production, it mainly depends on manual observation of the foam state in the flotation tank to determine whether the flotation condition is stable, and then adjust the flotation process to ensure that the flotation effect meets the standard. Due to the great randomness and uncertainty of manual observation, it is difficult to ensure that the flotation process is in the best state, which wastes the already limited mineral resources. Therefore, most of the current methods use image analysis to analyze flotation foam images, which is conducive to improving mineral utilization and stabilizing production processes.
[0003] However, for flotation foam image processing, flotation foam image segmentation is an important part of studying the characteristic parameters of foam images. By analyzing the mineral flotation foam images collected from industrial sites, the following characteristics can be found:
[0004] (1) “Full foreground, no background”: the entire foam image is almost entirely composed of bubbles.
[0005] (2) Uneven illumination causes local brightness differences in the image and obvious noise.
[0006] (3) There is a clear highlight near the center of each bubble surface. The grayscale variation between bubbles is small, while the grayscale variation in the middle of the bubble is large.
[0007] In view of the complex characteristics of the above images, the traditional image detection algorithm (such as edge detection algorithm) can only segment the bright spots in the middle of the bubbles, but the bubble edge information is seriously lost, which in turn affects the flotation accuracy. Summary of the invention
[0008] In response to the problems existing in the prior art, the embodiments of the present invention provide a flotation foam image segmentation method, electronic device, medium and device to solve or partially solve the technical problem in the prior art that when segmenting the flotation foam image, the bubble edge information is seriously lost, thereby affecting the flotation accuracy.
[0009] A first aspect of the present invention provides a flotation foam image segmentation method, which is applied in an electronic device, and the method comprises:
[0010] Preprocessing the original flotation foam image to obtain a first flotation foam image;
[0011] Performing clustering processing on the first flotation foam image based on a clustering algorithm to obtain an internal marking area, and processing the clustered first flotation foam image based on the internal marking area to obtain a second flotation foam image;
[0012] Reconstructing the second flotation foam image to obtain a grayscale reconstructed image; extracting an unknown area of the second flotation foam image according to the second flotation foam image and the grayscale reconstructed image;
[0013] Marking eight connected domains and unknown regions on the second flotation foam image to obtain a target marking map;
[0014] The target marker image is used as a marker point of a watershed segmentation algorithm to segment the second flotation foam image to obtain the outline of each flotation foam, and the outline of each flotation foam is added to the original foam image to complete the segmentation of the original flotation foam image.
[0015] In the above solution, the preprocessing of the original flotation foam image to obtain the first flotation foam image includes:
[0016] Preprocessing the original flotation foam image once using a finite contrast adaptive histogram equalization algorithm to obtain a first preprocessed image;
[0017] Using a preset cascade filter to filter the preprocessed image to obtain a second preprocessed image;
[0018] The second preprocessed image is sequentially subjected to erosion, dilation and opening operations to obtain the first flotation froth image.
[0019] In the above solution, clustering the first flotation foam image based on a clustering algorithm to obtain an internal marking area includes:
[0020] In the current iteration, the membership of each pixel in the first flotation foam image to the k classes is determined, and the initial membership matrix is updated according to the membership of each pixel to the k classes to obtain an updated membership matrix; a 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 previous iteration is less than or equal to a preset threshold, the iteration is stopped, and the cluster centers of the preset number of clusters are output;
[0021] clustering the first flotation foam image into corresponding pixel regions based on the cluster center;
[0022] The area with the largest grayscale value in the pixel area is determined as the internal marking area.
[0023] In the above solution, the first flotation foam image after clustering is processed based on the internal marked area to obtain the second flotation foam image, including:
[0024] The first flotation foam image after clustering is subjected to threshold binarization segmentation based on the internal marked area to obtain a binarized image; the binarized image is the second flotation foam image.
[0025] In the above solution, reconstructing the second flotation foam image to obtain a grayscale reconstructed image includes:
[0026] performing a negation operation on the grayscale value of each pixel of the second flotation foam image to obtain a negated image;
[0027] Performing a distance transformation operation on the inverted image to obtain a distance image;
[0028] Grayscale processing is performed on the distance image to obtain the grayscale reconstructed image.
[0029] In the above solution, the eight-connected domain labeling and unknown region labeling of the second flotation foam image to obtain a target labeling map includes:
[0030] creating an initial label image, the size of the initial label image being the same as the size of the second flotation froth image;
[0031] Traversing each pixel point of the second flotation foam image, for any current pixel point, if it is determined that the current pixel point is a foreground pixel point and it is determined that the current pixel point has not been marked, then the current pixel point is determined as the current connected domain mark, and the initial mark value corresponding to the current pixel point in the initial mark map is updated to the first label value; checking the eight neighboring pixel points of the current pixel point, if it is determined that the eight neighboring pixel points are all the foreground pixel points and it is determined that the eight neighboring pixel points have not been marked, then the initial mark value corresponding to the neighboring pixel point in the initial mark map is updated to the first label value;
[0032] When it is determined that all the pixels in the current connected domain have been marked, continue to search for the next connected domain, and update the initial label values corresponding to all the pixels in the next connected domain to the second label value in the initial label map until all the foreground pixels have been marked;
[0033] In the initial labeling map, the initial labeling value corresponding to the unknown area is updated to a third label value, and the labeled initial labeling map is determined as the target labeling map.
[0034] In the above solution, the target marker image is used as a marker point of a watershed segmentation algorithm to segment the second flotation foam image to obtain the contours of each flotation foam, including:
[0035] Each non-zero label value in the target label map is used as a seed point, water is injected based on the seed point, and when water flows from different seed points meet, a watershed formed by the meeting is obtained, and the watershed is determined as a segmentation boundary;
[0036] The target label map is updated according to the determined segmentation boundary, and the initial label value of the pixel point located on the segmentation boundary in the target label map is updated to a fourth label value, where the fourth label value is a negative number;
[0037] The contour of each flotation froth in the second flotation froth image is extracted based on the updated target label map.
[0038] A second aspect of the present invention provides an electronic device for flotation foam image segmentation, the electronic device comprising:
[0039] A preprocessing unit, used for preprocessing the original flotation foam image to obtain a first flotation foam image;
[0040] a clustering processing unit, which performs clustering processing on the first flotation foam image based on a clustering algorithm to obtain an internal marking area, and processes the first flotation foam image after the clustering processing based on the internal marking area to obtain a second flotation foam image;
[0041] a reconstruction unit, configured to reconstruct the second flotation foam image to obtain a grayscale reconstructed image; and extract an unknown region of the second flotation foam image according to the second flotation foam image and the grayscale reconstructed image;
[0042] a marking unit, used for marking eight connected domains and unknown regions of the second flotation foam image to obtain a target marking map;
[0043] The segmentation unit is used to segment the second flotation foam image by using the target marking image as a marking point of a watershed segmentation algorithm to obtain the outline of each flotation foam, and add the outline of each flotation foam to the original foam image to complete the segmentation of the original flotation foam image.
[0044] According to a third aspect of the present invention, a computer-readable storage medium is provided, on which a computer program is stored, and when the program is executed by a processor, the steps of any one of the methods described in the first aspect are implemented.
[0045] According to a fourth aspect of the present invention, a computer device is provided, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the program, the steps of any one of the methods described in the first aspect are implemented.
[0046] The present invention provides a flotation foam image segmentation method, electronic device, medium and device, the method comprising: preprocessing an original flotation foam image to obtain a first flotation foam image; clustering the first flotation foam image based on a clustering algorithm to obtain an internal marking area, and processing the clustered first flotation foam image based on the internal marking area to obtain a second flotation foam image; reconstructing the second flotation foam image to obtain a grayscale reconstructed image; extracting an unknown area of the second flotation foam image according to the second flotation foam image and the grayscale reconstructed image; marking the second flotation foam image with eight connected domains and unknown areas to obtain a target marking map; The target marking image is used as the marking point of the watershed segmentation algorithm to segment the second flotation foam image, and the outline of each flotation foam is obtained. The outline of each flotation foam is added to the original foam image to complete the segmentation of the original flotation foam image. In this way, the original flotation foam image is first preprocessed to effectively remove the noise in the original image and reduce the influence of the bright spots on the edge of the image on the extraction of internal marks. According to the difference between the grayscale of the image, the grayscale of the image can be classified into different categories, and the internal marks of the foam image are extracted through clustering optimization, so as to provide accurate segmentation marks for the subsequent watershed segmentation algorithm, thereby ensuring the accuracy of the watershed segmentation algorithm in segmenting each foam outline, thereby ensuring the flotation accuracy. BRIEF DESCRIPTION OF THE DRAWINGS
[0047] Various other advantages and benefits will become apparent to those of ordinary skill in the art by reading the detailed description of the preferred embodiments below. The accompanying drawings are only for the purpose of illustrating the preferred embodiments and are not to be considered as limiting the present invention. Moreover, the same reference symbols are used throughout the accompanying drawings to represent the same components. In the accompanying drawings:
[0048] Figure 1 It shows a schematic diagram of the structure of a flotation foam image segmentation system according to an embodiment of the present invention;
[0049] Figure 2 A schematic diagram of an original flotation froth image according to an embodiment of the present invention is shown;
[0050] Figure 3 A schematic diagram of a flotation foam image segmentation method according to an embodiment of the present invention is shown;
[0051] Figure 4shows a grayscale histogram of an original flotation froth image according to one embodiment of the present invention;
[0052] Figure 5 shows a grayscale histogram obtained after a preprocessing of an original flotation froth image by CHALE according to an embodiment of the present invention;
[0053] Figure 6 A schematic diagram of a first preprocessed image obtained after a preprocessing according to an embodiment of the present invention is shown;
[0054] Figure 7 A schematic diagram of a second preprocessed image obtained through preprocessing according to an embodiment of the present invention is shown;
[0055] Figure 8 A schematic diagram of a first flotation foam image according to an embodiment of the present invention is shown;
[0056] Fig. 9 A schematic diagram of an image obtained after clustering processing of a first flotation foam image according to an embodiment of the present invention is shown;
[0057] Fig.10 A schematic diagram of an image segmented by a watershed algorithm according to an embodiment of the present invention is shown;
[0058] Fig.11 A schematic diagram of the overall structure of an electronic device for flotation foam image segmentation according to an embodiment of the present invention is shown. DETAILED DESCRIPTION
[0059] The exemplary embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. Although the exemplary embodiments of the present disclosure are shown in the accompanying drawings, it should be understood that the present disclosure can be implemented in various forms and should not be limited by the embodiments set forth herein. On the contrary, these embodiments are provided to enable a more thorough understanding of the present disclosure and to fully convey the scope of the present disclosure to those skilled in the art.
[0060] In order to better understand the technical solution of this application, the flotation foam image segmentation system is first introduced here. Figure 1 As shown, the system includes: an industrial camera 1, a froth flotation device 2 and an electronic device 3; wherein,
[0061] The industrial camera 1 is installed above the froth flotation device 2, and is used to collect the original flotation froth image and send the original flotation froth image to the electronic device 3;
[0062] After receiving the original flotation foam image, the electronic device 3 pre-processes the original flotation foam image to obtain a first flotation foam image; clusters the first flotation foam image based on a clustering algorithm to obtain an internal marking area, and processes the first flotation foam image after clustering based on the internal marking area to obtain a second flotation foam image; reconstructs the second flotation foam image to obtain a grayscale reconstructed image; extracts the unknown area of the second flotation foam image according to the second flotation foam image and the grayscale reconstructed image; marks the eight-connected domain and the unknown area of the second flotation foam image to obtain a target marking map; segments the second flotation foam image using the target marking map as the marking point of the watershed segmentation algorithm to obtain the contours of each flotation foam, and adds the contour of each flotation foam to the original foam image to complete the segmentation of the original flotation foam image.
[0063] Since the ambient temperature of the flotation process is above 30°C, the temperature resistance of the industrial camera 1 must reach at least 40°C to ensure reliable operation at the flotation site. In addition, the industrial camera 1 has the following performance:
[0064] (1) Long transmission distance.
[0065] (2) High pixels.
[0066] (3) High acquisition frame rate. Reasonable frame rate control can prevent jitter.
[0067] (4) It has a secondary development interface to realize data and image interaction with the analysis system.
[0068] Specifically, the industrial camera 1 should be perpendicular to the liquid surface to avoid uneven illumination affecting subsequent image analysis; the industrial camera 1 should maintain a preset installation distance from the liquid surface to prevent the slurry vapor from fogging the lens and affecting the image analysis results. A light source with a stable luminous frequency is also installed near the industrial camera 1 ( Figure 1 The original flotation foam image captured by the industrial camera 1 is shown in FIG. Figure 2 shown.
[0069] The electronic device 3 may specifically be a computer installed with an image analysis algorithm, or may be a server with an image analysis algorithm, which is not limited here.
[0070] The specific method for the electronic device 3 to segment the original flotation foam image can be referred to the implementation method of the subsequent electronic device side, so it will not be repeated here.
[0071] Based on the same inventive concept as the above-mentioned embodiment, the present invention also provides a flotation foam image segmentation method, such as Figure 3As shown, the method mainly includes the following steps:
[0072] S310, preprocessing the original flotation foam image to obtain a first flotation foam image.
[0073] from Figure 2 It can be seen that the contrast of the original flotation foam image taken by the industrial camera is low. In order to make the gray value of the pixel points evenly distributed, the edge information of the foam image is clearly visible, the contrast between the foams is enhanced, the image noise is removed, and the influence of the bright spots on the edge of the image on the subsequent internal mark extraction is reduced, the present invention needs to preprocess the original flotation foam image to obtain the first flotation foam image, which is implemented as follows:
[0074] The original flotation foam image is preprocessed (contrast enhancement) using a finite contrast adaptive histogram equalization algorithm CHALE to obtain a first preprocessed image;
[0075] Performing filtering processing on the preprocessed image using a preset cascade filter to obtain a second preprocessed image;
[0076] The second preprocessed image is sequentially subjected to corrosion, expansion and opening operations to obtain a first flotation froth image.
[0077] Specifically, the grayscale histogram of the original flotation foam image is as follows: Figure 4 As shown, from Figure 4 It can be seen that the grayscale value distribution of the pixels in the original flotation foam image is uneven, and the grayscale histogram obtained after CHALE preprocesses the original flotation foam image is as follows: Figure 5 As shown, from Figure 5 It can be seen that after one preprocessing, the grayscale details of the flotation foam image are stretched, which has both the effect of more coordinated grayscale distribution of global histogram equalization and the characteristics of local histogram equalization to adapt to the grayscale distribution differences of different parts of the image. Figure 6 shown.
[0078] The first preprocessed image contains many noise points, mainly Gaussian noise and salt and pepper noise, the sources of which are sensor noise introduced by high temperature and uneven illumination and the superposition of discrete pulse signals. The characteristic of Gaussian noise in the image is that the noise points are extremely small and have the characteristics of Gaussian distribution; the salt and pepper noise has large noise points and scattered distribution on the image. However, a single filter cannot meet the demand for denoising the collected image, so the present invention uses a preset cascade filter to filter the preprocessed image to obtain a second preprocessed image.
[0079] For the first preprocessed image, wavelet filtering is first performed on the first preprocessed image to remove Gaussian noise, and then median filtering is used to remove salt and pepper noise. The noise size is 3×3, and the grayscale value of each pixel within the noise size is set to the median value of the grayscale of all pixels in the selected window size.
[0080] The cascade filter can not only effectively eliminate the noise in the second preprocessed image, but also completely preserve the shape information of the foam image such as contours and bright spots.
[0081] The second pre-processed image can be Figure 7 shown.
[0082] In order to reduce the influence of the bright spots on the edge of the image on the subsequent extraction of internal marks, it is also necessary to perform corrosion operations, dilation operations and opening operations on the second preprocessed image in sequence to obtain the first flotation foam image.
[0083] Specifically, using the corrosion formula (fΘb)(s,t)=min{f(s+x,t+y)-b(x,y)(s+x),(t+y)∈D f ; (x,y)∈D b}Performing an erosion operation on the second preprocessed image to obtain an eroded image;
[0084] Among them, Θ represents the erosion operator, which means sliding the structural element b(x, y) on the image f(x, y) to find the minimum difference between the two at all positions. That is, to find the local minimum in the local area of the image. s and t are used to represent the offset of the sliding window, which determine the relationship between the image and the structural element at different positions, that is, to select the position of the sub-region in the second pre-processed image.
[0085] Then use the expansion formula Perform a dilation operation on the eroded image to obtain a dilated image.
[0086] in, represents the dilation operator, which means sliding the structural element b(x,y) on the image f(x,y) to find the maximum sum of the two at all positions. That is, to find the local maximum value in the local area of the image. f is the domain of the image, representing the coordinates of all valid pixels of the image, D b Represents the domain of the structure element b(x,y), which represents the representation range of all valid pixel coordinates in the structure element b(x,y).
[0087] In practical applications, narrow and long bright bands will also appear at the junctions between bubbles. The grayscale value changes around the junctions are different from the grayscale value changes around the bubble vertices, and generally appear as jumps without transition areas. The generation of these bright bands will seriously affect the subsequent extraction of marker points. Therefore, the present invention also needs to perform an open operation on the above-mentioned expanded image (first erosion and then expansion) to finally obtain the first flotation foam image. Among them, the first flotation foam image is as follows Figure 8 As shown in FIG. 1 , since the opening operation can remove two smaller points (relative to the structural element) while keeping the gray level of the image unchanged, the first flotation foam image obtained after the opening operation also has a relatively stable gradient.
[0088] S311, clustering the first flotation foam image based on a clustering algorithm to obtain an internal marking area, and processing the clustered first flotation foam image based on the internal marking area to obtain a second flotation foam image.
[0089] In one embodiment, clustering is performed on the first flotation foam image based on a clustering algorithm to obtain an internal marking area, including:
[0090] In the current iteration, the membership of each pixel in the first flotation foam image to the k-th class is determined, and the initial membership matrix is updated according to the membership of each pixel to the k-th class to obtain an updated membership matrix; a 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 previous iteration is less than or equal to a preset threshold, the iteration is stopped, and the cluster centers of the preset number of clusters are output;
[0091] clustering the first flotation foam image into corresponding pixel regions based on the cluster center;
[0092] The area with the largest grayscale value in the pixel area is determined as the internal marking area.
[0093] Specifically, the number of clusters k is set to 3, that is, three types of pixel regions need to be divided in the end. The iteration termination threshold ε>0 is set; and the convergence condition is set.
[0094] Then, three initial cluster centers are randomly selected in the first flotation foam image according to the number of clusters, and the membership matrix is initialized to obtain an initialized membership matrix;
[0095] In each iteration, the membership of each pixel in the first flotation foam image to the k classes is determined, and the initial membership matrix is updated according to the membership of each pixel to the k classes to obtain an updated membership matrix; a new cluster center of each class is determined according to the updated membership matrix;
[0096] According to the formula |c(n)-c(n-1)|, 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 so, stop the iteration and output the final cluster center.
[0097] Since the number of clusters is set to 3, the cluster center is also 3, and the first flotation foam image can be divided into 3 pixel regions. Fig. 9 shown.
[0098] The grayscale values of the three pixel regions are obtained respectively (each pixel region has a grayscale value), and the pixel region with the largest grayscale value is determined as the internal marking region.
[0099] After the internal marking area is determined, the first flotation foam image after clustering is processed based on the internal marking area to obtain a second flotation foam image, including:
[0100] The first flotation foam image after clustering is subjected to threshold binarization segmentation based on the internal marked area to obtain a binarized image; the binarized image is the second flotation foam image.
[0101] Specifically, the grayscale value of the internal marked area is used as a threshold for binary segmentation, the grayscale value less than the threshold is set to 0, and the grayscale value greater than or equal to the threshold is set to 255, so that a binary image is obtained, and the binary image is the second flotation foam image.
[0102] S312, reconstructing the second flotation foam image to obtain a grayscale reconstructed image; extracting an unknown area of the second flotation foam image according to the second flotation foam image and the grayscale reconstructed image.
[0103] In one embodiment, reconstructing the second flotation froth image to obtain a grayscale reconstructed image includes:
[0104] Performing a negation operation on the grayscale value of each pixel of the second flotation foam image to obtain a negated image;
[0105] Perform a distance transformation operation on the inverted image to obtain a distance image;
[0106] The distance image is processed with grayscale level 256 to obtain a grayscale reconstructed image.
[0107] Specifically, when the grayscale value of each pixel of the second flotation foam image is inverted, assuming that the grayscale value of the current pixel is t, the grayscale value of the current pixel can be inverted by 255-t. After each pixel is inverted, a inverted image is finally obtained.
[0108] After obtaining the inverted image, for each pixel in the inverted image, the Euclidean distance between the pixel and its nearest non-zero pixel (grey value is not 0) is calculated, and after all calculations are completed, a distance image is obtained. In this way, the background area can be preliminarily determined in the distance image.
[0109] Then, for each pixel in the distance image, the distance of the pixel is converted into a grayscale value according to the formula 255*s, thereby obtaining a grayscale reconstructed image, where s is the Euclidean distance of each pixel in the distance image.
[0110] After the grayscale reconstructed image is determined, the unknown region of the second flotation froth image may be extracted according to the second flotation froth image and the grayscale reconstructed image.
[0111] Specifically, the sizes of the grayscale reconstructed image and the second flotation foam image are consistent. In order to remove the background area in the internal marking image and improve the accuracy of subsequent foam boundary segmentation, it is also necessary to perform pixel-by-pixel difference between the grayscale reconstructed image and the second flotation foam image to extract the unknown area.
[0112] In specific implementation, the subtraction function substract() in the open source visual algorithm library can be called to perform pixel difference processing on the grayscale reconstruction image and the second flotation foam image. The image after the difference is the unknown area of the second flotation foam image.
[0113] S313, marking the eight-connected domain and the unknown region of the second flotation foam image to obtain a target marking map.
[0114] In order to improve the segmentation accuracy of the subsequent watershed algorithm, it is necessary to mark the eight connected regions and unknown regions of the second flotation foam image to obtain a target marking map, which is then used as the segmentation basis for the watershed segmentation algorithm.
[0115] In one embodiment, the second flotation foam image is labeled with eight connected domains and unknown regions to obtain a target labeling map, including:
[0116] creating an initial labeling image, the size of the initial labeling image being the same as the size of the second flotation foam image;
[0117] Traversing each pixel of the second flotation foam image, for any current pixel, if it is determined that the current pixel is a foreground pixel and it is determined that the current pixel has not been marked, the current pixel is determined as the current connected domain mark, and the initial mark value corresponding to the current pixel in the initial mark map is updated to the first label value; checking the eight neighboring pixels of the current pixel, if it is determined that the eight neighboring pixels are all foreground pixels and it is determined that the eight neighboring pixels are not marked, then the initial mark value corresponding to the neighboring pixel in the initial mark map is updated to the first label value;
[0118] When it is determined that all the pixels in the current connected domain have been marked, continue to search for the next connected domain, and update the initial label values corresponding to all the pixels in the next connected domain in the initial label map to the second label value; until all the foreground pixels have been marked;
[0119] In the initial labeling map, the initial labeling value corresponding to the unknown area is updated to the third label value, and the labeled initial labeling map is determined as the target labeling map.
[0120] Specifically, a new initial marking map needs to be created. The initial marking map can be understood as a matrix. The size of the initial marking map needs to be completely consistent with the size of the second flotation foam image. Therefore, each pixel in the second flotation foam image has a corresponding position in the initial marking map.
[0121] Then, the second flotation image is scanned according to the preset scanning order. For each pixel in the second flotation image, if the pixel is determined to be a foreground pixel (grayscale value is 255) and it is determined that the pixel has not been marked (the value of the pixel in the initial mark map is still 0), the pixel is determined as a new current connected domain mark (corresponding to the first label value in the initial mark map, number 1). Using the queue method, the pixel (coordinate) is stored in the queue, and the 8 neighboring pixels of the pixel are checked. For any neighboring pixel, if the neighboring pixel is also determined to be a foreground pixel (grayscale value is 255) and the neighboring pixel has not been marked, the initial value of the neighboring pixel in the initial mark map is also updated to the first label value, and the coordinates of the pixel in the field are also stored in the queue, and the subsequent pixels are checked.
[0122] If all pixels in the current connected domain are marked, continue to search for the next connected domain pixel, and set the value of the next connected domain pixel in the initial marking map to the second label value (the second label value is 1 more than the first label value, and the second label value is 2).
[0123] The above process is repeated to continuously scan the pixels in the second flotation foam image until all foreground pixels are marked.
[0124] In this way, each connected domain in the initial label 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 region in the initial label map. The third label value can be 0.
[0125] After all the pixels in the second flotation foam image are marked, the marked initial marking image is output, and the marked initial marking image is the target marking image.
[0126] S314, using the target marker image as a marker point of a watershed segmentation algorithm to segment the second flotation foam image, obtaining the outline of each flotation foam, adding the outline of each flotation foam to the original foam image, and completing the segmentation of the original flotation foam image.
[0127] It can be seen that the marks of the foreground area and the unknown area are clearly known in the target marking map, so the target marking map can be used as the marking point of the watershed segmentation algorithm to segment the second flotation foam image, and the contour of each flotation foam is obtained. The contour of each flotation foam is added to the original foam image to complete the segmentation of the original flotation foam image.
[0128] In one embodiment, the target marker image is used as a marker point of a watershed segmentation algorithm to segment the second flotation foam image to obtain the contours of each flotation foam, including:
[0129] Each non-zero label value in the target label map is used as a seed point, and water is injected based on the seed point. When water flows from different seed points meet, the watershed formed by the meeting is obtained, and the watershed is determined as the segmentation boundary;
[0130] The target label map is updated according to the determined segmentation boundary, and the initial label value of the pixel point located on the segmentation boundary in the target label map is updated to a fourth label value, where the fourth label value is a negative number;
[0131] The contour of each flotation froth in the second flotation froth image is extracted based on the updated target label map.
[0132] When performing image segmentation, the watershed algorithm needs to segment the second flotation foam image by the labels in the target label map. The same label value (usually different numbers or colors) in the target label map represents an area in the second flotation foam image. The watershed algorithm will guide the water immersion process based on these labels to ensure that water in different areas does not penetrate each other, thus forming a clear watershed (boundary) at the meeting point.
[0133] Specifically, the pixel points corresponding to the non-zero label values are used as seed points (minimum values), and then water spreads outward from all seed points to fill the entire second flotation foam image. When the water flows from different seed points meet, a watershed is formed at the junction, and the watershed is the segmentation boundary of different areas. The principles in the algorithm implementation are as follows:
[0134] For each pixel point where the water flows, the distance between the pixel point and each seed point is determined, and the pixel point is assigned to the seed point closest to it. If the distance between a pixel point and two or more seed points is the same, it means that the pixel point is a boundary point, then the pixel point is marked as a boundary point, and all boundary points form a watershed (segmentation boundary).
[0135] Then, in the target label map, the initial label value corresponding to the boundary point is updated to the fourth label value (for example, -1), so that the final target label map contains both the boundary area of each bubble and the foreground area of each bubble. Therefore, each bubble can be segmented according to the updated target label map to obtain the outline of each flotation bubble, and then the outline of each flotation bubble is added to the original foam image to complete the segmentation of the original flotation foam image. The final segmented image is as follows: Fig.10 shown.
[0136] In the present invention, the original flotation foam image is first preprocessed to effectively remove the noise in the original image and reduce the influence of the image edge bright spots on the extraction of internal marks. Based on the clustering method, the image grayscale can be classified according to the differences between the image grayscales. The internal marks of the foam image are extracted through clustering optimization, and accurate segmentation marks are provided for the subsequent watershed segmentation algorithm, thereby ensuring the accuracy of the watershed segmentation algorithm in segmenting each foam contour, thereby ensuring the flotation accuracy.
[0137] Based on the same inventive concept as in the above-mentioned embodiment, this embodiment also provides a flotation foam image segmentation electronic device, such as Fig.11 As shown, the device comprises:
[0138] A preprocessing unit 111 is used to preprocess the original flotation foam image to obtain a first flotation foam image;
[0139] A clustering processing unit 112 performs clustering processing on the first flotation foam image based on a clustering algorithm to obtain an internal marking area, and processes the first flotation foam image after the clustering processing based on the internal marking area to obtain a second flotation foam image;
[0140] A reconstruction unit 113 is used to reconstruct the second flotation foam image to obtain a grayscale reconstructed image; and extract an unknown area of the second flotation foam image according to the second flotation foam image and the grayscale reconstructed image;
[0141] A marking unit 114, configured to mark the eight connected domains and unknown regions of the second flotation foam image to obtain a target marking map;
[0142] The segmentation unit 115 is used to segment the second flotation foam image by using the target marking image as a marking point of a watershed segmentation algorithm to obtain the outline of each flotation foam, and add the outline of each flotation foam to the original foam image to complete the segmentation of the original flotation foam image.
[0143] Since the electronic device introduced in the embodiment of the present invention is a device used to implement the flotation foam image segmentation method of the embodiment of the present invention, based on the method introduced in the embodiment of the present invention, the person skilled in the art can understand the specific structure and deformation of the device, so it is not repeated here. All devices used in the method of the embodiment of the present invention belong to the scope of protection of the present invention.
[0144] 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, wherein the processor implements any step of the method described above when executing the computer program.
[0145] Based on the same inventive concept, this embodiment provides a computer-readable storage medium on which a computer program is stored. When the computer program is executed by a processor, the steps of any of the methods described above are implemented.
[0146] Through one or more embodiments of the present invention, the present invention has the following beneficial effects or advantages:
[0147] The present invention provides a flotation foam image segmentation method, device, medium and equipment, the method comprising: preprocessing an original flotation foam image to obtain a first flotation foam image; clustering the first flotation foam image based on a clustering algorithm to obtain an internal marking area, and processing the first flotation foam image after clustering based on the internal marking area to obtain a second flotation foam image; reconstructing the second flotation foam image to obtain a grayscale reconstructed image; extracting an unknown area of the second flotation foam image according to the second flotation foam image and the grayscale reconstructed image; marking the second flotation foam image with eight connected domains and unknown areas to obtain a target marking map; and The marked image is used as the marking point of the watershed segmentation algorithm to segment the second flotation foam image, and the outline of each flotation foam is obtained. The outline of each flotation foam is added to the original foam image to complete the segmentation of the original flotation foam image. In this way, the original flotation foam image is preprocessed first to effectively remove the noise in the original image and reduce the influence of the bright spots on the edge of the image on the extraction of internal marks. The clustering method is based on the differences between the grayscales of the image, and the image grayscale can be classified into different categories. The internal marks of the foam image are extracted through clustering optimization, which provides accurate segmentation marks for the subsequent watershed segmentation algorithm, thereby ensuring the accuracy of the watershed segmentation algorithm in segmenting each foam outline, thereby ensuring the flotation accuracy.
[0148] The algorithm and display provided herein are not inherently related to any particular computer, virtual system or other device. Various general purpose systems can also be used together with the teachings based on this. According to the above description, it is obvious that the structure required for constructing such systems. In addition, the present invention is not directed to any specific programming language either. It should be understood that various programming languages can be utilized to realize the content of the present invention described herein, and the description of the above specific languages is for disclosing the best mode of the present invention.
[0149] In the description provided herein, a large number of specific details are described. However, it is understood that embodiments of the present invention can be practiced without these specific details. In some instances, well-known methods, structures and techniques are not shown in detail so as not to obscure the understanding of this description.
[0150] Similarly, it should be understood that in order to streamline the present disclosure and aid in understanding one or more of the various inventive aspects, in the above description of exemplary embodiments of the present invention, various features of the present invention are sometimes grouped together into a single embodiment, figure, or description thereof. However, this disclosed method should not be interpreted as reflecting the intention that the claimed invention requires more features than those explicitly recited in each claim. More specifically, as reflected in the claims below, inventive aspects lie in less than all the features of the individual embodiments disclosed above. Therefore, the claims that follow the specific embodiment are hereby expressly incorporated into the specific embodiment, with each claim itself serving as a separate embodiment of the present invention.
[0151] Those skilled in the art will appreciate that the modules in the devices in the embodiments may be adaptively changed and arranged in one or more devices different from the embodiments. The modules or units or components in the embodiments may be combined into one module or unit or component, and in addition they may be divided into a plurality of submodules or subunits or subcomponents. Except that at least some of such features and / or processes or units are mutually exclusive, all features disclosed in this specification (including the accompanying claims, abstracts and drawings) and all processes or units of any method or device disclosed in this manner may be combined in any combination. Unless otherwise expressly stated, each feature disclosed in this specification (including the accompanying claims, abstracts and drawings) may be replaced by an alternative feature providing the same, equivalent or similar purpose.
[0152] In addition, those skilled in the art will appreciate that, although some embodiments herein include certain features included in other embodiments but not other features, the combination of features of different embodiments is meant to be within the scope of the present invention and form different embodiments. For example, in the claims below, any one of the claimed embodiments may be used in any combination.
[0153] The various component embodiments of the present invention may be implemented in hardware, or in software modules running on one or more processors, or in a combination thereof. It should be understood by those skilled in the art that a microprocessor or digital signal processor (DSP) may be used in practice to implement some or all functions of some or all components of a gateway, proxy electronic device, or system according to an embodiment of the present invention. The present invention may also be implemented as a device or apparatus program (e.g., a computer program and a computer program product) for executing part or all of the methods described herein. Such a program implementing the present invention may be stored on a computer-readable medium, or may be in the form of one or more signals. Such a signal may be downloaded from an Internet website, or provided on a carrier signal, or provided in any other form.
[0154] It should be noted that the above embodiments illustrate the present invention rather than limit it, and that those skilled in the art may devise alternative embodiments without departing from the scope of the appended claims. In the claims, any reference symbol between brackets shall not be construed as a limitation on the claims. The word "comprising" does not exclude the presence of elements or steps not listed in the claims. The word "one" or "an" preceding an element does not exclude the presence of a plurality of such elements. The present invention may be implemented by means of hardware comprising a number of different elements and by means of a suitably programmed computer. In a unit claim enumerating a number of devices, several of these devices may be embodied by the same hardware item. The use of the words first, second, and third, etc., does not indicate any order. These words may be interpreted as names.
[0155] Although the preferred embodiments of the present invention have been described, those skilled in the art may make other changes and modifications to these embodiments once they have learned the basic creative concept. Therefore, the appended claims are intended to be interpreted as including the preferred embodiments and all changes and modifications that fall within the scope of the present invention.
[0156] The above description is only a preferred embodiment of the present invention and is not intended to limit the protection scope of the present invention. Any modifications, equivalent substitutions and improvements made within the spirit and principles of the present invention should be included in the protection scope of the present invention.
Claims
1. A flotation foam image segmentation method, characterized in that: Applied in an electronic device, the method comprises: Preprocessing the original flotation foam image to obtain a first flotation foam image; Performing clustering processing on the first flotation foam image based on a clustering algorithm to obtain an internal marking area, and processing the clustered first flotation foam image based on the internal marking area to obtain a second flotation foam image; Reconstructing the second flotation foam image to obtain a grayscale reconstructed image; extracting an unknown area of the second flotation foam image according to the second flotation foam image and the grayscale reconstructed image; Marking the second flotation foam image by eight-connected domains and unknown regions to obtain a target marking map; The target marker image is used as a marker point of a watershed segmentation algorithm to segment the second flotation foam image to obtain the outline of each flotation foam, and the outline of each flotation foam is added to the original foam image to complete the segmentation of the original flotation foam image.
2. The method according to claim 1, characterized in that The preprocessing of the original flotation foam image to obtain the first flotation foam image includes: Preprocessing the original flotation foam image once using a finite contrast adaptive histogram equalization algorithm to obtain a first preprocessed image; Using a preset cascade filter to filter the preprocessed image to obtain a second preprocessed image; The second preprocessed image is sequentially subjected to erosion, dilation and opening operations to obtain the first flotation froth image.
3. The method according to claim 1, characterized in that The clustering algorithm is used to perform clustering processing on the first flotation foam image to obtain an internal marking area, including: In the current iteration, the membership of each pixel in the first flotation foam image to the k classes is determined, and the initial membership matrix is updated according to the membership of each pixel to the k classes to obtain an updated membership matrix; a 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 previous iteration is less than or equal to a preset threshold, the iteration is stopped, and the cluster centers of the preset number of clusters are output; clustering the first flotation foam image into corresponding pixel regions based on the cluster center; The area with the largest grayscale value in the pixel area is determined as the internal marking area.
4. The method according to claim 1, characterized in that The step of processing the first flotation foam image after clustering based on the internal marked area to obtain a second flotation foam image includes: The first flotation foam image after clustering is subjected to threshold binarization segmentation based on the internal marked area to obtain a binarized image; the binarized image is the second flotation foam image.
5. The method according to claim 1, characterized in that The step of reconstructing the second flotation foam image to obtain a grayscale reconstructed image includes: performing a negation operation on the grayscale value of each pixel of the second flotation foam image to obtain a negated image; Performing a distance transformation operation on the inverted image to obtain a distance image; Grayscale processing is performed on the distance image to obtain the grayscale reconstructed image.
6. The method according to claim 1, characterized in that The step of labeling the second flotation foam image with eight connected domains and unknown regions to obtain a target labeling map includes: creating an initial label image, the size of the initial label image being the same as the size of the second flotation froth image; Traversing each pixel point of the second flotation foam image, for any current pixel point, if it is determined that the current pixel point is a foreground pixel point and it is determined that the current pixel point has not been marked, then the current pixel point is determined as the current connected domain mark, and the initial mark value corresponding to the current pixel point in the initial mark map is updated to the first label value; checking the eight neighboring pixel points of the current pixel point, if it is determined that the eight neighboring pixel points are all the foreground pixel points and it is determined that the eight neighboring pixel points have not been marked, then the initial mark value corresponding to the neighboring pixel point in the initial mark map is updated to the first label value; When it is determined that all the pixels in the current connected domain have been marked, continue to search for the next connected domain, and update the initial label values corresponding to all the pixels in the next connected domain to the second label value in the initial label map until all the foreground pixels have been marked; In the initial labeling map, the initial labeling value corresponding to the unknown area is updated to a third label value, and the labeled initial labeling map is determined as the target labeling map.
7. The method according to claim 1, characterized in that The target marker image is used as a marker point of a watershed segmentation algorithm to segment the second flotation foam image to obtain the contours of each flotation foam, including: Each non-zero label value in the target label map is used as a seed point, water is injected based on the seed point, and when water flows from different seed points meet, a watershed formed by the meeting is obtained, and the watershed is determined as a segmentation boundary; The target label map is updated according to the determined segmentation boundary, and the initial label value of the pixel point located on the segmentation boundary in the target label map is updated to a fourth label value, where the fourth label value is a negative number; The contour of each flotation froth in the second flotation froth image is extracted based on the updated target label map.
8. An electronic device for flotation foam image segmentation, characterized in that: The electronic device comprises: A preprocessing unit, used for preprocessing the original flotation foam image to obtain a first flotation foam image; a clustering processing unit, which performs clustering processing on the first flotation foam image based on a clustering algorithm to obtain an internal marking area, and processes the first flotation foam image after the clustering processing based on the internal marking area to obtain a second flotation foam image; a reconstruction unit, configured to reconstruct the second flotation foam image to obtain a grayscale reconstructed image; and extract an unknown region of the second flotation foam image according to the second flotation foam image and the grayscale reconstructed image; a marking unit, used for marking eight connected domains and unknown regions of the second flotation foam image to obtain a target marking map; The segmentation unit is used to segment the second flotation foam image by using the target marking image as a marking point of a watershed segmentation algorithm to obtain the outline of each flotation foam, and 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 having a computer program stored thereon, characterized in that: When the program is executed by a processor, the steps of the method according to any one of claims 1 to 7 are implemented.
10. A computer device comprising a memory, a processor and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the program, the steps of the method according to any one of claims 1 to 7 are implemented.
Citation Information
Cited By
Method and electronic device for flotation foam image segmentation, medium, and device
WO2026076883A1