CN113506329A - Real-time displacement measurement method based on monocular camera - Google Patents
Real-time displacement measurement method based on monocular camera Download PDFInfo
- Publication number
- CN113506329A CN113506329A CN202110878654.4A CN202110878654A CN113506329A CN 113506329 A CN113506329 A CN 113506329A CN 202110878654 A CN202110878654 A CN 202110878654A CN 113506329 A CN113506329 A CN 113506329A
- Authority
- CN
- China
- Prior art keywords
- label
- real
- displacement measurement
- image
- monocular camera
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Pending
Links
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T7/00—Image analysis
- G06T7/20—Analysis of motion
- G06T7/246—Analysis of motion using feature-based methods, e.g. the tracking of corners or segments
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T5/00—Image enhancement or restoration
- G06T5/20—Image enhancement or restoration by the use of local operators
- G06T5/30—Erosion or dilatation, e.g. thinning
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T7/00—Image analysis
- G06T7/10—Segmentation; Edge detection
- G06T7/11—Region-based segmentation
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T7/00—Image analysis
- G06T7/10—Segmentation; Edge detection
- G06T7/13—Edge detection
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T7/00—Image analysis
- G06T7/10—Segmentation; Edge detection
- G06T7/155—Segmentation; Edge detection involving morphological operators
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T7/00—Image analysis
- G06T7/90—Determination of colour characteristics
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T2207/00—Indexing scheme for image analysis or image enhancement
- G06T2207/10—Image acquisition modality
- G06T2207/10016—Video; Image sequence
Abstract
The invention discloses a real-time displacement measurement method based on a monocular camera. Firstly, determining the arrangement position of a monocular camera and the label pasting position according to a measurement environment; identifying, capturing and framing the specific label by using a monocular camera and calculating the height of the rectangular frame; when the label moves, tracking the label by using a tracker, calculating the actual moving distance of the label according to the proportional relation between the height of the rectangular frame in the actual environment and the height of the rectangular frame captured by the monocular camera, and displaying the displacement of the label in real time; when carrying out real-time displacement measurement to the label under the night environment, use the night camera of carrying on infrared light filling module to carry out displacement measurement to the label. The method provided by the invention effectively optimizes a monocular vision displacement measurement mode and realizes stable measurement in a non-contact and night environment.
Description
Technical Field
The invention discloses a real-time displacement measurement method based on a monocular camera.
Background
The linear displacement measurement is widely applied to various fields of industrial production, a measurement method based on the principles of a time grating displacement sensor and a laser sensor is commonly used at present, the measurement precision is high, the work is reliable, but the installation and debugging process is complex, and the price is high.
With the rapid development of related technologies such as computer vision, artificial intelligence, image processing, etc., the displacement measurement technology based on machine vision is gradually emphasized due to its advantages such as low cost and non-contact measurement. However, the displacement measurement technology based on the principle also has the disadvantages of low measurement precision and unstable night measurement.
The key technology of the invention mainly comprises: a displacement calculation method, reliable identification of labels in a night environment, and a method of preventing environmental interference by cutting.
(1) The key technology in the aspect of a calculation method. If the label is supposed to be reflected in the image, the real world and the image shot by the camera show a similar relation, and if the size of the label is fixed, the real-time actual displacement can be calculated through simple similar knowledge in mathematics.
(2) Reliable identification of tags in a dark environment. In order to guarantee the recognition under the environment at night, the infrared camera with the light supplementing function is adopted in the device. The accurate stable identification of label at night is the key technology of this patent, through the experiment repeatedly, and the recognition effect who adopts pure black specific dull polish label is very reliable.
(3) The interference of the surrounding environment is prevented by picture cutting. As shown in fig. 3, the surrounding environment may have interferents with colors similar to the label, and smaller than the label may be removed by algorithm corrosion, and larger than the label may be removed by frame cutting. Therefore, the label can be stably identified, the system operation amount can be reduced, and the identification efficiency is improved.
Disclosure of Invention
The invention aims to solve the problem of the displacement measurement method, and provides a novel method only depending on a monocular camera by applying a machine vision technology, so that relatively accurate displacement measurement can be realized at different positions in space under the conditions of different light brightness degrees.
The technical scheme adopted by the invention is as follows: a real-time displacement measurement method based on a monocular camera mainly comprises the following steps:
(1) firstly, a specific label is attached to an object to be measured, and a camera is placed at a proper position.
(2) And reading the camera data through the code, and performing picture cutting on a first frame of a read picture to prevent interference of surrounding environment on label identification.
(3) And carrying out binarization processing on the cut image, further removing noise through morphological operations such as corrosion expansion and the like, obtaining a clear and complete label and capturing the edge of the label.
(4) Initializing the first frame label coordinate obtained in the last step, then starting a timer to read a new frame, and performing frame drawing on the label on the image.
(5) And observing whether the drawn frame is equal to the size of the label edge. If not, performing morphological processing again; and if so, realizing dynamic real-time displacement measurement by capturing and calculating the in-frame label through the tracker.
(6) And finally, outputting the displacement value calculated in the last step on the image in real time through the code.
(7) The night real-time displacement measurement should use a specific night camera with infrared supplementary lighting.
Preferably, the method comprises the following steps: the color and roughness of the label in step (1) are selected by using a specific RGB range and a specific roughness range.
Preferably, the method comprises the following steps: and (3) in the capturing process of the label in the step (2), in order to eliminate the interference of fine environmental impurities close to the label, performing morphological corrosion expansion operation on the image. And for a large interfering object which is similar to the label in material, if necessary, cutting the picture by using an algorithm according to the relative position of the label in the first frame image.
Preferably, the method comprises the following steps: the image binarization operation in the step (3) uses a Kittle algorithm, so that the speed is higher, and the method is more suitable for being applied to images with higher pixel quality.
Preferably, the method comprises the following steps: in the step (4), the actual height of the label is a preset actual value, the vertical distance of the picture frame is the height of the label recognized by the computer, and a bridge between the size of the picture in the image and the actual environment is established according to the ratio.
Preferably, the method comprises the following steps: and (5) a label tracking method. Tags were tracked using a KCF tracker.
Preferably, the method comprises the following steps: in the step (7), the infrared light supplement lamp should supplement light to the whole movement process of the measured object.
The image preprocessing method and the purpose of the invention are as follows: preprocessing a first frame of a picture acquired by a camera, wherein the preprocessing operation comprises but is not limited to: image cutting, image binaryzation, morphological corrosion expansion and picture enhancement and edge detection. The method aims to realize reliable identification of the label and improve the real-time displacement measurement precision; especially, in the night environment, the difference between the gray value of the image and the gray value of the image in the daytime is large, the image preprocessing link is more important, and the measurement precision of the method is directly influenced.
Compared with the prior art, the invention has the advantages that: the displacement method based on the machine vision technology only uses the monocular camera to realize the non-contact real-time displacement measurement in the daytime and at night, and obtains the displacement data with higher safety and accuracy only with lower cost on the premise of safety and stability.
Drawings
The invention is further explained below with reference to the drawings and the embodiments
FIG. 1 is a flow chart of the present invention;
FIG. 2 is a diagram of an actual environment after completion of the arrangement of embodiment 2;
FIG. 3 is an image captured by a monocular camera;
FIG. 4 is the image of FIG. 3 cut to prevent environmental interference;
FIG. 5a is a binarized image of a first frame picture;
FIG. 5b is the morphological erosion processing image of FIG. 5 a;
FIG. 5c is the morphological dilation processing image of FIG. 5 b;
FIG. 5d is the image of FIG. 5c after the enhancement process;
FIG. 5e is the image obtained from the frame after the edge detection in FIG. 5 d;
fig. 6 is an image of the real-time displacement detection process of example 2.
FIG. 7 is an image captured by a monocular camera according to example 3;
FIG. 8 is the image of FIG. 8 cut to prevent environmental interference;
FIG. 9a is a binarized image of a first frame picture;
FIG. 9b is the morphological erosion processing image of FIG. 9 a;
FIG. 9c is the morphological dilation processing image of FIG. 9 b;
FIG. 9d is the image of FIG. 9c after the enhancement process;
FIG. 10 is an image of the frame of FIG. 7 after edge detection;
fig. 11 is an image of the real-time displacement detection process of example 3.
Detailed Description
In order to make the technical means, the creation characteristics, the achievement purposes and the effects of the invention easy to understand, the invention will be further explained with the accompanying drawings.
Example 1: in order to better explain the invention, the invention provides a real-time displacement measurement method based on a monocular camera, which comprises the following steps:
(1) checking the measuring environment and pasting the specific label;
(2) entering a measuring system, checking the data of the camera, and exiting the system if the data is not detected;
(3) acquiring a first frame of image shot by a camera, and reading trimming data of a system to trim a picture;
(4) the RGB value space of the label preset by the reading system is subjected to binarization processing on the cut image, and the noise is further removed through morphological operations such as corrosion expansion and the like, so that a clear and complete label is obtained and the edge of the label is captured.
(5) Initializing the coordinates of the first frame tag obtained in the last step, then starting a timer to read a new frame, performing frame drawing on the tag on the image,
(6) and observing whether the drawn frame is equal to the size of the label edge. If not, performing morphological processing again; and if so, realizing dynamic real-time displacement measurement by capturing and calculating the in-frame label through the tracker.
(7) And finally, outputting the displacement value calculated in the last step on the image in real time through the code.
Example 2: to better illustrate the invention, we simulate measuring projector curtain displacement in a daytime environment. The invention comprises the following steps:
(1) a specific label is pasted on the projector screen, the arrangement position of the camera is determined, and the final environment arrangement result is shown in fig. 2.
(2) Entering the system, opening a camera to obtain a first frame image shown in figure 3, wherein part of the figure is a specific label, and the rest part of the figure is colored interference sticker, simulating the interference of environmental objects to the system, and verifying the identification stability of the system.
(3) In order to prevent interference of objects with large area and close RGB values in the image, the preset cropping data in the system is first read to crop the interference in the first frame of image in step (2), and the cropped image is as shown in fig. 4.
(4) Reading the RGB value space of a preset label of the system, and performing binarization processing on the image cut in the step (3) by using a Kittle algorithm to obtain a binarized image which consists of two parts:
the Kittle algorithm calculates the average value of the gradient gray scale of the whole image, and the average value is used as a threshold value to obtain the black and white image effect. For more intuition, the effect diagram is shown in fig. 5a, and the label position in the image is more obvious.
(5) And (4) performing morphological corrosion and expansion treatment on the image subjected to binarization in the step (4), and further eliminating the interference object which is close to the label after treatment. The effect diagrams are shown in fig. 5b and 5 c.
(6) After the morphological processing, in order to make the image feature obvious, enhancement processing is required, and the effect is as shown in fig. 5 d.
(7) After the image is enhanced, it needs to perform edge detection and framing, as shown in fig. 5 e. And observing whether the drawn frame is equal to the size of the label edge. If not, performing morphological processing again;
and if so, realizing dynamic real-time displacement measurement by capturing and calculating the in-frame label through the tracker.
It can be seen that the tag identification in the embodiment 2 is good, and the external environment does not interfere with the identification result.
(8) Fig. 6 is a daytime real-time displacement measurement effect diagram, and the displacement result of the projection screen is displayed on the screen in real time, with a relative error within 1%.
Example 3: to better illustrate the invention, we simulate measuring projector curtain displacement in a nighttime environment. The invention comprises the following steps:
(1) the projector curtain is pasted with a specific label, the arrangement position of the camera is determined, the infrared light supplement lamp is arranged, and the final environment arrangement result is shown in fig. 7.
(2) And entering the system, and turning on a camera to acquire a first frame image shown in fig. 8.
(3) In order to prevent interference of objects with large area and close RGB values in the image, the preset cropping data in the system is first read to crop the interference in the first frame of image in step (2), and the cropped image is as shown in fig. 8.
(4) Reading the RGB value space of a preset label of the system, and performing binarization processing on the image cut in the step (3) by using a Kittle algorithm to obtain a binarized image which consists of two parts: the Kittle algorithm calculates the average value of the gradient gray scale of the whole image, and the average value is used as a threshold value to obtain the black and white image effect. For more intuition, the effect diagram is shown in fig. 9a, and the label position in the image is more obvious.
(5) And (4) performing morphological corrosion and expansion treatment on the image subjected to binarization in the step (4), and further eliminating the interference object which is close to the label after treatment. The effect diagrams are shown in fig. 9b and 9 c.
(6) After the morphological processing, in order to make the image feature obvious, enhancement processing is needed, and the effect is as shown in fig. 9 d.
(7) After the image is subjected to enhancement processing, edge detection and framing are required, as shown in fig. 10. And observing whether the drawn frame is equal to the size of the label edge. If not, performing morphological processing again; and if so, realizing dynamic real-time displacement measurement by capturing and calculating the in-frame label through the tracker.
(8) Fig. 11 is a diagram showing the effect of real-time displacement measurement at night.
The embodiment is actually that the infrared light supplement lamp is added on the basis of daytime displacement detection for night identification, and the experiment verifies that the measurement system is expected in all aspects of precision, stability and the like.
The above description is only for the purpose of illustrating the preferred embodiments of the present invention and is not to be construed as limiting the invention, and any modifications, equivalents and improvements made within the spirit and principle of the present invention are intended to be included within the scope of the present invention.
Claims (5)
1. A real-time displacement measurement method based on a monocular camera is mainly characterized in that: the method comprises the following steps:
(1) and measuring the measurement environment, determining the arrangement position of the camera and determining the label pasting position.
(2) Capturing the specific label by using a monocular camera.
(3) And identifying the edge of the label, drawing a frame, and calculating the vertical distance of the drawn frame.
(4) And calculating the ratio to obtain the actual distance according to the principle that the two-dimensional actual environment is similar to the image captured by the camera.
(5) And tracking the label by using a tracker, and simultaneously displaying the real-time displacement of the moving object.
(6) The night real-time displacement measurement should use a specific night camera with infrared supplementary lighting.
2. The real-time displacement measurement method of the monocular camera according to claim 1, characterized in that: the color and roughness of the label in the step (1) are selected according to a specific RGB range and a specific roughness range.
3. The real-time displacement measurement method of the monocular camera according to claim 1, characterized in that: and (3) in the capturing process of the label in the step (2), in order to eliminate the interference of fine environmental impurities close to the label, performing morphological corrosion expansion operation on the image. And for a large interfering object which is similar to the label in material, if necessary, cutting the picture by using an algorithm according to the relative position of the label in the first frame image.
4. The real-time displacement measurement method of the monocular camera according to claim 1, characterized in that: in the step (4), the actual height of the label is a preset actual value, the vertical distance of the picture frame is the height of the label identified by the computer, and the actual displacement is calculated according to the ratio.
5. The real-time displacement measurement method of the monocular camera according to claim 1, characterized in that: the method for tracking the tag in the step (5) uses a KCF tracker to track the tag.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202110878654.4A CN113506329A (en) | 2021-08-02 | 2021-08-02 | Real-time displacement measurement method based on monocular camera |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202110878654.4A CN113506329A (en) | 2021-08-02 | 2021-08-02 | Real-time displacement measurement method based on monocular camera |
Publications (1)
Publication Number | Publication Date |
---|---|
CN113506329A true CN113506329A (en) | 2021-10-15 |
Family
ID=78015394
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202110878654.4A Pending CN113506329A (en) | 2021-08-02 | 2021-08-02 | Real-time displacement measurement method based on monocular camera |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN113506329A (en) |
Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US9922254B1 (en) * | 2016-09-13 | 2018-03-20 | Chi Fai Ho | Apparatus and method to determine a distance of a visual object using a label |
CN110681057A (en) * | 2019-09-17 | 2020-01-14 | 天津大学 | Real-time tracking irradiation device and method for experimental mouse |
CN111833379A (en) * | 2020-07-16 | 2020-10-27 | 西安电子科技大学 | Method for tracking target position in moving object by monocular camera |
CN112179283A (en) * | 2019-07-01 | 2021-01-05 | 深圳安锐科技有限公司 | Two-dimensional code-based real-time measurement method and system for spatial displacement of structural deformation |
-
2021
- 2021-08-02 CN CN202110878654.4A patent/CN113506329A/en active Pending
Patent Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US9922254B1 (en) * | 2016-09-13 | 2018-03-20 | Chi Fai Ho | Apparatus and method to determine a distance of a visual object using a label |
CN112179283A (en) * | 2019-07-01 | 2021-01-05 | 深圳安锐科技有限公司 | Two-dimensional code-based real-time measurement method and system for spatial displacement of structural deformation |
CN110681057A (en) * | 2019-09-17 | 2020-01-14 | 天津大学 | Real-time tracking irradiation device and method for experimental mouse |
CN111833379A (en) * | 2020-07-16 | 2020-10-27 | 西安电子科技大学 | Method for tracking target position in moving object by monocular camera |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN107507167B (en) | Cargo tray detection method and system based on point cloud plane contour matching | |
CN106845502B (en) | Wearable auxiliary device for equipment maintenance and visual equipment maintenance guiding method | |
US7231063B2 (en) | Fiducial detection system | |
CN106767399A (en) | The non-contact measurement method of the logistics measurement of cargo found range based on binocular stereo vision and dot laser | |
CN113269040A (en) | Driving environment sensing method combining image recognition and laser radar point cloud segmentation | |
CN110288612B (en) | Nameplate positioning and correcting method and device | |
CN111409070B (en) | Detection method and device, intelligent robot and storage medium | |
CN108764338B (en) | Pedestrian tracking method applied to video analysis | |
JP7450848B2 (en) | Transparency detection method based on machine vision | |
CN114136975A (en) | Intelligent detection system and method for surface defects of microwave bare chip | |
US9204130B2 (en) | Method and system for creating a three dimensional representation of an object | |
CN115100292A (en) | External parameter online calibration method between laser radar and camera in road environment | |
CN114241469A (en) | Information identification method and device for electricity meter rotation process | |
CN111767754A (en) | Identification code identification method and device, electronic equipment and storage medium | |
Dewi et al. | Object detection without color feature: Case study Autonomous Robot | |
CN112686872A (en) | Wood counting method based on deep learning | |
CN113506329A (en) | Real-time displacement measurement method based on monocular camera | |
CN117037132A (en) | Ship water gauge reading detection and identification method based on machine vision | |
WO2021227289A1 (en) | Deep learning-based low-quality two-dimensional barcode detection method in complex background | |
CN115689990A (en) | Carpet lamp stray light defect intelligent detection algorithm and equipment based on machine vision | |
CN115909359A (en) | Capacitance character detection method based on intelligent vision | |
CN115035071A (en) | Visual detection method for black spot defect of PAD light guide plate | |
CN115375991A (en) | Strong/weak illumination and fog environment self-adaptive target detection method | |
CN112733757A (en) | Living body face recognition method based on color image and near-infrared image | |
CN109584287B (en) | Spatial coding structured light decoding method based on deep learning target detection |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
WD01 | Invention patent application deemed withdrawn after publication | ||
WD01 | Invention patent application deemed withdrawn after publication |
Application publication date: 20211015 |