A Machine Vision-Based Method for Counting Half-Smooth Tongue Sole Fry

By using a machine vision-based method, the connected component parameters and skeleton images of half-smooth tongue sole fry were obtained. By combining the cross-point counting method and the compensation algorithm, the problem of unstable counting caused by the adhesion and overlap of fry was solved, and fry counting with high accuracy and high efficiency was achieved.

CN116152181BActive Publication Date: 2026-03-06TIANJIN AGRICULTURE COLLEGE
View PDF 4 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-01-06
Publication Date
2026-03-06

AI Technical Summary

Technical Problem

Existing technologies for counting half-smooth tongue sole fry suffer from large errors, low efficiency, and inability to handle the problem of fry sticking together and overlapping. Traditional counters are limited in use and expensive, while existing computer vision-based methods have low counting accuracy when fry stick together and overlap.

Method used

A machine vision-based approach was adopted to construct a connected component image by acquiring connected component parameters, obtain the fish fry skeleton image using a skeleton thinning algorithm, establish the determination rules for endpoints, connection points, and intersections, combine the intersection counting method, and use a compensation algorithm to obtain the number of fish fry.

Benefits of technology

It improves the counting accuracy and stability under both low and high adhesion and overlap of fish fry, increases counting efficiency and precision, and solves the problem of unstable counting caused by adhesion and overlap of fish fry.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116152181B_ABST
    Figure CN116152181B_ABST
Patent Text Reader

Abstract

This invention discloses a machine vision-based method for counting half-smooth tongue sole fry, comprising: acquiring half-smooth tongue sole fry images and binarizing them; acquiring all connected component parameters of the binarized image and constructing corresponding connected component images; processing the connected component images using a skeleton thinning algorithm to obtain fry skeleton images; classifying the pixels in the fry skeleton images; calculating the number of half-smooth tongue sole fry in the fry skeleton images using a crosspoint counting method; obtaining the average standard area of ​​the fry; applying a compensation algorithm to connected component images exceeding a set ratio coefficient; and summing the fry counts in all compensated connected component images to obtain the total number of fry. This invention uses crosspoint counting and a compensation algorithm to obtain the number of fry. The judgment method is simple and fast, non-contact with the fry, and enables automatic detection by machines instead of manual labor; it is applicable to all complex situations such as low or high adhesion and overlap of fry, and has the advantages of fast calculation speed, good detection stability, and high counting accuracy.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of aquatic image processing technology, and in particular to a machine vision-based method for counting fry of the tongue sole. Background Technology

[0002] In aquaculture, quantitative counting of tongue sole fry is necessary to provide a scientific basis for scientific feeding and stocking density management. Traditional counting methods mostly rely on manual methods, which are limited by human experience and suffer from drawbacks such as large errors, low efficiency, and damage to the fry. Since the 1980s, researchers have developed various types of fry counters, such as resistivity counters, optical counters, sonar counters, and single-channel and multi-channel counters. However, these counters have limited application conditions and are expensive, making them unsuitable for practical production.

[0003] With the rapid development of computer technology, technologies such as computer vision and digital image processing are gradually being applied in the field of aquaculture. Patent CN101430775B proposes an automatic fish fry counting device and method based on computer vision, which uses a formula relating background grayscale data and grayscale data of the measured number of fish fry to obtain the number of fish fry to be counted. Patent CN105374042B proposes an online automatic fish fry counting device and method based on machine vision, which uses a camera to acquire images of fish fry, then processes and analyzes the images, and uses an endpoint counting method to obtain the number of fish fry.

[0004] However, in actual production, the distribution of fish fry is uncertain and can lead to some adhesion and overlap. For example, the establishment of the reference base value and the coefficient between the target area and the average area in the pixel area method both contribute to the instability of fish fry counting. The endpoint counting method, when fish fry are adhered and overlapped, often results in endpoints becoming intersections. Using only endpoint counting leads to low counting accuracy, and the more fish fry adhere and overlap, the greater the error. Summary of the Invention

[0005] Therefore, the purpose of this invention is to provide a machine vision-based method for counting half-smooth tongue sole fry. By acquiring connected component parameters and constructing corresponding connected component images, image processing techniques are used, and a skeleton thinning algorithm is employed to obtain the skeleton image of the half-smooth tongue sole fry. Rules for determining skeleton pixels at endpoints, connection points, and intersections are established, and an intersection counting method is proposed. This method uses a combination of skeleton endpoints and intersections for counting, and based on this counting method, a compensation algorithm is provided to obtain the number of half-smooth tongue sole fry.

[0006] To achieve the above objectives, the present invention provides a machine vision-based method for counting fry of the tongue sole, comprising the following steps:

[0007] S1. Obtain images of half-smooth tongue sole fry and preprocess the obtained half-smooth tongue sole fry images to obtain binarized images of the fry.

[0008] S2. Obtain all connected components of the binarized image and process them sequentially. Obtain the parameters of a single connected component and construct the corresponding connected component image. Use the digital mode skeleton thinning algorithm to extract the fish fry skeleton from the connected component image to obtain the fish fry skeleton image.

[0009] S3. Determine the classification of pixels in the fish fry skeleton image and calculate the number of pixels in each classification. The pixel classification categories include endpoints, skeleton points, and intersections. The number of half-smooth tongue sole fry in the connected component image is calculated using the intersection counting method.

[0010] S4. Obtain the average standard area of ​​the fish fry, apply a compensation algorithm to the connected components that exceed the set ratio coefficient, and sum the number of fish fry in all the compensated connected components to get the number of half-smooth tongue sole fish fry in the final image.

[0011] Further preferably, in S1, the acquired image of the tongue sole fry is stored in an 8-bit RGB three-dimensional matrix format, with the three-dimensional matrix consisting of three channels: R (red), G (green), and B (blue).

[0012] In a further preferred embodiment of any of the above, in S1, the preprocessing of the acquired half-smooth tongue sole fry image to obtain a binarized fry image includes the following steps:

[0013] S101. Convert the acquired images of the half-smooth tongue sole fry into grayscale using a weighted average method.

[0014] Degree image;

[0015] S102. Smooth the grayscale image using median filtering.

[0016] S103. Perform binary segmentation on the smoothed image using the OTSU maximum inter-class variance segmentation algorithm.

[0017] Chemical treatment;

[0018] S104. Perform morphological processing on the binarized image to obtain the final binarized image of the fish fry.

[0019] In a further preferred embodiment of any of the above, in S2, the connected component parameters obtained include: number, label (pixel marker), xy coordinates of the bounding rectangle, width, height, and area.

[0020] In a further preferred embodiment of any of the above embodiments, in S2, a digital pattern skeleton thinning algorithm is used to extract the fish fry skeleton from the connected component image, including the following method:

[0021] The ZS algorithm is used to delete pixels of 8 neighboring points within the defined center point and pixel window according to a preset iteration rule, while retaining the skeleton pixels after iteration.

[0022] In a further preferred embodiment of any of the above embodiments, the iteration rule includes:

[0023] S201, Odd-number iteration rule:

[0024] (a)2≤A(P0)≤6; (b)B(P0)=1; (c)P2*P4*P6=0; (d)

[0025] P4*P6*P8=0;

[0026] S202, Even-number iteration rule:

[0027] (a)2≤A(P0)≤6; (b)B(P0)=1; (c)P2*P4*P8=0; (d)

[0028] P2*P6*P8=0;

[0029] Where A(P0) represents the number of non-zero neighbors of pixel P0, and B(P0) represents the number of 0-1 patterns in the ordered set of 8 neighbors P1, P2, ..., P8 of pixel P0; the 0-1 pattern represents the combination in the ordered set of 8 neighbors P1, P2, ..., P8 of pixel P0 where the former is 0 and the latter is 1.

[0030] In a further preferred embodiment of any of the above, step S3, determining the classification of pixels in the fish fry skeleton image and calculating the number of pixels in each classification, includes the following steps:

[0031] S301. Scan each pixel sequentially from left to right and from top to bottom, and record each pixel as P0;

[0032] S302. When P0 = 1 is scanned, the values ​​of the ordered sets of the 8 neighboring points P1, P2, ..., P8 of P0 are scanned in sequence, and the pixel point determination algorithm is used to determine whether P0 is an endpoint, skeleton point or intersection point.

[0033] S303. After the determination is completed, return to step S302 to continue determining the next pixel.

[0034] S304. After scanning all pixels, count the number of pixels in each category and use the cross-point counting method to count the number of half-smooth tongue sole fry in the image.

[0035] In a further preferred embodiment of any of the above, in S302, the pixel determination algorithm includes:

[0036] F = A(P0) - C(P0)

[0037] Where A(P0) represents the number of non-zero neighbors of pixel P0, and C(P0) represents the number of times the 1-1 pattern appears in the ordered set of 8 neighbors P1, P2, ..., P8 of pixel P0; the 1-1 pattern represents the combination of the former being 1 and the latter being 1 in the ordered set of 8 neighbors P1, P2, ..., P8 of pixel P0; the result F represents the classification of the pixel, defined as F=1, P0 is an endpoint; F=2, P0 is a skeleton point; F=3, P0 is an intersection point; F=0 or other, P0 is an outlier point.

[0038] In a further preferred embodiment of any of the above, in S304, the intersection counting method uses a counting method combining endpoints and intersections, as shown in the formula:

[0039] N = (E + C) / 2

[0040] Where E represents the number of endpoints, C represents the number of intersections, and N represents the number of tongue sole fry. The result is rounded to the nearest integer.

[0041] In a further preferred embodiment of any of the above, in step S4, obtaining the average standard area of ​​the fish fry includes the following steps: applying the ZS skeleton thinning algorithm and the crosspoint counting method to process the connected components sequentially; calculating the ratio of the connected component area to the number of fish fry, using the formula:

[0042] Ratio = Area / Number

[0043] Where Area is the area of ​​the connected region, and Number is the number of fish fry in the connected region calculated using the cross-point counting method; the calculated ratio is stored in a ratio list; the ratio list is sorted in ascending order, and the median is taken as the average standard area of ​​the fish fry.

[0044] In a further preferred embodiment of the above, in S4, the compensation algorithm is applied to the connected components that exceed the set proportional coefficient, and the compensation algorithm formula is:

[0045] Comp = Ratio / A - T + 1

[0046] Where A represents the average standard area, T represents the set ratio coefficient, Comp represents the number of fish fry to be compensated, and the result is rounded to the nearest integer.

[0047] Furthermore, preferably, the summation of the number of fish fry obtained from all compensated connected component images is the number of *Syzygium buergerianum* fry in the image, as shown by the formula:

[0048]

[0049] Where n is the total number of connected component images constructed, Conn_Number i The number of fish fry calculated using the intersection counting method in the i-th connected component image; Comp i Fry_number represents the number of fish fry compensated in the i-th connected component image; Fry_number represents the number of half-smooth tongue sole fry in the final image, and the result is an integer.

[0050] The machine vision-based method for counting half-smooth tongue sole fry disclosed in this application has at least the following advantages compared to existing technologies:

[0051] By acquiring connected component parameters and constructing corresponding connected component images, a skeleton thinning algorithm was used to obtain the skeleton image of *Syzygium buergerianum* fry. Rules for determining skeleton pixels at endpoints, connection points, and intersections were established, and an intersection counting method was proposed. This method combines skeleton endpoints and intersections for counting, and a compensation algorithm was provided based on this method to determine the number of *Syzygium buergerianum* fry. Compared to connected component counting and endpoint counting methods, traditional methods cannot accurately handle the overlapping and sticking of *Syzygium buergerianum* fry, and the higher the degree of overlap and sticking, the lower the counting accuracy. The intersection counting method can solve the intersection problem caused by overlapping and sticking fry, correctly handle fry branching, and has high counting accuracy and stability in both low and high overlap and sticking conditions, thus improving counting efficiency and precision. Attached Figure Description

[0052] Figure 1 This is a flowchart of a machine vision-based method for counting tongue sole fry provided by the present invention.

[0053] Figure 2 This is a schematic diagram of a 3*3 pixel window and its orientation structure in an embodiment of the present invention.

[0054] Figure 3 This is a schematic diagram of the 0-1 mode structure in an embodiment of the present invention.

[0055] Figure 4(a) is an example of a scenario where an endpoint exists in an embodiment of the present invention.

[0056] Figure 4(b) is an example of a scenario where the skeleton exists in an embodiment of the present invention.

[0057] Figure 4(c) is an example of a scenario where the skeleton exists in an embodiment of the present invention.

[0058] Figure 4(d) is an example of a scenario where the skeleton exists in an embodiment of the present invention.

[0059] Figure 4(e) is an example of a scenario where the skeleton exists in an embodiment of the present invention.

[0060] Figure 4(f) is an example of a scenario where an intersection point exists in an embodiment of the present invention.

[0061] Figure 4(g) is an example of a scenario where an intersection point exists in an embodiment of the present invention.

[0062] Figure 4(h) is an example of a scenario where an intersection point exists in an embodiment of the present invention.

[0063] Figure 5 This is a schematic diagram of the 1-1 mode structure in an embodiment of the present invention. Detailed Implementation

[0064] The present invention will be further described in detail below with reference to the accompanying drawings and specific embodiments.

[0065] like Figure 1 As shown, one embodiment of the present invention provides a machine vision-based method for counting fry of the tongue sole, comprising the following steps:

[0066] S1. Acquire images of half-smooth tongue sole fry and preprocess them to obtain binarized images of the fry. Further, the acquired half-smooth tongue sole fry images are saved as an 8-bit RGB three-dimensional matrix, with three channels: R (red), G (green), and B (blue). Each channel has a color value from 0 to 255. The original images are converted to a uniform format to avoid unnecessary errors during processing.

[0067] In S1, the process also includes preprocessing the acquired images of half-smooth tongue sole fry to obtain binarized images of the fry, including the following steps:

[0068] S101. Convert the acquired images of the half-smooth tongue sole fry into grayscale images using a weighted average method; use a weighted average method to perform a weighted average on the three color channel components of the fry image with different weights, and the calculation formula is as follows:

[0069] Gray=0.299*R+0.587*G+0.114*B

[0070] Where R, G, and B are the red, green, and blue channels of the image, respectively, and Gray is the processed grayscale image.

[0071] S102. Median filtering is used to smooth the grayscale image. Median filtering replaces the grayscale value of each pixel with the median value, making it closer to the true value, thereby eliminating isolated noise points. The outline of the fish fry remains largely unchanged, and the processing effect is relatively good. The median filtering formula is:

[0072] g(x,y)=med{f(xi,yj),(i,j∈W)}

[0073] Where f(x,y) is the image to be processed, g(x,y) is the processed image, and W is a 5x5 sliding matrix.

[0074] window.

[0075] S103. Binarize the smoothed image using the OTSU maximum inter-class variance segmentation algorithm. The intuitive characteristics of the grayscale histogram show that the target fish fry region has a higher peak value, while the background region has a lower peak value. The OTSU maximum inter-class variance segmentation algorithm, which is simple to process, works well. Threshold-based segmentation is then performed on the image. The portion smaller than the algorithm's threshold is the background region, and the portion larger than the threshold is the target region. The calculation formula is as follows:

[0076]

[0077] Where T is the segmentation threshold, f(x,y) is the image to be processed, and g(x,y) is the processed image. The target fish fry object is initially separated from the background region to obtain a binarized image of the fish fry.

[0078] S104. Morphological processing is performed on the binarized image to obtain the final binarized image of the fish fry. Further morphological processing, including dilation and erosion, is applied to the binarized image. An "opening" operation (erosion followed by dilation) is used to remove smaller noise points in the binarized image; then a "closing" operation (dilation followed by erosion) is used to remove hollow points in the target fish fry in the binarized image. No significant changes are observed in the target fish body, and the results are good.

[0079] S2. Obtain all connected components of the binarized image and process them sequentially. Obtain individual connected component parameters and construct corresponding connected component images. Use the digital pattern skeleton thinning algorithm to extract the fish fry skeleton from the connected component images to obtain fish fry skeleton images. Further, the obtained connected component parameters include: number, label pixel marker, xy coordinates, width, height, and area of ​​the bounding rectangle. Construct corresponding connected component images with the same number of connected components as the number of bounding rectangles using the connected component parameters.

[0080] In S2, a digital pattern skeleton thinning algorithm is also used to extract the fish fry skeleton from the connected component image, including the following methods:

[0081] The ZS algorithm is used to delete pixels of 8 neighboring points within the defined center point and pixel window according to a preset iteration rule, while retaining the skeleton pixels after iteration.

[0082] like Figure 2 As shown, the ZS algorithm uses a 3*3 pixel window, with the center point defined as P0. Its 8 neighboring points are defined as P1, P2, ..., P8 in a clockwise direction, starting from the top left corner. The directions are defined as north, south, west, and east.

[0083] The ZS algorithm consists of two sub-iterations, with two odd-even sub-iterations per round to eliminate the outermost contour of the target object. Furthermore, the ZS algorithm is a parallel algorithm; its result depends only on the current value and the result of the previous iteration, offering advantages such as fewer iterations and faster execution speed.

[0084] The iteration rules include:

[0085] S201, Odd-number iteration rule:

[0086] (a)2≤A(P0)≤6; (b)B(P0)=1; (c)P2*P4*P6=0; (d)

[0087] P4*P6*P8=0;

[0088] S202, Even-number iteration rule:

[0089] (a)2≤A(P0)≤6; (b)B(P0)=1; (c)P2*P4*P8=0; (d)

[0090] P2*P6*P8=0;

[0091] Where A(P0) represents the number of non-zero neighbors of pixel P0, and B(P0) represents the number of 0-1 patterns in the ordered set of 8 neighbors P1, P2, ..., P8 of pixel P0; the 0-1 pattern represents the combination in the ordered set of 8 neighbors P1, P2, ..., P8 of pixel P0 where the former is 0 and the latter is 1.

[0092] like Figure 3 As shown, the 0-1 pattern refers to the combination of pixels P0 whose 8-neighborhood P1, P2, ..., P8 (including P8 to P1) have values ​​of 0 for the former and 1 for the latter. Figure 3 In the equation, A(P0) represents a non-zero neighborhood with a value of 3, and B(P0) represents a 0-1 pattern with a value of 2.

[0093] S3. Determine the classification of pixels in the fish fry skeleton image and calculate the number of pixels in each classification. The pixel classification categories include endpoints, skeleton points, and intersections. The number of half-smooth tongue sole fry in the connected component image is calculated using the intersection counting method.

[0094] Furthermore, the step of classifying the pixels in the fish fry skeleton image and calculating the number of pixels in each class includes the following steps:

[0095] S301. Scan each pixel sequentially from left to right and from top to bottom, and record each pixel as P0;

[0096] S302. When P0 = 1 is scanned, the values ​​of the ordered sets of the 8 neighboring points P1, P2, ..., P8 of P0 are scanned in sequence, and the pixel point determination algorithm is used to determine whether P0 is an endpoint, skeleton point or intersection point.

[0097] Furthermore, the pixel determination algorithm includes:

[0098] F = A(P0) - C(P0)

[0099] Where A(P0) represents the number of non-zero neighbors of pixel P0, C(P0) represents the number of times the 1-1 pattern appears in the ordered set of 8 neighbors P1, P2, ..., P8 of pixel P0, and the result F represents the classification of the pixel. F = 1, P0 is an endpoint; F = 2, P0 is a skeleton point; F = 3, P0 is an intersection point; F = 0 or other, P0 is an outlier point.

[0100] As shown in Figures 4(a)-(h), after processing by the ZS algorithm, the number of 8-neighborhood values ​​of 1 is used as the classification, and the number of endpoints, skeleton points, and intersections in each classification is counted. There is only one classification for endpoints, as shown in Figure 4(a), with a total of 8 cases; as shown in Figures 4(b)-(e), there are 4 classifications for skeleton points, namely 2, 3, 4, and 5, with 20, 32, 36, and 32 cases respectively; as shown in Figures 4(f)-(h), there are 3 classifications for intersections, namely 3, 4, and 5, with 16, 24, and 16 cases respectively.

[0101] like Figure 5 As shown, the 1-1 pattern is a combination in the ordered set of neighborhood P1, P2, ..., P8 (including P8 to P1) of pixel P0, where the former is 1 and the latter is also 1. Figure 5 The value for the non-zero neighborhood is 4, and the value for the 1-1 pattern is 2.

[0102] For other cases, if there are three consecutive values ​​of 1 in the ordered set P1, P2, ..., P8, then the value of the 1-1 pattern is 2; if there are four consecutive values ​​of 1 in the ordered set, then the value of the 1-1 pattern is 3.

[0103] S303. After the determination is completed, return to step S302 to continue determining the next pixel.

[0104] S304. After scanning all pixels, count the number of pixels in each category and use the cross-point counting method to count the number of half-smooth tongue sole fry in the image.

[0105] Furthermore, in S304, the intersection counting method uses a combination of endpoints and intersections, as shown in the formula:

[0106] N = (E + C) / 2

[0107] Where E represents the number of endpoints, C represents the number of intersections, and N represents the number of tongue sole fry. The result is rounded to the nearest integer.

[0108] S4. Obtain the average standard area of ​​the fish fry. Apply a compensation algorithm to the connected components that exceed the set ratio coefficient. Sum the number of fish fry in all the compensated connected components to get the number of half-smooth tongue sole fry in the final image.

[0109] Furthermore, obtaining the average standard area of ​​the fish fry includes the following steps:

[0110] The ZS skeleton thinning algorithm and the intersection counting method are applied sequentially to process the connected components; the ratio of the area of ​​the connected components to the number of fish fry is calculated using the following formula:

[0111] Ratio = Area / Number

[0112] Where Area is the area of ​​the connected region, and Number is the number of fish fry in the connected region calculated using the cross-point counting method; the calculated ratio is stored in a ratio list; the ratio list is sorted in ascending order, and the median is taken as the average standard area of ​​the fish fry.

[0113] S4 also includes applying a compensation algorithm to connected components that exceed a set proportional coefficient. The compensation algorithm formula is:

[0114] Comp = Ratio / A - T + 1

[0115] Where A represents the average standard area, T represents the proportionality coefficient, and Comp represents the number of fish fry compensated. The result is rounded to the nearest integer.

[0116] The compensation algorithm requires setting a scaling factor T. If T is set too small, the number of counts will be too large, reducing accuracy; if T is set too large, the accuracy will not improve. Therefore, choosing a suitable scaling factor T has a significant impact on the final counting result. In this embodiment, T = 1.5 is selected.

[0117] The sum of the number of fish fry obtained from all compensated connected component images is used as the number of half-smooth tongue sole fry in the image. The formula is:

[0118]

[0119] Where n is the total number of connected component images constructed, Conn_Number i The number of fish fry calculated using the intersection counting method in the i-th connected component image; Comp i Fry_number represents the number of fish fry compensated in the i-th connected component image; Fry_number represents the number of half-smooth tongue sole fry in the final image, and the result is an integer.

[0120] Obviously, the above embodiments are merely illustrative examples for clear explanation and are not intended to limit the implementation. Those skilled in the art will recognize that other variations or modifications can be made based on the above description. It is neither necessary nor possible to exhaustively list all possible implementations here. However, obvious variations or modifications derived therefrom are still within the scope of protection of this invention.

Claims

1. A method for counting Cynoglossus semilaevis larvae based on machine vision, characterized in that, The method comprises the following steps: S1, acquiring the image of Cynoglossus semilaevis larvae and pre-processing the acquired image of Cynoglossus semilaevis larvae to obtain a binary image of the larvae; S2, acquiring all connected domains of the binary image and processing them in turn, acquiring parameters of a single connected domain and constructing a corresponding connected domain image, extracting the skeleton of the larvae from the connected domain image by using a digital pattern skeleton thinning algorithm to obtain a skeleton image of the larvae; S3, judging the classification of the pixel points in the skeleton image of the larvae and calculating the number of pixel points of each classification, the classification of the pixel points including end points, skeleton points and intersection points, and the number of Cynoglossus semilaevis larvae in the connected domain image is calculated by using an intersection point counting method; S301, scanning each pixel point in turn from left to right and from top to bottom, and counting the pixel points as P0; S302, when P0=1 is scanned, the values of the 8-neighborhood points P1, P2,..., P8 of P0 are scanned in turn, and a pixel point judgment algorithm is used to judge whether P0 is an end point, a skeleton point or an intersection point; S303, after the judgment is completed, the next pixel point is judged again in step S302; S304, after all the pixel points are scanned, the number of pixel points of each classification is counted, and the number of Cynoglossus semilaevis larvae in the image is counted by using an intersection point counting method; in S304, the intersection point counting method uses a counting method combining end points and intersection points, and the formula is: N=(E+C) / 2 wherein E represents the number of end points, C represents the number of intersection points, N represents the number of Cynoglossus semilaevis larvae, and the result is an integer; S4, acquiring the average standard area of the larvae, applying a compensation algorithm to the connected domain exceeding the set proportion coefficient, summing the number of the larvae of all the connected domains after compensation to obtain the number of Cynoglossus semilaevis larvae in the final image.

2. The machine vision-based juvenile Cynoglossus semilaevis counting method according to claim 1, characterized in that, In S1, the acquired image of Cynoglossus semilaevis larvae is saved in the form of an 8-bit RGB three-dimensional matrix, and the three-dimensional matrix includes three channels of R red, G green and B blue. 3.The machine vision-based juvenile Cynoglossus semilaevis counting method according to claim 1, characterized in that, In S1, the pre-processing of the acquired image of Cynoglossus semilaevis larvae to obtain a binary image of the larvae comprises the following steps: S101, converting the acquired image of Cynoglossus semilaevis larvae into a gray-scale image by using a weighted average method; S102, smoothing the gray-scale image by using a median filter method; S103, performing binary processing on the smoothed image by using an OTSU maximum inter-class variance segmentation algorithm; S104, performing morphological processing on the binary-processed image to obtain a final binary image of the larvae.

4. The machine vision-based juvenile Cynoglossus semilaevis counting method according to claim 1, characterized in that, In S2, the acquired connected domain parameters include: number, label, the xy coordinates, width, height and area of the circumscribed rectangle.

5. The machine vision-based juvenile Cynoglossus semilaevis counting method according to claim 1, characterized in that, In S2, the digital pattern skeleton thinning algorithm is used to extract the skeleton of the larvae from the connected domain image, and the algorithm comprises the following method: By using a ZS algorithm, the pixels of the 8-neighborhood points in the range of the center point are deleted according to a preset iteration rule by using a defined center point and a pixel window, and the skeleton pixel points after iteration are reserved.

6. The machine vision-based juvenile Cynoglossus semilaevis counting method according to claim 5, characterized in that, The iteration rule comprises: S201, odd iteration rule: (a) 2≤A(P0)≤6; (b) B(P0)=1; (c) P2*P4*P6=0; (d) P4*P6*P8=0; S202, even iteration rule: (a) 2≤A(P0)≤6; (b) B(P0)=1; (c) P2*P4*P8=0; (d) P2*P6*P8=0; Wherein, A(P0) represents the number of non-zero neighborhood of P0 pixel point, B(P0) represents the number of 0-1 mode in the ordered set of 8 neighborhood P1, P2,..., P8 of P0 pixel point; the 0-1 mode represents the combination of the former being 0 and the latter being 1 in the ordered set of 8 neighborhood P1, P2,..., P8 of P0 pixel point.

7. The machine vision-based juvenile Cynoglossus semilaevis counting method according to claim 1, characterized in that, In S3, the classification of the pixel points in the fish skeleton image is judged, and the number of pixel points of each classification is calculated; including the following steps: S301, from left to right, from top to bottom, each pixel point is scanned in turn, and the pixel point is P0; S302, when scanning P0=1, the values of the ordered set of 8 neighborhood points P1, P2,..., P8 of P0 are scanned in turn, and the pixel point judgment algorithm is used to judge whether P0 is an end point, a skeleton point or a cross point; S303, after the judgment is finished, return to step S302 to continue judging the next pixel point; S304, after scanning all the pixel points, the number of pixel points of each classification is counted, and the cross point counting method is used to complete the counting of the number of half slip tongue fry in the image.

8. The machine vision-based juvenile Cynoglossus semilaevis counting method according to claim 7, characterized in that, In S302, the pixel point judgment algorithm includes: F=A(P0)-C(P0) Wherein, A(P0) represents the number of non-zero neighborhood of P0 pixel point, C(P0) represents the number of 1-1 mode in the ordered set of 8 neighborhood P1, P2,..., P8 of P0 pixel point; the 1-1 mode represents the combination of the former being 1 and the latter being 1 in the ordered set of 8 neighborhood P1, P2,..., P8 of P0 pixel point; the result F represents the classification of the pixel point, defined F=1, P0 is an end point; F=2, P0 is a skeleton point; F=3, P0 is a cross point, F=0 or other, P0 is an abnormal point. 9.The machine vision-based juvenile Cynoglossus semilaevis counting method according to claim 1, wherein, In S4, the average standard area of fry is obtained, including the following steps: applying ZS skeleton thinning algorithm and cross point counting method to process the connected domain in turn; calculating the ratio of the area of the connected domain to the number of fry, the formula is: Ratio=Area / Number Wherein, Area is the area of the connected domain, Number is the number of fry in the connected domain calculated by the cross point counting method; The calculated ratio Ratio is saved in a ratio list; the ratio list is sorted in ascending order, and the median is taken as the average standard area of the fry.

10. The machine vision-based juvenile Cynoglossus semilaevis counting method according to claim 1, characterized in that, In S4, the compensation algorithm is applied to the connected domain exceeding the set proportion coefficient, and the compensation algorithm formula is: Comp=Ratio / A-T+1 Wherein, A represents the average standard area, T represents the proportion coefficient, Comp represents the number of compensated fry, and the result is an integer.

11. The machine vision-based juvenile Cynoglossus semilaevis counting method according to claim 10, characterized in that, The sum of the number of fry obtained from all the compensated connected domain images is taken as the number of half slip tongue fry in the final image, and the formula is: Where n is the total number of connected domain images constructed, Conn_Number i is the number of fry in the i-th connected domain image calculated by the intersection point counting method; Comp i is the number of fry in the i-th connected domain image after compensation; Fry_number is the number of fry in the final image, and the result is rounded to an integer.

Citation Information

Patent Citations

  • Automatic fry counting system based on computer vision

    CN101430775B

  • Device and method for online automatic counting of fry based on machine vision

    CN105374042B

  • Device and method of on-line automatic count of fries on the basis of machine vision

    CN105374042A

  • Identifying and counting method for intersecting and shielded fish

    CN106447672A