Video processing method, device, electronic equipment and medium

By extracting and sorting sperm head and tail outlines from sperm swimming video images, the problem of unobjective sperm tail swing image acquisition caused by manual intervention in the existing technology is solved, and automated video processing and efficient data support are achieved.

CN118447428BActive Publication Date: 2024-10-22CAPITAL UNIV OF PHYSICAL EDUCATION & SPORTS
View PDF 7 Cites 0 Cited by

Patent Information

Application Number
CN202410352453.4
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-03-26
Publication Date
2024-10-22
Estimated Expiration
2044-03-26

AI Technical Summary

Technical Problem

In the existing technology, the acquisition of sperm tail swing images requires manual intervention and cannot objectively reflect the changes in the sperm tail during swimming, resulting in the inability to truly evaluate the swing status of the sperm tail.

Method used

By extracting the head and tail contours of the target sperm from the first frame and remaining frames of the sperm swimming video image, and performing affine transformation registration and sorting, an ordered contour image sequence without manual intervention is generated, retaining the time dimension information. Eliminate the impact of location changes.

Benefits of technology

It realizes automatic video processing without manual intervention, truly reflects the swing state of sperm tail, provides rich data support for sperm performance research, and improves processing efficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118447428B_ABST
    Figure CN118447428B_ABST
Patent Text Reader

Abstract

The present invention provides a video processing method, device, electronic device and medium, and relates to the field of video image processing technology. The method includes: extracting the head contour and tail contour of the target sperm from the first frame and the remaining frames of the sperm swimming video image to obtain the first contour image and the second contour image with the frame number; aligning the head contour in each second contour image with the head contour in the first contour image respectively to obtain the affine transformation matrix corresponding to each second contour image; transforming the corresponding second contour image based on the affine transformation matrix to obtain the transformed second contour image; sorting the first contour image and all the transformed second contour images based on the frame number to obtain a contour image sequence arranged according to the frame number. The scheme of the present invention realizes the extraction of an ordered contour image sequence that can truly reflect the swinging state of the sperm tail without interfering with the sperm swimming, providing rich data support for sperm performance research.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of video image processing, and in particular to a video processing method, device, electronic equipment and medium. Background Art

[0002] The tail is the main driver of sperm motility and plays an important role in sperm dynamics assessment. As people's demand for visual information grows, the study of sperm tail motility characteristics through video images has emerged.

[0003] At present, the more common method of obtaining tail swinging images is as follows: first fix the sperm head, and then record the video image to obtain the swinging image of the sperm tail; however, due to human intervention in sperm movement, this method causes the acquired image to be unable to objectively evaluate the swinging of the sperm tail, and therefore urgently needs to be improved. Summary of the invention

[0004] The present invention provides a video processing method, device, electronic equipment and medium, which are used to solve the problem in the prior art that the swinging of sperm tail requires manual intervention and cannot truly reflect the changes of the sperm tail during swimming, and realize fully automatic video processing without manual intervention.

[0005] According to a first aspect of the present invention, the present invention provides a video processing method, the method comprising:

[0006] Extracting the head contour and tail contour of the target sperm from the first frame of the sperm swimming video image to obtain a first contour image with a frame number;

[0007] Extract the head contour and tail contour of the target sperm from the remaining frames of the sperm swimming video image except the first frame to obtain a second contour image with a frame number;

[0008] Registering the head contour in each of the second contour images with the head contour in the first contour image to obtain an affine transformation matrix corresponding to each of the second contour images;

[0009] Transforming the corresponding second contour image based on the affine transformation matrix to obtain a transformed second contour image;

[0010] The first contour image and all transformed second contour images are sorted based on the frame number to obtain a contour image sequence arranged according to the frame number.

[0011] In some possible implementations, before the step of registering the head contour in each of the second contour images with the head contour in the first contour image, the method further includes:

[0012] respectively calculating the circumscribed triangle of the head contour in the first contour image and the head contour in each of the second contour images;

[0013] The three vertices of each circumscribed triangle are sorted according to the sum of the distances from each vertex of each circumscribed triangle to the remaining vertices to obtain three vertices with order.

[0014] In some possible implementations, before the step of registering the head contour in each of the second contour images with the head contour in the first contour image, the method further includes:

[0015] respectively calculating the inscribed triangle of the head contour in the first contour image and the head contour in each of the second contour images;

[0016] The three vertices of each inscribed triangle are sorted according to the sum of the distances from each vertex of each inscribed triangle to the remaining vertices to obtain three vertices with order.

[0017] In some possible implementations, registering the head contour in each of the second contour images with the head contour in the first contour image to obtain an affine transformation matrix corresponding to each of the second contour images includes:

[0018] In a traversal manner, take the head contour in each second contour image as the target contour and perform the following operations:

[0019] Matching three vertices corresponding to each of the target contours with three vertices corresponding to the first contour image in vertex order to obtain a vertex correspondence relationship;

[0020] An affine transformation matrix is ​​calculated using the three vertex coordinates corresponding to the target contour, the three vertex coordinates corresponding to the first contour image, and the vertex correspondence.

[0021] In some possible implementations, transforming the corresponding second contour image based on the affine transformation matrix to obtain the transformed second contour image includes:

[0022] Take each second contour image as the target contour image in a traversal manner and perform the following operations:

[0023] The coordinates of the target contour image are transformed using the affine transformation matrix corresponding to the second contour image to which the target contour belongs.

[0024] In some possible implementations, before the step of extracting the head contour and tail contour of the target sperm from the first frame of the sperm swimming video image, the method further includes:

[0025] Sperm identification is performed on the sperm swimming video image to obtain the target sperm.

[0026] In some possible implementations, the step of performing sperm identification on the sperm swimming video image to obtain target sperm includes:

[0027] Selecting a frame from the sperm swimming video image as a reference frame;

[0028] Performing sperm head recognition on the reference frame to obtain a plurality of candidate sperms and a candidate head contour corresponding to each candidate sperm;

[0029] Based on the candidate head contour corresponding to each candidate sperm, target tracking is performed on the remaining frames of the sperm swimming video image except the reference frame to obtain the tracking area of ​​each candidate sperm in each remaining frame;

[0030] Searching for the contour center of each tracking area to obtain the sperm contour center of each candidate sperm in the remaining frames except the reference frame;

[0031] For each candidate sperm, respectively, the Euclidean distance between the center of the sperm outline in adjacent frames is calculated to obtain the maximum Euclidean distance corresponding to each candidate sperm;

[0032] The candidate sperm whose maximum Euclidean distance corresponding to the candidate sperm exceeds the preset distance is taken as the target sperm.

[0033] According to a second aspect of the present invention, the present invention provides a video processing device, the device comprising:

[0034] A first extraction module, the first extraction module is used to extract the head contour and tail contour of the target sperm from the first frame of the sperm swimming video image to obtain a first contour image with a frame number;

[0035] A second extraction module, the second extraction module is used to extract the head contour and tail contour of the target sperm from the remaining frames of the sperm swimming video image except the first frame, to obtain a second contour image with a frame number;

[0036] A registration module, the registration module is used to register the head contour in each of the second contour images with the head contour in the first contour image, to obtain an affine transformation matrix corresponding to each of the second contour images;

[0037] A transformation module, wherein the transformation module is used to transform the corresponding second contour image based on the affine transformation matrix to obtain a transformed second contour image;

[0038] A sorting module is used to sort the first contour image and all transformed second contour images based on the frame number to obtain a contour image sequence arranged according to the frame number.

[0039] According to the third aspect of the present invention, the present invention also provides an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the program, any of the video processing methods described above is implemented.

[0040] According to a fourth aspect of the present invention, the present invention also provides a non-transitory computer-readable storage medium on which a computer program is stored. When the computer program is executed by a processor, any of the video processing methods described above is implemented.

[0041] The present invention provides a video processing method, which first extracts a first contour image and a second contour image of a target sperm from a first frame and remaining frames of a sperm swimming video image, and then aligns the head contour in the second contour image with the head contour in the first contour image, thereby obtaining an affine transformation matrix corresponding to each second contour image, and then uses the affine transformation matrix corresponding to each second contour image to transform the corresponding image to obtain a transformed second contour image, and finally sorts and combines the first contour image and all the transformed second contour images according to the frame number, thereby generating an ordered contour image sequence with the head aligned, the ordered contour image sequence not only retains the time dimension information of each sperm contour in the video image, but also eliminates the influence of contour transformation caused by position change during the movement of the target sperm, thereby realizing the extraction of an ordered contour image sequence that can truly reflect the swinging state of the sperm tail without interfering with the sperm swimming, and providing rich data support for sperm performance research; in addition, the entire process does not require manual intervention or correction, and realizes automatic processing of sperm swimming videos, with high processing efficiency.

[0042] In addition, a video processing device, an electronic device and a non-transitory computer-readable storage medium provided by the present invention can also achieve the above-mentioned technical effects, which will not be described in detail here. BRIEF DESCRIPTION OF THE DRAWINGS

[0043] In order to more clearly illustrate the technical solutions in the present invention or the prior art, the following briefly introduces the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.

[0044] Figure 1 It is one of the flow charts of the video processing method provided by the present invention;

[0045] Figure 2 is a schematic diagram of registering the head contour using a circumscribed triangle provided by the present invention;

[0046] Figure 3 is a schematic diagram of registering the head contour using an inscribed triangle provided by the present invention;

[0047] Figure 4 is a schematic diagram of the overlapping state of the transformed second contour image sequence provided by the present invention;

[0048] Figure 5 This is the second flow chart of the video processing method provided by the present invention;

[0049] Figure 6 This is a schematic diagram of the target sperm identification process provided by the present invention;

[0050] Figure 7 is a structural schematic diagram of a video processing device provided by the present invention;

[0051] Figure 8 It is a structural schematic diagram of the electronic device provided by the present invention. DETAILED DESCRIPTION

[0052] In order to make the purpose, technical solution and advantages of the present invention clearer, the technical solution of the present invention will be clearly and completely described below in conjunction with the drawings of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0053] Combine the following Figures 1 to 7 A video processing method, a video processing device, an electronic device and a non-transitory computer-readable storage medium of the present invention are described.

[0054] Figure 1 This is one of the flow charts of the video processing method provided by the present invention. Please refer to Figure 1 As shown, this embodiment provides a video processing method, which can be implemented by steps S101 to S105. Each step will be described in detail below:

[0055] Step S101, extracting the head contour and tail contour of the target sperm from the first frame of the sperm swimming video image to obtain a first contour image with a frame number.

[0056] In this embodiment, the sperm swimming video image refers to an image of sperm swimming in semen taken under a microscope. The sperm swimming video image can be acquired through existing video acquisition equipment, such as a professional video recorder, a terminal with a video recording function or a camera. The frame rate and clarity of the sperm swimming video image meet the requirements. The sperm swimming video image is composed of multiple images. The first frame is the first frame image among multiple image frames of the sperm swimming video image. The target sperm refers to the swimming sperm identified from the sperm swimming video image. The target sperm can be determined by the existing sperm recognition technology, for example, selecting a certain frame image and identifying the sperm as the target sperm through the image, or identifying multiple frames of the sperm swimming video, and finding the sperm in motion as the target sperm. The target sperm can be one or more. The first contour image is an image composed of the complete sperm contour of the target sperm in the first frame of the sperm swimming video image. The frame number refers to the serial number of the frame to which the contour image belongs in the sperm swimming video. The first contour image belongs to the first frame, and its corresponding frame number t is 1.

[0057] In the specific implementation process, the complete sperm profile includes a head profile and a tail profile. In the specific implementation process, the head profile and the tail profile can be obtained in the following manner: first identify the head profile of the target sperm, then find the complete sperm profile of the target sperm, and finally regard the remaining part of the complete sperm profile excluding the head profile as the tail profile.

[0058] Step S102, extracting the head contour and tail contour of the target sperm from the remaining frames of the sperm swimming video image except the first frame, and obtaining a second contour image with a frame number.

[0059] In this embodiment, the method for extracting the second contour image can refer to the method for extracting the first contour, so it is not repeated here. It should be noted that each second contour image also has a corresponding frame number, and the method for determining the frame number of the second contour image can also refer to the method for determining the frame number of the first contour. It should be noted that the second contour image is extracted from the second frame, so its frame number should start from two.

[0060] Step S103: register the head contour in each second contour image with the head contour in the first contour image to obtain an affine transformation matrix corresponding to each second contour image.

[0061] In this embodiment, registering each second contour image with the first contour image refers to establishing a corresponding relationship between each second contour image and the first image. The registration is based on the head contours in the two contour images that need to be registered. For example, it is assumed that there are three hundred frames of sperm swimming video images, and each target sperm has a corresponding contour image in each image frame. The contour extracted in the first frame is the first contour image, and the contours of the target sperm extracted in the remaining two hundred and ninety-nine frames are all second contour images. It is necessary to align the head contours of the two hundred and ninety-nine second contour images with the first contour image respectively. In the specific implementation process, the affine transformation matrix can be used for image registration. At least three corresponding points are found from each head contour of the two contour images that need to be registered to establish a corresponding relationship between the two contour images that need to be registered, thereby obtaining an affine transformation matrix. It should be noted that the affine transformation matrix corresponds to each second contour image one by one, that is, the number of affine transformation matrices is the same as the number of second contour images.

[0062] Step S104: transform the corresponding second contour image based on the affine transformation matrix to obtain a transformed second contour image.

[0063] In this embodiment, transforming the second contour image using an affine transformation matrix means that the coordinates of the pixel points corresponding to the contour in the second contour image are affine transformed, so as to move the pixel values ​​of the coordinates before the transformation to the coordinates after the transformation. The contour of the sperm head in the transformed second contour image can be aligned with the contour of the head in the first contour image. It should be noted that the frame number corresponding to the transformed second contour image does not change.

[0064] Step S105 , sorting the first contour image and all transformed second contour images based on the frame number to obtain a contour image sequence arranged according to the frame number.

[0065] In this embodiment, after the aforementioned transformation operation, the transformed second contour images and the first contour images need to be sorted and integrated to obtain an ordered contour image sequence. Specifically, the first contour image is ranked first, and the transformed second contours are arranged in order according to their corresponding frame numbers.

[0066] The video processing method of the present embodiment first extracts the first contour image and the second contour image of the target sperm from the first frame and the remaining frames of the sperm swimming video image respectively, and then aligns the head contour in the second contour image with the head contour in the first contour image to obtain an affine transformation matrix corresponding to each second contour image, and then uses the affine transformation matrix corresponding to each second contour image to transform the corresponding image to obtain a transformed second contour image, and finally sorts and combines the first contour image and all the transformed second contour images according to the frame number to generate an ordered contour image sequence with the head aligned, which not only retains the time dimension information of each sperm contour in the video image, but also eliminates the influence of contour transformation caused by position change during the movement of the target sperm, and realizes the extraction of an ordered contour image sequence that can truly reflect the swinging state of the sperm tail without interfering with the sperm swimming, thereby providing rich data support for sperm performance research; in addition, the entire process does not require manual intervention or correction, and realizes automatic processing of sperm swimming videos with high processing efficiency.

[0067] In some possible implementations, before the aforementioned step S103 of registering the head contour in each second contour image with the head contour in the first contour image, the video processing method further includes:

[0068] respectively calculating the circumscribed triangle of the head contour in the first contour image and the head contour in each second contour image;

[0069] The three vertices of each circumscribed triangle are sorted according to the sum of the distances from each vertex of each circumscribed triangle to the remaining vertices to obtain three vertices with order.

[0070] For example, please refer to Figure 2 As shown, let’s assume Figure 2 The ellipse on the left is the head outline of the target sperm in the first frame of the sperm swimming video image. The circumscribed triangle of the ellipse is denoted as △ABC. Figure 2 The ellipse on the right is the head outline of the target sperm in the Nth frame of the sperm swimming video image (N is greater than or equal to two), and the circumscribed triangle of the ellipse is recorded as △DEF; for △ABC: AB+AC>BA+BC>CA+CB, it can be seen that the sum of the distances from the three vertices of △ABC to other vertices arranged from small to large is ABC; for △DEF: DE+DF>ED+EF>FD+FE, it can be seen that the sum of the distances from the three vertices of △DEF to other vertices arranged from small to large is DEF; based on this correspondence, the correspondence between the vertices of △ABC and △DEF is as follows: vertex A corresponds to vertex D, vertex B corresponds to vertex E, and vertex C corresponds to vertex F.

[0071] It should be noted that in the specific implementation process, when determining the order of the circumscribed triangle vertices based on the vertex distance and the order from small to large, the distance and the order can also be used. The principle is similar to the method of determining the order from large to small, so it will not be repeated here.

[0072] The video processing method of this embodiment uses the circumscribed triangle of the sperm head outline to accurately locate the position and direction of the sperm head, and selects the sperm head direction in the first frame as a reference, so that the sperm outlines of the same sperm in different frames and different swimming states can be aligned using the same reference direction. Not only is the amount of calculation small, but it also has high accuracy and versatility.

[0073] In some possible implementations, before the aforementioned step S103 of registering the head contour in each second contour image with the head contour in the first contour image, the video processing method further includes:

[0074] respectively calculating the inscribed triangle of the head contour in the first contour image and the head contour in each second contour image;

[0075] The three vertices of each inscribed triangle are sorted according to the sum of the distances from each vertex of each inscribed triangle to the remaining vertices to obtain three vertices with order.

[0076] For example, please refer to Figure 3 As shown, let’s assume Figure 3 The ellipse on the left is the head outline of the target sperm in the first frame of the sperm swimming video image. The inscribed triangle of the ellipse is denoted as △ABC. Figure 3 The ellipse on the right is the head outline of the target sperm in the Nth frame of the sperm swimming video image (N is greater than or equal to two), and the inscribed triangle of the ellipse is recorded as △DEF; for △ABC: AB+AC>BA+BC>CA+CB, it can be seen that the sum of the distances from the three vertices of △ABC to other vertices arranged from small to large is ABC; for △DEF: DE+DF>ED+EF>FD+FE, it can be seen that the sum of the distances from the three vertices of △DEF to other vertices arranged from small to large is DEF; based on this correspondence, the correspondence between the vertices of △ABC and △DEF is as follows: vertex A corresponds to vertex D, vertex B corresponds to vertex E, and vertex C corresponds to vertex F.

[0077] It should be noted that in the specific implementation process, when determining the order of inscribed triangle vertices based on vertex distances and vertices, the distances and the order from small to large can also be used. The principle is similar to the method of determining the order from large to small, so it will not be repeated here.

[0078] The video processing method of this embodiment uses the inscribed triangle of the sperm head outline to accurately locate the position and direction of the sperm head, and selects the sperm head direction in the first frame as a reference, so that the sperm outlines of the same sperm in different frames and different swimming states can be aligned using the same reference direction. Not only is the amount of calculation small, but it also has high accuracy and versatility.

[0079] In some possible implementations, the previous step S103, registering the head contour in each second contour image with the head contour in the first contour image, to obtain an affine transformation matrix corresponding to each second contour image, can be specifically implemented by the following steps:

[0080] In a traversal manner, take the head contour in each second contour image as the target contour and perform the following operations:

[0081] Match the three vertices corresponding to each target contour with the three vertices corresponding to the first contour image in vertex order to obtain a vertex correspondence relationship;

[0082] An affine transformation matrix is ​​calculated using the three vertex coordinates corresponding to the target contour and the three vertex coordinates corresponding to the first contour image as well as the vertex correspondence.

[0083] The video processing method of this embodiment traverses all combinations of second contour images and first contour images to find an affine transformation matrix that can align the head contour in each second contour image with the first contour image, thereby preparing for the subsequent transformation of the tail contour in the second contour image.

[0084] In some possible implementations, the aforementioned step S104, transforming the corresponding second contour image based on the affine transformation matrix to obtain the transformed second contour image, includes:

[0085] Take each second contour image as the target contour image in a traversal manner and perform the following operations:

[0086] The coordinates of the target contour image are transformed using the affine transformation matrix corresponding to the second contour image to which the target contour belongs.

[0087] For example, Figure 4 A schematic diagram showing the overlapping state of multiple transformed second contour images is shown. It should be noted that Figure 4 The sperm tail outline in FIG4 is the state of the same sperm after being transformed by the affine transformation matrix in different frames. Each sperm tail has its corresponding frame number. Although FIG4 does not show the frame number corresponding to each tail, Figure 4 The sperm tail in the image is sequential. Combining the sperm tail sequence with the image can clearly reflect the changes in the sperm tail during the swimming process.

[0088] The video processing method of this embodiment traverses all the second contour images and transforms the corresponding sperm contour using the affine transformation matrix corresponding to each second contour image, thereby aligning the sperm contours of the same sperm in different frames with the sperm contour head in the first frame. After the transformation, the second contour image can accurately reflect the change state of the sperm tail when the sperm head remains unchanged relative to the corresponding sperm in the first frame, and the entire process does not require manual correction, which reduces the incidence of human errors and helps to improve the efficiency and accuracy of sperm analysis.

[0089] Please refer to Figure 5 As shown, this embodiment provides another video processing method, which specifically includes the following steps:

[0090] Step S501, performing sperm recognition on the sperm swimming video image to obtain target sperm.

[0091] Step S502, extracting the head contour and tail contour of the target sperm from the first frame of the sperm swimming video image to obtain a first contour image with a frame number;

[0092] Step S503, extracting the head contour and tail contour of the target sperm from the remaining frames of the sperm swimming video image except the first frame, and obtaining a second contour image with a frame number;

[0093] Step S504, registering the head contour in each second contour image with the head contour in the first contour image, to obtain an affine transformation matrix corresponding to each second contour image;

[0094] Step S505, transforming the corresponding second contour image based on the affine transformation matrix to obtain a transformed second contour image;

[0095] Step S506, sorting the first contour image and all transformed second contour images based on the frame number to obtain a sperm contour image sequence arranged according to the frame number.

[0096] The description of steps S502 to S506 can refer to the description of steps S101 to S105, which will not be repeated here. The implementation process of step S501 will be described in detail below.

[0097] Please refer to Figure 6 As shown, step S501, performing sperm recognition on the sperm swimming video image to obtain target sperm, can be specifically achieved by the following steps:

[0098] Step S601, selecting a frame from the sperm swimming video image as a reference frame;

[0099] Step S602, performing sperm head recognition on the reference frame to obtain a plurality of candidate sperms and a candidate head contour corresponding to each candidate sperm;

[0100] Step S603, target tracking is performed on the remaining frames of the sperm swimming video image except the reference frame based on the candidate head contour corresponding to each candidate sperm, to obtain the tracking area of ​​each candidate sperm in each remaining frame;

[0101] Step S604, searching for the contour center of each tracking area to obtain the sperm contour center of each candidate sperm in the remaining frames except the reference frame;

[0102] Step S605, calculating the Euclidean distance of the center of the sperm contour in adjacent frames for each candidate sperm, and obtaining the maximum Euclidean distance corresponding to each candidate sperm;

[0103] Step S606: The candidate sperm whose maximum Euclidean distance corresponding to the candidate sperm exceeds the preset distance is taken as the target sperm.

[0104] For ease of understanding, the following uses the first frame of the sperm swimming video image as a reference frame to explain in detail the process of determining the target sperm and the process of obtaining the target sperm's outline in each frame:

[0105] First, a video image of sperm swimming is obtained; and a video of sperm swimming is obtained by recording a video under a microscope lens with a preset magnification through a camera, wherein the preset magnification refers to a pre-set magnification of the microscope lens. In the specific implementation process, the microscope lens is preferably a ten-fold lens, and the first frame of the sperm swimming video image is used as a reference frame.

[0106] Next, the sperm head is identified; the identification process is as follows: obtain the first frame of the sperm swimming video, convert the image into a grayscale image, calculate the cumulative probability function (CDF) of the image pixel value, and detect the inflection point in the CDF function through an inflection point detection algorithm such as knee. i represents the detected i-th inflection point, p i Indicates the pixel value corresponding to the detected i-th inflection point; if the image is a white background, find p i The value p in the interval [10, 100] th If there are multiple values ​​in the interval [10, 100], take the minimum value as p th ; If the image has a black background, then find p i The value p in the interval [200, 250] th If there are multiple values ​​in the interval [200, 250], take the maximum value as p th ; Use the fixed threshold algorithm to binarize the image, and the fixed threshold is set to p th; Use the contour detection algorithm to analyze the above binarized image, and the detected contour is the candidate sperm head contour.

[0107] Next, sperm swimming tracking is performed; the swimming tracking process is as follows: the circumscribed ellipse of each candidate sperm head contour is calculated, and the center point of the circumscribed ellipse is used as the center point of the contour. Indicates the center point of the head outline of the mth candidate sperm in the first frame of the video. All candidate sperm are tracked by the multi-target tracking algorithm of computer vision. The multi-target tracking algorithm needs to set the tracking area of ​​each tracked object. For the mth candidate sperm, the tracking area of ​​the sperm is set to the center point of the candidate sperm head outline. A square area with a side length of 400 pixels and centered on Represents the tracking area of ​​the mth candidate sperm in the tth frame image of the video.

[0108] Then, determine the true sperm and get the tail outline; the specific process is as follows: for the mth candidate sperm, The area is converted into a grayscale image; the head contour of the mth candidate sperm is calculated by sperm head recognition, and the Represents the head outline of the mth candidate sperm in the tth frame of the video, using represents the center point of the head contour of the mth candidate sperm in the tth frame of the video; the image is binarized using an adaptive threshold algorithm, which uses a Gaussian weighted sum method; the binarized image is analyzed using a contour detection algorithm; for all detected contours, the center point of the head contour of the candidate sperm m is calculated Is it inside the contour? If it is inside a certain contour, then the contour is the contour of the candidate sperm m. Represents the outline of the mth candidate sperm in the tth frame of the video; calculate The center point of the contour, Represents the center point of the outline of the mth candidate sperm in the tth frame of the video; first calculate and The Euclidean distance between them; then find the maximum value of all distances Max dsp ; If Max dsp >2, then the candidate sperm m is the correct sperm, and n represents the true sperm; otherwise, delete the candidate sperm m; for the contour of the true sperm n Remove the sperm head outline The remaining part is the tail outline of sperm n, represents the tail of the real sperm n in the tth frame of the video;

[0109] Finally, the determined true sperm is taken as the target sperm, thereby obtaining the complete outline, head outline and tail outline of each target sperm in each frame.

[0110] The video processing device provided by the present invention is described below. The video processing device described below and the video processing method described above can be referred to each other.

[0111] Please refer to Figure 7 As shown, this embodiment provides a video processing device, which includes: a first extraction module 710, a second extraction module 720, a registration module 730, a transformation module 740 and a sorting module 750. The above modules are described in detail below:

[0112] A first extraction module 710, the first extraction module 710 is used to extract the head contour and tail contour of the target sperm from the first frame of the sperm swimming video image to obtain a first contour image with a frame number;

[0113] The second extraction module 720 is used to extract the head contour and tail contour of the target sperm from the remaining frames of the sperm swimming video image except the first frame, and obtain a second contour image with a frame number;

[0114] A registration module 730, which is used to register the head contour in each second contour image with the head contour in the first contour image to obtain an affine transformation matrix corresponding to each second contour image;

[0115] A transformation module 740, the transformation module 740 is used to transform the corresponding second contour image based on the affine transformation matrix to obtain a transformed second contour image;

[0116] The sorting module 750 is used to sort the first contour image and all transformed second contour images based on the frame number to obtain a contour image sequence arranged according to the frame number.

[0117] The video processing device provided by the present invention first extracts the first contour image and the second contour image of the target sperm from the first frame and the remaining frames of the sperm swimming video image respectively, and then aligns the head contour in the second contour image with the head contour in the first contour image, so as to obtain an affine transformation matrix corresponding to each second contour image, and then uses the affine transformation matrix corresponding to each second contour image to transform the corresponding image to obtain the transformed second contour image, and finally sorts and combines the first contour image and all the transformed second contour images according to the frame number, so as to generate an ordered contour image sequence with the head aligned, the ordered contour image sequence not only retains the time dimension information of each sperm contour in the video image, but also eliminates the influence of contour transformation caused by the position change during the movement of the target sperm, and realizes the extraction of the ordered contour image sequence that can truly reflect the swinging state of the sperm tail without interfering with the sperm swimming, and provides rich data support for the sperm performance research; in addition, the whole process does not require manual intervention or correction, and realizes automatic processing of the sperm swimming video, with high processing efficiency.

[0118] In some possible implementations, the device further includes a first vertex determining module, and the first vertex determining module is configured to:

[0119] respectively calculating the circumscribed triangle of the head contour in the first contour image and the head contour in each second contour image;

[0120] The three vertices of each circumscribed triangle are sorted according to the sum of the distances from each vertex of each circumscribed triangle to the remaining vertices to obtain three vertices with order.

[0121] In some possible implementations, the device further includes a second vertex determination module, and the second vertex determination module is configured to:

[0122] respectively calculating the inscribed triangle of the head contour in the first contour image and the head contour in each second contour image;

[0123] The three vertices of each inscribed triangle are sorted according to the sum of the distances from each vertex of each inscribed triangle to the remaining vertices to obtain three vertices with order.

[0124] In some possible implementations, the registration module 730 is further configured to:

[0125] In a traversal manner, take the head contour in each second contour image as the target contour and perform the following operations:

[0126] Match the three vertices corresponding to each target contour with the three vertices corresponding to the first contour image in vertex order to obtain a vertex correspondence relationship;

[0127] An affine transformation matrix is ​​calculated using the three vertex coordinates corresponding to the target contour and the three vertex coordinates corresponding to the first contour image as well as the vertex correspondence.

[0128] In some possible implementations, the transformation module 740 is further configured to:

[0129] Take each second contour image as the target contour image in a traversal manner and perform the following operations:

[0130] The coordinates of the target contour image are transformed using the affine transformation matrix corresponding to the second contour image to which the target contour belongs.

[0131] In some possible implementations, the device further includes a recognition module, and the recognition module is used to perform sperm recognition on the sperm swimming video image to obtain target sperm.

[0132] In some possible implementations, the identification module is further configured to:

[0133] Select a frame from the sperm swimming video image as a reference frame;

[0134] Perform sperm head recognition on the reference frame to obtain multiple candidate sperms and a candidate head contour corresponding to each candidate sperm;

[0135] Based on the candidate head contour corresponding to each candidate sperm, target tracking is performed on the remaining frames of the sperm swimming video except the reference frame to obtain the tracking area of ​​each candidate sperm in each remaining frame;

[0136] Searching for the contour center of each tracking area, and obtaining the sperm contour center of each candidate sperm in the remaining frames except the reference frame;

[0137] For each candidate sperm, the Euclidean distance between the center of the sperm outline in adjacent frames is calculated to obtain the maximum Euclidean distance corresponding to each candidate sperm;

[0138] The candidate sperm whose corresponding maximum Euclidean distance exceeds the preset distance is taken as the target sperm.

[0139] Each module in the above video processing device can be implemented in whole or in part by software, hardware or a combination thereof. Each module can be embedded in or independent of a processor in a computer device in the form of hardware, or can be stored in a memory in a computer device in the form of software, so that the processor can call and execute operations corresponding to each module.

[0140] Figure 8 An example of a physical structure diagram of an electronic device is shown in FIG. Figure 8As shown, the electronic device may include: a processor 810, a communication interface 820, a memory 830 and a communication bus 840, wherein the processor 810, the communication interface 820 and the memory 830 communicate with each other through the communication bus 840. The processor 810 may call the logic instructions in the memory 830 to execute the video processing method, which includes: extracting the head contour and tail contour of the target sperm from the first frame of the sperm swimming video image to obtain a first contour image with a frame number; extracting the head contour and tail contour of the target sperm from the remaining frames of the sperm swimming video image except the first frame to obtain a second contour image with a frame number; aligning the head contour in each second contour image with the head contour in the first contour image respectively to obtain an affine transformation matrix corresponding to each second contour image; transforming the corresponding second contour image based on the affine transformation matrix to obtain a transformed second contour image; sorting the first contour image and all the transformed second contour images based on the frame number to obtain a contour image sequence arranged according to the frame number.

[0141] In addition, the logic instructions in the above-mentioned memory 830 can be implemented in the form of a software functional unit and can be stored in a computer-readable storage medium when it is sold or used as an independent product. Based on such an understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art or the part of the technical solution, can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present invention. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), disk or optical disk and other media that can store program codes.

[0142] On the other hand, the present invention also provides a computer program product, which includes a computer program. The computer program can be stored on a non-transitory computer-readable storage medium. When the computer program is executed by a processor, the computer can execute the video processing method provided by the above methods, which includes: extracting the head outline and tail outline of the target sperm from the first frame of the sperm swimming video image to obtain a first outline image with a frame number; extracting the head outline and tail outline of the target sperm from the remaining frames of the sperm swimming video image except the first frame to obtain a second outline image with a frame number; aligning the head outline in each second outline image with the head outline in the first outline image respectively to obtain an affine transformation matrix corresponding to each second outline image; transforming the corresponding second outline image based on the affine transformation matrix to obtain a transformed second outline image; sorting the first outline image and all transformed second outline images based on the frame number to obtain a outline image sequence arranged according to the frame number.

[0143] On the other hand, the present invention also provides a non-transitory computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, is implemented to execute the video processing method provided by the above-mentioned methods, the method comprising: extracting the head outline and tail outline of the target sperm from the first frame of the sperm swimming video image to obtain a first outline image with a frame number; extracting the head outline and tail outline of the target sperm from the remaining frames of the sperm swimming video image except the first frame to obtain a second outline image with a frame number; aligning the head outline in each second outline image with the head outline in the first outline image to obtain an affine transformation matrix corresponding to each second outline image; transforming the corresponding second outline image based on the affine transformation matrix to obtain a transformed second outline image; sorting the first outline image and all the transformed second outline images based on the frame number to obtain a sequence of outline images arranged according to the frame number.

[0144] The device embodiments described above are merely illustrative, wherein the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the scheme of this embodiment. Ordinary technicians in this field can understand and implement it without paying creative labor.

[0145] Through the description of the above implementation methods, those skilled in the art can clearly understand that each implementation method can be implemented by means of software plus a necessary general hardware platform, and of course, it can also be implemented by hardware. Based on this understanding, the above technical solution is essentially or the part that contributes to the prior art can be embodied in the form of a software product, and the computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, a disk, an optical disk, etc., including a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods described in each embodiment or some parts of the embodiments.

[0146] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present invention.

Claims

1. A video processing method, characterized in that: The method comprises: Extracting the head contour and tail contour of the target sperm from the first frame of the sperm swimming video image to obtain a first contour image with a frame number; Extract the head contour and tail contour of the target sperm from the remaining frames of the sperm swimming video image except the first frame to obtain a second contour image with a frame number; Registering the head contour in each of the second contour images with the head contour in the first contour image to obtain an affine transformation matrix corresponding to each of the second contour images; Transforming the corresponding second contour image based on the affine transformation matrix to obtain a transformed second contour image, wherein the frame number corresponding to the transformed second contour image does not change; The first contour image and all transformed second contour images are sorted based on the frame number to obtain a contour image sequence arranged according to the frame number.

2. The video processing method according to claim 1, characterized in that: Before the step of registering the head contour in each of the second contour images with the head contour in the first contour image, the method further includes: respectively calculating the circumscribed triangle of the head contour in the first contour image and the head contour in each of the second contour images; The three vertices of each circumscribed triangle are sorted according to the sum of the distances from each vertex of each circumscribed triangle to the remaining vertices to obtain three vertices with order.

3. The video processing method according to claim 1, characterized in that: Before the step of registering the head contour in each of the second contour images with the head contour in the first contour image, the method further comprises: respectively calculating the inscribed triangle of the head contour in the first contour image and the head contour in each of the second contour images; The three vertices of each inscribed triangle are sorted according to the sum of the distances from each vertex of each inscribed triangle to the remaining vertices to obtain three vertices with order.

4. The video processing method according to claim 2 or 3, characterized in that: The step of registering the head contour in each of the second contour images with the head contour in the first contour image to obtain an affine transformation matrix corresponding to each of the second contour images comprises: In a traversal manner, take the head contour in each second contour image as the target contour and perform the following operations: Matching three vertices corresponding to each of the target contours with three vertices corresponding to the first contour image in vertex order to obtain a vertex correspondence relationship; An affine transformation matrix is ​​calculated using the three vertex coordinates corresponding to the target contour, the three vertex coordinates corresponding to the first contour image, and the vertex correspondence.

5. The video processing method according to claim 1, characterized in that: The step of transforming the corresponding second contour image based on the affine transformation matrix to obtain the transformed second contour image includes: Take each second contour image as the target contour image in a traversal manner and perform the following operations: The coordinates of the target contour image are transformed using the affine transformation matrix corresponding to the second contour image to which the target contour belongs.

6. The video processing method according to claim 1, characterized in that: Before the step of extracting the head contour and tail contour of the target sperm from the first frame of the sperm swimming video image, the method further includes: Sperm identification is performed on the sperm swimming video image to obtain the target sperm.

7. The video processing method according to claim 6, characterized in that: The method of performing sperm identification on the sperm swimming video image to obtain target sperm comprises: Selecting a frame from the sperm swimming video image as a reference frame; Performing sperm head recognition on the reference frame to obtain a plurality of candidate sperms and a candidate head contour corresponding to each candidate sperm; Based on the candidate head contour corresponding to each candidate sperm, target tracking is performed on the remaining frames of the sperm swimming video image except the reference frame to obtain the tracking area of ​​each candidate sperm in each remaining frame; Searching for the contour center of each tracking area to obtain the sperm contour center of each candidate sperm in the remaining frames except the reference frame; For each candidate sperm, respectively, the Euclidean distance between the center of the sperm outline in adjacent frames is calculated to obtain the maximum Euclidean distance corresponding to each candidate sperm; The candidate sperm whose maximum Euclidean distance corresponding to the candidate sperm exceeds the preset distance is taken as the target sperm.

8. A video processing device, characterized in that: The device comprises: A first extraction module, the first extraction module is used to extract the head contour and tail contour of the target sperm from the first frame of the sperm swimming video image to obtain a first contour image with a frame number; A second extraction module, the second extraction module is used to extract the head contour and tail contour of the target sperm from the remaining frames of the sperm swimming video image except the first frame, to obtain a second contour image with a frame number; A registration module, the registration module is used to register the head contour in each of the second contour images with the head contour in the first contour image, to obtain an affine transformation matrix corresponding to each of the second contour images; A transformation module, wherein the transformation module is used to transform the corresponding second contour image based on the affine transformation matrix to obtain a transformed second contour image, wherein the frame number corresponding to the transformed second contour image does not change; A sorting module is used to sort the first contour image and all transformed second contour images based on the frame number to obtain a contour image sequence arranged according to the frame number.

9. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein: When the processor executes the program, the video processing method according to any one of claims 1 to 7 is implemented.

10. A non-transitory computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the video processing method according to any one of claims 1 to 7 is implemented.

Citation Information

Patent Citations

  • Method and device of gesture tracking calculation based on three-dimensional model

    CN103116895A

  • Automatic face outline modification method for video

    CN105894446A

  • 2D-3D image registration method based on contour coplanar four-point set

    CN107392947A

  • Sperm morphology detection method and device based on image technology

    CN111563550A

  • Sperm morphology recognition method based on deep convolutional neural network and storage medium

    CN113888496A