CN108961345B - Method and device for determining effective color in urine test paper - Google Patents

Method and device for determining effective color in urine test paper Download PDF

Info

Publication number
CN108961345B
CN108961345B CN201810556166.XA CN201810556166A CN108961345B CN 108961345 B CN108961345 B CN 108961345B CN 201810556166 A CN201810556166 A CN 201810556166A CN 108961345 B CN108961345 B CN 108961345B
Authority
CN
China
Prior art keywords
color
value
image
adjacent pixel
color value
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.)
Expired - Fee Related
Application number
CN201810556166.XA
Other languages
Chinese (zh)
Other versions
CN108961345A (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.)
Shenyang Puze Zhongkang Pharmaceutical Technology Co ltd
Original Assignee
Shenyang Puze Zhongkang Pharmaceutical Technology Co ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Shenyang Puze Zhongkang Pharmaceutical Technology Co ltd filed Critical Shenyang Puze Zhongkang Pharmaceutical Technology Co ltd
Priority to CN201810556166.XA priority Critical patent/CN108961345B/en
Publication of CN108961345A publication Critical patent/CN108961345A/en
Application granted granted Critical
Publication of CN108961345B publication Critical patent/CN108961345B/en
Expired - Fee Related legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/90Determination of colour characteristics
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T2207/00Indexing scheme for image analysis or image enhancement
    • G06T2207/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/30Subject of image; Context of image processing
    • G06T2207/30004Biomedical image processing

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Vision & Pattern Recognition (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Theoretical Computer Science (AREA)
  • Investigating Or Analysing Biological Materials (AREA)
  • Image Analysis (AREA)

Abstract

The embodiment of the invention provides a method and a device for determining effective colors in urine test paper, wherein the method comprises the following steps: dividing the urine test paper image into a plurality of image areas by taking the initial sampling point as a center; calculating the average value of color values of pixel points in a preset range around the initial sampling point; aiming at each adjacent pixel point of the initial sampling point, calculating a color difference value between the color value of the adjacent pixel point and a reference color value, and judging whether the adjacent pixel point is used as a new sampling point according to the size relation between the color difference value and a preset threshold value; when the adjacent pixel points are determined as new sampling points, executing the step of determining the color difference value until all sampling points in the image area are determined; and calculating the color value mean value of the plurality of sampling points, and determining the color corresponding to the color value mean value as the effective color. The embodiment of the invention can improve the accuracy of the determined effective color, thereby improving the detection accuracy of the concentration of the urine component.

Description

Method and device for determining effective color in urine test paper
Technical Field
The invention relates to the technical field of color analysis of urine test paper, in particular to a method and a device for determining effective color in the urine test paper.
Background
A urine dipstick is a dipstick used to test the concentration of different components in urine. The urine test paper is usually strip-shaped, the bottom color is white, a plurality of test paper color blocks are arranged in each piece of urine test paper, and the plurality of test paper color blocks are used for detecting the concentrations of different components in the urine. In the process of analyzing the component concentration of each test strip color block by using software, the image of the urine test strip needs to be collected firstly, and then the color of each test strip color block image in the image is compared with the standard color to determine the component concentration.
Before comparing the color of the test paper color block image with the standard color, the effective color of each test paper color block image needs to be determined, and due to the influence of the surface material of the test paper color block, the pixel point colors obtained at different positions of the test paper color block image have differences, so that the effective color of the whole test paper color block image cannot be evaluated only through the color of an individual pixel point. When determining the effective color of the test strip color block image, a sampling point is usually determined in the collected test strip color block image, a block-shaped area containing pixels of the sampling point, i.e., an effective area, is determined on the image, and then the effective color of the test strip color block image is determined by calculating the color average value of all the pixels in the effective area.
In the existing image processing process, when an effective area is determined, a test paper color block image is often converted into a gray image, and then the boundary of the effective area is determined based on the converted gray image. However, when the test strip color block image is converted into a gray level image, on one hand, effective color information is lost due to only luminance information in the gray level image, and on the other hand, the image processing device may confuse the gray level image with a higher luminance value with a white background image, so that the determined effective area is inaccurate, and further, the accurate effective color cannot be determined from the test strip color block image, which affects the detection of the urine component concentration.
Disclosure of Invention
The embodiment of the invention aims to provide a method and a device for determining effective colors in urine test paper, so as to determine accurate effective colors from a test paper color block image. The specific technical scheme is as follows:
in a first aspect, an embodiment of the present invention provides a method for determining an effective color in a urine test strip, where the method includes:
aiming at the obtained urine test paper image, dividing the urine test paper image into a plurality of image areas by taking an initial sampling point as a center, wherein each image area comprises a test paper color lump image;
calculating the color value mean value of the pixel points in a preset range around the initial sampling point, and taking the obtained color value mean value as a reference color value;
aiming at each adjacent pixel point of the initial sampling point, calculating a color difference value between the color value of the adjacent pixel point and the reference color value;
judging whether the adjacent pixel point is used as a new sampling point or not according to the size relation between the color difference value of the adjacent pixel point and a preset threshold value;
when the adjacent pixel points are determined as new sampling points, executing the step of calculating the color difference value between the color value of each adjacent pixel point and the reference color value aiming at each initial sampling point until all the sampling points in the image area are determined;
and calculating the color value mean value of the determined plurality of sampling points, and determining the color corresponding to the color value mean value as the effective color of the test paper color block image.
Optionally, before dividing the obtained urine test paper image into a plurality of image regions by taking an initial sampling point as a center, where each image region includes a test paper color block image, the method further includes:
acquiring a urine test paper image, and determining initial sampling points of each image area in the urine test paper image.
Optionally, after dividing the obtained urine dipstick image into a plurality of image areas with an initial sampling point as a center, the method further includes: and performing Gaussian filtering on the image area.
Optionally, the calculating, for each neighboring pixel point of the initial sampling point, a color difference value between a color value of the neighboring pixel point and the reference color value includes:
calculating the color difference value between the color value of the adjacent pixel point and the reference color value through a preset formula;
the preset formula is as follows:
Figure BDA0001682499870000032
in the formula, C1Representing the color value of the adjacent pixel point; c2Representing the reference color value; c1,RAn R channel component representing a color value of the neighboring pixel point; c2,RAn R channel component representing the reference color value; c1,GA G channel component representing a color value of the neighboring pixel point; c2,GA G channel component representing the reference color value; c1,BA B channel component representing a color value of the neighboring pixel point; c2,BA B channel component representing the reference color value;
Figure BDA0001682499870000031
and expressing the Euclidean distance between the color value of the adjacent pixel point and the reference color value, namely the color difference value.
Optionally, the determining whether to use the adjacent pixel point as a new sampling point according to the size relationship between the color difference value of the adjacent pixel point and a preset threshold includes:
and when the color difference value of the adjacent pixel point is smaller than the preset threshold value, determining the adjacent pixel point as a new sampling point.
Optionally, the determining an initial sampling point of each image region in the urine test paper image includes:
and determining pixel points positioned in the middle of the image areas as the initial sampling points aiming at the image areas in the urine test paper image.
In a second aspect, embodiments of the present invention provide a device for determining an effective color in a urine dipstick, the device comprising:
the area dividing module is used for dividing the urine test paper image into a plurality of image areas by taking an initial sampling point as a center according to the obtained urine test paper image, and each image area comprises a test paper color block image;
the color value mean value calculation module is used for calculating the color value mean value of pixel points in a preset range around the initial sampling point, and taking the obtained color value mean value as a reference color value;
the color difference value calculation module is used for calculating the color value of each adjacent pixel point of the initial sampling point and the color difference value between the color value of the adjacent pixel point and the reference color value;
the judging module is used for judging whether the adjacent pixel points are used as new sampling points according to the size relation between the color difference value of the adjacent pixel points and a preset threshold;
a sampling point determining module, configured to, when the adjacent pixel point is determined to be a new sampling point, cause a color difference value calculating module to perform the step of calculating a color difference value between a color value of the adjacent pixel point and the reference color value for each adjacent pixel point of the initial sampling point until all sampling points in the image region are determined;
and the effective color determining module is used for calculating the color value mean value of the determined plurality of sampling points and determining the color corresponding to the color value mean value as the effective color of the test paper color block image.
Optionally, the apparatus further comprises:
the initial sampling point determining module is used for acquiring a urine test paper image and determining initial sampling points of all image areas in the urine test paper image.
And the Gaussian filtering module is used for carrying out Gaussian filtering on the image area.
Optionally, the color difference value calculating module is specifically configured to:
and calculating the color difference value between the color value of the adjacent pixel point and the reference color value through a preset formula.
The preset formula is as follows:
Figure BDA0001682499870000041
in the formula, C1Representing the color value of the adjacent pixel point; c2Representing the reference color value; c1,RAn R channel component representing a color value of the neighboring pixel point; c2,RAn R channel component representing the reference color value; c1,GA G channel component representing a color value of the neighboring pixel point; c2,GA G channel component representing the reference color value; c1,BRepresenting the color of the adjacent pixelA B channel component of the color value; c2,BA B channel component representing the reference color value;
Figure BDA0001682499870000051
and expressing the Euclidean distance between the color value of the adjacent pixel point and the reference color value, namely the color difference value.
Optionally, the determining module is specifically configured to:
and when the color difference value of the adjacent pixel point is smaller than a preset threshold value, determining the adjacent pixel point as a new sampling point.
Optionally, the initial sampling point determining module is specifically configured to:
and determining pixel points positioned in the middle of the image areas as initial sampling points according to the image areas in the urine test paper image.
In a third aspect, an embodiment of the present invention provides an electronic device, including a processor, a communication interface, a memory, and a communication bus, where the processor, the communication interface, and the memory complete mutual communication through the communication bus; the machine-readable storage medium stores machine-executable instructions executable by the processor, the processor being caused by the machine-executable instructions to: method steps for implementing the method for determining an effective color in a urine dipstick provided in the first aspect of the embodiments of the invention.
In a fourth aspect, embodiments of the present invention provide a computer-readable storage medium having a computer program stored therein, where the computer program is executed by a processor to perform the method steps of the method for determining an effective color in a urine test strip provided in the first aspect of the embodiments of the present invention.
According to the method and the device for determining the effective color in the urine test paper, provided by the embodiment of the invention, the initial sampling point is taken as the center, the obtained urine test paper image is divided into a plurality of image areas, and then the effective color is determined aiming at each image area, namely, the color corresponding to the color mean value of each sampling point, the test paper color lump image does not need to be converted into a gray image, so that the loss of effective color information is avoided, the accuracy of the determined effective color is improved, and the detection accuracy of the urine component concentration is improved. Of course, it is not necessary for any product or method of practicing the invention to achieve all of the above-described advantages at the same time.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below, it is obvious that the drawings in the following description are only some embodiments of the present invention, and for those skilled in the art, other drawings can be obtained according to the drawings without creative efforts.
FIG. 1 is a schematic flow chart of a method for determining an effective color in a urine test strip according to an embodiment of the present invention;
FIG. 2 is a schematic diagram of an image of a urine dipstick;
FIG. 3 is a schematic diagram of an apparatus for determining an effective color in a urine test strip according to an embodiment of the present invention;
FIG. 4 is a schematic diagram of another structure of a device for determining an effective color in a urine test strip according to an embodiment of the present invention;
fig. 5 is a schematic structural diagram of an electronic device according to an embodiment of the present invention.
Detailed Description
The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
As shown in fig. 1, the embodiment of the present invention provides a method for determining an effective color in a urine test strip, which may include the following steps:
s101, aiming at the obtained urine test paper image, the urine test paper image is divided into a plurality of image areas by taking an initial sampling point as a center, and each image area comprises a test paper color lump image.
In the embodiment of the present invention, it is easily understood that one urine test paper image may include a plurality of test paper color block images, and thus the effective color determination method in the embodiment of the present invention may be directed to each test paper color block image in the urine test paper image. In order to determine the effective color of each test strip color block respectively, the embodiment of the invention can divide a urine test strip image into a plurality of image areas by taking an initial sampling point as a center, wherein each image area can have a fixed size, and the image area contains one test strip color block image, that is, the division of the image areas can be based on the number of the test strip color blocks in one urine test strip image, and when the number of the test strip color blocks is more, the divided image areas are more; when the number of the test paper color blocks is smaller, the divided image area is smaller.
As shown in fig. 2, the obtained urine dipstick image usually contains a two-dimensional code, and the two-dimensional code has four positioning points for determining the coordinates of the urine dipstick image. Therefore, after the coordinates of the urine test strip image are determined through the four positioning points, the initial sampling points of the image areas can be easily set according to the coordinates. Of course, the existing two-dimensional code also has three positioning points, but the determination of the urine test paper image coordinates is not affected. In fig. 2, the color of each test patch is represented by dots of different densities, and a higher density of dots indicates a darker color of the test patch, and a lower density of dots indicates a lighter color of the test patch.
The image is composed of pixel points, so that in the process of determining the initial sampling point, a certain pixel point in the image area can be used as the initial sampling point of the image area.
As an optional implementation manner of the embodiment of the present invention, before step S101, a urine test strip image may be obtained, and initial sampling points of each image area in the urine test strip image may be determined. Specifically, the pixel point located in the middle of the image area may be determined as a sampling point. In combination with the above coordinates, for example, if the size of an image area is 25 × 25, that is, the image area is composed of 25 × 25 pixels, a pixel located at 13 th row and 13 th column of the image area coordinates may be determined as a sampling point; if the size of an image area is 24 × 25, that is, the image area is composed of 24 × 25 pixel points, the pixel point located at the 12 th row and 13 th column of the coordinates of the image area may be determined as a sampling point; if the size of an image area is 25 × 24, that is, the image area is composed of 25 × 24 pixels, the pixel located at row 13 and column 12 of the coordinates of the image area may be determined as a sampling point.
As another optional implementation manner of the embodiment of the present invention, after step S101, gaussian filtering may be performed on each image region, where the purpose of the gaussian filtering is to make the divided image regions smoother, and in view of mathematics, the gaussian filtering is a process of performing weighted average on each pixel point in the image, so that noise of the image after the gaussian filtering is reduced, and the image becomes smoother intuitively.
S102, calculating a color value mean value of pixel points in a preset range around the initial sampling point, and taking the obtained color value mean value as a reference color value.
In the embodiment of the invention, after the sampling points are determined, the color values of the pixel points can be obtained within the preset range around the sampling points. For example, the predetermined range may be a rectangular area. It is easy to understand that the image area is also composed of pixel points, and the range of the rectangular area can be determined by taking the pixel points as units. For example, the predetermined range is 5 × 5, which is a rectangular area formed by 25 pixels with the sampling point as the center. It should be noted that the specific value of the preset range may be determined according to actual sampling requirements, for example, the preset range may also be determined as 4 × 4 or 10 × 10.
Each pixel point of the image area has a corresponding color value, and the color value can specifically refer to an RGB color value of the pixel point. The RGB color space is a color space that obtains various colors by changing three color channels of red (R), green (G), and blue (B) and superimposing them on each other. The color value mean is a result obtained by averaging the color values of the pixels in the preset range, and reflects the average size of the color values of the pixels in a certain range, so that the calculated color value mean can be used as a reference color value.
S103, aiming at each adjacent pixel point of the initial sampling point, calculating the color difference value between the color value of the adjacent pixel point and the reference color value.
It is easily understood that the sampling points have adjacent pixel points, specifically, one sampling point has 8 adjacent pixel points, which are respectively located above, above right, right side, below right, below left, and above left of the sampling point. In S102, the reference color value is determined, and therefore in this embodiment, the color values of the 8 adjacent pixels may be respectively compared with the reference color value to determine the color difference value between the color value of each adjacent pixel and the reference color value.
As an optional implementation manner in the embodiment of the present invention, the color difference value between the color value of the adjacent pixel point and the reference color value may be calculated through a preset formula.
The preset formula is as follows:
Figure BDA0001682499870000091
in the formula, C1Representing the color value of the adjacent pixel point; c2Representing a reference color value; c1,RAn R channel component representing a color value of an adjacent pixel point; c2,RAn R channel component representing a reference color value; c1,GA G channel component representing a color value of an adjacent pixel point; c2,GA G-channel component representing a reference color value; c1,BA B channel component representing a color value of an adjacent pixel point; c2,BA B channel component representing a reference color value;
Figure BDA0001682499870000092
and expressing the Euclidean distance between the color value of the adjacent pixel point and the reference color value, namely the color difference value.
And S104, judging whether the adjacent pixel points are used as new sampling points or not according to the size relation between the color difference value of the adjacent pixel points and a preset threshold value.
In the embodiment of the invention, after the color difference value between the color value of each adjacent pixel point and the reference color value is obtained through calculation, the color difference value can be compared with the preset threshold value, so that whether the adjacent pixel point is used as a new sampling point or not is determined.
The preset threshold may be set according to a contrast condition between the color of the image area and the background color, specifically, when the contrast between the color of the image area and the background color is large, the preset threshold is set to be correspondingly large; when the contrast between the color of the image area and the background color is small, the preset threshold is set small accordingly. It can be seen that the purpose of changing the threshold size is to get a different number of new sample points. It should be noted that, a person skilled in the art can flexibly set the preset threshold according to the severity of the new sampling point, the contrast between the color of the image area and the background color, and the like, for example, when the severity is determined to be high, the threshold is set to be small, and when the severity is determined to be low, the threshold is set to be large.
As an optional implementation manner of the embodiment of the present invention, when the color difference value of the adjacent pixel point is smaller than the preset threshold, the adjacent pixel point may be determined as a new sampling point; and when the color difference value of the adjacent pixel point is larger than or equal to the preset threshold value, not determining the adjacent pixel point as a new sampling point.
S105, when the adjacent pixel points are determined as new sampling points, the step of calculating the color difference value between the color value of each adjacent pixel point and the reference color value aiming at each adjacent pixel point of the initial sampling points is executed until all the sampling points in the image area are determined.
In the embodiment of the present invention, when the adjacent pixel point is determined as a new sampling point, since the new sampling point also has an adjacent pixel point, the steps S103 to S104 may be executed again, so as to determine more new sampling points in the image region, and by continuously calculating, all sampling points in the image region may be determined.
And S106, calculating the color value mean value of the determined plurality of sampling points, and determining the color corresponding to the color value mean value as the effective color of the test paper color block image.
And determining a plurality of sampling points, wherein the plurality of sampling points also have corresponding color values, and the colors of the sampling points are similar, so that the average value of the color values can be calculated again. Through the calculation process, the color corresponding to the color value mean value can be determined as the effective color of the test paper color block image.
For each test paper color block image in the urine test paper image, the respective effective color can be determined by the effective color determination method of the embodiment of the invention.
According to the method for determining the effective color in the urine test paper provided by the embodiment of the invention, the initial sampling point is taken as the center, the obtained urine test paper image is divided into a plurality of image areas, and then the effective color is determined for each image area, namely, the color corresponding to the color mean value of each sampling point, and the test paper color block image does not need to be converted into a gray image, so that the loss of effective color information is avoided, the accuracy of the determined effective color is improved, and the detection accuracy of the concentration of the urine component is improved.
A specific embodiment of the device for determining an effective color in a urine test strip provided in an embodiment of the present invention corresponds to the flow shown in fig. 1, and referring to fig. 3, fig. 3 is a schematic structural diagram of the device for determining an effective color in a urine test strip according to an embodiment of the present invention, including:
the area dividing module 201 is configured to divide the obtained urine test paper image into a plurality of image areas by taking the initial sampling point as a center, where each image area includes a test paper color block image.
And the color value mean value calculating module 202 is used for calculating the color value mean value of the pixel points in the preset range around the initial sampling point, and taking the obtained color value mean value as a reference color value.
And the color difference value calculating module 203 is configured to calculate, for each adjacent pixel point of the initial sampling point, a color difference value between a color value of the adjacent pixel point and a reference color value.
The determining module 204 is configured to determine whether to use the adjacent pixel point as a new sampling point according to a size relationship between the color difference value of the adjacent pixel point and a preset threshold.
And the sampling point determining module 205 is configured to, when the adjacent pixel point is determined to be a new sampling point, cause the color difference value calculating module 203 to perform a step of calculating a color difference value between a color value of the adjacent pixel point and a reference color value for each adjacent pixel point of the initial sampling point until all sampling points in the image region are determined.
And the effective color determining module 206 is configured to calculate a color value mean of the determined multiple sampling points, and determine a color corresponding to the color value mean as an effective color of the test strip patch image.
Alternatively, on the basis of the structure of the apparatus shown in fig. 3, with reference to fig. 4, the apparatus further includes:
the initial sampling point determining module 207 is configured to obtain a urine test paper image, and determine initial sampling points of each image area in the urine test paper image.
And a gaussian filtering module 208 for performing gaussian filtering on the image region.
Optionally, the color difference value calculating module 203 is specifically configured to:
and calculating the color difference value between the color value of the adjacent pixel point and the reference color value through a preset formula.
The preset formula is as follows:
Figure BDA0001682499870000111
in the formula, C1Representing the color value of the adjacent pixel point; c2Representing a reference color value; c1,RAn R channel component representing a color value of an adjacent pixel point; c2,RAn R channel component representing a reference color value; c1,GA G channel component representing a color value of an adjacent pixel point;C2,Ga G-channel component representing a reference color value; c1,BA B channel component representing a color value of an adjacent pixel point; c2,BA B channel component representing a reference color value;
Figure BDA0001682499870000112
and expressing the Euclidean distance between the color value of the adjacent pixel point and the reference color value, namely the color difference value.
Optionally, the determining module 204 is specifically configured to:
and when the color difference value of the adjacent pixel point is smaller than a preset threshold value, determining the adjacent pixel point as a new sampling point.
Optionally, the initial sampling point determining module 207 is specifically configured to:
and determining pixel points positioned in the middle of the image areas as initial sampling points according to the image areas in the urine test paper image.
According to the device for determining the effective color in the urine test paper, provided by the embodiment of the invention, the obtained urine test paper image is divided into a plurality of image areas by taking the initial sampling point as the center, and then the effective color is determined for each image area, namely, the color corresponding to the color mean value of each sampling point, and the test paper color block image does not need to be converted into a gray image, so that the loss of effective color information is avoided, the accuracy of the determined effective color is improved, and the detection accuracy of the concentration of the urine component is improved.
An embodiment of the present invention further provides an electronic device, as shown in fig. 5, including a processor 301, a communication interface 302, a memory 303, and a communication bus 304, where the processor 301, the communication interface 302, and the memory 303 complete mutual communication through the communication bus 304,
a memory 303 for storing a computer program;
the processor 301, when executing the program stored in the memory 303, implements the following steps:
aiming at the obtained urine test paper image, dividing the urine test paper image into a plurality of image areas by taking an initial sampling point as a center, wherein each image area comprises a test paper color lump image;
calculating the color value mean value of the pixel points in a preset range around the initial sampling point, and taking the obtained color value mean value as a reference color value;
aiming at each adjacent pixel point of the initial sampling point, calculating a color difference value between the color value of the adjacent pixel point and the reference color value;
judging whether the adjacent pixel points are used as new sampling points or not according to the size relation between the color difference value of the adjacent pixel points and a preset threshold;
when the adjacent pixel points are determined as new sampling points, executing the step of calculating the color difference value between the color value of the adjacent pixel points and the reference color value aiming at each adjacent pixel point of the initial sampling points until all the sampling points in the image area are determined;
and calculating the color value mean value of the determined plurality of sampling points, and determining the color corresponding to the color value mean value as the effective color of the test paper color block image.
The electronic device provided by the embodiment of the invention divides the acquired urine test paper image into a plurality of image areas by taking the initial sampling point as the center, and then determines the effective color for each image area, namely, the color corresponding to the color mean value of each sampling point, and the test paper color block image does not need to be converted into a gray image, so that the loss of effective color information is avoided, the accuracy of the determined effective color is improved, and the detection accuracy of the urine component concentration is improved.
The communication bus mentioned in the electronic device may be a Peripheral Component Interconnect (PCI) bus, an Extended Industry Standard Architecture (EISA) bus, or the like. The communication bus may be divided into an address bus, a data bus, a control bus, etc. For ease of illustration, only one thick line is shown, but this does not mean that there is only one bus or one type of bus.
The communication interface is used for communication between the electronic equipment and other equipment.
The Memory may include a Random Access Memory (RAM) or a non-volatile Memory (non-volatile Memory), such as at least one disk Memory. Optionally, the memory may also be at least one memory device located remotely from the processor.
The Processor may be a general-purpose Processor, and includes a Central Processing Unit (CPU), a Network Processor (NP), and the like; the Integrated Circuit may also be a Digital Signal Processor (DSP), an Application Specific Integrated Circuit (ASIC), a Field Programmable Gate Array (FPGA) or other Programmable logic device, a discrete Gate or transistor logic device, or a discrete hardware component.
An embodiment of the present invention further provides a computer-readable storage medium, in which a computer program is stored, and is configured to execute the following steps:
aiming at the obtained urine test paper image, dividing the urine test paper image into a plurality of image areas by taking an initial sampling point as a center, wherein each image area comprises a test paper color lump image;
calculating the color value mean value of the pixel points in a preset range around the initial sampling point, and taking the obtained color value mean value as a reference color value;
aiming at each adjacent pixel point of the initial sampling point, calculating a color difference value between the color value of the adjacent pixel point and the reference color value;
judging whether the adjacent pixel points are used as new sampling points or not according to the size relation between the color difference value of the adjacent pixel points and a preset threshold;
when the adjacent pixel points are determined as new sampling points, executing the step of calculating the color difference value between the color value of the adjacent pixel points and the reference color value aiming at each adjacent pixel point of the initial sampling points until all the sampling points in the image area are determined;
and calculating the color value mean value of the determined plurality of sampling points, and determining the color corresponding to the color value mean value as the effective color of the test paper color block image.
The computer-readable storage medium provided by the embodiment of the invention divides the acquired urine test paper image into a plurality of image areas by taking the initial sampling point as the center, and then determines the effective color for each image area, namely, the color corresponding to the color mean value of each sampling point, and the test paper color block image does not need to be converted into a gray image, so that the loss of effective color information is avoided, the accuracy of the determined effective color is improved, and the detection accuracy of the urine component concentration is improved.
For the apparatus/electronic device/storage medium embodiment, since it is substantially similar to the method embodiment, the description is relatively simple, and for the relevant points, reference may be made to part of the description of the method embodiment.
It should be noted that the device, the electronic device and the storage medium according to the embodiments of the present invention are respectively a device, an electronic device and a storage medium to which the method for determining an effective color in a urine test strip is applied, and all embodiments of the method for determining an effective color in a urine test strip are applicable to the device, the electronic device and the storage medium, and can achieve the same or similar beneficial effects.
It should be noted that, in this document, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other identical elements in a process, method, article, or apparatus that comprises the element.
All the embodiments in the present specification are described in a related manner, and the same and similar parts among the embodiments may be referred to each other, and each embodiment focuses on the differences from the other embodiments. In particular, for the system embodiment, since it is substantially similar to the method embodiment, the description is simple, and for the relevant points, reference may be made to the partial description of the method embodiment.
The above description is only for the preferred embodiment of the present invention, and is not intended to limit the scope of the present invention. Any modification, equivalent replacement, or improvement made within the spirit and principle of the present invention shall fall within the protection scope of the present invention.

Claims (7)

1. A method of determining an effective color in a urine dipstick, the method comprising:
acquiring a urine test paper image, and determining pixel points located in the middle of the image area as initial sampling points aiming at each image area in the urine test paper image;
aiming at the obtained urine test paper image, dividing the urine test paper image into a plurality of image areas by taking the initial sampling point as a center, wherein each image area comprises a test paper color lump image;
calculating the color value mean value of the pixel points in a preset range around the initial sampling point, and taking the obtained color value mean value as a reference color value;
aiming at each adjacent pixel point of the initial sampling point, calculating a color difference value between the color value of the adjacent pixel point and the reference color value;
judging whether the adjacent pixel point is used as a new sampling point or not according to the size relation between the color difference value of the adjacent pixel point and a preset threshold value;
when the adjacent pixel points are determined as new sampling points, executing the step of calculating the color difference value between the color value of each adjacent pixel point and the reference color value aiming at each initial sampling point until all the sampling points in the image area are determined;
and calculating the color value mean value of the determined plurality of sampling points, and determining the color corresponding to the color value mean value as the effective color of the test paper color block image.
2. The method according to claim 1, wherein after dividing the urine dipstick image into a plurality of image areas centered on an initial sampling point for the acquired urine dipstick image, the method further comprises: and performing Gaussian filtering on the image area.
3. The method of claim 1, wherein said calculating, for each neighboring pixel of the initial sampling point, a color difference value between a color value of the neighboring pixel and the reference color value comprises:
calculating the color difference value between the color value of the adjacent pixel point and the reference color value through a preset formula;
the preset formula is as follows:
Figure FDA0002811677080000021
in the formula, C1Representing the color value of the adjacent pixel point; c2Representing the reference color value; c1,RAn R channel component representing a color value of the neighboring pixel point; c2,RAn R channel component representing the reference color value; c1,GA G channel component representing a color value of the neighboring pixel point; c2,GA G channel component representing the reference color value; c1,BA B channel component representing a color value of the neighboring pixel point; c2,BA B channel component representing the reference color value;
Figure FDA0002811677080000022
and expressing the Euclidean distance between the color value of the adjacent pixel point and the reference color value, namely the color difference value.
4. The method according to claim 1, wherein the determining whether the neighboring pixel is used as a new sampling point according to a size relationship between a color difference value of the neighboring pixel and a preset threshold comprises:
and when the color difference value of the adjacent pixel point is smaller than the preset threshold value, determining the adjacent pixel point as a new sampling point.
5. A device for determining the effective color of a urine dipstick, said device comprising:
the initial sampling point determining module is used for acquiring a urine test paper image and determining initial sampling points of all image areas in the urine test paper image;
the area dividing module is used for dividing the urine test paper image into a plurality of image areas by taking an initial sampling point as a center according to the obtained urine test paper image, and each image area comprises a test paper color block image;
the color value mean value calculation module is used for calculating the color value mean value of pixel points in a preset range around the initial sampling point, and taking the obtained color value mean value as a reference color value;
the color difference value calculation module is used for calculating the color value of each adjacent pixel point of the initial sampling point and the color difference value between the color value of the adjacent pixel point and the reference color value;
the judging module is used for judging whether the adjacent pixel points are used as new sampling points according to the size relation between the color difference value of the adjacent pixel points and a preset threshold;
a sampling point determining module, configured to, when the adjacent pixel point is determined to be a new sampling point, cause a color difference value calculating module to perform the step of calculating a color difference value between a color value of the adjacent pixel point and the reference color value for each adjacent pixel point of the initial sampling point until all sampling points in the image region are determined;
and the effective color determining module is used for calculating the color value mean value of the determined plurality of sampling points and determining the color corresponding to the color value mean value as the effective color of the test paper color block image.
6. An electronic device, comprising a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory complete communication with each other through the communication bus;
the memory is used for storing a computer program;
the processor, when executing the program stored in the memory, implementing the method steps of any of claims 1-4.
7. A computer-readable storage medium, characterized in that a computer program is stored in the computer-readable storage medium, which computer program, when being executed by a processor, carries out the method steps of any one of claims 1-4.
CN201810556166.XA 2018-06-01 2018-06-01 Method and device for determining effective color in urine test paper Expired - Fee Related CN108961345B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201810556166.XA CN108961345B (en) 2018-06-01 2018-06-01 Method and device for determining effective color in urine test paper

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201810556166.XA CN108961345B (en) 2018-06-01 2018-06-01 Method and device for determining effective color in urine test paper

Publications (2)

Publication Number Publication Date
CN108961345A CN108961345A (en) 2018-12-07
CN108961345B true CN108961345B (en) 2021-02-23

Family

ID=64493311

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201810556166.XA Expired - Fee Related CN108961345B (en) 2018-06-01 2018-06-01 Method and device for determining effective color in urine test paper

Country Status (1)

Country Link
CN (1) CN108961345B (en)

Families Citing this family (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109557093A (en) * 2018-12-18 2019-04-02 无锡益诺华科技发展有限公司 A kind of urine detection test paper color measuring algorithm
CN109685860B (en) * 2019-01-10 2020-12-01 青岛浦利医疗技术有限公司 Floccule color determination method and device
CN111243038B (en) * 2020-01-07 2024-02-09 芯瞳半导体技术(山东)有限公司 Graphic comparison method and device based on color characteristics and computer storage medium
CN111579505A (en) * 2020-04-23 2020-08-25 河南中烟工业有限责任公司 Cigarette packaging material color difference detection method based on digital image processing
CN113791065A (en) * 2021-09-10 2021-12-14 北京君征医疗科技有限公司 Test paper based on two-dimensional coding positioning and interpretation method
CN115309922B (en) * 2022-10-10 2023-03-24 露乐健康科技股份有限公司 Method for establishing test paper database and test paper detection method based on database

Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101726251A (en) * 2009-11-13 2010-06-09 江苏大学 Automatic fruit identification method of apple picking robot on basis of support vector machine
CN104964973A (en) * 2015-07-08 2015-10-07 邓双胜 Test paper reading and analyzing method and system based on mobile terminal camera
CN105388147A (en) * 2015-10-21 2016-03-09 深圳市宝凯仑生物科技有限公司 Detection method for body fluid based on special test paper
CN105913441A (en) * 2016-04-27 2016-08-31 四川大学 Shadow removal method for improving target detection performance in video
CN106546581A (en) * 2016-11-02 2017-03-29 长沙云知检信息科技有限公司 Detection paper card intelligent checking system and detection paper card intelligent analysis method
CN107799184A (en) * 2017-11-05 2018-03-13 厦门波耐模型设计有限责任公司 A kind of self-service detection technique scheme of excreta and its implementation
CN107807121A (en) * 2017-10-20 2018-03-16 北京小米移动软件有限公司 The determination method and apparatus of testing result

Patent Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101726251A (en) * 2009-11-13 2010-06-09 江苏大学 Automatic fruit identification method of apple picking robot on basis of support vector machine
CN104964973A (en) * 2015-07-08 2015-10-07 邓双胜 Test paper reading and analyzing method and system based on mobile terminal camera
CN105388147A (en) * 2015-10-21 2016-03-09 深圳市宝凯仑生物科技有限公司 Detection method for body fluid based on special test paper
CN105913441A (en) * 2016-04-27 2016-08-31 四川大学 Shadow removal method for improving target detection performance in video
CN106546581A (en) * 2016-11-02 2017-03-29 长沙云知检信息科技有限公司 Detection paper card intelligent checking system and detection paper card intelligent analysis method
CN107807121A (en) * 2017-10-20 2018-03-16 北京小米移动软件有限公司 The determination method and apparatus of testing result
CN107799184A (en) * 2017-11-05 2018-03-13 厦门波耐模型设计有限责任公司 A kind of self-service detection technique scheme of excreta and its implementation

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
Research on Color Recognition of Urine Test Paper Based on Learning Vector Quantization (LVQ);Wang Chunhong et al;《2012 Second International Conference on Instrumentation, Measurement, Computer, Communication and Control》;20130204;第850-853页 *

Also Published As

Publication number Publication date
CN108961345A (en) 2018-12-07

Similar Documents

Publication Publication Date Title
CN108961345B (en) Method and device for determining effective color in urine test paper
CN108593645B (en) Method and device for determining detection result of urine test paper
CN110930352B (en) Object color difference defect detection method, device, computer equipment and storage medium
CN110930353A (en) Method and device for detecting state of hole site protection door, computer equipment and storage medium
US20060244806A1 (en) Systems and methods for measuring a like-color region of an object
CN109509200B (en) Checkerboard corner detection method based on contour extraction and computer readable storage medium
CN106067177B (en) HDR scene detection method and device
KR101114586B1 (en) Apparatus and method for removing of defect pixel
CN105069453A (en) Image correction method and apparatus
US10769478B2 (en) Convolutional neutral network identification efficiency increasing method and related convolutional neutral network identification efficiency increasing device
CN110246129B (en) Image detection method, device, computer readable storage medium and computer equipment
CN110035281B (en) Dead pixel detection method and device and electronic equipment
CN113379680A (en) Defect detection method, defect detection device, electronic equipment and computer readable storage medium
US20170011502A1 (en) Defect inspection apparatus for inspecting sheet-like inspection object, computer-implemented method for inspecting sheet-like inspection object, and defect inspection system for inspecting sheet-like inspection object
CN111163301B (en) Color adjustment method, device and computer readable storage medium
CN108022219B (en) Two-dimensional image gray level correction method
EP1976308A2 (en) Device and method for measuring noise characteristics of image sensor
CN110610493B (en) Image processing method and device and electronic equipment
CN109117843B (en) Character occlusion detection method and device
CN112017163A (en) Image blur degree detection method and device, electronic equipment and storage medium
CN114937037B (en) Product defect detection method, device and equipment and readable storage medium
CN111435080B (en) Water level measuring method, device and system
CN111317426A (en) Endoscope parameter self-adaptive adjusting method and device
CN110334606A (en) Picture-in-picture localization method and device
CN113508395B (en) Method and device for detecting objects in an image composed of pixels

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
CF01 Termination of patent right due to non-payment of annual fee

Granted publication date: 20210223