Background technology
In the water level measurement method of prior art, the application of float type level meter in water regime monitoring is the most general.Float is vertically hung on the pulley with line, and float is placed on the water surface, will produce displacement up and down along with the height of water level.By measuring the distance of float and specified point, again by certain calculating, just current water level can have been obtained.Float gauge needs special-purpose well logging, and its shortcoming is installed complicated exactly, and heavier if the while current contain silt, through operation after a while, the water inlet pipe of well logging will produce the phenomenon of alluvial, easily forms artifical water height.
Pressure type water level meter is according to the proportional hydrostatic force principle of pressure and the depth of water, use pressure-active element to make sensor, produce corresponding electric current and measure the height of equivalent water level at different depth of water induction different pressures, this mode has solved the shortcoming of float type level meter, but can't reach very high precision, and easily by environment temperature and liquid density variation influence.
The principle of aerosphere type or the wave reflection of liquid Jie formula ultrasonic type water level meter using ultrasound is measured water level.Ultrasound wave is propagated with certain speed in medium, and when running into the dielectric interface of different densities, ultrasound wave reflects immediately.Liquid Jie formula is that transducer is installed in the river bed, vertically to water surface emission ultrasound wave; Aerosphere type is that transducer is fixed on a certain eminence in the air, to water surface emission ultrasound wave.Two kinds of forms all need not built well logging.Liquid Jie formula is subject in water temperature, hydraulic pressure and the water floating outstanding particle concentration influence, and aerosphere type is subject to the temperature influence, and its advantage is not to be subjected to that pasture and water, silt etc. influence in the water.This method has its advance, but cost is higher.
And existing Level monitor often can only be independent sensed water level, can't detect water quality, need to adopt water monitoring device realize how realizing measuring simultaneously water level and water quality is the technical barrier of this area in addition.
The utility model content
The technical problems to be solved in the utility model provides a kind of water level and water quality monitoring terminal based on machine vision that is suitable for carrying out simultaneously water level and water quality measurement.
In order to solve the problems of the technologies described above, the utility model provides a kind of water level based on machine vision and water quality monitoring terminal, comprise: float, be positioned at described float directly over be provided with first camera that is suitable for taking the float image, be positioned at water surface top and be provided with second camera that is suitable for the filming surface image, the corresponding video signal of described first camera and the output of second camera inputs to video acquisition module, the processor that links to each other with described video acquisition module, this processor is suitable for calculating the area pixel of described float image to obtain the spacing of described first camera and float, the setting height(from bottom) of described camera head deducts described spacing with the acquisition water level value, and described water surface image is carried out gray scale handle to draw the water quality situation.
Further, for the ease of showing concrete water level and water quality data, perhaps can connect with computer and carry out data analysis, described water level and water quality monitoring terminal based on machine vision also comprises: the display module that is suitable for showing water level value and water quality situation, be suitable for the communication module with the computing machine communication, processor links to each other with communication module with described display module.
Further, for the light influence that prevents that ambient light from finding a view and producing camera lens, isolate visible light, the camera lens of described first camera, second camera is equipped with infrared filter.
Further, around the camera lens of described first camera, second camera, be distributed with the LED lighting device.
Further, described processor is FPGA module or DSP module.
Technique scheme of the present utility model has the following advantages compared to existing technology: the utility model has utilized the visual pattern treatment technology, with the application of image vision technology and water level, water quality monitoring field, by the float imagery coverage in the image vision commercial measurement video, be converted into distance between float and the camera to obtain water level numerical value according to the size of imagery coverage, and can obtain water quality information, need not expensive level sensor and loaded down with trivial details water quality monitoring, easy to use.
Embodiment
The present invention is described in detail below in conjunction with drawings and Examples:
See Fig. 1, a kind of water level and water quality monitoring terminal based on machine vision, comprise: float 1, be positioned at described float 1 directly over be provided with first camera that is suitable for taking float 1 image, be positioned at the water surface 2 tops and be provided with second camera that is suitable for the filming surface image, the corresponding video signal of described first camera and the output of second camera inputs to video acquisition module, the processor that links to each other with described video acquisition module, this processor is suitable for calculating the area pixel of described float image to obtain the spacing of described first camera and float 1, the setting height(from bottom) of described camera head deducts described spacing with the acquisition water level value, and described water surface image is carried out gray scale handle to draw the water quality situation.
Described water level and water quality monitoring terminal based on machine vision also comprises: be suitable for showing the display module of water level value and water quality situation, be suitable for the communication module with the computing machine communication, processor links to each other with communication module with described display module.
The camera lens of described first camera, second camera is equipped with infrared filter.
Around the camera lens of described first camera, second camera, be distributed with the LED lighting device.
Described processor is FPGA module or DSP module.
The level measuring ultimate principle is according to the image-forming principle of object in eye; That is, target is more far away, is seeing just more for a short time, for video, the picture of camera, camera, is like this equally.So, a float 1 is placed on the water surface 2, first camera is fixed on certain position, the water surface 2 tops takes float 1 vertically downward.Along with the variation up and down of water level, float 1 also can move up and down, and variation has also taken place the relative distance with first camera then, and this variation is presented as the variation of float 1 shared picture area size in the video image of clapping.Therefore, by the size of 1 area of float in the computed image, the relative distance of float 1 and first camera can be judged, owing to first camera position is fixed, thereby water level can be conversed.
The float image that the utility model adopts the MATLAB function that first camera is taken carries out the threshold value dividing processing, and 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 target and background
Figure; Imshow (Inew); % shows the result after the binaryzation
Obtain the imagery coverage of float 1 by above-mentioned steps, establish this imagery coverage and be white, background is black.
In order to calculate the area of white portion, can call MATLAB built-in function bwarea.The Bwarea function is not the number of non-0 pixel of simple computation, and it also gives different authorities to different pixels, to compensate owing to represent the error that consecutive image is brought with discrete data.Than 50 long horizontal line lengths, therefore, 50 long horizontal line areas that the bwarea function returns are 50 as 50 long diagonal line, are 62.5 and 50 long diagonal line areas return.
The step that employing bwarea carries out area calculating is as follows:
Number=bwarea(Inew);
Number
Calculate the pixel of white portion, i.e. the area pixel of described float image, and compare with the pixel corresponding lists with the distance in being stored in processor, as shown in table 1:
For example, if Number is 54116, i.e. 54116 elemental areas.This figure is that camera is taken during apart from water surface 19cm, thus 54116 elemental areas and 19cm this apart from producing mapping relations.
The distance of first camera and the water surface 2 is not linear with the imagery coverage of float, but a curve that is delayed by abrupt change, namely float is more near apart from camera, identical SEA LEVEL VARIATION, and the imagery coverage of float changes more greatly.Thereby the precision of this water level measurement method also is inconstant, measurement range hour ability guarantee a suitable precision, so be applicable to the little waters of SEA LEVEL VARIATION (lake little as flowability, highly limited cistern).
The utility model can also adopt Canny to detect operator to carry out edge extracting for gray component, and concrete steps are referring to patent of invention, application number 200910232679.6, and name is called " based on water level measurement system and the method for image vision ".
The utility model adopts the water quality detection principle, and to be each gray-scale value of utilizing different quality compare with the gray scale of the water surface to be detected, and namely processor stores each gray-scale value of different quality, and the water surface image that processor is taken second camera carries out the gray scale processing.
Adopt the MATLAB built-in function that described water surface image is carried out gray-scale value and handle, 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
By the calculating of mean2 function, just can obtain the gray-scale value of described water surface image, table 2 is average gray values of various water quality:
According to general general knowledge, the water quality quality of these water samples can be arranged like this: pure water〉green tea water〉swimming-pool water〉river〉be mixed with the water of mud〉by the water of dye discoloration〉industrial waste water ≈ prepared Chinese ink water, when water body sampled images gray-scale value (brightness value) more hour, can think that its water quality is more poor, vice versa.Thereby when water quality detection, can also pass through more senior processing means such as sample extraction, neural network, pattern-recognition by to the corresponding water quality conclusion of calculating of water body overall gray level, accomplish to detect the more water-quality guideline of refinement such as turbidity.
For example the gray-scale value of detected water surface image is 85, and the water quality that then draws the water quality of this water surface 2 and river is suitable.
Obviously, above-described embodiment only is for the utility model example clearly is described, and is not to be restriction to embodiment of the present utility model.For those of ordinary skill in the field, can also make other changes in different forms on the basis of the above description.Here need not also can't give all embodiments exhaustive.And these belong to apparent variation or the change that spirit of the present utility model extended out and still are among the protection domain of the present utility model.