Real-time displacement measurement method based on monocular camera

文档序号:106334 发布日期:2021-10-15 浏览:16次 中文

阅读说明:本技术 一种基于单目摄像头的实时位移测量方法 (Real-time displacement measurement method based on monocular camera ) 是由 储汇 宋陈 汪晨灿 于 2021-08-02 设计创作,主要内容包括:本发明公开了一种基于单目摄像头的实时位移测量方法。首先根据测量环境确定单目摄像头布置位置与标签粘贴位置;用单目摄像头对特定标签进行识别、捕捉、框选并计算矩形框的高;当标签进行运动时,使用追踪器对标签进行追踪,根据实际环境中矩形框的高度与单目摄像头捕捉的矩形框的高度的比例关系,计算标签运动实际距离并实时显示标签位移;夜间环境下对标签进行实时位移测量时,使用搭载红外补光模块的夜间摄像头对标签进行位移测量。本发明提供的方法有效地优化了单目视觉位移测量方式,做到了无接触、夜间环境下稳定的测量。(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.)

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.

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.

16页详细技术资料下载
上一篇:一种医用注射器针头装配设备
下一篇:基于多尺度变换的不同波段偏振角图像融合方法

网友询问留言

已有0条留言

还没有人留言评论。精彩留言会获得点赞!

精彩留言,会给你点赞!