CN110599552A - pH test paper detection method based on computer vision - Google Patents

pH test paper detection method based on computer vision Download PDF

Info

Publication number
CN110599552A
CN110599552A CN201910815257.5A CN201910815257A CN110599552A CN 110599552 A CN110599552 A CN 110599552A CN 201910815257 A CN201910815257 A CN 201910815257A CN 110599552 A CN110599552 A CN 110599552A
Authority
CN
China
Prior art keywords
image
equal
pixel
value
channel
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.)
Granted
Application number
CN201910815257.5A
Other languages
Chinese (zh)
Other versions
CN110599552B (en
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.)
Hangzhou Dianzi University
Original Assignee
Hangzhou Dianzi University
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 Hangzhou Dianzi University filed Critical Hangzhou Dianzi University
Priority to CN201910815257.5A priority Critical patent/CN110599552B/en
Publication of CN110599552A publication Critical patent/CN110599552A/en
Application granted granted Critical
Publication of CN110599552B publication Critical patent/CN110599552B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G01MEASURING; TESTING
    • G01NINVESTIGATING OR ANALYSING MATERIALS BY DETERMINING THEIR CHEMICAL OR PHYSICAL PROPERTIES
    • G01N21/00Investigating or analysing materials by the use of optical means, i.e. using sub-millimetre waves, infrared, visible or ultraviolet light
    • G01N21/75Systems in which material is subjected to a chemical reaction, the progress or the result of the reaction being investigated
    • G01N21/77Systems in which material is subjected to a chemical reaction, the progress or the result of the reaction being investigated by observing the effect on a chemical indicator
    • G01N21/78Systems in which material is subjected to a chemical reaction, the progress or the result of the reaction being investigated by observing the effect on a chemical indicator producing a change of colour
    • G01N21/80Indicating pH value
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/10Segmentation; Edge detection
    • G06T7/11Region-based segmentation
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/10Segmentation; Edge detection
    • G06T7/13Edge detection
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/90Determination of colour characteristics

Landscapes

  • Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Computer Vision & Pattern Recognition (AREA)
  • Theoretical Computer Science (AREA)
  • Chemical & Material Sciences (AREA)
  • Health & Medical Sciences (AREA)
  • Plasma & Fusion (AREA)
  • Chemical Kinetics & Catalysis (AREA)
  • Life Sciences & Earth Sciences (AREA)
  • Analytical Chemistry (AREA)
  • Biochemistry (AREA)
  • General Health & Medical Sciences (AREA)
  • Immunology (AREA)
  • Pathology (AREA)
  • Image Analysis (AREA)

Abstract

The invention discloses a pH test paper detection method based on computer vision. The detection of the pH value of the solution is an important link of industrial detection. The invention is as follows: 1. collecting an image and carrying out white balance processing; 2. removing the background of the image in the HSV space cone model; 3. carrying out binarization on the image; 4. and (3) carrying out contour extraction on the image by using a gradient-based Sobel operator detection method. 5. And determining the coordinates of the central point of the test paper detection area. 6. Extracting a target area in the image; 7. and comparing the chromaticity mean value of the target area with a color comparison card. The test paper with the background color can be identified. After the CCD acquires the digital image, the image is preprocessed, the image is not required to be manually segmented, the image target area is directly extracted, and the target area can be accurately acquired for color recognition. Meanwhile, the method is simple, convenient, efficient and low in cost, and is an achievable method for acquiring the image target area.

Description

pH test paper detection method based on computer vision
Technical Field
The invention belongs to the technical field of test paper detection, and particularly relates to a pH test paper detection technology based on image processing.
Background
The detection of the pH value of the solution is an important link of industrial detection, and a plurality of chemical reactions in the fields of sugar manufacturing, metallurgy, textile, chemical industry and the like need to be processed in a liquid state, so that the pH value of the solution needs to be detected at any time, and a safe and feasible method for detecting the pH value also becomes a hotspot problem of current computer vision research. The computer vision pH detection method is to extract the color-changed part on the pH test paper according to a specific technical index from a video frame acquired by a camera and identify the pH value corresponding to the corresponding color. At present, the industrial method for detecting the pH value of a solution mainly comprises an artificial colorimetric method and an electrode method, and the two methods have respective advantages and disadvantages in detection. Although the manual color comparison method is simple and easy to operate, the manual color comparison method is easily influenced by factors such as experimental conditions, light sources and the like, meanwhile, the method has high dependence on manual work, an experienced person is required to accurately judge the pH value, and manual judgment is easily influenced by various human factors such as visual fatigue, attention reduction and the like, so that the accuracy and the accuracy of color identification are reduced. The electrodes in the electrode method are easily polluted during detection, and the polluted electrodes cannot normally detect the pH value, so that errors occur in the measurement result. The electrodes of the electrode method also need to be cleaned, descaled and replaced regularly, consuming a large amount of energy and materials, and increasing the cost of industrial production. Aiming at the defects of the method, the invention mainly researches a computer vision-based algorithm for detecting the pH test paper value, preprocesses the pH test paper under a certain background, removes the background of the pH test paper by using an image processing method, extracts a part with changed test paper color after titration as a target area, converts the target area from an RGB space model into an HSV space model by using a corresponding algorithm, in the HSV space model, the color corresponding to the pH test paper value is distributed within a certain H angle, and the pH value corresponding to the test paper color can be reversely deduced by using the H value. The method not only reduces the dependence on manpower, but also improves the environment and saves resources.
Disclosure of Invention
The invention aims to provide a pH test paper detection method based on computer vision.
The method comprises the following specific steps:
step 1, collecting a color image of the pH test paper by using a CCD area array camera, and carrying out white balance treatment on the collected color image to obtain a picture T [ f (x, y) ].
Step 2, picture T [ f (x, y)]Converting the RGB space cube model into HSV space cone model to obtain picture T [ f (x, y)]The chroma H, the saturation S, and the transparency V of each pixel. Then, picture T [ f (x, y)]Setting the pixel point of which the medium chroma H, the saturation S and the transparency V meet any one of the following four conditions as black to obtain a background-removed image Th[f(x,y)]。
The condition is that H is more than or equal to 0 and less than or equal to 180; s is more than or equal to 0 and less than or equal to 255; v is more than or equal to 0 and less than or equal to 46.
The condition that H is more than or equal to 0 and less than or equal to 180; s is more than or equal to 0 and less than or equal to 43; v is more than or equal to 46 and less than or equal to 220.
Condition (0) H is less than or equal to 180; s is more than or equal to 0 and less than or equal to 30; v is more than or equal to 221 and less than or equal to 225.
H is more than or equal to 98 and less than or equal to 101; s is more than or equal to 43 and less than or equal to 255; v is more than or equal to 46 and less than or equal to 255.
Step 3, removing the background image Th[f(x,y)]And carrying out binarization to obtain a binary image. And corroding and expanding the binary image. Etching and expanding to obtain a deburring binary image T' [ f (x, y)]。
And 4, carrying out contour extraction on the target region of the deburring binary image T' [ f (x, y) ] by using a gradient-based Sobel operator detection method, and further finding the edge of the interest region.
The gradient-based Sobel operator detection method specifically comprises the following steps:
4-1. determining in the X directionConvolution kernel template ofConvolution kernel template in Y direction
4-2. calculating the edge contour in the x direction and the y direction respectively by using a Sobel operator.
And (3) taking all pixel points except the circle of pixel points on the edge of the deburring binary image T' f (X, Y) ] as target pixel points to carry out X-direction contour detection and Y-direction contour detection respectively.
The method for carrying out X-direction contour detection and Y-direction contour detection on the target pixel point comprises the following steps: and taking the nine-square image matrix with the target pixel point t' (x, y) as the center as a target pixel matrix. Matching the target pixel matrix with the convolution kernel template S in the X directionXDot product to obtain X-direction detection value z of target pixelX(x, y). Matching the target pixel matrix with a convolution kernel template S in the Y directionYDot product to obtain Y-direction detection value z of target pixelY(x,y)。
According to X-direction detection value z corresponding to each pixel pointX(x, Y) and Y-direction detection value zY(x, y), and establishing a contour image Z (x, y). Pixel value of pixel point with coordinate (x, y) on contour image
And 5, finding the center coordinates of the contour with the largest area and the contour with the largest area in the contour image Z' (x, y).
And 5-1, extracting the maximum contour in the contour image Z ' (x, y), and changing the other areas except the maximum contour in the contour image Z ' (x, y) into black to obtain the contour image Z ' (x, y).
5-2, calculating the first moment of the profile image Z' (x, y) in the x directionFirst moment in y direction
5-3. calculating the coordinates of the center of the contour in the contour image Z' (x, y)Wherein the content of the first and second substances,
step 6, the contour center coordinates obtained in the step 5 are usedAs a central point in the background-removed image Th[f(x,y)]Determining a target area;
step 7, outputting the average value of the H channel pixels of the target area obtained in the step 6 under the HSV space model; and comparing the average value with the H value of each color strip of the pH test paper colorimetric card under an HSV space model, and determining the pH value of the tested agent.
Preferably, the white balance processing of step 1 is implemented by the gray world method, which is specifically performed as follows
The input color image was split into R, G, B channels, resulting in a single channel R, G, B image. R, G, B images are respectively defined as Gk(x,y),k=1,2,3。G1(x, y) is an R (red) channel image; g2(x, y) is a G (green) channel image; g3(x, y) is a B (blue) channel image.
Obtaining the gain of each channel by using the average value of each channel, returning the gain to the corresponding channel to obtain a post-gain R, G, B image G'k(x, y) is represented by formula (1), and k is 1,2, 3.
In the formula (1), m and n are respectively an image GkThe number of rows and columns of (x, y); p indicates that the average of R, G, B three components of the image tends to be the same gray level.
Thereafter, post-gain R, G, B image G'k(x, y) three-channel picture T [ f (x, y) combined as a single sheet]。
Preferably, the step of converting the picture T [ f (x, y) ] from the RGB space cube model to the HSV space pyramid model is as follows:
2-1. calculating picture T [ f (x, y)]Maximum pixel value max in R, G, B channels of each pixel pointij=max(Rij,Gij,Bij). Calculating picture T [ f (x, y)]Minimum pixel value min in R, G, B channels of each pixel pointij=min(Rij,Gij,Bij). Calculating picture T [ f (x, y)]Delta pixel range for each pixel pointx,ij=maxij-minij。i=1,2,…,m;j=1,2,…,n;max(Rij,Gij,Bij) Is Rij、Gij、BijMaximum value of (1); min (R)ij,Gij,Bij) Is Rij、Gij、BijMinimum value of (1); rijThe R channel pixel value of the pixel point with the coordinate (i, j); gijG channel pixel values for pixel points at coordinates (i, j); b isijIs the B channel pixel value of the pixel point with coordinates (i, j).
2-2, calculating the transparency V of the pixel point of the coordinate (i, j)ij=maxij(ii) a Saturation S of coordinate (i, j) pixelij=△x,ij/maxij(ii) a If maxijIs the pixel value in the R channel; the chromaticity of the pixel point of coordinate (i, j)If maxijThe pixel value in the G channel is the chromaticity of the pixel point with the coordinate (i, j)If maxijThe pixel value in the B channel is the chroma of the pixel point with the coordinate (i, j)
Preferably, the structural elements for corrosion and expansion operations are all composed of five pixel points arranged in a cross shape. The origin of the structural element is located at the center of the structural element.
Preferably, the target area in the step 6 is rectangular, the length is 2c +1, the width is 2r +1, and c is more than or equal to 5 and less than or equal to 10; r is more than or equal to 5 and less than or equal to 10.
The invention has the beneficial effects that:
1. the invention can be suitable for the detection of the pH value of the solution in the industrial environment depending on people, the observation color of the traditional visual detection method is easy to change due to the change of the observation direction and the irradiation light source, and the visual fatigue of people can cause great errors and reduce the working efficiency. The pH test paper detection method based on computer vision can determine a standardized light environment and a fixed observation direction, and the identification system works all day long, so that the identification precision and efficiency are improved.
2. The invention can replace electrode method detection, the electrode method is greatly influenced by the pH value and the temperature of the solution in practical application, and the electrode of the electrode method also needs to be cleaned and replaced regularly. The pH test paper detection method based on computer vision can be directly contacted with a solution, and meanwhile, the industrial cost for replacing the electrode can be reduced.
3. The test paper with the background color can be identified. After the CCD acquires the digital image, the image is preprocessed, the image is not required to be manually segmented, the image target area is directly extracted, and the target area can be accurately acquired for color recognition. Meanwhile, the method is simple, convenient, efficient and low in cost, and is an achievable method for acquiring the image target area.
Drawings
FIG. 1 is a flow chart of the present invention;
FIG. 2 is a schematic diagram of the pH test paper of the present invention;
FIG. 3 is a schematic diagram of the present invention after background removal in step 2;
FIG. 4 is a schematic diagram of the present invention after binarization in step 3;
FIG. 5 is a schematic view of the etching process of step 3 in the present invention;
FIG. 6 is a schematic diagram of the expansion process of step 3 in the present invention.
Detailed Description
The invention is further described below with reference to the accompanying drawings.
As shown in fig. 1, a computer vision-based pH test paper detection method specifically includes the following steps:
step 1, collecting a color image of the pH test paper by using a CCD area array camera as shown in FIG. 2, and performing white balance processing on the collected color image by a gray world method. The picture after white balance processing tends to be a picture under natural light. The gray world method is the most commonly used algorithm in white balance, and in pH test paper detection, the gray world method is also one of algorithms with good stability in white balance processing, and an input RGB color image is split into R, G channels and B channels to obtain a single-channel R, G, B image. R, G, B images are respectively defined as Gk(x,y),k=1,2,3。G1(x, y) is an R (red) channel image; g2(x, y) is a G (green) channel image; g3(x, y) is a B (blue) channel image.
Obtaining the gain of each channel by using the average value of each channel, returning the gain to the corresponding channel to obtain a post-gain R, G, B image G'k(x, y) is represented by formula (1), and k is 1,2, 3.
In the formula (1), m and n are respectively an image GkThe number of rows and columns of (x, y), m.n being the image gi(x, y) the number of pixels; p denotes that the average of R, G, B three components of the image tends to be the same gray scale, where P is defined as half the maximum value of each channel, i.e., P-128.
Thereafter, post-gain R, G, B image G'k(x, y) three-channel picture T [ f (x, y) combined as a single sheet]。
Step 2, as shown in fig. 3, under the condition that the background is determined, an interested region needs to be extracted in HSV space, and a white-balanced picture T [ f (x, y) ] is converted from an RGB space cube model into an HSV space cone model to obtain the chromaticity H value, the saturation S and the transparency V of each pixel of the picture T [ f (x, y) ], wherein the specific process is as follows.
Calculating picture T [ f (x, y)]Maximum pixel value max in R, G, B channels of each pixel pointij=max(Rij,Gij,Bij). Calculating picture T [ f (x, y)]Minimum pixel value min in R, G, B channels of each pixel pointij=min(Rij,Gij,Bij). Calculating picture T [ f (x, y)]Delta pixel range for each pixel pointx,ij=maxij-minij。 i=1,2,…,m;j=1,2,…,n;max(Rij,Gij,Bij) Is Rij、Gij、BijMaximum value of (1); min (R)ij,Gij,Bij) Is Rij、Gij、BijMinimum value of (1); rijThe R channel pixel value of the pixel point with the coordinate (i, j); gijG channel pixel values for pixel points at coordinates (i, j); b isijIs the B channel pixel value of the pixel point with coordinates (i, j).
Calculating the transparency V of the pixel point of the coordinate (i, j)ij=maxij(ii) a Saturation S of coordinate (i, j) pixelij=△x,ij/maxij(ii) a If maxijIs the pixel value in the R channel; the chromaticity of the pixel point of coordinate (i, j)If maxijThe pixel value in the G channel is the chromaticity of the pixel point with the coordinate (i, j)If maxijThe pixel value in the B channel is the chroma of the pixel point with the coordinate (i, j)
The background was determined to be white, black, gray, and the color of the test paper was yellow. White, black, gray and yellow correspond to H, S and the V ranges under the HSV model are shown in table (1) below.
Colour(s) Black colour Ash of White colour (Bai) Yellow colour
H 0~180 0~180 0~180 98~101
S 0~255 0~43 0~30 43~255
V 0~46 46~220 221~225 46~255
Table (1) HSV values corresponding to white, black, gray, yellow under HSV space
Picture T [ f (x, y)]The middle H, S, V pixels in accordance with white, gray and yellow are all converted into black; a uniform background is obtained. Thereby obtaining a background-removed image Th[f(x,y)]As shown in fig. 3.
Step 3, as shown in fig. 4, removing the background image T by using a binary morphology methodh[f(x,y)]And setting the pixel point of the corresponding background area (black area) in the image to be 0, setting the pixel point (non-black area) of the foreground to be 1 (white, 255,255 under the RGB model), and obtaining a binary image. And corroding and expanding the binary image. Etching and expanding to obtain a deburring binary image T' [ f (x, y)]。
The etching process is shown in FIG. 5, where A is filling the set with background elements to form a matrix array, where the background elements are white squares, all shaded squares form a set, and each shaded square is an element of the set; b is a structural element which consists of five pixel points arranged in a cross shape. The origin position of the structural element the center position of the structural element (black dot in part B in fig. 5); c is a binary image after etching. Let B run on a so that the origin of B accesses each element of the collection, creating a new collection. When the origin of B maps to every element on the set, if B is completely surrounded by the set, the position is marked as a member of the new set, and all members combine to form the set of image shadows in C.
And expanding the corroded picture, wherein the expansion can enhance the connected domain of the target image. The expansion process is shown in fig. 6, where a is to fill the set with background elements to form a matrix array, where the background elements are white squares, all shaded squares are a set, and each shaded square is an element of the set; b is a structural element, and a black dot of the structural element represents an origin; c is a binary image after expansion. The structural elements of the expansion operation are identical to those of the corrosion operation. Let B run on a so that the origin of B accesses each element of the collection, creating a new collection. When the origin of B maps to each element on the set, then all the positions covered by B are marked as members of the new set, and all the members are combined to form the set of image shadows in C.
And 4, carrying out contour extraction on the target region of the deburring binary image T' [ f (x, y) ] by using a gradient-based Sobel operator detection method, and further finding the edge of the interest region.
The gradient-based Sobel operator detection method specifically comprises the following steps:
4-1. before edge detection, it is determined to use 3 x 3 convolution kernels, which are divided into x-direction and y-direction convolution kernels, whose two-direction convolution kernel templates are as follows:
convolution kernel template in X directionConvolution kernel template in Y direction
4-2. calculating the edge contour in the x direction and the y direction respectively by using a Sobel operator.
And (3) taking all pixel points except the circle of pixel points on the edge of the deburring binary image T' f (X, Y) ] as target pixel points to carry out X-direction contour detection and Y-direction contour detection respectively.
The method for carrying out X-direction contour detection and Y-direction contour detection on the target pixel point comprises the following steps: and taking the nine-square image matrix with the target pixel point t' (x, y) as the center as a target pixel matrix. Matching the target pixel matrix with the convolution kernel template S in the X directionXDot product (matrix dot product) to obtain X-direction detection value z of target pixelX(x, y). Matching the target pixel matrix with a convolution kernel template S in the Y directionYDot product to obtain Y-direction detection value z of target pixelY(x,y)。
According to X-direction detection value z corresponding to each pixel pointX(x, Y) and Y-direction detection value zY(x, y), and establishing a contour image Z (x, y). Pixel value of pixel point with coordinate (x, y) on contour image
And 5, finding the center coordinates of the contour with the largest area and the contour with the largest area in the contour image Z' (x, y).
And 5-1, extracting the maximum contour in the contour image Z ' (x, y), and changing the other areas except the maximum contour in the contour image Z ' (x, y) into black to obtain the contour image Z ' (x, y).
5-2, calculating the first moment m in the x direction of the profile image Z' (x, y)10The first moment in the y direction is shown in formula (2) and the first moment in the y direction is shown in formula (3).
5-3. calculating the coordinates of the center of the contour in the contour image Z' (x, y)Wherein m is00Is the area of the contour in the contour image | S' x, y |, i.e.
Step 6, the contour center coordinates obtained in the step 5 are usedAs a central point in the background-removed image Th[f(x,y)]Determining a target area; the target area is rectangular, the length is 2c +1, the width is 2r +1, and c is more than or equal to 5 and less than or equal to 10; r is more than or equal to 5 and less than or equal to 10.
The method specifically comprises the following steps: the upper left corner coordinate of the target area isThe coordinate of the lower left corner isCoordinates of the upper right corner areThe coordinate of the lower right corner is
Step 7, outputting the average value of the H channel pixels of the target area obtained in the step 6 under the HSV space model; and comparing the average value with the H value of each color strip of the pH test paper colorimetric card under an HSV space model, and determining the pH value of the tested agent.
The value of H of the pH test paper colorimetric card under the HSV space model is shown in the table (2):
Ph 1 2 3 4 5 6 7 8 9 10 11 12 13 14
H 128.661 120.984 111.027 104.784 99.904 96.524 94.033 84.797 53.287 3.792 5.670 167.031 155.641 150.798
table (2) values of the colorimetric cards under the HSV spatial model for H.

Claims (5)

1. A pH test paper detection method based on computer vision is characterized in that: step 1, collecting a color image of the pH test paper by using a CCD area array camera, and carrying out white balance treatment on the collected color image to obtain a picture T [ f (x, y) ];
step 2, picture T [ f (x, y)]Converting the RGB space cube model into HSV space cone model to obtain picture T [ f (x, y)]The chroma H, the saturation S and the transparency V of each pixel; then, picture T [ f (x, y)]Setting the pixel point of which the medium chroma H, the saturation S and the transparency V meet any one of the following four conditions as black to obtain a background-removed image Th[f(x,y)];
The condition is that H is more than or equal to 0 and less than or equal to 180; s is more than or equal to 0 and less than or equal to 255; v is more than or equal to 0 and less than or equal to 46;
the condition that H is more than or equal to 0 and less than or equal to 180; s is more than or equal to 0 and less than or equal to 43; v is more than or equal to 46 and less than or equal to 220;
condition (0) H is less than or equal to 180; s is more than or equal to 0 and less than or equal to 30; v is more than or equal to 221 and less than or equal to 225;
h is more than or equal to 98 and less than or equal to 101; s is more than or equal to 43 and less than or equal to 255; v is more than or equal to 46 and less than or equal to 255;
step 3, removing the background image Th[f(x,y)]Carrying out binarization to obtain a binary image; corroding and expanding the binary image; etching and expanding to obtain a deburring binary image T' [ f (x, y)];
Step 4, carrying out contour extraction on a target region of the deburring binary image T' [ f (x, y) ] by using a gradient-based Sobel operator detection method, and further finding out the edge of the interest region;
the gradient-based Sobel operator detection method specifically comprises the following steps:
4-1. determining convolution kernel templates in the X-directionConvolution kernel template in Y direction
4-2, respectively calculating edge contours in the x direction and the y direction by using a Sobel operator;
all pixel points on the deburring binary image T' [ f (X, Y) ] except for a circle of pixel points on the edge are respectively used as target pixel points to carry out X-direction contour detection and Y-direction contour detection;
the method for carrying out X-direction contour detection and Y-direction contour detection on the target pixel point comprises the following steps: taking a Sudoku image matrix with a target pixel point t' (x, y) as a center as a target pixel matrix; matching the target pixel matrix with the convolution kernel template S in the X directionXDot product to obtain X-direction detection value z of target pixelX(x, y); matching the target pixel matrix with a convolution kernel template S in the Y directionYDot product to obtain Y-direction detection value z of target pixelY(x,y);
According to X-direction detection value z corresponding to each pixel pointX(x, Y) and Y-direction detection value zY(x, y), establishing a profile image Z (x, y); pixel value of pixel point with coordinate (x, y) on contour image
Step 5, finding the outline with the largest area and the center coordinate of the outline with the largest area in the outline image Z' (x, y);
5-1, extracting the maximum contour in the contour image Z ' (x, y), and changing the other areas except the maximum contour in the contour image Z ' (x, y) into black to obtain a contour image Z ' (x, y);
5-2, calculating the first moment of the profile image Z' (x, y) in the x directionFirst moment in y direction
5-3. calculating the coordinates of the center of the contour in the contour image Z' (x, y) Wherein the content of the first and second substances,
step 6, the contour center coordinates obtained in the step 5 are usedAs a central point in the background-removed image Th[f(x,y)]Determining a target area;
step 7, outputting the average value of the H channel pixels of the target area obtained in the step 6 under the HSV space model; and comparing the average value with the H value of each color strip of the pH test paper colorimetric card under an HSV space model, and determining the pH value of the tested agent.
2. The computer vision-based pH test strip detection method of claim 1, wherein: the white balance processing of the step 1 is realized by a gray world method, and the specific operation is as follows
Splitting an input color image into R, G, B three channels to obtain a R, G, B image of a single channel; r, G, B images are respectively defined as Gk(x,y),k=1,2,3;G1(x, y) is an R (red) channel image; g2(x, y) is a G (green) channel image; g3(x, y) is a B (blue) channel image;
obtaining the gain of each channel by using the average value of each channel, returning the gain to the corresponding channel to obtain a post-gain R, G, B image G'k(x, y) is represented by formula (1), k is 1,2, 3;
in the formula (1), m and n are respectively an image GkThe number of rows and columns of (x, y); p indicates that the average value of R, G, B three components of the image tends to be the same gray level;
thereafter, post-gain R, G, B image G'k(x, y) three-channel picture T [ f (x, y) combined as a single sheet]。
3. The computer vision-based pH test strip detection method of claim 1, wherein: the steps of converting the picture T [ f (x, y) ] from the RGB space cube model to the HSV space cone model are as follows:
2-1. calculating picture T [ f (x, y)]Maximum pixel value max in R, G, B channels of each pixel pointij=max(Rij,Gij,Bij) (ii) a Calculating picture T [ f (x, y)]Minimum pixel value min in R, G, B channels of each pixel pointij=min(Rij,Gij,Bij) (ii) a Calculating picture T [ f (x, y)]Delta pixel range for each pixel pointx,ij=maxij-minij;i=1,2,…,m;j=1,2,…,n;max(Rij,Gij,Bij) Is Rij、Gij、BijMaximum value of (1); min (R)ij,Gij,Bij) Is composed ofRij、Gij、BijMinimum value of (1); rijThe R channel pixel value of the pixel point with the coordinate (i, j); gijG channel pixel values for pixel points at coordinates (i, j); b isijThe B channel pixel value of the pixel point with the coordinate (i, j);
2-2, calculating the transparency V of the pixel point of the coordinate (i, j)ij=maxij(ii) a Saturation S of coordinate (i, j) pixelij=△x,ij/maxij(ii) a If maxijIs the pixel value in the R channel; the chromaticity of the pixel point of coordinate (i, j)If maxijThe pixel value in the G channel is the chromaticity of the pixel point with the coordinate (i, j)If maxijThe pixel value in the B channel is the chroma of the pixel point with the coordinate (i, j)
4. The computer vision-based pH test strip detection method of claim 1, wherein: structural elements for corrosion and expansion operations are all composed of five pixel points which are arranged in a cross shape; the origin of the structural element is located at the center of the structural element.
5. The computer vision-based pH test strip detection method of claim 1, wherein: in the step 6, the target area is rectangular, the length is 2c +1, the width is 2r +1, and c is more than or equal to 5 and less than or equal to 10; r is more than or equal to 5 and less than or equal to 10.
CN201910815257.5A 2019-08-30 2019-08-30 pH test paper detection method based on computer vision Active CN110599552B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201910815257.5A CN110599552B (en) 2019-08-30 2019-08-30 pH test paper detection method based on computer vision

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201910815257.5A CN110599552B (en) 2019-08-30 2019-08-30 pH test paper detection method based on computer vision

Publications (2)

Publication Number Publication Date
CN110599552A true CN110599552A (en) 2019-12-20
CN110599552B CN110599552B (en) 2022-03-29

Family

ID=68856949

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201910815257.5A Active CN110599552B (en) 2019-08-30 2019-08-30 pH test paper detection method based on computer vision

Country Status (1)

Country Link
CN (1) CN110599552B (en)

Cited By (12)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111414877A (en) * 2020-03-26 2020-07-14 遥相科技发展(北京)有限公司 Table clipping method of removing color borders, image processing apparatus, and storage medium
CN111548931A (en) * 2020-04-10 2020-08-18 西安理工大学 Cell culture device and cell culture method
CN111768455A (en) * 2020-07-03 2020-10-13 福州大学 Image-based wood region and dominant color extraction method
CN112161973A (en) * 2020-08-31 2021-01-01 中国水利水电科学研究院 Unmanned aerial vehicle-based rapid detection method for water pollution
CN113177591A (en) * 2021-04-28 2021-07-27 四川省农业科学院分析测试中心 pH detection method
CN113252654A (en) * 2021-05-13 2021-08-13 北京贝塔钡尔健康科技有限公司 Anti-interference self-adaptive intelligent positioning and identifying method and system for urine test paper
CN113327236A (en) * 2021-06-04 2021-08-31 天津大学 Identification method and system of novel coronavirus antibody rapid detection reagent
CN114002217A (en) * 2021-11-02 2022-02-01 吉林市国科医工科技发展有限公司 Method for reading PH value through PH test paper image
CN114295639A (en) * 2021-12-31 2022-04-08 珠海格力智能装备有限公司 Visual inspection method, visual inspection apparatus, and non-volatile storage medium
CN114332063A (en) * 2022-01-04 2022-04-12 合肥工业大学 Wire harness sequence detection method based on background difference
CN115063375A (en) * 2022-02-18 2022-09-16 厦门中翎易优创科技有限公司 Image recognition method for automatically analyzing ovulation test paper detection result
CN115908280A (en) * 2022-11-03 2023-04-04 广东科力新材料有限公司 Data processing-based performance determination method and system for PVC calcium zinc stabilizer

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20070161103A1 (en) * 2004-02-19 2007-07-12 Prionics Ag Device and method for the visual analysis of test strips
CN104964973A (en) * 2015-07-08 2015-10-07 邓双胜 Test paper reading and analyzing method and system based on mobile terminal camera
CN106991679A (en) * 2017-03-16 2017-07-28 四川大学 One kind quantifies recognition methods based on cloud platform urine test paper physical signs
CN109886923A (en) * 2019-01-17 2019-06-14 柳州康云互联科技有限公司 It is a kind of for internet detection in measurement detection system and method based on machine learning

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20070161103A1 (en) * 2004-02-19 2007-07-12 Prionics Ag Device and method for the visual analysis of test strips
CN104964973A (en) * 2015-07-08 2015-10-07 邓双胜 Test paper reading and analyzing method and system based on mobile terminal camera
CN106991679A (en) * 2017-03-16 2017-07-28 四川大学 One kind quantifies recognition methods based on cloud platform urine test paper physical signs
CN109886923A (en) * 2019-01-17 2019-06-14 柳州康云互联科技有限公司 It is a kind of for internet detection in measurement detection system and method based on machine learning

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
B.Y. LOH ET AL.: "Automated Mobile pH Reader on a Camera Phone", 《IAENG INTERNATIONAL JOURNAL OF COMPUTER SCIENCE》 *
赵亚等: "基于数字图像处理的PH试纸自动检测技术", 《机械与电子》 *

Cited By (16)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111414877B (en) * 2020-03-26 2023-06-20 遥相科技发展(北京)有限公司 Table cutting method for removing color frame, image processing apparatus and storage medium
CN111414877A (en) * 2020-03-26 2020-07-14 遥相科技发展(北京)有限公司 Table clipping method of removing color borders, image processing apparatus, and storage medium
CN111548931A (en) * 2020-04-10 2020-08-18 西安理工大学 Cell culture device and cell culture method
CN111768455A (en) * 2020-07-03 2020-10-13 福州大学 Image-based wood region and dominant color extraction method
CN112161973A (en) * 2020-08-31 2021-01-01 中国水利水电科学研究院 Unmanned aerial vehicle-based rapid detection method for water pollution
CN113177591A (en) * 2021-04-28 2021-07-27 四川省农业科学院分析测试中心 pH detection method
CN113252654A (en) * 2021-05-13 2021-08-13 北京贝塔钡尔健康科技有限公司 Anti-interference self-adaptive intelligent positioning and identifying method and system for urine test paper
CN113327236A (en) * 2021-06-04 2021-08-31 天津大学 Identification method and system of novel coronavirus antibody rapid detection reagent
CN114002217A (en) * 2021-11-02 2022-02-01 吉林市国科医工科技发展有限公司 Method for reading PH value through PH test paper image
CN114002217B (en) * 2021-11-02 2024-05-14 苏州国科医工科技发展(集团)有限公司 Method for reading PH value through PH test paper image
CN114295639A (en) * 2021-12-31 2022-04-08 珠海格力智能装备有限公司 Visual inspection method, visual inspection apparatus, and non-volatile storage medium
CN114332063A (en) * 2022-01-04 2022-04-12 合肥工业大学 Wire harness sequence detection method based on background difference
CN114332063B (en) * 2022-01-04 2024-06-25 合肥工业大学 Wire harness sequence detection method based on background difference
CN115063375A (en) * 2022-02-18 2022-09-16 厦门中翎易优创科技有限公司 Image recognition method for automatically analyzing ovulation test paper detection result
CN115063375B (en) * 2022-02-18 2024-06-04 厦门中翎易优创科技有限公司 Image recognition method for automatically analyzing ovulation test paper detection result
CN115908280A (en) * 2022-11-03 2023-04-04 广东科力新材料有限公司 Data processing-based performance determination method and system for PVC calcium zinc stabilizer

Also Published As

Publication number Publication date
CN110599552B (en) 2022-03-29

Similar Documents

Publication Publication Date Title
CN110599552B (en) pH test paper detection method based on computer vision
CN107845087A (en) The detection method and system of the uneven defect of liquid crystal panel lightness
CN108596880A (en) Weld defect feature extraction based on image procossing and welding quality analysis method
CN108550159B (en) Flue gas concentration identification method based on image three-color segmentation
CN103543394A (en) Discharge ultraviolet imaging quantization parameter extraction method of high-voltage electric equipment
CN111724354B (en) Image processing-based method for measuring wheat ear length and wheat ear number of multiple wheat plants
CN109613023B (en) Fruit surface defect rapid detection method with area brightness self-adaptive correction
CN110189383B (en) Traditional Chinese medicine tongue color and fur color quantitative analysis method based on machine learning
CN110490836B (en) dPCR microarray image information processing method
CN114331986A (en) Dam crack identification and measurement method based on unmanned aerial vehicle vision
CN114219773B (en) Pre-screening and calibrating method for bridge crack detection data set
CN111986157B (en) Digital pathological image quality evaluation system
CN111985435A (en) Unmanned aerial vehicle water area monitoring and cruising method based on machine vision
CN115631350A (en) Method and device for identifying colors of canned image
CN106558044A (en) The resolution measuring method of image module
CN111368826B (en) Open fire detection algorithm based on variable convolution kernel
CN111161228B (en) Button surface defect detection method based on transfer learning
CN112132823A (en) Photovoltaic cell image local uneven illumination processing method based on artificial intelligence
CN108830834B (en) Automatic extraction method for video defect information of cable climbing robot
CN114022415B (en) Liquid crystal display defect detection method based on single-pixel feature clustering cluster establishment
CN115187790A (en) Image contour extraction method based on reference region binarization result
CN114881984A (en) Detection method and device for rice processing precision, electronic equipment and medium
CN114511567A (en) Tongue body and tongue coating image identification and separation method
CN114862765A (en) Cell layered image processing method
CN114359156A (en) Insulator string-dropping fault detection method based on image recognition

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
GR01 Patent grant
GR01 Patent grant