技术领域technical field
本发明涉及数字图像处理技术,特别是涉及到自动图像识别中的图像分割领域。The invention relates to digital image processing technology, in particular to the field of image segmentation in automatic image recognition.
背景技术Background technique
图像识别,是指利用计算机对图像进行处理、分析和理解,以识别各种不同模式的目标和对像的技术。一般工业使用中,采用工业相机拍摄图片,然后再利用软件根据图片灰阶差做进一步识别处理,图像识别软件国外代表的有康耐视等,国内代表的有图智能等。另外在地理学中指将遥感图像进行分类的技术。Image recognition refers to the technology of using computers to process, analyze and understand images to identify targets and objects in various patterns. In general industrial use, industrial cameras are used to take pictures, and then software is used for further recognition processing according to the gray scale difference of the pictures. Image recognition software is represented abroad by Cognex, etc., and domestically represented by Youtu Smart. In addition, in geography, it refers to the technology of classifying remote sensing images.
图像识别技术是人工智能的一个重要领域。为了编制模拟人类图像识别活动的计算机程序,人们提出了不同的图像识别模型。例如模板匹配模型。这种模型认为,识别某个图像,必须在过去的经验中有这个图像的记忆模式,又叫模板。当前的刺激如果能与大脑中的模板相匹配,这个图像也就被识别了。例如有一个字母A,如果在脑中有个A模板,字母A的大小、方位、形状都与这个A模板完全一致,字母A就被识别了。图像识别中的模式识别(PatternRecognition),是一种从大量信息和数据出发,在专家经验和已有认识的基础上,利用计算机和数学推理的方法对形状、模式、曲线、数字、字符格式和图形自动完成识别、评价的过程。模式识别包括两个阶段,即学习阶段和实现阶段,前者是对样本进行特征选择,寻找分类的规律,后者是根据分类规律对未知样本集进行分类和识别。这个模式识别的模板匹配模型简单明了,也容易得到实际应用。但这种模型强调图像必须与脑中的模板完全符合才能加以识别,而事实上人不仅能识别与脑中的模板完全一致的图像,也能识别与模板不完全一致的图像。Image recognition technology is an important field of artificial intelligence. In order to compile computer programs that simulate human image recognition activities, different image recognition models have been proposed. For example template matching models. This model believes that to recognize an image, there must be a memory pattern of this image in past experience, also called a template. If the current stimulus can match the template in the brain, the image will be recognized. For example, if there is a letter A, if there is an A template in the brain, and the size, orientation, and shape of the letter A are exactly the same as the A template, the letter A will be recognized. Pattern Recognition in image recognition is a method of analyzing shapes, patterns, curves, numbers, character formats and Graphics automatically complete the process of identification and evaluation. Pattern recognition includes two stages, that is, the learning stage and the realization stage. The former is to select the characteristics of the sample and find the classification law, and the latter is to classify and identify the unknown sample set according to the classification law. The template matching model of this pattern recognition is simple and clear, and it is easy to be applied in practice. However, this model emphasizes that the image must be completely consistent with the template in the brain before it can be recognized. In fact, people can not only recognize images that are completely consistent with the template in the brain, but also recognize images that are not completely consistent with the template.
一般说来,图像识别的第一步是对图像进行自动分割,即通过计算机将图片分割成不同的区域,然后进一步处理后才能进行图像的识别。现有的图像分割方法包括:基于轮廓跟踪的方法、基于区域竞争的方法、基于目标轮廓的方法、基于均值漂移的方法、基于图论的方法,以及基于学习的分割方法。如何评价分割结果的质量,以及如何根据评价结果进行改善是多数现有方法所忽略的问题。Generally speaking, the first step of image recognition is to automatically segment the image, that is, the image is divided into different regions by the computer, and then the image can be recognized after further processing. Existing image segmentation methods include: methods based on contour tracking, methods based on region competition, methods based on object contours, methods based on mean shift, methods based on graph theory, and segmentation methods based on learning. How to evaluate the quality of the segmentation results and how to improve them based on the evaluation results are issues that most existing methods ignore.
对图像分割结果的评价目前主要是基于监督的评价方法,也就是将分割结果与利用人手工分割得到的实况(ground true)图像进行比较。监督型评价方法的最主要问题是实况图像的获取。首先,每一张图像都需要人通过手工勾画进行分割,工作量巨大,特别是对于图片数量不断增长的大容量图像库来说,这种方法难以实际应用。此外,由于不同人对同一图像的理解有差异,人工分割的结果往往不尽相同,这也影响了对图像分割质量评价的客观性。而如果采用面向灰度图像分割结果的非监督型评价方法,它对区域的纹理特征进行了分析,但并未考虑颜色信息、因此纹理特征较为简单。还有例如使用的标准方差法,但这种基于统计的方法过于粗糙,很多情况下具有相同方差的区域其纹理特征实际相差仍然较大。The evaluation of image segmentation results is currently mainly based on the evaluation method of supervision, that is, the segmentation results are compared with the real (ground true) images obtained by manual segmentation. The main problem of supervised evaluation methods is the acquisition of live images. First of all, each image needs to be segmented by manual drawing, which is a huge workload, especially for a large-capacity image library with an increasing number of pictures, this method is difficult to apply in practice. In addition, because different people have different understandings of the same image, the results of manual segmentation are often not the same, which also affects the objectivity of image segmentation quality evaluation. However, if the non-supervised evaluation method for gray image segmentation results is used, it analyzes the texture features of the region, but does not consider the color information, so the texture features are relatively simple. There is also the standard variance method used, for example, but this method based on statistics is too rough, and in many cases the texture features of regions with the same variance are still quite different.
发明内容Contents of the invention
本发明的目的在于克服现有技术中的图像分割方法工作量较大、效率低;或者未考虑颜色信息、因此纹理特征较为简单等缺点,提供一种自动图像分割方法及其装置The purpose of the present invention is to overcome the shortcomings of the image segmentation method in the prior art, such as large workload and low efficiency; or the color information is not considered, so the texture features are relatively simple, etc., to provide an automatic image segmentation method and its device
为解决上述技术问题,本发明采用如下技术方案。In order to solve the above technical problems, the present invention adopts the following technical solutions.
一种自动图像分割方法,所述方法包括以下步骤:An automatic image segmentation method, said method comprising the following steps:
A、基于图论方法进行图像像素划分,由此将图像分割为不同区域;A. Based on the graph theory method, image pixels are divided, thereby dividing the image into different regions;
B、对图像分割的区域进行欠分割检测,修正图像分割区域;B. Under-segmentation detection is performed on the image segmented area, and the image segmented area is corrected;
C、分析欠分割检测并修正后的图像分割区域两两之间的近似度,如果足够近似则进行图像分割区域的合并。C. Analyzing the similarity between the image segmentation regions detected and corrected by under-segmentation, and merging the image segmentation regions if they are similar enough.
其中,所述基于图论方法进行图像像素划分包括:Wherein, the image pixel division based on the graph theory method includes:
A1、利用欧式距离方法计算两个相邻像素之间的颜色相似度:A1. Use the Euclidean distance method to calculate the color similarity between two adjacent pixels:
r′=(R1+R2)/2;r'=(R1 +R2 )/2;
ΔR=R1-R2;ΔR=R1 -R2 ;
ΔG=G1-G2;ΔG=G1 -G2 ;
ΔB=B1-B2;ΔB=B1 -B2 ;
其中R1和R2为两个像素各自的红色值;G1和G2为两个像素各自的绿色值;B1和B2为两个像素各自的蓝色值;Where R1 and R2 are the respective red values of the two pixels; G1 and G2 are the respective green values of the two pixels; B1 and B2 are the respective blue values of the two pixels;
Sc为两个像素之间的颜色相似度;Sc is the color similarity between two pixels;
A2、当两个像素的颜色相似度低于第一预定阈值时,将这两个像素归入同一区域。A2. When the color similarity of two pixels is lower than the first predetermined threshold, classify the two pixels into the same area.
另外,所述图像分割的区域进行欠分割检测,修正图像分割区域的步骤包括:In addition, the region of the image segmentation is under-segmented and detected, and the step of correcting the image segmentation region includes:
B1、对当前图像分割区域中的像素进行多次随机取样,每次随机采样获得两个像素;B1. Perform multiple random samplings on the pixels in the current image segmentation area, and obtain two pixels in each random sampling;
B2、对每次取样得到两个像素,取得这两个像素的邻域矩形小区域;B2, two pixels are obtained for each sampling, and a small rectangular area adjacent to these two pixels is obtained;
B3、对这两个像素的邻域矩形小区域,分别统计其中所有像素的颜色直方图,计算两个颜色直方图的相似值;B3, for the neighborhood rectangular small area of these two pixels, count the color histograms of all pixels therein respectively, calculate the similarity value of two color histograms;
B3、对多次取样后的两个像素,分别重复B2、B3步骤,将每次得到的颜色直方图相似值进行排序,将前1/4大小的颜色直方图相似值的均值和后1/4大小的颜色直方图相似值的均值进行比较,当差值超过所有颜色直方图相似值的均值的一半时,判断为欠分割,需要对所述图像分割的区域进行重新分割。B3. For the two pixels after multiple samplings, repeat steps B2 and B3 respectively, sort the similarity values of the color histograms obtained each time, and compare the mean value and the last 1/4 of the similarity values of the color histograms of the size of the first 1/4 4 size color histogram similarity values are compared, when the difference exceeds half of the mean value of all color histogram similarity values, it is judged as under-segmentation, and the image segmented region needs to be re-segmented.
并且所述图像划分的区域进行欠分割检测,修正图像分割区域的步骤还包括:And the region divided by the image is under-segmented and detected, and the step of correcting the segmented region of the image also includes:
B4、当需要对所述图像划分的区域进行重新分割时,对所述图像划分的区域内的像素再次执行步骤A1、A2,其中对步骤A2中的第一预定阈值予以下调。B4. When it is necessary to re-segment the divided region of the image, execute steps A1 and A2 again for the pixels in the divided region of the image, wherein the first predetermined threshold in step A2 is lowered.
其中,步骤B1中将当前图像分割区域中进行随机采样的次数取决于当前图像分割区域中的总像素点数量,总像素点数量越多,则需要进行随机采样的次数越多。Wherein, in step B1, the number of times of random sampling in the segmented area of the current image depends on the total number of pixels in the segmented area of the current image, the more the total number of pixels, the more times of random sampling required.
另外,所述分析欠分割检测并修正后的图像分割区域两两之间的近似度,如果足够近似则进行图像分割区域的合并的步骤包括:In addition, the step of analyzing the similarity between the image segmentation regions detected and corrected by the under-segmentation, and if the approximation is sufficient, the step of merging the image segmentation regions includes:
C1、对两个欠分割检测并修正后的图像分割区域中分别进行多次窗口采样,每次窗口采样后分别得到两个颜色直方图,然后计算这两个颜色直方图的颜色直方图相似值;C1. Perform multiple window samples in the two under-segmentation detected and corrected image segmentation areas, and obtain two color histograms after each window sampling, and then calculate the color histogram similarity value of the two color histograms ;
C2、对多次取样的颜色直方图相似值取平均数,作为两个子区域的总体平均相似度。若该平均相似度低于第二预定阈值,则将两个欠分割检测并修正后的图像分割区域进行合并。C2. Take the average of the similarity values of the color histograms sampled multiple times, and use it as the overall average similarity of the two sub-regions. If the average similarity is lower than the second predetermined threshold, the two under-segmented detected and corrected image segmented regions are merged.
本发明还包括一种自动图像分割装置,所述自动图像分割装置包括:The present invention also includes an automatic image segmentation device, which includes:
图像预分割单元,用于基于图论方法进行图像像素划分,由此将图像分割为不同区域;The image pre-segmentation unit is used to divide the image pixels based on the graph theory method, thereby dividing the image into different regions;
欠分割检测单元,用于对图像分割的区域进行欠分割检测,修正图像分割区域;The under-segmentation detection unit is used to perform under-segmentation detection on the region of image segmentation, and correct the image segmentation region;
过分割补偿单元,用于分析欠分割检测并修正后的图像分割区域两两之间的近似度,如果足够近似则进行图像分割区域的合并。The over-segmentation compensation unit is used to analyze the similarity between the image segmented regions after under-segmentation detection and correction, and merge the image segmented regions if they are similar enough.
首先,通过本发明的自动图像分割方法和装置,能够实现快速、准确、可靠的图像区域分割,并使分割结果更加接近人的视觉效果。其次,本发明的自动图像分割方法和装置的随机取样的过程保证了在较小计算量的前提下对整个区域的覆盖,每一次取样计算的是取样窗口内所有像素颜色的统计值,因此本发明的自动图像分割方法和装置能够综合了颜色与纹理两种特征的方法的优点。First, through the automatic image segmentation method and device of the present invention, fast, accurate and reliable image region segmentation can be realized, and the segmentation result is closer to human visual effect. Secondly, the random sampling process of the automatic image segmentation method and device of the present invention ensures the coverage of the entire area under the premise of a small amount of calculation, and each sampling calculation is the statistical value of all pixel colors in the sampling window, so this The invented automatic image segmentation method and device can combine the advantages of the two feature methods of color and texture.
附图说明Description of drawings
图1是根据本发明具体实施方式的自动图像分割方法的流程示意图。Fig. 1 is a schematic flowchart of an automatic image segmentation method according to a specific embodiment of the present invention.
图2是根据本发明具体实施方式的自动图像分割方法中确定相邻像素方法的示意图。Fig. 2 is a schematic diagram of a method for determining adjacent pixels in an automatic image segmentation method according to a specific embodiment of the present invention.
图3是本发明具体实施方式的自动图像分割装置的结构示意图。Fig. 3 is a schematic structural diagram of an automatic image segmentation device according to a specific embodiment of the present invention.
具体实施方式Detailed ways
下面结合附图,对本发明作详细说明。The present invention will be described in detail below in conjunction with the accompanying drawings.
以下公开详细的示范实施例。然而,此处公开的具体结构和功能细节仅仅是出于描述示范实施例的目的。Detailed exemplary embodiments are disclosed below. However, specific structural and functional details disclosed herein are merely for purposes of describing example embodiments.
然而,应该理解,本发明不局限于公开的具体示范实施例,而是覆盖落入本公开范围内的所有修改、等同物和替换物。在对全部附图的描述中,相同的附图标记表示相同的元件。It should be understood, however, that the invention is not limited to the particular exemplary embodiments disclosed, but covers all modifications, equivalents, and alternatives falling within the scope of the disclosure. Throughout the description of the figures, the same reference numerals denote the same elements.
参阅附图,本说明书所附图式所绘示的结构、比例、大小等,均仅用以配合说明书所揭示的内容,以供熟悉此技术的人士了解与阅读,并非用以限定本发明可实施的限定条件,故不具技术上的实质意义,任何结构的修饰、比例关系的改变或大小的调整,在不影响本发明所能产生的功效及所能达成的目的下,均应仍落在本发明所揭示的技术内容得能涵盖的范围内。同时,本说明书中所引用的位置限定用语,亦仅为便于叙述的明了,而非用以限定本发明可实施的范围,其相对关系的改变或调整,在无实质变更技术内容下,当亦视为本发明可实施的范畴。Referring to the accompanying drawings, the structures, proportions, sizes, etc. shown in the accompanying drawings of this specification are only used to match the content disclosed in the specification, for those who are familiar with this technology to understand and read, and are not used to limit the scope of the present invention. Therefore, it has no technical substantive meaning, and any modification of structure, change of proportional relationship or adjustment of size shall still fall within the scope of The technical content disclosed in the present invention must be within the scope covered. At the same time, the position-limiting terms quoted in this specification are only for the convenience of description, and are not used to limit the scope of the present invention. The change or adjustment of the relative relationship shall be regarded as the same without substantial change in the technical content. It is regarded as the scope in which the present invention can be practiced.
同时应该理解,如在此所用的术语“和/或”包括一个或多个相关的列出项的任意和所有组合。另外应该理解,当部件或单元被称为“连接”或“耦接”到另一部件或单元时,它可以直接连接或耦接到其他部件或单元,或者也可以存在中间部件或单元。此外,用来描述部件或单元之间关系的其他词语应该按照相同的方式理解(例如,“之间”对“直接之间”、“相邻”对“直接相邻”等)。Also, it should be understood that as used herein, the term "and/or" includes any and all combinations of one or more of the associated listed items. Also it will be understood that when a component or unit is referred to as being “connected” or “coupled” to another component or unit, it can be directly connected or coupled to the other component or unit or intervening components or units may also be present. Also, other words used to describe the relationship between elements or elements should be interpreted in the same fashion (eg, "between" versus "directly between," "adjacent" versus "directly adjacent," etc.).
如图1所示,本发明具体实施方式中包括了一种自动图像分割方法,所述方法包括以下步骤:As shown in Figure 1, a kind of automatic image segmentation method is included in the specific embodiment of the present invention, and described method comprises the following steps:
A、基于图论方法进行图像像素划分,由此将图像分割为不同区域;A. Based on the graph theory method, image pixels are divided, thereby dividing the image into different regions;
B、对图像分割的区域进行欠分割检测,修正图像分割区域;B. Under-segmentation detection is performed on the image segmented area, and the image segmented area is corrected;
C、分析欠分割检测并修正后的图像分割区域两两之间的近似度,如果足够近似则进行图像分割区域的合并。C. Analyzing the similarity between the image segmentation regions detected and corrected by under-segmentation, and merging the image segmentation regions if they are similar enough.
所谓欠分割,即为本来应该分割为不同区域的部分,因为其具有一定的相似性而没有区分开;而所谓过分割,即为本来应该属于同一区域的部分,因为过于严格的筛选标准而被错误划分为了不同区域,无论是欠分割还是过分割,都是自动图像分割中的错误结果。采用本发明具体实施方式中的自动图像分割方法,能够准确区分图像,而且能够通过欠分割和过分割的监测,来避免欠分割和过分割,因此相对于现有技术具有更高的准确性。The so-called under-segmentation refers to the parts that should have been divided into different regions, but they are not separated because they have certain similarities; Misclassification into different regions, whether under-segmented or over-segmented, is an erroneous result in automatic image segmentation. Using the automatic image segmentation method in the specific embodiment of the present invention can accurately distinguish images, and can avoid under-segmentation and over-segmentation through the monitoring of under-segmentation and over-segmentation, so it has higher accuracy than the prior art.
在一个具体实施方式中,所述基于图论方法进行图像像素划分包括:In a specific embodiment, the image pixel division based on the graph theory method includes:
A1、利用欧式距离方法计算两个相邻像素之间的颜色相似度:A1. Use the Euclidean distance method to calculate the color similarity between two adjacent pixels:
r′=(R1+R2)/2;r'=(R1 +R2 )/2;
ΔR=R1-R2;ΔR=R1 -R2 ;
ΔG=G1-G2;ΔG=G1 -G2 ;
ΔB=B1-B2;ΔB=B1 -B2 ;
其中R1和R2为两个像素各自的红色值;G1和G2为两个像素各自的绿色值;B1和B2为两个像素各自的蓝色值;Where R1 and R2 are the respective red values of the two pixels; G1 and G2 are the respective green values of the two pixels; B1 and B2 are the respective blue values of the two pixels;
Sc为两个像素之间的颜色相似度;Sc is the color similarity between two pixels;
A2、当两个像素的颜色相似度低于第一预定阈值时,将这两个像素归入同一区域,其中所述第一预定阈值根据经验获得。A2. When the color similarity of two pixels is lower than a first predetermined threshold, classify the two pixels into the same area, wherein the first predetermined threshold is obtained empirically.
一般说来,不同区域的像素之间会存在较大的颜色差异,因此,采用基于图论方法进行图像像素划分,能够简单有效地利用RGB值将不同区域进行初始的划分。Generally speaking, there will be a large color difference between pixels in different regions. Therefore, using a graph theory-based method for image pixel division can simply and effectively use RGB values to initially divide different regions.
执行以上步骤A1、A2时,需要按照“滚雪球”的方式将各个像素划入同一或者不同的区域,具体而言,首先确定两个相邻像素。When performing the above steps A1 and A2, it is necessary to divide each pixel into the same or different regions in a "snowball" manner, specifically, first determine two adjacent pixels.
如图2所示,确定相邻像素的方法是基于一个源像素,找寻其距离R范围内的像素,例如首先从A像素开始,其邻域为正方形区域,包括B、C、D等像素。如果把通过步骤A1、A2确定A、B像素应当归入同一区域后,因为A像素是源像素而B像素是边缘像素,则按照图2的方式,以B像素的另外一侧的邻域为范围,找寻下一个分析像素,与A、B像素是否应当归入同一区域。而如果通过步骤A1、A2后,B像素不应当与A像素归入同一区域,则重新以B像素为源像素,寻找其邻域内的像素,分析其是否应当与B像素归入同一区域。As shown in Figure 2, the method of determining adjacent pixels is based on a source pixel, looking for pixels within the distance R range, for example, starting from A pixel first, and its neighborhood is a square area, including B, C, D and other pixels. If it is determined through steps A1 and A2 that A and B pixels should be classified into the same area, because A pixel is a source pixel and B pixel is an edge pixel, then according to the method in Figure 2, the neighborhood on the other side of B pixel is Range, find the next analysis pixel, and whether the A and B pixels should be classified into the same area. And if after step A1 and A2, the B pixel should not belong to the same area as the A pixel, then take the B pixel as the source pixel again, find the pixels in its neighborhood, and analyze whether it should belong to the same area as the B pixel.
通过以上的方法,可以自动将图像上的所有像素划分到不同的区域,实现快速、准确、可靠的图像区域分割,并使图像分割结果更加接近人的视觉效果。Through the above method, all the pixels on the image can be automatically divided into different regions, realizing fast, accurate and reliable image region segmentation, and making the image segmentation result closer to the human visual effect.
另外,在本专利一个具体实施方式中,所述图像分割的区域进行欠分割检测,修正图像分割区域的步骤包括:In addition, in a specific implementation manner of this patent, the region of the image segmentation is under-segmented and detected, and the step of correcting the segmented region of the image includes:
B1、对当前图像分割区域中的像素进行多次随机取样,每次随机采样获得两个像素;B1. Perform multiple random samplings on the pixels in the current image segmentation area, and obtain two pixels in each random sampling;
B2、对每次取样得到两个像素,取得这两个像素的邻域矩形小区域;B2, two pixels are obtained for each sampling, and a small rectangular area adjacent to these two pixels is obtained;
B3、对这两个像素的邻域矩形小区域,分别统计其中所有像素的颜色直方图,计算两个颜色直方图的相似值;B3, for the neighborhood rectangular small area of these two pixels, count the color histograms of all pixels therein respectively, calculate the similarity value of two color histograms;
B3、对多次取样后的两个像素,分别重复B2、B3步骤,将每次得到的颜色直方图相似值进行排序,将前1/4大小的颜色直方图相似值的均值和后1/4大小的颜色直方图相似值的均值进行比较,当差值超过所有颜色直方图相似值的均值的一半时,判断为欠分割,需要对所述图像划分的区域进行重新分割。B3. For the two pixels after multiple samplings, repeat steps B2 and B3 respectively, sort the similarity values of the color histograms obtained each time, and compare the mean value and the last 1/4 of the similarity values of the color histograms of the size of the first 1/4 4 sizes of color histogram similarity values are compared, when the difference exceeds half of the mean value of all color histogram similarity values, it is judged as under-segmentation, and the region divided by the image needs to be re-segmented.
具体而言,对一个像素的邻域矩形小区域,统计其中所有像素的颜色直方图Histi,为了提高计算效率,Histi的颜色值为一维数值,是由HSV颜色空间所对应的色度H、饱和度S以及强度V通过位组合的方式得到的。Specifically, for a small rectangular area in the neighborhood of a pixel, the color histogram Histi of all pixels in it is counted. In order to improve the calculation efficiency, the color value of Histi is a one-dimensional value, which is the chromaticity H corresponding to the HSV color space, Saturation S and intensity V are obtained by bit combination.
欠分割的判断是根据全部取样的颜色直方图相似值分布,经过统计分析得到的。首先对N次取样得到的N的颜色直方图相似值进行由小到大的升序排列,得到:d1,d2…dn。对前N/4个和后N/4个颜色直方图相似值计算其平均值为:The judgment of under-segmentation is obtained through statistical analysis based on the similar value distribution of all sampled color histograms. Firstly, arrange the similarity values of N color histograms obtained by N sampling in ascending order from small to large, and obtain: d1 , d2 ...dn . The average value of the previous N/4 and the last N/4 color histogram similarities is calculated as:
判断是否欠分割的依据是:The basis for judging whether it is under-segmented is:
以上判别依据是采用多次实验所获得的,当前1/4大小的颜色直方图相似值的均值和后1/4大小的颜色直方图相似值的均值进行比较,当差值超过所有颜色直方图相似值的均值的一半时,判断为欠分割,这样能够消除90%以上的欠分割,具有很高的效率和准确性。The above discrimination basis is obtained by multiple experiments. The mean value of the similarity value of the color histogram of the current 1/4 size is compared with the mean value of the similarity value of the color histogram of the next 1/4 size. When the difference exceeds the value of all color histograms When it is half of the mean value of the similarity value, it is judged as under-segmentation, which can eliminate more than 90% of the under-segmentation, and has high efficiency and accuracy.
并且在另外一个具体实施方式中,对所述图像划分的区域进行欠分割检测,修正图像分割区域的步骤还包括:And in another specific implementation manner, the under-segmentation detection is performed on the region divided by the image, and the step of correcting the segmented region of the image further includes:
B4、当需要对所述图像划分的区域进行重新分割时,对所述图像分割的区域内的像素再次执行步骤A1、A2,其中对步骤A2中的第一预定阈值予以下调。B4. When it is necessary to re-segment the divided region of the image, execute steps A1 and A2 again for the pixels in the divided region of the image, wherein the first predetermined threshold in step A2 is lowered.
当需要重新分割时,说明步骤A中区域划分太过粗略,应该将步骤A划分后的区域更进一步细分,因此应当调整A2中的第一预定阈值,例如使其下降一半,这样会让更多的像素之间会被认为是相似度不能符合第一预定阈值,应当归为不同的区域,因此就能够将原先欠分割的区域划分为更多的小区域。When re-segmentation is required, it means that the area division in step A is too rough, and the area divided in step A should be further subdivided. Therefore, the first predetermined threshold in A2 should be adjusted, for example, to reduce it by half, which will make more It is considered that the similarity between more pixels cannot meet the first predetermined threshold and should be classified into different regions, so that the original under-segmented region can be divided into more small regions.
其中,步骤B1中将当前图像分割区域中进行随机采样的次数取决于当前图像分割区域中的总像素点数量,总像素点数量越多,则需要进行随机采样的次数越多。Wherein, in step B1, the number of times of random sampling in the segmented area of the current image depends on the total number of pixels in the segmented area of the current image, the more the total number of pixels, the more times of random sampling required.
另外,所述分析欠分割检测并修正后的图像分割区域两两之间的近似度,如果足够近似则进行图像分割区域的合并的步骤包括:In addition, the step of analyzing the similarity between the image segmentation regions detected and corrected by the under-segmentation, and if the approximation is sufficient, the step of merging the image segmentation regions includes:
C1、对两个欠分割检测并修正后的图像分割区域中分别进行多次窗口采样,每次窗口采样后分别得到两个颜色直方图,然后计算这两个颜色直方图的颜色直方图相似值;C1. Perform multiple window samples in the two under-segmentation detected and corrected image segmentation areas, and obtain two color histograms after each window sampling, and then calculate the color histogram similarity value of the two color histograms ;
C2、对多次取样的颜色直方图相似值取平均数,作为两个子区域的总体平均相似度。若该平均相似度低于第二预定阈值,则将两个欠分割检测并修正后的图像分割区域进行合并。C2. Take the average of the similarity values of the color histograms sampled multiple times, and use it as the overall average similarity of the two sub-regions. If the average similarity is lower than the second predetermined threshold, the two under-segmented detected and corrected image segmented regions are merged.
以上C1、C2步骤其实是步骤B相似的过程,只是从相邻子区域中采样,计算颜色直方图相似值,因此来判断是否经过步骤B以后,将图面划分的结果是否过于凌乱。The above steps C1 and C2 are actually similar to step B. They just sample from adjacent sub-regions and calculate the similarity value of the color histogram. Therefore, it is judged whether the result of dividing the image after step B is too messy.
如图3所示,与本发明具体实施方式中的自动图像分割方法相对应,本发明的具体实施方式中还包括一种自动图像分割装置,所述自动图像分割装置包括:As shown in Figure 3, corresponding to the automatic image segmentation method in the specific embodiment of the present invention, the specific embodiment of the present invention also includes an automatic image segmentation device, and the automatic image segmentation device includes:
图像预分割单元,用于基于图论方法进行图像像素划分,由此将图像分割为不同区域;The image pre-segmentation unit is used to divide the image pixels based on the graph theory method, thereby dividing the image into different regions;
欠分割检测单元,用于对图像分割的区域进行欠分割检测,修正图像分割区域;The under-segmentation detection unit is used to perform under-segmentation detection on the region of image segmentation, and correct the image segmentation region;
过分割补偿单元,用于分析欠分割检测并修正后的图像分割区域两两之间的近似度,如果足够近似则进行图像分割区域的合并。The over-segmentation compensation unit is used to analyze the similarity between the image segmented regions after under-segmentation detection and correction, and merge the image segmented regions if they are similar enough.
通过以上说明可见,本发明具体实施方式中的自动图像分割方法和装置的随机取样的过程保证了在较小计算量的前提下对整个区域的覆盖,每一次取样计算的是取样窗口内所有像素颜色的统计值,因此本发明的自动图像分割方法和装置能够综合了颜色与纹理两种特征的方法的优点。It can be seen from the above description that the random sampling process of the automatic image segmentation method and device in the specific embodiment of the present invention ensures the coverage of the entire area under the premise of a small amount of calculation, and each sampling calculates all pixels in the sampling window The statistical value of the color, so the automatic image segmentation method and device of the present invention can combine the advantages of the two methods of color and texture.
需要说明的是,上述实施方式仅为本发明较佳的实施方案,不能将其理解为对本发明保护范围的限制,在未脱离本发明构思前提下,对本发明所做的任何微小变化与修饰均属于本发明的保护范围。It should be noted that the above-mentioned embodiments are only preferred embodiments of the present invention, and should not be understood as limiting the protection scope of the present invention. Any minor changes and modifications made to the present invention are acceptable without departing from the concept of the present invention. Belong to the protection scope of the present invention.
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN201810463978.XACN108765426A (en) | 2018-05-15 | 2018-05-15 | automatic image segmentation method and device |
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN201810463978.XACN108765426A (en) | 2018-05-15 | 2018-05-15 | automatic image segmentation method and device |
| Publication Number | Publication Date |
|---|---|
| CN108765426Atrue CN108765426A (en) | 2018-11-06 |
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| CN201810463978.XAPendingCN108765426A (en) | 2018-05-15 | 2018-05-15 | automatic image segmentation method and device |
| Country | Link |
|---|---|
| CN (1) | CN108765426A (en) |
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN109977745A (en)* | 2018-12-25 | 2019-07-05 | 深圳云天励飞技术有限公司 | Face image processing process and relevant apparatus |
| CN110910396A (en)* | 2019-10-18 | 2020-03-24 | 北京量健智能科技有限公司 | Method and device for optimizing image segmentation result |
| CN112274110A (en)* | 2020-10-10 | 2021-01-29 | 苏州万微光电科技有限公司 | Pore detection system, device and method based on skin fluorescence image |
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| WO2002093450A1 (en)* | 2001-05-16 | 2002-11-21 | Cellavision Ab | Information processing for distinguishing an object |
| CN101710387A (en)* | 2009-10-29 | 2010-05-19 | 中国科学院对地观测与数字地球科学中心 | Intelligent method for classifying high-resolution remote sensing images |
| CN102968822A (en)* | 2012-08-23 | 2013-03-13 | 华南理工大学 | Three-dimensional medical image segmentation method based on graph theory |
| CN103778413A (en)* | 2014-01-16 | 2014-05-07 | 华东师范大学 | Remote-sensing image under-segmentation object automatic recognition method |
| CN105335965A (en)* | 2015-09-29 | 2016-02-17 | 中国科学院遥感与数字地球研究所 | High-resolution remote sensing image multi-scale self-adaptive decision fusion segmentation method |
| CN107767383A (en)* | 2017-11-01 | 2018-03-06 | 太原理工大学 | A kind of Road image segmentation method based on super-pixel |
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| WO2002093450A1 (en)* | 2001-05-16 | 2002-11-21 | Cellavision Ab | Information processing for distinguishing an object |
| CN101710387A (en)* | 2009-10-29 | 2010-05-19 | 中国科学院对地观测与数字地球科学中心 | Intelligent method for classifying high-resolution remote sensing images |
| CN102968822A (en)* | 2012-08-23 | 2013-03-13 | 华南理工大学 | Three-dimensional medical image segmentation method based on graph theory |
| CN103778413A (en)* | 2014-01-16 | 2014-05-07 | 华东师范大学 | Remote-sensing image under-segmentation object automatic recognition method |
| CN105335965A (en)* | 2015-09-29 | 2016-02-17 | 中国科学院遥感与数字地球研究所 | High-resolution remote sensing image multi-scale self-adaptive decision fusion segmentation method |
| CN107767383A (en)* | 2017-11-01 | 2018-03-06 | 太原理工大学 | A kind of Road image segmentation method based on super-pixel |
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN109977745A (en)* | 2018-12-25 | 2019-07-05 | 深圳云天励飞技术有限公司 | Face image processing process and relevant apparatus |
| CN109977745B (en)* | 2018-12-25 | 2021-09-14 | 深圳云天励飞技术有限公司 | Face image processing method and related device |
| CN110910396A (en)* | 2019-10-18 | 2020-03-24 | 北京量健智能科技有限公司 | Method and device for optimizing image segmentation result |
| CN112274110A (en)* | 2020-10-10 | 2021-01-29 | 苏州万微光电科技有限公司 | Pore detection system, device and method based on skin fluorescence image |
| Publication | Publication Date | Title |
|---|---|---|
| CN106651872B (en) | Pavement crack identification method and system based on Prewitt operator | |
| CN109377485B (en) | Machine vision detection method for instant noodle packaging defects | |
| EP3455782B1 (en) | System and method for detecting plant diseases | |
| CN104834912B (en) | A kind of weather recognition methods and device based on image information detection | |
| CN102184405B (en) | Image Acquisition and Analysis Method | |
| CN107610114B (en) | Detection method of cloud, snow and fog in optical satellite remote sensing images based on support vector machine | |
| CN107909081B (en) | A fast acquisition and fast calibration method for image datasets in deep learning | |
| CN107437243B (en) | Tire impurity detection method and device based on X-ray image | |
| He et al. | A method of green litchi recognition in natural environment based on improved LDA classifier | |
| CN105809121A (en) | Multi-characteristic synergic traffic sign detection and identification method | |
| CN106951899A (en) | Method for detecting abnormality based on image recognition | |
| CN118429242A (en) | Image analysis method and system based on deep learning | |
| CN111695373B (en) | Zebra stripes positioning method, system, medium and equipment | |
| Niu et al. | Image segmentation algorithm for disease detection of wheat leaves | |
| CN107945200A (en) | Image binaryzation dividing method | |
| CN103295013A (en) | Pared area based single-image shadow detection method | |
| CN112704259B (en) | Threshing quality evaluation method and system for dense tobacco leaf recognition | |
| CN108734131A (en) | A kind of traffic sign symmetry detection methods in image | |
| CN108765426A (en) | automatic image segmentation method and device | |
| CN117330582A (en) | Polymer PE film surface crystal point detecting system | |
| CN111768455A (en) | An Image-Based Method for Wood Region and Dominant Color Extraction | |
| CN103871084B (en) | Indigo printing fabric pattern recognition method | |
| CN110348530B (en) | Method for identifying lipstick number | |
| CN113516121A (en) | Multi-feature fusion non-motor vehicle license plate region positioning method | |
| CN111563536B (en) | Bamboo strip color self-adaptive classification method based on machine learning |
| 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 | ||
| RJ01 | Rejection of invention patent application after publication | ||
| RJ01 | Rejection of invention patent application after publication | Application publication date:20181106 |