Shrimp fry recognition and counting method based on ridge line extraction and integrated device
By extracting the ridge line of shrimp larvae and counting the number of intersections and endpoints of the ridge line, the problem of unclear counting of adhering shrimp larvae is solved, achieving efficient and accurate shrimp larvae counting.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- 海南快渔生物科技有限公司
- Filing Date
- 2022-12-09
- Publication Date
- 2026-06-16
AI Technical Summary
Existing technologies are inefficient and prone to errors when counting shrimp larvae that are stuck together, which affects the economic benefits of shrimp hatcheries and farmers.
The skeleton extraction method is used to extract the ridge line of shrimp larvae, calculate the number of shrimp larvae, and accurately count them by using the number of intersections and endpoints of the ridge line.
It improves the accuracy and efficiency of shrimp larvae counting, reduces human error, reduces manpower waste, and shortens the hatching time.
Smart Images

Figure CN115861245B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of shrimp larvae counting technology, and in particular to a shrimp larvae identification and counting method and integrated device based on ridge line extraction. Background Technology
[0002] In aquaculture, counting is necessary during the stocking and sale of shrimp (fish) fry. Taking shrimp fry as an example, currently, when shrimp fry are released (i.e., sold), the counting method involves sampling after packaging and counting manually. This involves diluting the fry, with one person counting the fry and another recording the count. The disadvantages of this method are obvious. It not only wastes manpower, but also increases the time required for fry release by dedicating several people to counting, thus reducing the number of people needed for packaging. Furthermore, it introduces human error, such as miscounting, misrecording, and incorrect addition. Additionally, the counting method is primitive and lacks automation.
[0003] Currently, there are various image recognition methods and devices on the market. These utilize hardware such as high-definition or infrared image capture equipment in conjunction with application software to identify target objects or their morphological features or other characteristics. Examples include facial recognition, high-speed car photography, and large supermarket monitoring. Existing biometric inventory methods include image deep learning, image morphology, and infrared sensor detection. These methods have been successfully applied to specific scenarios such as headcount, medical blood cell counting, and fish fry counting. Infrared sensor detection is suitable for counting fish or shrimp fry with low adhesion and small size, but it is not suitable when shrimp fry are large and prone to adhesion. Image deep learning and image morphology methods are inefficient when counting shrimp fry, especially king prawns, because shrimp fry are often transparent and difficult to distinguish from the background. This directly impacts the economic benefits of shrimp hatcheries and farmers.
[0004] Therefore, this application provides a shrimp larvae identification and counting method and integrated device based on ridge line extraction. Summary of the Invention
[0005] Therefore, the purpose of this invention is to provide a shrimp larvae identification and counting method and integrated device based on ridge line extraction. The method uses skeleton extraction to extract the ridge lines of the shrimp larvae, thereby using the ridge lines to calculate the number of shrimp larvae. This solves the problem of unclear counting caused by image overlap due to shrimp larvae sticking together.
[0006] To achieve the above objectives, the present invention provides a shrimp larvae identification and counting method based on ridge line extraction, comprising the following steps: S1, acquiring an original image of the shrimp larvae; binarizing the original image of the shrimp larvae; S2, performing edge detection on the binarized image, delineating the contour of the target to be tested according to the detected edges, and calculating the area and contour length of the target to be tested; S3, extracting the skeleton from the binarized image, and using the extracted skeleton as the ridge line of the shrimp larvae; when the area and / or contour length of the target to be tested are within a preset threshold range, calculating the number of shrimp larvae ridge lines as the number of independent shrimp larvae P; S4, when the area and / or contour length of the target to be tested exceed the preset threshold range; calculating the number of intersection points of the shrimp larvae ridge lines;
[0007] S5. Calculate the number of shrimp larvae according to the following formula based on the number of intersections.
[0008] N = (M + C) / 2 + P;
[0009] Where M is the number of endpoints of the shrimp larvae's ridge line with intersections, C is the number of intersections, and N is the total number of shrimp larvae after rounding.
[0010] Furthermore, preferably, in S2, the step of performing edge detection on the binarized image further includes the following steps:
[0011] S201. Apply the Sobel operator to the binarized image to perform horizontal and vertical convolution operations;
[0012] S202. Add the results of the convolution operation and use the sum as the new gray value of the image center;
[0013] S203. Perform edge binarization processing according to a fixed threshold to obtain the final edge detection image.
[0014] Further, preferably, in S203, the fixed threshold is set as follows: The images after horizontal and vertical Sobel operator convolution operations are respectively subjected to standard normalization calculation; pixels that do not conform to the standard normal distribution are deleted; the image after summing the convolution operation results is subjected to sliding search using a normalized distribution window; the normalized distribution window is set to include a gradient ascending side and a gradient descending side; the edge direction is set according to whether the image gradient change during the search belongs to the gradient ascending side or the gradient descending side; the pixel average of the two images after horizontal and vertical Sobel operator convolution operations is calculated as the fixed threshold.
[0015] Further, preferably, in S3, the skeleton is extracted from the binarized image, and the extracted skeleton is used as the shrimp larvae's ridge line. The background color is then removed using the following steps:
[0016] Acquire the binarized image and use a rectangular active window with the same color as the background; search for the binarized images acquired in adjacent sampling time intervals;
[0017] When a pixel value in the image matches the pixel value in the rectangular active window during the search process, the pixel value in the image is set to 0. After multiple iterations, the background color is eliminated.
[0018] Further, preferably, it also includes: acquiring multiple consecutive binarized images according to the sampling interval, and marking them according to whether the sampling time is odd or even; performing a subtraction operation on the pixel values in the images of the sampling sequence marked as odd or even in chronological order; assigning a value of 0 to the difference less than the threshold and a value of 1 to the difference greater than the threshold according to a set difference threshold; and eliminating the background color.
[0019] After multiple iterations, the final image after assigning values to the odd sequence is compared with the final image after assigning values to the even sequence. The number of shrimp larvae is counted based on whether their positions have moved.
[0020] The present invention also provides an integrated device for shrimp larvae identification and counting based on ridge line extraction, for implementing the shrimp larvae identification and counting method based on ridge line extraction, including a camera 1, a track-type larvae counting device and a controller 3;
[0021] The track-type seedling device 2 is used to transport shrimp seedlings from the track inlet to the track outlet in a circulating water supply environment.
[0022] The camera is used to acquire raw images of the shrimp larvae in the track;
[0023] The controller performs binarization processing on the original image of the shrimp seedlings; the binarized image is then processed by edge detection, and the outline of the target to be measured is delineated according to the detected edges, and the area and outline length of the target to be measured are calculated.
[0024] The skeleton is extracted from the binarized image and used as the ridge line of the shrimp larvae. When the area and / or contour length of the target to be measured are within the preset threshold range, the number of ridge lines of the shrimp larvae is calculated as the number of independent shrimp larvae P. When the area and / or contour length of the target to be measured exceeds the preset threshold range, the number of intersection points of the ridge lines of the shrimp larvae is calculated.
[0025] The number of shrimp larvae is calculated based on the number of intersections using the following formula:
[0026] N = (M + C) / 2 + P;
[0027] Where M is the number of endpoints of the shrimp larvae's ridge line with intersections, C is the number of intersections, and N is the total number of shrimp larvae after rounding.
[0028] Furthermore, preferably, it also includes a display device for displaying images and counting results, wherein the display device includes any one of a mobile phone, tablet, or monitor.
[0029] Furthermore, preferably, the track-type seedling device includes a box, an inclined track disposed inside the box, and a camera disposed parallel to the inclined track above it.
[0030] Furthermore, the inclined track is made of transparent material, and LED fill lights are provided at the bottom of the box.
[0031] The shrimp larvae identification and counting method and integrated device based on ridge line extraction disclosed in this application have at least the following advantages compared with the prior art:
[0032] 1. The shrimp larvae identification and counting method based on ridge line extraction in this application adopts the skeleton extraction method to extract the ridge line of the shrimp larvae, and then uses the ridge line of the shrimp larvae to calculate the number of shrimp larvae, which solves the problem of unclear number counting caused by image overlap due to shrimp larvae sticking together.
[0033] 2. When performing edge detection, this application uses a normally distributed gradient window to perform a sliding search to detect gradient changes in the image. When extracting edges from the image, it can determine the direction of the edge based on the gradient change trend, thus avoiding errors in the final extracted edge pixels.
[0034] 3. When extracting the skeleton, this application uses active window assignment or pixel values of continuous images for background removal to avoid the background affecting the edges of the shrimp seedlings. Attached Figure Description
[0035] Figure 1 This is a flowchart illustrating the shrimp larvae identification and counting method extracted from the ridge line provided by the present invention.
[0036] Figure 2 This is a schematic diagram illustrating the process of edge detection for binarized images in this invention.
[0037] Figure 3 This is a schematic diagram of the integrated device for shrimp seedling identification and counting based on ridge line extraction in this invention.
[0038] Figure 4 The images are the original images of shrimp larvae collected for this application.
[0039] Figure 5 This is a schematic diagram of the skeleton extracted after removing the background color in this application.
[0040] In the picture:
[0041] 1. Water pipe; 2. Box body; 3. Camera; 4. Exit; 5. LED fill light; 6. Inclined track. Detailed Implementation
[0042] The present invention will be further described in detail below with reference to the accompanying drawings and specific embodiments.
[0043] like Figure 1 As shown, one embodiment of the present invention provides a shrimp larvae identification and counting method based on ridge line extraction, comprising the following steps:
[0044] S1. Obtain the original image of the shrimp larvae; perform binarization processing on the original image of the shrimp larvae;
[0045] S2. After binarizing the image, perform edge detection, delineate the contour of the target to be tested according to the detected edges, and calculate the area and contour length of the target to be tested.
[0046] S3. Extract the skeleton from the binarized image and use the extracted skeleton as the ridge line of the shrimp larvae; when the area and / or contour length of the target to be measured are within the preset threshold range, calculate the number of ridge lines of the shrimp larvae as the number of independent shrimp larvae P.
[0047] S4. When the area and / or outline length of the target to be measured exceed the preset threshold range, calculate the number of intersection points of the shrimp larvae's ridge line.
[0048] S5. Calculate the number of shrimp larvae based on the number of intersections.
[0049] Calculate N = (M + C) / 2 + P using the following formula;
[0050] Where M represents the number of endpoints of the shrimp larvae's ridge lines with intersections, C represents the number of intersections, and N represents the total number of shrimp larvae after rounding. In this application, if... Figure 4 In the images shown, the shrimp larvae tend to cluster together by their heads, or by overlapping and crossing 2-3 shrimp larvae. Therefore, there are 1-2 intersection points at point C.
[0051] In S2, the process of performing edge detection on the binarized image further includes the following steps:
[0052] S201. Apply the Sobel operator to the binarized image to perform horizontal and vertical convolution operations;
[0053] S202. Add the results of the convolution operation and use the sum as the new gray value of the image center;
[0054] S203. Perform edge binarization processing according to a fixed threshold to obtain the final edge detection image.
[0055] Further in S203, the fixed threshold is set as follows: the images after horizontal and vertical Sobel operator convolution operations are respectively subjected to standard normalization calculation; pixels that do not conform to the standard normal distribution are deleted; the image after adding the results of the convolution operation is subjected to sliding search using a normalized distribution window; the normalized distribution window is set to include a gradient ascending side and a gradient descending side; depending on whether the gradient change of the image during the search process belongs to gradient increase or gradient decrease; when it belongs to gradient increase, it belongs to the gradient ascending side of the normalized distribution window, and the edge direction is marked with 45°; when it belongs to gradient decrease, it belongs to the gradient descending side of the normalized distribution window, and the edge direction is marked with 135°.
[0056] This sets the edge direction; the average pixel value of the two images after the horizontal and vertical Sobel operator convolution operations is calculated as a fixed threshold.
[0057] Figure 4 The image provided is the original image of the shrimp larvae collected for this application; in S3, the skeleton is extracted from the binarized image, and the extracted skeleton is used as the ridge line of the shrimp larvae. The background color is removed using the following steps: Figure 5 As shown, this is a schematic diagram of the skeleton extracted after removing the background color in this application;
[0058] Acquire the binarized image and use a rectangular active window with the same color as the background; search for the binarized images acquired in adjacent sampling time intervals;
[0059] When a pixel value in the image matches the pixel value in the rectangular active window during the search process, the pixel value in the image is set to 0. After multiple iterations, the background color is eliminated.
[0060] It also includes: acquiring multiple consecutive binarized images according to the sampling interval and marking them according to whether the sampling time is odd or even; performing subtraction operations on the pixel values in the images of the sampling sequence marked as odd or even in chronological order; assigning a value of 0 to the difference less than the threshold and a value of 1 to the difference greater than the threshold according to the set difference threshold; and removing the background color.
[0061] After multiple iterations, the final image after assigning values to the odd sequence is compared with the final image after assigning values to the even sequence. The number of shrimp larvae is counted based on whether their positions have moved.
[0062] like Figure 3 As shown, the present invention also provides an integrated device for shrimp larvae identification and counting based on ridge line extraction, for implementing the shrimp larvae identification and counting method based on ridge line extraction, including a camera 3, a track-type larvae counting device and a controller;
[0063] The track-type seedling device is used to transport shrimp seedlings from the track inlet to the track outlet 4 in a circulating water supply environment.
[0064] The camera 3 is used to acquire original images of the shrimp larvae in the track;
[0065] The controller performs binarization processing on the original image of the shrimp seedlings; the binarized image is then processed by edge detection, and the outline of the target to be measured is delineated according to the detected edges, and the area and outline length of the target to be measured are calculated.
[0066] The skeleton is extracted from the binarized image and used as the ridge line of the shrimp larvae. When the area and / or contour length of the target to be measured are within the preset threshold range, the number of ridge lines of the shrimp larvae is calculated as the number of independent shrimp larvae P. When the area and / or contour length of the target to be measured exceeds the preset threshold range, the number of intersection points of the ridge lines of the shrimp larvae is calculated.
[0067] The number of shrimp larvae is calculated based on the number of intersections using the following formula:
[0068] N = (M + C) / 2 + P;
[0069] Where M is the number of endpoints of the shrimp larvae's ridge line with intersections, C is the number of intersections, and N is the total number of shrimp larvae after rounding.
[0070] It also includes a display device for displaying images and counting results, wherein the display device includes any one of a mobile phone, tablet, or monitor.
[0071] The track-type shrimp seedling device includes a box 2, an inclined track 6 installed inside the box 2, and a camera 3 installed parallel above the inclined track. One end of the box 2 has an inlet with a water pipe 1 installed therein. A display device is installed above the camera to show images of the shrimp seedlings captured by the lens. The inclined track 6 connects to an outlet 4. After entering the inclined track from the inlet, the shrimp seedlings swim towards the outlet with the help of the water flow and flow out. The inclined track is made of transparent material, and LED supplementary lights are installed at the bottom of the box to provide supplementary lighting when acquiring images of the shrimp seedlings.
[0072] The display, main control unit, and camera module of this invention are separable. Portable devices (mobile phones, tablets, etc.) can also directly interact with the camera and control the device through a specific network connection and APP software to achieve the final calculation results, and transmit the final output report to the portable device (mobile phone, tablet) for display and sharing.
[0073] The flow-through channel system can count seedlings while they are being placed, and collect them at the exit. Compared to current image recognition methods that place seedlings on trays and manual potting methods, it is more efficient and convenient.
[0074] Currently available machine-based seedling collection methods often result in seedlings sticking together when there are many seedlings, making it difficult to guarantee accuracy and affecting the final calculation of total number and body length. This invention employs a continuous flow method that effectively separates the targets to be measured, ensuring no sticking or keeping sticking within a controllable range, thus guaranteeing the accuracy of the calculation and the final total number and body length.
[0075] Most nurseries are located in remote coastal areas, and current mechanized seedling planting mostly uses portable devices. Poor network connectivity can lead to unusable devices or excessively long data transmission times, severely impacting the effectiveness of the process. This invention proposes a method that allows for both computation using a built-in main control device and control via a portable main control unit, providing customers with flexible and adaptable on-site application options, unrestricted by network or other environmental factors.
[0076] 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 identifying and counting shrimp larvae based on ridge line extraction, characterized in that, Includes the following steps: S1. Obtain the original image of the shrimp larvae; perform binarization processing on the original image of the shrimp larvae; S2. Perform edge detection on the binarized image, delineate the contour of the target object according to the detected edges, and calculate the area and contour length of the target object; S201. Apply the Sobel operator to the binarized image for horizontal and vertical convolution operations; S202. Add the results of the convolution operations and use the sum as the new gray value of the image center; S203. Perform edge binarization processing according to a fixed threshold; obtain the final edge detection image; In S203, the fixed threshold is set as follows: The images after horizontal and vertical Sobel operator convolution operations are respectively subjected to standard normalization calculation; Pixels that do not conform to the standard normal distribution are deleted; The image after summing the convolution results is subjected to sliding search using a normalized distribution window; The normalized distribution window is set to include the gradient ascending side and the gradient descending side; The edge direction is set according to whether the gradient change of the image during the search belongs to the gradient ascending side or the gradient descending side; The pixel average of the two images after horizontal and vertical Sobel operator convolution operations is calculated as the fixed threshold; S3. Extract the skeleton from the binarized image and use the extracted skeleton as the ridge line of the shrimp larvae; when the area and / or contour length of the target to be measured are within the preset threshold range, calculate the number of ridge lines of the shrimp larvae as the number of independent shrimp larvae P. S4. When the area and / or outline length of the target to be measured exceed the preset threshold range, calculate the number of intersection points of the shrimp larvae's ridge line. S5. Based on the number of intersections, calculate the number of shrimp larvae N = (M + C) / 2 + P according to the following formula; where M is the number of endpoints of the ridge line of the shrimp larvae with intersections, C is the number of intersections, and N is the total number of shrimp larvae after rounding.
2. The shrimp larvae identification and counting method based on ridge line extraction according to claim 1, characterized in that, In S3, the skeleton is extracted from the binarized image, and the extracted skeleton is used as the ridge line of the shrimp larva. The background color is eliminated by the following steps: the binarized image is acquired and a rectangular active window with the same background color is used; the binarized images acquired in adjacent sampling time periods are searched; when the pixel value in the image is the same as the pixel value in the rectangular active window during the search process, the pixel value in the image is assigned to 0, and the background color is eliminated after multiple iterations.
3. The shrimp larvae identification and counting method based on ridge line extraction according to claim 1, characterized in that, Also includes: Multiple consecutive binarized images are obtained according to the sampling interval, and they are marked according to whether the sampling time is odd or even. For images with sampling sequences labeled as odd or even, perform subtraction operations on the pixel values in the images in chronological order; according to the set difference threshold, assign a value of 0 to values less than the threshold and a value of 1 to values greater than the threshold; remove the background color; after multiple iterations, compare the final image after assigning values to the odd sequence with the final image after assigning values to the even sequence, and count the number of shrimp larvae based on whether the shrimp larvae have moved.
4. An integrated device for shrimp larvae identification and counting based on ridge line extraction, characterized in that, The method for identifying and counting shrimp larvae based on ridge line extraction as described in any one of claims 1-3 includes a camera, a track-type larvae-collecting device, and a controller. The track-type larvae-collecting device is used to transport shrimp larvae from the track inlet to the track outlet in a circulating water supply environment. The camera is used to acquire original images of the shrimp larvae in the track. The controller performs binarization processing on the original images of the shrimp larvae. The binarized image is then subjected to edge detection, and the outline of the target to be measured is delineated according to the detected edges. The area and outline length of the target to be measured are calculated. A skeleton is extracted from the binarized image, and the extracted skeleton is used as the ridge line of the shrimp larvae. When the area and / or outline length of the target to be measured are within a preset threshold range, the number of shrimp larvae ridge lines is calculated as the number of independent shrimp larvae, P. When the area and / or outline length of the target to be measured exceeds the preset threshold range, the number of intersection points of the shrimp larvae ridge lines is calculated. Based on the number of intersection points, the number of shrimp larvae, N = (M + C) / 2 + P, is calculated according to the following formula. Where M is the number of endpoints of the shrimp larvae's ridge line with intersections, C is the number of intersections, and N is the total number of shrimp larvae after rounding.
5. The integrated shrimp larvae identification and counting device based on ridge line extraction according to claim 4, characterized in that, It also includes a display device for displaying images and counting results, wherein the display device includes any one of a mobile phone, tablet, or monitor.
6. The integrated shrimp larvae identification and counting device based on ridge line extraction according to claim 4, characterized in that, The track-type seedling device includes a box, an inclined track installed inside the box, and a camera installed parallel above the inclined track.
7. The integrated shrimp larvae identification and counting device based on ridge line extraction according to claim 6, characterized in that, The inclined track is made of transparent material, and the bottom of the box is equipped with LED fill lights.