Determination of Ozone or Hypochlorite in Waters Based on Digital Images Analysis Using Same Reagent

Ozone and hypochlorite are used for the disinfection of water and is essential to monitor these. In this paper, methods based on digital images were developed to determine these analytes in waters using the malachite green dye. The oxidation of the reagent with ozone was very fast and with hypochlorite occurred in 10 min in pseudo-first-order kinetics. New software called ICCA was developed for the capture and processing of red, green and blue (RGB) data, which is planned for digital image analysis. In addition, the recently proposed parameters analytical resolution and N9 were used to define some study conditions. An evaluation of different response functions and white correction of the webcam were done, having thrown some light on the subject to this theme. Their optimization showed a linear range from 0.6 mg L to 5.0/6.0 mg L (O3/Cl, respectively). The figures of merit were similar for both. The methods were validated and the recoveries achieved were between 85.0 and 96.0% (ozone) and 101.0 and 119.0% (hypochlorite).


Introduction
Chlorination is the main process for the disinfection of drinking water and water for use in the food industry in Brazil. 1 Hypochlorous acid can be used for disinfection (destruction of pathogenic microorganisms), oxidation (alteration of water characteristics due to the oxidation of the compounds present), or these two actions at the same time. 2 For historical reasons, the Bronsted acid-base system of hypochlorous acid is called "chlorine", even when its source in solution is not chlorine gas. Therefore, the formation of this system in solution is called "chlorination" (equation 1). pK a = 7.53 (25 °C) (1) In this way, the equilibrium concentration of hypochlorous acid is a function of pH and temperature. 2 Hypochlorous acid is the main oxidizing agent in the Bronsted acid-base system and also the main disinfecting agent. 3 The disinfectant action is explained by the pH-partition theory, in which the hypochlorous acid crosses the cell wall, due to being neutral, by a partition process and causes the oxidation of various chemical species within the bacteria. 4 Therefore, with an increase in pH, there is a decrease in the reactivity of hypochlorous acid, and with an increase in temperature, the reaction speed increases. 2 Several products are used for the production of hypochlorous acid in an aqueous solution, mainly chlorine gas (Cl 2 ), and sodium hypochlorite (in alkaline solution). 2 Chlorine gas produces hypochlorous acid quickly by disproportionation in water (equation 2). logK = -3.3 ( 2 ) Also for historical reasons, as the interference of chloramines in the methods to determine "chlorine" was being understood, the hypochlorous system (hypochlorous acid and hypochlorite) was called "free residual chlorine", whereas, chloramines (NH 2 Cl, NHCl 2 , and NCl 3 ), were called "combined residual chlorine". The sum of these contents is called "total residual chlorine". Chloramines are formed slowly by the action of "chlorine" on ammonia and its kinetic also depends on the pH. The chloramines are oxidated by an excess of hypochlorous acid (the minimum concentration for this is called breakpoint). 2 However, some carcinogenic sub-products can be generated in the chlorination method, such as trihalomethanes and other organochloride substances. In addition, due to the increasingly restrictive parameters for the emission of effluents and the increased need for water reuse, other alternatives for disinfection have been evaluated. 5 By the way, the use of other disinfectants has been raised nowadays and the ozonation is again a promising alternative for disinfection. The ozone allows more efficient sterilization, and its natural and fast degradation produces only oxygen gas. 6 In aqueous solutions, ozone can react with organic compounds by direct or indirect reactions, in which these two mechanisms of action compete for the compound to be oxidized. In an acidic medium (pH < 4) the direct reaction mechanism, which involves molecular ozone, predominates. At higher pH values (above 10), the indirect reaction mechanism predominates, as there is an increase in the formation of hydroxyl radicals (OH•) formed by the decomposition of ozone. For pH around 7, both mechanisms can occur. 7,8 Paradoxically, the inconvenience of the use of ozone is its chemical instability. The half-life of ozone is much less than the residence time of water in pipes. It is important to keep a safe concentration of disinfectant (residual concentration) in the drinking water to avoid contamination after treatment and before consumption. Thus, the use of a residual concentration of chlorine (it means, hypochlorite system) is still needed in some situations. 9 Therefore, it is necessary to monitor the concentration of ozone and residual chlorine in the water. Some methods are used to monitor ozone, as the spectrophotometric method of indigo 10 and for residual chlorine, as the spectrophotometric method with DPD (N,N-diethyl-p-phenylenediamine) 10 and ortho-tolidine, in which the latter is not recommended by standard methods 11 due to its carcinogenic potential. Besides, the DPD reagent is unstable in presence of oxygen gas and it is usually used in solid form instead of in solution. Allergic reactions are not uncommon with this reagent. 12 Recently, the method based on digital images has been used for qualitative and quantitative analysis, which has been used as a simple alternative to desktop spectrophotometers or light emitting diode (LED) photometers. In this method, any equipment that detects color intensity variation (webcam, digital camera, cell phone camera, scanner, among others) allows the analysis to be carried out. [13][14][15] In these cases, the digital images obtained are analyzed using software and nowadays the resolution is limited to 8-bit string. These devices capture the maximum light intensity and convert it in an electrical signal, where it is divided into 256 levels.
It is important to distinguish the number of units of a detector (associated to pixel) in the detector matrix in a device and the resolution of each unit. 16 So, the use of a device of 2 MP; 5 MP, or higher do not influence the resolution of the detector unit.
In methods based on digital images, analytical responses are acquired from the intensity of colored filters in a region of the image, using software to collect this information. The processing of these analytical responses is based on color models, which explain the properties or behavior of colors, describing their different characteristics and their perception by humans. [17][18][19][20] As an example of these models, there is RGB (red, green and blue).
The RGB color model is a cartesian system with three dimensions. Each axis of each dimension corresponds to one of the three primary colors (red, green and blue), assuming integer values ranging from zero (0, black) to 255, which is the maximum intensity (white). The intermediate values correspond to the various shades of each color. 21 To obtain the black, all values would be 0 (0 for red, 0 for blue and 0 for green). For white, all values should be 255. For the gray scale, the value of 128 should be set for all colors.
Image capture devices bear similarities to spectrophotometers in terms of the functions of their main parts, such as the wavelength selector and detector. However, there are differences in details. In image capture devices, the principle of light scattering or light reflection is used, and not transmittance or absorbance. There is the use of a monochromatic radiation source. In spectrophotometers, the configuration of single or multiple beam is used, in which there are several optical parts as a mirror, dispersive system for selecting the wavelength.
As the main objective of an image capture device aims to build an image with the best definition, therefore the interest is to use the largest number of detectors, so that each detector represents a point in the image. 22 Although an image capture device may have a few million detectors (called a pixel, that is, each point of the image built into the device with very small size), which makes up a sensor, each device behaves like a spectrophotometer detector. The ability to represent an image accurately is called the image resolution and it increases with the density of pixels in the image, expressed in dpi (dots per inch). 16 But each detector still has 8-bits digital resolution.
It is very important to observe the filters used to have large bandwidth. The digital image device is, therefore, similar to the old optical filter photometer and they are adequate to use with color species with a large band of absorption to avoid the loss in linearity. 23 An advantage of this method is the low cost (it is possible to buy a webcam for US$ 8.00) and portability since spectrophotometric systems with small sizes are more expensive. As an example, a small and low-cost detector was developed from the modification of a webcam camera with a simple lab-on-chip reactor. It was used for the continuous monitoring of an acid-base reaction with a phenolphthalein indicator, and the fading of the pink color was recorded as the change in the colors red, green and blue (RGB). This change is associated with acid concentration. 24 Another work 25 described the development of a simple and portable method, using pre-concentration on an adsorbent surface and digital image analysis, for the determination of malachite green and leucomalachite green in natural waters. In this, the ImageJ software was used to analyze the digital images captured by a cell phone camera. 25 Several other applications have been shown to determine methanol in alcoholic beverages, 26 measurement of NO 2 levels in ambient air, 27

among others.
There is a lot of software for analyzing digital images on the market and many of them are commercial and expensive, such as Adobe Photoshop, 28 and other free software such as Image J. 29 These software can be used for image processing, however, they are developed for another purpose and it is not easy access to the pure RGB data on a spatial defined local. 30 There are also free software available such as Photometrix PRO, 31 ChemoStat, 32 GNU Octave 33 among others. However, for this work a new software was developed.
In this paper, methods based on digital image analysis were developed to determine isolated ozone or hypochlorite in waters using the same reagent and kinetically distinct behavior. For this, a new software called ICCA was developed to collect pure RGB information, which is intended exclusively for use in the development of analytical methods based on digital image analysis. The characteristics of a dark chamber in a less controlled environment were also studied, using webcams with and without white correction, in which these characteristics were not previously studied.

Solutions and reagents
All solutions were prepared with water type 1 (Milli-Q ® Reference A+). All chemicals and solvents were used without further purification unless otherwise stated. All reagents were obtained by Sigma-Aldrich (São Paulo, Brazil).
The solutions were prepared according to Standard Methods for the Examination of Water and Wastewater: 10  The buffer solutions, phosphate (pH 3.0; 6.0; 7.5), acetate (pH 4.5) and borate (pH 9.0) were prepared from NaH 2 PO 4 .H 2 O 99%, CH 3 COONa.3H 2 O 99% and H 3 BO 3 99.5%, respectively. The pH of solutions was adjusted with hydrochloric acid or sodium hydroxide using a pHmeter pH 21 (HANNA, Barueri, Brazil) before the volume was completed.

Instruments
The absorbance measurements for obtaining the analytical curves for the tested reagents (DPD, indigo trisulfonate, and malachite green) were obtained using a spectrophotometer USB2000 + (Ocean Optics, São Paulo, Brazil), which is also used to obtain the spectrum of the malachite green in the wavelength range between 380 and 780 nm and a quartz cuvette with a path length of 10 mm.
A "homemade" chamber was built to obtain the digital images from a black plastic box (Patola, PB 25) with dimensions: 11 cm × 7.5 cm × 3.5 cm (length × depth × height) as shown in Figure 1. The observation hole for the webcam was kept at the center of the opposite wall to the light capture aperture. It was cover with a light scatter (A) made with pages of sulfite paper. Holes (C) in the superior part of the chamber were made to place two cuvettes (B, B') with a path length of 10 mm. Internally, a guide made on cardboard was placed to guarantee the fixed position of the cuvettes.
For the study of the influence of the light on digital images, another bigger dark chamber was made with cardboard with dimensions 32 cm × 28 cm × 27 cm (length × depth × height). Inside this dark chamber, the "homemade" chamber was placed, and in front of the light scatter, a radiation source with a white LED (Light fixture DP LED light, DP6001, 1.8 W, China) evenly separated in an area of 20 cm × 10 cm.

General procedures
The procedures for quantification of ozone and hypochlorite were adapted from standard methods 10 and briefly described in the Supplementary Information (SI) section.

Study for the selection of the reagents to be used in the developed methods
This study was carried out using the spectrophotometer.
Analytical curves for the method with DPD, indigotrisulfonate, and malachite green For the method with DPD, the analytical curve for the hypochlorite was obtained from six standard solutions with concentrations between 0.5 and 5.0 mg Cl L -1 , according to the Standard Methods for the Examination of Water and Wastewater. 10 The analytical curve for the ozone was made in a similar way to the hypochlorite one. The standards (0.5 to 4.0 mg O 3 L -1 ) were obtained by diluting the aqueous solution of ozone in the concentration of approximately 6.0 mg O 3 L -1 .
For the method with indigotrisulfonate, the analytical curve for ozone was obtained from the same standard solutions described in the DPD method, according to the Standard Methods for the Examination of Water and Wastewater. 10 A similar procedure was used for the curve of hypochlorite. Although, standard solutions with concentrations ranging from 10.0 to 150.0 mg Cl L -1 were used.
The method used for the malachite green was adapted from the indigotrisulfonate method. 10  To evaluate the behavior of the malachite green in the presence of ozone or hypochlorite, studies with an experimental design based on the Doehlert matrix were performed, for two variables, which were the pH and the concentration of the malachite green (SI section, Table S1).
To perform the studies, 5.0 mL of the buffer solution was added into beakers, for the adjustment of pH, 10.0 mL of the malachite green solution, and 5.0 mL of ozone or hypochlorite sample. The evaluation of the behavior of the malachite green was made through spectrometer readings in the visible region, during intervals between 0 to 30 min, being obtained every 15 s.

Analysis method by digital images with malachite green
For the analysis, two types of webcams were tested. One with white correction (Hardiline, China) and the other without that type of correction (Infokit, Brazil). Also, cuvette made with two different materials (acrylic and glass) were tested, as well as the different distances between the source of the radiation and the light scatter (10 to 40 cm).
The images were collected using software that was developed for this work, called ICCA. The ICCA software was developed for the acquisition and treatment of RGB data. ICCA was developed using the Open source Processing 34 programming language version 1.5.1. Although the processing compiler itself is multi platform, it was chosen to run it on Ubuntu Linux version 16.04 LTS due to its high compatibility with numerous imaging devices (webcams), all presented via a common interface called UVC (USB Video Class) 35 making it significantly simple to test different cameras without the need of installing device drivers of dealing with different communication methods. In this way, the ICCA software was developed to collect and process only pure RGB information, which is intended for use in analytical methods based on digital image analysis.
The block diagram of a typical experiment using ICCA is presented in the Figure S1 (SI section). The software's main loop algorithm is represented on flowchart on the Figure S2 (SI section). It encompasses the steps of initializing the imaging device, previewing the image and capture the RGB values for each defined region of interest (ROI).
The collected images of the webcam were transmitted to the software and displayed in the main window (SI section, Figure S3). It was possible to select four regions of the image to obtain the average RGB values in each region (A, B, C and D). The dimensions of the region and its position in the image could be adjusted through the settings. The average value of each region was displayed in small graphs in real-time and the acquisition could be made in pre-defined intervals or manually, and saved in ASCII type files (text format, a column of data separated with a comma). The data were imported directly to the software data treatment, such as Microsoft Excel or OriginLab. 36

Reagents selection
From the analytical curves for each of the reagents (DPD, indigotrisulfonate, and malachite green), using a spectrophotometer, the one that was selected and would be used for the determination of ozone and hypochlorite in waters by methods based on digital images was malachite green. The other two reagents were discarded because a reagent that had a similar analytical response for the two analytes of interest was needed, aiming to develop a method for determining ozone and hypochlorite simultaneously in waters in the future.
The Figure S4 (SI section) shows the analytical curves of the spectrophotometric method with malachite green for hypochlorite ( Figure S4a) and ozone ( Figure S4b) (linear and quadratic models) and their respective graph of residues for these models.
The two models obtained for the analytical curves for hypochlorite and ozone explained sufficiently well the experimental data, which can be confirmed by the graph of residues of Figures S4a and S4b (SI section), respectively. In this way, Occam's parsimony principle was considered, which states that, for two empirical models that equally explain well a set of data, the simpler model is the most adequate. Therefore, the use of the linear model was opted for hypochlorite in the entire studied range and for ozone in the range between 0.5 and 2.5 mg O 3 L -1 . In Table S2 (SI section) the summary of results of analytical curves is shown.
The oxidation of the malachite green can be explained by equation 3. (3) The consumption of hypochlorite and ozone is expressed by the equations 4 and 5. (4) While the oxidation of malachite green should be associated to opening of aromatic rings, once, there is a total omission of bands in the visible range of the spectrum.
The analytical sensitivity (S) can be associated with the molar absorptivity of the malachite green reagent (ε) by equation 6, which also considers the stoichiometric ratio (r) between the reagent and the analyte (in this case, unit), by the efficiency of this reaction (f ef ) and by the dilutions made described by a dilution factor (f dil ).
Thereby, considering that the dilution factors from both methods and the stoichiometry from the analytes with the reagents are the same, the reason between the sensitivity of both methods is a measure of the relative efficiency of the oxidation of the malachite green for both. It is observed that the ozone was around 33% more efficient than the hypochlorite. That difference can be associated with the different species formed in the oxidation of the malachite green by the two oxidizers and their equilibrium conditions.

Kinetic study of the malachite green
The kinetic study was made with the help of experimental planning based on the Doehlert matrix for two variables, pH and the analytical concentration of the malachite green (SI section, Table S1).
In all experimental conditions, we verified that the ozone reacted completely discoloring the malachite green in a few seconds, differently from the hypochlorite, which took approximately 10 min to completely react with the malachite green. Thereby, the kinetic study was accomplished only for the hypochlorite.
In Figure S5 (SI section), an example of the observed behavior was presented, considering the experimental condition with the malachite green solution 7.5 µmol L -1 in the presence of hypochlorite 2.0 mg Cl L -1 (56.0 µmol L -1 ) and pH 7.5. The kinetic adjustment of the pseudo-first-order (equation 7), was appropriated to explain the behavior of the system. The graph of residues is presented as an insert of Figure S5 (SI section).
where Â is the estimated absorbance, A eq was the estimated absorbance of the malachite green at the end of the reaction (in equilibrium state), while A o was the estimated absorbance of the malachite green at the time 0 and k, the reaction constant observed in the first order. All the kinetic studies from this planning were able to be analyzed by the kinetic model of the pseudo-firstorder. The selection of terms procedure was used to select the significant terms from the model, discarding the other ones, as it was proposed by Andrade et al. 37 The spreadsheet DOE-Doehlert2 was used to make all the treatment of the matrix. 38 Only the quadratic and linear terms of the pH and the quadratic term of malachite green concentration (equation 8) significantly influenced the rate of the reaction for the different concentrations. k = apH 2 + bpH + cMG 2 + d (8) The letters a, b and c were the coefficients obtained through the models of regression, and pH and MG refer to the pH and the concentration of malachite green (MG), respectively. The d term is associated with average k. The identification of a single model for all the experimental conditions was very interesting from the theoretical point of view. An exponential decrease in the coefficients can be observed for the concentrations of hypochlorite ( Figure S6, SI section).
For the determination of the more adequate condition for the reaction between the ozone or hypochlorite with the malachite green, the parameters of every analytical curve obtained in the experimental conditions were analyzed (Table 1). For the ozone, was verified that the linear model presented a better fit and for the hypochlorite, the quadratic model presented a better fit.
The higher the slope of the curve, the higher the analytical sensitivity for the linear model, therefore, the better condition for the reaction. Hence, it was verified that the assay 2 exhibited a higher slope and a good fit for the ozone and it was selected as the best condition. It means the pH was 4.5 and the malachite green concentration was 22.5 mmol L -1 , according to Table S1 (SI section).
For the hypochlorite, a high slope and better fit of analytical curves to experimental data were observed for assay 4. In this case, the standard deviation of residues was also considered, since for this assay it was much smaller than the others. The better conditions for hypochlorite determination were pH 6.0 and concentration of malachite green equal to 15.0 mmol L -1 , according to Table S1 (SI section). The time of 10 min was chosen to guarantee a total reaction. In this way, the precision was kept, and the influence of the analyst is lesser.
In case of interest of determination of both analytes in the same sample, the validation should be done using, for example, the assay 4, with good comprise between slopes, model fit (low estimative of standard deviation of residues (s res )) for both analytes.

Analysis method by digital images with the malachite green
The analytical signal provided by the digital image was the light intensity of each filter (RGB). With the chamber used, it was possible to obtain 4 types of signals: sample cuvette (A), blank cuvette (D), light without passing through the cuvettes (light scatter-B), and the region without incidence of light (C), according to what was shown in Figure S3 (SI section).
Considering these analytical signals, the response functions used for data analysis were obtained, which will be presented below.

Influence of the RGB filter
Due to the higher overlap of the absorption band of the malachite green with the red filter, it is expected a higher sensitivity about that filter. The observed sensitivity for blue and green filters is associated with a second band near 800 nm ( Figure S7, SI section).
An example of that behavior is presented in Figure 2, where analytical curves of the malachite green obtained by the digital images of the three filters were presented for the analytical response absorbance. Therefore, the red filter was used later.

Influence of treatment in the analytical signal
For the use of the digital image as an analytical response, were proposed different response functions for the signal obtained by the webcam, presented in Table S3 (SI section). They were obtained from different hypotheses about the signal given by the webcam, that is, whether it is a linear function of the luminous power, or from the transmittance or the absorbance.
The constructed chamber allowed the measure of different parameters, exhibited in the insert of Figure 3b. The intensity of the signal due to the diffuse light (Bo), after going through the cuvette containing the blank solution (B), the cuvette containing the sample (S), and a region with the absence of light (K). On the scale of colors, the region Bo would have a 255-bit value (maximum value), while the region K, minimum value, equal to 0 bit, totalizing the resolution of 8 bits. The intensity of the signal Bo was not used in the calculation due to being contained in the intensity of the B signal, but allowed to evaluate the behavior of the blank solution.
Since there are different response functions, the usual parameters of evaluation of analytical curves (sensitivity and residues values) are related to response functions and so, it was not possible to compare the parameters of the curve obtained with itself.
The analytical resolution parameter (Ar) (equation 9) has been used. This parameter means the smallest difference of the analyte concentration that can be observed with the analytical curve. The smaller the analytical resolution, the better quality of the method. 39 (9) where s res is the low estimative of standard deviation of residues and S analytical sensitivity.
The values of N9, a "number of nines", meaning the number of nines of R 2 coefficient (equation 10). 36 It is shown that all curves have R 2 higher than 0.9 and these high values allowed us to understand why several other papers use different types of functions with relative success, in other words, any functions presented provide adequate analytical curves.
The Figure 3 presented the analytical resolutions (Ar) for the different response functions, using webcams with or without white correction and the values of N9.
It was observed that, for a constant illumination condition, the analytical resolution was greatly influenced by the type of webcam (with or without white correction). For the webcam with the white correction, all the responses obtained provided good analytical resolutions (ranging from 0.1 and 0.3 μmol L -1 ) when compared to webcams without white correction. The absorbance function (A), was the one that presented the worst analytical resolution, being the highest one in comparison with the other functions for the same type of webcam.
The white correction is an automatic adjustment made by the webcam that corrects the incidence of non-standard radiation, correcting the differences that can occur in distinctive selected areas for analysis by the ICCA software.

Influence of the type of the cuvette material
The influence of the type of material of the cuvette was evaluated on the repeatability of the blank solution, obtaining the difference of intensity of the blank solution (I B ) about the intensity of the light scatter (I D ).
The glass cuvette presented, as expected, a dispersion of data (amplitude equal to 5 bit, in a total scale of 255 bit) smaller than the acrylic cuvette (amplitude equal to 8 bit) as shown in Table S4 (SI section). The distribution profile did not allow us to state what was observed as a normal distribution. Therefore, the statistical parameters (average, standard deviation, etc.) and their interference tests should be used with caution. The use of acrylic cuvette is more interesting in portable applications.
There was an expectation that the glass cuvette would behave better than the acrylic cuvette, due to the better surface of the first cuvette. However, the main objective of this study was to verify the possibility of using an acrylic cuvette.

Influence of the type of webcam and cuvette
To evaluate the behavior of the digital images system, analytical curves in the RGB filters for the malachite green were acquired in the concentration range of 7.5 to 22.5 μmol L -1 with different distances of the source, using a webcam with and without the white correction and the glass and acrylic cuvettes.
The behavior of both cuvettes (glass and acrylic) was similar for the webcam with white correction and the one without this white correction. So, it was decided to use the glass cuvette.
With the increasing distance of the radiation source, there was a reduction in the intensity of light. The white correction of the webcam tried to fix the decrease of the intensity of light from the source in every filter (white color, in RGB, is expressed by 255, 255, 255) and all pixels.
A response function was proposed based on this kind of behavior (equation 11).
log(∆I) = log(I B -I) (11) where I B is the intensity obtained in the cuvette with the blank solution (water type 1) and I is the intensity obtained in the cuvette with the sample. The ICCA software permits the identification of these areas previously and reading of RGB data. The intern algorithm white correction in the webcam should be influenced by the relation between the 'free area' and the area of blank solution or of the colorful solution. The hypothesis that a large free area should be maintained was used in the construction of the chamber ( Figure S8, SI section).
The slope of the analytical curve using a webcam with white correction was independent of the intensity of source light in a large range. Once the intensity of source light decreases with the square of the distance, a decrease at least nine times in intensity (10 cm up to 30 cm, Figure S8a, SI section) not affects the slope, thus, it was decided to use the distance of 20 cm of free area. But this result is related to the ratio between free area and colored area. For other designs of the chamber, the influence could be different. However, the slope of the analytical curve was influenced by the intensity of source light. This behavior is not clear once the reference values were used to compensate for the change in intensity of source light.
This characteristic of the dark chamber used has not been studied before, but it demonstrated to be very important mainly in a less controlled environment, for example, if a device using natural light as a source of light.

Validation of the analytical methods
Analysis methods by digital images for the quantification of ozone or hypochlorite in waters with malachite green.
For ozone, the determination coefficient (R 2 ) was 0.9940 and for hypochlorite was 0.9938, which were above the minimum value considered by the Instituto Nacional de Metrologia, Qualidade e Tecnologia (INMETRO) for the certification of methods, that is, equal to 0.99, 40 while the standard deviation of the residues, equal to 0.0056 and 0.0152, respectively. Thus, the analytical resolution of the method for hypochlorite was 0.135 mg Cl L -1 and for ozone was 0.103 mg O 3 L -1 . The graphs of residues are represented as an insert in Figure 4, where it was verified the model fitted well for the experimental data.  (14) where S is the analytical sensitivity (slope of the linear model).
The Interfering study A concurrent study of Fe 3+ , Cu 2+ , CO 3 2-, Mn 2+ , and Clwas fulfilled to evaluate if they could cause any interference in the methods, that were evaluated through the t-Student test, with 95% of certainty, which verifies the existence of any significant difference between the blank solution measure and the solution containing the concurrent. In the absence of ozone and hypochlorite, not a single ion caused any interference.
However, it was verified the interference of Fe 3+ and Cu 2+ in the presence of ozone and hypochlorite. The use of an EDTA 0.002 mol L -1 solution eliminated the problem due to the complexation of metals. In this case, the interference was also considered verifying the existence of a significative difference between the measure of the blank solution, and the solution containing the interferent, through a t-Student test, with 95% certainty.
The accuracy of the method was verified with an addition and recovery test. 40, 42 Additions of known volumes of aqueous ozone solution (from 2.5 to 15.0 mL) and hypochlorite stock solution (from 7.0 to 70.0 μL) were performed on samples of tap water (treated in conventional water treatment station) so that the concentration of ozone added was between 0.5 and 4.0 mg O 3 L -1 and hypochlorite was between 0.5 and 4.0 mg Cl L -1 (in triplicate) to verify if there was any matrix interference.
As no significant difference was observed between the slopes of both curves for ozone (in water type 1 and the matrix of the sample (drinking water)), no matrix interference was observed for this matrix. For hypochlorite, as a significant difference was observed between the slopes of the two curves (in water type 1 and the sample matrix (drinking water)), a matrix interference was observed.
For that comparison, the t-Student test presented in equation 16 was used. 43 The calculated value for ozone equal to 2.1, was smaller than the critical value (2.3). The calculated value for hypochlorite equal to 3.6 was higher than the critical value (2.3). For both tests, a degree of freedom equal to 15 and 95% certainty was used in a two-tailed test. (16) where S i is the slope and s i is the square of the estimated standard deviation of that slope.
Therefore, to eliminate matrix interference for hypochlorite, a new analytical curve was built, adding EDTA 0.002 mol L -1 , in order to form complexes with the interferents, and they did not interfere in the hypochlorite reaction with the malachite green.
As no significant difference was observed between the slope of both curves (in water type 1 and the matrix of the sample (drinking water) with EDTA 0.002 mol L -1 ), no matrix interference was observed for this matrix. The calculated value of t equal to 0.1 was smaller than the critical value (2.3), for a higher degree of freedom equal to 15 and 95% of certainty in a two-tailed test.
Comparison of methods developed based on digital images with spectrophotometric methods The spectrophotometric method of indigotrisulfonate (ozone) The method for determination of ozone in water by digital images was compared to the spectrophotometric method of indigotrisulfonate proposed by standard methods for the examination of water and wastewater, 10 using the red filter (the one which provided the best fit).
The method of analysis by digital images with malachite green and the spectrophotometric method with indigotrisulfonate presented values close to the limit of detection and the limit of quantification. The values for the determination coefficients were also close, showing that there was a good fit of the model to the data, as can be seen in Table 2.
The spectrophotometric method of ortho-tolidine (hypochlorite) The method for the determination of hypochlorite in water by digital images was compared to the spectrophotometric method of ortho-tolidine, using the red filter, that it was the one that provided the best fit.
The method of analysis by digital images with malachite green and the spectrophotometry with orthotolidine presented adequate values of the limits of detection and quantification, in which these were lower than the maximum permitted values for residual chlorine, according to the legislation (Table 3). 9 The analysis method based on digital images with malachite green is less sensitive than the spectrophotometric with orthotolidine. However, the developed method becomes more adequate due to the carcinogenic potential presented by ortho-tolidine.

Conclusions
The presented work had as its objective develop analytical methods based on the analysis by digital images for the determination of ozone or hypochlorite isolatedly in waters, as an alternative to spectrophotometric methods in the visible region.
From different reagents tested (DPD, indigotrisulfonate, and malachite green), the malachite green was selected to determine both ozone and hypochlorite. Due to its good stability (compared with DPD), both analytes can be determined with little difference in procedure. The response for ozone is fast, but the rate of reaction is lower for hypochlorite. This is interesting for a sequential method in cases when both analytes are in same solution, not studied in this work.
New software for capturing and processing RGB data was used, called the ICCA software. This proved to be adequate, in addition to treating only pure RGB data.
The analytical resolution (Ar) and the values of N9 were adequate to compare and define some variables (type of webcam and response function) to be used in the method based on the analysis of the digital images.
The system based on digital images was studied and the presence of white correction in webcam is important when a light source is variable, and a proposed response function helps in this goal. The variable light source could be a technological feature for simplicity in a portable system.

Supplementary Information
Supplementary information is available free of charge at http://jbcs.sbq.org.br as PDF file.