CN109377490A - Water quality detection method, device and terminal - Google Patents

Water quality detection method, device and terminal Download PDF

Info

Publication number
CN109377490A
CN109377490A CN201811291182.7A CN201811291182A CN109377490A CN 109377490 A CN109377490 A CN 109377490A CN 201811291182 A CN201811291182 A CN 201811291182A CN 109377490 A CN109377490 A CN 109377490A
Authority
CN
China
Prior art keywords
value
detected
image
sample
water
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
Application number
CN201811291182.7A
Other languages
Chinese (zh)
Inventor
苏涛
刘倩
周小峰
董林辉
董红红
蔡振山
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Shenzhen Mayor Technology Co Ltd
Original Assignee
Shenzhen Mayor Technology Co Ltd
Priority date (The priority date 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 date listed.)
Filing date
Publication date
Application filed by Shenzhen Mayor Technology Co Ltd filed Critical Shenzhen Mayor Technology Co Ltd
Priority to CN201811291182.7A priority Critical patent/CN109377490A/en
Publication of CN109377490A publication Critical patent/CN109377490A/en
Pending legal-status Critical Current

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/0002Inspection of images, e.g. flaw detection
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06QINFORMATION AND COMMUNICATION TECHNOLOGY [ICT] SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES; SYSTEMS OR METHODS SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES, NOT OTHERWISE PROVIDED FOR
    • G06Q50/00Information and communication technology [ICT] specially adapted for implementation of business processes of specific business sectors, e.g. utilities or tourism
    • G06Q50/06Energy or water supply
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/90Determination of colour characteristics
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T2207/00Indexing scheme for image analysis or image enhancement
    • G06T2207/30Subject of image; Context of image processing
    • G06T2207/30168Image quality inspection
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02ATECHNOLOGIES FOR ADAPTATION TO CLIMATE CHANGE
    • Y02A20/00Water conservation; Efficient water supply; Efficient water use
    • Y02A20/152Water filtration

Landscapes

  • Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Theoretical Computer Science (AREA)
  • Business, Economics & Management (AREA)
  • Economics (AREA)
  • Computer Vision & Pattern Recognition (AREA)
  • Health & Medical Sciences (AREA)
  • Water Supply & Treatment (AREA)
  • Public Health (AREA)
  • Quality & Reliability (AREA)
  • General Health & Medical Sciences (AREA)
  • Human Resources & Organizations (AREA)
  • Marketing (AREA)
  • Primary Health Care (AREA)
  • Strategic Management (AREA)
  • Tourism & Hospitality (AREA)
  • General Business, Economics & Management (AREA)
  • Investigating Or Analyzing Non-Biological Materials By The Use Of Chemical Means (AREA)
  • Investigating Or Analysing Materials By Optical Means (AREA)

Abstract

The invention discloses a kind of water quality detection method, device and terminals, this method comprises: obtaining the image of pretreated water sample to be detected;Extract the sample rgb value of the image of the water sample to be detected;The RGB coordinate distance between standard RGB values by presetting the image that arithmetic operation calculates the sample rgb value and multiple standard water samples;Using the water quality parameter concentration in the multiple standard water sample with the smallest standard water sample of RGB coordinate distance of the water sample to be detected as the water quality parameter concentration of the water sample to be detected.The present invention can be handled sample solution image to be detected, and detected automatically by scheduled detection rule, suitable for the detection of multiple-quality water parameter concentration, detection accuracy is high, at low cost, convenient to use when detecting the concentration of water quality parameter.

Description

Water quality detection method, device and terminal
Technical field
The present invention relates to water quality inspection technique fields, in particular to a kind of water quality detection method, device and computer Terminal.
Background technique
It after adding medicament in water, is examined by special instrument whether water quality parameter is up to standard in water quality parameter monitoring process It surveys.But, it is generally the case that water quality parameter detector is somewhat expensive, higher cost, and complicated for operation, so water quality parameter Fast inspection medicament is a kind of not only quick but also cheap detection means.Existing water quality parameter examines the principle of medicament fastly currently on the market It is: adds particular agent in water sample, then develop the color, it is subjected to colorimetric with standard color comparison card.Standard color comparison card is by multiple The sample of different colours depth forms, and the color of water sample color and which standard card after adding medicament is close, then its result It is just consistent with which.In general, the process of colorimetric is carried out with human eye.This process has some limitations, because, Different people, it is different to the sensitivity of color, even so the same water sample, the same colorimetric card, different people's ratios Pair result may also be inconsistent, therefore, come into being by the technology that computer equipment carries out automatic colorimetric.
Concentration standard solution color value corresponding with the concentration is fitted in a kind of existing automatic colorimetric scheme, is obtained The curve for indicating corresponding relationship between concentration and standard solution color to one, in the detection process, by solution colour generation to be detected Entering the fitting equation can be obtained its corresponding concentration.In this kind of mode, it is fitted by the concentration and color value of predetermined number Curve not the color value of all solution to be detected is all suitable for, and the program is only applicable to the detection of chlorine ion concentration.
The rgb value of the image of solution to be detected is carried out by one group of equation in existing another automatic colorimetric scheme Linearisation, is converted into trichromatic coordinates value, trichromatic coordinates value is converted to two-dimentional CIE1931 chrominance space, by comparing to be measured molten Liquid target data values and calibration curve calculate final measured value.In this in mode, rgb value is converted into trichromatic coordinates value, And then two-dimensional coordinate value is converted to, and the probability for increasing error is converted by two-stage, and algorithm is complicated, Algorithms T-cbmplexity is high, It is unfavorable for fast implementing.
Summary of the invention
In view of the above problems, the embodiment of the present invention is designed to provide a kind of water quality detection method, device and computer Terminal, so as to solve the deficiencies in the prior art.
According to embodiment of the present invention, a kind of water quality detection method is provided, comprising:
Obtain the image of pretreated water sample to be detected;
Extract the sample rgb value of the image of the water sample to be detected;
Between standard RGB values by presetting the image that arithmetic operation calculates the sample rgb value and multiple standard water samples RGB coordinate distance;
By the water quality in the multiple standard water sample with the smallest standard water sample of RGB coordinate distance of the water sample to be detected Water quality parameter concentration of the parameter concentration as the water sample to be detected.
In above-mentioned water quality detection method, the default arithmetic operation are as follows:
K=(a-x)2+(b-y)2+(c-z)2
Or
Or K=| a-x |+| b-y |+| c-z |;
Wherein, K is RGB coordinate distance, and (x, y, z) is the standard RGB values, and (a, b, c) is the sample rgb value.
In above-mentioned water quality detection method, " image for obtaining pretreated water sample to be detected " includes:
Obtain the original image of the water sample to be detected before being located at white background;
The corresponding image of water sample solvent portions to be detected is extracted from the original image as the water sample to be detected Image.
In above-mentioned water quality detection method, " the sample rgb value for extracting the image of the water sample to be detected " includes:
It is equal to calculate all pixels the point channel R mean value, the channel G in RGB color domain space in the image of the water sample to be detected Value and channel B mean value, and using the channel R mean value, the channel G mean value and channel B mean value as the sample rgb value of the image.
In above-mentioned water quality detection method, " image for obtaining pretreated water sample to be detected " includes:
Obtain the original image of the water sample to be detected before being located at white background;
The corresponding image of water sample solvent portions to be detected and background image are extracted from the original image.
In above-mentioned water quality detection method, " the sample rgb value for extracting the image of the water sample to be detected " includes:
It calculates in the background image corresponding in each pixel image corresponding with the water sample solvent portions to be detected R channel difference values, G channel difference values and channel B difference between pixel, and by the absolute value of the R channel difference values, G channel difference The R value, G value and B value of the absolute value of value and the absolute value of channel B difference as the pixel;
Calculate the mean value of the mean value of R value of all pixels point, the mean value of G value and B value, and by the mean value of the R value, G value Mean value and B value sample rgb value of the mean value as the image.
In above-mentioned water quality detection method, also wrapped before " image for obtaining pretreated water sample to be detected " It includes:
The input operation for responding user obtains water quality parameter to be detected.
According to another implementation of the invention, a kind of water quality detecting device is provided, comprising:
Module is obtained, for obtaining the image of pretreated water sample to be detected;
Extraction module, the sample rgb value of the image for extracting the water sample to be detected;
Computing module, for calculating the sample rgb value and the image of multiple standard water samples by presetting arithmetic operation RGB coordinate distance between standard RGB values;
Contrast module, for will be the smallest with the RGB coordinate distance of the water sample to be detected in the multiple standard water sample Water quality parameter concentration of the water quality parameter concentration of standard water sample as the water sample to be detected.
Another embodiment according to the present invention, provides a kind of terminal, and the terminal includes storage Device and processor, the memory run the computer program so that institute for storing computer program, the processor It states terminal and executes above-mentioned water quality detection method.
In above-mentioned terminal, the terminal is mobile terminal.
Yet another embodiment according to the present invention provides a kind of computer storage medium, is stored with above-mentioned calculating The computer program used in machine terminal.
The technical scheme provided by this disclosed embodiment may include it is following the utility model has the advantages that
A kind of water quality detection method, device and terminal in the present invention can will when detecting the concentration of water quality parameter The solution image of acquisition is detected automatically by scheduled detection rule, suitable for the detection of multiple-quality water parameter concentration, inspection It is high, at low cost to survey precision, it is convenient to use.
To enable the above objects, features and advantages of the present invention to be clearer and more comprehensible, preferred embodiment is cited below particularly, and cooperate Appended attached drawing, is described in detail below.
Detailed description of the invention
In order to illustrate more clearly of technical solution of the present invention, letter will be made to attached drawing needed in the embodiment below It singly introduces, it should be understood that the following drawings illustrates only certain embodiments of the present invention, therefore is not construed as to the present invention The restriction of protection scope for those of ordinary skill in the art without creative efforts, can be with root Other relevant attached drawings are obtained according to these attached drawings.
Fig. 1 shows a kind of flow diagram of water quality detection method of first embodiment of the invention offer.
Fig. 2 shows a kind of flow diagrams for water quality detection method that second embodiment of the invention provides.
Fig. 3 shows a kind of flow diagram of water quality detection method of third embodiment of the invention offer.
Fig. 4 shows a kind of flow diagram of water quality detection method of fourth embodiment of the invention offer.
Fig. 5 shows a kind of structural schematic diagram of water quality detecting device provided in an embodiment of the present invention.
Main element symbol description:
500- water quality detecting device;510- obtains module;520- extraction module;530- computing module;540- contrast module.
Specific embodiment
Below in conjunction with attached drawing in the embodiment of the present invention, technical solution in the embodiment of the present invention carries out clear, complete Ground description, it is clear that described embodiments are only a part of the embodiments of the present invention, instead of all the embodiments.Usually exist The component of the embodiment of the present invention described and illustrated in attached drawing can be arranged and be designed with a variety of different configurations herein.Cause This, is not intended to limit claimed invention to the detailed description of the embodiment of the present invention provided in the accompanying drawings below Range, but it is merely representative of selected embodiment of the invention.Based on the embodiment of the present invention, those skilled in the art are not doing Every other embodiment obtained under the premise of creative work out, shall fall within the protection scope of the present invention.
Embodiment 1
Fig. 1 shows a kind of flow diagram of water quality detection method of first embodiment of the invention offer.
The water quality detection method includes the following steps:
In step s 110, the image of pretreated water sample to be detected is obtained.
Specifically, the pretreatment is a certain amount of chemical reagent will to be added in water sample when detecting a certain water quality parameter, Generated after adequately chemically reacting with coloured chemical substance, when in water sample including the water quality parameter of various concentration, The chemical substance generated when being chemically reacted with chemical reagent is of different shades.
The water quality parameter can be total phosphorus, ammonia nitrogen, phosphate, copper etc..
For example, if water quality parameter is total phosphorus, when the concentration for the total phosphorus for including in water sample to be detected, in water sample to be detected Adding quantitative potassium sulfate makes sample digestion, and contained phosphorus is all oxidized to phosphate.In acid medium, orthophosphates with Molybdenum acid ammonia reaction is restored by ascorbic acid immediately after generating phosphato-molybdic heteropolyacid in the presence of antimonic salt, generates the complex compound of blue.
In the water sample to be detected of the total phosphorus comprising various concentration, with the complex compound that is generated after quantitative sulfuric acid nak response Color is different, e.g., total phosphorus concentration be in the water sample to be detected of 0.5mg/L with generate very shallow indigo plant after quantitative sulfuric acid nak response The complex compound of color;Total phosphorus concentration is total compared to above-mentioned with generation after quantitative sulfuric acid nak response in the water sample to be detected of 1mg/L The complex compound of deeper blue when phosphorus concentration is 0.5mg/L;Total phosphorus concentration be 2mg/L water sample to be detected in quantitative sulfuric acid The complex compound of when being 1mg/L deeper blue is generated compared to above-mentioned total phosphorus concentration after nak response;Total phosphorus concentration be 3mg/L to Detect in water sample with generated after quantitative sulfuric acid nak response be 2mg/L compared to above-mentioned total phosphorus concentration when deeper blue complexing Object;Total phosphorus concentration is in the water sample to be detected of 5mg/L The complex compound, etc. of deeper blue when 3mg/L.
In the present embodiment, which is acquired by imaging device After particular color compound) water sample to be detected image.In some other embodiments, it can also receive and be set from other The image of the standby water sample to be detected after pretreatment transmitted realizes long-range detection, is not only restricted to position and distance Perplex caused by factor.It, can also be from being locally stored in the equipment where imaging device in yet other embodiment The image that the water sample to be detected is recalled in the other positions (such as photograph album, glue file press from both sides) of device is detected, when being not only restricted to Between perplex caused by factor.In further embodiments, can also be downloaded from internet the image of the water sample to be detected into Row detection, is not only restricted to puzzlement caused by position, distance, time and imaging device.
Further, the image of the pretreated water sample to be detected of the acquisition can be pretreated water to be detected The corresponding image of the solvent portions of sample.
Specifically, the vessel for holding pretreated water sample to be detected can be transparence, will not block when shooting The visual angle of its internal solution placed, and the color of the solvent portions of the pretreated water sample to be detected of acquisition will not be generated It influences, causes the error of the rgb value extracted, influence water quality parameter Concentration Testing precision.
Specifically, when acquiring the image of pretreated water sample to be detected, the display portion of the imaging device can be set Set the rectangle frame of a predetermined size (such as 10 × 10,6 × 6, as unit of pixel), user by adjusting imaging device position It sets, has the corresponding image of solvent portions of display water sample to be detected in rectangle frame (in the image i.e. through water sample to be detected The image in the region of color).
Further, the image of the pretreated water sample to be detected of the acquisition can be the water to be detected comprising background The image of sample can be split by image of the image processing techniques to water sample to be detected, obtain detecting required image-region, The freedom degree in shooting process is improved, is reduced to the position of imaging device and the limitation of shooting distance.
In the step s 120, the sample rgb value of the image of water sample to be detected is extracted.
Any color is all by R (Red), G (Green), three kinds of primary colours compositions of B (Blue), from the angle of computer disposal From the point of view of, RGB can be regarded as to three reference axis, the value range of each reference axis can be (0~255), so, it is any Color can be indicated with (a, b, c), wherein a indicates the value in the channel R of the color, and b indicates the value in the channel G of the color, c Indicate the value of the channel B of the color.
For example, red can be expressed as (255,0,0), green can be expressed as (0,255,0), and blue can be expressed as (0,0,255) etc..
In the present solution, the image of the water sample to be detected is carried out channel fractionation in RGB color domain space, the channel R is obtained The value of value, the value in the channel G and channel B.
In the present embodiment, the value in the channel R can be a certain pixel in the image of the water sample to be detected in the channel R Value, can also for the water sample to be detected image in mean value of all pixels point on the channel R.The value and B in the channel G are logical Value of the value in road such as the channel R is consistent, and details are not described herein.
In step s 130, the standard for calculating the image of sample rgb value and multiple standard water samples by presetting arithmetic operation RGB coordinate distance between rgb value.
Further, each water quality parameter is corresponding with the standard RGB values of the image of multiple standard water samples, each standard water The standard RGB values of the image of sample correspond to the image rgb value of the water sample of the water quality parameter of various concentration.
For example, total phosphorus is corresponding with multiple standard RGB values, the multiple standard RGB values may include that total phosphorus concentration is 0.1mg/L When water sample image rgb value, total phosphorus concentration be 0.2mg/L when water sample image rgb value, total phosphorus concentration 0.3mg/ The rgb value of the image of water sample when L, the rgb value of the image of water sample when total phosphorus concentration is 0.4mg/L, total phosphorus concentration are The rgb value ... ... of the image of water sample when 0.5mg/L, the rgb value of the image of water sample when total phosphorus concentration is 1.9mg/L, etc. Deng.
Other each water quality parameters are similar with total phosphorus, are corresponding with the standard RGB values of multiple table various concentrations.
By default arithmetic operation calculate separately the sample rgb value multiple standard RGB values corresponding with the water quality parameter it Between RGB coordinate distance.
Further, the default arithmetic operation are as follows:
K=(a-x)2+(b-y)2+(c-z)2
Or
Or K=| a-x |+| b-y |+| c-z |;
Wherein, K is RGB coordinate distance, and (x, y, z) is the standard RGB values, and (a, b, c) is the sample rgb value.
The seat of the RGB between the sample rgb value and standard RGB values can be calculated by above-mentioned any default arithmetic operation Subject distance.
The standard RGB values of the image of the corresponding multiple standard water samples of each water quality parameter are more, the sample rgb value of calculating with The number of RGB coordinate distance between standard RGB values is more, and it is more careful that distance divides, and the precision of water quality parameter Concentration Testing is got over It is high.
In step S140, by the smallest standard water sample of RGB coordinate distance in multiple standard water samples with water sample to be detected Water quality parameter concentration of the water quality parameter concentration as water sample to be detected.
Specifically, all RGB coordinate distances of calculating can be ranked up by sort algorithm, obtains the smallest RGB and sits Subject distance.
Wherein, the sort algorithm can be Bubble Sort Algorithm, Shell sorting, heapsort, binary merge sequence etc..
The standard RGB values and water of the water quality parameter are also previously stored in the equipment for executing the water quality detection method Corresponding relationship between matter parameter concentration.The corresponding relationship can be described by table, can also by expression formula into Row description.
It is described between the standard RGB values of the water quality parameter and water quality parameter concentration for example, following table is shown by table Corresponding relationship.
Standard RGB values Water quality parameter concentration Standard RGB values Water quality parameter concentration
(x1,y1,z1) A1 (x4,y4,z4) A4
(x2,y2,z2) A2 …… ……
(x3,y3,z3) A3 (xN,yN,zN) AN
In upper table, standard RGB values (x1,y1,z1) corresponding water quality parameter concentration is A1;Standard RGB values (x2,y2,z2) right The water quality parameter concentration answered is A2;Standard RGB values (x3,y3,z3) corresponding water quality parameter concentration is A3;Standard RGB values (x4,y4, z4) corresponding water quality parameter concentration is A4, etc..
When the corresponding relationship between the standard RGB values and water quality parameter concentration of the water quality parameter is described by table When, above-mentioned table can be inquired using the obtained corresponding standard RGB values of the smallest RGB coordinate distance as index, obtain and be somebody's turn to do The corresponding water quality parameter concentration of standard RGB values.
Alternatively, when the corresponding relationship between the standard RGB values of the water quality parameter and water quality parameter concentration is expression formula, Obtained the smallest RGB coordinate distance can be updated in the expression formula, obtain water quality parameter corresponding with the standard RGB values Concentration.
Embodiment 2
Fig. 2 shows a kind of flow diagrams for water quality detection method that second embodiment of the invention provides.
The water quality detection method includes the following steps:
In step S210, the original image of the water sample to be detected before being located at white background is obtained.
Specifically, before pretreated water sample to be detected being placed in white background, imaging device acquires original image When, the original image comprising background and water sample to be detected, freedom degree of the further expansion user in acquisition original image can be acquired.
In step S220, the corresponding image of water sample solvent portions to be detected is extracted from original image as water to be detected The image of sample.
The original image is handled, the corresponding image of water sample solvent portions to be detected is extracted from original image and is made For the image of water sample to be detected.
Specifically, the original image is handled can include: the original image is filtered, noise is reduced, Reducing influences caused by catastrophe point, carries out image segmentation to filtered image and obtains the corresponding figure of water sample solvent portions to be detected Picture;Or image segmentation is carried out to original image and obtains the corresponding image of water sample solvent portions to be detected.
In step S230, it is equal to calculate all pixels point channel R in RGB color domain space in the image of water sample to be detected Value, the channel G mean value and channel B mean value, using the channel R mean value, the channel G mean value and channel B mean value as the sample RGB of the image Value.
Specifically, all pixels point can be calculated in the following way in the channel R mean value:
Wherein, XRFor all pixels point in RGB color domain space the channel R mean value, xiFor the channel R of ith pixel point Value, N are the number of all pixels point in the image of water sample to be detected.
The all pixels point can be calculated in the following way in the channel G mean value:
Wherein, YGFor all pixels point in RGB color domain space the channel G mean value, yjFor the channel G of j-th pixel Value, N are the number of all pixels point in the image of water sample to be detected.
The all pixels point can be calculated in the following way in channel B mean value:
Wherein, ZBFor all pixels point in RGB color domain space channel B mean value, zkFor the channel B of k-th pixel Value, N are the number of all pixels point in the image of water sample to be detected.
By reducing catastrophe point using the channel R mean value, the channel G mean value and channel B mean value as the sample rgb value of the image To the influence that rgb value generates, detection accuracy is improved.
In step S240, the standard of sample rgb value with the image of multiple standard water samples is calculated by presetting arithmetic operation RGB coordinate distance between rgb value.
Further, the default arithmetic operation are as follows:
K=(a-x)2+(b-y)2+(c-z)2
Or
Or K=| a-x |+| b-y |+| c-z |;
Wherein, K is RGB coordinate distance, and (x, y, z) is the standard RGB values, and (a, b, c) is the sample rgb value.
In step s 250, by the smallest standard water sample of RGB coordinate distance in multiple standard water samples with water sample to be detected Water quality parameter concentration of the water quality parameter concentration as water sample to be detected.
Identical as step S140, details are not described herein.
Embodiment 3
Fig. 3 shows a kind of flow diagram of water quality detection method of third embodiment of the invention offer.
The water quality detection method includes the following steps:
In step s310, the original image of the water sample to be detected before being located at white background is obtained.
Identical as step S210, details are not described herein.
In step s 320, the corresponding image of water sample solvent portions to be detected and background image are extracted from original image.
The original image is handled, extracted from original image the corresponding image of water sample solvent portions to be detected and Background image.
Specifically, the original image is handled can include: the original image is filtered, noise is reduced, Reducing influences caused by catastrophe point, carries out image segmentation to filtered image and obtains the water sample solution to be detected portion of identical size Divide corresponding image and background image;Or image segmentation is carried out to original image and obtains the water sample solution to be detected of identical size The corresponding image in part and background image.
Specifically, image can be split based on the rgb value of pixel, for example, in background area or water to be detected In the corresponding image of sample solvent portions (the corresponding image of the solvent portions to develop the color) region, all pixels point in image Rgb value is identical or the rgb value of every two neighbor pixel between difference it is smaller, can be divided according to the rgb value of pixel It cuts.
In step S330, calculate in background image in each pixel image corresponding with water sample solvent portions to be detected R channel difference values, G channel difference values and channel B difference between corresponding pixel points, and by the absolute value of R channel difference values, G channel difference The R value, G value and B value of the absolute value of value and the absolute value of channel B difference as the pixel.
Specifically, in order to eliminate influence of the background area to the rgb value of the corresponding image of water sample solvent portions to be detected, by It is identical in the picture size of background image image corresponding with water sample solvent portions to be detected, it can be by pixel each in background image The rgb value of point subtracts the rgb value of corresponding pixel points in the corresponding image of water sample solvent portions to be detected, obtains each pixel and exists R channel difference values, G channel difference values and channel B difference, the absolute value of R channel difference values, the absolute value of G channel difference values and channel B is poor R value, G value and B value of the absolute value of value as the pixel eliminate background to the water sample solvent portions pair to be detected of shooting with this The influence of the rgb value for the image answered, while the influence of environment light generation is reduced, the requirement to shooting ambient enviroment is lower.
Alternatively, also the rgb value of each pixel in the corresponding image of water sample solvent portions to be detected can be subtracted Background The rgb value of corresponding pixel points, obtains each pixel in R channel difference values, G channel difference values and channel B difference, by the channel R as in R value, G value and B value of the absolute value of the absolute value of difference, the absolute value of G channel difference values and channel B difference as the pixel.
For example, if the size of the background image and the corresponding image of water sample solvent portions to be detected is 6 × 6 (pixel), It is illustrated by taking wherein preceding 4 pixels as an example.If first pixel is Back1 (a1, b1, c1) in background image, second A pixel is Back2 (a2, b2, c2), and third pixel is Back3 (a3, b3, c3), and the 4th pixel is Back4 (a4,b4,c4).If point corresponding with first pixel in background image is in the corresponding image of water sample solvent portions to be detected Colour1 (d1, e1, f1), it is corresponding with second pixel point in background image in the corresponding image of water sample solvent portions to be detected Point be Colour2 (d2, e2, f2), in the corresponding image of water sample solvent portions to be detected with third pixel in background image The corresponding point of point is Colour3 (d3, e3, f3), with the in background image the 4th in the corresponding image of water sample solvent portions to be detected The corresponding point of a pixel is Colour4 (d4, e4, f4).
The channel R in background image in pixel image corresponding with water sample solvent portions to be detected between corresponding pixel points Difference, G channel difference values and channel B difference may be expressed as:
R value, G value and the B value of first pixel be Sub1 (| a1-d1 |, | b1-e1 |, | c1-f1 |), second pixel Point R value, G value and B value be Sub2 (| a2-d2 |, | b2-e2 |, | c2-f2 |), R value, G value and the B value of third pixel are Sub3 (| a3-d3 |, | b3-e3 |, | c3-f3 |), R value, G value and the B value of the 4th pixel be Sub4 (| a4-d4 |, | b4-e4 |,|c4-f4|).Avoid occurring the case where negative value in calculating difference by way of absolute value, and all pictures in background image It is suitable when doing subtraction in the rgb value of vegetarian refreshments and the corresponding image of water sample solvent portions to be detected between the rgb value of corresponding pixel points Sequence can intermodulation, avoid calculate mistake.
In step S340, the mean value of the mean value of R value of all pixels point, the mean value of G value and B value is calculated, and by R value Sample rgb value of the mean value of mean value, the mean value of G value and B value as the image.
Specifically, the R value mean value of all pixels point can be calculated by the following formula:
Wherein, AverRFor the R value mean value of all pixels point, | aε-dε| for the ε pixel in background image with it is to be detected Corresponding pixel points in the corresponding image of water sample solvent portions (in the case where summarizing identical sortord with background image, i.e. the ε picture Vegetarian refreshments) between R channel difference values absolute value, M is to own in background image or the corresponding image of water sample solvent portions to be detected The number of pixel.
The G value mean value of all pixels point can be calculated by the following formula:
Wherein, AverGFor the G value mean value of all pixels point, | bε-eε| for the ε pixel in background image with it is to be detected Corresponding pixel points in the corresponding image of water sample solvent portions (in the case where summarizing identical sortord with background image, i.e. the ε picture Vegetarian refreshments) between G channel difference values absolute value, M is to own in background image or the corresponding image of water sample solvent portions to be detected The number of pixel.
The B value mean value of all pixels point can be calculated by the following formula:
Wherein, AverBFor the B value mean value of all pixels point, | cε-fε| for the ε pixel in background image with it is to be detected Corresponding pixel points in the corresponding image of water sample solvent portions (in the case where summarizing identical sortord with background image, i.e. the ε picture Vegetarian refreshments) between channel B difference absolute value, M is to own in background image or the corresponding image of water sample solvent portions to be detected The number of pixel.
In step S350, the standard of sample rgb value with the image of multiple standard water samples is calculated by presetting arithmetic operation RGB coordinate distance between rgb value.
In step S360, by the smallest standard water sample of RGB coordinate distance in multiple standard water samples with water sample to be detected Water quality parameter concentration of the water quality parameter concentration as water sample to be detected.
Embodiment 4
Fig. 4 shows a kind of flow diagram of water quality detection method of fourth embodiment of the invention offer.
The water quality detection method includes the steps that as described below:
In step S410, the input operation for responding user obtains water quality parameter to be detected.
The water quality detection method can be applied to the detection of multiple-quality water parameter concentration.The inspection of each water quality parameter concentration It surveys identical with step described in above-described embodiment.When initially entering water quality detection, user can be direct by terminal It inputs the water quality parameter to be detected or user selects wherein in all detectable water quality parameter lists in terminal One water quality parameter to be detected.
In the step s 420, the image of the pretreated water sample to be detected of the water quality parameter is obtained.
In step S430, the sample rgb value of the image of water sample to be detected is extracted.
In step S440, the standard of sample rgb value with the image of multiple standard water samples is calculated by presetting arithmetic operation RGB coordinate distance between rgb value.
In step S450, all RGB coordinate distances of calculating are compared.
In step S460, by the smallest standard water sample of RGB coordinate distance in multiple standard water samples with water sample to be detected Water quality parameter concentration of the water quality parameter concentration as water sample to be detected.
In step S470, the water quality parameter concentration of water sample to be detected is subjected to visualization display so that user checks.
After the water quality parameter concentration for obtaining the water sample to be detected, it can also be shown by way of visualization display Show, so that user checks.
For example, water quality parameter concentration obtained, Huo Zhe can be directly displayed by the display unit in terminal While showing water quality parameter concentration obtained, the image of the water sample to be detected, the image of the water sample to be detected are also shown The smallest standard RGB values of RGB coordinate distance and the RGB between sample rgb value between corresponding sample rgb value and sample rgb value One or more of data such as the corresponding image of the smallest standard RGB values of coordinate distance.
In addition, can also be issued according to the water quality parameter concentration when showing the water quality parameter concentration of the water sample to be detected Corresponding result.It executes and is also stored in the terminal of the water quality detection method between the water quality parameter concentration and result Corresponding relationship.
Corresponding relationship between the water quality parameter concentration and result can be described by following table.
Water quality parameter concentration As a result Water quality parameter concentration As a result
P1~P2 Normally P5~P6 It severely exceeds
P3~P4 It is exceeded …… ……
For example, if corresponding result is normal when range of the water quality parameter concentration between P1~P2 of detection;If When range of the water quality parameter concentration of detection between P3~P4, corresponding result be it is exceeded, health may be jeopardized;If inspection When range of the water quality parameter concentration of survey between P5~P6, corresponding result is to severely exceed, and jeopardizes health, etc..
Embodiment 5
Fig. 5 shows a kind of structural schematic diagram of water quality detecting device provided in an embodiment of the present invention.Water quality detection dress It sets 500 and is applied to water quality detection method described in embodiment 1, any option in embodiment 1 is also applied for being suitable for this implementation Example, I will not elaborate.
The water quality detecting device 500 includes obtaining module 510, extraction module 520, computing module 530 and contrast module 540。
Module 510 is obtained, for obtaining the image of pretreated water sample to be detected.
Extraction module 520, the sample rgb value of the image for extracting the water sample to be detected.
Computing module 530, for calculating the image of the sample rgb value and multiple standard water samples by presetting arithmetic operation Standard RGB values between RGB coordinate distance.
Contrast module 540, for will in the multiple standard water sample it is minimum with the RGB coordinate distance of the water sample to be detected Standard water sample water quality parameter concentration of the water quality parameter concentration as the water sample to be detected.
The embodiment of the invention also provides a kind of terminal, which may include smart phone, plate Computer, PC etc..The terminal includes memory and processor, and memory can be used for storing computer program, place Device is managed by running the computer program, so that terminal be made to execute above-mentioned water quality detection method or the inspection of above-mentioned water quality Survey the function of the modules in device.
Memory may include storing program area and storage data area, wherein storing program area can storage program area, at least Application program needed for one function etc.;Storage data area, which can be stored, uses created data etc. according to terminal. In addition, memory may include high-speed random access memory, it can also include nonvolatile memory, for example, at least a magnetic Disk storage device, flush memory device or other volatile solid-state parts.
Further, the terminal is mobile terminal, so that user can be carried out whenever and wherever possible by mobile terminal The detection of water quality parameter concentration improves the convenience and comfort used, is not limited by distance, position.
The embodiment of the invention also provides a kind of computer storage mediums, for storing used in above-mentioned terminal The computer program.
So far, the present invention provides a kind of water quality detection method, device and terminals, in the dense of detection water quality parameter When spending, the solution image that can be will acquire is detected automatically by scheduled detection rule, is suitable for multiple-quality water parameter concentration Detection, detection accuracy is high, at low cost, convenient to use, requires ambient lighting relatively low.
In several embodiments provided herein, it should be understood that disclosed device and method can also pass through Other modes are realized.The apparatus embodiments described above are merely exemplary, for example, flow chart and structure in attached drawing Figure shows the system frame in the cards of the device of multiple embodiments according to the present invention, method and computer program product Structure, function and operation.In this regard, each box in flowchart or block diagram can represent a module, section or code A part, a part of the module, section or code includes one or more for implementing the specified logical function Executable instruction.It should also be noted that function marked in the box can also be to be different from the implementation as replacement The sequence marked in attached drawing occurs.For example, two continuous boxes can actually be basically executed in parallel, they are sometimes It can execute in the opposite order, this depends on the function involved.It is also noted that in structure chart and/or flow chart The combination of each box and the box in structure chart and/or flow chart, can function or movement as defined in executing it is dedicated Hardware based system realize, or can realize using a combination of dedicated hardware and computer instructions.
In addition, each functional module or unit in each embodiment of the present invention can integrate one independence of formation together Part, be also possible to modules individualism, an independent part can also be integrated to form with two or more modules.
It, can be with if the function is realized and when sold or used as an independent product in the form of software function module It is stored in a computer readable storage medium.Based on this understanding, technical solution of the present invention is substantially in other words The part of the part that contributes to existing technology or the technical solution can be embodied in the form of software products, the meter Calculation machine software product is stored in a storage medium, including some instructions are used so that a computer equipment (can be intelligence Can mobile phone, personal computer, server or network equipment etc.) execute each embodiment the method for the present invention whole or Part steps.And storage medium above-mentioned include: USB flash disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), Random access memory (RAM, Random Access Memory), magnetic or disk etc. be various to can store program code Medium.
The above description is merely a specific embodiment, but scope of protection of the present invention is not limited thereto, any Those familiar with the art in the technical scope disclosed by the present invention, can easily think of the change or the replacement, and should all contain Lid is within protection scope of the present invention.

Claims (10)

1. a kind of water quality detection method characterized by comprising
Obtain the image of pretreated water sample to be detected;
Extract the sample rgb value of the image of the water sample to be detected;
The RGB between standard RGB values by presetting the image that arithmetic operation calculates the sample rgb value and multiple standard water samples Coordinate distance;
By the water quality parameter in the multiple standard water sample with the smallest standard water sample of RGB coordinate distance of the water sample to be detected Water quality parameter concentration of the concentration as the water sample to be detected.
2. water quality detection method according to claim 1, which is characterized in that the default arithmetic operation are as follows:
K=(a-x)2+(b-y)2+(c-z)2
Or
Or K=| a-x |+| b-y |+| c-z |;
Wherein, K is RGB coordinate distance, and (x, y, z) is the standard RGB values, and (a, b, c) is the sample rgb value.
3. water quality detection method according to claim 1, which is characterized in that described " to obtain pretreated water to be detected The image of sample " includes:
Obtain the original image of the water sample to be detected before being located at white background;
Image of the corresponding image of water sample solvent portions to be detected as the water sample to be detected is extracted from the original image.
4. water quality detection method according to claim 3, which is characterized in that described " to extract the figure of the water sample to be detected The sample rgb value of picture " includes:
Calculate all pixels point channel R mean value, the channel G mean value and B in RGB color domain space in the image of the water sample to be detected Channel mean value, and using the channel R mean value, the channel G mean value and channel B mean value as the sample rgb value of the image.
5. water quality detection method according to claim 1, which is characterized in that described " to obtain pretreated water to be detected The image of sample " includes:
Obtain the original image of the water sample to be detected before being located at white background;
The corresponding image of water sample solvent portions to be detected and background image are extracted from the original image.
6. water quality detection method according to claim 5, which is characterized in that described " to extract the figure of the water sample to be detected The sample rgb value of picture " includes:
Calculate in the background image respective pixel in each pixel image corresponding with the water sample solvent portions to be detected R channel difference values, G channel difference values and channel B difference between point, and by the absolute values of the R channel difference values, G channel difference values The R value, G value and B value of absolute value and the absolute value of channel B difference as the pixel;
Calculate the mean value of the mean value of R value of all pixels point, the mean value of G value and B value, and by the mean value of the R value, G value it is equal Sample rgb value of the mean value of value and B value as the image.
7. a kind of water quality detecting device characterized by comprising
Module is obtained, for obtaining the image of pretreated water sample to be detected;
Extraction module, the sample rgb value of the image for extracting the water sample to be detected;
Computing module, the standard for calculating the image of the sample rgb value and multiple standard water samples by presetting arithmetic operation RGB coordinate distance between rgb value;
Contrast module, for by the smallest standard of RGB coordinate distance in the multiple standard water sample with the water sample to be detected Water quality parameter concentration of the water quality parameter concentration of water sample as the water sample to be detected.
8. a kind of terminal, which is characterized in that the terminal includes memory and processor, the memory For storing computer program, the processor runs the computer program so that the terminal perform claim requires 1 to 6 described in any item water quality detection methods.
9. terminal according to claim 8, which is characterized in that the terminal is mobile terminal.
10. a kind of computer storage medium, which is characterized in that the computer storage medium stores according to any one of claims 8 The computer program used in terminal.
CN201811291182.7A 2018-10-31 2018-10-31 Water quality detection method, device and terminal Pending CN109377490A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201811291182.7A CN109377490A (en) 2018-10-31 2018-10-31 Water quality detection method, device and terminal

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201811291182.7A CN109377490A (en) 2018-10-31 2018-10-31 Water quality detection method, device and terminal

Publications (1)

Publication Number Publication Date
CN109377490A true CN109377490A (en) 2019-02-22

Family

ID=65397202

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201811291182.7A Pending CN109377490A (en) 2018-10-31 2018-10-31 Water quality detection method, device and terminal

Country Status (1)

Country Link
CN (1) CN109377490A (en)

Cited By (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110197480A (en) * 2019-05-29 2019-09-03 江汉大学 Detection method, device and the readable storage medium storing program for executing of Cr VI
CN110222698A (en) * 2019-05-24 2019-09-10 深圳市前海微升科学股份有限公司 A kind of method and system carrying out water analysis based on color information processing
CN110627182A (en) * 2019-09-24 2019-12-31 康玄谷(北京)国际生物科技有限公司 Method and device for obtaining mineral water
WO2021057230A1 (en) * 2019-09-26 2021-04-01 五邑大学 Color identification-based water quality detection method, apparatus and device, and storage medium
CN113820305A (en) * 2021-09-30 2021-12-21 盈奇科技(深圳)有限公司 Total phosphorus detection equipment and method
WO2022052032A1 (en) * 2020-09-11 2022-03-17 京东方科技集团股份有限公司 Image segmentation method and device, and three-dimensional reconstruction method and device for image
CN114965456A (en) * 2022-05-30 2022-08-30 泉州市水务水质检测有限公司 Water quality detection method
CN115753691A (en) * 2022-08-23 2023-03-07 合肥工业大学 Water quality parameter detection method based on RGB reconstruction hyperspectrum
CN115931838A (en) * 2022-11-04 2023-04-07 湖北大场科技有限公司 Water quality detection method, controller and equipment suitable for test paper method

Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101915739A (en) * 2010-06-30 2010-12-15 李华 Multi-dimensional chromatograph vector sorting method in water quality detection based on machine vision
CN104101569A (en) * 2013-04-12 2014-10-15 樊棠怀 Water environment monitoring system
CN106257269A (en) * 2016-02-26 2016-12-28 深圳华盛昌机械实业有限公司 A kind of liquid detecting method and device
CN106323968A (en) * 2016-11-23 2017-01-11 厦门大学 Data acquisition device and data sampling method for detecting water quality quickly
CN106404682A (en) * 2016-12-01 2017-02-15 北京林业大学 Soil color recognition method
CN107144531A (en) * 2017-04-19 2017-09-08 黄建国 A kind of content of material detection method, system and device analyzed based on color data
CN108051434A (en) * 2017-12-13 2018-05-18 深圳市在田翊方科技有限公司 A kind of prepare liquid concentration quantitative detection method based on color identification

Patent Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101915739A (en) * 2010-06-30 2010-12-15 李华 Multi-dimensional chromatograph vector sorting method in water quality detection based on machine vision
CN104101569A (en) * 2013-04-12 2014-10-15 樊棠怀 Water environment monitoring system
CN106257269A (en) * 2016-02-26 2016-12-28 深圳华盛昌机械实业有限公司 A kind of liquid detecting method and device
CN106323968A (en) * 2016-11-23 2017-01-11 厦门大学 Data acquisition device and data sampling method for detecting water quality quickly
CN106404682A (en) * 2016-12-01 2017-02-15 北京林业大学 Soil color recognition method
CN107144531A (en) * 2017-04-19 2017-09-08 黄建国 A kind of content of material detection method, system and device analyzed based on color data
CN108051434A (en) * 2017-12-13 2018-05-18 深圳市在田翊方科技有限公司 A kind of prepare liquid concentration quantitative detection method based on color identification

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
曹生现 等: "基于图像处理的水质中氨氮含量的检测研究", 《化工自动化及仪表》 *
朱志宇: "《流形粒子滤波算法及其在视频目标跟踪中的应用》", 31 January 2015 *

Cited By (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110222698A (en) * 2019-05-24 2019-09-10 深圳市前海微升科学股份有限公司 A kind of method and system carrying out water analysis based on color information processing
CN110197480A (en) * 2019-05-29 2019-09-03 江汉大学 Detection method, device and the readable storage medium storing program for executing of Cr VI
CN110627182A (en) * 2019-09-24 2019-12-31 康玄谷(北京)国际生物科技有限公司 Method and device for obtaining mineral water
WO2021057230A1 (en) * 2019-09-26 2021-04-01 五邑大学 Color identification-based water quality detection method, apparatus and device, and storage medium
WO2022052032A1 (en) * 2020-09-11 2022-03-17 京东方科技集团股份有限公司 Image segmentation method and device, and three-dimensional reconstruction method and device for image
CN113820305A (en) * 2021-09-30 2021-12-21 盈奇科技(深圳)有限公司 Total phosphorus detection equipment and method
CN114965456A (en) * 2022-05-30 2022-08-30 泉州市水务水质检测有限公司 Water quality detection method
CN115753691A (en) * 2022-08-23 2023-03-07 合肥工业大学 Water quality parameter detection method based on RGB reconstruction hyperspectrum
CN115931838A (en) * 2022-11-04 2023-04-07 湖北大场科技有限公司 Water quality detection method, controller and equipment suitable for test paper method

Similar Documents

Publication Publication Date Title
CN109377490A (en) Water quality detection method, device and terminal
Varshney Improved NDBI differencing algorithm for built-up regions change detection from remote-sensing data: an automated approach
Ma et al. Shadow detection of moving objects based on multisource information in internet of things
Luzón-González et al. Recovering of weather degraded images based on RGB response ratio constancy
EP3772722B1 (en) X-ray image processing system and method, and program therefor
CN112348126B (en) Method and device for identifying target object in printed article
CN116883336A (en) Image processing method, device, computer equipment and medium
CN110533660B (en) Method for detecting silk-screen defect of electronic product shell
CN102565044A (en) Method for detecting pesticide residue by adopting rapid-determination card on basis of image processing
CN111614959A (en) Video coding method and device and electronic equipment
CN116580026B (en) Automatic optical detection method, equipment and storage medium for appearance defects of precision parts
CN114359685A (en) Training method, device and equipment for logistics piece recognition model
CN117455887A (en) PCB incoming material detection method, device, equipment and medium based on machine vision
CN116402781A (en) Defect detection method, device, computer equipment and medium
CN115294035A (en) Bright point positioning method, bright point positioning device, electronic equipment and storage medium
CN108282643B (en) Image processing method, image processing device and electronic equipment
CN108447107B (en) Method and apparatus for generating video
CN105893520A (en) Estimation method for urban road areas
CN111833325A (en) Colloidal gold reagent strip detection method and system based on deep learning
CN117456473B (en) Vehicle assembly detection method, device, equipment and storage medium
CN112179623B (en) Method, apparatus, system, device and medium for measuring camouflage contrast of coating
CN114140391B (en) Method for realizing rapid detection of on-board display screen module based on machine vision
CN116385336B (en) Deep learning-based weld joint detection method, system, device and storage medium
CN114266749B (en) TridentNet-based image processing method
Silva Digital image colorimetry for determination of sulfonamides in water

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
RJ01 Rejection of invention patent application after publication
RJ01 Rejection of invention patent application after publication

Application publication date: 20190222