A method, device and storage medium for identifying microplastics
By performing three-color channel decomposition and image processing technology on microplastic pictures, the automatic identification and segmentation of microplastics is realized, solving the problems of low recognition efficiency and relying on artificial subjectivity in the existing technology, and improving the accuracy and speed of recognition sex.
Patent Information
- Application Number
- CN202210017080.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-01-07
- Publication Date
- 2025-02-07
- Estimated Expiration
- 2042-01-07
AI Technical Summary
The prior art has problems in microplastic monitoring with low identification efficiency, cumbersome processes and relying on manual subjectivity, making it difficult to achieve automated, precise and rapid microplastic identification.
By decomposing the microplastic image into three color channels: red, green and blue, image integration, mean calculation and binarization processing are performed, and the microplastic individuals are automatically identified and divided.
Automatic, reliable and efficient identification of microplastics in microplastic pictures is achieved, reducing manual intervention and improving the accuracy and rapidity of identification results.
Smart Images

Figure CN114359238B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of marine environment monitoring, and in particular to a method, device and storage medium for identifying microplastics. Background Art
[0002] Since the 1920s, researchers have begun to pay attention to microplastics. The commonly used definition of microplastics is: plastic fragments with a particle size of less than 5mm. So far, microplastic waste has been found in the Pacific Ocean, Indian Ocean, Atlantic Ocean, polar regions and deep sea. The impact of microplastics is wide-ranging, and the environmental problems they cause are becoming more and more prominent. Microplastics not only affect the photosynthesis of algae, but also cause physical damage to the digestive system, respiratory system, reproductive system and other organs of aquatic organisms. They can also absorb environmental persistent organic pollutants and organic heavy metals, release toxic substances carried or adsorbed by themselves, and cause more serious chemical toxicological damage.
[0003] In response to these issues, the Ministry of Ecology and Environment recently issued the "Outline of the Ecological Environmental Monitoring Plan (2020-2035)", which emphasized the need to strengthen marine microplastic monitoring and accelerate the formation of monitoring support capabilities in related fields to provide support for international compliance negotiations and the governance of global emerging environmental issues.
[0004] Due to differences in the physical properties (size, shape, density, color) and chemical composition of microplastics, the flow process (input, output and retention) of different types of microplastics in different environments is different, which makes microplastic monitoring a major problem. At present, the main analysis methods for microplastics include visual analysis, spectroscopy (such as Fourier transform infrared spectroscopy and Raman spectroscopy), thermal analysis, and other analysis methods (such as mass spectrometry and scanning electron microscope-energy spectrometer combination). Among them, infrared spectroscopy and Raman spectroscopy analysis have become the main analytical techniques for detecting and identifying microplastics due to their non-destructive, low sample volume testing, high-throughput screening, and complementary structural information obtained.
[0005] At present, visual analysis is usually used in laboratories to count microplastic individuals, particle size, and concentration. The general process is to manually classify the samples collected on site into different containers, use microscopic imaging to obtain photos of microplastics, manually count the microplastic individuals, measure the particle size, count the particle area, and obtain the concentration of microplastics in the water. The laboratory work is numerous and the cumbersome process brings a huge workload. Due to the huge differences in the morphology and size of microplastics, it is an urgent task to establish relatively unified and standardized microplastic sampling and analysis and operating procedures, innovate and improve the implementation methods and technical means of quantitative research on microplastics such as counting statistics and type identification, and ultimately improve the efficiency of research work. Summary of the invention
[0006] In order to overcome the above-mentioned technical problems, an embodiment of the present invention provides a method for identifying microplastics, comprising the following steps:
[0007] S1, decomposing the microplastic image into a first color channel, a second color channel, and a third color channel, obtaining a first grayscale image corresponding to the first color channel, a second grayscale image corresponding to the second color channel, and a third grayscale image corresponding to the third color channel;
[0008] S2, performing image integration on the first grayscale image, the second grayscale image and the third grayscale image respectively to obtain a corresponding first integral image, a second integral image and a third integral image;
[0009] S3, performing local area calculation on the first integral image, the second integral image and the third integral image respectively to obtain a corresponding first mean image, a second mean image and a third mean image;
[0010] S4, respectively comparing the first grayscale image with the first mean image, the second grayscale image with the second mean image, and the third grayscale image with the third mean image to obtain a first binary image corresponding to the first grayscale image, a second binary image corresponding to the second grayscale image, and a third binary image corresponding to the third grayscale image;
[0011] S5, performing a predetermined number of image opening operations on the first binary image, the second binary image, and the third binary image, respectively, to obtain a corresponding fourth binary image, a fifth binary image, and a sixth binary image;
[0012] S6, performing a logic AND operation on the fourth binary image, the fifth binary image and the sixth binary image, and identifying the microplastics present in the microplastic image according to a result matrix of the logic AND operation.
[0013] Furthermore, after step S6, the following steps are further included:
[0014] S7, marking the connected domains of the result matrix of the logical AND operation, and dividing the identified microplastics into different microplastic individuals, wherein pixels with the same connected domain marker are determined to belong to one microplastic individual, and different microplastic individuals have different connected domain markers.
[0015] Furthermore, after step S7, the method further includes: determining the number of microplastics present in the microplastic image according to the number of different connected domain markers.
[0016] Furthermore, after step S7, it also includes: for any one of the different microplastic individuals, according to the grayscale values of the pixel points corresponding to the microplastic individual in the first grayscale image, the second grayscale image and the third grayscale image, calculating the grayscale average value of the pixel points corresponding to the microplastic individual, and the grayscale average value represents the color of the microplastic individual.
[0017] Furthermore, after step S7, the method further includes: for any one of the different microplastic individuals, determining the number of pixels count contained in the microplastic individual according to the number of pixels contained in the same connected domain marker, and determining the area of the microplastic individual according to the following formula:
[0018] A=count×r×r
[0019] Wherein, r is the observation resolution of the microplastic image.
[0020] Furthermore, after step S7, the method further includes: for any one of the different microplastic individuals, performing edge detection on the microplastic individual using a Sobel operator, and obtaining the major axis and / or minor axis of the microplastic individual using ellipse fitting.
[0021] Furthermore, the step S4 determines the pixel values b of the corresponding binary image matrices in the first binary image, the second binary image and the third binary image according to the following formula:
[0022]
[0023] Wherein, t is a predetermined value less than 100 and greater than 0, g(i, j) is the corresponding pixel value of the original pixel point (i, j) in the first grayscale image, the second grayscale image or the third grayscale image, i, j are natural numbers, is the pixel value corresponding to the original pixel point (i, j) in the first mean map, the second mean map or the third mean map.
[0024] Furthermore, in step S6, the pixel points with a value of 0 in the result matrix of the logical AND operation are identified as microplastics, and the pixel points with a value of 1 are identified as not microplastics.
[0025] Further, the first color channel is a red channel, the second color channel is a green channel, and the third color channel is a blue channel.
[0026] On the other hand, a device for identifying microplastics is provided, comprising a memory and a processor, wherein the memory stores at least one program, and the at least one program is executed by the processor to implement the method for identifying microplastics as described above.
[0027] On the other hand, a computer-readable storage medium is provided, wherein at least one program is stored in the storage medium, and the at least one program is executed by the processor to implement the method for identifying microplastics as described above.
[0028] The technical solution of the present invention for identifying microplastics by using an image processing method can automatically, reliably and efficiently identify the microplastics present in the picture based on a three-color grayscale image without human-computer interaction after the researchers obtain the microplastic picture. The solution is simple and easy to implement, reduces the subjectivity of relying on manual identification of microplastics, and the identification result is accurate and reliable. Compared with the traditional visual method, the method has the advantages of automation, precision and rapidity, and can be widely used in microplastic monitoring research. And the further solution of the present invention can identify the morphological information such as the number, color, area, and / or long axis and / or short axis of the microplastic body in the picture, so that the microplastic characteristics can be jointly constructed from at least four angles of color, area, morphology and size as needed, meeting the needs of microplastic research. BRIEF DESCRIPTION OF THE DRAWINGS
[0029] Figure 1 A schematic diagram of a process for identifying microplastics according to an embodiment of the present invention;
[0030] Figure 2 A schematic flow chart of a method for identifying microplastics according to another embodiment of the present invention;
[0031] Figure 3 An example grayscale diagram of the red channel after three-color decomposition of the original image when using the method of an embodiment of the present invention to identify microplastics;
[0032] Figure 4 An example diagram of mean values corresponding to the grayscale image of the red channel after processing the grayscale data of the red channel when using the method of one embodiment of the present invention to identify microplastics;
[0033] Figure 5 A binary example image corresponding to a grayscale image of a red channel when using a method according to an embodiment of the present invention to identify microplastics;
[0034] Figure 6 When using the method of one embodiment of the present invention to identify microplastics, Figure 5 An example of the result obtained after 10 image opening operations are performed on the binary image shown in;
[0035] Figure 7An exemplary image obtained by performing a logical AND operation on the results of performing an image opening operation on the binary images corresponding to the three color channels when identifying microplastics using the method of an embodiment of the present invention;
[0036] Figure 8 This is an exemplary image obtained after connected domain labeling when identifying microplastics using the method of one embodiment of the present invention;
[0037] Fig. 9 This is an exemplary image obtained after edge detection of a microplastic body when identifying microplastics using the method of one embodiment of the present invention;
[0038] Fig.10 An exemplary image obtained by performing ellipse fitting on microplastic individuals after edge detection when identifying microplastics using the method of an embodiment of the present invention;
[0039] Fig.11 Schematic diagram of a device for identifying microplastics according to an embodiment of the present invention. DETAILED DESCRIPTION
[0040] To further illustrate the various embodiments, the present invention provides drawings. These drawings are part of the disclosure of the present invention, which are mainly used to illustrate the embodiments and can be used in conjunction with the relevant descriptions in the specification to explain the operating principles of the embodiments. With reference to these contents, a person of ordinary skill in the art should be able to understand other possible implementations and advantages of the present invention. The components in the figures are not drawn to scale, and similar component symbols are generally used to represent similar components.
[0041] The present invention will now be further described with reference to the accompanying drawings and specific implementation methods.
[0042] Embodiment 1:
[0043] Figure 1 FIG. 1 is a flow chart showing a method for identifying microplastics according to an embodiment of the present invention. Figure 1 The method for identifying microplastics according to an embodiment of the present invention comprises the following steps:
[0044] S1, decomposing the microplastic image into a first color channel, a second color channel and a third color channel, obtaining a first grayscale image corresponding to the first color channel, a second grayscale image corresponding to the second color channel and a third grayscale image corresponding to the third color channel; preferably, the first color channel is a red channel, the second color channel is a green channel, and the third color channel is a blue channel;
[0045] S2, performing image integration on the first grayscale image, the second grayscale image, and the third grayscale image, respectively, to obtain a corresponding first integral image, a second integral image, and a third integral image;
[0046] S3, performing local area calculation on the first integral image, the second integral image and the third integral image respectively to obtain a corresponding first mean image, a second mean image and a third mean image;
[0047] S4, respectively comparing the first grayscale image with the first mean image, the second grayscale image with the second mean image, and the third grayscale image with the third mean image to obtain a first binary image corresponding to the first grayscale image, a second binary image corresponding to the second grayscale image, and a third binary image corresponding to the third grayscale image;
[0048] S5, performing a predetermined number of image opening operations on the first binary image, the second binary image, and the third binary image, respectively, to obtain a corresponding fourth binary image, a fifth binary image, and a sixth binary image;
[0049] S6, performing a logical AND operation on the fourth binary image, the fifth binary image, and the sixth binary image, and identifying microplastics present in the microplastic image according to a result matrix of the logical AND operation.
[0050] Furthermore, after step S6, the method may also include: S7, marking the connected domain of the result matrix of the logical AND operation, dividing the identified microplastics into different microplastic individuals, wherein pixels with the same connected domain marker are determined to belong to one microplastic individual, and different microplastic individuals have different connected domain markers. Further, after step S7, the method may also include: determining the number of microplastics present in the microplastic image according to the number of different connected domain markers. Further, after step S7, the method may also include: for any one of the different microplastic individuals, calculating the grayscale average of the pixel points corresponding to the microplastic individual according to the grayscale values of the pixel points corresponding to the microplastic individual in the first grayscale image, the second grayscale image, and the third grayscale image, wherein the grayscale average represents the color of the microplastic individual. Further, after step S7, the method may also include: for any one of the different microplastic individuals, determining the number of pixel points count contained in the microplastic individual according to the number of pixel points contained in the same connected domain marker, and determining the area of the microplastic individual according to the following formula,
[0051] A=count×r×r
[0052] Wherein, r is the observation resolution of the microplastic image. Further, after step S7, the method may further include: for any microplastic individual among the different microplastic individuals, performing edge detection on the microplastic individual using a Sobel operator, and obtaining the major axis and / or minor axis of the microplastic individual using ellipse fitting.
[0053] Furthermore, the step S4 determines each pixel value b of the corresponding binary image matrix in the first binary image, the second binary image and the third binary image according to the following formula:
[0054]
[0055] Wherein, t is a predetermined value less than 100 and greater than 0, g(i, j) is the corresponding pixel value of the original pixel point (i, j) in the first grayscale image, the second grayscale image or the third grayscale image, i, j are natural numbers, is the pixel value corresponding to the original pixel point (i, j) in the first mean map, the second mean map or the third mean map. Further, in step S6, the pixel points with a value of 0 in the result matrix of the logical AND operation are identified as microplastics, and the pixel points with a value of 1 are identified as not microplastics.
[0056] Embodiment 2:
[0057] Figure 2 A flow chart of a method for identifying microplastics according to another embodiment of the present invention is shown. Figure 2 As shown, in another embodiment of the present invention, in the method for identifying microplastics, a microplastic picture is first obtained. Existing methods can be used to obtain microplastic pictures. For example, samples collected on site are simply classified into different vessels in an artificial manner, and then microplastic photos are obtained using microscopic imaging. The obtained microplastic photos are used as microplastic pictures processed by the method of this embodiment. Next, the microplastic picture can be decomposed into three parts: a red channel (r), a green channel (g), and a blue channel (b) using existing image processing tools, and grayscale images corresponding to the three color channels are obtained. The grayscale image corresponding to the red channel (r) can be called the first grayscale image, the grayscale image corresponding to the green channel (g) can be called the second grayscale image, and the grayscale image corresponding to the blue channel (b) can be called the third grayscale image. Each grayscale image is composed of a grayscale value matrix composed of the original grayscale values of the original pixel point (i, j). Wherein (i, j) indicates the position of the pixel point, that is, the position of the pixel point is the i-th row and the j-th column, i and j are natural numbers, and the pixel (i, j) is used to represent any pixel point in the image. Figure 3 An example of the grayscale of the red channel after three-color decomposition of the original image when identifying microplastics using the method of an embodiment of the present invention is given. Figure 1 An example of a grayscale image of the red channel. Figure 3 In the figure, the horizontal and left vertical data units are pixels, and the right vertical data indicates the pixel values represented by different colors.
[0058] The grayscale data of the three channels are processed by adaptive threshold algorithm by image integration and conversion into mean image. This adaptive threshold algorithm can solve the problem of being unable to identify microplastics due to the difference in light and dark in the picture. The specific steps are as follows: Get the integral image matrix. Integrate the grayscale values of all pixels before the pixel (i, j) to form an integral image matrix I. The calculation formula is as follows, where i, j, m, and n are all natural numbers:
[0059]
[0060] The above method is used to obtain the integral images corresponding to the grayscale image of the red channel, the grayscale image of the green channel, and the grayscale image of the blue channel, that is, the integral image matrix.
[0061] Then, a rectangular area of s×s is used to traverse the above integral image matrices, where s is an odd number and the pixel point (i, j) is the center of the rectangular area. The pixel value corresponding to any pixel point (i, j) in the corresponding mean image matrix M in each grayscale image is calculated according to the following formula: Can be used To indicate the pixel value of the center (i, j) of the rectangular area. Preferably, the value of s is 1 / 8 of the frame width.
[0062]
[0063] Through the above steps, the mean maps, that is, the mean images, corresponding to the grayscale images of the red channel, the green channel, and the blue channel are respectively obtained. Figure 4 When using the method of one embodiment of the present invention to identify microplastics, after processing the grayscale data of the red channel, an example graph of the mean value corresponding to the grayscale image of the red channel is provided. Figure 4 In the figure, the data units of the horizontal and left vertical directions are pixel numbers, and the data units of the right vertical direction are grayscale values ranging from 0 to 1.
[0064] Next, we determine whether the grayscale value of the pixel point of the three color channels is less than (1-t%) of the corresponding pixel value in the corresponding mean image, where t is a predetermined value less than 100 and greater than 0. According to the judgment results, we obtain the binary images corresponding to the three color channels, i.e., the binary images. If it is less than, the corresponding pixel point is marked as 0 in the binary image; otherwise, it is marked as 1. Specifically, the grayscale value g(i, j) corresponding to the original pixel point (i, j) in the grayscale image is compared with the pixel value corresponding to the position in the mean image matrix M, i.e., the pixel point The comparison can be made according to the following formula to determine whether the corresponding element value in the corresponding binary image matrix B, that is, the value of the pixel point b, is 0 or 1.
[0065]
[0066] Wherein, t is a predetermined value less than 100 and greater than 0, preferably, t=30. Figure 5 An example of a binary image obtained using the above method is given. Figure 5 In the figure, the data units of the horizontal and left vertical lines are pixel numbers, and the right vertical line is a grayscale value ranging from 0 to 1. This figure is a binary figure and only contains 0 and 1 values.
[0067] Then, the binary image B of the three color channels is opened a predetermined number of times. That is, B is first eroded and then expanded. The erosion is represented by the operator ⊙, and the expansion is represented by the operator Denotes, S is the structure matrix used. Preferably, 10 image opening operations are performed. Figure 6 An example of the result obtained after 10 image opening operations on the mean map corresponding to the red channel is shown. Exemplarily, the structure matrix S used is as follows,
[0068]
[0069] The binary image Br of the red channel, the binary image Bg of the green channel, and the binary image Bb of the blue channel obtained after the image opening operation are subjected to a logical "AND" operation, and the result matrix F obtained after the operation can be used to identify microplastics, that is, F = Br & Bg & Bb. Figure 7 When using the method of an embodiment of the present invention to identify microplastics, an exemplary image is obtained by performing a logical AND operation on the binary images corresponding to the three color channels after image opening operations are performed. In the matrix F, a value of 0 indicates that the pixel is identified as microplastic, and a value of 1 indicates that the pixel is not identified as microplastic. At this point, the method of an embodiment of the present invention is used to realize the identification of microplastics in microplastic images.
[0070] Further, the identified microplastics can be segmented using the method of the embodiment of the present invention, and the microplastics can be segmented into several microplastic individuals. Specifically, the connected domain marking processing method in image processing can be used to achieve the segmentation of microplastic individuals. Exemplarily, the segmentation step includes: traversing all pixel points in the matrix F, finding pixel points with a value of 1, and marking a connected domain marker at the same time. With this pixel point as the center, search for the 4 points around it to see if there is still a value of 1. If so, the existing pixel points with a value of 1 are also marked as the same marker. Exemplarily, for example, when the first pixel point with a value of 1 is found, this pixel point can be marked as 1, and the 4 points around it can be searched with this pixel point as the center to see if there is still a value of 1. If so, the existing pixel points with a value of 1 are also marked as 1. Continue searching and marking until there are no more pixel points with a value of 1 in the F array among the adjacent pixel points of the pixel point marked as 1. Continue searching and marking, and the next pixel point found, with a value of 1 in the F array, and no marker, can be marked as another marker, for example, the marker is 2. Continue to mark the four points around the pixel marked as 2 and the pixel points with a value of 1 in the F matrix as 2. Similar to the above, find all connected domains of the pixel marked as 2 and mark them all as 2. Mark other connected domains in a similar way. Among them, the pixel area containing the marker is the connected domain, and the pixel area not containing the marker is the non-connected domain. The connected domain with the same marker is identified as a microplastic individual. Different microplastic individuals have different connected domain markers. In this way, a marker matrix can be obtained. Figure 8 This is an exemplary image obtained after connected domain labeling when identifying microplastics using the method of an embodiment of the present invention. The number of microplastic individuals can be determined by counting the number of different markers. If the individual microplastics are labeled one by one according to natural numbers, the maximum number of labels in the labeling matrix is the total number of microplastics in the image. Figure 8 The number of medium and micro plastics is 19. Figure 8 In the figure, the data units in the horizontal direction and the left vertical direction are pixel numbers, and the vertical direction on the right indicates the label value of the connected domain.
[0071] It should be noted that other connected domain marking methods may also be used, such as a two-pass scanning method or a seed-filling method, and the present invention does not limit this.
[0072] The color information of microplastics can also be extracted using the method of the embodiment of the present invention. For example, the microplastic observation pixel points with the same marker i (i can be a natural number such as 1, 2, 3, 4) can be extracted from the marking matrix obtained after the above connected domain marking step, and the grayscale images of the red channel, green channel and blue channel obtained above are used to calculate the grayscale average of the pixel points corresponding to each color channel for the above microplastic observation pixel points with the same marker. This grayscale average represents the color information of the microplastic.
[0073] The area of microplastics can also be calculated using the method of the embodiment of the present invention. The area of all microplastics in the microplastic image is equal to the sum of the areas of all microplastic individuals. The area calculation of microplastic individuals specifically includes: using the marking matrix obtained from the connected domain marking step above to extract microplastic observation pixels with the same marker i (i can be a natural number such as 1, 2, 3, 4), counting the number of microplastic pixels with the marker count, and calculating the area A of the microplastic individual indicated by the marker based on the observation resolution r of the microplastic image (i.e., the length occupied by each pixel). The formula is as follows,
[0074] A=count×r×r
[0075] The method of the embodiment of the present invention can also be used to calculate the major axis and / or minor axis of the microplastic individual. The specific steps are to use the labeling matrix obtained in the above connected domain labeling step to extract the microplastic observation pixel points with the same label i (i = 1, 2, 3, 4...). Use edge detection to obtain the edge pixel points of the microplastic individual. Exemplarily, the sobel operator can be used for edge detection. Fig. 9 An exemplary image obtained after edge detection of a microplastic body when identifying microplastics using the method of an embodiment of the present invention. Fig. 9 In the figure, the data units of the horizontal and left vertical directions are pixel numbers, and the right vertical direction is a grayscale value with a range of 0-1. The figure is a binary figure and only contains values 0 and 1. After obtaining the edge position of the microplastic individual, the length of the major axis and minor axis pixels can be obtained by ellipse fitting. The length of the major axis is the length of the major axis pixel obtained by ellipse fitting multiplied by the image resolution. The length of the minor axis is the length of the minor axis pixel obtained by ellipse fitting multiplied by the image resolution. The area is the number of pixels multiplied by the square of the image resolution. The color is the average value of the red channel, green channel, and blue channel corresponding to the microplastic individual. Fig.10 This is an exemplary image obtained after ellipse fitting of microplastic individuals after edge detection. Combined with the observed image resolution, the actual lengths of the major and minor axes can be calculated. Fig.10 In the example, the obtained major axis length is 1.81 mm, the minor axis length is 1.51 mm, and the area is 2.05 mm.2 , the color is (129, 97, 71).
[0076] Embodiment three:
[0077] The present invention also provides a device for identifying microplastics, such as Fig.11 As shown, the device includes a processor 1101, a memory 1102, a bus 1103, and a computer program stored in the memory 1102 and executable on the processor 1101. The processor 1101 includes one or more processing cores. The memory 1102 is connected to the processor 1101 via the bus 1103. The memory 1102 is used to store program instructions. When the processor executes the computer program, the steps in the above method embodiment of the first embodiment of the present invention are implemented.
[0078] Further, as an executable solution, the device for identifying microplastics can be a computer unit, which can be a computing device such as a desktop computer, a notebook, a PDA, and a cloud server. The computer unit may include, but is not limited to, a processor and a memory. Those skilled in the art will understand that the composition structure of the above-mentioned computer unit is only an example of a computer unit and does not constitute a limitation on the computer unit. It may include more or less components than the above, or a combination of certain components, or different components. For example, the computer unit may also include input and output devices, network access devices, buses, etc., which are not limited in the embodiments of the present invention.
[0079] Further, as an executable solution, the processor may be a central processing unit (CPU), other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general-purpose processor may be a microprocessor or any conventional processor, etc. The processor is the control center of the computer unit, and various interfaces and lines are used to connect the various parts of the entire computer unit.
[0080] The memory can be used to store the computer program and / or module, and the processor realizes various functions of the computer unit by running or executing the computer program and / or module stored in the memory, and calling the data stored in the memory. The memory can mainly include a program storage area and a data storage area, wherein the program storage area can store an operating system and at least one application required for a function; the data storage area can store data created according to the use of the mobile phone, etc. In addition, the memory can include a high-speed random access memory, and can also include a non-volatile memory, such as a hard disk, a memory, a plug-in hard disk, a smart memory card (Smart Media Card, SMC), a secure digital (SecureDigital, SD) card, a flash card (Flash Card), at least one disk storage device, a flash memory device, or other volatile solid-state storage devices.
[0081] Embodiment 4:
[0082] The present invention also provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps of the above method in the embodiment of the present invention are implemented.
[0083] If the module / unit integrated in the computer unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the present invention implements all or part of the processes in the above-mentioned embodiment method, and can also be completed by instructing the relevant hardware through a computer program. The computer program can be stored in a computer-readable storage medium, and the computer program can implement the steps of the above-mentioned various method embodiments when executed by the processor. Among them, the computer program includes computer program code, and the computer program code can be in source code form, object code form, executable file or some intermediate form. The computer-readable medium may include: any entity or device capable of carrying the computer program code, recording medium, U disk, mobile hard disk, disk, optical disk, computer memory, read-only memory (ROM, Read-Onny Memory), random access memory (RAM, Random Access Memory) and software distribution medium, etc. It should be noted that the content contained in the computer-readable medium can be appropriately increased or decreased according to the requirements of legislation and patent practice in the jurisdiction.
[0084] Although the present invention has been specifically shown and described in conjunction with the preferred embodiments, it should be understood by those skilled in the art that various changes may be made to the present invention in form and details without departing from the spirit and scope of the present invention as defined by the appended claims, all of which are within the scope of protection of the present invention.
Claims
1. A method for identifying microplastics, characterized in that: The steps include: S1, decomposing the microplastic image into a first color channel, a second color channel, and a third color channel, obtaining a first grayscale image corresponding to the first color channel, a second grayscale image corresponding to the second color channel, and a third grayscale image corresponding to the third color channel; S2, performing image integration on the first grayscale image, the second grayscale image and the third grayscale image respectively to obtain a corresponding first integral image, a second integral image and a third integral image; S3, performing local area calculation on the first integral image, the second integral image and the third integral image respectively to obtain a corresponding first mean image, a second mean image and a third mean image; S4, respectively comparing the first grayscale image with the first mean image, the second grayscale image with the second mean image, and the third grayscale image with the third mean image to obtain a first binary image corresponding to the first grayscale image, a second binary image corresponding to the second grayscale image, and a third binary image corresponding to the third grayscale image; S5, performing a predetermined number of image opening operations on the first binary image, the second binary image, and the third binary image, respectively, to obtain a corresponding fourth binary image, a fifth binary image, and a sixth binary image; S6, performing a logic AND operation on the fourth binary image, the fifth binary image, and the sixth binary image, and identifying microplastics present in the microplastic image according to a result matrix of the logic AND operation; Wherein, the step S4 determines the pixel values b of the corresponding binary image matrices in the first binary image, the second binary image and the third binary image according to the following formula: Wherein, t is a predetermined value less than 100 and greater than 0, g(i, j) is the corresponding pixel value of the original pixel point (i, j) in the first grayscale image, the second grayscale image or the third grayscale image, i, j are natural numbers, is the pixel value corresponding to the original pixel point (i, j) in the first mean map, the second mean map or the third mean map; In step S6, the pixel points with a value of 0 in the result matrix of the logical AND operation are identified as microplastics, and the pixel points with a value of 1 are identified as not microplastics; Wherein, after step S6, the method further includes: S7, marking the connected domains of the result matrix of the logical AND operation, and dividing the identified microplastics into different microplastic individuals, wherein pixels with the same connected domain marker are determined to belong to one microplastic individual, and different microplastic individuals have different connected domain markers.
2. The method according to claim 1, characterized in that After step S7, the method further includes: According to the number of different connected domain markers, the number of microplastics present in the microplastic image is determined.
3. The method according to claim 1, characterized in that After step S7, the method further includes: For any one of the different microplastic individuals, the grayscale average of the pixel points corresponding to the microplastic individual is calculated based on the grayscale values of the pixel points corresponding to the microplastic individual in the first grayscale image, the second grayscale image and the third grayscale image, and the grayscale average represents the color of the microplastic individual.
4. The method according to claim 1, characterized in that: After step S7, the method further includes: For any one of the different microplastic individuals, the number of pixels count contained in the microplastic individual is determined according to the number of pixels contained in the same connected domain marker, and the area of the microplastic individual is determined according to the following formula: A=count×r×r Wherein, r is the observation resolution of the microplastic image.
5. The method according to claim 1, characterized in that After step S7, the method further includes: For any one of the different microplastic individuals, the Sobel operator is used to perform edge detection on the microplastic individual, and the major axis and / or minor axis of the microplastic individual is obtained by ellipse fitting.
6. The method according to claim 1, characterized in that The first color channel is a red channel, the second color channel is a green channel, and the third color channel is a blue channel.
7. A device for identifying microplastics, characterized in that: It includes a memory and a processor, the memory stores at least one program, and the at least one program is executed by the processor to implement the method for identifying microplastics as described in any one of claims 1 to 6.
8. A computer-readable storage medium, characterized in that: The storage medium stores at least one program, and the at least one program is executed by a processor to implement the method for identifying microplastics as described in any one of claims 1 to 6.
Citation Information
Patent Citations
Dirt detection method
CN109712123A
Two-dimensional code detection method and device
CN110263595A