CN115096878A - A kind of detection method and system of stool test paper - Google Patents
A kind of detection method and system of stool test paper Download PDFInfo
- Publication number
- CN115096878A CN115096878A CN202210355742.0A CN202210355742A CN115096878A CN 115096878 A CN115096878 A CN 115096878A CN 202210355742 A CN202210355742 A CN 202210355742A CN 115096878 A CN115096878 A CN 115096878A
- Authority
- CN
- China
- Prior art keywords
- image
- test paper
- detection
- stool
- detecting
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Pending
Links
- 238000001514 detection method Methods 0.000 title claims abstract description 55
- 238000002563 stool test Methods 0.000 title claims abstract description 47
- 238000012360 testing method Methods 0.000 claims abstract description 90
- 238000000034 method Methods 0.000 claims abstract description 36
- 238000011161 development Methods 0.000 claims abstract description 26
- 238000012937 correction Methods 0.000 claims abstract 3
- 230000015654 memory Effects 0.000 claims description 45
- 238000003708 edge detection Methods 0.000 claims description 26
- 238000012545 processing Methods 0.000 claims description 17
- 238000000605 extraction Methods 0.000 claims description 4
- 238000001914 filtration Methods 0.000 claims description 4
- 238000010998 test method Methods 0.000 claims description 2
- 239000003550 marker Substances 0.000 claims 4
- 238000005260 corrosion Methods 0.000 claims 1
- 230000007797 corrosion Effects 0.000 claims 1
- 238000007689 inspection Methods 0.000 abstract description 9
- 230000000694 effects Effects 0.000 abstract description 4
- 238000009535 clinical urine test Methods 0.000 description 8
- 238000004891 communication Methods 0.000 description 8
- 210000003608 fece Anatomy 0.000 description 5
- 230000003628 erosive effect Effects 0.000 description 4
- 230000006870 function Effects 0.000 description 4
- 241000894006 Bacteria Species 0.000 description 3
- 238000004364 calculation method Methods 0.000 description 3
- 230000002550 fecal effect Effects 0.000 description 3
- 230000008901 benefit Effects 0.000 description 2
- 238000010586 diagram Methods 0.000 description 2
- 230000010339 dilation Effects 0.000 description 2
- 201000010099 disease Diseases 0.000 description 2
- 208000037265 diseases, disorders, signs and symptoms Diseases 0.000 description 2
- 239000000203 mixture Substances 0.000 description 2
- 230000008569 process Effects 0.000 description 2
- 230000009466 transformation Effects 0.000 description 2
- PXFBZOLANLWPMH-UHFFFAOYSA-N 16-Epiaffinine Natural products C1C(C2=CC=CC=C2N2)=C2C(=O)CC2C(=CC)CN(C)C1C2CO PXFBZOLANLWPMH-UHFFFAOYSA-N 0.000 description 1
- 241000590002 Helicobacter pylori Species 0.000 description 1
- 102000004338 Transferrin Human genes 0.000 description 1
- 108090000901 Transferrin Proteins 0.000 description 1
- 239000008280 blood Substances 0.000 description 1
- 210000004369 blood Anatomy 0.000 description 1
- 238000010276 construction Methods 0.000 description 1
- 230000013872 defecation Effects 0.000 description 1
- 230000007547 defect Effects 0.000 description 1
- 238000013461 design Methods 0.000 description 1
- 239000003085 diluting agent Substances 0.000 description 1
- 238000000802 evaporation-induced self-assembly Methods 0.000 description 1
- 238000002474 experimental method Methods 0.000 description 1
- 229940037467 helicobacter pylori Drugs 0.000 description 1
- 208000015181 infectious disease Diseases 0.000 description 1
- 239000011159 matrix material Substances 0.000 description 1
- 238000012986 modification Methods 0.000 description 1
- 230000004048 modification Effects 0.000 description 1
- 230000003287 optical effect Effects 0.000 description 1
- 230000002093 peripheral effect Effects 0.000 description 1
- 239000012581 transferrin Substances 0.000 description 1
Images
Classifications
-
- G—PHYSICS
- G01—MEASURING; TESTING
- G01N—INVESTIGATING OR ANALYSING MATERIALS BY DETERMINING THEIR CHEMICAL OR PHYSICAL PROPERTIES
- G01N21/00—Investigating or analysing materials by the use of optical means, i.e. using sub-millimetre waves, infrared, visible or ultraviolet light
- G01N21/75—Systems in which material is subjected to a chemical reaction, the progress or the result of the reaction being investigated
- G01N21/77—Systems in which material is subjected to a chemical reaction, the progress or the result of the reaction being investigated by observing the effect on a chemical indicator
- G01N21/78—Systems in which material is subjected to a chemical reaction, the progress or the result of the reaction being investigated by observing the effect on a chemical indicator producing a change of colour
Landscapes
- Physics & Mathematics (AREA)
- Chemical & Material Sciences (AREA)
- Engineering & Computer Science (AREA)
- Chemical Kinetics & Catalysis (AREA)
- Plasma & Fusion (AREA)
- Health & Medical Sciences (AREA)
- Life Sciences & Earth Sciences (AREA)
- Analytical Chemistry (AREA)
- Biochemistry (AREA)
- General Health & Medical Sciences (AREA)
- General Physics & Mathematics (AREA)
- Immunology (AREA)
- Pathology (AREA)
- Investigating Or Analysing Biological Materials (AREA)
Abstract
本发明公开了一种便检试纸的检测方法及系统,方法包括:获取便检试纸的图像,所述便检试纸的图像包含至少一条试纸的标志位;利用第一预设算法,生成便检试纸图像的矫正图像;利用矫正图像中每一条试纸的标志位,提取检测试纸的显色结果区域;分别对每一条试纸显色结果区域进行识别判断,生成每一条试纸相应的检测结果。本发明提出的检测方法,可以准确的识别图像中试纸的显色结果。在不同的便检试纸图像检测上具有较好的识别效果,算法适应性强,参数结构简单,线性的计算复杂度低。
The invention discloses a method and a system for detecting a stool inspection test paper. The method includes: acquiring an image of the stool inspection test paper, wherein the image of the stool inspection test paper includes a flag position of at least one test paper; using a first preset algorithm to generate a stool inspection test paper Correcting the image of the test paper image; extracting the color development result area of the test paper by using the sign of each test paper in the correction image; identifying and judging the color development result area of each test paper respectively, and generating the corresponding detection result of each test paper. The detection method proposed by the invention can accurately identify the color development result of the test paper in the image. It has good recognition effect in the detection of different stool test strip images, the algorithm has strong adaptability, simple parameter structure, and low linear computational complexity.
Description
技术领域technical field
本发明涉及便检技术领域,具体涉及一种便检试纸的检测方法及系统。The invention relates to the technical field of stool inspection, in particular to a detection method and system for stool inspection test paper.
背景技术Background technique
传统的便检方法,需要在每次排便后,利用粪便采集棒在粪便中取样,然后使用粪便样本稀释液进行溶解,取相应的试纸进行检测,观察反应结果,此种方式需要人工干预,存在检测过程繁琐,容易感染粪便中的病菌,线性计算准确率低的风险。The traditional fecal test method needs to use a fecal collection stick to sample the feces after each defecation, and then use the fecal sample diluent to dissolve, take the corresponding test paper for testing, and observe the reaction results. This method requires manual intervention, and there are The detection process is cumbersome, easy to infect the bacteria in the feces, and the risk of low accuracy of linear calculation.
发明内容SUMMARY OF THE INVENTION
因此,本发明提供的一种便检试纸的检测方法及系统,克服了现有技术中检测过程繁琐,容易感染粪便中的病菌,线性计算准确率低的缺陷。Therefore, the detection method and system for a stool test paper provided by the present invention overcome the defects of the prior art that the detection process is cumbersome, the bacteria in the feces are easily infected, and the linear calculation accuracy is low.
为达到上述目的,本发明提供如下技术方案:To achieve the above object, the present invention provides the following technical solutions:
第一方面,本发明实施例提供一种便检试纸的检测方法,包括:In a first aspect, an embodiment of the present invention provides a method for detecting a stool test paper, including:
获取便检试纸的图像,所述便检试纸的图像包含至少一条试纸的标志位;acquiring an image of a stool test strip, where the image of the stool test strip includes at least one sign of the test strip;
利用第一预设算法,生成便检试纸图像的矫正图像;Using the first preset algorithm to generate a corrected image of the stool test strip image;
利用矫正图像中每一条试纸的标志位,提取检测试纸的显色结果区域;Extract the color development result area of the test strip by using the mark position of each test strip in the corrected image;
分别对每一条试纸显色结果区域进行识别判断,生成每一条试纸相应的检测结果。Identify and judge the color development result area of each test strip respectively, and generate the corresponding detection result of each test strip.
可选地,所述利用第一预设算法,生成便检试纸图像的矫正图像的步骤,包括:Optionally, the step of generating a corrected image of the stool test strip image using the first preset algorithm includes:
将便检试纸的图像转化为灰度图像,利用预设参数的高斯滤波器,去除灰度图像的噪声;Convert the image of the stool test paper into a grayscale image, and use the Gaussian filter with preset parameters to remove the noise of the grayscale image;
通过预设边缘检测算法提取去噪后灰度图像的轮廓,通过图像膨胀,填充边缘检测后的图像;Extract the contour of the denoised grayscale image through a preset edge detection algorithm, and fill the edge-detected image through image expansion;
利用霍夫变换算法检测填充后边缘检测图像中的边缘线,计算填充后边缘检测图像待矫正的旋转角度;Use the Hough transform algorithm to detect the edge lines in the filled edge detection image, and calculate the rotation angle of the filled edge detection image to be corrected;
以填充后边缘检测图像的中心为旋转中心,结合待矫正的旋转角度,利用第一预设算法生成便检试纸图像的矫正图像。Taking the center of the edge detection image after filling as the rotation center, combined with the rotation angle to be corrected, a first preset algorithm is used to generate a corrected image of the test strip image.
可选地,所述利用霍夫变换算法检测填充后边缘检测图像中的边缘线,计算填充后边缘检测图像待矫正的旋转角度的步骤,包括:Optionally, the step of using the Hough transform algorithm to detect the edge line in the edge detection image after filling, and calculating the rotation angle to be corrected in the edge detection image after filling, includes:
利用霍夫变换算法检测填充后边缘检测图像中的边缘线;Use the Hough transform algorithm to detect the edge lines in the edge detection image after filling;
通过填充后边缘检测图像中的边缘线,计算边缘线的倾斜角度;Detect the edge line in the image by filling the edge, and calculate the inclination angle of the edge line;
通过边缘线的倾斜角度,计算填充后边缘检测图像待矫正的旋转角度。Through the inclination angle of the edge line, the rotation angle of the edge detection image to be corrected after filling is calculated.
可选地,对旋转后的图像分别进行二值化处理、腐蚀及膨胀处理、均值滤波处理,生成去噪后的二值化图像;Optionally, performing binarization processing, erosion and expansion processing, and mean filtering processing on the rotated image, respectively, to generate a denoised binarized image;
利用第二预设算法,检测去噪后的二值化图像中的若干黑色区域,所述黑色区域的矩形轮廓对应,旋转后的图像中每一条试纸所对应的黑色区域,所述图像中每一条试纸均有一个黑色区域,黑色区域为每一条试纸的标志位。Use the second preset algorithm to detect several black areas in the denoised binarized image, the rectangular outlines of the black areas correspond to the black areas corresponding to each test strip in the rotated image, each Each test strip has a black area, and the black area is the mark position of each test strip.
可选地,试纸的显色结果区域分为上、下两部分。Optionally, the color development result area of the test paper is divided into upper and lower parts.
可选地,通过第三预设算法,检测上、下两部分区域是否分别含有红色线,判断试纸的检测结果。Optionally, through a third preset algorithm, it is detected whether the upper and lower regions respectively contain red lines, and the detection result of the test paper is judged.
可选地,所述检测结果,包括:Optionally, the detection result includes:
若上、下两部分区域均没有红色的线,或只有下部分有红色的线,则检测结果为无效;If there is no red line in the upper and lower parts, or only the lower part has a red line, the detection result is invalid;
若上部分有红色的线,下部分没有红色的线,则检测结果为阴性;If there is a red line in the upper part and no red line in the lower part, the test result is negative;
若上、下两部分均有红色的线,则检测结果为阳性。If the upper and lower parts have red lines, the test result is positive.
第二方面,本发明实施例提供一种便检试纸的检测系统,包括:In a second aspect, an embodiment of the present invention provides a detection system for a stool test paper, including:
样本获取模块,用于获取便检试纸的图像,所述便检试纸的图像包含至少一条试纸的标志位;a sample acquisition module, used for acquiring an image of a stool test strip, wherein the image of the stool test strip includes at least one sign of the test strip;
见证图像生成模块,用于利用第一预设算法,生成便检试纸图像的矫正图像;a witness image generation module, used for generating a corrected image of the test strip image by using the first preset algorithm;
显色结果区域的提取模块,用于利用矫正图像中每一条试纸的标志位,提取检测试纸的显色结果区域;The extraction module of the color development result area is used for extracting the color development result area of the detection test strip by using the mark position of each test strip in the corrected image;
检测结果的生成模块,用于分别对每一条试纸显色结果区域进行识别判断,生成每一条试纸相应的检测结果。The detection result generation module is used for identifying and judging the color development result area of each test strip respectively, and generating the corresponding detection result of each test strip.
第三方面,本发明实施例提供一种终端,包括:至少一个处理器,以及与所述至少一个处理器通信连接的存储器,其中,所述存储器存储有可被所述至少一个处理器执行的指令,所述指令被所述至少一个处理器执行,以使所述至少一个处理器执行本发明实施例第一方面所述的便检试纸的检测方法。In a third aspect, an embodiment of the present invention provides a terminal, including: at least one processor, and a memory communicatively connected to the at least one processor, wherein the memory stores a program executable by the at least one processor. The instruction is executed by the at least one processor, so that the at least one processor executes the method for detecting a stool test paper according to the first aspect of the embodiment of the present invention.
第四方面,本发明实施例提供一种计算机可读存储介质,所述计算机可读存储介质存储有计算机指令,所述计算机指令用于使所述计算机执行本发明实施例第一方面所述的便检试纸的检测方法。In a fourth aspect, an embodiment of the present invention provides a computer-readable storage medium, where the computer-readable storage medium stores computer instructions, and the computer instructions are used to cause the computer to execute the first aspect of the embodiment of the present invention. The detection method of stool test paper.
本发明技术方案,具有如下优点:The technical scheme of the present invention has the following advantages:
本发明提供的便检试纸的检测方法及系统,可以准确的识别图像中试纸的显色结果。在不同的便检试纸图像检测上具有较好的识别效果,算法适应性强。参数结构简单,线性的计算复杂度低。The detection method and system of the stool test paper provided by the present invention can accurately identify the color development result of the test paper in the image. It has a good recognition effect in the image detection of different stool test strips, and the algorithm has strong adaptability. The parameter structure is simple, and the linear computational complexity is low.
附图说明Description of drawings
为了更清楚地说明本发明具体实施方式或现有技术中的技术方案,下面将对具体实施方式或现有技术描述中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图是本发明的一些实施方式,对于本领域普通技术人员来讲,在不付出创造性劳动的前提下,还可以根据这些附图获得其他的附图。In order to illustrate the specific embodiments of the present invention or the technical solutions in the prior art more clearly, the following briefly introduces the accompanying drawings that need to be used in the description of the specific embodiments or the prior art. Obviously, the accompanying drawings in the following description The drawings are some embodiments of the present invention. For those of ordinary skill in the art, other drawings can also be obtained based on these drawings without creative efforts.
图1为本发明实施例提供的一种便检试纸的检测方法的一个具体示例的流程图;1 is a flowchart of a specific example of a method for detecting a urine test paper provided by an embodiment of the present invention;
图2为本发明实施例提供的一种便检试纸的检测方法的一个具体示例的边缘检测图像;FIG. 2 is an edge detection image of a specific example of a method for detecting a test strip provided by an embodiment of the present invention;
图3为本发明实施例提供的一种便检试纸的检测方法的一个具体示例的矫正后的图像;3 is a corrected image of a specific example of a method for detecting a urine test strip provided by an embodiment of the present invention;
图4为本发明实施例提供的一种便检试纸的检测方法的一个具体示例的二值化处理的图像;4 is a binarized image of a specific example of a method for detecting a urine test strip provided by an embodiment of the present invention;
图5为本发明实施例提供的一种便检试纸的检测方法的一个具体示例的去噪处理后的二值化图像;5 is a binarized image after denoising of a specific example of a method for detecting a urine test strip provided by an embodiment of the present invention;
图6为本发明实施例提供的一种便检试纸的检测方法的一个具体示例的原始图像标志位检测结果图像;FIG. 6 is an original image mark position detection result image of a specific example of a method for detecting a urine test strip provided by an embodiment of the present invention;
图7a、7b分别为本发明实施例提供的一种便检试纸的检测方法的一个具体示例的试纸显色上、下部分区域的图像;Figures 7a and 7b are respectively images of the upper and lower parts of the color of the test paper of a specific example of a method for detecting a urine test paper provided by an embodiment of the present invention;
图8为本发明实施例提供的一种便检试纸的检测系统的模块组成图;FIG. 8 is a module composition diagram of a detection system for a urine test paper provided by an embodiment of the present invention;
图9为本发明实施例提供的一种终端一个具体示例的组成图。FIG. 9 is a composition diagram of a specific example of a terminal according to an embodiment of the present invention.
具体实施方式Detailed ways
下面将结合附图对本发明的技术方案进行清楚、完整地描述,显然,所描述的实施例是本发明一部分实施例,而不是全部的实施例。基于本发明中的实施例,本领域普通技术人员在没有做出创造性劳动前提下所获得的所有其他实施例,都属于本发明保护的范围。The technical solutions of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are a part of the embodiments of the present invention, but not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those of ordinary skill in the art without creative efforts shall fall within the protection scope of the present invention.
在本发明的描述中,需要说明的是,术语“中心”、“上”、“下”、“左”、“右”、“竖直”、“水平”、“内”、“外”等指示的方位或位置关系为基于附图所示的方位或位置关系,仅是为了便于描述本发明和简化描述,而不是指示或暗示所指的装置或元件必须具有特定的方位、以特定的方位构造和操作,因此不能理解为对本发明的限制。此外,术语“第一”、“第二”、“第三”仅用于描述目的,而不能理解为指示或暗示相对重要性。In the description of the present invention, it should be noted that the terms "center", "upper", "lower", "left", "right", "vertical", "horizontal", "inner", "outer", etc. The indicated orientation or positional relationship is based on the orientation or positional relationship shown in the accompanying drawings, which is only for the convenience of describing the present invention and simplifying the description, rather than indicating or implying that the indicated device or element must have a specific orientation or a specific orientation. construction and operation, and therefore should not be construed as limiting the invention. Furthermore, the terms "first", "second", and "third" are used for descriptive purposes only and should not be construed to indicate or imply relative importance.
在本发明的描述中,需要说明的是,除非另有明确的规定和限定,术语“安装”、“相连”、“连接”应做广义理解,例如,可以是固定连接,也可以是可拆卸连接,或一体地连接;可以是机械连接,也可以是电连接;可以是直接相连,也可以通过中间媒介间接相连,还可以是两个元件内部的连通,可以是无线连接,也可以是有线连接。对于本领域的普通技术人员而言,可以具体情况理解上述术语在本发明中的具体含义。In the description of the present invention, it should be noted that the terms "installed", "connected" and "connected" should be understood in a broad sense, unless otherwise expressly specified and limited, for example, it may be a fixed connection or a detachable connection connection, or integral connection; it can be a mechanical connection or an electrical connection; it can be a direct connection or an indirect connection through an intermediate medium, or it can be the internal connection of two components, which can be a wireless connection or a wired connection connect. For those of ordinary skill in the art, the specific meanings of the above terms in the present invention can be understood in specific situations.
此外,下面所描述的本发明不同实施方式中所涉及的技术特征只要彼此之间未构成冲突就可以相互结合。In addition, the technical features involved in the different embodiments of the present invention described below can be combined with each other as long as they do not conflict with each other.
实施例1Example 1
本发明实施例提供的一种便检试纸的检测方法,应用于智能马桶中粪便检测中,便检试纸可以检测潜血、转铁蛋白和幽门螺旋杆菌等,仅以此举例,不以此为限,在实际应用中根据实际需求检测相应的疾病。使用试纸检测并结合图像处理识别检测结果可以方便受检者在家进行自检,为疾病早期发现提供有效的保障。避免了繁琐的程序,不必接触粪便,能够有效避免感染粪便中的病菌,更加安全、实用,是一种非常适用于家庭自检的检测方法,能够实现远程在线检测,为用户带来极大的便利。A method for detecting a stool test paper provided in the embodiment of the present invention is applied to the detection of stool in a smart toilet, and the stool test paper can detect occult blood, transferrin, Helicobacter pylori, etc., which is only an example and not limited to this , and detect corresponding diseases according to actual needs in practical applications. The use of test strip detection combined with image processing to identify the test results can facilitate the subject to conduct self-examination at home and provide an effective guarantee for the early detection of the disease. It avoids cumbersome procedures and does not need to touch feces, which can effectively avoid infection with bacteria in feces. It is safer and more practical. It is a detection method that is very suitable for home self-inspection. It can realize remote online detection and bring great benefits to users. convenient.
如图1所示,本发明实施例提供的一种便检试纸的检测方法,包括如下步骤:As shown in FIG. 1 , a method for detecting a stool test paper provided by an embodiment of the present invention includes the following steps:
步骤S1:获取便检试纸的图像,所述便检试纸的图像包含至少一条试纸的标志位。Step S1 : acquiring an image of the stool inspection test strip, where the image of the stool inspection test strip includes at least one sign of the test strip.
在本发明实施例中,便检试纸的图像获取根据具体情况选择具有摄像拍摄功能的器材,在此不做限制。In the embodiment of the present invention, the image acquisition of the urine test paper selects a device with a camera and shooting function according to the specific situation, which is not limited here.
步骤S2:利用第一预设算法,生成便检试纸图像的矫正图像。Step S2: using the first preset algorithm to generate a corrected image of the stool test strip image.
在本发明实施例中,利用第一预设算法,生成便检试纸图像的矫正图像的步骤,包括:将便检试纸的图像转化为灰度图像,利用预设参数的高斯滤波器,去除灰度图像的噪声,预设参数的选取在此不做限制,根据实际情况进行相应的选取;通过预设边缘检测算法提取去噪后灰度图像的轮廓,通过图像膨胀,填充边缘检测后的图像,预设边缘检测算法在此不作限制,根据实际情况进行相应的选取;利用霍夫变换算法检测填充后边缘检测图像中的边缘线;通过填充后边缘检测图像中的边缘线,计算边缘线的倾斜角度;通过边缘线的倾斜角度,计算填充后边缘检测图像待矫正的旋转角度。以填充后边缘检测图像的中心为旋转中心,结合待矫正的旋转角度,利用第一预设算法生成便检试纸图像的矫正图像,第一预设算法在此不作限制,根据实际情况进行相应的选取。In the embodiment of the present invention, the step of generating a corrected image of the stool test strip image by using the first preset algorithm includes: converting the stool test strip image into a grayscale image, and using a Gaussian filter with preset parameters to remove the grayscale The selection of preset parameters is not limited here, and the corresponding selection is made according to the actual situation; the contour of the denoised grayscale image is extracted through the preset edge detection algorithm, and the image after edge detection is filled through image expansion. , the preset edge detection algorithm is not limited here, and the corresponding selection is made according to the actual situation; the Hough transform algorithm is used to detect the edge line in the edge detection image after filling; the edge line in the image is detected by the edge after filling, and the edge line is calculated. Tilt angle: Calculate the rotation angle of the edge detection image to be corrected after filling according to the tilt angle of the edge line. Taking the center of the edge detection image after filling as the rotation center, combined with the rotation angle to be corrected, the first preset algorithm is used to generate a corrected image of the test strip image. The first preset algorithm is not limited here, and the corresponding Select.
在一具体实施例中,为了矫正图像,需要先计算图像的旋转角度。首先,将原始的彩色图像(便检试纸的图像)转化成灰度图像,并使用高斯滤波器去噪以免影响边缘检测,其中,高斯滤波器中的卷积核设置成(9,9)。然后,使用Canny检测算法检测图像轮廓,设置检测阈值为(1,20),提取图像轮廓,并通过图像膨胀,填充边缘检测后的图像,设置图像膨胀的卷积核参数为(5,5)。最后,通过霍夫变换检测图像中的边缘线,计算边缘线的倾斜角度,进而计算图像要矫正的旋转角度。In a specific embodiment, in order to correct the image, the rotation angle of the image needs to be calculated first. First, convert the original color image (the image of the test paper) into a grayscale image, and use a Gaussian filter to denoise it so as not to affect the edge detection, where the convolution kernel in the Gaussian filter is set to (9,9). Then, use the Canny detection algorithm to detect the image contour, set the detection threshold to (1,20), extract the image contour, and fill the edge-detected image through image expansion, and set the convolution kernel parameter of image expansion to (5,5) . Finally, the edge lines in the image are detected by Hough transform, the inclination angle of the edge lines is calculated, and then the rotation angle to be corrected by the image is calculated.
在一具体实施例中,如图2所示,为边缘检测后的图像,图中红框内的边缘线即为霍夫变换需要检测的边缘直线,计算此直线与垂直方向的夹角,即为矫正图像需要的旋转角度。In a specific embodiment, as shown in FIG. 2, it is an image after edge detection, and the edge line in the red frame in the figure is the edge straight line that needs to be detected by Hough transform, and the angle between this straight line and the vertical direction is calculated, that is, The angle of rotation needed to rectify the image.
在一具体实施例中,以图像的中心为旋转中心,结合旋转角度,并使用OpenCV库的getRotationMatrix2D函数获取旋转变换矩阵,使用OpenCV库的warpAffine仿射变换函数得到旋转后的图像,如图3所示,矫正后的空白区域使用白色填充,以便后续计算。In a specific embodiment, take the center of the image as the rotation center, combine the rotation angle, and use the getRotationMatrix2D function of the OpenCV library to obtain the rotation transformation matrix, and use the warpAffine affine transformation function of the OpenCV library to obtain the rotated image, as shown in Figure 3. As shown, the corrected blank area is filled with white for subsequent calculation.
步骤S3:利用矫正图像中每一条试纸的标志位,提取检测试纸的显色结果区域。Step S3 : extracting the color development result area of the detection test strip by using the flag bit of each test strip in the corrected image.
在本发明实施例中,对旋转后的图像分别进行二值化处理、腐蚀及膨胀处理、均值滤波处理,生成去噪后的二值化图像;利用第二预设算法,其中,第二预设算法在此不作限制,根据实际情况进行相应的选取。检测去噪后的二值化图像中的若干黑色区域,所述黑色区域的矩形轮廓对应,旋转后的图像中每一条试纸所对应的黑色区域,所述图像中每一条试纸均有一个黑色区域,黑色区域为每一条试纸的标志位。In the embodiment of the present invention, the rotated image is subjected to binarization processing, erosion and expansion processing, and mean filtering processing, respectively, to generate a binarized image after denoising; the second preset algorithm is used, wherein the second preset algorithm is used. The design method is not limited here, and the corresponding selection is made according to the actual situation. Detect several black areas in the binarized image after denoising, the rectangular outline of the black area corresponds to the black area corresponding to each test strip in the rotated image, and each test strip in the image has a black area , the black area is the sign of each test strip.
在本发明实施例中,试纸的显色结果区域分为上、下两部分。通过第三预设算法,检测上、下两部分区域是否分别含有红色线,判断试纸的检测结果,第三预设算法在此不作限制,根据实际情况进行相应的选取。In the embodiment of the present invention, the color development result area of the test paper is divided into upper and lower parts. The third preset algorithm is used to detect whether the upper and lower regions contain red lines respectively, and the detection result of the test strip is judged. The third preset algorithm is not limited here, and is selected according to the actual situation.
在一具体实施例中,观察旋转后的图像,由于每一次拍摄照片位置并不固定,因此,需要定位每一条试纸的位置。图像中每一条试纸均有一个黑色区域,将该黑色区域定为每一条试纸的标志位。In a specific embodiment, when observing the rotated image, since the position of each shot is not fixed, it is necessary to locate the position of each test strip. Each test strip in the image has a black area, and the black area is set as the mark position of each test strip.
在一具体实施例中,首先,对旋转后的图像二值化处理,由于图像像素点的阈值为0到255,设置检测阈值为65(实验得出),即将图像中大于阈值的像素点的值改为255,小于或等于阈值的像素点的值改为0。二值化处理的图像如图4所示。In a specific embodiment, first, for the binarization of the rotated image, since the threshold of the image pixel points is 0 to 255, the detection threshold is set to 65 (obtained by experiments), that is, the pixel points in the image larger than the threshold value are set to 65. The value is changed to 255, and the value of pixels less than or equal to the threshold is changed to 0. The binarized image is shown in Figure 4.
在一具体实施例中,如图4所示,三个黑色的矩形区域即为旋转后的图像中每一条试纸所对应的黑色区域,而二值化处理后的图像中还包含其它干扰区域,因此,通过对图像进行腐蚀和膨胀处理,去除图像中的孤立点,设置膨胀和腐蚀卷积核参数为(5,5),然后通过均值滤波,进一步去除孤立点,消除图像中的孤立点噪声,设置均值滤波卷积核参数为(13,13),此参数根据实际情况进行选取,去噪处理后的二值化图像如图5所示。In a specific embodiment, as shown in FIG. 4 , the three black rectangular areas are the black areas corresponding to each test strip in the rotated image, and the binarized image also includes other interference areas, Therefore, by performing erosion and dilation processing on the image, the outliers in the image are removed, and the dilation and erosion convolution kernel parameters are set to (5, 5), and then the outliers are further removed by mean filtering, and the outlier noise in the image is eliminated. , set the mean filter convolution kernel parameter to (13,13), this parameter is selected according to the actual situation, and the binarized image after denoising is shown in Figure 5.
最后,使用OpenCV库的findContours函数,检测图5中三个黑色区域的矩形轮廓,并返回每一个矩形轮廓x、y、w、h四个参数,其中x和y表示轮廓的左侧顶点坐标,w表示矩形轮廓的宽,h表示矩形轮廓的高,检测黑色区域的矩形轮廓对应原始图像位置如图6所示。Finally, use the findContours function of the OpenCV library to detect the rectangular contours of the three black areas in Figure 5, and return each rectangular contour x, y, w, h four parameters, where x and y represent the coordinates of the left vertex of the contour, w represents the width of the rectangular outline, h represents the height of the rectangular outline, and the rectangular outline of the detected black area corresponds to the original image position as shown in Figure 6.
步骤S4:分别对每一条试纸显色结果区域进行识别判断,生成每一条试纸相应的检测结果。Step S4: Identifying and judging the color development result area of each test strip respectively, and generating a corresponding detection result for each test strip.
在一具体实施例中,检测出每一条试纸的位置,而试纸显色结果区域在图6中红色框下方固定区域,因此,需要对红色框下方区域进行分割提取,由于每一条试纸显色结果最多会出现两条红线,因此,将每一条试纸的显色结果区域分割成上下两部分提取,如图7所示为第一条检测试纸的上下两部分显色区域。检测每一部分显色区域是否有红色线来判断结果。In a specific embodiment, the position of each test paper is detected, and the color development result area of the test paper is a fixed area under the red frame in FIG. There will be at most two red lines. Therefore, the color development area of each test strip is divided into upper and lower parts for extraction. As shown in Figure 7, the color development area of the upper and lower parts of the first test strip is shown. Check whether there is a red line in each part of the color area to judge the result.
识别图7中的两部分试纸显色区域图像是否含有红色线,因此,需要将彩色的RGB图像转化成HSV图像,HSV图像即使用色调(Hue)、饱和度(Saturation)和明度(Value)来表示色彩的一种方式,H的取值范围(0-180),S的取值范围(0-255),V的取值范围(0-255),其中红色的表示方法是设置H(0-10)、S(43-255)、V(46-255)和H(156-180)、S(43-255)、V(46-255)两种方式,通过检测转化成HSV图像中是否含有该红色阈值中的像素点,以此来检测图7中的上下两部分区域是否分别含有红色线,来判断试纸的检测结果。Identify whether the two-part test paper color area image in Figure 7 contains red lines. Therefore, it is necessary to convert the colored RGB image into an HSV image. The HSV image uses Hue, Saturation, and Value. A way to represent color, the value range of H (0-180), the value range of S (0-255), the value range of V (0-255), and the red representation method is to set H(0 -10), S(43-255), V(46-255) and H(156-180), S(43-255), V(46-255), by detecting whether the HSV image is converted into The pixels in the red threshold are included, so as to detect whether the upper and lower regions in FIG. 7 contain red lines respectively, so as to judge the detection result of the test paper.
在本发明实施例中,若上下两部分区域均没有红色的线或者只有下部分有红色的线,则检测结果为无效;若上部分有红色的线,下部分没有红色的线,则检测结果为阴性;若上下两部分均有红色的线,则检测结果为阳性。以此判断方法来识别每一条试纸的最终结果。In the embodiment of the present invention, if there is no red line in the upper and lower parts or only the lower part has a red line, the detection result is invalid; if there is a red line in the upper part and no red line in the lower part, the detection result is invalid. Negative; if there are red lines on the upper and lower parts, the test result is positive. This judgment method is used to identify the final result of each test strip.
本发明实施例中提供的便检试纸的检测方法,可以准确的识别图像中试纸的显色结果,在不同的便检试纸图像检测上具有较好的识别效果,算法适应性强,参数结构简单,线性的计算复杂度低。The detection method of the stool test paper provided in the embodiment of the present invention can accurately identify the color development result of the test paper in the image, has a good recognition effect in the detection of different stool test paper images, has strong algorithm adaptability, and simple parameter structure , the linear computational complexity is low.
实施例2Example 2
本发明实施例提供一种便检试纸的检测系统,如图8所示,包括:An embodiment of the present invention provides a detection system for a stool test paper, as shown in FIG. 8 , including:
样本获取模块1,用于获取便检试纸的图像,所述便检试纸的图像包含至少一条试纸的标志位;此模块执行实施例1中的步骤S1所描述的方法,在此不再赘述。The
见证图像生成模块2,用于利用第一预设算法,生成便检试纸图像的矫正图像;此模块执行实施例1中的步骤S2所描述的方法,在此不再赘述。The witness
显色结果区域的提取模块3,用于利用矫正图像中每一条试纸的标志位,提取检测试纸的显色结果区域;此模块执行实施例1中的步骤S3所描述的方法,在此不再赘述。The
检测结果的生成模块4,用于分别对每一条试纸显色结果区域进行识别判断,生成每一条试纸相应的检测结果;此模块执行实施例1中的步骤S4所描述的方法,在此不再赘述。The detection result generation module 4 is used for identifying and judging the color development result area of each test strip respectively, and generating the corresponding detection result of each test strip; this module executes the method described in step S4 in
本发明实施例提供一种便检试纸的检测系统,可以准确的识别图像中试纸的显色结果,在不同的便检试纸图像检测上具有较好的识别效果,算法适应性强,参数结构简单,线性的计算复杂度低。The embodiment of the present invention provides a detection system for stool test strips, which can accurately identify the color development results of the test strips in images, has a better recognition effect in the detection of different stool test strip images, has strong algorithm adaptability, and simple parameter structure , the linear computational complexity is low.
实施例3Example 3
本发明实施例提供一种终端,如图9所示,包括:至少一个处理器401,例如CPU(Central Processing Unit,中央处理器),至少一个通信接口403,存储器404,至少一个通信总线402。其中,通信总线402用于实现这些组件之间的连接通信。其中,通信接口403可以包括显示屏(Display)、键盘(Keyboard),可选通信接口403还可以包括标准的有线接口、无线接口。存储器404可以是高速RAM存储器(Random Access Memory,易挥发性随机存取存储器),也可以是非易失性存储器(non-volatile memory),例如至少一个磁盘存储器。存储器404可选的还可以是至少一个位于远离前述处理器401的存储装置。其中处理器401可以执行实施例1中的便检试纸的检测方法。存储器404中存储一组程序代码,且处理器401调用存储器404中存储的程序代码,以用于执行实施例1中的便检试纸的检测方法。其中,通信总线402可以是外设部件互连标准(peripheral component interconnect,简称PCI)总线或扩展工业标准结构(extended industry standard architecture,简称EISA)总线等。通信总线402可以分为地址总线、数据总线、控制总线等。为便于表示,图9中仅用一条线表示,但并不表示仅有一根总线或一种类型的总线。其中,存储器404可以包括易失性存储器(英文:volatile memory),例如随机存取存储器(英文:random-access memory,缩写:RAM);存储器也可以包括非易失性存储器(英文:non-volatile memory),例如快闪存储器(英文:flash memory),硬盘(英文:hard disk drive,缩写:HDD)或固降硬盘(英文:solid-statedrive,缩写:SSD);存储器404还可以包括上述种类的存储器的组合。其中,处理器401可以是中央处理器(英文:central processing unit,缩写:CPU),网络处理器(英文:networkprocessor,缩写:NP)或者CPU和NP的组合。An embodiment of the present invention provides a terminal, as shown in FIG. 9 , including: at least one
其中,存储器404可以包括易失性存储器(英文:volatile memory),例如随机存取存储器(英文:random-access memory,缩写:RAM);存储器也可以包括非易失性存储器(英文:non-volatile memory),例如快闪存储器(英文:flash memory),硬盘(英文:hard diskdrive,缩写:HDD)或固态硬盘(英文:solid-state drive,缩写:SSD);存储器404还可以包括上述种类的存储器的组合。The
其中,处理器401可以是中央处理器(英文:central processing unit,缩写:CPU),网络处理器(英文:network processor,缩写:NP)或者CPU和NP的组合。The
其中,处理器401还可以进一步包括硬件芯片。上述硬件芯片可以是专用集成电路(英文:application-specific integrated circuit,缩写:ASIC),可编程逻辑器件(英文:programmable logic device,缩写:PLD)或其组合。上述PLD可以是复杂可编程逻辑器件(英文:complex programmable logic device,缩写:CPLD),现场可编程逻辑门阵列(英文:field-programmable gate array,缩写:FPGA),通用阵列逻辑(英文:generic arraylogic,缩写:GAL)或其任意组合。The
可选地,存储器404还用于存储程序指令。处理器401可以调用程序指令,实现如本申请执行实施例1中的便检试纸的检测方法。Optionally,
本发明实施例还提供一种计算机可读存储介质,计算机可读存储介质上存储有计算机可执行指令,该计算机可执行指令可执行实施例1中的便检试纸的检测方法。其中,所述存储介质可为磁碟、光盘、只读存储记忆体(Read-Only Memory,ROM)、随机存储记忆体(Random Access Memory,RAM)、快闪存储器(Flash Memory)、硬盘(Hard Disk Drive,缩写:HDD)或固态硬盘(Solid-State Drive,SSD)等;所述存储介质还可以包括上述种类的存储器的组合。Embodiments of the present invention further provide a computer-readable storage medium, where computer-executable instructions are stored on the computer-readable storage medium, and the computer-executable instructions can execute the method for detecting a stool test paper in
显然,上述实施例仅仅是为清楚地说明所作的举例,而并非对实施方式的限定。对于所属领域的普通技术人员来说,在上述说明的基础上还可以做出其它不同形式的变化或变动。这里无需也无法对所有的实施方式予以穷举。而由此所引申出的显而易见的变化或变动仍处于本发明创造的保护范围之中。Obviously, the above-mentioned embodiments are only examples for clear description, and are not intended to limit the implementation manner. For those of ordinary skill in the art, changes or modifications in other different forms can also be made on the basis of the above description. There is no need and cannot be exhaustive of all implementations here. However, the obvious changes or changes derived from this are still within the protection scope of the present invention.
Claims (10)
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202210355742.0A CN115096878A (en) | 2022-04-06 | 2022-04-06 | A kind of detection method and system of stool test paper |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202210355742.0A CN115096878A (en) | 2022-04-06 | 2022-04-06 | A kind of detection method and system of stool test paper |
Publications (1)
Publication Number | Publication Date |
---|---|
CN115096878A true CN115096878A (en) | 2022-09-23 |
Family
ID=83287196
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202210355742.0A Pending CN115096878A (en) | 2022-04-06 | 2022-04-06 | A kind of detection method and system of stool test paper |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN115096878A (en) |
Citations (7)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JP2007295210A (en) * | 2006-04-25 | 2007-11-08 | Sharp Corp | Image processing apparatus, image processing method, image processing program, and recording medium recording the program |
US20140154789A1 (en) * | 2011-03-31 | 2014-06-05 | Neil Polwart | Testing apparatus |
WO2016150134A1 (en) * | 2015-03-21 | 2016-09-29 | 杨轶轩 | Test paper reading method, and pregnancy test and ovulation test method therefor |
US20170103543A1 (en) * | 2015-10-09 | 2017-04-13 | Sysmex Corporation | Test piece analyzing apparatus and test piece analyzing method |
CN111504985A (en) * | 2020-03-07 | 2020-08-07 | 云南省烟草质量监督检测站 | Method for evaluating quality stability of pesticide residue quick test paper |
CN113450383A (en) * | 2021-06-29 | 2021-09-28 | 华中科技大学 | Quantitative analysis method, device, equipment and medium for immunochromatographic test paper |
US20220084659A1 (en) * | 2020-09-17 | 2022-03-17 | Scanwell Health, Inc. | Diagnostic test kits and methods of analyzing the same |
-
2022
- 2022-04-06 CN CN202210355742.0A patent/CN115096878A/en active Pending
Patent Citations (7)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JP2007295210A (en) * | 2006-04-25 | 2007-11-08 | Sharp Corp | Image processing apparatus, image processing method, image processing program, and recording medium recording the program |
US20140154789A1 (en) * | 2011-03-31 | 2014-06-05 | Neil Polwart | Testing apparatus |
WO2016150134A1 (en) * | 2015-03-21 | 2016-09-29 | 杨轶轩 | Test paper reading method, and pregnancy test and ovulation test method therefor |
US20170103543A1 (en) * | 2015-10-09 | 2017-04-13 | Sysmex Corporation | Test piece analyzing apparatus and test piece analyzing method |
CN111504985A (en) * | 2020-03-07 | 2020-08-07 | 云南省烟草质量监督检测站 | Method for evaluating quality stability of pesticide residue quick test paper |
US20220084659A1 (en) * | 2020-09-17 | 2022-03-17 | Scanwell Health, Inc. | Diagnostic test kits and methods of analyzing the same |
CN113450383A (en) * | 2021-06-29 | 2021-09-28 | 华中科技大学 | Quantitative analysis method, device, equipment and medium for immunochromatographic test paper |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN110866924B (en) | Line structured light center line extraction method and storage medium | |
CN108577803B (en) | Fundus image detection method, device and system based on machine learning | |
EP3620981A1 (en) | Object detection method, device, apparatus and computer-readable storage medium | |
CN114897864B (en) | Workpiece detection and defect judgment method based on digital model information | |
CN113362331A (en) | Image segmentation method and device, electronic equipment and computer storage medium | |
JP6115214B2 (en) | Pattern processing apparatus, pattern processing method, and pattern processing program | |
JP4908440B2 (en) | Image processing apparatus and method | |
CN104700062A (en) | Method and equipment for identifying two-dimension code | |
CN113557520B (en) | Character processing and character recognition method, storage medium and terminal device | |
CN110866932A (en) | Multi-channel tongue edge detection device and method and storage medium | |
CN113785181A (en) | OLED screen point defect judgment method and device, storage medium and electronic equipment | |
CN111220235A (en) | Water level monitoring method and device | |
CN113689412A (en) | Thyroid image processing method, device, electronic device and storage medium | |
CN110827308A (en) | Image processing method, device, electronic device and storage medium | |
CN109754423B (en) | A kind of extraction method and equipment of leaf disease spot coverage area | |
CN112419207A (en) | Image correction method, device and system | |
JP4599110B2 (en) | Image processing apparatus and method, imaging apparatus, and program | |
CN112529923B (en) | Control identification method and device | |
CN115272362A (en) | Method and device for segmenting effective area of digital pathology full-field image | |
CN114972209A (en) | Cervical pathology image processing method and device | |
CN113298803A (en) | Magnet piece detection method, system, equipment and computer readable storage medium | |
CN115096878A (en) | A kind of detection method and system of stool test paper | |
CN111091895B (en) | Breast image analysis method, system and non-transitory computer readable medium | |
CN112801112B (en) | Image binarization processing method, device, medium and equipment | |
CN112614146B (en) | Method and device for judging chessboard calibration corner points and computer readable storage medium |
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 |