A displacement measurement method, system, storage medium and electronic device
Through machine vision and digital close-range measurement technology, using video data frame processing and centroid coordinate calculation, the problems of contact encoders being easily damaged and non-contact encoders requiring manual operation are solved, achieving efficient and accurate displacement measurement.
Patent Information
- Application Number
- CN202210862320.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-07-21
- Publication Date
- 2025-10-10
- Estimated Expiration
- 2042-07-21
AI Technical Summary
Existing contact encoders are easily damaged and have large measurement errors, and non-contact measurement methods require manual operation. Traditional methods are not suitable for modern displacement measurement needs.
Using machine vision and digital close-range measurement technology, the system obtains video data for frame processing, binarizes the segmented image to obtain the centroid coordinates, and uses preset conversion coefficients to calculate the displacement value to avoid distortion caused by camera calibration.
It improves the convenience and accuracy of displacement measurement, reduces resource loss, and simplifies the operating process.
Smart Images

Figure CN115393430B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of image processing technology, and in particular to a displacement measurement method, system, storage medium and electronic equipment. Background Art
[0002] Displacement monitoring is essential in many industrial fields. Displacement monitoring technologies are primarily categorized as contact and non-contact. However, current probe encoders are often exposed to the environment, making them susceptible to damage. Furthermore, under certain circumstances, the contact encoder's sensor can introduce measurement errors, affecting the accuracy of the results. The current mainstream non-contact displacement measurement method primarily utilizes infrared measuring instruments, which require continuous manual control and tracking. These traditional measurement methods are clearly unsuitable for today's probe displacement measurements.
[0003] In recent years, with the rapid development of digital imaging and high-speed computer technology, machine vision and digital close-range measurement have been successfully applied to displacement measurement. The developed visual displacement sensors overcome the limitations of traditional displacement sensors and can simultaneously measure the three-dimensional spatial coordinates of multiple points within a specified area. They offer numerous advantages, including non-contact measurement, high accuracy, immunity to electromagnetic interference, a high degree of informationization, easy on-site installation, and simple operation. Non-contact measurement technology has already played a vital role in cutting-edge fields such as aerospace, weapon guidance, and rapid braking, highlighting the advantages of videography. Camera calibration is the foundation of videography, but its pre-processing is complex and time-consuming in certain application environments. Therefore, there is an urgent need to provide a technical solution to the problems existing in existing technologies. Summary of the Invention
[0004] To solve the above technical problems, the present invention provides a displacement measurement method, system, storage medium and electronic device.
[0005] The technical solution of a displacement measurement method of the present invention is as follows:
[0006] S1. Acquire video data containing the motion process of the target to be measured, and perform frame processing on the video data to obtain all original frame images;
[0007] S2. Performing a binary segmentation process on each original frame image to obtain a binary segmentation image corresponding to each original frame image, and obtaining the centroid coordinates of the target connected area corresponding to the target to be measured in each binary segmentation image;
[0008] S3. Obtaining the actual displacement value of the target to be measured during the movement process according to the preset conversion coefficient and all centroid coordinates.
[0009] The beneficial effects of a displacement measurement method of the present invention are as follows:
[0010] The method of the present invention obtains the centroid coordinates corresponding to the image and calculates the target running displacement value. While improving the running efficiency, it can also avoid the problem of edge distortion of the camera-captured image caused by camera calibration, thereby reducing resource loss and improving the convenience of displacement measurement.
[0011] Based on the above solution, a displacement measurement method of the present invention can be further improved as follows.
[0012] Furthermore, the binary segmentation processing is performed on each original frame image to obtain a binary segmented image corresponding to each original frame image, including:
[0013] Perform median filtering on each original frame image to obtain a filtered frame image corresponding to each original frame image;
[0014] Performing grayscale transformation on each filtered frame image to obtain an enhanced frame image containing a binary image boundary corresponding to each filtered frame image;
[0015] The maximum inter-class variance method is used to perform image segmentation on each enhanced frame image to obtain a binary segmentation image corresponding to each original frame image.
[0016] Furthermore, the video data containing the motion process of the target to be measured includes: obtaining the video data containing the motion process of the target to be measured through a camera device.
[0017] Furthermore, the process of obtaining the preset conversion coefficient includes:
[0018] According to the number of pixels of the first frame original frame image, the shooting height of the camera device and the radius of the circular light source of the camera device, the conversion ratio of the shooting height and the circular light source is obtained, and according to the conversion ratio, the preset conversion coefficient between the pixel point coordinates and the actual coordinates is obtained.
[0019] Furthermore, the S3 includes:
[0020] S31, obtaining the centroid coordinates corresponding to the target frame original frame image, and determining whether the centroid coordinates of the first frame original frame image are located within the target frame original frame image, and obtaining a determination result;
[0021] S32A, when the judgment result is yes, obtaining the displacement difference of the target to be measured according to the preset conversion coefficient and the difference between the centroid coordinates of the first frame original frame image and the centroid coordinates of the target frame original frame image;
[0022] S32B, when the judgment result is no, determining that the original framed image before the centroid coordinates of the first frame original framed image are lost is the target frame original framed image, and obtaining the displacement difference of the target target based on the preset conversion coefficient and the difference between the centroid coordinates of the first frame original framed image and the centroid coordinates of the target frame original framed image;
[0023] S33, taking the target frame original frame image as the first frame original frame image between the target frame original frame image and the last frame original frame image, and looping through S31 until the target frame original frame image is the last frame original frame image, and obtaining the actual displacement value of the target to be measured according to all the displacement differences.
[0024] Furthermore, it also includes:
[0025] Obtaining, based on the difference between the preset conversion coefficient and the centroid coordinates corresponding to any two adjacent frames of the original framed image, a segment displacement value between the binary segmented images of the arbitrary two adjacent frames, until all segment displacement values between the first frame of the original framed image and the last frame of the original framed image are obtained;
[0026] According to all the segment displacement values, a motion change trajectory of the target to be measured during the motion process is obtained.
[0027] The technical solution of a displacement measurement system of the present invention is as follows:
[0028] Includes: acquisition module, processing module and operation module;
[0029] The acquisition module is used to: acquire video data containing the motion process of the target to be measured, and perform frame processing on the video data to obtain all original frame images;
[0030] The processing module is used to perform a binary segmentation process on each original frame image to obtain a binary segmentation image corresponding to each original frame image, and obtain the centroid coordinates of the target connected area corresponding to the target to be measured in each binary segmentation image;
[0031] The operation module is used to obtain the actual displacement value of the target to be measured during the movement according to the preset conversion coefficient and all the centroid coordinates.
[0032] The beneficial effects of a displacement measurement system of the present invention are as follows:
[0033] The system of the present invention obtains the centroid coordinates corresponding to the image and calculates the target running displacement value. While improving the running efficiency, it can also avoid the problem of edge distortion of the camera-captured image caused by camera calibration, thereby reducing resource loss and improving the convenience of displacement measurement.
[0034] Based on the above solution, the displacement measurement system of the present invention can be further improved as follows.
[0035] Further, the processing module includes: a first processing module, a second processing module and a third processing module;
[0036] The first processing module is used to: perform median filtering on each original frame image to obtain a filtered frame image corresponding to each original frame image;
[0037] The second processing module is used to: perform grayscale transformation on each filtered frame image to obtain an enhanced frame image containing a binary image boundary corresponding to each filtered frame image;
[0038] The third processing module is used to perform image segmentation processing on each enhanced frame image using the maximum inter-class variance method to obtain a binary segmented image corresponding to each original frame image.
[0039] A technical solution of a storage medium of the present invention is as follows:
[0040] The storage medium stores instructions, and when a computer reads the instructions, the computer executes the steps of a displacement measurement method of the present invention.
[0041] The technical solution of an electronic device of the present invention is as follows:
[0042] The method comprises a memory, a processor and a computer program stored in the memory and executable on the processor, wherein when the processor executes the computer program, the computer is caused to execute the steps of a displacement measurement method according to the present invention. BRIEF DESCRIPTION OF THE DRAWINGS
[0043] Figure 1 Schematic diagram of a flow chart of a displacement measurement method according to an embodiment of the present invention;
[0044] Figure 2 Schematic diagram of the structure of a displacement measurement system according to an embodiment of the present invention. DETAILED DESCRIPTION
[0045] like Figure 1 As shown, a displacement measurement method according to an embodiment of the present invention includes the following steps:
[0046] S1. Obtain video data containing the motion process of the target to be measured, and perform frame processing on the video data to obtain all original frame images.
[0047] The target to be measured is: a person, an animal, or an object, with no specific restrictions. The motion process is: moving, running, walking, and other motion processes. The original frame image is: an image frame in the video data after the video data is framed.
[0048] Specifically, a camera device is used to obtain video data of the entire motion process of the target to be measured, and the strcat function is called in MATLAB to frame the video data to obtain all the original frame images, and then the imwrite function is called in MATLAB to store all the original frame images.
[0049] It should be noted that the process of calling the strcat function in MATLAB to frame video data is an existing technology, and the process of calling the imwrite function in MATLAB to store all original framed images is an existing technology. The specific process will not be described in detail here.
[0050] S2. Performing a binarization segmentation process on each original frame image to obtain a binarized segmented image corresponding to each original frame image, and obtaining the centroid coordinates of the target connected area corresponding to the target to be measured in each binarized segmented image.
[0051] Among them, the binary segmentation image is: the image obtained after the original frame image is processed by steps such as median filtering, color extraction, binarization, and OTSU image segmentation method. It has the following characteristics: ① It has consistency in certain features (such as grayscale, color, texture, etc.); ② The interior of the region is single and there are no excessive small holes; ③ Adjacent regions have obvious differences in the features based on which the segmentation is based.
[0052] Specifically, each original frame image is binarized and thresholded using MATLAB to obtain a binary segmented image corresponding to each original frame image, and the regionprops function in MATLAB is used to obtain the centroid coordinates of the connected region in each binary segmented image.
[0053] It should be noted that binarization distinguishes between the image corresponding to the target to be measured and the image outside the target to be measured. Thresholding divides the pixels in the image into two categories: the area consisting of pixels below a preset grayscale value is the target area (the area corresponding to the target to be measured), and the area consisting of pixels above the preset grayscale value is the background area (the area outside the area corresponding to the target to be measured). The maximum between-class variance method (OTSU) is used to obtain the optimal threshold value that minimizes the intra-class variance, maximizes the inter-class variance, or minimizes the ratio of the intra-class to inter-class variances.
[0054] S3. Obtaining the actual displacement value of the target to be measured during the movement process according to the preset conversion coefficient and all centroid coordinates.
[0055] The preset conversion coefficient is the conversion coefficient between the image pixel coordinates and the actual coordinate system.
[0056] The actual displacement value is the displacement value of the target during its entire motion process, which needs to be calculated based on all centroid coordinates. Specifically, the actual displacement difference between the centroids of the connected regions is calculated using the difference between the centroid coordinates of the original frame image of the first frame and the centroid coordinates of the original frame image of the target frame (last frame), and the actual displacement difference between the centroids of different connected regions obtained using a preset conversion coefficient. Finally, the actual displacement value of the target during its motion is calculated based on all the obtained displacement differences.
[0057] Preferably, the performing binarization segmentation processing on each original frame image to obtain a binarized segmented image corresponding to each original frame image includes:
[0058] Perform median filtering on each original frame image to obtain a filtered frame image corresponding to each original frame image.
[0059] The filtered framed image is an image obtained by median filtering the original framed image.
[0060] It should be noted that the process of performing median filtering on the original framed image is an existing technology, which is used to extract image features from the original framed image.
[0061] Grayscale transformation is performed on each filtered frame image to obtain an enhanced frame image containing a binary image boundary corresponding to each filtered frame image.
[0062] The enhanced framed image is an image obtained by processing the filtered framed image using an image enhancement method with grayscale transformation.
[0063] It should be noted that the process of performing image processing using the image enhancement method of grayscale transformation is an existing technology, and its function is to make the binary image boundary in the filtered frame image more obvious.
[0064] The maximum inter-class variance method is used to perform image segmentation processing on each enhanced frame image, to obtain a binary segmentation image corresponding to each original frame image.
[0065] The process of using the maximum inter-class variance method (OTSU) to process the image is prior art.
[0066] Specifically, the imbinarize function in MATLAB is called to generate a certain threshold for the global enhanced frame image, all pixels in the enhanced frame image are divided into two categories, the low gray is set as the target area, and the high gray is set as the background area (the threshold obtained by OTSU is the best ratio of the minimum intra-class variance or the maximum inter-class variance, or the minimum ratio of the intra-class variance and the inter-class variance), to obtain a binary segmentation image corresponding to the original frame image.
[0067] It should be noted that the process of calling the imbinarize function in MATLAB for processing is prior art, and the specific process will not be described here.
[0068] Preferably, the video data containing the motion process of the target to be measured comprises: acquiring video data containing the motion process of the target to be measured by a camera device.
[0069] In the embodiment, the camera device is installed above or obliquely above the probe, and the camera device is used to measure the environmental changes of the probe in real time. During displacement measurement, the probe is used to aim at the target to be measured. By adjusting the camera device to be parallel to the direction of the probe, fixing the shooting angle of the camera device, accurately focusing, recording the actual size of the image boundary at this height, and recording the whole process of the motion of the target to be measured, the video file obtained is imported into the corresponding system for subsequent image processing.
[0070] Preferably, the process of obtaining the preset conversion coefficient comprises:
[0071] According to the number of pixel points of the first frame original frame image, the shooting height of the camera device, and the radius of the circular light source of the camera device, the conversion ratio of the shooting height and the circular light source is obtained, and the preset conversion coefficient between the pixel point coordinates and the actual coordinates is obtained according to the conversion ratio.
[0072] Specifically, since the height of the camera device is fixed, the number of pixel points of the photographed image is determined, and the actual radius of the circular light source of the pixel points in the camera device is artificially set. The conversion ratio of the shooting height and the circular light source can be obtained, and the preset conversion coefficient between the pixel point coordinates and the actual coordinates can be obtained according to the conversion ratio. For example, the horizontal coordinate of the image changes by 1, and the actual horizontal displacement changes by 2, and at this time, the preset conversion coefficient is 1:2.
[0073] It should be noted that the specific implementation principle and calculation process of obtaining the preset conversion coefficient between the pixel point coordinates and the actual coordinates based on the conversion ratio of the shooting height and the circular light source, and based on the conversion ratio, are existing technologies and will not be elaborated here.
[0074] Preferably, the S3 includes:
[0075] S31 , obtaining the centroid coordinates corresponding to the target frame original frame image, and determining whether the centroid coordinates of the first frame original frame image are located within the target frame original frame image, and obtaining a determination result.
[0076] The target frame original frame image is an original frame image of any frame, which may be the first frame original frame image or the last frame original frame image.
[0077] Specifically, after the target frame original sub-frame image is acquired, it is determined in the target frame original sub-frame image whether the centroid coordinates of the first frame original sub-frame image are located within the target frame original sub-frame image.
[0078] It should be noted that the method of determining whether a centroid coordinate is located within the target area is an existing technology.
[0079] S32A: When the judgment result is yes, obtain the displacement difference of the target to be measured according to the preset conversion coefficient and the difference between the centroid coordinates of the first frame original frame image and the centroid coordinates of the target frame original frame image.
[0080] Specifically, when the centroid coordinates of the first-frame original frame image are located within the target frame original frame image, the difference in centroid coordinates is converted into the actual displacement difference of the target to be measured between the target frame and the first frame based on the preset conversion coefficient and the difference between the centroid coordinates of the first-frame original frame image and the centroid coordinates of the target frame original frame image.
[0081] S32B. When the judgment result is no, determine that the original frame image before the centroid coordinates of the first frame original frame image are lost is the target frame original frame image, and obtain the displacement difference of the target to be measured based on the preset conversion coefficient and the difference between the centroid coordinates of the first frame original frame image and the centroid coordinates of the target frame original frame image.
[0082] Specifically, when the range between the selected target frame original sub-frame image and the first frame original sub-frame image is too large, and there is no centroid coordinate corresponding to the original sub-frame image in the target frame original sub-frame image, one frame of original sub-frame image before the centroid coordinate of the first frame original sub-frame image is lost is determined as the target frame original sub-frame image, and a displacement difference value of the target to be measured is obtained according to a preset conversion coefficient, and a difference value between the centroid coordinate of the first frame original sub-frame image and the centroid coordinate of the target frame original sub-frame image.
[0083] For example, the original sub-frame image disappears at the fifth frame, and the original sub-frame image of the fourth frame is determined as the target frame original sub-frame image.
[0084] S33, the target frame original sub-frame image is taken as the first frame original sub-frame image between the target frame original sub-frame image and the last frame original sub-frame image, and S31 is executed circularly until the target frame original sub-frame image is the last frame original sub-frame image, and the actual displacement value of the target to be measured is obtained according to all displacement difference values.
[0085] When one displacement difference value is obtained, the target frame original sub-frame image is taken as the first frame original sub-frame image between the target frame original sub-frame image and the last frame original sub-frame image, the step of S31 is executed circularly, a new target frame original sub-frame image is obtained, and the actual displacement value of the target to be measured is obtained by accumulating all displacement difference values when the target frame original sub-frame image is the last frame original sub-frame image.
[0086] Preferably, the method further comprises:
[0087] According to the preset conversion coefficient and a difference value between the centroid coordinates corresponding to the original sub-frame images of any two adjacent frame numbers, a segment displacement value between the binarization segmentation images of the any two adjacent frame numbers is obtained, until all segment displacement values between the first frame original sub-frame image and the last frame original sub-frame image are obtained.
[0088] According to all segment displacement values, a motion change trajectory of the target to be measured in the motion process is obtained.
[0089] The motion change trajectory is a change curve diagram of the target to be measured, wherein the horizontal coordinate is the horizontal displacement, and the vertical coordinate is the vertical displacement.
[0090] The technical scheme of the embodiment obtains the centroid coordinates corresponding to the images and calculates the target running displacement value, which improves the running efficiency, avoids the problem of edge distortion of the image captured by the camera caused by camera calibration, reduces resource consumption, and improves the convenience of displacement measurement.
[0091] For example, the original sub-frame image disappears at the fifth frame, and the original sub-frame image of the fourth frame is determined as the target frame original sub-frame image. Figure 2As shown, a displacement measurement system 200 according to an embodiment of the present invention includes: an acquisition module 210, a processing module 220 and an operation module 230;
[0092] The acquisition module 210 is used to: acquire video data containing the motion process of the target to be measured, and perform frame processing on the video data to obtain all original frame images;
[0093] The processing module 220 is used to perform a binarization segmentation process on each original frame image to obtain a binarized segmented image corresponding to each original frame image, and obtain the centroid coordinates of the target connected area corresponding to the target to be measured in each binarized segmented image;
[0094] The operation module 230 is used to obtain the actual displacement value of the target to be measured during the movement process according to the preset conversion coefficient and all centroid coordinates.
[0095] Preferably, the processing module 220 includes: a first processing module, a second processing module and a third processing module;
[0096] The first processing module is used to: perform median filtering on each original frame image to obtain a filtered frame image corresponding to each original frame image;
[0097] The second processing module is used to: perform grayscale transformation on each filtered frame image to obtain an enhanced frame image containing a binary image boundary corresponding to each filtered frame image;
[0098] The third processing module is used to perform image segmentation processing on each enhanced frame image using the maximum inter-class variance method to obtain a binary segmented image corresponding to each original frame image.
[0099] The technical solution of this embodiment obtains the centroid coordinates corresponding to the image and calculates the target running displacement value. While improving the running efficiency, it can also avoid the problem of edge distortion of the camera-captured image caused by camera calibration, thereby reducing resource loss and improving the convenience of displacement measurement.
[0100] The parameters and steps for each module to implement corresponding functions in the displacement measurement system 200 of this embodiment can be referenced to the parameters and steps in the embodiment of a displacement measurement method above, and will not be repeated here.
[0101] A storage medium provided by an embodiment of the present invention includes: instructions stored in the storage medium, and when a computer reads the instructions, the computer executes the steps of a displacement measurement method. For details, please refer to the parameters and steps in the embodiment of a displacement measurement method above, which will not be repeated here.
[0102] Computer storage media such as USB flash drives, mobile hard drives, etc.
[0103] An embodiment of the present invention provides an electronic device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor. The electronic device is characterized in that when the processor executes the computer program, the computer executes the steps of a displacement measurement method. For details, reference may be made to the various parameters and steps in the embodiment of a displacement measurement method described above, which will not be elaborated here.
[0104] Those skilled in the art will appreciate that the present invention can be implemented as a method, a system, a storage medium, and an electronic device.
[0105] Therefore, the present invention may be embodied in the following forms: entirely in hardware, entirely in software (including firmware, resident software, microcode, etc.), or in a combination of hardware and software, generally referred to herein as a "circuit," "module," or "system." Furthermore, in some embodiments, the present invention may be embodied in the form of a computer program product embodied in one or more computer-readable media, the computer-readable media containing computer-readable program code. Any combination of one or more computer-readable media may be employed. The computer-readable medium may be a computer-readable signal medium or a computer-readable storage medium. A computer-readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination thereof. More specific examples (a non-exhaustive list) of computer-readable storage media include: an electrical connection having one or more wires, a portable computer disk, a hard disk, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination thereof. In this document, a computer-readable storage medium may be any tangible medium containing or storing a program that can be used by or in conjunction with an instruction execution system, apparatus, or device. Although embodiments of the present invention have been shown and described above, it should be understood that the above embodiments are exemplary and are not intended to limit the present invention. Those skilled in the art may make changes, modifications, substitutions, and variations to the above embodiments within the scope of the present invention.
Claims
1. A displacement measurement method, characterized in that: include: S1. Acquire video data containing the motion process of the target to be measured, and perform frame processing on the video data to obtain all original frame images; S2. Performing a binary segmentation process on each original frame image to obtain a binary segmentation image corresponding to each original frame image, and obtaining the centroid coordinates of the target connected area corresponding to the target to be measured in each binary segmentation image; S3. Obtaining an actual displacement value of the target during the motion according to a preset conversion coefficient and all centroid coordinates; The S3 includes: S31, determining whether the centroid of the first frame original sub-frame image is located within the target frame original sub-frame image, and obtaining a determination result; The target frame original frame image is: the original frame image of any frame; S32A, when the judgment result is yes, obtaining the displacement difference of the target to be measured according to the preset conversion coefficient and the difference between the centroid coordinates of the first frame original frame image and the centroid coordinates of the target frame original frame image; S32B, when the judgment result is no, determining that the original framed image before the centroid of the first frame original framed image is lost is the target frame original framed image, and obtaining the displacement difference of the target target according to the preset conversion coefficient and the difference between the centroid coordinates of the first frame original framed image and the centroid coordinates of the target frame original framed image; S33: Use the target frame original frame image as the first frame original frame image between the target frame original frame image and the last frame original frame image, and loop through S31 to S32B until the target frame original frame image is the last frame original frame image, and obtain the actual displacement value of the target to be measured based on all the displacement differences.
2. A displacement measurement method according to claim 1, characterized in that: The step of performing a binarization segmentation process on each original frame image to obtain a binarized segmented image corresponding to each original frame image includes: Perform median filtering on each original frame image to obtain a filtered frame image corresponding to each original frame image; Performing grayscale transformation on each filtered frame image to obtain an enhanced frame image containing a binary image boundary corresponding to each filtered frame image; The maximum inter-class variance method is used to perform image segmentation on each enhanced frame image to obtain a binary segmentation image corresponding to each original frame image.
3. A displacement measurement method according to claim 1, characterized in that: The video data containing the motion process of the target to be measured includes: obtaining the video data containing the motion process of the target to be measured by a camera device.
4. A displacement measurement method according to claim 3, characterized in that: The process of obtaining the preset conversion coefficient includes: According to the number of pixels of the first frame original frame image, the shooting height of the camera device and the radius of the circular light source of the camera device, the conversion ratio of the shooting height and the circular light source is obtained, and according to the conversion ratio, the preset conversion coefficient between the pixel point coordinates and the actual coordinates is obtained.
5. A displacement measurement system, characterized in that: include: Acquisition module, processing module and operation module; The acquisition module is used to: acquire video data containing the motion process of the target to be measured, and perform frame processing on the video data to obtain all original frame images; The processing module is used to perform a binary segmentation process on each original frame image to obtain a binary segmentation image corresponding to each original frame image, and obtain the centroid coordinates of the target connected area corresponding to the target to be measured in each binary segmentation image; The operation module is used to obtain the actual displacement value of the target to be measured during the movement according to the preset conversion coefficient and all the centroid coordinates; The operation module is specifically used for: S31, determining whether the centroid of the first frame original sub-frame image is located within the target frame original sub-frame image, and obtaining a determination result; the target frame original sub-frame image is: an original sub-frame image of any frame; S32A, when the judgment result is yes, obtaining the displacement difference of the target to be measured according to the preset conversion coefficient and the difference between the centroid coordinates of the first frame original frame image and the centroid coordinates of the target frame original frame image; S32B, when the judgment result is no, determining that the original framed image before the centroid of the first frame original framed image is lost is the target frame original framed image, and obtaining the displacement difference of the target target according to the preset conversion coefficient and the difference between the centroid coordinates of the first frame original framed image and the centroid coordinates of the target frame original framed image; S33: Use the target frame original frame image as the first frame original frame image between the target frame original frame image and the last frame original frame image, and loop through S31 to S32B until the target frame original frame image is the last frame original frame image, and obtain the actual displacement value of the target to be measured based on all the displacement differences.
6. A displacement measurement system according to claim 5, characterized in that: The processing module includes: a first processing module, a second processing module and a third processing module; The first processing module is used to: perform median filtering on each original frame image to obtain a filtered frame image corresponding to each original frame image; The second processing module is used to: perform grayscale transformation on each filtered frame image to obtain an enhanced frame image containing a binary image boundary corresponding to each filtered frame image; The third processing module is used to perform image segmentation processing on each enhanced frame image using the maximum inter-class variance method to obtain a binary segmented image corresponding to each original frame image.
7. A storage medium, characterized in that: The storage medium stores instructions, and when a computer reads the instructions, the computer executes a displacement measurement method according to any one of claims 1 to 4.
8. 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 computer program, the computer is caused to execute the displacement measurement method according to any one of claims 1 to 4.
Citation Information
Patent Citations
Movement track display method and device
CN108257146A
Vehicle speed detection and collision early warning method and electronic equipment
CN114332153A