CN110726720A - Method for detecting suspended substances in drinking mineral water - Google Patents

Method for detecting suspended substances in drinking mineral water Download PDF

Info

Publication number
CN110726720A
CN110726720A CN201911083057.1A CN201911083057A CN110726720A CN 110726720 A CN110726720 A CN 110726720A CN 201911083057 A CN201911083057 A CN 201911083057A CN 110726720 A CN110726720 A CN 110726720A
Authority
CN
China
Prior art keywords
image
suspended
particle
mineral water
size
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
CN201911083057.1A
Other languages
Chinese (zh)
Other versions
CN110726720B (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.)
Kunming University of Science and Technology
Original Assignee
Kunming University of Science and Technology
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 Kunming University of Science and Technology filed Critical Kunming University of Science and Technology
Priority to CN201911083057.1A priority Critical patent/CN110726720B/en
Publication of CN110726720A publication Critical patent/CN110726720A/en
Application granted granted Critical
Publication of CN110726720B publication Critical patent/CN110726720B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

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/84Systems specially adapted for particular applications
    • GPHYSICS
    • G01MEASURING; TESTING
    • G01NINVESTIGATING OR ANALYSING MATERIALS BY DETERMINING THEIR CHEMICAL OR PHYSICAL PROPERTIES
    • G01N15/00Investigating characteristics of particles; Investigating permeability, pore-volume, or surface-area of porous materials
    • G01N15/02Investigating particle size or size distribution
    • G01N15/0205Investigating particle size or size distribution by optical means, e.g. by light scattering, diffraction, holography or imaging
    • G01N15/0227Investigating particle size or size distribution by optical means, e.g. by light scattering, diffraction, holography or imaging using imaging, e.g. a projected image of suspension; using holography
    • GPHYSICS
    • G01MEASURING; TESTING
    • G01NINVESTIGATING OR ANALYSING MATERIALS BY DETERMINING THEIR CHEMICAL OR PHYSICAL PROPERTIES
    • G01N15/00Investigating characteristics of particles; Investigating permeability, pore-volume, or surface-area of porous materials
    • G01N15/10Investigating individual particles
    • 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/187Segmentation; Edge detection involving region growing; involving region merging; involving connected component labelling
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/60Analysis of geometric attributes
    • G06T7/66Analysis of geometric attributes of image moments or centre of gravity
    • G01N2015/1024
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T2207/00Indexing scheme for image analysis or image enhancement
    • G06T2207/10Image acquisition modality
    • G06T2207/10016Video; Image sequence
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T2207/00Indexing scheme for image analysis or image enhancement
    • G06T2207/10Image acquisition modality
    • G06T2207/10024Color image
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T2207/00Indexing scheme for image analysis or image enhancement
    • G06T2207/20Special algorithmic details
    • G06T2207/20036Morphological image processing
    • 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/30242Counting objects in image

Abstract

The invention discloses a method for detecting suspended substances in drinking mineral water, which utilizes a computer vision technology to carry out image acquisition and analysis on the detected bottled mineral water, utilizes an image analysis algorithm to carry out target identification, quantity statistics and size range detection on the suspended substance particles in the water and has higher accuracy.

Description

Method for detecting suspended substances in drinking mineral water
Technical Field
The invention belongs to the field of computer vision and image processing research, and particularly relates to a method for detecting suspended matters in drinking mineral water.
Background
Water quality detection is a very important key link of product quality management of various water plants, and is related to the drinking water health of everyone. At present, the drinking water quality detection in China still has some problems, such as uneven distribution of drinking water quality detection centers, unreasonable arrangement of drinking water quality detection sampling points, lack of advanced detection instruments and the like.
At present, the production process of bottled mineral water is basically as follows: source water → coarse filtration → fine filtration → deionized purification (ion exchange, reverse osmosis, distillation) → sterilization → filling and sealing → lamp inspection → product. In the light inspection link, because of the lack of detection instruments and automatic detection devices, the current method mainly relies on manual visual identification, and the method has the following defects: the light inspection personnel have different eyesight, different detection results and non-uniform quality; the eyes of operators are easy to fatigue, and easy to detect by mistake or miss; the long-time work has certain damage to the eyes of operators, the pressure of the thoughts of the operators is large, the quality fluctuation is easy to cause, and the detection omission is generated; the production efficiency is low, the time and the labor are wasted, and the method is the capacity bottleneck of large-scale production.
Suspended particles in drinking mineral water need to be subjected to statistical and qualitative analysis so as to have a good evaluation on a water quality detection result, and the method has important guiding significance on product quality detection improvement in enterprise assembly line work and each link. The technology for counting particles is widely applied to the prior art, and is based on a machine vision technology and adopts an image processing method. Li et al performed a study on the particle size and concentration of suspended particles in the room by microscopic imaging, acquired the particle image by microscopic observation, and programmed the image processing program to process and analyze it, and obtained a series of particle parameters. Otsu segmentation algorithm based on two-dimensional histogram is provided for seed image segmentation by Wanghai et al, and influence of light on seed counting is eliminated to a certain extent. The Wangjian et al solves the problem that the particle bonding condition affects the statistical result during the detection by using a watershed segmentation method. The Wangdan improves a mathematical morphology fractal dimension estimation method based on variable structure elements, and applies the algorithm to fractal dimension estimation of an image of airborne suspended particles. The above-mentioned statistical methods for the detection of particles have advantages, but have some problems: or the particles are only limited to suspended matters in the air or large particles with easily recognized shapes and sizes, such as soybean seeds and the like, and the problems that the detected particles are projected onto a two-dimensional plane from three dimensions, the information of depth and invisible parts is lost and the like are not considered; or the optical characteristic of the measured object in the particle image is reflected, the method how to process the image to supplement the illumination nonuniformity is not considered, and partial operation is completed by manual operation software, so that the image processing efficiency is low, and the batch processing of the image cannot be realized; or the method is not perfect, and the online detection of the particles cannot be realized. The identification statistics of the particles in the water quality detection need to be considered more, and whether the methods are suitable for the water quality detection of drinking mineral water or not is yet verified. In summary, many studies on detection of various particles are currently conducted at home and abroad, but studies on detection of bottled mineral water suspended matters are still lacked.
Disclosure of Invention
In order to solve the technical problem, the invention provides a bottled mineral water suspended matter automatic detection method based on computer vision, which utilizes the computer vision technology to carry out image acquisition and analysis on the bottled mineral water to be detected, utilizes an image analysis algorithm to carry out target identification, quantity statistics and size range detection on suspended matter particles in water, and has higher accuracy. The detection method can analyze and process the collected images of the fully and uniformly shaken water, and can compare the clean water with the images obtained by the water mixed with suspended matters, thereby analyzing the granularity of the suspended matters in the water and further obtaining the conclusion whether the detected mineral water contains the solid suspended matters and meets the standard. The invention can solve the problems that bottled mineral water needs to be observed manually when detecting whether suspended matters exist in the bottled mineral water before leaving a factory, wastes time and labor, depends on subjective feeling of people and has poor detection effect.
The technical scheme of the invention is as follows: a method for detecting suspended matters in drinking mineral water comprises the following specific steps:
(1) image acquisition: the bottled mineral water to be detected is sent into an automatic detection device, the bottled mineral water stops at a motor control door after rolling to the bottom end along a slope, the suspended matter particles in the bottle are in a motion state under the action of rolling, then under the irradiation of an LED light source, two frames of bottled mineral water original images are collected at intervals of delta T, graying processing is carried out on the two frames of images by adopting a weighted average value method respectively, RGB color images are converted into gray level images by eliminating image hue and saturation information and simultaneously keeping brightness, the requirement of difference of subsequent images is considered, the delta T ensures that the motion positions of the suspended matters in the two frames of images are staggered as far as possible so as to obtain a better target detection effect, and the range value of the delta T is as follows: mineral water bottle receives the action of gravity to roll along the slope direction, roll in-process suspended solid in the bottle, mineral water and bottle synchronous revolution, stopped by the roll of baffle after the slope end, because of the inertia effect, suspended solid can follow the mineral water in the bottle in the short time and continue to be rotary motion around bottle longitudinal axis, neglect the inertia influence of rolling friction and plastics bottle, according to the kinematics analysis, the suspended solid is for this moment from the former position pi/2 angle required time t of turning over:
Figure 100002_DEST_PATH_IMAGE002
(7)
wherein r is the radius of the mineral water bottle,lfor the rolling slope length, θ is the slope angle, g is the gravitational acceleration, ω is the angular rotation velocity, then the image acquisition time interval Δ T should satisfy the equation (8):
Figure DEST_PATH_IMAGE004
(8)
(2) and (3) jitter elimination: when the mineral water bottle reaches the bottom end of the slope and stops rolling, the mineral water bottle may slightly shake up and down, so that the positions of the mineral water bottle in two images shake and misplace, and thus, the situation that the background is large in elimination residue can occur during later image processing, the extraction of the quantity and size information of suspended particles is not facilitated, and therefore the shaking elimination is required. Defining one frame image of the two frame images after the graying processing in the step (1) as a subtracted image, namely an A image, and the other frame image as a background image, namely a B image, then defining a loss function E (x, y) for evaluating the jitter dislocation degree,
Figure 100002_DEST_PATH_IMAGE005
(1)
wherein, rowsize and colsize are the vertical height and horizontal width of the image, x, y represent the image deviation in vertical and horizontal directions caused by shaking, A (i, j) represents the gray value corresponding to the pixel coordinate on the A image, B (i-x, j-y) represents the gray value corresponding to the pixel coordinate on the B image after the deviation is removed, find the optimal solution x, y which makes E (x, y) the minimum value, and respectively represent with rowmin and colmin, to obtain the relative deviation of the mineral water bottle position in the two images, and when image difference time sharing is carried out subsequently, the shaking influence can be eliminated by shifting the background image according to the deviation;
(3) image difference: carrying out difference processing on the two frame images by using an interframe difference method, subtracting the subtracted image A and the background image B according to a formula (2) background difference algorithm, and theoretically only remaining suspended particles in the subtracted image A to obtain a gray image C containing the suspended particles;
Figure DEST_PATH_IMAGE006
(2)
in the formula:k=A(i, j)-B(i-rowmin,j-colmin),colminandrowminthe horizontal and vertical offsets solved for step (2),ifis expressed as a condition,(i,j)Representing pixel points on the C image;
then, performing binarization processing on the gray level image C through threshold value filtering to obtain a binarization differential image P:
Figure 100002_DEST_PATH_IMAGE007
(3)
in the formula:thresholddetermining the value range of the critical threshold value by using a maximum inter-class variance method (OTSU) to ensure the integrity of the suspension particle image after binarization;
(4) background purification: due to various interferences, in the binary differential image P, besides the suspended particle image, some noise white spots with small sizes exist, and need to be removed, and the method is realized by performing region detection on the binary image and removing small-area region blocks.
Carrying out region detection on a binarization differential image P and eliminating small-area region blocks, firstly, scanning the image P by adopting an 8-communication region, marking the image P when detecting one region, compared with a 4-communication region, avoiding that a single communication region is divided into a plurality of regions by mistake by adopting the 8-communication region, and then, calculating the area of each marked regionarea,The area of the region is actually the number of pixel points in the marked region, and finally, the region with the area smaller than s is removed, wherein the algorithm is expressed as follows:
Figure DEST_PATH_IMAGE009
(3)
in the formula, D is an output image after background purification treatment; if conditions indicate: if the current image point P (i, j) belongs to a certain region R and the area of the region R is smaller than a threshold value s, rejecting the region, namely, setting each pixel point value of the region to be 0; s is a threshold area value, the set value of which is determined by the minimum size d of suspended particles to be measured in the actual mineral water production processminTo determine, s is calculated as shown in (4):
Figure DEST_PATH_IMAGE011
(4)
in the formula, int represents a rounding operation, k0For the actual size per pixel, k is fixed since the image acquisition position is fixed0Obtained by pre-calibration;
(5) edge smoothing: in the image D after background purification, since some connected weak-gray pixels around the suspended particles may be set to 1 in the binary processing process, but the pixels do not belong to a part of the suspended particles, if the pixels are not subjected to edge smoothing, the sizes of the suspended particles detected later are larger, and in order to eliminate the influence, morphological operations are required to be further processed.
The image D after background cleaning is processed by morphological operations, first of all, edge detection is performed by canny operator within one decimal of 0 ~ 1, then morphological closing operations are performed, the image D is first subjected to dilation operation and then to erosion operation by the same structural elements, the image D is set as X, the structural elements are Se, the symbol x.se represents closing operation, which is defined as:
Figure 100002_DEST_PATH_IMAGE012
(5)
the Se is a matrix, boundary object suppression is performed on the processed image, bright spots connected with the boundary are removed, reconstruction transformation is involved, hole filling is finally performed, and a binary image only containing suspended particle target objects and marked as BW2 can be obtained after the steps are completed;
(6) counting the number of suspended particles: firstly, the binary image BW2 is subjected to region marking to obtain the number of suspended particles, and specifically, the MATLAB method is called: [ labelled, num ] = bwleabel (BW2, n), where n is 8, and represents that the search area is connected according to 8, which returns a labelled matrix of labelled type of BW2 with the same size as BW2, and the class label of each connected area in labelled BW2 is stored in the labelled matrix, and the return value num is the number of connected areas in BW2, i.e. the total number of suspended particles;
(7) and (3) detecting the particle size of the suspended matter: the maximum size of suspended particles is detected, namely the maximum value of the distance between any two points on the edge of the particles, a binary image BW3 with the same size as BW2 is taken, BW3 is used for temporarily storing the outline of the extracted single suspended particles, the size of each particle is stored by a two-dimensional array A with the length of num, the whole BW2 image is traversed, the sizes of num suspended particles are obtained, then the value in the array A is output, and the maximum size of the suspended particles can be obtained, and the method comprises the following specific steps:
(1) initializing an array A, letting A = zeros (num,1), initializing an array BW3, traversing the whole image of BW2, processing the first particle first, and assigning the pixel value of the point in BW2 to the corresponding point in BW3 as long as the pixel point with the mark number of 1 in the mark matrix Labeled is satisfied and the pixel value of the corresponding point in BW2 is 1, wherein the program is represented as follows:
If Labeled(i,j)==x&&BW2(i,j)==1
BW3(i,j)= BW2(i,j);
where x =1, 2, …, num, and the reference number is 1 (x = 1), traversing the entire graph also obtains an image of the first particle, i.e., a first particle contour;
(2) and (3) solving the suspended particle size by rotation: after extracting the particle outline, rotating around a z-axis in an xoy plane by taking a centroid O of the suspended particle image as a coordinate origin, solving the maximum distance of the suspended particle image in the two directions of an x-axis and a y-axis until the suspended particle image rotates for 90 degrees when rotating for an alpha angle, and solving the maximum size and the minimum size of the particle, wherein the maximum size and the minimum size are stored in an array A and serve as the size of the particle with the mark number of 1;
(3) and (3) repeating the step (1) ~ (2) until the num particle is extracted and detected, finishing the size detection of the suspended particles, and outputting the values in the array A to obtain the maximum size and the minimum size of the suspended particles.
Since the rotation also requires the minimum size of the particles, the method of the invention is equally applicable to the minimum size if required for the test.
The automatic detection device is a drinking mineral water quality detection device which is invented by the patent with the application number of 201810999685.3, and mainly comprises nine parts, namely an LED light source, a conveyor belt, a slope, a detection box, a camera, a motor control door device, a controller, an electric door, a movable baffle plate and the like, wherein the camera and the controller are fixed at the top of the detection box, the conveyor belt is connected with the slope in the detection box and used for transmitting a sample to be detected, the electric door is arranged at the bottom end of the slope, the LED light source is installed on the rear wall of the detection box, and the movable baffle plate is arranged at a product inlet. The motor control door device is arranged on the side wall of the detection box and comprises a motor and a door, and the opening and closing of the door connected with the motor at the upper end is controlled by the motor at the upper end. When the image is collected, the detection box of the device is sealed at the periphery, so that the image collection is carried out in a dark environment, the image of suspended particles can be clearly captured, and the processing of a complex background during subsequent image processing is simplified.
The invention establishes an automatic detection method for suspended substance particles in bottled mineral water based on a computer vision technology, and comprises image analysis processing procedures such as image acquisition, suspended substance particle target identification, quantity statistics, size parameter detection and the like.
Compared with the prior art, the invention has the beneficial effects that:
(1) the method detects whether suspended particles exist in the bottled mineral water in two aspects of qualitative and quantitative, the statistics of the number of the suspended particles is accurate, the maximum error of the size detection of the suspended particles is 0.28mm, the maximum relative error is 6.8%, and the method has high accuracy.
(2) The method has feasibility, is suitable for detecting whether bottled drinking mineral water contains suspended solids before leaving the factory, and has the characteristics of accurate detection, manpower and material resource saving, working efficiency improvement, economy, practicability and simple operation.
Drawings
FIG. 1 is a schematic flow diagram of the present invention;
FIG. 2 is a schematic view of a rotation of an image of suspended particles;
FIG. 3a is a schematic view of a first set of captured subtracted images, and FIG. 3b is a schematic view of a first set of captured background images;
FIG. 4a is a schematic view of a second set of captured subtracted images, and FIG. 4b is a schematic view of a second set of captured background images;
FIG. 5a is a schematic view of a third set of captured subtracted images, and FIG. 5b is a schematic view of a third set of captured background images;
FIG. 6a is a differential image of a first set of tests, FIG. 6b is a differential image binarization of the first set of tests, FIG. 6c is a denoised image of the first set of tests, and FIG. 6d is a smoothed edge image of the first set of tests;
FIG. 7a is a differential image of a first set of tests, FIG. 7b is a differential image binarization of the first set of tests, FIG. 7c is a denoised image of the first set of tests, and FIG. 7d is a smoothed edge image of the first set of tests;
FIG. 8a is the difference image of the first set of experiments, FIG. 8b is the difference image binarization of the first set of experiments, FIG. 8c is the denoised image of the first set of experiments, and FIG. 8d is the smoothed edge image of the first set of experiments.
Detailed Description
The invention is further described with reference to the following figures and specific examples.
Example 1: the method for detecting suspended substances in drinking mineral water comprises the following specific steps:
(1) the bottled mineral water to be detected is sent into an automatic detection device, the bottled mineral water stops at a motor control door after rolling to the bottom along a slope, the suspended particles in the bottle are in a motion state under the action of rolling, under the action of light source irradiation, due to the diffuse reflection action of the surface of the suspended particles to light, the suspended particles are wholly clear and bright, a better imaging effect is achieved in an image collected by a visual sensor, an LED light source of the automatic detection device is positioned at the left lower end of the rear wall of a detection box and can irradiate at a position vertical to the bottom of the mineral water bottle, the whole bottle of water can be irradiated from the side, the problem that the side irradiation is easily affected by convex-concave lines on the side wall of the mineral water bottle is avoided, mirror reflection can also be effectively avoided, a camera is positioned at the right side of the top of the detection box, the shooting direction is vertical to the LED light, the image acquisition is carried out in a dark environment, so that the images of suspended particles can be clearly captured, and the processing of a complex background in the subsequent image processing is simplified; acquiring two frames of original bottled mineral water images by an industrial camera at a certain time interval delta T, wherein when a sample is detected and sent, the mineral water bottle rolls along the slope direction under the action of gravity, suspended matters in the bottle, mineral water and the bottle body synchronously rotate in the rolling process, the rolling is stopped by a baffle plate after the mineral water bottle reaches the slope bottom, and due to the inertia effect, the suspended matters in the bottle can continuously rotate around the longitudinal central axis of the bottle along with the mineral water in a short time, as shown in figure 1; neglecting the rolling friction and the rotational inertia influence of the plastic bottle body, according to the kinematic analysis, the time t required by the suspended matter to rotate by pi/2 angle from the previous position is approximate to:
Figure DEST_PATH_IMAGE002A
(7)
wherein: r is the radius of the mineral water bottle,lfor the rolling ramp length, θ is the ramp angle, g is the gravitational acceleration, and ω is the rotational angular velocity. The image acquisition time interval Δ T should satisfy the equation (8):
Figure DEST_PATH_IMAGE004A
(8)
after two frames of original images are obtained, the collected images are subjected to gray level processing by adopting a weighted average value method, and RGB color images are converted into gray level images by eliminating image hue and saturation information and simultaneously keeping brightness.
(2) And (3) jitter elimination: when the mineral water bottle arrives at the bottom end of the slope and stops rolling, the mineral water bottle may slightly shake up and down to cause the position shaking and dislocation of the mineral water bottle in two images, so that the situation that the background removal residue is large can occur during the subsequent image processing, the extraction of the quantity and size information of suspended particles is not facilitated, and therefore the shaking removal is performed.
Defining one frame image of the two frame images after the graying processing in the step (1) as a subtracted image, namely an A image, and the other frame image as a background image, namely a B image, then defining a loss function E (x, y) for evaluating the jitter dislocation degree,
(1)
wherein, rowsize and colsize are the vertical height and horizontal width of the image, x and y represent the image deviation in the vertical and horizontal directions caused by shaking, A (i, j) represents the gray value corresponding to the pixel coordinate on the A image, B (i-x, j-y) represents the gray value corresponding to the pixel coordinate on the B image after the deviation is removed, the optimal solution x and y which makes E (x, y) be the minimum value are found, and are respectively represented by rowmin and colmin;
(3) image difference: carrying out difference processing on the two frame images by using an interframe difference method, subtracting the subtracted image A and the background image B according to a formula (2) background difference algorithm, and theoretically only remaining suspended particles in the subtracted image A to obtain a gray image C only containing the suspended particles;
Figure 842170DEST_PATH_IMAGE006
(2)
in the formula:k=A(i, j)-B(i-rowmin,j-colmin),colminandrowminthe horizontal and vertical offsets solved for step (2),ifis expressed as a condition,(i,j)Representing pixel points on the C image;
then, performing binarization processing on the gray level image C through threshold value filtering to obtain a binarization differential image P:
(3)
in the formula:thresholddetermining the value range of the critical threshold value by a maximum inter-class variance method to ensure the integrity of the suspension particle image after binarization;
(4) background purification: due to various interferences, in the binary differential image P, besides the suspended particle image, there are some noise white spots with small sizes, which need to be removed, and this is achieved by performing region detection on the binary image and removing small-sized region blocks.
Carrying out region detection on the binarization differential image P and eliminating small-area region blocks, firstly, scanning the image P by adopting an 8-connected region, marking the image P when detecting one region, and then, calculating the area of each marked regionarea,The area of the region is actually the number of pixel points in the marked region, and finally, the region with the area smaller than s is removed, wherein the algorithm is expressed as follows:
Figure DEST_PATH_IMAGE009A
(4)
in the formula, D is an output image after background purification treatment; if conditions indicate: if the current image point P (i, j) belongs to a certain region R and the area of the region R is smaller than a threshold value s, rejecting the region, namely, setting each pixel point value of the region to be 0; s is a threshold area value, the set value of which is determined by the minimum size d of suspended particles to be measured in the actual mineral water production processminTo determine, s is calculated as shown in (5):
Figure DEST_PATH_IMAGE011A
(5)
in the formula, int represents a rounding operation, k0For the actual size per pixel, k is fixed since the image acquisition position is fixed0Obtained by pre-calibration;
(5) edge smoothing: in the image D after background purification, since some connected weak-gray pixels around the suspended particles may be set to 1 in the binary processing process, but the pixels do not belong to a part of the suspended particles, if the pixels are not subjected to edge smoothing, the sizes of the suspended particles detected later are larger, and in order to eliminate the influence, morphological operations are required to be further processed.
The image D after background cleaning is processed by morphological operations, first of all, edge detection is performed by canny operator within one decimal of 0 ~ 1, then morphological closing operations are performed, the image D is first subjected to dilation operation and then to erosion operation by the same structural elements, the image D is set as X, the structural elements are Se, the symbol x.se represents closing operation, which is defined as:
Figure 938488DEST_PATH_IMAGE012
(6)
wherein Se is a 5 x 5 matrix, and then performing boundary object suppression on the processed image to remove bright spots connected with the boundary, wherein the reconstruction transformation is involved and is provided withIf g is the mask and f is the label, then the transformation to reconstruct g from f is denoted as Rg(f) It is defined by the following iterative process:
1) h is to be1Initializing to a marker image f;
2) creating a structural element: b = ones (5);
3) repetition ofUp to
Figure DEST_PATH_IMAGE014
The flag f must be a subset of g, i.e.
Figure DEST_PATH_IMAGE015
Defining a marker image fmAs in equation (8), masking with the original image f is performed
Figure DEST_PATH_IMAGE016
The boundary object can be cleared;
Figure DEST_PATH_IMAGE017
(8),
finally, filling holes, wherein the filling of the holes is specifically recorded
Figure DEST_PATH_IMAGE018
For the marked image, which is defined as equation (9), then
Figure DEST_PATH_IMAGE019
The holes in the image can be filled in,
Figure DEST_PATH_IMAGE020
(9)。
after the steps are completed, a binary image only containing suspended particle target objects is obtained and is marked as BW 2;
(6) counting the number of suspended particles: firstly, the binary image BW2 is subjected to region marking to obtain the number of suspended particles, and specifically, the MATLAB method is called: [ labelled, num ] = bwleabel (BW2, n), where n is 8, and represents that the search area is connected according to 8, which returns a labelled matrix of labelled type of BW2 with the same size as BW2, and the class label of each connected area in labelled BW2 is stored in the labelled matrix, and the return value num is the number of connected areas in BW2, i.e. the total number of suspended particles;
(7) and (3) detecting the particle size of the suspended matter: detecting the maximum size of suspended particles, namely the maximum value of the distance between any two points on the edge of the particles, initializing a binary map BW3 with the same size as BW2, wherein BW3 is used for temporarily storing the outline of the extracted single suspended particles, storing the size of each particle by using a two-dimensional array A with the length of num, traversing the whole BW2 image, calculating the sizes of num suspended particles, and then outputting the value in the array A to obtain the maximum size of the suspended particles, wherein the method comprises the following specific steps:
(1) initializing an array A, letting A = zeros (num,1), initializing an array BW3, traversing the whole image of BW2, processing the first particle first, and assigning the pixel value of the point in BW2 to the corresponding point in BW3 as long as the pixel point with the mark number of 1 in the mark matrix Labeled is satisfied and the pixel value of the corresponding point in BW2 is 1, wherein the program is represented as follows:
If Labeled(i,j)==x&&BW2(i,j)==1
BW3(i,j)= BW2(i,j);
where x =1, 2, …, num, and the reference number is 1 (x = 1), traversing the entire graph also obtains an image of the first particle, i.e., a first particle contour;
(2) and (3) solving the suspended particle size by rotation: after the particle contour is extracted, the suspended particle image is rotated around the z-axis in the xoy plane by taking the centroid O of the suspended particle image as the origin of coordinates, as shown in fig. 2, the maximum distance between the suspended particle image and the x-axis and the y-axis is calculated when the suspended particle image is rotated by an angle α, and in the rotating process, by taking a certain point P on the suspended particle as an example, the expression of the rotation vector r can be obtained by using basic knowledge of a triangle and a trigonometric function and a difference formula as follows:
Figure DEST_PATH_IMAGE021
the coordinate formula after the rotation can be derived as:
Figure DEST_PATH_IMAGE022
is abbreviated as
Figure DEST_PATH_IMAGE023
To sum up, m pixels have the following rotation formula:
Figure DEST_PATH_IMAGE024
and (3) sorting the rotated matrix from small to large every time, subtracting the minimum value from the maximum value to obtain the distance of the particles in the x-axis direction and the y-axis direction, comparing the two values, wherein the larger value is placed in max, the smaller value is placed in min, then performing rotation of the next alpha angle by the same method to obtain two values, the larger value is max1, the smaller value is min1, and comparing and updating with the previous max and min, wherein the corresponding expression is as follows:
Figure DEST_PATH_IMAGE025
Figure DEST_PATH_IMAGE026
until the rotation reaches 90 degrees, so that the finally obtained max value and min value are respectively multiplied by a scaling ratio coefficient k0I.e. the maximum and minimum size of the particles, are stored in array a as the size of the particles marked 1.
And (3) repeating the step (1) ~ (2) until the num particle is extracted and detected, finishing the size detection of the suspended particles, and outputting the values in the array A to obtain the maximum size and the minimum size of the suspended particles.
The experiment of 3 groups is carried out to this embodiment, 1 group adds the suspended solid particle of less dimension in bottled mineral water (bottle 1), 2 groups add the suspended solid particle of bigger dimension in bottled mineral water (bottle 2), 3 groups add the suspended solid particle of size mixture in bottled mineral water (bottle 3), through surveying, examine the link in the lamp, the quantity that the suspended solid appears in the mineral water is few, generally can not exceed 5, consequently all add 5 solid suspended solid particles in every group, with the simulation bottled water the condition of mixing the suspended solid before dispatching from the factory. The particle sizes (maximum and minimum diameters) of the solid suspensions were measured with a vernier caliper before addition, as shown in Table 1. Wherein the maximum size range of group 1 is 2.80mm-3.78mm, the maximum size range of group 2 is 4.80mm-5.58mm, and the size range of group 3 is 1.60mm-7.04 mm. Since in the actual production of mineral water the maximum size of the aerosol particles is often of interest, beyond a certain size, which is an unacceptable product, the maximum size comparison has a reference value, where the maximum size is not lower than 1mm, so that the subsequent measurement of the size of the aerosol particles only counts the maximum size.
TABLE 1 statistical table of the actual size of suspended particles
Figure DEST_PATH_IMAGE028
The method comprises the steps of detecting 3 groups of tests by adopting the method, collecting a plurality of groups of images, selecting one group of images for large particle suspended matters, small particle suspended matters and mixed particle suspended matters with different sizes as shown in figures 3, 4 and 5, and then sequentially processing the images according to the image processing method to obtain a difference image, a binary image, a denoised image and an image with smooth edges as shown in figures 6, 7 and 8.
The three images finally detected 5 particles, which completely correspond to the number of the suspended particles actually added, and the results of the detection of the suspended particles in the 1, 2 and 3 groups in tables 2, 3 and 4 are compared with the actual sizes, and it can be seen from the table that the detected suspended particles with small particles range from 2.96mm to 3.82 mm, the suspended particles with large particles range from 4.65mm to 5.86mm, and the mixed particles range from 1.70mm to 7.24 mm. The error is maintained within 0.3mm, which shows that the detection result of the method is more accurate under the condition that the error allows, and simultaneously shows that the automatic detection device provided by the method has feasibility. In the aspect of algorithm real-time performance, opencv and C + + programming is adopted, image resolution is optimized, and then the time consumed for detecting a bottle of mineral water is actually measured in a computing environment (information such as cpu, memory, hard disk, operating system and the like is given according to your computer configuration) for about 1 second (including photo acquisition time and image processing time), so that the real-time performance meets the actual detection requirement.
TABLE 2 comparison of the results of the suspended particles in group 1 with the actual size
Figure DEST_PATH_IMAGE030
TABLE 3 comparison of the results of the suspended particles in group 2 with the actual size
Figure DEST_PATH_IMAGE032
TABLE 4 comparison of the results of the suspended particles in group 3 with the actual size
Figure DEST_PATH_IMAGE034
The foregoing is only a preferred embodiment of the present invention, and it should be noted that, for those skilled in the art, various modifications and decorations can be made without departing from the principle of the present invention, and these modifications and decorations should also be regarded as the protection scope of the present invention.

Claims (2)

1. A method for detecting suspended matters in drinking mineral water is characterized by comprising the following specific steps:
(1) image acquisition: sending bottled mineral water to be detected into an automatic detection device, rolling the bottled mineral water to the bottom end along a slope, stopping at a motor control door, enabling suspended matter particles in the bottle to be in a motion state under the rolling action, then acquiring two frames of original images of the bottled mineral water at a time interval delta T under the irradiation of an LED light source, respectively carrying out gray processing on the two frames of images, and simultaneously keeping the brightness to convert RGB color images into gray images by eliminating image hue and saturation information;
(2) and (3) jitter elimination: defining one frame image of the two frame images after the graying processing in the step (1) as a subtracted image, namely an A image, and the other frame image as a background image, namely a B image, then defining a loss function E (x, y) for evaluating the jitter dislocation degree,
(1)
wherein, rowsize and colsize are the vertical height and horizontal width of the image, x and y represent the image deviation in the vertical and horizontal directions caused by shaking, A (i, j) represents the gray value corresponding to the pixel coordinate on the A image, B (i-x, j-y) represents the gray value corresponding to the pixel coordinate on the B image after the deviation is removed, the optimal solution x and y which makes E (x, y) be the minimum value are found, and are respectively represented by rowmin and colmin;
(3) image difference: carrying out difference processing on the two frame images by using an interframe difference method, subtracting the subtracted image A and the background image B according to a formula (2) background difference algorithm, and theoretically only remaining suspended particles in the subtracted image A to obtain a gray image C containing the suspended particles;
Figure DEST_PATH_IMAGE002
(2)
in the formula:k=A(i, j)-B(i-rowmin,j-colmin),colminandrowminthe horizontal and vertical offsets solved for step (2),ifis expressed as a condition,(i,j)On C imageThe pixel point of (2);
then, performing binarization processing on the gray level image C through threshold value filtering to obtain a binarization differential image P:
(3)
in the formula:thresholddetermining the value range of the critical threshold value by a maximum inter-class variance method to ensure the integrity of the suspension particle image after binarization;
(4) background purification: carrying out region detection on the binarization differential image P and eliminating small-area region blocks, firstly, scanning the image P by adopting an 8-connected region, marking the image P when detecting one region, and then, calculating the area of each marked regionarea,And finally, removing the regions with the area smaller than s, wherein the algorithm is expressed as follows:
(4)
in the formula, D is an output image after background purification treatment; if conditions indicate: if the current image point P (i, j) belongs to a certain region R and the area of the region R is smaller than a threshold value s, rejecting the region, namely, setting each pixel point value of the region to be 0; s is a threshold area value, the set value of which is determined by the minimum size d of suspended particles to be measured in the actual mineral water production processminTo determine, s is calculated as shown in (5):
Figure DEST_PATH_IMAGE007
(5)
in the formula, int represents a rounding operation, k0For the actual size per pixel, k is fixed since the image acquisition position is fixed0Obtained by pre-calibration;
(5) processing the image D after background purification by using morphological operation, firstly, carrying out edge detection by using canny operator within a decimal of 0 ~ 1, then, executing morphological closing operation, firstly, carrying out expansion operation and then corrosion operation on the image D by using the same structural elements, setting the image D as X, setting the structural elements as Se, and expressing the closing operation by using a symbol X.Se, wherein the definition is as follows:
Figure DEST_PATH_IMAGE008
(6)
the Se is a matrix, boundary object suppression is performed on the processed image, bright spots connected with the boundary are removed, reconstruction transformation is involved, hole filling is finally performed, and a binary image only containing suspended particle target objects and marked as BW2 can be obtained after the steps are completed;
(6) counting the number of suspended particles: firstly, the binary image BW2 is subjected to region marking to obtain the number of suspended particles, and specifically, the MATLAB method is called: [ labelled, num ] = bwleabel (BW2, n), where n is 8, and represents that the search area is connected according to 8, which returns a labelled matrix of labelled type of BW2 with the same size as BW2, and the class label of each connected area in labelled BW2 is stored in the labelled matrix, and the return value num is the number of connected areas in BW2, i.e. the total number of suspended particles;
(7) and (3) detecting the particle size of the suspended matter: detecting the maximum size of suspended particles, namely the maximum value of the distance between any two points on the edge of the particles, initializing a binary map BW3 with the same size as BW2, wherein BW3 is used for temporarily storing the outlines of the extracted single suspended particles, storing the size of each particle by using a two-dimensional array A with the length of num, traversing the whole BW2 image, calculating the sizes of num suspended particles, and then outputting the value in the array A to obtain the maximum size of the suspended particles.
2. The method of detecting a suspension of drinking mineral water according to claim 1, wherein: mineral water bottle receives the action of gravity to roll along the slope direction in step (1), roll in-process suspended solid, mineral water and bottle synchronous revolution in the bottle, stopped by the baffle stopping to roll after the slope end, because of the inertia effect, suspended solid can follow the mineral water and continue to be rotary motion around bottle longitudinal axis in the short time, neglect the inertia influence of rolling friction and plastic bottle, according to the kinematics analysis, the suspended solid is the required time t of pi/2 angle of the past position of this moment:
Figure DEST_PATH_IMAGE010
(7)
wherein r is the radius of the mineral water bottle,lfor the rolling slope length, θ is the slope angle, g is the gravitational acceleration, ω is the angular rotation velocity, then the image acquisition time interval Δ T should satisfy the equation (9):
(8)
the method of detecting a suspension of drinking mineral water according to claim 1, wherein: the specific steps for determining the suspended matter particle size in the step (7) are as follows:
(1) initializing an array A, letting A = zeros (num,1), initializing an array BW3, traversing the whole image of BW2, processing the first particle first, and assigning the pixel value of the point in BW2 to the corresponding point in BW3 as long as the pixel point with the mark number of 1 in the mark matrix Labeled is satisfied and the pixel value of the corresponding point in BW2 is 1, wherein the program is represented as follows:
If Labeled(i,j)==x&&BW2(i,j)==1
BW3(i,j)= BW2(i,j);
where x =1, 2, …, num, and the reference number is 1 (x = 1), traversing the entire graph also obtains an image of the first particle, i.e., a first particle contour;
(2) and (3) solving the suspended particle size by rotation: after extracting the particle outline, rotating around a z-axis in an xoy plane by taking a centroid O of the suspended particle image as a coordinate origin, solving the maximum distance of the suspended particle image in the two directions of an x-axis and a y-axis until the suspended particle image rotates for 90 degrees when rotating for an alpha angle, and solving the maximum size and the minimum size of the particle, wherein the maximum size and the minimum size are stored in an array A and serve as the size of the particle with the mark number of 1;
(3) and (3) repeating the step (1) ~ (2) until the num particle is extracted and detected, finishing the size detection of the suspended particles, and outputting the values in the array A to obtain the maximum size and the minimum size of the suspended particles.
CN201911083057.1A 2019-11-07 2019-11-07 Method for detecting suspended substances in drinking mineral water Active CN110726720B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201911083057.1A CN110726720B (en) 2019-11-07 2019-11-07 Method for detecting suspended substances in drinking mineral water

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201911083057.1A CN110726720B (en) 2019-11-07 2019-11-07 Method for detecting suspended substances in drinking mineral water

Publications (2)

Publication Number Publication Date
CN110726720A true CN110726720A (en) 2020-01-24
CN110726720B CN110726720B (en) 2021-09-17

Family

ID=69225070

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201911083057.1A Active CN110726720B (en) 2019-11-07 2019-11-07 Method for detecting suspended substances in drinking mineral water

Country Status (1)

Country Link
CN (1) CN110726720B (en)

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112147047A (en) * 2020-10-26 2020-12-29 浙江四点灵机器人股份有限公司 Device and method for detecting concentration of particles in high-speed fluid
CN115046966A (en) * 2022-08-16 2022-09-13 山东国慈新型材料科技有限公司 Method for detecting recycling degree of environmental sewage
CN115825364A (en) * 2022-10-13 2023-03-21 青海九零六工程勘察设计院有限责任公司 System and method for detecting water quality of drinking mineral water
CN116330516A (en) * 2023-05-29 2023-06-27 乳山市东方硅胶有限公司 Particle size control system of silica gel particle production equipment

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP3396855B2 (en) * 1994-11-14 2003-04-14 信越化学工業株式会社 Automatic quantification device for fiber components dispersed in liquid
CN101354359A (en) * 2008-09-04 2009-01-28 湖南大学 Method for detecting, tracking and recognizing movement visible exogenous impurity in medicine liquid
CN101819164A (en) * 2010-05-14 2010-09-01 山东大学 Device and method for detecting impurities after filling of beverage
CN109142377A (en) * 2018-08-30 2019-01-04 昆明理工大学 A kind of drinking mineral water water quality detecting device

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP3396855B2 (en) * 1994-11-14 2003-04-14 信越化学工業株式会社 Automatic quantification device for fiber components dispersed in liquid
CN101354359A (en) * 2008-09-04 2009-01-28 湖南大学 Method for detecting, tracking and recognizing movement visible exogenous impurity in medicine liquid
CN101819164A (en) * 2010-05-14 2010-09-01 山东大学 Device and method for detecting impurities after filling of beverage
CN109142377A (en) * 2018-08-30 2019-01-04 昆明理工大学 A kind of drinking mineral water water quality detecting device

Non-Patent Citations (3)

* Cited by examiner, † Cited by third party
Title
何成: "灌装液体药品质量的机器视觉检测与识别", 《中南大学学报(自然科学版)》 *
周博文: "基于机器视觉的酒液智能检测额***研究与开发", 《中国机械工程》 *
张辉: "基于机器视觉的保健酒可见异物检测***研究与开发", 《仪器仪表学报》 *

Cited By (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112147047A (en) * 2020-10-26 2020-12-29 浙江四点灵机器人股份有限公司 Device and method for detecting concentration of particles in high-speed fluid
CN115046966A (en) * 2022-08-16 2022-09-13 山东国慈新型材料科技有限公司 Method for detecting recycling degree of environmental sewage
CN115046966B (en) * 2022-08-16 2022-11-04 山东国慈新型材料科技有限公司 Method for detecting recycling degree of environmental sewage
CN115825364A (en) * 2022-10-13 2023-03-21 青海九零六工程勘察设计院有限责任公司 System and method for detecting water quality of drinking mineral water
CN116330516A (en) * 2023-05-29 2023-06-27 乳山市东方硅胶有限公司 Particle size control system of silica gel particle production equipment
CN116330516B (en) * 2023-05-29 2023-08-29 乳山市东方硅胶有限公司 Particle size control system of silica gel particle production equipment

Also Published As

Publication number Publication date
CN110726720B (en) 2021-09-17

Similar Documents

Publication Publication Date Title
CN110726720B (en) Method for detecting suspended substances in drinking mineral water
CN103913468B (en) Many defects of vision checkout equipment and the method for large-scale LCD glass substrate on production line
CN111179225B (en) Test paper surface texture defect detection method based on gray gradient clustering
CA2779795C (en) Inclusion detection in polished gemstones
CN109598715B (en) Material granularity online detection method based on machine vision
CN109978839A (en) The detection method of the low texture defect of wafer
CN103439229B (en) A kind of quick method for analyzing iron spectrum based on digital video
CN114705686A (en) Method and system for detecting surface defects of cylindrical pot, controller and industrial personal computer
CN112184648A (en) Piston surface defect detection method and system based on deep learning
CN106780526A (en) A kind of ferrite wafer alligatoring recognition methods
CN210071686U (en) Fruit grading plant based on orthogonal binocular machine vision
CN110261391A (en) A kind of LED chip appearance detection system and method
CN114910480A (en) Wafer surface defect detection method based on machine vision
CN106529551B (en) Intelligent recognition counting detection method for round-like objects in packaging industry
CN110490826A (en) Droplet sample image processing method in a kind of camera
CN111539927A (en) Detection process and algorithm of automobile plastic assembly fastening buckle lack-assembly detection device
CN115035092A (en) Image-based bottle detection method, device, equipment and storage medium
Yang et al. Application of highlight removal and multivariate image analysis to color measurement of flotation bubble images
CN109636785A (en) A kind of visual processing method identifying particles of silicon carbide
CN113145473A (en) Intelligent fruit sorting system and method
Pons et al. Particle shape characterization by image analysis
CN111707672A (en) Method for detecting surface defects of wind power rotary supporting piece
CN109622404B (en) Automatic sorting system and method for micro-workpieces based on machine vision
CN114187269B (en) Rapid detection method for surface defect edge of small component
Allen et al. Automatic recognition of light microscope pollen images

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