说 明 书 用于颜色分布和纹理分布图像检索的相似度获取方法 技术领域 Description Method for obtaining similarity for color distribution and texture distribution image retrieval
本发明涉及图像检索技术,尤其是一种用于颜色分布和纹理分布 图像检索的相似度获取方法。 背景技术 The present invention relates to image retrieval techniques, and more particularly to a similarity acquisition method for color distribution and texture distribution image retrieval. Background technique
近年来, 随着移动互联网的迅速发展, 拍照应用获得了很大的发 展空间, 照片的获取与存储变得十分容易。 随着照片数据***式的增 长, 用户迫切需要对照片的检索和整理的自动化技术。现有的图像检 索技术都要依赖数据库中已存图像的训练样本求得相似度。而目前云 存储的照片基本上都是来自各种用户拍摄的各种场景的照片,并没有 可获取的显示标注了的训练样本。因而现有的图像检索技术不便直接 应用到云存储图像的检索中。 发明内容 In recent years, with the rapid development of the mobile Internet, the photo application has gained a lot of development space, and the acquisition and storage of photos has become very easy. With the explosive growth of photo data, users are in urgent need of automated techniques for the retrieval and organization of photos. Existing image retrieval techniques rely on training samples of stored images in the database to obtain similarities. At present, the photos stored in the cloud are basically photos from various scenes taken by various users, and there is no training sample that can be obtained by displaying the display. Therefore, the existing image retrieval technology is inconvenient to directly apply to the retrieval of cloud storage images. Summary of the invention
本发明所要解决的技术问题是: 针对上述存在的问题, 提供一种 适用于云存储颜色分布和纹理分布图像检索的相似度获取方法。 The technical problem to be solved by the present invention is: To solve the above problems, a similarity acquisition method suitable for cloud storage color distribution and texture distribution image retrieval is provided.
本发明提供的用于颜色分布和纹理分布图像检索的相似度获取方 法, 其特征在于, 包括: The method for acquiring similarity for color distribution and texture distribution image retrieval provided by the present invention is characterized in that it comprises:
歩骤 1 : 提取输入图像的颜色分布特征及纹理分布特征; 歩骤 2: 分别计算所述输入图像的颜色分布特征与数据库中每一 幅图像的颜色分布特征的相似度,得到输入图像与数据库中每一幅图 像之间的颜色分布特征相似度 Sa (0, i取 0、 1、 2...数据库图像总 数 -1 ; Step 1: extracting the color distribution feature and the texture distribution feature of the input image; Step 2: respectively calculating the similarity between the color distribution feature of the input image and the color distribution feature of each image in the database, and obtaining an input image and a database The color distribution characteristic similarity Sa between each image in each case (0, i takes 0, 1, 2... total number of database images -1;
分别计算所述输入图像的纹理分布特征与数据库中每一幅图像的
纹理分布特征的相似度,得到输入图像与数据库中每一幅图像之间的 纹理分布特征相似度 Sb (1), 1取 0、 1、 2...数据库图像总数 -1; Calculating texture distribution characteristics of the input image and each image in the database separately The similarity of the texture distribution features, the texture distribution feature similarity between the input image and each image in the database Sb (1), 1 takes 0, 1, 2... the total number of database images -1;
歩骤 3: 利用公式 S (i) =WaxSa (i) +Wb Sb (i), i取 0、 1、 2... 数据库图像总数 -1, Wa、 Wb为加权系数且 Wa+Wb=l, 计算输入图 像与数据库中每一幅图像的组合相似度 S (i)0 优选地, 所述颜色分布特征的获取方法包括: Step 3: Using the formula S (i) = WaxSa (i) + Wb Sb (i), i takes 0, 1, 2... The total number of database images -1, Wa, Wb are weighting coefficients and Wa + Wb = l calculating a combination of the input image and each image database similarity S (i) 0 preferably, the method of obtaining a color distribution comprising:
歩骤 201: 将图像转换到 颜色空间, 得到图像 I; Step 201: Convert an image to a color space to obtain an image I;
歩骤 202:将图像各个像素的 H、 S, 分量映射为颜色特征值 G: Step 202: Mapping H, S, and components of each pixel of the image into color feature values G:
G = Qs*Qv*H + Qv*S + V, 将 颜色空间的三个通道的取值范围进行 区间划分, 分别划分为 A , 其中0≤ζ≤¾,0≤·/≤ ,0≤ , , , 分别表示 颜色空间的三个通道被分割的区间总数; 歩骤 203: 统计图像中各个像素点的特征值分布情况: 遍历每个 像素点的颜色特征值,统计落入各个颜色分布直方图区间的像素点数 量,将落入各个颜色分布直方图区间的像素点数量分别除以图像像素 点总数,得到归一化的颜色分布特征^t(x), 其中 X代表颜色分布直方 图区间。 优选地, 所述颜色分布特征的获取方法还包括: G = Q s *Q v *H + Q v *S + V, divide the range of values of the three channels of the color space into sections, respectively, into A, where 0≤ ζ ≤ 3⁄4, 0≤ ·/≤, 0 ≤ , , , respectively represent the total number of intervals in which the three channels of the color space are divided; Step 203: Statistic value distribution of each pixel in the statistical image: traverse the color feature value of each pixel, and the statistics fall into each color The number of pixels in the distribution histogram interval is divided by the number of pixels in each color distribution histogram interval divided by the total number of image pixels to obtain a normalized color distribution feature ^t(x), where X represents the color distribution histogram Diagram interval. Preferably, the method for acquiring the color distribution feature further includes:
将图像划分为 Ν块; 在所述歩骤 203中: 统计图像中各个像素点 的特征值分布情况: 遍历每个像素点的特征值, 统计落入各个颜色分 布直方图区间的像素点数量,且将不是图像边界块中的像素点统计两 次;将落入各个颜色分布直方图区间的像素点数量分别除以图像像素 点总数,得到归一化的颜色分布特征^t(x), 其中 X代表颜色直方图。 优选地, 所述纹理分布特征的获取方法包括:
歩骤 301 : 将图像转换为灰度图, 得到图像 L; Dividing the image into Ν blocks; In the step 203: statistic value distribution of each pixel in the statistical image: traversing the eigenvalue of each pixel, and counting the number of pixels falling into the histogram interval of each color distribution, And the pixel points in the image boundary block are not counted twice; the number of pixels falling into the histogram interval of each color distribution is divided by the total number of image pixels, and a normalized color distribution feature ^t(x) is obtained, wherein X represents the color histogram. Preferably, the method for obtaining the texture distribution feature includes: Step 301: Convert an image into a grayscale image to obtain an image L;
歩骤 302: 以尺寸为 3像素 χ3像素的模板, 遍历所述图像 得 到每个模板的 LHP特征, 其中得到模板 LBp特征的方法包括: Step 302: traversing the image to obtain an LHP feature of each template by using a template with a size of 3 pixels and 3 pixels, wherein the method for obtaining the template L B p feature includes:
记模板中的 9个像素点的灰度值为 P' (Q≤ z≤ 8), 其中模板正中的像 素灰度值记为 ; 将模板中其它的像素点的灰度值减去 。得到: The gray value of the nine pixels in the template is P' ( Q ≤ z ≤ 8 ), where the gray value of the pixel in the middle of the template is recorded as; the gray value of the other pixels in the template is subtracted. get:
对每个计算得到的 &进行二值化处理: 如果 g' ≥Q则令 g' = 1, 否则 g- = 0 ;将位于位置 z的像素的 &值扩展为 8位 2进制数,得到 特 征为, 1≤ ≤8: g 0 . For each calculated & binarization: If g' ≥ Q then let g' = 1 , otherwise g - = 0 ; expand the & value of the pixel at position z to an 8-bit binary number, The characteristic is, 1≤ ≤8: g 0 .
歩骤 303 : 获得每个模板的旋转不变的 特征; 其中得到模板 的旋转不变的 LBP"特征的方法包括: Step 303: Obtaining a rotation-invariant feature of each template; wherein the method of obtaining the rotation-invariant LBP feature of the template includes:
对模板的每个 H(0按进行移位操作,分别可以得到 8个二进制数 据, 取其中最小的一个作为旋转不变的 LBP" 特征: For each H of the template (0 is shifted by operation, respectively, 8 binary data can be obtained, and the smallest one is taken as the rotation-invariant LBP ".
LBP" (/) = q)) , 式中 l≤z'≤8, RC>R表示移位操作, q
表示移位位数; LBP" (/) = q)) , where l ≤ z' ≤ 8, RC > R represents the shift operation, q Indicates the number of shift bits;
歩骤 304 : 统计各个模板中各个旋转不变的^ 特征的分布情 况:遍历各个模板的每个旋转不变的 特征值,统计落入各个纹 理分布直方图区间的像素点数量,再将落入各个纹理分布直方图区间 的像素点数量分别除以图像像素点总数,得到归一化的纹理分布特征 hist(y) , 其中 _y代表纹理分布直方图区间。 优选地,所述歩骤 2中计算颜色分布特征相似度 Sa的方法包括:
歩骤 401 : 利用公式Step 304: Counting the distribution of each of the rotation-invariant features in each template: traversing each rotation-invariant feature value of each template, and counting the number of pixels falling into each texture distribution histogram interval, and then falling into The number of pixels in each texture distribution histogram interval is divided by the total number of image pixels, and the normalized texture distribution feature hist(y) is obtained, where _y represents the texture distribution histogram interval. Preferably, the method for calculating the color distribution feature similarity Sa in the step 2 includes: Step 401: Using the formula
相似度, 其中 tet x)为第一幅图像的颜色分布特征, tot2 (x)为第二幅 图像的颜色分布特征。 优选地,所述歩骤 2中计算纹理分布特征相似度 Sb的方法包括: Similarity, where tet x) is the color distribution characteristic of the first image, and tot 2 (x) is the color distribution characteristic of the second image. Preferably, the method for calculating the texture distribution feature similarity Sb in the step 2 includes:
^ mrn^is^ (y\ hist2 y)) ^ mrn^is^ (y\ hist 2 y))
歩骤 401 : 利用公式& =^ 计算纹理分布特征相 似度, 其中 Ο 为第一幅图像的纹理分布特征, 为第二幅图 像的纹理分布特征。 优选地, 所述 Wa>Wb。 本发明还保护一种用于纹理分布图像检索方法的相似度获取方 法, 包括: Step 401: Calculate the similarity of the texture distribution feature using the formula & =^, where Ο is the texture distribution feature of the first image and the texture distribution feature of the second image. Preferably, the Wa>Wb. The present invention also protects a similarity acquisition method for a texture distribution image retrieval method, including:
歩骤 1 : 提取输入图像的纹理分布特征; Step 1: extracting a texture distribution feature of the input image;
歩骤 2: 分别计算所述输入图像的纹理分布特征与数据库中每一 幅图像的纹理分布特征的相似度,得到输入图像与数据库中每一幅图 像之间的纹理分布特征相似度 Sb ( i), 1取 0、 1、 2...数据库图像总 数 -1 ; 所述纹理分布特征的获取方法包括: Step 2: Calculate the similarity between the texture distribution feature of the input image and the texture distribution feature of each image in the database, and obtain the texture distribution feature similarity Sb between the input image and each image in the database (i) ), 1 takes 0, 1, 2... total number of database images -1; the method for obtaining the texture distribution features includes:
歩骤 301 : 将图像转换为灰度图, 得到图像 L; Step 301: Converting an image into a grayscale image to obtain an image L;
歩骤 302: 以尺寸为 3像素 χ3像素的模板, 遍历所述图像 得 到每个模板的 LHP特征, 其中得到模板 LBp特征的方法包括: 记模板中的 9个像素点的灰度值为 P' (Q≤ z≤ 8), 其中模板正中的像 素灰度值记为 ; 将模板中其它的像素点的灰度值减去 。得到:
对每个计算得到的 &进行二值化处理: 如果 g' ≥Q则令 g' = 1, 否则 g- = 0 ;将位于位置 z的像素的 &值扩展为 8位 2进制数,得到 特 征为, 1≤ ≤8: g 0 . Step 302: traversing the image to obtain an LHP feature of each template by using a template with a size of 3 pixels and 3 pixels, wherein the method for obtaining the template L B p feature includes: recording a gray value of 9 pixels in the template P' ( Q ≤ z ≤ 8 ), where the gray value of the pixel in the middle of the template is recorded as; the gray value of the other pixels in the template is subtracted. get: For each calculated & binarization: If g' ≥ Q then let g' = 1 , otherwise g - = 0 ; expand the & value of the pixel at position z to an 8-bit binary number, The characteristic is, 1≤ ≤8: g 0 .
歩骤 303 : 获得每个模板的旋转不变的 特征; 其中得到模板 的旋转不变的 LBP"特征的方法包括: Step 303: Obtaining a rotation-invariant feature of each template; wherein the method of obtaining the rotation-invariant LBP feature of the template includes:
对模板的每个 H(0按进行移位操作,分别可以得到 8个二进制数 据, 取其中最小的一个作为旋转不变的 LBP" 特征: For each H of the template (0 is shifted by operation, respectively, 8 binary data can be obtained, and the smallest one is taken as the rotation-invariant LBP ".
LBP" (i) = m[n(ROR(LBP(il q)) , 式中 1≤ 8, ROR表示移位操作, g 0 表示移位位数; LBP" (i) = m [ n (ROR(LBP(il q)) , where 1 ≤ 8, ROR represents the shift operation, and g 0 represents the number of shift bits;
歩骤 304: 统计各个模板中各个旋转不变的^ 特征的分布情 况:遍历各个模板的每个旋转不变的 特征值,统计落入各个纹 理分布直方图区间的像素点数量,再将落入各个纹理分布直方图区间 的像素点数量分别除以图像像素点总数,得到归一化的纹理分布特征 hist(y) , 其中 _y代表纹理分布直方图区间。 Step 304: Counting the distribution of each of the rotation-invariant features in each template: traversing each rotation-invariant feature value of each template, and counting the number of pixels falling into each texture distribution histogram interval, and then falling into The number of pixels in each texture distribution histogram interval is divided by the total number of image pixels, and the normalized texture distribution feature hist(y) is obtained, where _y represents the texture distribution histogram interval.
本发明还保护上述中的纹理分布特征的获取方法。 综上所述, 由于采用了上述技术方案, 本发明的有益效果是: 本发明涉及的图像相似度获取方法不需对图像进行任何假设, 也 不需要大量的标注样本训练模型,具有容易实现,计算速度快的优点。 附图说明 The present invention also protects the method of acquiring texture distribution features in the above. In summary, the above technical solution is adopted, and the beneficial effects of the present invention are as follows: The image similarity obtaining method according to the present invention does not need to make any assumptions on the image, and does not require a large number of labeled sample training models, and is easy to implement. The advantage of fast calculation. DRAWINGS
本发明将通过例子并参照附图的方式说明, 其中:
图 1为本发明中颜色分布特征提取流程图。 The invention will be illustrated by way of example and with reference to the accompanying drawings in which: FIG. 1 is a flow chart of color distribution feature extraction in the present invention.
图 2为本发明中纹理分布特征提取流程图。 图 3为本发明中图像检索流程图。 具体实施方式 本说明书中公开的所有特征,或公开的所有方法或过程中的歩骤, 除了互相排斥的特征和 /或歩骤以外, 均可以以任何方式组合。 本说明书中公开的任一特征, 除非特别叙述, 均可被其他等效或 具有类似目的的替代特征加以替换。 gp, 除非特别叙述, 每个特征只 是一系列等效或类似特征中的一个例子而已。 2 is a flow chart of texture distribution feature extraction in the present invention. Figure 3 is a flow chart of image retrieval in the present invention. DETAILED DESCRIPTION OF THE INVENTION All of the features disclosed in this specification, or steps in all methods or processes disclosed, can be combined in any manner other than mutually exclusive features and/or steps. Any feature disclosed in this specification, unless specifically stated otherwise, may be replaced by other equivalent features or similar features. Gp, unless specifically stated, each feature is only one example of a series of equivalent or similar features.
本发明提供了一种用于颜色分布和纹理分布图像检索的相似度获 取方法, 其具体歩骤包括: The present invention provides a similarity acquisition method for color distribution and texture distribution image retrieval, and the specific steps include:
歩骤 1: 提取输入图像的颜色分布特征及纹理分布特征; 歩骤 2: 分别计算所述输入图像的颜色分布特征与数据库中每一 幅图像的颜色分布特征的相似度,得到输入图像与数据库中每一幅图 像之间的颜色分布特征相似度 Sa (0, i取 0、 1、 2...数据库图像总 数 -1; Step 1: extracting the color distribution feature and the texture distribution feature of the input image; Step 2: respectively calculating the similarity between the color distribution feature of the input image and the color distribution feature of each image in the database, and obtaining an input image and a database The color distribution characteristic similarity Sa between each image in each case (0, i takes 0, 1, 2... total number of database images -1;
分别计算所述输入图像的纹理分布特征与数据库中每一幅图像的 纹理分布特征的相似度,得到输入图像与数据库中每一幅图像之间的 纹理分布特征相似度 Sb (i), 1取 0、 1、 2...数据库图像总数 -1; 歩骤 3: 利用公式 S (i) =WaxSa (i) +WbxSb (i), i取 0、 1、 2...数据库图像总数-1, Wa、 Wb为加权系数且 Wa+Wb=l, 计算输入 图像与数据库中每一幅图像的组合相似度 S (i)0 由于人们在一般情 况下更关心颜色, 因此作为一个优选的实施方式, 加权系数 Wa>Wb。
如图 3, 当获得了输入图像与数据库每一幅图像之间的组合相似 度后, 对各个相似度进行排序, 相似度越大说明两幅图像越相似, 我 们可以根据经验设定一阈值,将大于组合相似度大于该阈值的所有数 据库中的图像输出, 作为检索结果。 如图 1,在本发明一个实施例中,颜色分布特征的获取方法包括: 歩骤 201: 将图像转换到 颜色空间, 得到图像 I; 一般来说图 片为 RGB颜色空间,将 RGB颜色空间的图片转换到 颜色空间为 本领域公知的技术, 在此不再赘述其具体过程。 Calculating the similarity between the texture distribution feature of the input image and the texture distribution feature of each image in the database, and obtaining the texture distribution feature similarity Sb (i), 1 between the input image and each image in the database. 0, 1, 2... Total number of database images -1; Step 3: Using the formula S (i) = WaxSa (i) + WbxSb (i), i takes 0, 1, 2... Total number of database images -1 , Wa, Wb and the weighting coefficient Wa + Wb = l, calculate the combination of the input image and each image database similarity S (i) 0 as people are more concerned with color in general, and therefore as a preferred embodiment , weighting coefficient Wa>Wb. As shown in Figure 3, when the combined similarity between the input image and each image of the database is obtained, each similarity is sorted. The greater the similarity, the more similar the two images are, and we can set a threshold based on experience. An image output in all databases larger than the combined similarity is greater than the threshold as a retrieval result. As shown in FIG. 1, in an embodiment of the present invention, a method for acquiring a color distribution feature includes: Step 201: Convert an image into a color space to obtain an image I; generally, the image is an RGB color space, and the image of the RGB color space is obtained. The conversion to the color space is a technique well known in the art, and the specific process thereof will not be described herein.
歩骤 202 : 将图像各个像素的 H、 S , 分量按照公式 G = * *H + 2V^+ 映射关系转换为颜色特征值 G; 其中, Qh,Qs,Qv 的定义是这样的:将^^颜色空间的三个通道的取值范围进行区间划 分, 分别划分为 , Λ, 其中 o≤ ≤ ,o≤_/≤ ,o≤A≤a, , a, 分 别表示 HSV颜色空间的三个通道被分割的区间总数; 歩骤 203: 统计图像中各个像素点的特征值分布情况: 遍历每个 像素点的颜色特征值,统计落入各个颜色分布直方图区间的像素点数 量,将落入各个颜色分布直方图区间的像素点数量分别除以图像像素 点总数,得到归一化的颜色分布特征^t(x), 其中 X代表颜色分布直方 图区间。 本领域技术人员均知晓,颜色分布直方图将整幅图像的颜色特征 分为若干区间,然后用各个像素在各个区间分布的情况描述不同色彩 在整幅图像中所占的比例。 考虑到一幅图像所表达的含义,往往位于图像边界附近的区域不
太重要, 我们更关心图非边界区域表达的内容。 因此, 在本发明另一 个实施例中, 所述颜色分布特征的获取方法还包括: Step 202: Convert H, S, and components of each pixel of the image into a color feature value G according to a formula G = * * H + 2 V ^ + ; wherein Q h , Q s , Q v are defined as follows : The range of values of the three channels of the ^^ color space is divided into sections, respectively, where ≤, where o ≤ ≤ , o ≤ _ / ≤ , o ≤ A ≤ a, , a, respectively represent the HSV color space The total number of intervals in which the three channels are divided; Step 203: Statistic value distribution of each pixel in the statistical image: traverse the color feature values of each pixel, and count the number of pixels falling into the histogram interval of each color distribution, The number of pixels falling into the histogram interval of each color distribution is divided by the total number of image pixels, respectively, to obtain a normalized color distribution feature ^t(x), where X represents a color distribution histogram interval. Those skilled in the art are aware that the color distribution histogram divides the color features of the entire image into several intervals, and then describes the proportion of different colors in the entire image by the case where each pixel is distributed in each interval. Considering the meaning expressed by an image, the area that is often near the boundary of the image is not Too important, we are more concerned with the content expressed in the non-boundary areas of the map. Therefore, in another embodiment of the present invention, the method for acquiring the color distribution feature further includes:
将图像划分为 N块, 例如 N等于 36; 包含在图像边界块中的像 素仅被统计一次, 其余像素被统计两次。 具体而言, 在所述歩骤 203 中: 统计图像中各个像素点的特征值分布情况: 遍历每个像素点的特 征值, 统计落入各个颜色分布直方图区间的像素点数量; 且将不是图 像边界块中的像素点统计两次, gp, 当有不是图像边界块中的像素点 的特征值落入某一颜色分布直方图区间时,将落入该区间的像素点数 量加 2; 当有是图像边界块中的像素点的特征值落入某一颜色分布直 方图区间时, 则将落入该区间的像素点数量加 1 ; 最后再将落入各个 颜色分布直方图区间的像素点数量分别除以图像像素点总数,得到归 一化的颜色分布特征 tet(x), 其中 X代表颜色直方图。 The image is divided into N blocks, for example, N is equal to 36; the pixels contained in the image boundary block are counted only once, and the remaining pixels are counted twice. Specifically, in the step 203: collecting the feature value distribution of each pixel in the image: traversing the feature value of each pixel, and counting the number of pixels falling into the histogram interval of each color distribution; The pixel points in the image boundary block are counted twice, gp. When there is a feature value of a pixel in the image boundary block that falls within a certain color distribution histogram interval, the number of pixels falling into the interval is increased by 2; When the feature value of the pixel in the image boundary block falls within a certain color distribution histogram interval, the number of pixels falling into the interval is increased by 1; finally, the pixel falling into the histogram interval of each color distribution is added. The number is divided by the total number of image pixels to obtain a normalized color distribution characteristic tet(x), where X represents a color histogram.
这样统计出来的颜色分布特征值更加准确。 如图 2, 在本发明的另一个实施例中, 所述纹理分布特征的获取 方法包括: The color distribution feature values thus calculated are more accurate. As shown in FIG. 2, in another embodiment of the present invention, the method for obtaining the texture distribution feature includes:
歩骤 301 : 将图像转换为灰度图, 得到图像 L; 将 RGB图像转换 为 灰 度 图 有 多 种 方 法 , 其 中 一 种 是 利 用 公 式 Ζ = 0.299^ + 0.587 *(? + 0.114 进行转换, 其中, R代表像素的红色分 量, G代表像素的绿色分量, Β代表像素的蓝色分量。 0.299、 0.587、 0.114为系数, 当然这个系数并不唯一, 不能理解为对本发明的限制。 Step 301: Converting an image into a grayscale image to obtain an image L; There are various methods for converting an RGB image into a grayscale image, one of which is converted by using the formula Ζ = 0.299^ + 0.587 *(? + 0.114 R represents the red component of the pixel, G represents the green component of the pixel, and Β represents the blue component of the pixel. 0.299, 0.587, 0.114 are coefficients, although this coefficient is not unique and cannot be construed as limiting the invention.
歩骤 302: 以尺寸为 3像素 χ3像素的模板, 遍历所述图像 得 到每个模板的^^特征 (即纹理特征), 其中得到模板^^特征的方 法包括: 记模板中的 9个像素点的灰度值为 P'(Q≤ z≤ 8), 其中模板正中的像
素灰度值记为 ; 将模板中其它的像素点的灰度值减去 。得到: Step 302: traversing the image to obtain a ^^ feature (ie, a texture feature) of each template by using a template with a size of 3 pixels and 3 pixels, wherein the method for obtaining the template feature includes: recording 9 pixels in the template The gray value is P' ( Q ≤ z ≤ 8 ), where the image in the middle of the template The prime gray value is recorded as; the gray value of other pixels in the template is subtracted. get:
对每个计算得到的 &进行二值化处理: 如果 g' ≥Q则令 g' = 1, 否则 g- = 0 ;将位于位置 z的像素的 &值扩展为 8位 2进制数,得到 特 征为, 1≤ ≤8:
For each calculated & binarization: If g' ≥ Q then let g' = 1 , otherwise g - = 0 ; expand the & value of the pixel at position z to an 8-bit binary number, The characteristic is, 1≤ ≤8:
上述计算的^ ^特征不能应对旋转不变的要求, 为了获得旋转不 变的 Z ?P特征, 需要进一歩执行歩骤 303 : 获得每个模板的旋转不变 的 LBP"特征; 其中得到模板的旋转不变的 LBP"特征的方法包括: 对模板的每个 H(0按进行移位操作,分别可以得到 8个二进制数 据, 取其中最小的一个作为旋转不变的 LBP" 特征: The ^^ feature of the above calculation cannot cope with the requirement of rotation invariance. In order to obtain the rotation-invariant Z?P feature, it is necessary to perform step 303: obtaining the rotation-invariant LBP" feature of each template; The method of rotating the invariant LBP "features includes: For each H of the template (0 is shifted by operation, respectively, 8 binary data can be obtained, and the smallest one is taken as the rotation-invariant LBP ".
LBP" (i) = m[n(ROR(LBP(il q)) , 式中 1≤ 8, ROR表示移位操作, g 0 表示移位位数; LBP" (i) = m [ n (ROR(LBP(il q)) , where 1 ≤ 8, ROR represents the shift operation, and g 0 represents the number of shift bits;
歩骤 304: 统计各个模板中各个旋转不变的^ 特征的分布情 况:遍历各个模板的每个旋转不变的 特征值,统计落入各个纹 理分布直方图区间的像素点数量,再将落入各个纹理分布直方图区间 的像素点数量分别除以图像像素点总数,得到归一化的纹理分布特征 hist(y) , 其中 _y代表纹理分布直方图区间。 这里纹理分布直方图的定义与前述颜色分布直方图定义类似。纹 理分布直方图将整幅图像的纹理特征分为若干区间,然后用各个像素 在各个区间分布的情况描述不同纹理在整幅图像中所占的比例。 Step 304: Counting the distribution of each of the rotation-invariant features in each template: traversing each rotation-invariant feature value of each template, and counting the number of pixels falling into each texture distribution histogram interval, and then falling into The number of pixels in each texture distribution histogram interval is divided by the total number of image pixels, and the normalized texture distribution feature hist(y) is obtained, where _y represents the texture distribution histogram interval. The definition of the texture distribution histogram here is similar to the definition of the aforementioned color distribution histogram. The texture distribution histogram divides the texture features of the entire image into several intervals, and then describes the proportion of different textures in the entire image by the case where each pixel is distributed in each interval.
当得到图像的颜色分布特征后,计算两幅图像的颜色分布特征相
似度 Sa的一个具体实施方式, 包括: 歩骤 401 : 利用公式After obtaining the color distribution characteristics of the image, calculating the color distribution characteristics of the two images A specific implementation of the degree of Sa, including: Step 401: Using the formula
相似度, 其中 tet x)为第一幅图像的颜色分布特征, tot2 (x)为第二幅 图像的颜色分布特征, 其中 X代表颜色直方图。 当得到图像的纹理分布特征后,计算两幅图像的纹理分布特征相 似度 Sb的一个具体实施方式, 包括: Similarity, where tet x) is the color distribution characteristic of the first image, and tot 2 (x) is the color distribution characteristic of the second image, where X represents the color histogram. After obtaining the texture distribution feature of the image, a specific implementation manner of calculating the texture distribution feature similarity Sb of the two images includes:
^ mrn^is^ (y\ hist2 y)) ^ mrn^is^ (y\ hist 2 y))
歩骤 501 : 利用公式& =^ 计算纹理分布特征相 似度, 其中 Ο 为第一幅图像的纹理分布特征, 0 为第二幅图 像的纹理分布特征。 J代表纹理分布直方图区间。 在上述内容的教导下,本领域技术人员容易想到基于本发明创新 思想的一种用于纹理分布图像检索方法的相似度获取方法, 包括: 歩骤 1 : 提取输入图像的纹理分布特征; Step 501: Calculate the similarity of the texture distribution feature using the formula & =^, where Ο is the texture distribution feature of the first image, and 0 is the texture distribution feature of the second image. J represents the texture distribution histogram interval. Under the above teachings, a person skilled in the art can easily think of a similarity acquisition method for a texture distribution image retrieval method based on the innovative idea of the present invention, comprising: Step 1: Extracting a texture distribution feature of an input image;
歩骤 2 : 分别计算所述输入图像的纹理分布特征与数据库中每一 幅图像的纹理分布特征的相似度,得到输入图像与数据库中每一幅图 像之间的纹理分布特征相似度 Sb ( i), 1取 0、 1、 2. . .数据库图像总 数 -1。 同理,当获得了输入图像与数据库每一幅图像之间的纹理分布特 征相似度后, 对各个相似度进行排序, 相似度越大说明两幅图像越相 似, 我们可以根据经验设定一阈值, 将大于组合相似度大于该阈值的 所有数据库中的图像输出, 作为检索结果。
本发明并不局限于前述的具体实施方式。 本发明扩展到任何在本 说明书中披露的新特征或任何新的组合,以及披露的任一新的方法或 过程的歩骤或任何新的组合。
Step 2: respectively calculating the similarity between the texture distribution feature of the input image and the texture distribution feature of each image in the database, and obtaining a texture distribution feature similarity Sb between the input image and each image in the database (i) ), 1 takes 0, 1, 2. 2. The total number of database images -1. Similarly, when the texture distribution feature similarity between the input image and each image of the database is obtained, each similarity is sorted. The greater the similarity, the more similar the two images are. We can set a threshold according to experience. , will output the image in all databases larger than the combined similarity greater than the threshold as the search result. The invention is not limited to the specific embodiments described above. The invention extends to any novel features or any new combinations disclosed in this specification, as well as a novel or a novel combination of any new method or process disclosed.