The water environment monitoring device of water level, water quality monitoring can be realized
Technical field
The present invention relates to a kind of electronic surveying field, particularly relate to a kind of image vision treatment technology and realize water level and water monitoring device.
Background technology
Existing Level monitor can only be independent sensed water level or water quality, namely cannot implement water level, water quality is monitored simultaneously.
Summary of the invention
The technical problem to be solved in the present invention is to provide a kind of water environment monitoring device being suitable for carrying out water quality measurement, this water environment monitoring device adopts gray scale detection principle to carry out water quality monitoring, namely carries out gray proces to the water surface image of shooting and obtains the gray-scale value of this water surface image to obtain water quality situation.
The invention provides a kind of water environment monitoring device, comprise: the measuring tube distributed up and down during use, its lower port is provided with lighting device and enters the water surface in use, and the upper port place of measuring tube establishes a video camera, and this video camera is suitable for the water surface image taken in described measuring tube; Digital image acquisition units, is connected with described video camera, is suitable for the image gathered to be transformed to digital picture; The computing machine be connected with described digital image acquisition units, this Computer Storage has the first sample data, and described first sample data is suitable for the gray-scale value recording various water quality; Described first sample data is measured one by one water that is known, different quality by described water environment monitoring device and obtains; Described computing machine is suitable for carrying out gray proces to described digital picture, and to obtain the gray-scale value of described water surface image, this gray-scale value and the first sample data are compared and drawn water quality situation.
Described computing machine is PC.
Preferred as one, described measuring tube is tapered tube, and one end that opening is less is in top, with the ratio of whole image shared by the inwall reducing measuring tube in image that video camera obtains, to improve the reliability of gray proces.
Further, in order to avoid ambient light during shooting is on the impact of water surface image, the inwall of described measuring tube is provided with and is suitable for light-absorbing coating.
Further, in order to avoid ambient light water-bed during shooting is on the impact of water surface image, and keep current unimpeded when not taking, to make the water quality in described measuring tube consistent with actual water quality, described measuring tube is distributed with multiple through hole on the tube wall being positioned at underwater side, and the bottom end closure of this measuring tube, enter in measuring tube to prevent veiling glare; Sheathed one sleeve pipe being distributed with through hole on body below the water surface; The rotating mechanism that described sleeve pipe and is suitable for driving this sleeve pipe to rotate around described measuring tube is in transmission connection, this rotating mechanism is controlled by the controller that is connected with described video camera, when not filming surface image, controlling described rotating mechanism drives sleeve rotating to make the through hole on described measuring tube relative respectively with the through hole on sleeve pipe, is suitable for passing in and out described measuring tube to make current; When filming surface image, control described rotating mechanism and drive sleeve rotating to offset one from another to make the through hole on described measuring tube and the through hole on sleeve pipe, enter described measuring tube to prevent extraneous light.
Further, in order to realize the level measuring to described water environment monitoring device, described measuring tube is fixedly installed; Video camera adopts focusing wide angle camera lens, or tight shot.
Described computing machine also stores the second sample data, and this second sample data is suitable for the pixel value of the water surface image recorded in described measuring tube and the corresponding table of video camera distance water surface elevation or calculating formula; Described computing machine is also suitable for the pixel value of the water surface image calculated in the described measuring tube of current shooting, and the height of the current camera distance water surface is drawn by described second sample data, then the setting height(from bottom) of described video camera is deducted the height of the described video camera distance water surface, namely obtain water level value.
As further preferred embodiment, described video camera is fixed on described measuring tube, and the upper port of this measuring tube is closed, and enters this measuring tube to avoid extraneous light from upper port.
In order to make video camera when taking, be more prone to the edge distinguishing water surface image, float in white pipe is also comprised in described measuring tube, in this pipe, float is the column structure of the center through hole with vertical setting, described image mechanism is suitable for the water surface image taken in described center through hole, and in this pipe, float is suitable for fluctuating in described measuring tube with the water surface.
Further, in order to realize the level measuring to described water environment monitoring device, the outer of described measuring tube is arranged with the float being suitable for this measuring tube is bubbled through the water column; Described water environment monitoring device also comprises: flexible scale, and one end of this flexible scale is fixed on the bottom, and the other end and is suitable for rolling, strain the wrap-up of this flexible scale is connected, and this wrap-up is fixed on described measuring tube; Angle sheave, be located on the inwall of described measuring tube, on the inwall of this measuring tube, the upper and lower of contiguous described angle sheave is respectively equipped with the upper and lower guide pole parallel with the wheel shaft of described angle sheave, described flexible scale is suitable for passing from the gap of the inwall of described upper and lower guide pole and measuring tube respectively and being fitted on the inner side wheel face of described angle sheave, and the top of described angle sheave is in above the water surface.Adopt flexible scale, be suitable for making measuring tube vertically bubble through the water column on the parts such as float, angle sheave, described water environment monitoring device can be swum on the water surface, described video camera obtains the reading of the flexible scale at the top of contiguous described angle sheave, after image recognition, error correction, obtain actual water level value.The method of described error correction is: by the reading of described flexible scale obtained by image recognition, subtracts each other, namely obtain actual water level value with the corrected value preset.Described default corrected value obtains by experiment.
Present invention also offers a kind of measuring method being suitable for water level and water quality monitoring, the technical matters that the method will solve is that the water surface image utilizing video camera to take carries out respective handling to obtain the gray-scale value of water surface image and area pixel value to obtain corresponding water quality and water level conditions.
The method of work of above-mentioned water environment monitoring device, comprises the steps:
(1) water surface is fixed with measuring tube, its lower port is suitable for entering the water surface, and upper port place establishes a video camera, and the water surface image in described measuring tube taken by this video camera;
(2) described water surface image is converted to digital picture by digital image acquisition units;
(3) first, second sample data is stored in the computing machine be connected with described digital image acquisition units, described first sample data is suitable for the gray-scale value recording various water quality, and described second sample data is suitable for the pixel value of the water surface image recorded in described measuring tube and the corresponding table of video camera distance water surface elevation or calculating formula;
(4) described computing machine carries out gray proces to described digital picture, and to obtain the gray-scale value of described water surface image, this gray-scale value and the first sample data are compared, and draw water quality situation;
(5) described Computer calculates the pixel value of the water surface image in the described measuring tube of current shooting, and the height of the current camera distance water surface is drawn by described second sample data, then the setting height(from bottom) of described video camera is deducted the height of the described video camera distance water surface, namely obtain water level value.
Further, in order to extract the area pixel value of water surface image more easily, described step (5) comprising:
A: described digital picture, after gray proces, adopts MATLAB function to carry out Threshold segmentation process to extract the edge of water surface image;
B: Calling MATLAB built-in function bwarea, the area pixel value of the water surface image after extracting with edge calculation.
Compared with prior art, tool of the present invention has the following advantages: (1) the present invention passes through water surface image to obtain the corresponding situation of water quality, device is simple, carries out water quality measurement easily or anticipation, without the need to tedious steps when being convenient in the wild or unconditionally carrying out water quality test; (2) water surface image taken in the measuring tube closed not easily receives the impact of extraneous light, and it is more accurate to measure; (3) the present invention is while acquisition water quality information, obtain the size of the water surface image in image, and according to measuring the distance relation between water surface image size and video camera obtained in advance, to obtain water level, and then achieve water level, water quality monitoring, easy to use.
Accompanying drawing explanation
In order to make content of the present invention be more likely to be clearly understood, below basis specific embodiment and by reference to the accompanying drawings, the present invention is further detailed explanation, wherein
The structural representation of Fig. 1 water environment monitoring device of the present invention.
The connection diagram of Fig. 2 rotating mechanism of the present invention, controller, video camera;
A kind of embodiment of Fig. 3 rotating mechanism of the present invention;
The another kind of embodiment of Fig. 4 rotating mechanism of the present invention;
The structure vertical view of each gag lever post in the another kind of embodiment of Fig. 5 rotating mechanism of the present invention;
The structural representation for water level detection part of Fig. 6 water level detecting system of the present invention.
Embodiment
Embodiment one
As Fig. 1, a kind of water environment monitoring device, comprising: measuring tube 1, and its lower port is provided with lighting device and this lower port is suitable for entirety and enters the water surface 2 in use, upper port place establishes a video camera, and this video camera is suitable for the water surface image 2-1 taken in described measuring tube 1; Digital image acquisition units, is connected with described video camera and is suitable for collection image to be transformed to digital picture; The computing machine be connected with described digital image acquisition units, this Computer Storage has the first sample data, and described first sample data is suitable for the gray-scale value recording various water quality; Described first sample data is measured one by one water that is known, different quality by described water environment monitoring device and obtains; Described computing machine is suitable for carrying out gray proces to described digital picture, and to obtain the gray-scale value of described water surface image 2-1, this gray-scale value and the first sample data are compared and drawn water quality situation.
Water quality detection principle utilizes the gray-scale value of different quality corresponding gray-scale value sample and water surface image to be detected to compare, and namely Computer Storage has each gray-scale value sample of different quality, i.e. the first sample data.
Adopt MATLAB built-in function to carry out corresponding gray-scale value process to described water surface image 2-1, step is as follows:
I=imread (' image.jpg '); % opens pending picture (8 gray scales)
Imshow (I); % shows this picture
C=mean2 (I); The mean value of % computed image picture element matrix
The gray-scale value of described water surface image 2-1 just can be calculated by mean2 function.
Table 1 is the average gray value of various water quality, i.e. the first sample data:
According to general general knowledge, the water quality quality of these water samples can arrange like this: pure water > green tea water > swimming-pool water > river > is mixed with the water > industrial waste water ≈ prepared Chinese ink water of water > by dye discoloration of mud, when water body sampled images gray-scale value (brightness value) more hour, can think that its water quality is poorer, vice versa.Thus when water quality detection, by calculating corresponding water quality conclusion to water body overall gray level, can also be able to pass through the more senior process means such as sample extraction, neural network, pattern-recognition, accomplishing the water-quality guideline of the more refinement such as detection turbidity.
Such as, if the gray scale of the water surface image 2-1 detected is 85, then show that the water quality of this water quality and river is suitable.
In order to avoid extraneous light is on the impact of water surface image 2-1, described video camera and upper port are tightly connected, and the inwall of described measuring tube 1 is provided with and is suitable for light-absorbing black coating.
See Fig. 2, in order to avoid light under water on the impact of shooting further, to improve the brightness of water surface image 2-1, the accuracy of colourity of shooting, described measuring tube 1 is distributed with multiple through hole being positioned on the tube wall below the water surface 2, and the bottom end closure of this measuring tube 1; The sheathed one sleeve pipe 8-1 being distributed with through hole on body below the water surface 2; The rotating mechanism that described sleeve pipe 8-1 and is suitable for driving this sleeve pipe 8-1 to rotate around described measuring tube 1 is in transmission connection, this rotating mechanism is controlled by the controller that is connected with described video camera, when not filming surface image 2-1, control described rotating mechanism and drive sleeve pipe 8-1 to rotate to make the through hole on described measuring tube 1 and the through hole on sleeve pipe 8-1 coincide to be suitable for current circulation; When filming surface image 2-1, control described rotating mechanism and drive sleeve pipe 8-1 to rotate to make the through hole on described measuring tube 1 and the through hole on sleeve pipe 8-1 offset one from another, enter described measuring tube 1 to prevent extraneous light.
Described rotating mechanism controls the embodiment that sleeve pipe rotates around described measuring tube 1:
See Fig. 3, annular seal space 8-2 is formed between the lower surface, bottom of described measuring tube 1 and the upper surface, bottom of sleeve pipe 8-1, sealing chamber 8-2 is to play waterproof action, a stepper motor 8-3 is provided with in the 8-2 of sealing chamber, by stepper motor 8-3, can rotational angle be set, the through hole in described measurement 1 and the through hole on sleeve pipe 8-1 is made to coincide or offset one from another (through hole is not shown in FIG.), the support of stepper motor 8-3 is fixed on the lower surface, bottom of described measuring tube 1, and the center of this support is corresponding with the center of lower surface, described bottom, namely coaxial, rotating shaft one end of described stepper motor 8-3 is connected to drive sleeve pipe 8-1 to rotate around described measuring tube 1 with the upper surface, bottom of described sleeve pipe 8-1, this stepper motor 8-3 is controlled by controller.
Also rotating shaft one end of stepper motor 8-3 can be fixed on the lower surface, bottom of described measuring tube 1, support is coaxially fixed on the upper surface, bottom of described sleeve pipe 8-1, when stepper motor 8-3 rotates, because rotating shaft is fixed, can not rotate, then support will rotate, and namely support drives sleeve pipe 8-1 to rotate around described measuring tube 1.
See Fig. 4, in described annular seal space 8-2, motor 8-4 can also be installed, the support of motor 8-4 is fixed on the lower surface, bottom of described measuring tube 1, and bottom this center of lower surface and the center of this support corresponding, namely coaxial, rotating shaft 8-5 one end of described motor 8-4 is connected with the upper surface, bottom of described sleeve pipe 8-1, because motor 8-4 is difficult to the angle controlling rotation when rotating, so be provided with a spacing cross bar 8-6 on the rotating shaft 8-5 of described motor 8-4, in the upper surface, bottom of described sleeve pipe 8-1, two pairs of gag lever posts are installed, described spacing cross bar 8-6 is embedded in described two pairs of gag lever posts (namely first, second gag lever post is a pair, 3rd, 4th gag lever post is a pair) between, when described motor 8-4 rotates, described sleeve pipe 8-1 is driven to rotate around described measuring tube 1, two pairs of gag lever posts define the anglec of rotation of motor 8-4.
See Fig. 5, specific works process, if when described spacing cross bar 8-6 two ends are in the second gag lever post 8-7b, the 3rd gag lever post 8-7c place, through hole on described measuring tube 1 and the through hole on sleeve pipe 8-1 coincide, when described spacing cross bar 8-6 two ends are in the first gag lever post 8-7a, the 4th gag lever post 8-7d place, through hole on described measuring tube 1 and the through hole on sleeve pipe 8-1 offset one from another, and enter measuring tube 1 to prevent light.
When video camera prepares shooting, when motor 8-4 control rotating shaft 8-5 drives spacing cross bar 8-6 to rotate to the first gag lever post 8-7a and the 4th gag lever post 8-7d place, motor 8-4 quits work, at this moment the through hole on described measuring tube 1 and the through hole on sleeve pipe 8-1 offset one from another, described measuring tube 1 is entered to prevent extraneous light, video camera is taken, take complete, motor 8-4 reverses, when described spacing cross bar 8-6 rotates to the second gag lever post 8-7b and the 3rd gag lever post 8-7c place, through hole on described measuring tube 1 and the through hole on sleeve pipe 8-1 are coincide, current are circulated.
In certain this scheme, gag lever post also can utilize stopper slot to substitute, and the width of rebate of this stopper slot is greater than described spacing cross bar 8-6.
Embodiment two
On the basis of embodiment one, the technical scheme of carrying out the measurement of water level is as follows:
Described measuring tube 1 is fixedly installed, and described video camera is fixedly installed in the upper port of described measuring tube 1; Described computing machine also stores the second sample data, and this second sample data is suitable for recording each area pixel value of water surface image 2-1 and the respective heights of the video camera distance water surface, the corresponding relation namely between each area pixel value and the spacing of video camera and the water surface 2; Described computing machine is also suitable for the area pixel value calculating described water surface image 2-1, this area pixel value and the second sample data are compared, draw the height of the video camera distance water surface 2, the setting height(from bottom) of described video camera deducts the height of the described video camera distance water surface 2 to obtain water level value.
The setting height(from bottom) of described video camera can be known in advance and be pre-stored in described computing machine, also can carry out measurement by instruments such as scales of the prior art and draw.
Camera height can also be achieved by the following scheme measure, the program comprises: flexible scale, be suitable for rolling, strain the wrap-up of this flexible scale, this wrap-up and camera horizon are arranged, described wrap-up is driven by a micro-step motor, this motor is suitable for when scale end thereof contacts (diminishes if current of electric is instantaneous to stopping release scale time water-bed, then judge that the end thereof contacts of scale is to water-bed), simultaneously by the number of turns of driven by motor wrap-up rotation under a sensor record, and this sensor inputs to a control module the corresponding number of turns, this control module obtains the true altitude of video camera by the corresponding number of turns.
Level measuring ultimate principle is according to the image-forming principle of object in eye; That is, target is far away, look at less, for video, the picture of video camera, camera shooting, is like this equally.So, video camera is fixed on measuring tube 1 upper port and takes water surface image 2-1 in measuring tube 1 vertically downward.Along with the change up and down of water level, namely the relative distance of water level and video camera there occurs change, and this change is presented as the change of picture size shared by water surface image 2-1 in clapped water surface image 2-1.Therefore, by the size of water surface image 2-1 in computed image, the water surface 2 and the relative distance of video camera can be judged, because camera position is fixing, thus can converse water level.
This invention and application number 200910232679.6, name is called " water level measurement system and method based on image vision ".Scheme compare, (1) structure that has the following advantages is more simple, without the need to just carrying out water stage measurement by float; (2) error is little, because float is being bubbled through the water column, therefore when taking, the height of the projection of the float of shooting is not the height of actual water level, slightly higher than actual water level, this is just present in error, and various water quality density is different, causes the height difference that float is bubbled through the water column, need to carry out error revision, carried out trouble to water level measuring tape, but the present invention directly carries out level measuring by water surface image 2-1, overcomes above-mentioned defect.
Float in pipe is also comprised in described measuring tube 1, in this pipe, float is the column structure of the center through hole with vertical setting, described image mechanism is suitable for the water surface image taken in described center through hole, and in this pipe, float is suitable for fluctuating in described measuring tube 1 with the water surface; Make the edge of this water surface image 2-1 more clear by the water surface image 2-1 in float in shooting pipe, be convenient to the area extracting this water surface image 2-1.
Embodiment three
See Fig. 6, on the basis of embodiment one, carry out the measurement of water level, this technical scheme is as follows:
The upper port place of described measuring tube 1 is installed with a video camera, described measuring tube 1 outer be arranged be suitable for making this measuring tube 1 vertically bubble through the water column 2 float 3, and measuring tube 1 can be made to bubble through the water column, without the need to fixing in addition by this float 3.
Described water environment monitoring device also comprises:
Flexible scale 4, and one end is fixed on the bottom, and the other end and is suitable for rolling, strain the wrap-up 5 of this flexible scale 4 is connected, and this wrap-up 5 is fixed on the top of described measuring tube 1;
Angle sheave 6, be located on the inwall of described measuring tube 1, on the inwall of this measuring tube 1, contiguous described angle sheave upper and lower is respectively equipped with guide pole 7-1, lower guide pole 7-2, described flexible scale 4 is suitable for passing from described upper guide pole 7-1, lower guide pole 7-2 and being fitted in the inner side wheel face of described angle sheave 6, and the top of described angle sheave 6 is in above the water surface.
The principle that this embodiment six carries out level measuring utilizes video camera when filming surface image 2-1, and shooting is simultaneously directed to the flexible scale 4 that wheel 6 props up, and the scale of flexible scale 4 is easy to be photographed after being propped up, and just obtains actual water level.
Because angle sheave 6 is very little, carry out water quality detection time, when the water surface image 2-1 of shooting carries out gray proces, the parts such as angle sheave, scale are negligible, and the gray-scale value that can't have influence on water surface image 2-1 calculates.
And described flexible scale 4 stretches into the water-bed bottom end closure not affecting described measuring tube 1.
Embodiment four
See Fig. 1, the method for work of the water environment monitoring device on the basis of embodiment two, comprises the steps:
(1) be fixed with measuring tube 1 above the water surface 2, its lower port is suitable for entering the water surface 2, and upper port place establishes a video camera, and the water surface image 2-1 in described measuring tube 1 taken by this video camera;
(2) described water surface image 2-1 is converted to digital picture by digital image acquisition units;
(3) computing machine be connected with described digital image acquisition units, this Computer Storage has first, second sample data, described first sample data is suitable for the gray-scale value recording various water quality, described second sample data is suitable for recording each area pixel value of water surface image 2-1 and the respective heights (that is, the corresponding relation between each area pixel value and the spacing of video camera and the water surface 2) of the video camera distance water surface;
(4) described computing machine carries out gray proces to described digital picture, and to obtain the gray-scale value of described water surface image 2-1, this gray-scale value and the first sample data are compared and drawn water quality situation;
(5) described Computer calculates the area pixel value of described water surface image 2-1, this area pixel value and the second sample data are compared, draw the height of the video camera distance water surface 2, the setting height(from bottom) of described video camera deducts the height of the described video camera distance water surface 2 to obtain water level value.
Described step (5) comprising:
A: after described water surface image 2-1 carries out gray proces, adopts MATLAB function to carry out Threshold segmentation process to extract the edge of water surface image 2-1;
B: Calling MATLAB built-in function bwarea, the area pixel value of the water surface image 2-1 after extracting with edge calculation.
The concrete grammar of water quality detection is shown in the water quality monitoring step in embodiment 1.
The concrete grammar that water level calculates
Adopt MATLAB function to carry out Threshold segmentation process to the water surface image 2-1 that described video camera is taken, its step is as follows:
I=imread (' image.jpg '); % opens pending picture
Imshow (I); % shows this picture
Inew=im2bw (I, x/255); % carries out image binaryzation according to threshold value x, divides object and background
Figure; Imshow (Inew); % shows the result after binaryzation
Obtained the area of water surface image 2-1 by above-mentioned steps, such as, this water surface image 2-1 is white, and background is black.Can certainly arrange different colors as required, such as water surface image 2-1 is black, and background is white.
Here with water surface image 2-1 for white, background is black is example, in order to calculate the area of white portion, can Calling MATLAB built-in function bwarea.Bwarea function is not the number of the non-zero pixel of simple computation, and it also gives different authorities to different pixels, to compensate owing to representing the error that consecutive image brings by discrete data.Horizontal line length as longer than 50 in one 50 long diagonal line, therefore, the long horizontal line area of bwarea function 50 of returning is 50, and 50 long diagonal line areas return is 62.5.
The step that employing bwarea carries out areal calculation is as follows:
Number=bwarea(Inew);
Number
Calculate the pixel of white portion, the i.e. area pixel of described water surface image 2-1, and with store the second sample data in a computer, namely each area pixel value (i.e. pixel) of water surface image 2-1 is recorded compared with the corresponding relation list of the respective heights of the video camera distance water surface, as shown in table 2:
Distance (cm) |
Pixel |
Distance (cm) |
Pixel |
Distance (cm) |
Pixel |
18 |
59998 |
25 |
31759 |
32 |
20668 |
19 |
54116 |
26 |
28131 |
33 |
19627 |
20 |
49458 |
27 |
25657 |
34 |
18809 |
21 |
45541 |
28 |
24082 |
35 |
17774 |
22 |
41099 |
29 |
23204 |
36 |
16963 |
23 |
38848 |
30 |
22223 |
37 |
16188 |
24 |
34584 |
31 |
21549 |
42 |
14800 |
|
|
|
|
50 |
13966 |
Such as, if Number is 54116, i.e. 54116 elemental areas.Then the water surface 2 is 19cm with the spacing of video camera, and namely the height of the video camera distance water surface 2 is 19cm, therefore 54116 elemental areas and this distance of 19cm produce mapping relations.
The height of the described video camera distance water surface is not linear, but a curve delayed by abrupt change, namely the water surface is nearer apart from video camera, identical SEA LEVEL VARIATION, and the change of water surface image is greatly.Thus the precision of this water level measurement method is also inconstant, the precision that guarantee is suitable when measurement range is less, therefore is applicable to the little waters of SEA LEVEL VARIATION (lake as little in mobility, the cistern of limited height).
The present invention can also adopt Canny detective operators to carry out edge extracting for gray component, to obtain each area pixel value of water surface image 2-1, concrete steps are see patent of invention, and application number 200910232679.6, name is called " water level measurement system and method based on image vision ".
Periodical " computing machine and modernization " 06 phase in 2006, extract gray-scale edges in the paper " research based on template parameter in the gray-scale Image Edge extraction algorithm of CNN " of Huang Lei, Liu Wenbo and be also described in detail, the present invention can adopt this algorithm too.
Periodical " Nanjing Aero-Space University " 2006, to describing the method adopting neural network image to be carried out to edge extracting in the paper " the Edge extraction algorithm research based on cell neural network " of Huang Lei, the method is applicable to the present invention too.
Obtain the height of the video camera distance water surface 2 from table 2 after, the setting height(from bottom) of described video camera deducts the height of the described video camera distance water surface 2 to obtain water level value.