WO2019019679A1 - 倾斜图像的倾斜值获取方法及装置、终端、存储介质 - Google Patents

倾斜图像的倾斜值获取方法及装置、终端、存储介质 Download PDF

Info

Publication number
WO2019019679A1
WO2019019679A1 PCT/CN2018/080837 CN2018080837W WO2019019679A1 WO 2019019679 A1 WO2019019679 A1 WO 2019019679A1 CN 2018080837 W CN2018080837 W CN 2018080837W WO 2019019679 A1 WO2019019679 A1 WO 2019019679A1
Authority
WO
WIPO (PCT)
Prior art keywords
tilt
value
regions
values
image
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.)
Ceased
Application number
PCT/CN2018/080837
Other languages
English (en)
French (fr)
Inventor
王健宗
王晨羽
马进
肖京
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Ping An Technology Shenzhen Co Ltd
Original Assignee
Ping An Technology Shenzhen Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Ping An Technology Shenzhen Co Ltd filed Critical Ping An Technology Shenzhen Co Ltd
Publication of WO2019019679A1 publication Critical patent/WO2019019679A1/zh
Anticipated expiration legal-status Critical
Ceased legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/10Segmentation; Edge detection
    • G06T7/187Segmentation; Edge detection involving region growing; involving region merging; involving connected component labelling
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/60Analysis of geometric attributes
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T2207/00Indexing scheme for image analysis or image enhancement
    • G06T2207/10Image acquisition modality
    • G06T2207/10004Still image; Photographic image

Definitions

  • the present application relates to the field of image processing, and in particular, to a method and device for acquiring a tilt value of a tilted image, a terminal, and a storage medium.
  • the easiest way to obtain the tilt of an image with elemental information is to extract its boundary line and determine the slope of the image by the slope of the boundary line.
  • this method is only applicable to rectangular images, and the length direction or width direction of the rectangular image is consistent with the ordering direction of the elements.
  • the boundary line of the image does not have a linear characteristic, for example, the boundary line is a curve, it is obvious that the manner of obtaining the inclination by extracting the boundary line is not applicable. Therefore, there is a need to provide a tilt acquisition method that can be applied to a non-rectangular oblique image.
  • the present application provides a method and device for acquiring the tilt value of the oblique image, a terminal, and a storage medium.
  • the embodiment of the present application provides a method for acquiring a tilt value of a tilt image, where the tilt image includes a plurality of elements arranged in order; and the method for obtaining the tilt value includes:
  • Parsing the oblique image extracting a plurality of element regions, wherein the element regions are affine invariant regions including the elements;
  • the tilt values of all the straight lines are analyzed and calculated, and the tilt values of the tilt images are obtained.
  • the parsing the oblique image and extracting a plurality of element regions comprises:
  • the element is a character
  • the non-element area is a maximum stable extreme value area corresponding to the first rectangular boundary
  • the method further includes:
  • the filtering of elemental feature regions from all of the largest stable extreme regions includes:
  • the first rectangular boundary is a rectangular boundary located inside the other rectangular boundary, a rectangular boundary having an area larger than a first preset threshold, or a rectangle having an aspect ratio greater than a second preset threshold boundary;
  • the maximum stable extreme value region corresponding to the first rectangular boundary is filtered out from all the maximum stable extreme value regions.
  • the determining two adjacent element regions includes:
  • the two element regions are determined as two adjacent element regions.
  • the determining two adjacent element regions includes:
  • the two element regions are determined as two adjacent element regions.
  • the analyzing and calculating the tilt values of all the straight lines to obtain the tilt values of the tilt images comprises:
  • the mean value of the cluster of tilt values having the largest weight is calculated, and the tilt value of the tilt image is obtained.
  • the clustering all the tilt values to obtain a plurality of tilt value clusters including:
  • the minimum variance value is greater than or equal to the fourth preset threshold, updating the preset number, and returning to perform performing clustering on all the tilt values to obtain a preset number of tilt value clusters until the minimum variance value is less than The fourth preset threshold.
  • the embodiment of the present application provides a tilt value acquiring device for a tilt image, where the tilt image includes a plurality of elements arranged in order; and the tilt value obtaining device includes:
  • An element region extraction module configured to parse the oblique image, and extract a plurality of element regions, wherein the element region is an affine invariant region including the element;
  • An adjacent area determining module for determining two adjacent element areas
  • a linear tilt value acquisition module configured to acquire a tilt value of all straight lines connecting two adjacent element regions
  • An image tilt value obtaining module is configured to perform an analysis calculation on the tilt values of all the straight lines to obtain a tilt value of the tilt image.
  • an embodiment of the present application provides a terminal, including a memory, a processor, and computer readable instructions stored in the memory and executable on the processor, where the processor executes the computer The following steps are implemented when reading the instruction:
  • Parsing the oblique image extracting a plurality of element regions, wherein the element regions are affine invariant regions including the elements;
  • the tilt values of all the straight lines are analyzed and calculated, and the tilt values of the tilt images are obtained.
  • the embodiment of the present application provides one or more non-volatile readable storage media storing computer readable instructions, when the computer readable instructions are executed by one or more processors, such that the one or Multiple processors perform the following steps:
  • Parsing the oblique image extracting a plurality of element regions, wherein the element regions are affine invariant regions including the elements;
  • the tilt values of all the straight lines are analyzed and calculated, and the tilt values of the tilt images are obtained.
  • FIG. 1 is a schematic flow chart of a first embodiment of a method for acquiring a tilt value of a tilt image according to the present application
  • FIG. 2 is a schematic flow chart of a second embodiment of a method for acquiring a tilt value of a tilt image according to the present application
  • FIG 3 is a schematic structural view of an embodiment of a tilt value acquiring device of a tilt image of the present application.
  • FIG. 1 is a schematic flowchart of a first embodiment of a method for acquiring a tilt value of a tilt image according to the present application.
  • the method includes:
  • the oblique image is parsed, and a plurality of element regions are extracted.
  • the oblique image includes a plurality of elements arranged in order, and the elements may specifically be characters, special graphics, and the like.
  • the element area is an affine invariant area containing elements. Specifically, all the affine invariant regions in the oblique image may be extracted based on the region feature extraction algorithm, and the element regions (ie, regions having no features of all the single elements) are excluded therefrom, thereby obtaining the element regions.
  • Step 102 determining two adjacent element regions.
  • the distance between the two element regions may be acquired; determining whether the distance is less than a third preset threshold; if the distance is less than the third preset threshold, determining two element regions as two adjacent element regions .
  • the distance between the two element regions may be the distance between the center points of the two element regions.
  • the distance between the two element regions is the lateral distance and/or the longitudinal distance of the two element regions in the preset coordinate system.
  • the third preset threshold is less than twice the element row spacing or twice the column spacing; or the third preset threshold is less than twice the element row spacing, and Less than twice the spacing of the element columns.
  • the adjacent two element regions determined by step 102 include two element regions adjacent in the element sorting direction, and/or two element regions adjacent in the vertical direction. Wherein, the vertical direction is a direction perpendicular to the order in which the elements are sorted.
  • the number of linear directions connecting the adjacent two element regions depends on the line spacing of the elements, the column spacing, and the third predetermined threshold.
  • Step 103 Acquire all the inclination values of the straight lines connecting the adjacent two element regions.
  • the straight line connecting the adjacent two element regions may be a straight line connecting the respective reference points of the two element regions, and the reference point may be a corner point or a center point, which is preferably a center point in this embodiment.
  • the slope value of the line can be the tilt angle or slope.
  • step 104 the tilt values of all the straight lines are analyzed and calculated, and the tilt values of the tilt images are obtained.
  • step 104 may cluster the tilt values of all the straight lines acquired in step 103 to obtain a plurality of tilt value clusters; determine the tilt value clusters whose weights meet the preset conditions; and calculate the tilt value clusters whose weights meet the preset conditions. Mean value, the tilt value of the oblique image is obtained.
  • the preset condition matches the category of the weight of the target cluster (ie, the cluster of tilt values corresponding to the sorting direction of the element), and the preset condition may be a preset range or a preset weight level; wherein the preset range may be a target The extent to which the weight of the cluster belongs; the preset weight level may be the magnitude of the weight of the target cluster in the weight of all acquired skew value clusters.
  • Different tilt value clusters correspond to different adjacent directions. Since the arrangement of elements in the oblique image is fixed, the weight of each tilt value cluster obtained in step 104 is a known fixed value, that is, with elements. The weight of the tilt value cluster corresponding to the adjacent direction in which the sorting directions are the same is also a known fixed value. Therefore, the preset range and the preset size arrangement level can be preset.
  • the preset condition may also be the weight maximum.
  • the tilt values of all the straight lines acquired in step 103 are clustered to obtain a plurality of tilt value clusters; from all the tilt value clusters, the tilt value cluster with the largest weight is obtained; and the tilt value cluster with the largest weight is calculated. Mean value, the tilt value of the oblique image is obtained.
  • the cluster of tilt values with the largest weight refers to the cluster of tilt values with the largest number of skew values.
  • K-means algorithm such as balanced iterative reduction using hierarchical structure and clustering algorithm
  • hierarchical algorithm such as balanced iterative reduction using hierarchical structure and clustering algorithm
  • model algorithm etc.
  • K The mean value algorithm is exemplified as an example: firstly, k tilt values are arbitrarily selected from all the tilt values as the initial cluster center; and for the remaining tilt values, according to their similarity with these initial cluster centers (That is, the distance from the initial cluster center), respectively assigned to the cluster cluster represented by the initial cluster center, which is the most similar, to obtain k clusters; recalculate the cluster centers of the k clusters ( That is, the mean value of each tilt value in the cluster cluster is obtained; according to the recalculated cluster center, all the tilt values are clustered again (that is, according to their similarity with these cluster centers, they are respectively assigned to them most similarly The cluster of clusters represented by the cluster center), and repeat this step until the cluster clusters do not change.
  • K-means algorithm such as balanced iterative
  • the third preset threshold may be set such that the adjacent direction is uniquely determined as the sorting direction of the element, wherein the set third preset threshold is greater than or equal to the column spacing and less than the line spacing.
  • the mean value of the tilt value cluster with the largest weight is the tilt value corresponding to the element sorting direction, that is, the tilt value of the tilt image.
  • the mean value of the tilt value cluster having the largest weight is inconsistent with the tilt value corresponding to the element sorting direction, and the mean value can be corrected to obtain the tilt value of the tilt image.
  • the process of correcting the mean value to obtain the tilt value of the tilt image is as follows: acquiring a preset offset value, wherein the preset offset value is a deviation value between the mean value and the tilt value corresponding to the arrangement direction; The preset deviation value corrects the mean value to obtain the tilt value of the tilt image.
  • the process of acquiring the preset deviation value is as follows: the image is parsed by a preset, and the line segments connecting the adjacent two element regions are determined, and the number of line segments parallel to each adjacent direction is separately counted, and the adjacent number corresponding to the largest number is determined.
  • the direction obtains the angle information between the adjacent direction and the sorting direction of the element, and determines the preset deviation value based on the angle information.
  • the embodiment of the present application determines the slope of the oblique image by determining the adjacent two element regions, and acquiring the slope values of all the straight lines connecting the adjacent two element regions, and analyzing and calculating the slope values of all the straight lines.
  • the value is such that the inclination value of the oblique image is determined by the straight line connecting the element regions without extracting the boundary line of the image to determine the inclination value, and can be applied to the non-rectangular or rectangular oblique image at the same time.
  • FIG. 2 is a schematic flowchart of a second embodiment of a method for acquiring a tilt value of a tilt image according to the present application.
  • the method includes:
  • the oblique image is parsed, and all the maximum stable extreme value regions are extracted.
  • the tilt image may specifically be a captured image of the ID card.
  • Step 202 Determine a rectangular boundary for each of the maximum stable extreme value regions. Since each of the maximum stable extreme value regions is an irregular region, it is inconvenient to calculate the center point thereof, and it is also inconvenient to remove the non-element region. Therefore, it is necessary to determine an external rectangular boundary for each of the maximum stable extreme value regions, so as to facilitate the pair of elements.
  • the minimum circumscribed rectangle refers to the maximum range of the two-dimensional shape represented by two-dimensional coordinates, that is, the maximum abscissa, the minimum abscissa, the maximum ordinate, and the minimum ordinate of each vertice of a given two-dimensional shape are defined The rectangle.
  • the element area is filtered out from all the maximum stable extreme value areas to obtain a plurality of element areas.
  • the oblique image includes a plurality of elements arranged in order, and the elements may specifically be characters, special graphics, and the like.
  • the element area is an affine invariant area containing elements.
  • the step includes: detecting whether there is a first rectangular boundary; if detecting the first rectangular boundary, filtering out the maximum stable extreme region corresponding to the first rectangular boundary from all the maximum stable extreme regions.
  • the non-element region is a maximum stable extremum region corresponding to the first rectangular boundary;
  • the first rectangular boundary is a rectangular boundary located inside the other rectangular boundary, the rectangular boundary having an area larger than the first preset threshold, or the aspect ratio is greater than the first A rectangular boundary with two preset thresholds.
  • the first preset threshold is greater than or equal to an area value corresponding to the element in the oblique image.
  • the size of the second preset threshold depends on the shape of the element. If the shape of the element is a character, the second preset threshold can be set to 1.5, because normally the length ratio of the rectangular boundary of the regular character is not greater than 1.5. . In some cases, the interior of the element area will also wrap a smaller maximum stable extremum area, so it is also necessary to filter out the maximum stable extremum area corresponding to the inner rectangular boundary of the other rectangular boundary.
  • Step 204 determining two adjacent element regions.
  • the two embodiments of the step have been generally described above, and the second embodiment is further introduced.
  • the step 204 includes: obtaining the lateral distance and the longitudinal direction of the two element regions in the preset coordinate system. The distance is determined as to whether the lateral distance is less than the lateral threshold; whether the longitudinal distance is less than the longitudinal threshold; if the lateral distance is less than the lateral threshold, and the longitudinal distance is less than the longitudinal threshold, the two element regions are determined as the adjacent two element regions.
  • the horizontal threshold and the vertical threshold may be customized according to actual conditions, but it is required to ensure that the horizontal threshold is less than twice the column spacing of the elements, and the vertical threshold is less than twice the line spacing of the elements.
  • Step 205 Acquire all the inclination values of the straight lines connecting the adjacent two element regions.
  • the coordinates of the geometric center of the element region ie, the center point of the rectangular boundary
  • two adjacent connections are calculated according to the coordinates of the geometric center of the adjacent two element regions.
  • the slope of the line of the geometric center of the element area When the slope value is the slope, the slope is the ratio of the difference between the ordinate of the two geometric centers and the difference between the abscissas.
  • Step 206 Clustering the tilt values of all the straight lines to obtain a plurality of tilt value clusters.
  • the step includes: acquiring a preset number (a preset number is used to define the number of tilt value clusters); clustering all the tilt values to obtain a preset number of tilt value clusters; calculating a variance of each tilt value cluster Obtaining a minimum variance value; determining whether the minimum variance value is less than a fourth preset threshold; if the minimum variance value is greater than or equal to a fourth preset threshold, updating the preset number, and returning to perform clustering on all the tilt values And obtaining a preset number of tilt value clusters until the minimum variance value is less than the fourth preset threshold.
  • the preset number can be set to 2.
  • the step of updating the preset number includes: obtaining a preset number of current values; adding 1 to the current value to obtain a new value, and assigning the new value to the preset number.
  • the size of the fourth preset threshold may be defined according to the actual situation. When the tilt image is an image of an ID card, the value may be set to 200. By setting the minimum variance of the tilt value cluster to be smaller than the fourth preset threshold, it can be ensured that each tilt value cluster is sufficiently converged, thereby improving the accuracy of the tilt value calculation of the oblique image.
  • the step of clustering all the tilt values to obtain a preset number of tilt value clusters includes: arbitrarily selecting a preset number of tilt values from all the tilt values as the initial cluster center; and for remaining others
  • the tilt values are assigned to the cluster clusters represented by the initial cluster centers, based on their similarity with the initial cluster centers (ie, the distance from the initial cluster center). The number of clusters.
  • Step 207 Obtain a cluster of tilt values with the largest weight.
  • Step 208 Calculate the mean value of the tilt value cluster with the largest weight, and obtain the tilt value of the tilt image. By obtaining the mean of the cluster of tilt values with the largest weight, the tilt value of the tilt image can be made more accurate.
  • the embodiment of the present application filters out the element regions, thereby ensuring that the remaining maximum stable extreme value regions are all element regions, thereby avoiding the subsequent calculation of the non-element regions, thereby improving the calculation of the tilt value of the oblique image.
  • Accuracy in addition, by setting the minimum variance of the tilt value cluster to be less than the fourth preset threshold, it can be ensured that each tilt value cluster is sufficiently convergent, and the accuracy of the tilt value calculation of the oblique image is also improved.
  • FIG. 3 is a schematic structural diagram of an embodiment of a tilt value acquiring device for a tilt image according to the present application.
  • the oblique image includes a plurality of elements arranged in order.
  • the tilt value acquisition means includes an element region extraction module 301, an adjacent region determination module 302, a linear slope value acquisition module 303, and an image tilt value acquisition module 304.
  • the element region extraction module 301 is configured to parse the oblique image and extract a plurality of element regions.
  • the elements can be specific characters, special graphics, and the like.
  • the element area is an affine invariant area containing elements.
  • the element region extraction module 301 includes a parsing unit and a filtering unit.
  • the parsing unit is used to parse the oblique image and extract all the maximum stable extremum regions.
  • the filtering unit is used to filter out the element area from all the maximum stable extreme value areas to obtain a plurality of element areas.
  • the filtering unit is further configured to detect whether there is a first rectangular boundary; if the first rectangular boundary is detected, the maximum stable extreme value region corresponding to the first rectangular boundary is filtered out from all the maximum stable extreme value regions.
  • the first rectangular boundary has been described in detail above and will not be described here.
  • the adjacent area determining module 302 is configured to determine two adjacent element areas.
  • the adjacent area determining module 302 includes a distance acquiring unit, a determining unit, and a determining unit.
  • the distance obtaining unit is configured to acquire a distance between two element regions;
  • the determining unit is configured to determine whether the distance is less than a third preset threshold; and the determining unit is configured to: if the distance is less than a third preset threshold, Then two element areas are determined as two adjacent element areas.
  • the distance acquiring unit is configured to acquire a lateral distance and a longitudinal distance of the two element regions in the preset coordinate system; the determining unit is configured to determine whether the lateral distance is less than a lateral threshold, and determine whether the longitudinal distance is smaller than the vertical direction. Threshold; determining unit is configured to determine two element regions as adjacent two element regions if the lateral distance is less than the lateral threshold and the longitudinal distance is less than the longitudinal threshold.
  • the linear tilt value acquisition module 303 is configured to acquire the tilt values of all the straight lines connecting the two adjacent element regions.
  • the image tilt value obtaining module 304 is configured to perform an analysis calculation on the tilt values of all the straight lines to obtain the tilt value of the tilt image.
  • the image tilt value acquisition module 304 includes a clustering unit, a tilt value cluster determining unit, and a processing unit.
  • the clustering unit is configured to cluster the tilt values of all the straight lines to obtain a plurality of tilt value clusters;
  • the oblique value cluster determining unit is configured to determine the tilt value clusters whose weights meet the preset conditions;
  • the tilt value of the tilt image is obtained by calculating the mean value of the tilt value clusters whose weights meet the preset conditions.
  • the preset conditions have been described above in detail and will not be described here.
  • the processing unit may correct the mean value to obtain the tilt value of the tilt image.
  • the processing unit is configured to obtain a preset deviation value, wherein the preset deviation value is a deviation value between the mean value and the tilt value corresponding to the arrangement direction; and the mean value is corrected based on the preset deviation value to obtain a tilt image.
  • the slope value is a preset deviation value, wherein the preset deviation value is a deviation value between the mean value and the tilt value corresponding to the arrangement direction; and the mean value is corrected based on the preset deviation value to obtain a tilt image.
  • the clustering unit is configured to cluster the tilt values of all the straight lines to obtain a plurality of tilt value clusters; the oblique value cluster determining unit is configured to determine the tilt value cluster with the largest weight; the processing unit It is used to calculate the mean value of the tilt value cluster with the largest weight, and obtain the tilt value of the tilt image.
  • the clustering unit is specifically configured to: acquire a preset number; cluster all the tilt values to obtain a preset number of tilt value clusters; calculate a variance of each tilt value cluster to obtain a minimum variance value; and determine a minimum square Whether the difference is smaller than the fourth preset threshold; if the minimum variance value is greater than or equal to the fourth preset threshold, updating the preset number, and returning to perform clustering on all the tilt values to obtain a preset number of tilt value clusters, Until the minimum variance value is less than the fourth predetermined threshold.
  • the embodiment of the present application determines the slope of the oblique image by determining the adjacent two element regions, and acquiring the slope values of all the straight lines connecting the adjacent two element regions, and analyzing and calculating the slope values of all the straight lines.
  • the value is such that the inclination value of the oblique image is determined by the straight line connecting the element regions without extracting the boundary line of the image to determine the inclination value, and can be applied to the non-rectangular or rectangular oblique image at the same time.
  • the embodiment of the present application further provides a terminal, including a memory, a processor, and computer readable instructions stored in the memory and executable on the processor, and the processor implements the tilt image according to the computer readable instructions Tilt value acquisition method.
  • embodiments of the present application also provide one or more non-volatile readable storage media storing computer readable instructions.
  • the one or more non-transitory readable storage mediums storing computer readable instructions, when executed by one or more processors, causing one or more processors to perform, the tilting of the oblique image described above Value acquisition method.
  • the program when executed, may include the flow of an embodiment of the methods as described above.
  • the storage medium may be a magnetic disk, an optical disk, a read-only memory (ROM), or a random access memory (RAM).

Landscapes

  • Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • Computer Vision & Pattern Recognition (AREA)
  • General Physics & Mathematics (AREA)
  • Theoretical Computer Science (AREA)
  • Geometry (AREA)
  • Image Analysis (AREA)

Abstract

本申请提供了一种倾斜图像的倾斜值获取方法及装置、终端、存储介质。其中,倾斜值获取方法包括:解析倾斜图像,提取多个元素区域,元素区域为包含元素的仿射不变区域;确定相邻的两个元素区域;获取所有的连接相邻的两个元素区域的直线的倾斜值;对所有的所述直线的倾斜值进行分析计算,获取倾斜图像的倾斜值。本申请可以同时适用于非矩形或矩形的倾斜图像。

Description

倾斜图像的倾斜值获取方法及装置、终端、存储介质
本申请以2017年7月28日提交的申请号为201710630872.X,名称为“倾斜图像的倾斜值获取方法及装置、终端、存储介质”的中国发明专利申请为基础,并要求其优先权。
技术领域
本申请涉及图像处理领域,尤其涉及一种倾斜图像的倾斜值获取方法及装置、终端、存储介质。
背景技术
目前,若要获取具有元素信息(例如字符)的图像的倾斜度,最简单的方法是提取其边界线,通过边界线的倾斜度来确定图像的倾斜度。但是这种方法只适用于矩形图像,且矩形图像的长度方向或宽度方向与元素的排序方向一致。当图像的边界线不具有直线特性时,例如边界线为曲线,很明显,通过提取边界线获取倾斜度的方式是不适用的。因此,亟需提供一种可以适用于非矩形的倾斜图像的倾斜度获取方法。
发明内容
为克服现有技术中非矩形的倾斜图像的倾斜度难以获取的问题,本申请提供一种倾斜图像的倾斜值获取方法及装置、终端、存储介质。
第一方面,本申请实施例提供了一种倾斜图像的倾斜值获取方法,所述倾斜图像包括按序排列的多个元素;所述倾斜值获取方法包括:
解析倾斜图像,提取多个元素区域,所述元素区域为包含所述元素的仿射不变区域;
确定相邻的两个元素区域;
获取所有的连接相邻的两个元素区域的直线的倾斜值;
对所有的所述直线的倾斜值进行分析计算,获取所述倾斜图像的倾斜值。
优选地,所述解析倾斜图像,提取多个元素区域,包括:
解析倾斜图像,提取所有的最大稳定极值区域;
从所有的最大稳定极值区域中滤除非元素区域,得到多个所述元素区域。
优选地,所述元素为字符,所述非元素区域为第一矩形边界对应的最大稳定极值区域;
所述解析倾斜图像,提取所有的最大稳定极值区域之后,还包括:
分别为各所述最大稳定极值区域确定矩形边界;
所述从所有的最大稳定极值区域中滤除非元素特征区域,包括:
检测是否有所述第一矩形边界,所述第一矩形边界为位于其它矩形边界的内部的矩形边界、面积大于第一预设阈值的矩形边界、或长宽比大于第二预设阈值的矩形边界;
若检测有第一矩形边界,则从所有的最大稳定极值区域中将第一矩形边界对应的最大稳定极值区域滤除。
优选地,所述确定相邻的两个元素区域,包括:
获取两个元素区域之间的距离;
判断所述距离是否小于第三预设阈值;
若所述距离小于第三预设阈值,则将两个元素区域确定为相邻的两个元素区域。
优选地,所述确定相邻的两个元素区域,包括:
获取两个元素区域在预设坐标系中的横向距离和纵向距离;
判断所述横向距离是否小于横向阈值;
判断所述纵向距离是否小于纵向阈值;
若所述横向距离小于所述横向阈值,且所述纵向距离小于所述纵向阈值,则将两个元素区域确定为相邻的两个元素区域。
优选地,所述对所有的所述直线的倾斜值进行分析计算,获取所述倾斜图像的倾斜值,包括:
对所有的所述直线的倾斜值进行聚类,得到多个倾斜值簇;
获取权重最大的倾斜值簇;
计算权重最大的倾斜值簇的均值,获取所述倾斜图像的倾斜值。
优选地,所述对所有的倾斜值进行聚类,得到多个倾斜值簇,包括:
获取预设数目;
对所有的倾斜值进行聚类,得到预设数目的倾斜值簇;
计算各个倾斜值簇的方差,得到最小方差值;
判断所述最小方差值是否小于第四预设阈值;
若最小方差值大于或等于第四预设阈值,则更新预设数目,返回执行所述对所有的倾斜值进行聚类,得到预设数目的倾斜值簇,直至所述最小方差值小于第四预设阈值。
第二方面,本申请实施例提供了一种倾斜图像的倾斜值获取装置,所述倾斜图像包括按序排列的多个元素;所述倾斜值获取装置包括:
元素区域提取模块,用于解析倾斜图像,提取多个元素区域,所述元素区域为包含所 述元素的仿射不变区域;
相邻区域确定模块,用于确定相邻的两个元素区域;
直线倾斜值获取模块,用于获取所有的连接相邻的两个元素区域的直线的倾斜值;
图像倾斜值获取模块,用于对所有的所述直线的倾斜值进行分析计算,获取所述倾斜图像的倾斜值。
第三方面,本申请实施例提供了一种终端,包括存储器、处理器以及存储在所述存储器中并可在所述处理器上运行的计算机可读指令,所述处理器执行所述计算机可读指令时实现如下步骤:
解析倾斜图像,提取多个元素区域,所述元素区域为包含所述元素的仿射不变区域;
确定相邻的两个元素区域;
获取所有的连接相邻的两个元素区域的直线的倾斜值;
对所有的所述直线的倾斜值进行分析计算,获取所述倾斜图像的倾斜值。
第四方面,本申请实施例提供一个或多个存储有计算机可读指令的非易失性可读存储介质,所述计算机可读指令被一个或多个处理器执行时,使得所述一个或多个处理器执行如下步骤:
解析倾斜图像,提取多个元素区域,所述元素区域为包含所述元素的仿射不变区域;
确定相邻的两个元素区域;
获取所有的连接相邻的两个元素区域的直线的倾斜值;
对所有的所述直线的倾斜值进行分析计算,获取所述倾斜图像的倾斜值。
本申请的一个或多个实施例的细节在下面的附图及描述中提出。本申请的其他特征和优点将从说明书、附图以及权利要求书变得明显。
附图说明
为了更清楚地说明本申请实施例中的技术方案,下面将对实施例描述中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图仅仅是本申请的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动的前提下,还可以根据这些附图获得其他的附图。
图1是本申请的倾斜图像的倾斜值获取方法的第一实施例的流程示意图;
图2是本申请的倾斜图像的倾斜值获取方法的第二实施例的流程示意图;
图3是本申请的倾斜图像的倾斜值获取装置的实施例的结构示意图。
具体实施方式
为了使本申请所解决的技术问题、技术方案及有益效果更加清楚明白,以下结合附图及实施例,对本申请进行进一步详细说明。应当理解,此处所描述的具体实施例仅仅用以解释本申请,并不用于限定本申请。
请参照图1,是本申请的倾斜图像的倾斜值获取方法的第一实施例的流程示意图。该方法包括:
步骤101,解析倾斜图像,提取多个元素区域。倾斜图像包括多个按序排列的元素,元素具体可以为字符、特殊图形等。其中,元素区域为包含元素的仿射不变区域。具体地,可以基于区域特征提取算法,对倾斜图像中所有的仿射不变区域进行提取,并从中剔除非元素区域(即不具有单个元素全部特征的区域),从而得到元素区域。
步骤102,确定相邻的两个元素区域。具体地,可以获取两个元素区域之间的距离;判断该距离是否小于第三预设阈值;若该距离小于第三预设阈值,则将两个元素区域确定为相邻的两个元素区域。作为第一种实施方式,两个元素区域之间的距离可以是两个元素区域中心点之间的距离。作为第二种实施方式,两个元素区域之间的距离是两个元素区域在预设坐标系中的横向距离和/或纵向距离。当图像中的多个元素排成多行和多列时,第三预设阈值小于元素行间距的两倍或列间距的两倍;或者第三预设阈值小于元素行间距的两倍,且小于元素列间距的两倍。通过步骤102确定的相邻的两个元素区域包括在元素排序方向上相邻的两个元素区域、和/或在垂直方向上相邻的两个元素区域。其中,垂直方向是与元素排序方向相垂直的方向。连接相邻的两个元素区域的直线方向(以下简称相邻方向)的数目取决于元素的行间距、列间距以及第三预设阈值。
步骤103,获取所有的连接相邻的两个元素区域的直线的倾斜值。连接相邻的两个元素区域的直线可以是连接两个元素区域各自的参照点的直线,参照点可以为角点或中心点,本实施例优选中心点。直线的倾斜值可以为倾斜角度或斜率。
步骤104,对所有的直线的倾斜值进行分析计算,获取倾斜图像的倾斜值。具体地,步骤104可以对步骤103获取的所有的直线的倾斜值进行聚类,得到多个倾斜值簇;确定权重符合预设条件的倾斜值簇;计算权重符合预设条件的倾斜值簇的均值,获取倾斜图像的倾斜值。
具体地,预设条件匹配目标簇(即与元素排序方向对应的倾斜值簇)的权重的所属范畴,预设条件可以为预设范围、或预设权重等级;其中,预设范围可以是目标簇的权重的所属范围;预设的权重等级可以是目标簇的权重在所有获取的倾斜值簇的权重中的大小等级。不同的倾斜值簇对应不同的相邻方向,由于倾斜图像中的元素的排布方式是固定的, 因此,步骤104中获取的各倾斜值簇的权重是已知定值,也就是说与元素排序方向一致的相邻方向所对应的倾斜值簇的权重也是已知定值,因此,预设范围和预设的大小排列等级均可以预先设定。
优选地,预设条件也可以为权重最大。,具体地,对步骤103获取的所有的直线的倾斜值进行聚类,得到多个倾斜值簇;从所有的倾斜值簇中,获取权重最大的倾斜值簇;计算权重最大的倾斜值簇的均值,获取倾斜图像的倾斜值。其中,权重最大的倾斜值簇是指拥有倾斜值的数目最多的倾斜值簇。具体地,对所有的直线的倾斜值进行聚类的方法有多种,如K-均值算法、层次算法(如使用层次结构的平衡迭代减少和聚类算法)和模型算法等等,现以K-均值算法为例进行具体说明:首先从所有的倾斜值任意选择k个倾斜值分别作为初始聚类中心;而对于所剩下其它倾斜值,则根据它们与这些初始聚类中心的相似度(即与初始聚类中心的距离),分别将它们分配给与其最相似的由初始聚类中心所代表的聚类簇,得到k个聚类簇;重新计算k个聚类簇的聚类中心(即获取聚类簇中各个倾斜值的均值);根据重新计算的聚类中心,再次对所有的倾斜值聚类(即将根据它们与这些聚类中心的相似度,分别将它们分配给与其最相似的由聚类中心所代表的聚类簇),并重复本步骤,直至各个聚类簇不会发生变化。
由于确定两个元素区域的相邻方向的数目取决于元素的行间距、列间距以及第三预设阈值,在当元素在排列方向上的间距(假设为列间距)远小于元素的行间距,可以通过设置第三预设阈值,使得相邻方向唯一确定为元素的排序方向,其中,设置的第三预设阈值大于或等于列间距,且小于行间距。此时,权重最大的倾斜值簇的均值即为元素排序方向所对应的倾斜值,即为倾斜图像的倾斜值。此外,若元素的排列分布不满足上述情况,权重最大的倾斜值簇的均值与元素排序方向所对应的倾斜值不一致,可以对该均值进行校正,得到倾斜图像的倾斜值。具体地,对该均值进行校正,得到倾斜图像的倾斜值的过程如下:获取预设偏差值,其中,预设偏差值为均值和与排列方向所对应的倾斜值的之间的偏差值;基于预设偏差值对均值进行校正,得到倾斜图像的倾斜值。预设偏差值的获取过程如下:预设对图像进行解析,确定连接相邻的两个元素区域的线段,分别统计与各个相邻方向平行的线段的数目,确定最大的数目所对应的相邻方向,获取相邻方向与元素排序方向之间的夹角信息,基于夹角信息确定预设偏差值。
本申请实施例通过确定相邻的两个元素区域,并获取所有的连接相邻的两个元素区域的直线的斜率值,以及对所有的直线的斜率值进行分析计算,从而得到倾斜图像的倾斜值,这样,通过连接元素区域的直线确定倾斜图像的倾斜值,而不用提取图像的边界线以确定 倾斜值,可以同时适用于非矩形或矩形的倾斜图像。
请参照图2,是本申请的倾斜图像的倾斜值获取方法的第二实施例的流程示意图。该方法包括:
步骤201,解析倾斜图像,提取所有的最大稳定极值区域。倾斜图像具体可以为身份证的拍摄图像。
步骤202,分别为各最大稳定极值区域确定矩形边界。由于各个最大稳定极值区域是不规则的区域,不便于计算其中心点,也不便于对非元素区域的去除,因此需要为各最大稳定极值区域确定一个外接的矩形边界,以便于对元素区域的中心点的计算。具体地,本步骤包括:确定最大稳定极值区域的轮廓;根据确定的轮廓,得到该轮廓的最小外接矩形,从而得到该最大稳定极值区域的矩形边界。其中,最小外接矩形是指以二维坐标表示的二维形状的最大范围,即以给定的二维形状各顶点中的最大横坐标、最小横坐标、最大纵坐标、最小纵坐标定下边界的矩形。
步骤203,从所有的最大稳定极值区域中滤除非元素区域,得到多个元素区域。倾斜图像包括多个按序排列的元素,元素具体可以为字符、特殊图形等。其中,元素区域为包含元素的仿射不变区域。具体地,本步骤包括:检测是否有第一矩形边界;若检测有第一矩形边界,则从所有的最大稳定极值区域中将第一矩形边界对应的最大稳定极值区域滤除。其中,非元素区域为第一矩形边界对应的最大稳定极值区域;第一矩形边界为位于其它矩形边界的内部的矩形边界、面积大于第一预设阈值的矩形边界、或长宽比大于第二预设阈值的矩形边界。其中,第一预设阈值大于或等于元素在倾斜图像中所对应的面积值。第二预设阈值的大小取决于元素的形状,如元素的形状为字符,那么第二预设阈值可以设为1.5,这是因为通常情况下规则字符的矩形边界的长度比都不会大于1.5。在一些情况下,元素区域内部也会包裹更小的最大稳定极值区域,因此,还需要将位于其它矩形边界的内部的矩形边界对应的最大稳定极值区域滤除。
步骤204,确定相邻的两个元素区域。该步骤的两种实施方式已在上文中作了大致介绍,现针对第二种实施方式做进一步介绍,具体地,步骤204包括:获取两个元素区域在预设坐标系中的横向距离和纵向距离;判断横向距离是否小于横向阈值;判断纵向距离是否小于纵向阈值;若横向距离小于横向阈值,且纵向距离小于纵向阈值,则将两个元素区域确定为相邻的两个元素区域。其中,横向阈值和纵向阈值的大小均可以根据实际情况自定义,但需要保证横向阈值小于元素的列间距的两倍,且纵向阈值小于元素的行间距的两倍。
步骤205,获取所有的连接相邻的两个元素区域的直线的倾斜值。具体地,可以根据元素区域的矩形边界,获取元素区域的几何中心(即矩形边界的中心点)的坐标,并根据相邻的两个元素区域的几何中心的坐标,计算连接相邻的两个元素区域的几何中心的直线的倾斜值。当倾斜值为斜率时,斜率为两几何中心的纵坐标之差与横坐标之差的比值。
步骤206,对所有的所述直线的倾斜值进行聚类,得到多个倾斜值簇。具体地,本步骤包括:获取预设数目(预设数目用于定义倾斜值簇的数目);对所有的倾斜值进行聚类,得到预设数目的倾斜值簇;计算各个倾斜值簇的方差,得到最小方差值;判断最小方差值是否小于第四预设阈值;若最小方差值大于或等于第四预设阈值,则更新预设数目,返回执行对所有的倾斜值进行聚类,得到预设数目的倾斜值簇,直至最小方差值小于第四预设阈值。其中,预设数目可以设置为2。更新预设数目的步骤,包括:获取预设数目的当前值;对当前值加1,得到新值,将新值赋值给预设数目。第四预设阈值的大小可以根据实际情况自己定义,在当倾斜图像为身份证的图像,该值可以设置为200。通过设置倾斜值簇的最小方差小于第四预设阈值,可以保证各倾斜值簇足够收敛,从而提高对倾斜图像的倾斜值计算的精确度。
具体地,对所有的倾斜值进行聚类,得到预设数目的倾斜值簇的步骤包括:从所有的倾斜值任意选择预设数目的倾斜值分别作为初始聚类中心;而对于所剩下其它倾斜值,则根据它们与这些初始聚类中心的相似度(即与初始聚类中心的距离),分别将它们分配给与其最相似的由初始聚类中心所代表的聚类簇,得到预设数目的聚类簇。
步骤207,获取权重最大的倾斜值簇。
步骤208,计算权重最大的倾斜值簇的均值,获取倾斜图像的倾斜值。通过获取权重最大的倾斜值簇的均值,可以使倾斜图像的倾斜值更为精确。
本申请实施例通过滤除非元素区域,从而保证得到的剩余最大稳定极值区域均为元素区域,从而避免了非元素区域的对后续计算的干拢,从而提高了对倾斜图像的倾斜值计算的精确度;此外,通过设置倾斜值簇的最小方差小于第四预设阈值,可以保证各倾斜值簇足够收敛,同样也提高了对倾斜图像的倾斜值计算的精确度。
上文针对本申请的倾斜图像的倾斜值获取方法做了详细介绍,下面将相对于上述方法的装置做进一步阐述。
请参照图3,是本申请的倾斜图像的倾斜值获取装置的实施例的结构示意图。倾斜图像包括按序排列的多个元素。倾斜值获取装置包括元素区域提取模块301、相邻区域确定模块302、直线倾斜值获取模块303和图像倾斜值获取模块304。
元素区域提取模块301,用于解析倾斜图像,提取多个元素区域。元素具体可以为字符、特殊图形等。其中,元素区域为包含元素的仿射不变区域。具体地,元素区域提取模块301包括解析单元和滤除单元。解析单元用于解析倾斜图像,提取所有的最大稳定极值区域。滤除单元用于从所有的最大稳定极值区域中滤除非元素区域,得到多个元素区域。滤除单元进一步用于检测是否有第一矩形边界;若检测有第一矩形边界,则从所有的最大稳定极值区域中将第一矩形边界对应的最大稳定极值区域滤除。第一矩形边界已在上文中作了详细介绍,故在此不作赘述。
相邻区域确定模块302,用于确定相邻的两个元素区域。相邻区域确定模块302包括距离获取单元、判断单元和确定单元。作为一种实施方式,距离获取单元用于获取两个元素区域之间的距离;判断单元用于判断该距离是否小于第三预设阈值;确定单元用于若该距离小于第三预设阈值,则将两个元素区域确定为相邻的两个元素区域。作为另一种实施方式,距离获取单元用于获取两个元素区域在预设坐标系中的横向距离和纵向距离;判断单元用于,判断横向距离是否小于横向阈值,以及判断纵向距离是否小于纵向阈值;确定单元用于若横向距离小于横向阈值,且纵向距离小于纵向阈值,则将两个元素区域确定为相邻的两个元素区域。
直线倾斜值获取模块303,用于获取所有的连接相邻的两个元素区域的直线的倾斜值。
图像倾斜值获取模块304,用于对所有的直线的倾斜值进行分析计算,获取倾斜图像的倾斜值。图像倾斜值获取模块304包括聚类单元、倾斜值簇确定单元和处理单元。作为一种实施方式,聚类单元用于对所有的直线的倾斜值进行聚类,得到多个倾斜值簇;斜值簇确定单元用于确定权重符合预设条件的倾斜值簇;处理单元用于计算权重符合预设条件的倾斜值簇的均值,获取倾斜图像的倾斜值。预设条件已在上文中作为详细介绍故在此不作赘述。若元素的排列分布不满足上述情况,权重最大的倾斜值簇的均值与元素排序方向所对应的倾斜值不一致,处理单元可以对该均值进行校正,得到倾斜图像的倾斜值。具体地,处理单元用于获取预设偏差值,其中,预设偏差值为均值和与排列方向所对应的倾斜值的之间的偏差值;基于预设偏差值对均值进行校正,得到倾斜图像的倾斜值。
优选地,作为另一种实施方式,聚类单元用于对所有的直线的倾斜值进行聚类,得到多个倾斜值簇;斜值簇确定单元用于确定权重最大的倾斜值簇;处理单元用于计算权重最大的倾斜值簇的均值,获取倾斜图像的倾斜值。该实施方式已在上文中作了详细介绍,故在此不作赘述。
优选地,聚类单元具体用于:获取预设数目;对所有的倾斜值进行聚类,得到预设数 目的倾斜值簇;计算各个倾斜值簇的方差,得到最小方差值;判断最小方差值是否小于第四预设阈值;若最小方差值大于或等于第四预设阈值,则更新预设数目,返回执行对所有的倾斜值进行聚类,得到预设数目的倾斜值簇,直至最小方差值小于第四预设阈值。
本申请实施例通过确定相邻的两个元素区域,并获取所有的连接相邻的两个元素区域的直线的斜率值,以及对所有的直线的斜率值进行分析计算,从而得到倾斜图像的倾斜值,这样,通过连接元素区域的直线确定倾斜图像的倾斜值,而不用提取图像的边界线以确定倾斜值,可以同时适用于非矩形或矩形的倾斜图像。
本申请实施例还提供了一种终端,包括存储器、处理器以及存储在所述存储器中并可在处理器上运行的计算机可读指令,处理器执行计算机可读指令时实现上述的倾斜图像的倾斜值获取方法。
此外,本申请实施例还提供一个或多个存储有计算机可读指令的非易失性可读存储介质。该一个或多个存储有计算机可读指令的非易失性可读存储介质,计算机可读指令被一个或多个处理器执行时,使得一个或多个处理器执行,上述的倾斜图像的倾斜值获取方法。
本领域普通技术人员可以理解实现上述实施例方法中的全部或部分流程,是可以通过计算机可读指令来指令相关的硬件来完成,所述的程序可存储于一个或多个存储有计算机可读指令的非易失性可读存储介质中,该程序在执行时,可包括如上述各方法的实施例的流程。其中,所述的存储介质可为磁碟、光盘、只读存储记忆体(Read-Only Memory,ROM)或随机存储记忆体(Random Access Memory,RAM)等。
如上所述是结合具体内容提供的一种或多种实施方式,并不认定本申请的具体实施只局限于这些说明。凡与本申请的方法、结构等近似、雷同,或是对于本申请构思前提下做出若干技术推演或替换,都应当视为本申请的保护范围。

Claims (20)

  1. 一种倾斜图像的倾斜值获取方法,其特征在于,所述倾斜图像包括按序排列的多个元素;所述倾斜值获取方法包括:
    解析倾斜图像,提取多个元素区域,所述元素区域为包含所述元素的仿射不变区域;
    确定相邻的两个元素区域;
    获取所有的连接相邻的两个元素区域的直线的倾斜值;
    对所有的所述直线的倾斜值进行分析计算,获取所述倾斜图像的倾斜值。
  2. 如权利要求1所述的倾斜图像的倾斜值获取方法,其特征在于,所述解析倾斜图像,提取多个元素区域,包括:
    解析倾斜图像,提取所有的最大稳定极值区域;
    从所有的最大稳定极值区域中滤除非元素区域,得到多个所述元素区域。
  3. 如权利要求2倾斜图像的倾斜值获取方法,其特征在于,所述元素为字符,所述非元素区域为第一矩形边界对应的最大稳定极值区域;
    所述解析倾斜图像,提取所有的最大稳定极值区域之后,还包括:
    为各所述最大稳定极值区域确定矩形边界;
    所述从所有的最大稳定极值区域中滤除非元素特征区域,包括:
    检测是否有所述第一矩形边界,所述第一矩形边界为位于其它矩形边界的内部的矩形边界、面积大于第一预设阈值的矩形边界、或长宽比大于第二预设阈值的矩形边界;
    若检测有第一矩形边界,则从所有的最大稳定极值区域中将第一矩形边界对应的最大稳定极值区域滤除。
  4. 如权利要求1所述的倾斜图像的倾斜值获取方法,其特征在于,所述确定相邻的两个元素区域,包括:
    获取两个元素区域之间的距离;
    判断所述距离是否小于第三预设阈值;
    若所述距离小于第三预设阈值,则将两个元素区域确定为相邻的两个元素区域。
  5. 如权利要求1所述的倾斜图像的倾斜值获取方法,其特征在于,所述确定相邻的两个元素区域,包括:
    获取两个元素区域在预设坐标系中的横向距离和纵向距离;
    判断所述横向距离是否小于横向阈值;
    判断所述纵向距离是否小于纵向阈值;
    若所述横向距离小于所述横向阈值,且所述纵向距离小于所述纵向阈值,则将两个元素区域确定为相邻的两个元素区域。
  6. 如权利要求1所述的倾斜图像的倾斜值获取方法,其特征在于,所述对所有的所述直线的倾斜值进行分析计算,获取所述倾斜图像的倾斜值,包括:
    对所有的所述直线的倾斜值进行聚类,得到多个倾斜值簇;
    获取权重最大的倾斜值簇;
    计算权重最大的倾斜值簇的均值,获取所述倾斜图像的倾斜值。
  7. 如权利要求6所述的倾斜图像的倾斜值获取方法,其特征在于,所述对所有的倾斜值进行聚类,得到多个倾斜值簇,包括:
    获取预设数目;
    对所有的倾斜值进行聚类,得到预设数目的倾斜值簇;
    计算各个倾斜值簇的方差,得到最小方差值;
    判断所述最小方差值是否小于第四预设阈值;
    若最小方差值大于或等于第四预设阈值,则更新预设数目,返回执行所述对所有的倾斜值进行聚类,得到预设数目的倾斜值簇,直至所述最小方差值小于第四预设阈值。
  8. 一种倾斜图像的倾斜值获取装置,其特征在于,所述倾斜图像包括按序排列的多个元素;所述倾斜值获取装置包括:
    元素区域提取模块,用于解析倾斜图像,提取多个元素区域,所述元素区域为包含所述元素的仿射不变区域;
    相邻区域确定模块,用于确定相邻的两个元素区域;
    直线倾斜值获取模块,用于获取所有的连接相邻的两个元素区域的直线的倾斜值;
    图像倾斜值获取模块,用于对所有的所述直线的倾斜值进行分析计算,获取所述倾斜图像的倾斜值。
  9. 一种终端,包括存储器、处理器以及存储在所述存储器中并可在所述处理器上运行的计算机可读指令,其特征在于,所述处理器执行所述计算机可读指令计算机可读指令时实现如下步骤:
    解析倾斜图像,提取多个元素区域,所述元素区域为包含所述元素的仿射不变区域;
    确定相邻的两个元素区域;
    获取所有的连接相邻的两个元素区域的直线的倾斜值;
    对所有的所述直线的倾斜值进行分析计算,获取所述倾斜图像的倾斜值。
  10. 如所述权利要求9所述的终端设备,其特征在于,所述解析倾斜图像,提取多个元素区域,包括:
    解析倾斜图像,提取所有的最大稳定极值区域;
    从所有的最大稳定极值区域中滤除非元素区域,得到多个所述元素区域。
  11. 如所述权利要求10所述的终端设备,其特征在于,所述元素为字符,所述非元素区域为第一矩形边界对应的最大稳定极值区域;
    所述解析倾斜图像,提取所有的最大稳定极值区域之后,还包括:
    为各所述最大稳定极值区域确定矩形边界;
    所述从所有的最大稳定极值区域中滤除非元素特征区域,包括:
    检测是否有所述第一矩形边界,所述第一矩形边界为位于其它矩形边界的内部的矩形边界、面积大于第一预设阈值的矩形边界、或长宽比大于第二预设阈值的矩形边界;
    若检测有第一矩形边界,则从所有的最大稳定极值区域中将第一矩形边界对应的最大稳定极值区域滤除。
  12. 如所述权利要求9所述的终端设备,其特征在于,所述确定相邻的两个元素区域,包括:
    获取两个元素区域之间的距离;
    判断所述距离是否小于第三预设阈值;
    若所述距离小于第三预设阈值,则将两个元素区域确定为相邻的两个元素区域。
  13. 如所述权利要求9所述的终端设备,其特征在于,所述对所有的所述直线的倾斜值进行分析计算,获取所述倾斜图像的倾斜值,包括:
    对所有的所述直线的倾斜值进行聚类,得到多个倾斜值簇;
    获取权重最大的倾斜值簇;
    计算权重最大的倾斜值簇的均值,获取所述倾斜图像的倾斜值。
  14. 如所述权利要求13所述的终端设备,其特征在于,所述对所有的倾斜值进行聚类,得到多个倾斜值簇,包括:
    获取预设数目;
    对所有的倾斜值进行聚类,得到预设数目的倾斜值簇;
    计算各个倾斜值簇的方差,得到最小方差值;
    判断所述最小方差值是否小于第四预设阈值;
    若最小方差值大于或等于第四预设阈值,则更新预设数目,返回执行所述对所有的倾斜值进行聚类,得到预设数目的倾斜值簇,直至所述最小方差值小于第四预设阈值。
  15. 一个或多个存储有计算机可读指令的非易失性可读存储介质,其特征在于,所述计算机可读指令被一个或多个处理器执行时,使得所述一个或多个处理器执行如下步骤:
    解析倾斜图像,提取多个元素区域,所述元素区域为包含所述元素的仿射不变区域;
    确定相邻的两个元素区域;
    获取所有的连接相邻的两个元素区域的直线的倾斜值;
    对所有的所述直线的倾斜值进行分析计算,获取所述倾斜图像的倾斜值。
  16. 如权利要求15所述的非易失性可读存储介质,其特征在于,所述解析倾斜图像,提取多个元素区域,包括:
    解析倾斜图像,提取所有的最大稳定极值区域;
    从所有的最大稳定极值区域中滤除非元素区域,得到多个所述元素区域。
  17. 如权利要求16所述的非易失性可读存储介质,其特征在于,所述元素为字符,所述非元素区域为第一矩形边界对应的最大稳定极值区域;
    所述解析倾斜图像,提取所有的最大稳定极值区域之后,还包括:
    为各所述最大稳定极值区域确定矩形边界;
    所述从所有的最大稳定极值区域中滤除非元素特征区域,包括:
    检测是否有所述第一矩形边界,所述第一矩形边界为位于其它矩形边界的内部的矩形边界、面积大于第一预设阈值的矩形边界、或长宽比大于第二预设阈值的矩形边界;
    若检测有第一矩形边界,则从所有的最大稳定极值区域中将第一矩形边界对应的最大稳定极值区域滤除。
  18. 如权利要求15所述的非易失性可读存储介质,其特征在于,所述确定相邻的两个元素区域,包括:
    获取两个元素区域之间的距离;
    判断所述距离是否小于第三预设阈值;
    若所述距离小于第三预设阈值,则将两个元素区域确定为相邻的两个元素区域。
  19. 如权利要求15所述的非易失性可读存储介质,其特征在于,所述对所有的所述直线的倾斜值进行分析计算,获取所述倾斜图像的倾斜值,包括:
    对所有的所述直线的倾斜值进行聚类,得到多个倾斜值簇;
    获取权重最大的倾斜值簇;
    计算权重最大的倾斜值簇的均值,获取所述倾斜图像的倾斜值。
  20. 如权利要求19所述的非易失性可读存储介质,其特征在于,所述对所有的倾斜值进行聚类,得到多个倾斜值簇,包括:
    获取预设数目;
    对所有的倾斜值进行聚类,得到预设数目的倾斜值簇;
    计算各个倾斜值簇的方差,得到最小方差值;
    判断所述最小方差值是否小于第四预设阈值;
    若最小方差值大于或等于第四预设阈值,则更新预设数目,返回执行所述对所有的倾斜值进行聚类,得到预设数目的倾斜值簇,直至所述最小方差值小于第四预设阈值。
PCT/CN2018/080837 2017-07-28 2018-03-28 倾斜图像的倾斜值获取方法及装置、终端、存储介质 Ceased WO2019019679A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201710630872.XA CN108269267B (zh) 2017-07-28 2017-07-28 倾斜图像的倾斜值获取方法及装置、终端、存储介质
CN201710630872.X 2017-07-28

Publications (1)

Publication Number Publication Date
WO2019019679A1 true WO2019019679A1 (zh) 2019-01-31

Family

ID=62771735

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2018/080837 Ceased WO2019019679A1 (zh) 2017-07-28 2018-03-28 倾斜图像的倾斜值获取方法及装置、终端、存储介质

Country Status (2)

Country Link
CN (1) CN108269267B (zh)
WO (1) WO2019019679A1 (zh)

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20150304651A1 (en) * 2014-04-18 2015-10-22 Fujitsu Limited Method of detecting tilt of image capturing direction and apparatus of detecting tilt of image capturing direction
CN105184294A (zh) * 2015-09-22 2015-12-23 成都数联铭品科技有限公司 一种基于像素追踪的倾斜文字判断识别方法
CN105590112A (zh) * 2015-09-22 2016-05-18 成都数联铭品科技有限公司 一种图像识别中倾斜文字判断方法
CN106067023A (zh) * 2016-06-02 2016-11-02 北京国泰星云科技有限公司 基于图像处理的集装箱箱号及集卡车号识别系统及方法

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20150304651A1 (en) * 2014-04-18 2015-10-22 Fujitsu Limited Method of detecting tilt of image capturing direction and apparatus of detecting tilt of image capturing direction
CN105184294A (zh) * 2015-09-22 2015-12-23 成都数联铭品科技有限公司 一种基于像素追踪的倾斜文字判断识别方法
CN105590112A (zh) * 2015-09-22 2016-05-18 成都数联铭品科技有限公司 一种图像识别中倾斜文字判断方法
CN106067023A (zh) * 2016-06-02 2016-11-02 北京国泰星云科技有限公司 基于图像处理的集装箱箱号及集卡车号识别系统及方法

Also Published As

Publication number Publication date
CN108269267A (zh) 2018-07-10
CN108269267B (zh) 2019-10-08

Similar Documents

Publication Publication Date Title
US11074443B2 (en) Method and device for acquiring slant value of slant image, terminal and storage medium
CN110298858B (zh) 一种图像裁剪方法及装置
CN110136069B (zh) 文本图像矫正方法、装置与电子设备
US10062007B2 (en) Apparatus and method for creating an image recognizing program having high positional recognition accuracy
US10349832B2 (en) Method of detecting boundary between iris and sclera
CN111275040A (zh) 定位方法及装置、电子设备、计算机可读存储介质
CN111222508B (zh) 基于roi的户型图比例尺识别方法、装置、计算机设备
CN118379295B (zh) 一种基于配准的高光谱异常检测方法
CN114220108A (zh) 自然场景的文本识别方法、可读存储介质及文本识别装置
US20180268212A1 (en) Information processing apparatus, information processing system, and non-transitory computer readable medium
CN115661131A (zh) 一种图像识别方法、装置、电子设备及存储介质
CN107305682B (zh) 用于对图像进行拼接的方法和装置
CN112699863B (zh) 指纹增强方法、计算机可读存储介质及电子设备
CN111783775B (zh) 一种图像采集方法、装置、设备和计算机可读存储介质
CN116434071B (zh) 一种规整化建筑掩膜的确定方法、确定装置、设备及介质
KR20110091381A (ko) 영상 안정화 시스템 및 방법
US12211198B2 (en) Method for detecting defects in divided and further divided images based on trained models, electronic device, and storage medium
CN113780313B (zh) 线特征的提取方法、装置和电子设备
CN115294590A (zh) 图像中单字的检测方法及装置、电子设备、存储介质
WO2019019681A1 (zh) 身份证图像的倾斜值获取方法及装置、终端、存储介质
CN109035285B (zh) 图像边界确定方法及装置、终端及存储介质
WO2019019679A1 (zh) 倾斜图像的倾斜值获取方法及装置、终端、存储介质
CN110245674A (zh) 模板匹配方法、装置、设备及计算机存储介质
CN108564571B (zh) 图像区域选取方法及终端设备
CN114943973A (zh) 一种文本校正方法、装置、计算机设备及存储介质

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 18838883

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 18838883

Country of ref document: EP

Kind code of ref document: A1