CN-121999355-A - Fish body length measurement method and system
Abstract
The invention discloses a fish body length measurement method and a fish body length measurement system. The method realizes stable and reliable fish body length measurement under the conditions of complex fish body posture and segmentation errors by constructing a two-channel length estimation method of a geometric measurement and area statistics model and combining a self-adaptive fusion mechanism based on shape quality indexes. The method comprises the steps of firstly obtaining geometric measurement length through fish body contour extraction and skeleton analysis, and constructing a statistical length estimation model based on fish body area and shape characteristics to obtain area estimation length. In order to improve the stability of the system in a complex scene, an adaptive fusion mechanism based on shape quality indexes is further constructed, the indexes such as the integrity of the fish body outline, the smoothness of the outline, the region filling rate and the like are evaluated, the weight of the measurement reliability is calculated, and the geometric measurement result and the area estimation result are adaptively fused according to the weight, so that the final fish body length estimation value is obtained.
Inventors
- YE ZHANGYING
- LU GUOXING
- Gao Linyun
- ZHAO JIAN
- PENG ZEQUN
Assignees
- 浙江大学
Dates
- Publication Date
- 20260508
- Application Date
- 20260409
Claims (10)
- 1. The fish body length measuring method is characterized by comprising the following steps of: S1, acquiring an image area only containing a single fish body to obtain a single fish image; S2, performing geometric correction on the acquired image, establishing a mapping relation between a pixel scale and an actual physical scale, and performing scale normalization on the corrected image; S3, preprocessing the image obtained in the step S2 to enhance the contrast between the fish body and the background and obtain a fish body foreground area; S4, extracting the profile of the fish body; s5, carrying out statistical modeling on the center line of the fish body based on the extracted fish body contour points to obtain a fitted center line of the fish body; and S6, obtaining the fish body length Lgeo by combining the mapping relation of the step S2 based on the obtained fish body center line, namely adopting a center line fitting method, obtaining the fish body length Larea by adopting an area model method based on the fish body area obtained in the step S3, and combining the fish body length Lgeo and Larea by combining quality factors to obtain the actual fish body length.
- 2. The fish body length measurement method according to claim 1, wherein in the step S1, the image is a fish body top view image acquired by an acquisition device, and the image area of the individual fish body is acquired based on the target detection.
- 3. The method for measuring the length of the fish body according to claim 1, wherein in the step S2, distortion correction is performed on the single-fish image according to the camera internal parameters of the image acquisition device, the corrected single-fish image is scaled to have uniform actual size references, and a mapping relationship between the pixel scale and the actual physical scale is established based on preset calibration parameters.
- 4. The fish body length measurement method according to claim 1, wherein the preprocessing in the step S3 comprises graying processing, denoising filtering, adaptive threshold segmentation and morphological adaptive cleaning, specifically comprises the steps of graying the image obtained in the step S2, performing Gaussian low-pass filtering, automatically determining a global threshold value for the filtered gray image by adopting an adaptive threshold segmentation algorithm, and performing binarization processing on the image based on the threshold value to obtain an initial fish body foreground region; Performing morphological self-adaptive cleaning, namely self-adaptively determining the size of morphological structural elements according to scale information of fish bodies in single-fish images, and sequentially performing open operation, close operation and region filling processing on the binary images based on the morphological structural elements to obtain communicated and noiseless fish body foreground regions; Wherein, the size of the self-adaptive morphological structure element is determined as follows: , w and h are the width and height of the rectangle connected with the fish body, And Is a defined minimum and maximum, μ is a scaling factor; simultaneously counting fish body pixels to obtain a fish body area A, wherein the fish body area A is as follows: , (x, y) is pixel coordinates, the fish body of the foreground mask M in the binary image is 1, and the background is 0.
- 5. The fish body length measurement method according to claim 1, wherein the fish body contour extraction method in step S4 is as follows: Judging whether the pixel is a boundary pixel or not based on a pixel neighborhood relation in the preprocessed binary image, wherein the pixel neighborhood relation is N8 neighborhood or N4 neighborhood; All fish body contour points are collected to form a fish body boundary pixel point set b= { (x 1, y 1), (x 2, y 2), (xn, yn) }.
- 6. The fish body length measurement method according to claim 1, wherein the modeling method of the fish body center line in step S5 is as follows: based on the extracted fish body contour points, modeling the fish body center line as a cubic polynomial function: y(x)=a 0 +a 1 x+a 2 x 2 +a 3 x 3 , And a 0 、a 1 、a 2 、a 3 is a parameter to be fitted, and the polynomial parameter is solved by using a least square method to obtain a fitted fish body center line.
- 7. The method of claim 1, wherein the method of calculating the fish length Lgeo in step S6 is as follows: Judging whether a central line point is positioned in a fish body foreground region point by point along the direction of the central line of the fish body obtained by fitting, determining the position of the central line entering the fish body foreground region from a background region for the first time as a starting point, combining a mapping relationship to obtain an actual starting point (x s ,y s ), determining the position of the central line entering the background region from the fish body foreground region as an ending point, and combining the mapping relationship to obtain an actual ending point (x e ,y e ); Determining an effective interval [ x s ,x e ] of the central line between the starting point and the ending point; deriving a central line to obtain a first derivative function of the central line; calculating the curve length of the central line in the effective interval according to an arc length formula: 。
- 8. The method of claim 1, wherein the method of calculating the fish body length Larea in step S6 is as follows: obtaining the fish body length Larea based on the area model: , Wherein, the Is a scale factor; r is the length-width ratio of the rectangle outside the fish body: , is an extremely small positive number; compensating the index for a fine length; Q is the convex hull ratio, i.e. the ratio of the fish body area to the convex hull area: , Wherein a hull is the convex hull area; is a bend compensation index; is an area index; Is a bias term; 、 、 、 、 All are obtained through real fish body sample data fitting.
- 9. The method of claim 1, wherein in step S6, the fish body length Lgeo is fused with Larea by combining the quality factor to obtain the actual fish body length L, specifically: , Wherein the quality factor The method comprises the following steps: , Wherein S Q is a Q-based mass fraction, which is: , C is roundness, is: , P is the outline perimeter of the fish body and is calculated by a boundary pixel point coordinate set B; S C is the mass fraction based on C, which is: , F is the area ratio of the fish body in the circumscribed rectangle, namely the filling rate, is: , S F is mass fraction based on filling rate F , Wherein F mid is the fill rate center value; the filling rate attenuation control parameter is also the tolerance range of the filling rate; Q max 、Q min 、C max 、C min 、F max 、F min is the maximum value and the minimum value corresponding to Q, C, F in the fry sample; The linear layer parameter b 0 、b Q 、b C 、b F is obtained by fish fry sample fitting.
- 10. A fish length measurement system, characterized in that computer executable instructions are stored therein, which instructions, when executed, are adapted to carry out the method of any one of claims 1 to 9.
Description
Fish body length measurement method and system Technical Field The invention belongs to the technical field of intelligent detection of aquaculture, and relates to a fish body length measurement method and system. Background In the large-scale and intelligent development process of the aquaculture industry, the quantity statistics and body length detection of fish fries are core basic data support for evaluating the quality of fries, optimizing the culture density, guiding accurate feeding and developing growth situation analysis. In the traditional cultivation mode, the fry counting depends on manual estimation or simple screening tools, body length detection is completed through manual sampling measurement, the efficiency is low, the labor intensity is high, the data accuracy is poor due to manual operation errors and fry stress reaction, and the requirements of modern cultivation on the data accuracy and instantaneity are difficult to meet. Automatic fry counters based on machine vision, sensors and other technologies and some fish length detection methods are gradually developed in the industry. The existing fish fry length detection technology has the common adaptability defect that most schemes are designed only for fish fries of specific body length ranges and specific varieties, the requirements on cleanliness and light stability of detection environments are high, complex conditions such as turbid water quality, intensive swimming of fish fries, large light fluctuation and the like often exist on a cultivation site, the detection precision of the existing technology is greatly reduced, and part of schemes are pursuing measurement precision and excessively complicating technical processes, so that equipment deployment difficulty and maintenance cost are increased, the stability of system operation is reduced, and the low-cost, easy-to-operate and high-reliability practical application requirements on the cultivation site cannot be met. From the perspective of a detection algorithm, the conventional fish body length measurement method mainly comprises a measurement method based on geometric features and an estimation method based on a statistical or machine learning model. The geometric feature-based method generally calculates the length through a fish body skeleton, an endpoint or a contour geometric structure, and has higher precision under the condition that the fish body gesture is relatively straight and the segmentation result is complete, but larger measurement errors are easy to generate when fish body bending, tail loss, contour fracture or segmentation noise exists. On the other hand, although the length estimation method based on the statistical model or the machine learning method has better stability to a certain extent, a large amount of marked data is often required for training, and the method depends on higher computing resources, so that the problems of difficult data acquisition, higher training cost, insufficient model interpretation and the like exist in an actual aquaculture environment. Based on the method, the fish body length measuring method which is simple to realize, low in calculation resource occupation, stable in result and strong in interpretability, can adapt to complex environments of a culture site, and can realize high measurement accuracy and good stability under the conditions of limited fish body posture change, segmentation errors and data samples is the technical problem to be solved in the field. Disclosure of Invention The invention aims at overcoming the defects of the prior art, and provides a fish body length measuring method and a fish body length measuring system, which are a fish body length estimating method based on fusion of geometric measurement and a statistical model. The method comprises the steps of firstly obtaining geometric measurement length Lgeo through fish body contour extraction and skeleton analysis, and constructing a statistical length estimation model based on fish body area and shape characteristics to obtain area estimation length Larea. The statistical model utilizes shape parameters such as fish body area, length-width ratio, convex hull ratio and the like to construct a nonlinear length estimation relation so as to compensate the influence of fish body posture change on area estimation. In order to improve the stability of the system in a complex scene, the invention further constructs a self-adaptive fusion mechanism based on shape quality indexes, evaluates indexes such as fish body contour integrity, contour smoothness, region filling rate and the like, calculates measurement reliability weight, and carries out self-adaptive fusion on a geometric measurement result and an area estimation result according to the weight to obtain a final fish body length estimation value. The technical scheme adopted by the invention is as follows: A method for measuring the length of a fish body, comprising the following steps: S1, acquiring