A method and system for visually detecting myocardial cell contraction and relaxation

The cardiomyocyte videos were processed by dense optical flow method to detect their contraction-diastolic status, solving the problems of complex operation and high cost in the prior art, and achieving simple and efficient cardiomyocyte contraction-diastolic detection.

CN114399492BActive Publication Date: 2024-11-19NANKAI UNIV
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202210039854.5
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-01-14
Publication Date
2024-11-19
Estimated Expiration
2042-01-14

Smart Images

  • Figure CN114399492B_ABST
    Figure CN114399492B_ABST
Patent Text Reader

Abstract

The present invention relates to a method and system for visual detection of contraction and relaxation of myocardial cells. First, a myocardial cell video is framed to obtain multiple frames of images, and sampling points are uniformly selected in each frame of the image with a preset pixel value as the spacing. Then, optical flow processing is performed on two adjacent frames of images to obtain an optical flow matrix corresponding to the two adjacent frames of images. The position and displacement value of each sampling point of the current frame image are calculated according to the optical flow matrix, and the movement speed of each sampling point of the current frame image is determined according to the displacement value to draw the optical flow field corresponding to the current frame image. Finally, the contraction and relaxation of myocardial cells are detected based on all optical flow fields. It is only necessary to record the contraction and relaxation movements of myocardial cells under a bright field, and the contraction and relaxation states can be detected by the visual detection method. No additional equipment is needed, which greatly reduces the operational difficulty of myocardial cell contraction and relaxation detection.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of myocardial cell state detection, and in particular to a myocardial cell contraction-relaxation visual detection method and system based on a dense optical flow method. Background Art

[0002] Myocardial cell contraction and relaxation are important representations of myocardial cell status, and their amplitude and cycle are important detection indicators. Existing methods for measuring myocardial cell contraction and relaxation include mechanical sensor measurement and calcium ion concentration measurement. However, when using mechanical sensors for measurement, very precise mechanical sensors are required, and delicate operations are also required to connect the mechanical sensors and myocardial cells to achieve the purpose of measurement, which brings additional hardware, operational and economic burdens to the experiment. Since calcium ions are the main regulator of contractility, the contractility and calcium ion concentration measurement curves are compared by measuring calcium ion concentration through fluorescence signals, thereby realizing the measurement of myocardial cell contractility. However, this method is more cumbersome and requires special observation with a fluorescence microscope.

[0003] Based on this, there is an urgent need for a method and system for detecting the contraction and relaxation of myocardial cells that is easy to operate. Summary of the invention

[0004] The purpose of the present invention is to provide a method and system for visually detecting contraction and relaxation of myocardial cells, which detects the contraction and relaxation state of myocardial cells by processing myocardial cell videos, does not require the use of additional equipment, and is easy to operate.

[0005] To achieve the above object, the present invention provides the following solutions:

[0006] A method for visually detecting myocardial cell contraction and relaxation, the method comprising:

[0007] Performing frame processing on the cardiomyocyte video to obtain multiple frames of images; the cardiomyocyte video is a video obtained by recording the movement of the cardiomyocytes under a bright field microscope;

[0008] Using a preset pixel value as a spacing, uniformly selecting sampling points in each frame of the image;

[0009] Performing optical flow processing on the two adjacent frames of the image to obtain an optical flow matrix corresponding to the two adjacent frames of the image; recording the two adjacent frames of the image as a previous frame image and a current frame image respectively according to the time sequence of the cardiomyocyte video, the optical flow matrix including the offset of each sampling point of the current frame image in the x direction and the y direction respectively compared with the previous frame image;

[0010] Calculating the position and displacement value of each sampling point of the current frame image according to the optical flow matrix, determining the motion speed according to the displacement value, and drawing the optical flow field corresponding to the current frame image based on the position and motion speed of each sampling point of the current frame image;

[0011] The contraction and relaxation of cardiomyocytes are detected based on all the optical flow fields.

[0012] A myocardial cell contraction-relaxation visual detection system, the visual detection system comprising:

[0013] A frame processing module, used for performing frame processing on the cardiomyocyte video to obtain multiple frames of images; the cardiomyocyte video is a video obtained by recording the movement of the cardiomyocytes under a bright field microscope;

[0014] A sampling point selection module, used to uniformly select sampling points in each frame of the image with a preset pixel value as the spacing;

[0015] An optical flow processing module is used to perform optical flow processing on two adjacent frames of the image to obtain an optical flow matrix corresponding to the two adjacent frames of the image; the two adjacent frames of the image are recorded as a previous frame image and a current frame image respectively according to the time sequence of the cardiomyocyte video, and the optical flow matrix includes the offset of each sampling point of the current frame image in the x direction and the y direction respectively compared with the previous frame image;

[0016] A detection module is used to calculate the position and displacement value of each sampling point of the current frame image according to the optical flow matrix, determine the movement speed according to the displacement value, draw the optical flow field corresponding to the current frame image based on the position and movement speed of each sampling point of the current frame image; and detect the contraction and relaxation of myocardial cells based on all the optical flow fields.

[0017] According to the specific embodiments provided by the present invention, the present invention discloses the following technical effects:

[0018] The present invention is used to provide a method and system for visual detection of contraction and relaxation of myocardial cells. First, the myocardial cell video is framed to obtain multiple frames of images, and sampling points are uniformly selected in each frame of the image with a preset pixel value as the spacing. Then, optical flow processing is performed on two adjacent frames of images to obtain an optical flow matrix corresponding to the two adjacent frames of images. The position and displacement value of each sampling point of the current frame image are calculated according to the optical flow matrix, and the movement speed of each sampling point of the current frame image is determined according to the displacement value to draw the optical flow field corresponding to the current frame image. Finally, the contraction and relaxation of myocardial cells are detected based on all optical flow fields. It is only necessary to record the contraction and relaxation actions of myocardial cells under a bright field, and the contraction and relaxation states can be detected by the visual detection method. No additional equipment is required, and no observation is required under specific conditions (such as a fluorescence microscope). The operational difficulty of myocardial cell contraction and relaxation detection is greatly reduced, and a method is provided for realizing real-time detection of myocardial cell contraction and relaxation. BRIEF DESCRIPTION OF THE DRAWINGS

[0019] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments will be briefly introduced below. Obviously, the drawings described below are only 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.

[0020] Figure 1 A method flow chart of the visual inspection method provided in Example 1 of the present invention;

[0021] Figure 2 A schematic diagram of calculating the displacement value of a sampling point provided in Example 1 of the present invention;

[0022] Figure 3 This is an optical flow field result diagram of a myocardial cell contraction-relaxation process in Video 1 provided in Example 1 of the present invention;

[0023] Figure 4 This is an optical flow field result diagram of a myocardial cell contraction-relaxation process in Video 2 provided in Example 1 of the present invention;

[0024] Figure 5 A graph showing the average and maximum value of sampling point displacements of video 1 provided in Example 1 of the present invention;

[0025] Figure 6 A graph showing the average and maximum value of sampling point displacements of video 2 provided in Example 1 of the present invention;

[0026] Figure 7 This is a system block diagram of the visual inspection system provided in Example 2 of the present invention. DETAILED DESCRIPTION

[0027] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only 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.

[0028] The purpose of the present invention is to provide a method and system for visually detecting contraction and relaxation of myocardial cells, which detects the contraction and relaxation state of myocardial cells by processing myocardial cell videos, does not require the use of additional equipment, and is easy to operate.

[0029] In order to make the above-mentioned objects, features and advantages of the present invention more obvious and easy to understand, the present invention is further described in detail below with reference to the accompanying drawings and specific embodiments.

[0030] Embodiment 1:

[0031] Optical flow was first proposed by Gibson in 1950. It refers to the apparent movement of the brightness pattern of an object on the observation imaging plane when it is moving, that is, the instantaneous speed of the pixel movement of a spatial moving object on the observation imaging plane. The optical flow method uses the change of pixels in the time domain in the image sequence and the correlation between adjacent frames to find the relationship between the current frame and the previous frame, thereby calculating the position change of pixels between the two frames. This embodiment is used to provide a method for visual detection of myocardial cell contraction-relaxation based on dense optical flow method, such as Figure 1 As shown, the visual detection method includes:

[0032] S1: performing frame processing on the cardiomyocyte video to obtain multiple frames of images; the cardiomyocyte video is a video obtained by recording the movement of the cardiomyocytes under a bright field microscope;

[0033] The cardiomyocytes referred to in this embodiment may be neonatal rat cardiomyocytes. The neonatal rat myocardial tissue is first separated, and then a single fiber is separated by mechanical cutting, and the contraction and relaxation of the single fiber is observed under a bright field microscope to obtain a cardiomyocyte video recorded under a bright field microscope.

[0034] Specifically, S1 may include: in MATLAB software, first use the VideoReader function to read the cardiomyocyte video, then use the read function to read the video frame, and use the imwrite function to save the read video frame as an image file to obtain multiple frames of images. More specifically, S1 may include: use the VideoReader and imwrite functions in MATLAB software to implement the frame processing of the cardiomyocyte video, and store the obtained multiple frames of cardiomyocyte images in a specified location. First, use the VideoReader function to read the cardiomyocyte video. The VideoReader function creates an object to read the video file. The function input is the file name of the video file, which is specified as a character vector or a string vector. The function output is an object obj containing the information of the read video file. By querying the property obj.NumberOfFrames of the object obj, the total number of frames numFrames of the video is obtained, and the video frame rate of the processed video can be selected as 25 frames per second. Then, use the read function to read the video frame. Finally, use the imwrite function to save the read video frame as a jpg file, and the obtained jpg file will be directly saved to the current folder where the MATLAB file is located, thereby saving the multiple frames of images to the specified location.

[0035] S2: uniformly selecting sampling points in each frame of the image with a preset pixel value as the spacing;

[0036] Before S2, the visual detection method of this embodiment also includes preprocessing each frame of the image, specifically including: converting each frame of the image into a grayscale image, detecting the size of the image, and determining a preset pixel value according to the detected image size.

[0037] In this embodiment, the preset pixel value can be selected as 15 pixels. At this time, S2 may include: for each frame of image, a sampling point is taken every 15 pixels along the X direction of the image, and a sampling point is taken every 15 pixels along the Y direction of the image, so as to uniformly select sampling points in the image. It should be noted that the contraction-relaxation detection of myocardial cells can also be realized by directly using all pixel points, but the amount of data will be very large, which will bring a great burden to the calculation. Therefore, in this embodiment, each frame of image is sampled to obtain sampling points. The analysis of the sampling points can also realize the detection, and the amount of calculation is greatly reduced, the calculation speed is fast, and the detection efficiency is high.

[0038] S3: performing optical flow processing on the two adjacent frames of the image to obtain an optical flow matrix corresponding to the two adjacent frames of the image; recording the two adjacent frames of the image as a previous frame image and a current frame image respectively according to the time sequence of the cardiomyocyte video, wherein the optical flow matrix includes the offset of each sampling point of the current frame image in the x direction and the y direction respectively compared with the previous frame image;

[0039] Specifically, S3 may include: using the calcOpticalFlowFarneback() function of Opencv to perform optical flow processing on two adjacent frames of images to obtain the optical flow matrix corresponding to the two adjacent frames of images. The calling format of the calcOpticalFlowFarneback() function is: calcOpticalFlowFarneback(InputArray_prev0, InputArray_next0, OutputArray_flow0, double pyr_scale, int levels, intwinsize, int iterations, intpoly_n, double poly_sigma, int flags), where _prev0 is the previous frame of the input image; _next0 is the current frame of the input image; _flow0 is the output matrix, the size of the matrix is ​​the same as the input image, but each element in the matrix contains two values, which are the movement (i.e., offset) of the pixel point corresponding to the element position in the x-direction and the y-direction; pyr_scale is the scale relationship between the upper and lower layers of the pyramid, which is generally set to 0.5, indicating that the upper layer of the image pyramid is twice the downsampled layer of the lower layer; levels is the number of layers of the image pyramid; winsize is the mean window size, and the larger the winsize, the smaller the size. The larger the value, the smaller the influence of noise on the calculation result, and the more suitable it is for detecting fast-moving targets, but it will also cause blur in the moving area; iterations indicates the number of iterations of each layer of the image pyramid; poly_n is the neighborhood size of the pixel point, that is, the number of adjacent pixels for calculating the polynomial expansion at each pixel point, usually poly_n is 5 or 7; poly_sigma is the Gaussian standard deviation, generally 1.1 or 1.5; flags is the calculation method, mainly including OPTFLOW_USE_INITIAL_FLOW and OPTFLOW_FARNEBACK_GAUSSIAN.

[0040] Using the above function, the previous frame image and the current frame image are input as _prev0 and _next0 respectively, and the matrix _flow0 can be obtained after processing. The above function can obtain the offset of each pixel in the current frame image. Considering that the amount of data is too large when the offset of all pixels is used for detection, it will bring a great burden to the calculation, and sampling a part of the pixels can also complete the detection. Therefore, this embodiment only selects the offset of the sampling point to form an optical flow matrix, which contains the offset of each sampling point in the current frame image in the x direction and the y direction.

[0041] S4: calculating the position and displacement value of each sampling point of the current frame image according to the optical flow matrix, determining the movement speed according to the displacement value, and drawing the optical flow field corresponding to the current frame image based on the position and movement speed of each sampling point of the current frame image;

[0042] In order to qualitatively and intuitively observe the motion information of each sampling point, this embodiment draws the sampling point position and the sampling point motion speed on each frame image according to the optical flow matrix obtained by the optical flow method, and uses color to distinguish the motion speed of the sampling point to draw a visualized optical flow field.

[0043] In S4, calculating the position of each sampling point of the current frame image according to the optical flow matrix may include: for each sampling point of the current frame image, taking the sum of the coordinate value of the sampling point in the previous frame image and the offset of the sampling point in the x direction and the y direction as the coordinate value of the sampling point in the current frame image, and obtaining the position of the sampling point. More specifically, assuming that S1 obtains N frames of images after performing frame processing on the myocardial cell video, then, using S3 in this embodiment, the optical flow matrix corresponding to the 1st frame image and the 2nd frame image, the optical flow matrix corresponding to the 2nd frame image and the 3rd frame image, ... the optical flow matrix corresponding to the N-1th frame image and the Nth frame image can be obtained. If the coordinates of each sampling point of the 1st frame image are known values, the coordinates of each sampling point of the 2nd frame image are calculated according to the optical flow matrix corresponding to the 1st frame image and the 2nd frame image, and so on, the coordinates of the sampling points are updated frame by frame, and the above operation is repeated until the Nth frame of the video is processed to obtain the coordinates of each sampling point of the Nth frame image.

[0044] Among them, the calculation formula for updating the sampling point coordinate value based on the optical flow matrix is ​​as follows:

[0045] X t+1 =X t +(fx,fy); (1)

[0046] In formula (1), X t+1 is a coordinate matrix composed of the coordinates of each sampling point of the t+1 frame image, including the x coordinate and y coordinate of each sampling point of the t+1 frame image; t is a coordinate matrix composed of the coordinates of each sampling point of the t-th frame image, including the x-coordinate and y-coordinate of each sampling point of the t-th frame image; (fx, fy) is the optical flow matrix corresponding to the t-th frame image and the t+1-th frame image, which includes the offsets of each sampling point in the t+1-th frame image in the x and y directions from the t-th frame to the t+1-th frame.

[0047] In S4, calculating the displacement value of each sampling point of the current frame image according to the optical flow matrix may include: for each sampling point of the current frame image, summing the square of the offset of the sampling point in the x direction and the square of the offset of the sampling point in the y direction to obtain the sum of squares, and then taking the square root of the sum of squares to obtain the displacement value of the sampling point. This embodiment calculates the displacement value of the sampling point between two adjacent frames and uses it as a standard for measuring the movement speed of the sampling point, specifically directly using the displacement value of the sampling point as the movement speed of the sampling point.

[0048] like Figure 2 As shown in the figure, the calculation formula of the displacement value of the sampling point is as follows:

[0049]

[0050] In formula (2), d is the displacement value of the sampling point; x is the offset of the sampling point in the x direction; y is the offset of the sampling point in the y direction.

[0051] In S4, drawing the optical flow field corresponding to the current frame image based on the position and movement speed of each sampling point of the current frame image may include:

[0052] (1) Draw the initial optical flow field according to the position of each sampling point of the current frame image;

[0053] Except for the position of each sampling point of the first frame image, which is a known value, the position of each sampling point of the remaining frame images needs to be updated using formula (1).

[0054] (2) For each sampling point, the preset motion speed interval to which the sampling point belongs is determined according to the motion speed of the sampling point, and the color corresponding to the preset motion speed interval to which the sampling point belongs is used as the color corresponding to the sampling point; different preset motion speed intervals correspond to different colors;

[0055] The motion speed of the sampling points of the first frame image is all 0, and the motion speed calculated according to the optical flow matrix corresponding to the first frame image and the second frame image is converted into color and reflected on the second frame image. Specifically, the preset motion speed intervals used in this embodiment include: 0-0.2, 0.2-0.4, 0.4-0.6, 0.6-0.8, 0.8-1.0, 1.0-1.2, 1.2-1.4, 1.4-1.6, 1.6-1.8, 1.8-∞, each preset motion speed interval corresponds to a color, and different preset motion speed intervals correspond to different colors, and the unit of motion speed is pixel / frame.

[0056] (3) By adding the corresponding color to each sampling point in the initial optical flow field, the optical flow field corresponding to the current frame image can be obtained.

[0057] The sampling points are marked with corresponding colors and represented on the current frame image to obtain the optical flow field corresponding to the current frame.

[0058] S5: Detecting the contraction and relaxation of cardiomyocytes based on all the optical flow fields.

[0059] By observing the optical flow field, the regular and periodic beating of cardiomyocytes can be intuitively seen, thereby realizing the detection of the contraction and relaxation of cardiomyocytes.

[0060] As an optional implementation, after S5, the visual inspection method of this embodiment further includes:

[0061] (1) determining an average displacement value and a maximum displacement value corresponding to the current frame image according to the displacement value of each sampling point of the current frame image;

[0062] In order to visualize the movement of myocardial cells during contraction and relaxation, the displacement values ​​of all sampling points in each current frame image are calculated using formula (2), and then the average and maximum displacement values ​​of all sampling points in the current frame image are obtained to measure the intensity of myocardial cell beating in the current frame image.

[0063] (2) according to the time sequence of the cardiomyocyte video, the average value curve and the maximum value curve are drawn based on the average displacement values ​​and the maximum displacement values ​​corresponding to all current frame images;

[0064] The calculation is performed frame by frame in chronological order to obtain two one-dimensional vectors (Mean(t) and Max(t)) containing the average displacement value and the maximum displacement value of all current frame images. The curve is drawn in MATLAB based on the one-dimensional vectors.

[0065] (3) Determine the amplitude and period of myocardial cell contraction and relaxation based on the mean value curve and the maximum value curve.

[0066] Plot the average value curve and the maximum value curve in the same coordinate system. The number of cycles can be clearly seen in the curve graph. Use the GetData Graph Digitizer software to directly select the highest point in the cycle in the curve graph to obtain the horizontal and vertical coordinates of this point, and then obtain the amplitude value and the number of frames between two cycles, thereby determining the amplitude and cycle.

[0067] In order to test the adaptability of the detection method described in this embodiment to different myocardial cells, the above detection method was used to process two videos of myocardial cells of neonatal rats. The detection results of a complete contraction-relaxation movement of myocardial cells of neonatal rats in the two videos are as follows: Figure 3 and Figure 4 As shown, Figure 3 and Figure 4The color (representing the displacement value of the pixel point between two adjacent frames) and position changes of the sampling point during the contraction and relaxation of the myocardial cell are shown in Figure 2. Figure 3 and Figure 4 The test results show that when the myocardial cells contract and relax, the sampling points in the beating area change to the color corresponding to the high running speed interval and shift, while the sampling points in other areas are almost always in the color corresponding to the 0 running speed interval and do not shift significantly. In addition, the sampling points change to the color corresponding to the high running speed interval twice, corresponding to the contraction and relaxation of the myocardial cells. By observing the color of the optical flow field, the contraction and relaxation of the myocardial cells can be intuitively determined, and the contraction and relaxation of the myocardial cells can be detected.

[0068] Output the displacement information of all sampling points in each frame of the two videos, calculate the average and maximum displacement of all sampling points in each frame in Matlab, and draw the displacement average and maximum curves according to the time series, as shown in Figure 2. Figure 5 and Figure 6 As shown. Figure 5 and Figure 6 It can be seen that the beating amplitude of the cardiomyocytes in the two videos is similar, both about 1.8 to 2.5 microns; among them, the contraction-relaxation cycle of the cardiomyocytes in video 1 is about 34 frames. Since the video frame rate is 25 frames / second, the contraction-relaxation cycle of the cardiomyocytes is 1.36 seconds. The contraction-relaxation cycle of the cardiomyocytes in video 2 is about 30 frames. Since the video frame rate is 25 frames / second, the contraction-relaxation cycle of the cardiomyocytes is calculated to be 1.2 seconds.

[0069] Through the above detection and analysis of the contraction-relaxation videos of myocardial cells of different neonatal rats, it can be seen that the myocardial cell contraction-relaxation detection method based on the dense optical flow method implemented by Opencv can accurately detect the contraction-relaxation movement of myocardial cells, and can obtain the period and amplitude of one myocardial cell beat by analyzing the displacement of the sampling points, indicating that the detection of myocardial cell contraction and relaxation based on the dense optical flow method is feasible and can meet the needs of detecting the beating of myocardial cells before and after drug treatment.

[0070] This embodiment uses the myocardial cells of neonatal rats recorded under a bright field microscope as the experimental object, and uses the dense optical flow method (DOF) proposed by Gunner Farneback to perform pixel-level image tracking and processing on the collected video recordings of myocardial cell activities of neonatal rats, calculates the motion information of the pixel points based on the obtained optical flow, and then calculates the amplitude and period of contraction and relaxation of myocardial cells of neonatal rats by tracking the position changes of the sampling points uniformly selected on the cells, providing evaluation indicators for subsequent research on the effects of drugs on myocardial cells. This method only needs to record the contraction and relaxation of myocardial cells under a bright field, and can obtain the period and amplitude of its contraction and relaxation by visual detection methods. It does not require the use of additional equipment, nor does it require observation under specific conditions (such as a fluorescence microscope), which greatly reduces the operational difficulty of myocardial cell contraction and relaxation detection, and provides a method for realizing real-time detection of myocardial cell contraction and relaxation.

[0071] Embodiment 2:

[0072] This embodiment is developed based on the OpenCV open source computer vision library cv2, using C language programming and Matlab for auxiliary data processing to design a cardiomyocyte contraction-relaxation visual detection system based on the GunnerFarneback dense optical flow method. Figure 7 As shown, the visual inspection system comprises:

[0073] A frame processing module M1 is used to perform frame processing on the cardiomyocyte video to obtain multiple frames of images; the cardiomyocyte video is a video obtained by recording the movement of the cardiomyocytes under a bright field microscope;

[0074] A sampling point selection module M2, used to uniformly select sampling points in each frame of the image with a preset pixel value as the spacing;

[0075] The optical flow processing module M3 is used to perform optical flow processing on two adjacent frames of the image to obtain an optical flow matrix corresponding to the two adjacent frames of the image; the two adjacent frames of the image are recorded as a previous frame image and a current frame image respectively according to the time sequence of the cardiomyocyte video, and the optical flow matrix includes the offset of each sampling point of the current frame image in the x direction and the y direction respectively compared with the previous frame image;

[0076] The detection module M4 is used to calculate the position and displacement value of each sampling point of the current frame image according to the optical flow matrix, determine the movement speed according to the displacement value, draw the optical flow field corresponding to the current frame image based on the position and movement speed of each sampling point of the current frame image; and detect the contraction and relaxation of myocardial cells based on all the optical flow fields.

[0077] As an optional implementation, the visual detection system of this embodiment also includes an amplitude period determination module M5, which is used to determine the average displacement value and the maximum displacement value corresponding to the current frame image according to the displacement value of each sampling point of the current frame image; draw a mean value curve and a maximum value curve based on the average displacement values ​​and the maximum displacement values ​​corresponding to all the current frame images according to the time sequence of the myocardial cell video; determine the amplitude and period of myocardial cell contraction-relaxation according to the mean value curve and the maximum value curve.

[0078] Each embodiment in this specification focuses on the differences from other embodiments, and the same or similar parts between the embodiments can be referred to each other. For the system disclosed in the embodiment, since it corresponds to the method disclosed in the embodiment, the description is relatively simple, and the relevant parts can be referred to the method part.

[0079] The principles and implementation methods of the present invention are described in this article using specific examples. The description of the above embodiments is only used to help understand the method and core idea of ​​the present invention. At the same time, for those skilled in the art, according to the idea of ​​the present invention, there will be changes in the specific implementation methods and application scope. In summary, the content of this specification should not be understood as limiting the present invention.

Claims

1. A method for visually detecting myocardial cell contraction and relaxation, characterized in that: The visual detection method comprises: Performing frame processing on the cardiomyocyte video to obtain multiple frames of images; the cardiomyocyte video is a video obtained by recording the movement of the cardiomyocytes under a bright field microscope; Using a preset pixel value as a spacing, uniformly selecting sampling points in each frame of the image; Performing optical flow processing on the two adjacent frames of the image to obtain an optical flow matrix corresponding to the two adjacent frames of the image; recording the two adjacent frames of the image as a previous frame image and a current frame image respectively according to the time sequence of the cardiomyocyte video, the optical flow matrix including the offset of each sampling point of the current frame image in the x direction and the y direction respectively compared with the previous frame image; Calculating the position and displacement value of each sampling point of the current frame image according to the optical flow matrix, determining the motion speed according to the displacement value, and drawing the optical flow field corresponding to the current frame image based on the position and motion speed of each sampling point of the current frame image; The contraction and relaxation of cardiomyocytes are detected based on all the optical flow fields.

2. The visual inspection method according to claim 1, characterized in that: The step of performing frame processing on the myocardial cell video to obtain multiple frames of images specifically includes: In MATLAB software, the cardiomyocyte video is first read using the VideoReader function, then the video frame is read using the read function, and the read video frame is saved as an image file using the imwrite function to obtain multiple frames of images.

3. The visual inspection method according to claim 1, characterized in that: Before uniformly selecting sampling points in each frame of the image at a spacing of a preset pixel value, the visual detection method further includes preprocessing each frame of the image, specifically including: Each frame of the image is converted into a grayscale image, and the size of the image is detected, and the preset pixel value is determined according to the detected image size.

4. The visual inspection method according to claim 1, characterized in that: The performing optical flow processing on the images of two adjacent frames to obtain the optical flow matrix corresponding to the images of two adjacent frames specifically includes: The calcOpticalFlowFarneback() function of Opencv is used to perform optical flow processing on the images of two adjacent frames to obtain the optical flow matrix corresponding to the images of the two adjacent frames.

5. The visual inspection method according to claim 1, characterized in that: Calculating the position and displacement value of each sampling point of the current frame image according to the optical flow matrix specifically includes: For each sampling point of the current frame image, the position of the sampling point is obtained by taking the sum of the coordinate value of the sampling point in the previous frame image and the offset of the sampling point in the x direction and the y direction as the coordinate value of the sampling point in the current frame image; The square of the offset of the sampling point in the x direction and the square of the offset of the sampling point in the y direction are summed to obtain a square sum; and the square root of the square sum is taken to obtain a displacement value of the sampling point.

6. The visual inspection method according to claim 1, characterized in that: Determining the movement speed according to the displacement value specifically includes: The displacement value of the sampling point is used as the movement speed of the sampling point.

7. The visual inspection method according to claim 1, characterized in that: Drawing the optical flow field corresponding to the current frame image based on the position and movement speed of each sampling point of the current frame image specifically includes: Draw an initial optical flow field according to the position of each sampling point of the current frame image; For each of the sampling points, the preset motion speed interval to which the sampling point belongs is determined according to the motion speed of the sampling point, and the color corresponding to the preset motion speed interval to which the sampling point belongs is used as the color corresponding to the sampling point; different preset motion speed intervals correspond to different colors; A corresponding color is added to each sampling point in the initial optical flow field to obtain an optical flow field corresponding to the current frame image.

8. The visual inspection method according to claim 1, characterized in that: After detecting the contraction and relaxation of the myocardial cells based on all the optical flow fields, the visual detection method further includes: Determine an average displacement value and a maximum displacement value corresponding to the current frame image according to the displacement value of each sampling point of the current frame image; According to the time sequence of the myocardial cell video, a mean value curve and a maximum value curve are drawn based on the mean displacement values ​​and the maximum displacement values ​​corresponding to all the current frame images; The amplitude and cycle of contraction and relaxation of myocardial cells are determined according to the mean value curve and the maximum value curve.

9. A myocardial cell contraction-relaxation visual detection system, characterized in that: The visual inspection system comprises: A frame processing module, used for performing frame processing on the cardiomyocyte video to obtain multiple frames of images; the cardiomyocyte video is a video obtained by recording the movement of the cardiomyocytes under a bright field microscope; A sampling point selection module, used to uniformly select sampling points in each frame of the image with a preset pixel value as the spacing; An optical flow processing module is used to perform optical flow processing on two adjacent frames of the image to obtain an optical flow matrix corresponding to the two adjacent frames of the image; the two adjacent frames of the image are recorded as a previous frame image and a current frame image respectively according to the time sequence of the cardiomyocyte video, and the optical flow matrix includes the offset of each sampling point of the current frame image in the x direction and the y direction respectively compared with the previous frame image; A detection module is used to calculate the position and displacement value of each sampling point of the current frame image according to the optical flow matrix, determine the movement speed according to the displacement value, draw the optical flow field corresponding to the current frame image based on the position and movement speed of each sampling point of the current frame image; and detect the contraction and relaxation of myocardial cells based on all the optical flow fields.

10. The visual inspection system according to claim 9, characterized in that: The visual detection system also includes an amplitude period determination module, which is used to determine the average displacement value and the maximum displacement value corresponding to the current frame image according to the displacement value of each sampling point of the current frame image; draw a mean value curve and a maximum value curve based on the average displacement values ​​and the maximum displacement values ​​corresponding to all the current frame images according to the time sequence of the myocardial cell video; and determine the amplitude and period of myocardial cell contraction-relaxation according to the mean value curve and the maximum value curve.