Shrimp fry marking method and device based on image processing
Patent Information
- Application Number
- CN202111529718.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-12-14
- Publication Date
- 2025-09-16
- Estimated Expiration
- 2041-12-14
AI Technical Summary
The existing methods for counting shrimp seedlings are time-consuming, costly, and inaccurate. Manual counting with the naked eye is prone to damage and large errors, and random sampling methods lead to inaccurate numbers.
An image processing-based method was used to convert the shrimp fry images into binary images, and the Sobel operator was used for edge detection. The marks were screened according to the median of the edge area, and the number of shrimp fry was calculated.
The efficiency and accuracy of shrimp seed counting are improved, the damage caused by manual counting is avoided, the device has a simple structure and is easy to operate.
Smart Images

Figure CN114187279B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of aquaculture data processing, and in particular to a shrimp fry marking method and device based on image processing. Background Art
[0002] Given the large-scale aquaculture of penaeid shrimp (including Chinese shrimp, giant tiger prawn, Japanese shrimp, and whiteleg shrimp), accurate counting of shrimp seedlings is crucial. Because live bait, such as large worms, is commonly used in shrimp seedling cultivation, physical counting devices like sonic and infrared triggers cannot distinguish them. Therefore, manual counting with the naked eye is currently the most common method. However, the small size of individual shrimp seedlings (approximately 1 cm) and the large number of them (tens of thousands to hundreds of thousands, sometimes even hundreds of millions), making manual counting of each one time-consuming, costly, and inaccurate. Therefore, existing manual counting methods rely on random sampling. One method involves weighing the total weight of the shrimp seedlings, randomly sampling the number of shrimp seedlings per unit weight, and then calculating the total number. The other method involves calculating the total volume of water in which the shrimp seedlings are grown, then randomly sampling the number of shrimp seedlings per unit water volume, and then calculating the total number. Regardless of the random sampling and counting method used, not only will there be varying degrees of damage to the seedlings, but the error in the sample size will be multiplied, resulting in huge differences in the total number, and the problem of low counting accuracy cannot be solved. Summary of the Invention
[0003] Therefore, the present invention aims to provide a shrimp seed marking method and device based on image processing. The method converts an image into a binary image, uses the Sobel operator for edge detection, and selects markers based on the median of all edge areas. This method effectively improves the efficiency and accuracy of shrimp seed counting.
[0004] In order to achieve the above object, the present invention provides a shrimp fry marking method based on image processing, comprising the following steps:
[0005] S1. Place the shrimp fry to be tested in a white tray filled with clear water;
[0006] S2. Collect pictures of the shrimp seedlings to be tested within the range of the white tray;
[0007] S3, converting the collected pictures into binary images;
[0008] S4, use Sobel operator to perform edge detection on the binary image, calculate the outline area of the shrimp seed to be tested in the image one by one, and judge one by one whether the outline area obtained is greater than or equal to the preset threshold. If it exceeds the preset threshold, mark and count until the outline area of the shrimp seed to be tested is less than the preset threshold, then no longer mark and count the shrimp seed to be tested;
[0009] S5. Calculate the total number of shrimp fry to be tested, and highlight the marked shrimp fry to be tested.
[0010] Further, preferably, in S2, when collecting pictures of the shrimp seedlings to be tested within the range of the white tray, the following steps are included: according to the acquisition cycle of the camera, multiple pictures continuously collected by the camera in continuous acquisition cycles are obtained; each picture is sorted according to its clarity; and the top three pictures with high clarity are retained.
[0011] Further preferably, the sorting according to the clarity of each picture includes the following steps:
[0012] Calculate the pixel size of each image and sort the images in order from highest pixel size to lowest pixel size, giving them the first priority.
[0013] For images with equal pixels, the Laplacian operator is used to perform template convolution on the image to obtain the high-frequency components of the image, the high-frequency components of the image are summed, and the high-frequency components are used to sort the images in the second priority order;
[0014] Perform brightness homogenization on high-frequency components and similar images, perform edge detection on the processed images, sum the gradient values of the edge detection, and use the sum of the edge detection gradient values from large to small to sort the images in the third priority order;
[0015] The first three pictures with high definition are selected in descending order from the third priority to the first priority.
[0016] Further preferably, the shrimp seedlings to be tested in each picture are marked, and the number of marked shrimp seedlings to be tested is counted, and the median of the number of shrimp seedlings to be tested counted in the three images is selected as the final result of the counted number of shrimp seedlings to be tested.
[0017] Further preferably, between S3 and S4, an adaptive histogram is used to perform equalization processing on the binary image to enhance the image contrast.
[0018] Further preferably, in S4, the contour area of the shrimp fry to be tested in the image is calculated one by one, including using the Sobel operator to perform edge detection on the binary image to obtain the contour of the shrimp fry to be tested, and obtaining the contour area of the shrimp fry to be tested by calculating the size of the pixels within the contour.
[0019] Further preferably, in S4, when marking the shrimp fry to be tested, the following method is adopted:
[0020] According to the shrimp fry growth age, set the default values corresponding to different growth ages;
[0021] According to the current age of the shrimp fry to be tested, the default value corresponding to the current age is adjusted up and down to obtain a preset threshold value. The preset threshold value is a numerical range. When the contour area of the shrimp fry to be tested exceeds or falls into the numerical range of the preset threshold value, the shrimp fry to be tested is marked, and the marked shrimp fry is hidden. The contour area of the next shrimp fry is continued until the contour area of the shrimp fry to be tested is less than the preset threshold value, and the shrimp fry to be tested will no longer be marked and counted.
[0022] The present invention also provides a shrimp fry marking device based on image processing, comprising a white tray, a camera and an image processor; the white tray is used to hold clear water and shrimp fry to be tested; the camera is used to collect pictures containing the shrimp fry to be tested within the range of the white tray; the image processor is used to convert the collected pictures into binary images; the Sobel operator is used to perform edge detection on the binary image, the contour area of the shrimp fry to be tested in the image is calculated one by one, and it is judged one by one whether the obtained contour area is greater than or equal to a preset threshold. If the contour area exceeds the preset threshold, it is marked and counted until the contour area of the shrimp fry to be tested is less than the preset threshold, and the shrimp fry to be tested is no longer marked and counted; the total number of shrimp fry to be tested is calculated, and the marked shrimp fry to be tested are highlighted.
[0023] Further preferably, it also includes a box with a light emitter, the box is used to install a white tray, the light emitter is arranged in the box, and is located above the white tray; the light emitter is used to provide uniform fill light for the shrimp seedlings to be tested.
[0024] Further preferably, the light emitting device includes an LED light emitting body, a pure white light shielding plate and a control button, the control button is connected to the LED light emitting body and is used to control the conduction and shutdown of the LED light emitting body; the pure white light shielding plate is arranged on the periphery of the LED light emitting body and is used to uniformly reflect the light emitted by the LED light emitting body.
[0025] The shrimp fry marking method and device based on image processing disclosed in this application have at least the following advantages over the prior art:
[0026] 1. Collect images of shrimp fry to be tested and convert them into binary images. Use the Sobel operator for edge detection. Select markers based on the median of all edge areas. This effectively improves the efficiency and accuracy of shrimp fry counting and does not damage live shrimp fry in water. The device is simple in structure and easy to operate.
[0027] 2. When collecting pictures of the shrimp seedlings to be tested within the white tray, multiple priorities were set based on the impact of different factors on clarity. Finally, three pictures with higher clarity were selected for marking, avoiding the impact of a single factor on clarity and improving the accuracy of shrimp seedling counting. BRIEF DESCRIPTION OF THE DRAWINGS
[0028] Figure 1The figure is a flow chart of the shrimp fry marking method based on image processing of the present invention.
[0029] Figure 2 This is a schematic diagram of the connection structure of the shrimp fry marking device based on image processing of the present invention.
[0030] Figure 3 This is a schematic structural diagram of the shrimp fry marking device based on image processing of the present invention. DETAILED DESCRIPTION
[0031] The present invention is further described in detail below with reference to the accompanying drawings and specific embodiments.
[0032] like Figure 1 As shown, an embodiment of one aspect of the present invention provides a shrimp fry marking method based on image processing, comprising the following steps:
[0033] S1. Place the shrimp fry to be tested in a white tray filled with clear water;
[0034] S2. Collect pictures of the shrimp seedlings to be tested within the range of the white tray;
[0035] Further, in S2, when collecting pictures of the shrimp seedlings to be tested within the range of the white tray, the following steps are included: according to the camera's acquisition cycle, multiple pictures continuously collected by the camera in continuous acquisition cycles are obtained; each picture is sorted according to its clarity; and the top three pictures with high clarity are retained.
[0036] The sorting according to the clarity of each picture includes the following steps:
[0037] Calculate the pixel size of each image and sort the images with the first priority from high pixel to low pixel. Generally, the clarity of an image is closely related to the pixel value, so images with higher clarity are filtered based on the pixel value. The higher the pixel value, the better the clarity.
[0038] For images with equal pixels, the Laplacian operator is used to perform template convolution on the image to obtain the high-frequency components of the image. The high-frequency components of the image are summed, and the images are sorted by the sum of the high-frequency components. For images with small pixel differences, it is necessary to filter based on the brightness difference of the image. The areas where the brightness or grayscale changes drastically in the image correspond to high-frequency components. By calculating the sum of the high-frequency components, images with high brightness are distinguished. The higher the brightness or the higher the contrast, the clearer the image is considered to be.
[0039] Perform brightness homogenization on high-frequency components and similar images, perform edge detection on the processed images, sum the gradient values of edge detection, and use the sum of edge detection gradient values to sort the images in the third priority order from large to small; the larger the sum of edge detection gradient values, the more obvious the edge boundaries of the objects in the image, and the less ghosting and other phenomena will occur. Based on the sum of edge detection gradient values, images with high clarity can be further screened.
[0040] The first three pictures with high definition are selected in descending order from the third priority to the first priority.
[0041] S3, converting the collected image into a binary image; and also including using an adaptive histogram to perform equalization processing on the binary image to enhance the image contrast.
[0042] S4, use Sobel operator to perform edge detection on the binary image, calculate the outline area of the shrimp seed to be tested in the image one by one, and judge one by one whether the outline area obtained is greater than or equal to the preset threshold. If it exceeds the preset threshold, mark and count until the outline area of the shrimp seed to be tested is less than the preset threshold, then no longer mark and count the shrimp seed to be tested;
[0043] S5. Calculate the total number of shrimp fry to be tested, and highlight the marked shrimp fry to be tested.
[0044] The shrimp fry to be tested in each picture were marked, and the number of marked shrimp fry to be tested was counted. The median of the number of shrimp fry to be tested counted in the three images was selected as the final result of the number of shrimp fry to be tested counted.
[0045] Further preferably, in S4, the contour area of the shrimp fry to be tested in the image is calculated one by one, including using the Sobel operator to perform edge detection on the binary image to obtain the contour of the shrimp fry to be tested, and obtaining the contour area of the shrimp fry to be tested by calculating the size of the pixels within the contour.
[0046] Further preferably, in S4, when marking the shrimp fry to be tested, the following method is adopted:
[0047] According to the shrimp fry growth age, set the default values corresponding to different growth ages;
[0048] According to the current age of the shrimp fry to be tested, the default value corresponding to the current age is adjusted up and down to obtain a preset threshold value. The preset threshold value is a numerical range. When the contour area of the shrimp fry to be tested exceeds or falls into the numerical range of the preset threshold value, the shrimp fry to be tested is marked, and the marked shrimp fry is hidden. The contour area of the next shrimp fry is continued until the contour area of the shrimp fry to be tested is less than the preset threshold value, and the shrimp fry to be tested will no longer be marked and counted.
[0049] In one embodiment of the present invention, the upper limit of the preset threshold value range is recorded as Threshold 1, and the lower limit is recorded as Threshold 2. The obtained contour area is compared with Threshold 1. Targets with contour areas larger than Threshold 1 are marked and counted, and the marked shrimp fry to be tested are hidden. The contour areas of the remaining unmarked shrimp fry to be tested are then compared with the predicted threshold. If Threshold 2 ≤ Contour Area ≤ Threshold 1, they are marked and counted, and then hidden. This process is repeated until the contour area of the shrimp fry to be tested is smaller than Threshold 2, at which point they are no longer marked and counted.
[0050] like Figure 2-3 As shown, the present invention also provides a shrimp fry marking device based on image processing for implementing the above method, comprising a white tray ( Figure 3 Place a white tray at A in the middle), camera ( Figure 3 a mobile phone or camera is placed at B in the middle) and an image processor; the white tray is used to hold clear water and the shrimp fry to be tested; the camera is used to capture pictures of the shrimp fry to be tested within the range of the white tray; the image processor is used to convert the captured pictures into binary images; the Sobel operator is used to perform edge detection on the binary image, the contour area of the shrimp fry to be tested in the image is calculated one by one, and whether the obtained contour area is greater than or equal to a preset threshold is determined one by one. If the contour area exceeds the preset threshold, it is marked and counted until the contour area of the shrimp fry to be tested is less than the preset threshold, at which time the shrimp fry to be tested is no longer marked and counted; the total number of the shrimp fry to be tested is calculated, and the marked shrimp fry to be tested are highlighted.
[0051] More preferably, it further comprises a box with a light emitter, wherein the box is used to install the white tray, and the light emitter is arranged in the box and located above the white tray.
[0052] Further preferably, the light emitting device includes an LED light emitting body, a pure white light shielding plate and a control button, the control button is connected to the LED light emitting body and is used to control the conduction and shutdown of the LED light emitting body; the pure white light shielding plate is arranged on the periphery of the LED light emitting body and is used to uniformly reflect the light emitted by the LED light emitting body.
[0053] Obviously, the above embodiments are merely examples for clarity of explanation and are not intended to limit the implementation methods. Those skilled in the art will readily appreciate that other variations or modifications based on the above descriptions are possible. It is not necessary and impossible to enumerate all implementation methods here. Obvious variations or modifications arising therefrom remain within the scope of protection of the present invention.
Claims
1. A shrimp fry marking method based on image processing, characterized in that: The following steps are involved: S1. Place the shrimp fry to be tested in a white tray filled with clear water; S2. Collecting pictures of the shrimp fry to be tested within the range of the white tray. In S2, collecting pictures of the shrimp fry to be tested within the range of the white tray includes the following steps: According to the camera's acquisition cycle, multiple pictures continuously acquired by the camera in consecutive acquisition cycles are obtained; Sorting according to the clarity of each picture; the sorting according to the clarity of each picture includes the following steps: Calculate the pixel size of each image and sort the images in order from highest pixel size to lowest pixel size, giving them the first priority. For images with equal pixels, the Laplacian operator is used to perform template convolution on the image to obtain the high-frequency components of the image, the high-frequency components of the image are summed, and the high-frequency components are used to sort the images in the second priority order; Perform brightness homogenization on high-frequency components and similar images, perform edge detection on the processed images, sum the gradient values of the edge detection, and use the sum of the edge detection gradient values from large to small to sort the images in the third priority order; Select the top three images with the highest definition in descending order from the third priority to the first priority; Keep the first three images with high resolution; S3, converting the collected pictures into binary images; S4, use Sobel operator to perform edge detection on the binary image, calculate the outline area of the shrimp seed to be tested in the image one by one, and judge one by one whether the outline area obtained is greater than or equal to the preset threshold. If it exceeds the preset threshold, mark and count until the outline area of the shrimp seed to be tested is less than the preset threshold, then no longer mark and count the shrimp seed to be tested; S5. Calculate the total number of shrimp fry to be tested, and highlight the marked shrimp fry to be tested.
2. The shrimp fry marking method based on image processing according to claim 1, wherein The shrimp fry to be tested in each picture were marked, and the number of marked shrimp fry to be tested was counted. The median of the number of shrimp fry to be tested counted in the three images was selected as the final result of the number of shrimp fry to be tested counted.
3. The shrimp fry marking method based on image processing according to claim 1, wherein Between S3 and S4, an adaptive histogram is also used to perform equalization processing on the binary image to enhance the image contrast.
4. The shrimp fry marking method based on image processing according to claim 1, wherein In S4, the contour areas of the shrimp fry to be tested in the image are calculated one by one, including using the Sobel operator to perform edge detection on the binary image to obtain the contours of the shrimp fry to be tested, and obtaining the contour areas of the shrimp fry to be tested by calculating the sizes of the pixels within the contours.
5. The shrimp fry marking method based on image processing according to claim 1, wherein In S4, the following method is used to mark the shrimp fry to be tested: According to the shrimp fry growth age, set the default values corresponding to different growth ages. According to the current age of the shrimp fry to be tested, the default value corresponding to the current age is adjusted up and down to obtain a preset threshold value. The preset threshold value is a numerical range. When the contour area of the shrimp fry to be tested exceeds or falls into the numerical range of the preset threshold value, the shrimp fry to be tested is marked, and the marked shrimp fry is hidden. The contour area of the next shrimp fry is continued until the contour area of the shrimp fry to be tested is less than the preset threshold value, and the shrimp fry to be tested will no longer be marked and counted.
6. A shrimp fry marking device based on image processing, characterized in that: Used to implement the shrimp fry marking method based on image processing as described in any one of claims 1 to 5 above, comprising a white tray, a camera and an image processor; The white tray is used to hold clear water and shrimp fry to be tested; The camera is used to capture images of the shrimp seedlings to be tested within the range of the white tray; The image processor is used to convert the collected picture into a binary image; use the Sobel operator to perform edge detection on the binary image, calculate the contour area of the shrimp fry to be tested in the image one by one, and determine whether the obtained contour area is greater than or equal to a preset threshold one by one. If the contour area exceeds the preset threshold, it is marked and counted until the contour area of the shrimp fry to be tested is less than the preset threshold, and then the shrimp fry to be tested is no longer marked and counted; Count the total number of shrimp fry to be tested and highlight the marked shrimp fry to be tested.
7. The shrimp fry marking device based on image processing according to claim 6, characterized in that: It also includes a box with a light emitter, which is used to install a white tray. The light emitter is arranged in the box and located above the white tray; the light emitter is used to provide uniform fill light for the shrimp seedlings to be tested.
8. The shrimp fry marking device based on image processing according to claim 7, characterized in that: The light emitting device includes an LED light emitting body, a pure white light shielding plate and a control button. The control button is connected to the LED light emitting body and is used to control the conduction and shutdown of the LED light emitting body; the pure white light shielding plate is arranged on the periphery of the LED light emitting body and is used to uniformly reflect the light emitted by the LED light emitting body.
Citation Information
Patent Citations
Image recognition method and system
CN106548113A
Image-photographing counting device
CN107820010A
Fruit tree flowering phase management system based on image recognition
CN108513102A