CN112380920B - Method for counting fry number by using video data - Google Patents

Method for counting fry number by using video data Download PDF

Info

Publication number
CN112380920B
CN112380920B CN202011146080.3A CN202011146080A CN112380920B CN 112380920 B CN112380920 B CN 112380920B CN 202011146080 A CN202011146080 A CN 202011146080A CN 112380920 B CN112380920 B CN 112380920B
Authority
CN
China
Prior art keywords
image
pixel
fry
data
frame
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN202011146080.3A
Other languages
Chinese (zh)
Other versions
CN112380920A (en
Inventor
张收元
张胜茂
王书献
邹国华
戴阳
崔雪森
樊伟
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Shanghai Junding Fishery Technology Co ltd
East China Sea Fishery Research Institute Chinese Academy of Fishery Sciences
Original Assignee
Shanghai Junding Fishery Technology Co ltd
East China Sea Fishery Research Institute Chinese Academy of Fishery Sciences
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Shanghai Junding Fishery Technology Co ltd, East China Sea Fishery Research Institute Chinese Academy of Fishery Sciences filed Critical Shanghai Junding Fishery Technology Co ltd
Priority to CN202011146080.3A priority Critical patent/CN112380920B/en
Publication of CN112380920A publication Critical patent/CN112380920A/en
Application granted granted Critical
Publication of CN112380920B publication Critical patent/CN112380920B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V40/00Recognition of biometric, human-related or animal-related patterns in image or video data
    • G06V40/10Human or animal bodies, e.g. vehicle occupants or pedestrians; Body parts, e.g. hands
    • AHUMAN NECESSITIES
    • A01AGRICULTURE; FORESTRY; ANIMAL HUSBANDRY; HUNTING; TRAPPING; FISHING
    • A01KANIMAL HUSBANDRY; AVICULTURE; APICULTURE; PISCICULTURE; FISHING; REARING OR BREEDING ANIMALS, NOT OTHERWISE PROVIDED FOR; NEW BREEDS OF ANIMALS
    • A01K61/00Culture of aquatic animals
    • A01K61/90Sorting, grading, counting or marking live aquatic animals, e.g. sex determination
    • A01K61/95Sorting, grading, counting or marking live aquatic animals, e.g. sex determination specially adapted for fish
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V20/00Scenes; Scene-specific elements
    • G06V20/40Scenes; Scene-specific elements in video content

Landscapes

  • Engineering & Computer Science (AREA)
  • Life Sciences & Earth Sciences (AREA)
  • General Physics & Mathematics (AREA)
  • Physics & Mathematics (AREA)
  • Multimedia (AREA)
  • Theoretical Computer Science (AREA)
  • Zoology (AREA)
  • Environmental Sciences (AREA)
  • Human Computer Interaction (AREA)
  • Marine Sciences & Fisheries (AREA)
  • Animal Husbandry (AREA)
  • Biodiversity & Conservation Biology (AREA)
  • Image Processing (AREA)

Abstract

The invention relates to a method for counting fry quantity by using video data, which comprises the following steps: acquiring images of the fries passing through the fishway by image acquisition equipment; carrying out gray level processing on each frame of image of the obtained image, and reducing the resolution; carrying out binarization processing on each frame of image to ensure that only black pixel points and white pixel points exist on the image; extracting the same N columns of pixel data from each frame image; processing black pixel points on each row of pixel data to determine statistical pixels; and comparing the N rows of pixel data of the next frame of image with the N rows of pixel data of the previous frame of image line by line, if the pixel is converted from a white pixel point to a black pixel point, the fry statistic value is increased by 1 by self, and the final statistic value is obtained after all images are compared. The invention can rapidly count the number of the fry.

Description

Method for counting fry number by using video data
Technical Field
The invention relates to application of an image processing and analyzing technology in the field of aquaculture, in particular to a method for counting fry quantity by using video data.
Background
The scale statistics of the number of the fry in a certain water body is a problem frequently encountered in the field of aquatic products, and the statistics of the number specification of the fry can be involved in aquatic product application links such as feed putting, transportation and sale, survival rate statistics, cultivation density control and the like. The traditional fry testing methods include statistical methods such as a push algorithm, a bowl measurement method and an interval method, but the methods are not only complex in operation, but also have the obvious defects of low efficiency, large error and the like because the fry are not distributed uniformly, and the counting values of the methods are often far from the actual fry number. Since the 80 s of the 20 th century, some fishermen developed modern fry counting tools such as photoelectric fish meters and bridge fish meters, but these tools are not only expensive, but also susceptible to various factors such as fry size.
Digital image processing technology is a method and technology for processing an image by removing noise, enhancing, restoring, segmenting, extracting features, and the like through a computer, and the digital image processing technology is originally appeared in the 50 th of the 20 th century. With the rapid development of computer technology and the establishment and perfection of discrete mathematical theory, the application field of digital image processing technology is continuously expanded. The fry quantity is counted by using a digital image processing technology without causing damage to the fry, and the analysis capability of a computer is slightly interfered by the outside, so that a method for counting the fry quantity by using video data, which is fast in business operation, needs to be found.
Disclosure of Invention
The invention aims to provide a method for counting the number of fries by using video data, which can quickly count the number of the fries.
The technical scheme adopted by the invention for solving the technical problems is as follows: the method for counting the fry number by using the video data comprises the following steps:
(1) acquiring images of the fries passing through the fishway by image acquisition equipment;
(2) carrying out gray level processing on each frame of image of the obtained image, and reducing the resolution;
(3) carrying out binarization processing on each frame of image to ensure that only black pixel points and white pixel points exist on the image;
(4) extracting the same N columns of pixel data from each frame image;
(5) processing black pixel points on each row of pixel data to determine statistical pixels;
(6) and comparing the N rows of pixel data of the next frame of image with the N rows of pixel data of the previous frame of image line by line, if the pixel is converted from a white pixel point to a black pixel point, the fry statistic value is increased by 1 by self, and the final statistic value is obtained after all images are compared.
The fishway is of a flat cuboid structure.
The image acquisition equipment acquires images of the fry passing through the fishway from the right above.
And (3) when the resolution is reduced in the step (2), the number of pixels occupied by each fry in the vertical direction in the reduced image is 1-5.
And (3) between the step (2) and the step (3), carrying out corrosion treatment on each frame of image to remove impurities in the image, and then carrying out expansion treatment to compensate the holes in the image.
And (4) the distances between two adjacent columns of pixel data in the N columns of pixel data are equal.
The step (5) is specifically as follows: if the number of continuous black pixel points in a certain row of pixel data is 1, skipping the black pixel points, and not performing special treatment; if the number of continuous black pixel points in a certain row of pixel data is 2, taking a first black pixel point as a statistical pixel, and setting a second black pixel point as an invalid pixel; if the number of continuous black pixel points in a certain row of pixel data is larger than 2, one black pixel point in the middle position is reserved as a statistical pixel, and other black pixel points are set as invalid pixels.
The pixel value of the invalid pixel is set to 128 and ignored when performing the line-by-line comparison in step (6).
Advantageous effects
Due to the adoption of the technical scheme, compared with the prior art, the invention has the following advantages and positive effects: the experimental device is simple, the operation process is convenient and fast, and the fry cannot be influenced so as to influence income; when the sampling environment is ideal, the experimental error is extremely small, and the counting error caused by part of environmental problems can be shielded by dynamically configuring the column numbers; after the fry video is obtained, the whole counting process is completed by a computer program, the speed is high, the error is small, manual intervention is not needed, the human resources can be greatly saved, and the efficiency is improved.
Drawings
FIG. 1 is a flow chart of the present invention;
FIG. 2 is a diagram of an apparatus for capturing a fry video according to the present invention;
FIG. 3 is a schematic view of fry flowing from left to right with water;
FIG. 4 is a diagram of a vertically selected 5 rows of pixels on an image;
FIG. 5 is a diagram of statistical pixels of fry
FIG. 6 is a diagram of a frame in an experiment of the present invention;
fig. 7 is a diagram of a certain frame after the binarization processing of the present invention.
Detailed Description
The invention will be further illustrated with reference to the following specific examples. It should be understood that these examples are for illustrative purposes only and are not intended to limit the scope of the present invention. Further, it should be understood that various changes or modifications of the present invention may be made by those skilled in the art after reading the teaching of the present invention, and such equivalents may fall within the scope of the present invention as defined in the appended claims.
The embodiment of the invention relates to a method for counting fry quantity by using video data, which comprises the following steps as shown in figure 1: storing the fry and water in a fry storage barrel, wherein the fry in the fry storage barrel flows out along with the water and passes through a fishway; the camera fixed directly over the fishway shoots fry images, and the fry flow into the split charging barrel after passing through the fishway. The camera acquires each frame of image when the fry flows into the sub-packaging barrel after passing through the fishway; losing each frame of image, extracting a color layer of a color image from the original video, converting the color layer into a gray image, and reducing the resolution of the original image; and then removing impurities in the image processed by the steps by corrosion treatment. And then compensating the holes in the image processed by the steps by expansion processing.
Binarizing the image according to a specified threshold value, and ensuring that only a black point with a pixel value of 0 and a white point with a pixel value of 255 exist in the image after the step; extracting five columns of pixel data according to the column number configured by the user; preprocessing five rows of data, determining statistical pixels and eliminating invalid pixels; and comparing the five columns of pixel data of the current frame with the five columns of pixel data of the previous frame row by row. If the pixel value is changed from white to black, the fry statistic value is increased by 1. Until the last row of pixels is compared; and acquiring the pixel of the next frame, and repeating the steps until the pixel data of the last frame is extracted.
The invention is further illustrated by the following specific example.
1. Data acquisition
As shown in figure 2, fry and water are put in the fry storage barrel, a switch at the bottom of the fry storage barrel is turned on, and the fry flows to a fishway along with the water. The fishway is extremely large in width and extremely small in height, so that the fries are basically not overlapped up and down. And a camera device is fixed right above the fishway, and the camera function is started. The tail part of the fishway is connected with a sub-packaging barrel, and the fry finally flows to the sub-packaging barrel after passing through the fishway. The camera records the video data of the fry to be counted from the fry storage barrel to the split charging barrel through the fishway.
2. First frame data analysis and processing
The fish way is schematically shown in fig. 3, the fry flows from left to right along with water, and because the fish way is wide and very small in height, the fry rarely overlaps up and down. The colors of the shot images are complex, the fishway only comprises three substances of fishway, water and fry, the colors in the original video file are discarded for convenient analysis, and only the gray data is reserved.
First, first frame data is obtained, the resolution of an original video file is 1920 × 1080, and the resolution of each frame of image data is 1920 × 1080. In order to increase the processing speed and not influence the counting effect, the resolution of the frame image is reduced. The determination principle of the reduction multiple is as follows: after the reduction, each fry occupies about 1-5 pixels in the vertical direction. In order to ensure the data quality, the original video is reduced in horizontal and vertical directions by an equal ratio, and the reduction multiple is 10 times. I.e. the resolution of the reduced image is 192 x 168.
And corroding the image to remove partial independent black spots in the image, wherein the black spots can be caused by untidy fishways, impurities in water and the like. And expanding the image and compensating the hole pixels in the image.
A threshold value is set for the processed image, and the frame image is binarized by a threshold value of 110, that is, all pixels smaller than 110 are set to 0, and all pixels greater than or equal to 110 are set to 255. The background of the fishway is white and the fry is black. Fig. 6 is a screenshot of a frame of image for an experiment. Fig. 7 is a diagram obtained by subjecting a certain frame to binarization processing.
In this embodiment, the resolution of the image is reduced according to the size of the fry. To count the fry, 5 columns of pixels are selected vertically on the image (see fig. 4), the pixels are white when no fry passes through, and the pixels are black when a fry passes through. When the fry flows from left to right along with water, individual fry swim along the fry passage in the reverse direction, and because the fish passage is long, the fry swim through two columns of longitudinal items at most, so that a large statistical error cannot be caused.
The fry has big or small size, some fries possess a pixel, some possess two pixels, some possess more than three pixel, if occupy a pixel, just process according to this pixel, if possess two pixels, choose one to handle, if possess more than 3 pixels, choose middle pixel, the pixel of selecting is called statistics pixel (see fig. 5).
In this embodiment, five rows of pixel data with column numbers of 31, 63, 95, 127, and 159 are extracted, and the five rows are preprocessed. Traversing line by line, if the number of continuous black pixel points in a certain column is 1, skipping the pixel, and not performing special processing; if the number of the continuous black pixel points in a certain row is 2, taking the first pixel as a statistical pixel, and setting the second black pixel as an invalid pixel; if the number of the continuous black pixel points in a certain column is more than 2, the black pixel points in the middle position are kept as statistical pixels, and other black pixel points are set as invalid pixels; if an invalid pixel is detected, it is skipped directly. In the above process, a specific way to set the pixel to invalid is to set the pixel value to 128. The specific pixel data of the first frame after five columns of processing in this embodiment is shown in table 1:
TABLE 1 first frame pixel data
Figure BDA0002739739870000041
Figure BDA0002739739870000051
Figure BDA0002739739870000061
And storing the first frame data into a list to be used as a first group of comparison data.
3. Processing other data
And (3) acquiring next frame data according to the step 2, and carrying out operations such as graying, resolution reduction, corrosion, expansion, binarization, preprocessing and the like on the next frame data. And obtaining a new list after operation, wherein the list comprises five groups of sub-list elements, each sub-list element represents a row of data and comprises 108 elements, and each element represents a pixel point. Compare the list to the comparison data: and if the comparison data is 255 and the current data is 0, increasing the fry count value of the row of the current element by 1, otherwise, not operating. And after the comparison of the two lists is finished, setting the current list data as comparison data, and waiting for the comparison of the next frame data. Until the last frame is compared. The above traversal process is completed by a computer.
4. Interface display
After the data processing is finished, the statistical result of each column is displayed in the user interface, and the obtained data is shown in table 2:
TABLE 2 statistical results
Column number Counting the number of fish fry
First group 31 239
Second group 63 214
Third group 95 210
Fourth group 127 328
Fifth group 159 314
The experimental device is simple, the operation process is convenient and fast, and the fry cannot be influenced to influence the income; when the sampling environment is ideal, the experimental error is extremely small, and the counting error caused by part of environmental problems can be shielded by dynamically configuring the column numbers; after the fry video is obtained, the whole counting process is completed by a computer program, the speed is high, the error is small, manual intervention is not needed, the human resources can be greatly saved, and the efficiency is improved.

Claims (7)

1. A method for counting fry quantity by using video data is characterized by comprising the following steps:
(1) acquiring images of the fries passing through the fishway by image acquisition equipment;
(2) carrying out gray level processing on each frame of image of the obtained image, and reducing the resolution;
(3) carrying out binarization processing on each frame of image to ensure that only black pixel points and white pixel points exist on the image;
(4) extracting the same N columns of pixel data from each frame image;
(5) processing black pixel points on each row of pixel data to determine statistical pixels; the method specifically comprises the following steps: if the number of continuous black pixel points in a certain row of pixel data is 1, skipping the black pixel points, and not performing special treatment; if the number of continuous black pixel points in a certain row of pixel data is 2, taking a first black pixel point as a statistical pixel, and setting a second black pixel point as an invalid pixel; if the number of continuous black pixel points in a certain row of pixel data is more than 2, keeping one black pixel point at the middle position as a statistical pixel, and setting other black pixel points as invalid pixels;
(6) and comparing the N rows of pixel data of the next frame of image with the N rows of pixel data of the previous frame of image line by line, if the pixel is converted from a white pixel point to a black pixel point, the fry statistic value is increased by 1 by self, and the final statistic value is obtained after all images are compared.
2. The method for counting fry number using video data as claimed in claim 1, wherein the fishway has a flat rectangular parallelepiped structure.
3. The method for counting the number of fish fries by using video data as claimed in claim 1, wherein the image capturing device in step (1) captures the image of the fish fries passing through the fishway from the right above.
4. The method according to claim 1, wherein the resolution is reduced in the step (2) so that each fry occupies 1-5 pixels in the vertical direction in the image after the reduction.
5. The method for counting fry number by using video data as claimed in claim 1, further comprising between the step (2) and the step (3), performing erosion processing on each frame of image to remove impurities in the image, and performing dilation processing to compensate for holes in the image.
6. The method for counting fry number using video data as claimed in claim 1, wherein the distance between two adjacent columns of pixel data in the N columns of pixel data in step (4) is equal.
7. The method for counting fry number using video data as claimed in claim 1, wherein the pixel value of the invalid pixel is set to 128 and is ignored when the step (6) performs the line-by-line comparison.
CN202011146080.3A 2020-10-23 2020-10-23 Method for counting fry number by using video data Active CN112380920B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202011146080.3A CN112380920B (en) 2020-10-23 2020-10-23 Method for counting fry number by using video data

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202011146080.3A CN112380920B (en) 2020-10-23 2020-10-23 Method for counting fry number by using video data

Publications (2)

Publication Number Publication Date
CN112380920A CN112380920A (en) 2021-02-19
CN112380920B true CN112380920B (en) 2021-08-10

Family

ID=74580817

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202011146080.3A Active CN112380920B (en) 2020-10-23 2020-10-23 Method for counting fry number by using video data

Country Status (1)

Country Link
CN (1) CN112380920B (en)

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113674200B (en) * 2021-07-08 2024-07-12 浙江大华技术股份有限公司 Method and device for counting articles on assembly line and computer storage medium
CN114020074B (en) * 2021-09-30 2022-10-11 杭州费尔马科技有限责任公司 Intelligent unmanned culture system and method for culture pond

Family Cites Families (13)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2007272614A (en) * 2006-03-31 2007-10-18 Nagasaki Prefecture Action analysis device using interlaced image
CN101430775B (en) * 2008-11-17 2011-09-07 浙江海洋学院 Automatic fry counting system based on computer vision
CN102073905A (en) * 2009-11-23 2011-05-25 财团法人资讯工业策进会 Aquatic animal counting system and method
US9069550B2 (en) * 2010-11-29 2015-06-30 International Business Machines Corporation System and method for adjusting inactivity timeout settings on a display device
CN102805044B (en) * 2012-07-16 2014-01-29 宁波大学 Fish, shrimp and crab seed automatic counting device and method based on computer video processing
CN104137796B (en) * 2014-07-28 2016-03-02 中国水产科学研究院东海水产研究所 Fry sorter
CN204540393U (en) * 2015-03-31 2015-08-12 中国水产科学研究院东海水产研究所 Pomfret seedling counting device
CN106204626B (en) * 2016-07-26 2019-01-29 浙江省海洋水产研究所 A kind of fig counter based on image procossing
ES2950682T3 (en) * 2017-08-16 2023-10-11 Furuno Electric Co Fish counting device, fish counting system and procedure for counting fish
CN107909137A (en) * 2017-11-27 2018-04-13 南瑞集团有限公司 A kind of fish pass crosses fish counting and recognition methods
CN208225070U (en) * 2018-01-18 2018-12-11 中国水产科学研究院东海水产研究所 Fish body quantity statistics device in vertical seam type fish channel
TWI687159B (en) * 2018-07-10 2020-03-11 群光電能科技股份有限公司 Fry counting system and fry counting method
CN110046594A (en) * 2019-04-22 2019-07-23 中国农业科学院农业信息研究所 A kind of method of picture count

Also Published As

Publication number Publication date
CN112380920A (en) 2021-02-19

Similar Documents

Publication Publication Date Title
Pape et al. 3-D histogram-based segmentation and leaf detection for rosette plants
CN112380920B (en) Method for counting fry number by using video data
CN104537671B (en) A kind of cigarette filter stick on-line counting and quality determining method based on machine vision
CN111260616A (en) Insulator crack detection method based on Canny operator two-dimensional threshold segmentation optimization
CN104008401B (en) A kind of method and device of pictograph identification
CN113920453A (en) Pig body size weight estimation method based on deep learning
CN108563975B (en) High-density crowd number estimation method based on deep learning
CN110930427B (en) Image segmentation method, device and storage medium based on semantic contour information
CN113191222A (en) Underwater fish target detection method and device
CN113012105B (en) Yarn hairiness detection and rating method based on image processing
CN111539293A (en) Fruit tree disease diagnosis method and system
CN116563237B (en) Deep learning-based chicken carcass defect hyperspectral image detection method
CN110555863A (en) moving object detection method and device and computer readable storage medium
CN113034464A (en) Method for detecting defects of liquid crystal display in real time under multiple backgrounds
CN116912674A (en) Target detection method and system based on improved YOLOv5s network model under complex water environment
CN110298856B (en) Non-contact type fish body length estimation method
CN113222889B (en) Industrial aquaculture counting method and device for aquaculture under high-resolution image
CN111914766B (en) Method for detecting business trip behavior of city management service
CN110334606B (en) Picture-in-picture positioning method and device
CN114550069B (en) Piglet nipple counting method based on deep learning
CN110569853B (en) Target positioning-based independent formula segmentation method
Peng et al. MND-GAN: A research on image deblurring algorithm based on generative adversarial network
CN109448010B (en) Automatic four-side continuous pattern generation method based on content features
US20060126136A1 (en) Image inspecting apparatus, image inspecting method, control program and computer-readable storage medium
CN108830834B (en) Automatic extraction method for video defect information of cable climbing robot

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant