Liquid level control method based on visual analysis

文档序号:1361025 发布日期:2020-08-11 浏览:37次 中文

阅读说明:本技术 基于视觉分析的液位控制方法 (Liquid level control method based on visual analysis ) 是由 王静宜 黄鑫 李何 张俊喆 于 2020-07-06 设计创作,主要内容包括:本发明提供一种基于视觉分析的液位控制方法,采用计算机视觉技术,自动获取容器中的液位信息,通过透明连通器接入到矿下水箱的底部,使连通器中液位保持与水箱中液位相同,摄像机对准连通器液位管,采用计算机视觉技术对监控摄像头进行实时分析,将连通器中的浮球的高度与连通器外部的刻度进行比较,即可准确得到容器里的液位信息,进而通过控制装置调整容器的液位高度。(The invention provides a liquid level control method based on visual analysis, which adopts a computer vision technology to automatically acquire liquid level information in a container, and the liquid level information is connected to the bottom of a mine water tank through a transparent communicating vessel, so that the liquid level in the communicating vessel is kept the same as the liquid level in the water tank, a camera is aligned to a liquid level pipe of the communicating vessel, a monitoring camera is analyzed in real time by adopting the computer vision technology, the height of a floating ball in the communicating vessel is compared with scales outside the communicating vessel, the liquid level information in the container can be accurately acquired, and further the liquid level height of the container is adjusted by a control device.)

1. A liquid level control method based on visual analysis comprises the following steps:

s1: communicating an original container with an L-shaped communicating vessel, wherein the liquid levels of the original container and the L-shaped communicating vessel are the same, arranging a colored floating ball in the L-shaped communicating vessel, and acquiring an image through a high-definition camera;

s2: decoding video stream data of a video collected by a camera, and reading video images frame by frame;

s3: detecting whether the floating ball exists in the image or not by using the floating ball as a tracking target, and continuously reading frame by frame if the floating ball does not exist in the image;

s4: after the floating ball is detected, the position of the tracking target is compared with the scale position on the surface of the communicating vessel for analysis, so that the liquid level height in the container is accurately obtained;

s5: the liquid level height is transmitted to a control device, the control device judges whether the height of the floating ball exceeds a set limit, if not, the video image is continuously read downwards frame by frame, and if the height of the floating ball exceeds the set limit, an alarm is generated and data is stored and recorded;

s6: the control device adjusts the liquid level height of the container through the liquid level height.

2. The visual analysis-based liquid level control method of claim 1, wherein: in step S3, the color of the float ball is a bright red monochromatic image, and the colored float ball is used as the tracking target.

3. The visual analysis-based liquid level control method of claim 2, wherein: the method for taking the floating ball as the tracking target comprises the following steps:

s31: calculating a histogram model of the tracking target, converting all images from values of other color spaces to HSV space, and solving a histogram of the H component;

s32: carrying out back projection on each frame of image by using the histogram, and calculating a probability distribution map corresponding to a tracking target in each frame of image;

s33: an initial search window containing a tracked target is initialized, and mean shift determines the center of the search window.

4. The visual analysis-based liquid level control method of claim 3, wherein: in step S33, the center point and the size information of the initialization window are obtained, the centroid position of the tracking target and the size of the tracking target are calculated, the position and the size parameters of the search window are reset according to the centroid position, and the centroid position of the tracking target is obtained by repeating the process.

5. The visual analysis-based liquid level control method of claim 4, wherein: the method for calculating the centroid position of the tracking target and the size of the tracking target comprises the following steps:

s41: inputting a frame of complete picture, calculating which level of a target area histogram the pixel value of each pixel in the frame corresponds to, and then assigning the value of the histogram corresponding to the level to the pixel;

the histogram index of the histogram of the target position corresponding to the pixel value is recorded asNew pixel value isThen, the formula can be expressed as:

x and y represent the horizontal and vertical coordinates of the pixel points,

m is the number of levels of the histogram, each level of histogram is used for corresponding valueFor indicating, for corresponding histogram indicesRepresents;

s42: and (3) enabling the pixel value of each point pixel of the calculated probability distribution map to be between 0 and 255, and processing the pixels as follows:

wherein q ismaxA histogram corresponding value representing the highest level;

s43: calculating a target centroid position by a zero order moment and a first order moment formula of the image, the zero order moment formula:

M00represents the zero order moment;

first moment formula:

M10representing the first moment in the x-direction, M01Representing the first moment in the y direction; whereinI(x,y)Refers to an image in(x,y)At the pixel value of the pixel, i.e. the probability distribution map(x,y)A pixel of (b);

s44: position of the target centroid:

has the coordinates of

Wherein, P0(x, y) represents coordinates of the centroid.

6. The visual analysis-based liquid level control method of claim 1, wherein: in step S4, the set of image coordinates for each scale is confirmed in advance from the position marked at the time of mountingQ(x,y)Matching the centroid of the tracking target with the scale coordinate at the minimum distance DminNamely, the specific liquid level height is judgedQ(x 0 ,y 0 )

The above-mentionedRepresenting the centroid of the tracked object.

7. The visual analysis-based liquid level control method of claim 1, wherein: the color of the scale of the liquid level in the L-shaped communicating vessel is different from that of the floating ball.

8. The visual analysis-based liquid level control method of claim 6, wherein: the collectionQ(x,y)And (4) carrying out distance calculation on coordinates in a coordinate set and centroid coordinates, and taking out the closest coordinates.

Technical Field

The invention relates to a liquid level control method of liquid stored in a container, in particular to a liquid level control method based on visual analysis.

Background

Traditional liquid level control is through placing the judgement device that floats about the level such as level gauge or floater in liquid, the liquid level score is two kinds: one is invasive, inserted into the container bottom; the other is that the inner wall of the container is marked with scales, and personnel regularly patrol. Because some environment when using is dark moist, invasive level gauge live time has long caused the pollution to the sensor easily, and is difficult to maintain, and the increase of inner wall scale formula patrols and examines personnel's work load.

Disclosure of Invention

The invention provides a liquid level control method based on visual analysis, which adopts a computer vision technology to automatically acquire liquid level information in a container, solves the problem of inconvenient detection of the traditional liquid level meter, and adopts the following technical scheme:

a liquid level control method based on visual analysis comprises the following steps:

s1: communicating an original container with an L-shaped communicating vessel, wherein the liquid levels of the original container and the L-shaped communicating vessel are the same, arranging a colored floating ball in the L-shaped communicating vessel, and acquiring an image through a high-definition camera;

s2: decoding video stream data of a video collected by a camera, and reading video images frame by frame;

s3: detecting whether the floating ball exists in the image or not by using the floating ball as a tracking target, and continuously reading frame by frame if the floating ball does not exist in the image;

s4: after the floating ball is detected, the position of the tracking target is compared with the scale position on the surface of the communicating vessel for analysis, so that the liquid level height in the container is accurately obtained;

s5: and the liquid level height is transmitted to a control device, the control device judges whether the height of the floating ball exceeds a set limit, if not, the video image is continuously read downwards frame by frame, and if the height of the floating ball exceeds the set limit, an alarm is generated and data is stored and recorded.

S6: the control device adjusts the liquid level height of the container through the liquid level height.

Further, in step S3, the color of the float ball is a bright red monochromatic image, and the colored float ball is used as the tracking target.

The method for taking the floating ball as the tracking target comprises the following steps:

s31: calculating a histogram model of the tracking target, converting all images from values of other color spaces to HSV space, and solving a histogram of the H component;

s32: carrying out back projection on each frame of image by using the histogram, and calculating a probability distribution map corresponding to a tracking target in each frame of image;

s33: an initial search window containing a tracked target is initialized, and mean shift determines the center of the search window.

Further, in step S33, the center point and the size information of the initialization window are obtained, the centroid position of the tracking target and the size of the tracking target are calculated, the position and the size parameters of the search window are reset according to the centroid position, and the process is repeated to obtain the centroid position of the tracking target.

The method for calculating the centroid position of the tracking target and the size of the tracking target comprises the following steps:

s41: inputting a frame of complete picture, calculating which level of a target area histogram the pixel value of each pixel in the frame corresponds to, and then assigning the value of the histogram corresponding to the level to the pixel;

the histogram index of the histogram of the target position corresponding to the pixel value is recorded asNew pixel value isThen, the formula can be expressed as:

and x and y represent the horizontal and vertical coordinates of the pixel points. i =1,2,3,. m; m is the number of levels of the histogram, each level of histogram is used for corresponding valueFor indicating, for corresponding histogram indicesAnd (4) showing.

S42: and (3) enabling the pixel value of each point pixel of the calculated probability distribution map to be between 0 and 255, and processing the pixels as follows:

wherein q ismaxA histogram corresponding value representing the highest level;

s43: calculating a target centroid position by a zero order moment and a first order moment formula of the image, the zero order moment formula:

M00represents the zero order moment;

first moment formula:

M10representing the first moment in the x-direction, M01Representing the first moment in the y direction; whereinI(x,y)Refers to an image in(x,y)At the pixel value of the pixel, i.e. the probability distribution map(x,y)A pixel of (b);

s44: position of the target centroid:

wherein, P0(x, y) represents coordinates of the centroid.

Further, in step S4, the set of image coordinates of each scale is confirmed in advance based on the position to be calibrated at the time of mountingQ (x,y)Matching the centroid of the tracking target with the scale coordinate for minimum distanceAnd (3) determining the specific liquid level height after matching:

the above-mentionedRepresenting the centroid of the tracked object.

The color of the scale of the liquid level in the L-shaped communicating vessel is different from that of the floating ball.

The collectionQ(x,y)And (4) carrying out distance calculation on coordinates in a coordinate set and centroid coordinates, and taking out the closest coordinates.

Liquid level information sends controlling means through the data line, the container is provided with inlet tube and outlet pipe, the inlet tube is provided with inlet tube switch and inlet tube water pump, the outlet pipe is provided with outlet pipe switch and outlet pipe water pump, controlling means is connected with inlet tube water pump and outlet pipe water pump, under the condition that inlet tube switch and outlet pipe switch are all opened, controlling means can control the liquid level height in the container to realize liquid level control.

According to the liquid level control method based on visual analysis, the transparent communicating vessel is connected to the bottom of the container, so that the liquid level in the communicating vessel is kept the same as the liquid level in the container, the camera is aligned with the liquid level pipe of the communicating vessel, the monitoring camera is analyzed in real time by adopting a computer vision technology, the height of a floating ball in the communicating vessel is compared with scales outside the communicating vessel, and then the liquid level information in the water storage tank can be accurately obtained.

Drawings

FIG. 1 is a schematic view of the liquid level identification device;

fig. 2 is a schematic flow chart of the liquid level identification device.

Detailed Description

The following examples are given in conjunction with the accompanying drawings to illustrate technical embodiments of the present invention in detail.

As shown in figure 1, the liquid level control method based on visual analysis comprises an L-shaped communicating vessel 2 communicated with the lower part of an original container 1, wherein a floating ball 3 is arranged in the L-shaped communicating vessel.

According to the liquid pressure principle, the liquid level in the communicating vessel is the same as the liquid level in the original container 1, and meanwhile, the small ball in the communicating vessel floats above the liquid level, so that data can be collected conveniently.

Based on monocular vision, a high-definition camera 4 is arranged beside an L-shaped communicating vessel 2, and as can be seen by combining a picture 2, video stream data is decoded from the camera, video images are read frame by frame, a floating ball in a liquid level meter is used as a tracking target, if the liquid level floating ball is not detected, the video images are continuously read frame by frame, and the liquid level floating ball in the images is continuously searched; when the condition for updating the tracking target is met, the tracking target is extracted from the current image, and after the tracking target is extracted, the position of the tracking target is compared and analyzed with the scale position on the surface of the communicating vessel, so that the liquid level height in the reservoir is accurately obtained.

And then judging whether the height of the floating ball exceeds a set limit, if not, continuously reading the video images downwards frame by frame, and if exceeding is found, generating an alarm and storing and recording the data.

The liquid level monitoring method comprises the following specific operation steps: (1) selecting a tracking target; (2) updating the tracking target position; (3) and comparing and judging the positions of the tracked targets.

For step (1), selecting a tracking target: and (4) taking the colored floating ball as a main body of the tracking target, and calculating a color histogram of the tracking target and a probability distribution map of the current image. The color of the floating ball can be a monochromatic image, and particularly, a more obvious bright red color can be selected.

The method comprises the following steps:

1) when the histogram model of the tracking target is calculated, since the H component in the HSV space can represent color information, all images can be converted from values of other color spaces to the HSV space first in the calculation process, and only the histogram of the H component is obtained. The color conversion process is prior art and is not described in detail. Because the processing of the images is single-frame processing, each frame of image participates in the processing, all the images are converted from frame to frame during the processing.

2) And then, carrying out back projection on each frame of image by using the histogram, and calculating a probability distribution map corresponding to the tracking target in each frame of image. The probability distribution map is used for judging the probability that the tracking target is distributed in different areas.

And taking the whole image as a search area, wherein the back projection is to query a color histogram of a tracking target for the current value of each pixel point in the search area of the current frame image, and determine the probability that the pixel point belongs to the tracking target.

3) The mean shift determines the window center. An initial search window containing a tracking target is initialized, the search window is a window-like area relative to the full image, and the sliding search can be carried out in the full image.

Center point and size information of the initialization window are obtained. And calculating the centroid position of the tracking target and the size of the tracking target according to the following zero-order moment and first-order moment formulas, and resetting the position and size parameters of the search window according to the centroid position. This process is repeated to obtain the centroid position of the tracking target.

(2) Updating the tracking target position;

for the whole image, the probability distribution diagram of the whole image about the target region histogram of the tracking target is calculated, and the calculation mode is very simple. Assuming that the calculated histogram is divided into m levels, each level of histogram is applied to the corresponding valueFor indicating, for corresponding histogram indicesAnd (4) showing. Wherein q represents a value of the histogram, and the index represents a histogram level; u denotes a histogram index.

For the whole image, a frame of the whole picture is input, the level of the target area histogram corresponding to the pixel value of each pixel in the frame is calculated, and then the image is displayedThe value of the histogram corresponding to the level is assigned to the pixel. The histogram index of the histogram of the target position corresponding to the pixel value is recorded asNew pixel value isThen, the formula can be expressed as:

and x and y represent the horizontal and vertical coordinates of the pixel points. i =1,2, 3.. m.

In order to make the pixel value of each point of the calculated probability map be between 0 and 255, the following processing is carried out on the pixel:

calculating the target centroid position through a zero-order moment formula and a first-order moment formula of the image, wherein the zero-order moment formula comprises the following steps:

M00representing the zeroth order moment.

First moment formula:

M10representing the first moment in the x-direction, M01Representing the first moment in the y-direction.

WhereinI(x,y)Refers to an image in(x,y)The pixel value of the pixel, here the probability distribution map(x, y)The pixel of (b). Calculating the position of the center of mass of the target:

wherein, P0(x, y) represents coordinates of the centroid.

(3) And (3) comparing and judging the positions of the tracked targets:

because the color of the scale of the liquid level in the communicating vessel is different from that of the floating ball, the set of the image coordinates of each scale can be confirmed in advance according to the calibrated position (namely, the scale of the transverse line) during installationQ(x,y)And the set is a coordinate set, the distance between the coordinates in the set and the coordinates of the center of mass is calculated, and the closest coordinates are taken out. Then, the centroid of the tracking target is subjected to minimum distance matching with the scale coordinates, and the specific liquid level height is judged:

the liquid level height data identified by the device can be accessed into various management and control systems through standard industrial protocol interfaces.

According to the liquid level control method based on visual analysis, the transparent communicating vessel is connected to the bottom of the container, so that the liquid level in the communicating vessel is kept the same as the liquid level in the water tank, the camera is aligned with the liquid level pipe of the communicating vessel, the monitoring camera is analyzed in real time by adopting a computer vision technology, the height of the floating ball in the communicating vessel is compared with the scale outside the communicating vessel, and then the liquid level information in the water storage tank can be accurately obtained.

Liquid level information sends controlling means through the data line, the container is provided with inlet tube and outlet pipe, the inlet tube is provided with inlet tube switch and inlet tube water pump, the outlet pipe is provided with outlet pipe switch and outlet pipe water pump, controlling means is connected with inlet tube water pump and outlet pipe water pump, under the condition that inlet tube switch and outlet pipe switch are all opened, controlling means can control the liquid level height in the container to realize liquid level control.

10页详细技术资料下载
上一篇:一种医用注射器针头装配设备
下一篇:一种药粉称量系统

网友询问留言

已有0条留言

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

精彩留言,会给你点赞!

技术分类