Image processing method, floc imaging method and camera system

By performing foreground and background segmentation and connecting domain segmentation of alum flower image, alum flower feature information is extracted, and the problem of inaccurate alum flower feature information in the prior art is solved, and precise control of flocculant dosage is achieved.

CN119784788BActive Publication Date: 2025-06-24HANGZHOU HIKVISION DIGITAL TECHNOLOGY CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202510247930.5
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-03-04
Publication Date
2025-06-24
Estimated Expiration
2045-03-04

AI Technical Summary

Technical Problem

The prior art is difficult to accurately determine the characteristic information of alum flower, resulting in inaccurate control of the dosage of flocculant.

Method used

By segmenting the foreground and background of the alum flower image, a binary image is obtained, and then the foreground area in the binary image is segmented in the connected domain, and each alum flower is extracted to determine its characteristic information.

Benefits of technology

The accurate extraction of the characteristic information of alum flower is achieved, the control accuracy of flocculant is improved, and the problem of poor flocculation effect caused by inaccurate control is avoided.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119784788B_ABST
    Figure CN119784788B_ABST
Patent Text Reader

Abstract

An embodiment of the present application provides an image processing method, a floc imaging method, and a camera system. By performing foreground and background segmentation processing on a floc image to obtain a binary image, and performing connected component segmentation on the floc region in the binary image, each floc can be extracted from the floc image, so as to more accurately determine the characteristic information of the floc. When performing connected component segmentation, the connected component of each pixel point can be determined based on the connected components to which the adjacent pixel points of each pixel point in the traversed pixel points belong. And when each pixel point belonging to the foreground region is traversed, it can be first determined whether the number of the currently segmented connected components is greater than a preset number threshold. If it is greater, the segmented connected components are first integrated, and then the connected component to which the currently traversed pixel point belongs is determined based on the connected components to which the adjacent pixel points belong after the integration processing, thereby improving the efficiency of connected component segmentation and reducing the memory overhead during the connected component segmentation process.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of image processing technology. Specifically, it relates to an image processing method, a floc imaging method, and a camera system. Background Art

[0002] In the water treatment process of waterworks, alum flocculants are usually used to coagulate impurities in water, so that colloidal particles and tiny suspended solids that are not easily precipitated in water form larger flocs for separation and precipitation from water. These flocs are generally called flocs. Usually, based on characteristic information such as the size and morphological structure of the flocs, the quality of the flocculation effect after adding alum flocculants can be evaluated, so as to control the dosage of the flocculant based on the flocculation effect. In the related art, the determined characteristic information of the flocs is not accurate enough, and thus the flocculation effect obtained based on this characteristic information is also inaccurate, resulting in the inability to accurately control the dosage of the flocculant based on the floc characteristics information. Therefore, it is necessary to provide a solution that can accurately determine the characteristic information of the flocs. Summary of the Invention

[0003] In view of this, the present application provides an image processing method, a floc imaging method, and a camera system.

[0004] According to the first aspect of the present application, a floc image processing method is provided. The method includes:

[0005] Obtain a floc image to be processed;

[0006] Determine the foreground region and the background region in the floc image to obtain a binary image;

[0007] Perform connected component segmentation on the foreground region in the binary image, and regard each connected component obtained by the segmentation as a floc to determine the characteristic information of the flocs in the floc image;

[0008] Among them, the process of performing connected component segmentation on the foreground region in the binary image is as follows:

[0009] Traverse the pixel points in the binary image. For the pixel point belonging to the foreground region that is currently traversed, perform the following operations:

[0010] Determine whether the number of connected components that have been segmented currently is greater than a preset number threshold;

[0011] If not, determine the connected component to which the pixel point belongs based on the connected components to which the adjacent pixel points of the pixel point among the pixel points that have been traversed belong;

[0012] If so, merge the connected regions with a connection relationship among the currently segmented connected regions, and after performing the merging operation, determine the connected region to which the adjacent pixel belongs, and determine the connected region to which the pixel belongs based on the connected region to which the adjacent pixel belongs.

[0013] According to a second aspect of the present application, there is provided a floc imaging method, the method comprising:

[0014] Configure a camera system, the camera system includes a camera, a black backplane, and a fill light, wherein the camera and the black backplane are arranged in sequence, the window of the camera has a first gap from the black backplane, the area defined by the first gap is illuminated by the fill light, and a flocculation tank with flocs is arranged in the area defined by the first gap;

[0015] The camera is used to collect an image of the flocs in the first gap, obtain a floc image, determine a foreground region and a background region in the floc image, obtain a binary image, perform connected region segmentation on the foreground region in the binary image, and use each segmented connected region as a floc to determine the characteristic information of the flocs in the floc image; wherein, the process of performing connected region segmentation on the foreground region in the binary image is as follows:

[0016] Traverse the pixel points in the binary image, and for the currently traversed pixel point belonging to the foreground region, perform the following operations:

[0017] Determine whether the number of currently segmented connected regions is greater than a preset number threshold;

[0018] If not, determine the connected region to which the pixel belongs based on the connected regions to which the adjacent pixel points of the pixel among the traversed pixel points belong;

[0019] If so, merge the connected regions with a connection relationship among the currently segmented connected regions, and after performing the merging operation, determine the connected region to which the adjacent pixel belongs, and determine the connected region to which the pixel belongs based on the connected region to which the adjacent pixel belongs.

[0020] According to a third aspect of the present application, there is provided a camera system, the camera system includes a camera, a black backplane, and a fill light, wherein the camera and the black backplane are arranged in sequence, the window of the camera has a first gap from the black backplane, the area defined by the first gap is illuminated by the fill light, and a flocculation tank with flocs is arranged in the area defined by the first gap;

[0021] The camera is used to collect images of the flocs in the first gap, obtain floc images, determine the foreground area and the background area in the floc images to obtain binary images, perform connected component segmentation on the foreground area in the binary images, and use each segmented connected component as a floc to determine the characteristic information of the flocs in the floc images;

[0022] Among them, the process of performing connected component segmentation on the foreground area in the binary image is as follows:

[0023] Traverse the pixel points in the binary image. For the currently traversed pixel point belonging to the foreground area, perform the following operations:

[0024] Determine whether the number of currently segmented connected components is greater than a preset number threshold;

[0025] If not, determine the connected component to which the pixel point belongs based on the connected components to which the adjacent pixel points of the pixel point among the already traversed pixel points belong;

[0026] If so, perform a merging process on the connected components with a connection relationship among the currently segmented connected components, and determine the connected component to which the adjacent pixel point belongs after performing the merging process, and determine the connected component to which the pixel point belongs based on the connected component to which the adjacent pixel point belongs.

[0027] According to the fourth aspect of the present application, there is provided an electronic device, which includes a processor, a memory, and a computer program stored in the memory and executable by the processor. When the processor executes the computer program, the method mentioned in the first aspect above is implemented.

[0028] According to the fifth aspect of the present application, there is provided a computer program product, which includes a computer program. When the computer program is executed, the method mentioned in the first aspect above is implemented.

[0029] According to the sixth aspect of the present application, there is provided a computer-readable storage medium, on which a computer program is stored. When the computer program is executed, the method mentioned in the first aspect above is implemented.

[0030] Applying the solution provided by this application, by performing foreground and background segmentation on the floc image, a binary image is obtained, and then the connected component segmentation is performed on the floc region in the binary image, so that each floc can be extracted from the floc image to more accurately determine the characteristic information of the floc. At the same time, when performing connected component segmentation, the connected component of each pixel point can be determined based on the connected components to which the adjacent pixel points of each pixel point in the traversed pixel points belong, which can improve the processing efficiency. And when each pixel point belonging to the foreground region is traversed, it can be first determined whether the number of the connected components obtained by segmentation is greater than the preset number threshold. If it is greater, the segmented connected components are first integrated, and then the connected component to which the current traversed pixel point belongs is determined based on the connected components to which the adjacent pixel points belong after the integration processing, so that the connected component segmentation efficiency can be improved and excessive memory overhead can be avoided during the connected component segmentation process.

[0031] It should be understood that the above general description and the following detailed description are only exemplary and explanatory, and cannot limit this specification. Description of the Drawings

[0032] In order to more clearly illustrate the technical solutions in the embodiments of this application, the following will briefly introduce the drawings required for the description of the embodiments. Obviously, the following drawings are only some embodiments of this application. For those of ordinary skill in the art, other drawings can be obtained based on these drawings without creative efforts.

[0033] Figure 1 It is a flowchart of an image processing method according to an embodiment of this application.

[0034] Figure 2 It is a schematic diagram of performing connected component segmentation on a binary image according to an embodiment of this application.

[0035] Figure 3 It is a schematic diagram of performing connected component segmentation on a binary image according to an embodiment of this application.

[0036] Figure 4 It is a schematic diagram of collecting a floc image according to an embodiment of this application.

[0037] Figure 5 It is a schematic diagram of collecting a floc image according to another embodiment of this application.

[0038] Figure 6 It is a schematic diagram of each floc extracted from the image according to another embodiment of this application.

[0039] Figure 7 It is a schematic diagram of the logical structure of an electronic device according to an embodiment of this application. Detailed Embodiments

[0040] Next, the technical solutions in the embodiments of the present application will be clearly and completely described in conjunction with the accompanying drawings in the embodiments of the present application. Obviously, the described embodiments are only a part of the embodiments of the present application, rather than all the embodiments. All other embodiments obtained by those of ordinary skill in the art based on the embodiments in the present application without creative efforts belong to the scope of protection of the present application.

[0041] In the water treatment process of waterworks, alum flocculants are usually used to coagulate impurities in water, so that the colloids and tiny suspended solids that are not easily precipitated in water form larger flocs, so as to be separated and precipitated from the water. These flocs are generally called alum flowers. Usually, based on the characteristic information such as the size and morphological structure of the alum flowers, the quality of the flocculation effect after adding alum flocculants can be evaluated, so as to control the dosage of the flocculants based on the flocculation effect. In the prior art, usually, the size, morphological structure and other characteristics of the alum flowers are judged manually, and then the quality of the flocculation effect is judged. However, this method relies too much on manual experience, cannot unify the evaluation criteria, and has low efficiency.

[0042] There are also technologies that can collect alum flower images through underwater camera devices, and then use contour detection algorithms to detect the contours of alum flowers from the alum flower images, and determine the characteristics of the alum flowers based on the contours. However, this algorithm cannot accurately separate each alum flower, and the extracted contour may be the contour of a pile of alum flowers, and the characteristics of the alum flowers determined thereby are also inaccurate, and the flocculation effect cannot be accurately determined based on the characteristics of the alum flowers.

[0043] Based on this, the present application comes up with the idea that in order to better count the characteristic information of alum flowers, each alum flower can be extracted from the alum flower image first, and then the characteristic information of the alum flowers can be determined based on the regions corresponding to each extracted alum flower in the image, so as to evaluate the quality of the flocculation effect based on this characteristic information. Specifically, when extracting alum flowers, the foreground region and the background region of the alum flower image can be segmented to obtain a binary image, and then the foreground region (i.e., the alum flower region) in the binary image can be subjected to connected component segmentation processing, and each connected component obtained by segmentation is used as an alum flower.

[0044] In addition, considering that the number of flocs in the floc image is often large, using existing techniques for connected component segmentation of images, such as depth-first search (DFS) or breadth-first search (BFS), will result in large memory overhead and low processing efficiency. Based on this, the present application proposes a new connected component segmentation scheme based on the characteristics of the floc image, which can traverse the pixel points in the binary image. For the pixel points belonging to the foreground region currently traversed, the connected component of the pixel point can be determined based on the connected components to which the adjacent pixel points of the pixel point belong among the already traversed pixel points. Since when determining the connected component to which each pixel point belongs, only the adjacent pixel points of the current pixel point are considered, compared with the method of searching pixel points recursively in the DFS technique (the DFS technique starts from a pixel and visits the neighbor pixels connected to the current pixel one by one until no more adjacent pixels can be visited, and then backtracks to the previous pixel to continue the exploration), the recursive overhead can be avoided. In addition, since each pixel point determines the connected component to which it belongs only based on the connected components to which the already traversed adjacent pixels belong, there may be a situation where some pixel points belonging to the same connected component are split into two or more connected components. Therefore, it is necessary to perform a second traversal of the binary image to integrate these connected components. Specifically, considering that the number of flocs in the floc image is often large, and the connected component to which each pixel point belongs is determined only based on the connected components to which the already traversed adjacent pixel points belong, it will result in pixel points belonging to the same connected component being split into two or more connected components, resulting in a large number of determined connected components and large memory overhead. To reduce the memory overhead, when each pixel point belonging to the foreground region is traversed, it can first be determined whether the number of already segmented connected components exceeds a preset number threshold. If it exceeds, the connected components segmented from the already traversed region can be integrated first, and then the connected component of the current pixel point can be determined based on the integrated connected components. In this way, it is possible to avoid occupying a large amount of memory overhead due to an excessive number of determined connected components.

[0045] Based on the above inventive concept, the present application provides an image processing method, as Figure 1 shown, the method may include the following steps:

[0046] S102. Obtain a floc image to be processed;

[0047] In step S102, a floc image to be processed can be obtained, where the floc image can be obtained by an underwater camera device arranged in a flocculation tank to collect images of the flocs in the flocculation tank.

[0048] S104. Determine the foreground region and the background region in the floc image to obtain a binary image;

[0049] In step S104, after obtaining the floc image, the foreground region and the background region in the floc image can be segmented to obtain a binary image. For example, the pixel points with a pixel value of 1 in the binary image represent flocs, and the pixel points with a pixel value of 0 represent the background.

[0050] Among them, there are various ways to segment the foreground region and the background region in the floc image. For example, in some embodiments, threshold segmentation can be used to determine the foreground region and the background region in the floc image. For example, the maximum inter-class variance algorithm can be used to perform foreground and background segmentation on the floc image. The principle of the maximum inter-class variance algorithm is as follows: Since the image pixel values are between 0 and 255, the inter-class variance can be calculated sequentially for each brightness as the segmentation threshold by traversing, and the threshold with the maximum inter-class variance is used as the optimal threshold, and the foreground region and the background region in the image are determined based on this optimal threshold.

[0051] Of course, in some scenarios, a pre-trained neural network can also be used to segment the foreground region and the background region of the floc image to determine whether each pixel point in the floc image belongs to the foreground or the background.

[0052] S106. Perform connected component segmentation on the foreground region in the binary image, and regard each segmented connected component as a floc to determine the characteristic information of the flocs in the floc image;

[0053] Among them, the process of performing connected component segmentation on the foreground region in the binary image is as follows: Traverse the pixel points in the binary image. For the pixel points belonging to the foreground region that are currently traversed, perform the following operations: Determine whether the number of connected components that have been segmented currently is greater than a preset number threshold; if not, determine the connected component to which the pixel point belongs based on the connected components to which the adjacent pixel points of the pixel point among the traversed pixel points belong; if so, perform a merging process on the connected components with a connection relationship among the currently segmented connected components, and determine the connected component to which the adjacent pixel point belongs after performing the merging process, and determine the connected component to which the pixel point belongs based on the connected component to which the adjacent pixel point belongs.

[0054] In step S106, after obtaining the binary image, connected component segmentation processing can be performed on the foreground region (i.e., the floc region) in the binary image, and each segmented connected component is regarded as a floc.

[0055] Among them, in order to improve the processing efficiency of connected component segmentation and reduce the memory overhead during the segmentation process, the embodiment of the present application provides a segmentation scheme of secondary scanning. That is, the first scan can be used to traverse each pixel point in the image, and determine the connected component of the pixel point based on the connected component to which the pixel points adjacent to the currently traversed pixel point belonging to the foreground region among the already traversed pixel points belong. Since only the adjacent pixel points of the current pixel point are considered during the first scan, there may be some connected regions that are segmented into two or more connected components in this way of segmentation. For example, as Figure 2 shown, assuming that the pixel points in the binary image are traversed in the order from left to right and from top to bottom, for the currently traversed pixel point belonging to the foreground region, the connected component to which the left or upper pixel point of this pixel point belongs can be used as the connected component to which this pixel point belongs. Assuming that the connected component with a larger label is selected as the connected component of the current pixel point, the labels of the connected components to which each pixel point belongs are as shown by the serial numbers in the upper right corner of each pixel point in Figure 2 . It can be seen from the figure that there are some pixel points belonging to the foreground region that are originally connected. However, since only the connected components to which the left and upper pixel points of each pixel point belong are considered when determining the connected component to which each pixel point belongs, these originally connected pixel points are segmented into two connected components. For example, in the area enclosed by the red circle in the figure, these three pixel points originally belonged to the same connected component but were segmented into two connected components.

[0056] To address the above problems, the connected components obtained through the first scan can be integrated through a second scan. Considering that the number of flocs is often large, and during the first scan, regions that originally belonged to one connected component may be split into two connected components, that is, the number of determined connected components is often extremely large. During the process of splitting connected components, since it is necessary to store the marks of each connected component (information used to identify the connected component, such as the label of the connected component), the connectivity relationships between connected components (usually, a connectivity relationship table can be used to record the connectivity relationships. When the number of connected components is too large, the relationship table is very complex and occupies a large amount of memory), etc. To avoid occupying too much memory, the steps of integrating connected components through the second scan can be alternated with the first scan. For example, during the first scan, when each foreground region pixel point is traversed, it can first be determined whether the number of currently split connected components is greater than a preset quantity threshold. Here, the preset quantity threshold can be determined based on the memory space provided by the image processing device for storing the marks of connected components and the connectivity relationships between connected components. If the number of currently split connected components is less than the preset quantity threshold, it indicates that the current memory can still store more marks of connected components and the connectivity relationships between connected components. Therefore, based on the connected components to which the adjacent pixel points of this pixel point belong among the traversed pixel points, the connected component to which this pixel point belongs can be determined. For example, assuming that the binary image is traversed in the order from left to right and from top to bottom, for each current pixel point, the traversed pixel points adjacent to this pixel point are the pixel points on the left and above this pixel point. Thus, based on the connected components to which these two determined pixel points belong, the connected component of the current pixel point can be determined. After determining the connected component to which this pixel point belongs, the next pixel point of this pixel point can be traversed, and the above process can be repeated.

[0057] Of course, if the number of currently split connected components is greater than the preset quantity threshold, it indicates that the current memory can no longer store more connectivity relationships of connected components. At this time, to reduce the memory overhead, the connected components with connectivity relationships among the currently split connected components can be merged first (that is, the process of the second scan is executed), and after the merge processing operation, the connected components to which the adjacent pixel points of the current pixel point belong are determined, and the connected component to which this pixel point belongs is determined based on the connected components to which the adjacent pixel points belong. In this way, the timing of the second scan can be dynamically adjusted based on the current memory space of the image processing device, which can ensure that during the process of splitting connected components, too much memory is not occupied, the memory overhead is reduced, and the efficiency of splitting connected components can be improved.

[0058] Among them, during the process of traversing the binary image, considering that only the foreground region needs to be processed for connected component splitting, the pixel points belonging to the background region that are traversed can be skipped directly.

[0059] Of course, when traversing a binary image, the specific traversal order can be set based on actual needs. For example, it can be traversed in the order from left to right and top to bottom, or in the order from right to left and bottom to top. The embodiments of the present application do not make any restrictions.

[0060] Through the method provided by the embodiments of the present application, by performing foreground and background segmentation processing on the floc image, a binary image is obtained, and then connected component segmentation processing is performed on the floc region in the binary image, so that each floc can be extracted from the floc image to more accurately determine the characteristic information of the floc. At the same time, when performing connected component segmentation, the connected component to which the pixel point belongs can be determined based on the connected components to which the adjacent pixel points of each pixel point in the already traversed pixel points belong, which can improve the processing efficiency. And when each pixel point belonging to the foreground region is traversed, it can be first determined whether the number of the already segmented connected components is greater than a preset number threshold. If it is greater, the segmented connected components are first integrated, and then the connected component to which the current traversed pixel point belongs is determined based on the connected components to which the adjacent pixel points after the integration belong, so that the connected component segmentation efficiency can be improved and excessive memory overhead can be avoided during the connected component segmentation process.

[0061] In some embodiments, when determining the connected component to which the pixel point belongs based on the connected components to which the adjacent pixel points of the pixel point in the already traversed pixel points belong, if all the adjacent pixel points of the pixel point belong to the background region, it means that the pixel point is not connected to the already traversed adjacent pixel points. Therefore, a new connected component can be created and the newly created connected component is used as the connected component to which the pixel point belongs. For example, as Figure 3 shown, for the pixel point selected by the circular frame, since the pixel points on its left and upper sides are both background regions, a new connected component ④ can be created and it is determined that the pixel point belongs to the connected component ④.

[0062] In some embodiments, if only one of the adjacent pixel points of the pixel point belongs to the foreground region, the connected component to which the adjacent pixel point belonging to the foreground region belongs is used as the connected component to which the pixel point belongs. For example, taking the pixel points in the binary image traversed in the order from left to right and top to bottom as an example, the already traversed pixel points adjacent to the pixel point are the pixel points on the left and upper sides of the pixel point. If the left pixel point is the background, the connected component to which the upper pixel point belongs is directly used as the connected component to which the pixel point belongs.

[0063] In some embodiments, if at least two of the adjacent pixel points of the pixel point belong to the foreground region, a target adjacent pixel point is selected from the adjacent pixel points belonging to the foreground region, and the connected component to which the target adjacent pixel point belongs is used as the connected component to which the pixel point belongs.

[0064] In some embodiments, the label of the connected component to which the target adjacent pixel belongs is greater than the labels of the connected components to which the other pixels among the adjacent pixels belonging to the foreground region belong. That is, the connected component with the largest label among the connected components to which the adjacent pixels belong can be selected as the connected component to which the current pixel belongs.

[0065] In some embodiments, the label of the connected component to which the target adjacent pixel belongs is less than the labels of the connected components to which the other pixels among the adjacent pixels belonging to the foreground region belong. That is, the connected component with the smallest label among the connected components to which the adjacent pixels belong can be selected as the connected component to which the current pixel belongs.

[0066] In some embodiments, the connectivity relationship between the segmented connected components is recorded in a connectivity relationship table. After determining the connected component to which the pixel belongs based on the connected components to which the adjacent pixels of the pixel among the traversed pixels belong, the method further includes: if the connected component to which the pixel belongs is a newly created connected component, a new data record is added to the connectivity relationship table, and this data record is used to indicate that the newly created connected component is the source connected component.

[0067] For example, taking the traversal of the pixels in a binary image in the order from left to right and from top to bottom as an example, the traversed pixels adjacent to this pixel are the pixels on the left and above of this pixel. If the pixels on the left and above of this pixel are both background regions, a new connected component can be newly created, and it is determined that the connected component to which this pixel belongs is the newly created connected component. Since the newly created connected component is not connected to the previously determined connected components, a new data record can be added to the connectivity relationship table, and this data record is used to indicate that the newly created connected component is the source connected component, and the source connected component is the connected component that is not connected to the previously determined connected components. For example, assuming that the label of the newly created connected component is A, a new data record can be added: hashmap[A]=O, indicating that this connected component is the source connected component.

[0068] In some embodiments, the connectivity relationship between the segmented connected components is recorded in a connectivity relationship table. After determining the connected component to which the pixel belongs based on the connected components to which the adjacent pixels of the pixel among the traversed pixels belong, the method further includes: if the connected component to which the pixel belongs is the connected component to which the above-mentioned target adjacent pixel belongs, and the connected component labels of the connected components to which at least two adjacent pixels belonging to the foreground region belong are different, one or more new data records are added to the connectivity relationship table, and these data records are used to indicate that the connected components to which at least two adjacent pixels belonging to the foreground region belong are connected.

[0069] For example, taking the traversal of pixel points in a binary image in the order from left to right and top to bottom as an example, the traversed pixel points adjacent to the pixel point are the pixel points on the left and above the pixel point. If the pixel point above the pixel point belongs to connected component 3 and the pixel point on the left of the pixel point belongs to connected component 4, it can be determined that the pixel point belongs to connected component 4. Since connected component 3 and connected component 4 are connected, at this time, a new data record can be added to the connectivity relationship table, and this data record is used to indicate that connected component 3 and connected component 4 are connected. For example, a new data record can be added: hashmap[4]=3, indicating that connected component 4 is connected to connected component 3.

[0070] In some embodiments, since the data records in the connectivity relationship table of connected components are updated in the manner mentioned above, that is, if a certain connected component is not connected to any of the connected components determined before this connected component, then this connected component is the source connected component. And, only the connectivity relationships between a certain connected component and its adjacent connected components determined before it are recorded in the connectivity relationship table. Therefore, when merging the connected components with connectivity relationships among the currently segmented connected components, for any currently segmented connected component, the data records in the connectivity relationship table can be recursively searched to determine the source connected component connected to this connected component, and the connected component label of this connected component is updated using the connected component label of the source connected component; after the connected component labels of all connected components are updated, the connected components with the same connected component label are merged into one connected component.

[0071] In some embodiments, the connectivity relationships between the segmented connected components are recorded in the connectivity relationship table. For each segmented connected component, there is at least one data record corresponding to this connected component in the connectivity relationship table. This data record is used to indicate that this connected component is the source connected component, or this data record is used to indicate that this connected component is connected to one of its adjacent connected components among the connected components determined before this connected component. Among them, if this connected component is not connected to all the connected components determined before this connected component, then this connected component is the source connected component. Since only the connectivity relationships between a certain connected component and its adjacent connected components are recorded in the connectivity relationship table, it is necessary to determine the source connected component connected to this connected component by means of recursive search. For example, when merging the connected components with connectivity relationships among the currently segmented connected components, for any currently segmented connected component, the data records in the connectivity relationship table can be recursively searched to determine the source connected component connected to this connected component, and the connected component label of this connected component is updated using the connected component label of the source connected component; after the connected component labels of all connected components are updated, the connected components with the same connected component label are merged into one connected component. Of course, if a certain connected component itself is the source connected component, there is no need to perform the above recursive search process.

[0072] For example, assume that the connectivity relation table determined based on the currently traversed binary image includes the following data records:

[0073] hashmap[1]=O, hashmap[2]=O, hashmap[3]=1, hashmap[4]=3, hashmap[5]=4, hashmap[6]=O…

[0074] Among them, hashmap[N]=O indicates that the connected domain N is the source connected domain, and hashmap[N1]=N2 indicates that the connected domain N2 is connected to the connected domain N1.

[0075] When performing the merging process on the currently segmented connected domains, for each connected domain, if the connected domain is the source connected domain, there is no need to update its connected domain label. If the connected domain is a non-source connected domain, the source connected domain connected to this connected domain can be determined through recursive search. For example, for the connected domain 5, through recursive search, it can be determined that the source connected domain connected to it is the connected domain 1. Therefore, its connected domain label can be updated to 1. The same applies to the connected domains 4 and 3. It is determined that the connected domain connected to them is the connected domain 1. Therefore, their connected domain labels are updated to 1. Then, the connected domains with the same connected domain label can be merged. For example, the connected domains 1, 3, 4, and 5 are merged into one connected domain. After completing the connected domain merging, the connected domain labels can be updated again to make the connected domain labels continuous.

[0076] Considering that the flocs (i.e., alum flowers) formed after the flocculant adsorbs impurities in water usually have overlapping and adhesion phenomena. In order to more accurately extract each alum flower, the alum flowers with at least partial overlap in the alum flower image can be separated first to avoid the extracted alum flower being obtained by overlapping multiple alum flowers, and thus the feature information such as the size of the determined alum flower is inaccurate. Therefore, in some embodiments, before determining the foreground region and background region of the alum flower image to obtain a binary image, a morphological operation can be performed on the alum flower image to separate the alum flowers with at least partial overlap in the alum flower image, where the morphological operation includes an erosion operation and a dilation operation. Then, the foreground region and background region of the alum flower image can be determined based on the image after performing the morphological operation to obtain a binary image.

[0077] In some embodiments, considering that the floc images collected by the underwater camera device usually have a lot of noise, in order to avoid misidentifying the noise as small-sized flocs subsequently, before extracting the flocs from the image, the floc image can be denoised first. For example, before determining the foreground area and background area of the floc image to obtain a binary image, the floc image can be denoised first, and then the foreground and background of the denoised floc image can be segmented to obtain a binary image. Among them, the specific denoising method can include various types. For example, the median filtering method can be used to denoise the floc image.

[0078] In the related art, when collecting floc images, usually an underwater camera device is placed in the flocculation tank, and the underwater camera device is used to collect floc images. Due to the distortion problem of near-large and far-small in underwater camera device photography, the flocs in the floc image will be distorted to varying degrees, and thus the size of the flocs determined based on the floc image is not very accurate. In order to more accurately determine the size of the flocs, in some embodiments, as Figure 4 shown, when using the underwater camera device placed in the flocculation tank to collect images of the flocs, a black backboard can be placed in front of the lens of the underwater camera device in the flocculation tank (i.e., the position directly facing the photographing direction of the underwater camera device). The black backboard can cover the photographing field of view of the underwater camera device. And in order to avoid inaccurate floc size in the floc image caused by the distortion problem of near-large and far-small in the underwater camera device, the distance between the underwater camera device and the black backboard does not exceed a preset distance. A channel can be formed between the black backboard and the underwater camera device, and the underwater camera device can be used to collect images of the flocs in the channel to obtain floc images. In the embodiments of the present application, by setting a black backboard in front of the underwater camera device, the contrast of the collected floc images can be improved, which is convenient for subsequent foreground-background segmentation and floc extraction. And the distance between the black backboard and the underwater camera device can be controlled so that the distance between the flocs in the collected floc images and the underwater camera device is controlled within a certain range, which can reduce distortion, so as to obtain a more accurate floc size based on the floc image.

[0079] In addition, due to the relatively dim underwater light, the collected floc images often have poor effects. In some embodiments, a supplementary light can be set on at least one side of the channel formed between the underwater camera device and the black background. The supplementary light can be used to supplement light to the flocs in the channel. The channel is illuminated by the supplementary light, and then the underwater camera device can be used to collect images of the flocs in the channel, which can improve the brightness of the shooting area and obtain floc images with better effects. As Figure 5 shown, a supplementary light can be set on each side of the channel to supplement light to the flocs in the channel.

[0080] In the related art, when determining the physical size of flocs in a floc image, a scale with a known size is usually used to determine the physical size of the flocs. For example, assuming the actual size of the scale is L1, the number of corresponding pixels of the scale in the floc image is N1, and for any floc in the floc image, the number of corresponding pixels of the floc in the floc image is N2, then the physical size L2 of the floc is L2 = L1 * N2 / N1. Similarly, due to the distortion problem of near-large and far-small of the underwater camera device, for the flocs in the same depth plane as the scale, the size of the flocs can be accurately determined using the above calculation formula. However, for the flocs in different depth planes from the above scale, due to the distortion, the size of the flocs determined using the above formula is not accurate.

[0081] Considering the embodiments of the present application, since a black backboard is provided at a certain distance from the underwater camera device, that is, the object distance is known, and then the size of the flocs can be determined based on the optical parameters of the underwater camera device and the object distance to obtain a more accurate size of the flocs. In some embodiments, the characteristic information of the flocs may include the physical size of each floc. When determining the physical size of each floc, the physical size corresponding to each pixel in the floc image can be determined based on the distance between the black backboard and the underwater camera device and the optical parameters of the underwater camera device. Then, based on the number of pixels occupied by each floc in the floc image and the physical size corresponding to each pixel, the physical size of each floc can be obtained.

[0082] The following introduces the floc image processing method of the present application in combination with a specific solution, and the specific process is as follows:

[0083] 1. Acquisition of floc images

[0084] Floc detection is usually carried out in the sedimentation tank of a water treatment plant. How to acquire reliable floc images in this environment is the premise for subsequent floc extraction and feature analysis. This solution proposes a collection method, and the specific structure is as Figure 5 shown. A black background board is placed 2 cm away from the front glass of the underwater camera, and fill lights are arranged on both sides of the formed gap, and the flocs pass through this gap. By arranging a black background board at a certain distance in front of the underwater camera, this method can solve the problem of incorrect estimation of the floc size due to the near-large and far-small characteristics when flocs appear at different distances within the camera's field of view. In addition, by setting the background as a pure black backboard, the contrast of the flocs in the image can be improved, and the accuracy of foreground and background segmentation of the floc image can be improved.

[0085] 2. Extract each floc from the floc image

[0086] (1) Separate the overlapping flocs in the floc image

[0087] First, filter the noise in the floc image and separate the overlapping flocs through morphological filtering. Specifically, first use a 3×3 median filter to filter the dot noise existing in the image to avoid misidentifying the noise as small-scale flocs later; use a 5×5 rectangular window as the structuring element for the opening operation to separate the overlapping or adjacent flocs from each other. The opening operation can be expressed as,

[0088]

[0089] where A is the input image and B is the structuring element, represents the opening operation, represents the erosion operation, represents the dilation operation, represents the maximum filter (i.e., setting the current pixel value to the maximum pixel value in the neighborhood), represents the minimum filter (i.e., setting the current pixel value to the minimum pixel value in the neighborhood).

[0090] (2) Perform foreground and background region segmentation on the floc image to obtain a binary image

[0091] Distinguish the background from the flocs through threshold segmentation. The method for determining the threshold is to maximize the between-class variance. Specifically, if all the pixels of the image are divided into two categories, the background and the flocs, by this threshold, the between-class variance of the two categories of pixels should be the largest. Since the pixel values of the image are between 0 and 255, the between-class variance can be calculated sequentially for each brightness as the segmentation threshold through a traversal method, and the threshold with the maximum between-class variance is used as the optimal threshold.

[0092] (3) Perform connected component segmentation on the foreground region in the binary image to obtain each floc in the floc image

[0093] First, create a connected component counter count, a connected relationship table hashmap, and a connected component label image label. Among them, the connected component counter count is used to record the label of the latest connected component; the connected relationship table hashmap is used to record the connected relationships between connected components. For example, if connected components A and B are connected, then hashmap[B]=A. If connected components B and C are connected, then hashmap[C]=B. Further, the connection between connected component C and A can be found through hashmap; in addition, if connected component D is the source connected component, that is, it is not connected to the connected components determined before this connected component, then hashmap[D]=O; the connected label image is used to record the label of the connected component to which each pixel belongs.

[0094] Initialize the connected component counter to 2, initialize the entire connected relationship table to 0, and initialize the entire connected label image to 0.

[0095] The process of one scan is as follows:

[0096] Traverse all the pixels of the binary image from left to right and from top to bottom. If the pixel is a floc, perform the following steps; if the pixel is the background, skip this traversal.

[0097] When traversing to each pixel point, first determine whether the current number of connected components exceeds the upper limit. If it exceeds, perform a secondary scan on the traversed image area to integrate the connected components. If the number of connected components still exceeds the upper limit after integration, exit abnormally; otherwise, perform the following traversal content.

[0098] Among them, the following traversal content is to determine the connected component label of the current pixel by judging the connected component labels of the pixels on the left and above the current pixel, and update the connected component relationship table and the connected component counter. The connected component labels of the left and above pixels can be divided into four cases: a) If both the left and above labels are 0, increase the connected component counter (assume the label is 3), use it as the connected component label of the current pixel, and update the connection relationship table, such as adding a new data record (hash[3]=1); b) If the label on the left or above is 0, or the two are the same, assign the larger of the two labels to the current pixel and update the connection relationship table; c) If the above label is less than the left label, set the current pixel label to be the same as the left one, and update the connected label relationship table to connect the above and left labels, such as adding a new data record (hash[connected component label of the left pixel]=connected component label of the above pixel); d) If the left label is less than the above label, set the current pixel label to be the same as the above one, and update the connection relationship table to connect the left and above labels, such as adding a new data record (hash[connected component label of the left pixel]=connected component label of the above pixel).

[0099] The process of the secondary scan is as follows:

[0100] In the secondary scan, introduce the source label, the first-level label, and the empty label. Their definitions are hashmap[source label]=O, hashmap[first-level label]=source label, hashmap[empty label]=0. Among them, if a certain label is not connected to any previously determined label, then this label is the source label. If a certain label is connected to a previously determined label, then this label is the first-level label, and the connected component labels of the background pixel points are all empty labels.

[0101] Update the connection relationship table hashmap through self-recursive search so that it only contains the source label and the empty label. For example, for any first-level label, through recursive search, the source label corresponding to this first-level label can be determined, and this first-level label can be updated to this source label.

[0102] For example, assume that hashmap[1]=O, hashmap[2]=O, hashmap[3]=1, hashmap[4]=3, hashmap[5]=4, hashmap[6]=O…

[0103] Among them, the labels 1, 2, and 6 are source labels, and the labels 3, 4, and 5 are first-level labels, which are determined by recursive search. The source labels corresponding to the labels 3, 4, and 5 are 1. Therefore, the labels 3, 4, and 5 can be updated to 1.

[0104] (3)According to the updated hashmap, search and update the connected label graph label so that the connected label graph only contains source labels and empty labels.

[0105] Count the total number of source labels, that is, the number of current connected components. For example, in the above example, there are 3 source labels, that is, including 3 connected components.

[0106] The above optimized secondary scanning method can extract the complete area of the floc compared with the contour detection method. Even if multiple flocs overlap with each other, the adhered flocs can be segmented from each other through morphological filtering processing, improving the accuracy of floc extraction. In addition, compared with other scanning methods such as depth-first search (DFS), the optimized secondary scanning method only needs two traversals, and each traversal only needs to access each pixel once, and the time complexity is only O(N), avoiding recursive overhead, and introducing a mechanism for integrating the connected relationship table between two scans, solving the problem of excessive memory occupation of the connected relationship record table. Through the above method, the result of floc extraction is as Figure 6 shown, and the areas with different brightness are one floc.

[0107] 3. Determination of floc size

[0108] After the above floc segmentation and recognition algorithm, the number of pixels occupied by each floc in the image is extracted, but the number of pixels does not belong to the standard unit, which is not conducive to the normalized analysis of floc characteristics. In this method, a method for calculating the physical size of flocs based on camera optical parameters is proposed, and the specific process is as follows:

[0109]

[0110] Among them, u represents the object distance, v represents the image distance, f represents the focal length, N represents the number of occupied pixels, and d represents the pixel size. Using the above formula, by inputting the number of pixels N occupied by the floc and the camera optical parameters, the physical diameter of the floc (i.e., the object-side height) can be calculated.

[0111] Among them, the solutions of the above embodiments can be freely combined to obtain new solutions without conflict. Due to space limitations, they will not be listed one by one here.

[0112] In addition, an embodiment of the present application further provides a floc imaging method, and the method includes:

[0113] Configure a camera system, the camera system includes a camera, a black backplane, and a fill light. Among them, the camera and the black backplane are arranged in sequence, the window of the camera has a first gap from the black backplane, the area defined by the first gap is illuminated by the fill light, and a flocculation tank with flocs is arranged in the area defined by the first gap;

[0114] The camera is used to collect images of the flocs in the first gap to obtain floc images, determine the foreground area and the background area in the floc images to obtain binary images, perform connected component segmentation on the foreground area in the binary images, and use each connected component obtained by the segmentation as a floc to determine the characteristic information of the flocs in the floc images; among them, the process of performing connected component segmentation on the foreground area in the binary images is as follows:

[0115] Traverse the pixel points in the binary image, and for the pixel points belonging to the foreground area that are currently traversed, perform the following operations:

[0116] Determine whether the number of connected components that have been segmented currently is greater than a preset number threshold;

[0117] If not, determine the connected component to which the pixel point belongs based on the connected components to which the adjacent pixel points of the pixel point among the pixel points that have been traversed belong;

[0118] If so, perform a merging process on the connected components that have a connection relationship among the connected components that have been segmented currently, and determine the connected component to which the adjacent pixel point belongs after performing the merging process operation, and determine the connected component to which the pixel point belongs based on the connected component to which the adjacent pixel point belongs.

[0119] Among them, the specific process of the camera for extracting flocs from the floc images to obtain each floc can refer to the description in the above embodiments and will not be elaborated here.

[0120] In addition, an embodiment of the present application further provides a camera system, the camera system includes a camera, a black backplane, and a fill light. Among them, the camera and the black backplane are arranged in sequence, the window of the camera has a first gap from the black backplane, the area defined by the first gap is illuminated by the fill light, and a flocculation tank with flocs is arranged in the area defined by the first gap;

[0121] The camera is used to collect images of the flocs in the first gap, obtain floc images, determine the foreground area and background area in the floc images, obtain binary images, perform connected component segmentation on the foreground area in the binary images, and use each segmented connected component as a floc to determine the characteristic information of the flocs in the floc images;

[0122] Among them, the process of performing connected component segmentation on the foreground area in the binary image is as follows:

[0123] Traverse the pixel points in the binary image. For the currently traversed pixel point belonging to the foreground area, perform the following operations:

[0124] Determine whether the number of currently segmented connected components is greater than a preset number threshold;

[0125] If not, determine the connected component to which the pixel point belongs based on the connected components to which the adjacent pixel points of the pixel point among the already traversed pixel points belong;

[0126] If so, perform a merging process on the connected components with a connection relationship among the currently segmented connected components, and after performing the merging process operation, determine the connected component to which the adjacent pixel point belongs, and determine the connected component to which the pixel point belongs based on the connected component to which the adjacent pixel point belongs.

[0127] Among them, the specific process of the camera for extracting flocs from the floc images to obtain each floc can refer to the description in the above embodiments and will not be elaborated here.

[0128] In addition, an embodiment of the present disclosure also provides a computer program product, which includes a computer program. When the computer program is executed, it implements the method mentioned in any of the above embodiments.

[0129] An embodiment of the present disclosure also provides an electronic device, as Figure 7 shown. The electronic device 70 includes a processor 71, a memory 72, and computer instructions stored on the memory 72. When the processor 71 executes the computer instructions, it implements the method mentioned in any of the above embodiments.

[0130] Correspondingly, an embodiment of this specification also provides a computer storage medium, in which a program is stored. When the program is executed by a processor, it implements the method in any of the above embodiments.

[0131] An embodiment of this specification can adopt a computer program product implemented on one or more storage media (including but not limited to disk memories, CD-ROMs, optical memories, etc.) containing program codes

[0132] The form. Computer-usable storage media include permanent and non-permanent, removable and non-removable media, and information storage can be implemented by any method or technology. The information can be computer-readable instructions, data structures, program modules, or other data. Examples of computer storage media include, but are not limited to: phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technologies, compact disc read-only memory (CD-ROM), digital versatile disc (DVD) or other optical storage, magnetic cassette tapes, disk storage or other magnetic storage devices, or any other non-transmission medium that can be used to store information accessible by a computing device.

[0133] For the device embodiments, since they basically correspond to the method embodiments, the relevant parts can be referred to the descriptions of the method embodiments. The device embodiments described above are only illustrative. The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed to multiple network units. Some or all of the modules can be selected according to actual needs to achieve the purpose of the solution of this embodiment. A person of ordinary skill in the art can understand and implement it without creative work.

[0134] The user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data for analysis, stored data, displayed data, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties. And the collection, use, and processing of relevant data need to comply with the relevant laws, regulations, and standards of relevant countries and regions, and corresponding operation entrances are provided for users to choose to authorize or refuse.

[0135] It should be noted that in this article, relational terms such as first and second are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any actual relationship or order between these entities or operations. The term "comprising", "including" or any other variant thereof is intended to cover non-exclusive inclusion, so that a process, method, article or device comprising a series of elements not only includes those elements, but also includes other elements not expressly listed, or further includes elements inherent to such process, method, article or device. Without further limitation, the element defined by the statement "comprising an..." does not exclude the existence of additional identical elements in the process, method, article or device comprising the element.

[0136] The methods and devices provided by the embodiments of the present invention have been introduced in detail above. Specific examples are used in this article to elaborate on the principles and implementation manners of the present invention. The description of the above embodiments is only used to help understand the method and its core idea of the present invention; at the same time, for those of ordinary skill in the art, according to the idea of the present invention, there will be changes in the specific implementation manners and application scopes. In summary, the content of this specification should not be construed as a limitation to the present invention.

Claims

1. A method for processing alum flower image, characterized in that: The method comprises: Acquire the alum flower image to be processed; Determine the foreground area and the background area in the alum flower image to obtain a binary image; Performing connected domain segmentation on the foreground area in the binary image, and taking each connected domain obtained by the segmentation as an alum flower, so as to determine the characteristic information of the alum flower in the alum flower image; The process of performing connected domain segmentation on the foreground area in the binary image is as follows: The pixels in the binary image are traversed, and the following operations are performed for the currently traversed pixels belonging to the foreground area: Determine whether the number of connected domains currently segmented is greater than a preset number threshold; if not, determine the connected domain to which the pixel belongs based on the connected domains to which the neighboring pixels of the pixel belong among the traversed pixels; If yes, then merging the connected domains that have a connectivity relationship in the currently segmented connected domains, and determining the connected domain to which the adjacent pixel point belongs after performing the merging operation, and determining the connected domain to which the pixel point belongs based on the connected domains to which the adjacent pixel point belongs; The connectivity relationship between the segmented connected domains is recorded in a connectivity relationship table. For each segmented connected domain, the connectivity relationship table includes at least one data record corresponding to the connected domain, the data record is used to indicate that the connected domain is a source connected domain, or the data record is used to indicate that the connected domain is connected to an adjacent connected domain of the connected domain in the connected domains determined before the connected domain, wherein if the connected domain is not connected to all the connected domains determined before the connected domain, the connected domain is the source connected domain; The merging of the connected domains having a connected relationship in the currently segmented connected domains includes: For any connected domain currently segmented, recursively search the data records in the connectivity relationship table to determine the source connected domain connected to the connected domain, and update the data records in the connectivity relationship table, wherein the updated data records are used to indicate that the segmented connected domain is the source connected domain, or that the segmented connected domain is connected to one of the source connected domains; Based on the updated connectivity relationship table, the connected domain labels of the divided connected domains are updated, wherein, for a non-source connected domain, the connected domain label of the non-source connected domain is updated using the connected domain label of the source connected domain connected to the non-source connected domain; After the connected domain labels of the connected domains are updated, the connected domains with the same connected domain labels are merged into one connected domain.

2. The method according to claim 1, characterized in that The step of determining the connected domain to which the pixel point belongs based on the connected domain to which the adjacent pixels of the pixel point in the traversed pixels belong includes: If the adjacent pixels all belong to the background area, re-create a connected domain, and use the re-created connected domain as the connected domain to which the pixel belongs; and / or If only one of the adjacent pixel points belongs to the foreground area, the connected domain to which the adjacent pixel point belonging to the foreground area belongs is used as the connected domain to which the pixel point belongs; and / or If there are at least two adjacent pixel points belonging to the foreground area among the adjacent pixel points, a target adjacent pixel point is selected from the adjacent pixel points belonging to the foreground area, and the connected domain to which the target adjacent pixel point belongs is used as the connected domain to which the pixel point belongs; wherein the target adjacent pixel point is the pixel point with the largest connected domain label among the adjacent pixel points belonging to the foreground area, or the target adjacent pixel point is the pixel point with the smallest connected domain label among the adjacent pixel points belonging to the foreground area.

3. The method according to claim 2, characterized in that The connectivity relationship between the segmented connected domains is recorded in a connectivity relationship table. After determining the connected domain to which the pixel point belongs based on the connected domain to which the adjacent pixel points of the pixel point belong among the traversed pixel points, the method further includes: If the connected domain to which the pixel point belongs is a newly created connected domain, then a new data record is added to the connectivity relationship table, and the data record is used to indicate that the newly created connected domain is the source connected domain; and / or If the connected domain to which the pixel point belongs is the connected domain to which the target adjacent pixel point belongs, and the connected domain labels of the connected domains to which the at least two adjacent pixel points belonging to the foreground area belong are different, then one or more data records are added to the connectivity relationship table, and the data records are used to indicate that the connected domains to which the at least two adjacent pixel points belonging to the foreground area belong are connected.

4. The method according to claim 1, characterized in that: Before determining the foreground area and background area of ​​the alum flower image to obtain a binary image, the method further includes: performing a morphological operation on the alum flower image to separate the alum flowers that are at least partially overlapped in the alum flower image; wherein the morphological operation includes an erosion operation and a dilation operation; the determining the foreground area and background area of ​​the alum flower image to obtain a binary image includes: determining the foreground area and background area of ​​the alum flower image based on the image after the morphological operation to obtain a binary image; and / or Before determining the foreground area and background area of ​​the alum flower image to obtain a binary image, the method also includes: denoising the alum flower image; determining the foreground area and background area of ​​the alum flower image to obtain a binary image includes: determining the foreground area and the background area based on the alum flower image obtained by denoising to obtain a binary image.

5. The method according to claim 1, characterized in that The alum flower image is acquired by an underwater camera device disposed in a flocculation tank, wherein a black back plate is disposed in front of the lens of the underwater camera device in the flocculation tank, and the alum flower image is acquired by the underwater camera device by acquiring an image of the alum flower in a channel formed between the underwater camera device and the black back plate, wherein the distance between the black back plate and the underwater camera device does not exceed a preset distance.

6. The method according to claim 5, characterized in that A fill light is provided on at least one side of the channel formed between the underwater camera device and the black back plate, and the fill light is used to fill light on the alum flowers in the channel; and / or The characteristic information of the alum flower includes the physical size of each alum flower, and the physical size of each alum flower is determined based on the following method: the physical size corresponding to each pixel in the alum flower image is determined based on the distance between the underwater camera device and the black backplate and the optical parameters of the underwater camera device; the physical size of each alum flower is obtained based on the number of pixels occupied by each alum flower in the alum flower image and the physical size corresponding to each pixel.

7. A method for imaging alum flowers, characterized in that: The method comprises: A camera system is configured, the camera system comprising a camera, a black back plate and a fill light, wherein the camera and the black back plate are arranged in sequence, a first gap is formed between the camera window and the black back plate, an area defined by the first gap is illuminated by the fill light, and a flocculation pool with alum flowers is arranged in the area defined by the first gap; The camera is used to capture the image of the alum flowers in the first gap to obtain an alum flower image, determine the foreground area and the background area in the alum flower image to obtain a binary image, perform connected domain segmentation on the foreground area in the binary image, and use each connected domain obtained by segmentation as an alum flower to determine the characteristic information of the alum flowers in the alum flower image; wherein the process of performing connected domain segmentation on the foreground area in the binary image is as follows: The pixels in the binary image are traversed, and the following operations are performed for the currently traversed pixels belonging to the foreground area: Determine whether the number of connected domains currently segmented is greater than a preset number threshold; If not, then determining the connected domain to which the pixel point belongs based on the connected domains to which the neighboring pixels of the pixel point among the traversed pixels point belong; If yes, then merging the connected domains that have a connectivity relationship in the currently segmented connected domains, and determining the connected domain to which the adjacent pixel point belongs after performing the merging operation, and determining the connected domain to which the pixel point belongs based on the connected domains to which the adjacent pixel point belongs; The connectivity relationship between the segmented connected domains is recorded in a connectivity relationship table. For each segmented connected domain, the connectivity relationship table includes at least one data record corresponding to the connected domain, the data record is used to indicate that the connected domain is a source connected domain, or the data record is used to indicate that the connected domain is connected to an adjacent connected domain of the connected domain in the connected domains determined before the connected domain, wherein if the connected domain is not connected to all the connected domains determined before the connected domain, the connected domain is the source connected domain; The merging of the connected domains having a connected relationship in the currently segmented connected domains includes: For any connected domain currently segmented, recursively search the data records in the connectivity relationship table to determine the source connected domain connected to the connected domain, and update the data records in the connectivity relationship table, wherein the updated data records are used to indicate that the segmented connected domain is the source connected domain, or that the segmented connected domain is connected to one of the source connected domains; Based on the updated connectivity relationship table, the connected domain labels of the divided connected domains are updated, wherein, for a non-source connected domain, the connected domain label of the non-source connected domain is updated using the connected domain label of the source connected domain connected to the non-source connected domain; After the connected domain labels of the connected domains are updated, the connected domains with the same connected domain labels are merged into one connected domain.

8. A camera system, characterized in that: The camera system comprises a camera, a black back plate and a fill light, wherein the camera and the black back plate are arranged in sequence, a first gap is formed between the camera window and the black back plate, an area defined by the first gap is illuminated by the fill light, and a flocculation pool with alum flowers is arranged in the area defined by the first gap; The camera is used to collect images of the alum flowers in the first gap to obtain an alum flower image, determine the foreground area and the background area in the alum flower image to obtain a binary image, perform connected domain segmentation on the foreground area in the binary image, and use each connected domain obtained by segmentation as an alum flower to determine the characteristic information of the alum flowers in the alum flower image; The process of performing connected domain segmentation on the foreground area in the binary image is as follows: The pixels in the binary image are traversed, and the following operations are performed for the currently traversed pixels belonging to the foreground area: Determine whether the number of connected domains currently segmented is greater than a preset number threshold; If not, then determining the connected domain to which the pixel point belongs based on the connected domains to which the neighboring pixels of the pixel point among the traversed pixels point belong; If yes, then merging the connected domains that have a connectivity relationship in the currently segmented connected domains, and determining the connected domain to which the adjacent pixel point belongs after performing the merging operation, and determining the connected domain to which the pixel point belongs based on the connected domains to which the adjacent pixel point belongs; The connectivity relationship between the segmented connected domains is recorded in a connectivity relationship table. For each segmented connected domain, the connectivity relationship table includes at least one data record corresponding to the connected domain, the data record is used to indicate that the connected domain is a source connected domain, or the data record is used to indicate that the connected domain is connected to an adjacent connected domain of the connected domain in the connected domains determined before the connected domain, wherein if the connected domain is not connected to all the connected domains determined before the connected domain, the connected domain is the source connected domain; The merging of the connected domains having a connected relationship in the currently segmented connected domains includes: For any connected domain currently segmented, recursively search the data records in the connectivity relationship table to determine the source connected domain connected to the connected domain, and update the data records in the connectivity relationship table, wherein the updated data records are used to indicate that the segmented connected domain is the source connected domain, or that the segmented connected domain is connected to one of the source connected domains; Based on the updated connectivity relationship table, the connected domain labels of the divided connected domains are updated, wherein, for a non-source connected domain, the connected domain label of the non-source connected domain is updated using the connected domain label of the source connected domain connected to the non-source connected domain; After the connected domain labels of the connected domains are updated, the connected domains with the same connected domain labels are merged into one connected domain.

Citation Information

Patent Citations

  • Water treatment dosing control method and device based on alumen ustum detection

    CN116012701A