WO2012000296A1 - Image tilt correction method and apparatus - Google Patents

Image tilt correction method and apparatus Download PDF

Info

Publication number
WO2012000296A1
WO2012000296A1 PCT/CN2010/080304 CN2010080304W WO2012000296A1 WO 2012000296 A1 WO2012000296 A1 WO 2012000296A1 CN 2010080304 W CN2010080304 W CN 2010080304W WO 2012000296 A1 WO2012000296 A1 WO 2012000296A1
Authority
WO
WIPO (PCT)
Prior art keywords
image
grayscale image
projection
grayscale
black
Prior art date
Application number
PCT/CN2010/080304
Other languages
French (fr)
Chinese (zh)
Inventor
李挺
陈维强
李月高
裴雷
刘微
Original Assignee
青岛海信网络科技股份有限公司
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 青岛海信网络科技股份有限公司 filed Critical 青岛海信网络科技股份有限公司
Publication of WO2012000296A1 publication Critical patent/WO2012000296A1/en

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T3/00Geometric image transformation in the plane of the image

Definitions

  • the present invention relates to the field of image processing technologies, and in particular, to an image tilt correction method and apparatus. Background technique
  • image processing technology is widely used in intelligent transportation systems.
  • the image recognition technology is usually used to image the license plate of the vehicle, thereby realizing the automatic acquisition of the license plate number of the vehicle.
  • the prior art license plate image recognition system needs to perform image correction processing on the license plates of all the detected vehicles, so that the image of the license plate can facilitate the image recognition system to recognize the license plate number.
  • the image correction processing method in the prior art performs correction processing on all detected images, and performs image correction processing on vehicles that have not tilted, which greatly increases the burden of image correction processing and affects the license plate.
  • the speed at which the tilted vehicle performs image correction processing reduces the correction efficiency of the image correction processing. Therefore, the processing method of the prior art method is low in efficiency.
  • the present invention provides an image tilt correction method and apparatus for solving the defect of low efficiency of the image tilt correction method in the prior art, and improving the correction efficiency of the image tilt correction method.
  • the step of performing a projection process on the grayscale image to determine whether the grayscale image is tilted specifically:
  • Whether the grayscale image is tilted is determined based on the comparison result.
  • An embodiment of the present invention further provides an image tilt correction apparatus, including:
  • a grayscale processing module configured to perform grayscale processing on the acquired image to obtain a grayscale image
  • a projection processing module configured to perform a projection process on the grayscale image to determine whether the grayscale image is tilted; : performing binarization processing on the grayscale image to obtain a binarized image; performing vertical projection on the binarized image to obtain a projection length of the binarized image; and using the projection length and the pre-projection length Setting a projection length threshold for comparison; determining whether the grayscale image is tilted according to a comparison result;
  • a correction processing module configured to perform a tilt correction process on the grayscale image if the grayscale image is tilted.
  • the image tilt correction method and apparatus determines whether the grayscale image is tilted by performing projection processing on the grayscale image, and performs tilt correction processing on the grayscale image if the grayscale image is in an oblique state, and The oblique grayscale image is not subjected to the tilt correction processing, and the correction efficiency of the image tilt correction method is improved.
  • FIG. 1 is a flow chart of an embodiment of an image tilt correction method according to the present invention.
  • FIG. 2 is a specific flowchart of step 102 in the image tilt correction method embodiment of the present invention
  • FIG. 3 is a specific flowchart of step 103 in the image tilt correction method embodiment of the present invention
  • 4 is a schematic structural view of an embodiment of an image tilt correction device according to the present invention
  • FIG. 5 is a schematic structural diagram of a projection processing module in an embodiment of an image tilt correction apparatus according to the present invention.
  • Fig. 6 is a schematic view showing the detailed structure of a correction processing module in the embodiment of the image tilt correction device of the present invention. detailed description
  • FIG. 1 is a flow chart of an embodiment of an image tilt correction method of the present invention. As shown in FIG. 1, the image tilt correction method of this embodiment includes:
  • Step 101 Perform grayscale processing on the acquired image to obtain a grayscale image.
  • step 101 in the present embodiment processes the acquired image information so that the processed image becomes a grayscale image.
  • the vehicle license plate is detected in the intelligent transportation system as an example.
  • the image information of the vehicle license plate on the road is obtained by the image acquisition device such as the camera provided on the road, and then the image information of the license plate is obtained through step 101.
  • Grayscale processing is performed to obtain a grayscale image of the license plate image.
  • Step 102 Perform a projection process on the grayscale image to determine whether the grayscale image is tilted.
  • the obtained grayscale image is subjected to projection processing by step 102, and it is determined whether the grayscale image is tilted based on the image information obtained by the projection.
  • Step 103 If the grayscale image is tilted, the grayscale image is subjected to tilt correction processing.
  • the grayscale image is obtained as a tilted image.
  • the grayscale image is subjected to tilt correction processing in step 103.
  • step 102 after it is known in step 102 that the obtained grayscale image of the license plate is in an inclined state, it can be determined that the detected license plate of the vehicle is inclined, and it is necessary to perform tilt correction processing on the grayscale image of the inclined license plate, and then step through 103 corrects the grayscale image of the license plate to obtain a grayscale image of the license plate without the oblique angle, so that the subsequent program obtains the license plate number according to the grayscale image without the oblique angle.
  • the image tilt correction method of the present embodiment can be applied to the license plate recognition system of the intelligent transportation system, and can also be used for other occasions where the image is subjected to the tilt correction processing.
  • the grayscale image is subjected to projection processing to determine whether the grayscale image is tilted, and if the grayscale image is in an oblique state, the grayscale image is subjected to tilt correction processing, and for the grayscale without tilting
  • the degree image is not subjected to the tilt correction processing, and the correction efficiency of the image tilt correction method is improved.
  • the image tilt correction method of the embodiment performs the tilt correction processing only on the image in the tilt state, and the tilt-free image does not need to perform the tilt correction processing, thereby effectively avoiding image information loss in the non-tilted image, which is beneficial to improving the entire image. The efficiency of the process.
  • step 102 in this embodiment is shown in FIG. 2, and specifically includes the following steps:
  • Step 1021 Perform a binarization process on the grayscale image to obtain a binarized image.
  • the grayscale image obtained in step 101 is binarized to convert the grayscale image into a binarized image.
  • the license plate number will turn white and the background will turn black, thus forming a black and white binarized image.
  • Step 1022 Perform vertical projection on the binarized image to obtain a projection length of the binarized image.
  • a binarized image of the grayscale image is obtained by step 1021, and a binarized image is vertically projected by step 1022, so that the projection length of the binarized image can be obtained.
  • a black and white spaced projection is formed in the X-axis direction, and the projection length can be the total length of the white projection of the white license plate number on the X-axis, or X. The total length of the black projection between the white projections on the axis.
  • Step 1023 Compare the projection length with a preset projection length threshold. Specifically, by step After the vertical projection of the binarized image, the length of the white projection area of the binarized image and the length of the black projection area are obtained (in the case of the license plate, for example, the white license plate number is white on the X-axis). The total length of the projection and the total length of the black projection between the white projections on the X-axis). Since the projection of the binarized image of black and white includes two parts of black and white, the projection length threshold also includes a black length threshold and a white length threshold.
  • the black length threshold is the length value of the black projection length obtained on the X-axis after the vertical projection processing of the black-and-white binary image in the non-tilted state
  • the white length value is the black and white in the non-tilted state.
  • the white projection length on the X-axis of the currently processed binarized image is compared to the white length threshold; the black projection length on the X-axis of the currently processed binarized image is compared to the black length threshold.
  • Step 1024 If the black projection length of the currently processed binarized image on the X axis is less than the black length threshold, determine that the grayscale image is in a tilt state; or, if the white projection length of the binarized image is greater than the white length threshold, Then, it is determined that the grayscale image is in an inclined state. Specifically, the projection length obtained on the X-axis after the vertical projection of the black-and-white binary image of the license plate is described. In the binarized image of the license plate, the image of the license plate number is white, and the image of the background is black.
  • the white projection length of the license plate number on the X axis will increase, and the background area between the license plate numbers is on the X axis.
  • the black projection length on the upper side is correspondingly shortened, so that when the black projection length of the black and white binarized image of the license plate on the X axis is smaller than the black length threshold, it is determined that the grayscale image is in an inclined state, thereby determining that the license plate is inclined.
  • the white projection length of the black and white binarized image of the license plate on the X-axis is greater than the white length threshold, it is determined that the grayscale image is tilted, thereby determining that the license plate is tilted.
  • the white length threshold and the black length threshold may be set according to specific application scenarios.
  • the license plate number is a white character
  • the background area between the license plate numbers is black.
  • the black length threshold described above is an empirical value that can be predetermined based on the number of license plate characters and the interval between characters. For white lengths, in black and white The valued image is a small value without any inclination. Therefore, a reasonable empirical value can be set as the white length threshold according to the allowable tilt, when the black and white binarized image of the license plate is at
  • the image tilt correction method disclosed in the above embodiment is specifically described as an example of a license plate applied to a smart transportation system. In practice, it can also be used in other situations where it is necessary to perform tilt correction processing on an image.
  • the image tilt correction method of the present embodiment knows the projection length of the grayscale image by performing projection processing on the grayscale image, and then compares the projection length with the preset length threshold, so that it can be conveniently obtained according to the projection length. Whether or not the grayscale image is oblique is more advantageous for improving the correction efficiency of the image tilt correction method of the present embodiment.
  • step 103 in this embodiment specifically includes the following steps:
  • Step 1031 Acquire edge information of the grayscale image. Specifically, after the gray image is tilted by step 102, the tilt correction process needs to be performed in step 103. Step 1031 processes the grayscale image to obtain edge information of the grayscale image. In order to obtain the edge information of the grayscale image more reliably, the step 1031 in this embodiment can obtain the edge information of the grayscale image by using the Canny operator, and the Canny operator can increase the applicable range of the edge detection in a larger range, thereby further Conducive to accurate and reliable edge information of grayscale images.
  • Step 1032 Calculate a tilt angle of the grayscale image according to the edge information. Specifically, after obtaining the edge information of the gray image by step 1031, the tilt angle of the gray image is calculated according to the edge information by step 1032.
  • step 1032 in this embodiment may perform the contrast processing on the edge information of both sides of the grayscale image by Hough transform to calculate the level of the grayscale image. slope. For example: For the edge information corresponding to the inclined license plate, the effective edge information of the upper and lower parts of the license plate is extracted by Hough transform, and the comparison processing is performed, which can quickly and accurately calculate the horizontal inclination of the license plate, effectively avoiding the middle of the license plate, etc. Image The influence of the information interference line improves the calculated correct rate of the license plate inclination.
  • Step 1033 Rotate the grayscale image according to the tilt angle to output the grayscale image without the tilt angle. Specifically, after the tilt angle corresponding to the gray image is calculated in step 1032, the gray image may be rotated according to the tilt angle in step 1033 to output the gray image without the tilt angle.
  • step 1033 in this embodiment may perform rotation correction on the grayscale image by the bilinear interpolation algorithm according to the tilt angle. After the gray image is rotated by the bilinear interpolation algorithm, the gray image without tilt angle can be obtained, which can facilitate the subsequent image processing.
  • the edge information of the gray image is obtained, and the tilt angle is calculated according to the edge information. Finally, the gray image is rotated according to the tilt angle to obtain the gray image without the tilt angle, which can be quickly and effectively
  • the grayscale image that requires the tilt correction processing is processed, which is more advantageous for improving the correction efficiency of the image tilt correction method of the present embodiment.
  • the image tilt correction apparatus of the present embodiment includes: a gradation processing module 1, a projection processing module 2, and a correction processing module 3.
  • the gradation processing module 1 is configured to perform gradation processing on the acquired image to obtain a grayscale image; the projection processing module 2 is configured to perform projection processing on the grayscale image to determine whether the gradation image is tilted; and the correction processing module 3 is configured to If the grayscale image is tilted, the grayscale image is subjected to tilt correction processing.
  • the grayscale processing module 1 in this embodiment performs grayscale processing on the acquired image; then, the projection processing module 2 performs projection processing on the grayscale image generated by the grayscale processing module 1 to determine gray. Whether the degree image is tilted; Finally, the correction processing module 3 performs a correction process on the tilted grayscale image to obtain a normal state non-tilted grayscale image.
  • the specific processing procedure of the image tilting correction apparatus of this embodiment can be referred to the description of the embodiment of the image tilt correction method of the present invention, and details are not described herein again.
  • the grayscale image is subjected to projection processing to determine whether the grayscale image is tilted, and if the grayscale image is in an oblique state, the grayscale image is tilt corrected.
  • the tilt correction processing is not performed on the grayscale image without tilt, and the correction efficiency of the image tilt correction method is improved.
  • the image tilt correction method of the embodiment performs the tilt correction processing only on the image in the tilt state, and the tilt-free image does not need to perform the tilt correction processing, thereby effectively avoiding image information loss in the non-tilted image, which is beneficial to improving the entire image. The efficiency of the process.
  • the projection processing module 2 in this embodiment includes: a projection sub-module 21, a judging sub-module 22, a first determining sub-module 23, and a second determining sub-module.
  • the projection sub-module 21 is configured to project a grayscale image to obtain a projection length of the grayscale image; the determining sub-module 22 is configured to compare the projection length with a preset length threshold; the first determining sub-module 23 is configured to compare As a result, the grayscale image is determined to be in a tilted state; the second determining sub-module 24 is configured to determine that the grayscale image is in a normal state based on the comparison result.
  • the projection sub-module 21 is specifically configured to: perform binarization processing on the grayscale image to obtain a binary image of black and white, wherein black represents the background color of the image; and vertically project the binary image of black and white, Obtain a black projection length or a white projection length on the X-axis;
  • the determining sub-module 22 is specifically configured to: compare the black projection length with a preset black length threshold, or compare the white projection length with a preset white length threshold;
  • the first determining sub-module 23 is specifically configured to: if the comparison result is that the black projection length is less than the black length threshold, determine that the grayscale image is in a tilt state; or, if the white projection length is greater than the white length threshold, determine that the grayscale image is tilted State
  • the second determining sub-module 24 is specifically configured to: if the black projection length is not less than the black length threshold, determine that the grayscale image is in a normal state; or, if the white projection length is not greater than the white length threshold, determine that the grayscale image is in a normal state.
  • the projection length of the grayscale image is obtained by performing projection processing on the grayscale image, and then the projection length is compared with a preset length threshold, so that the gray can be conveniently obtained according to the projection length. Whether the degree image is oblique or not is more advantageous for improving the correction efficiency of the image tilt correction method of the present embodiment.
  • the correction processing module 3 in this embodiment includes: an acquisition sub-module 31, a calculation sub-module 32, and a rotation sub-module 33.
  • the obtaining sub-module 31 is configured to acquire edge information of the grayscale image if the grayscale image is tilted; the calculation sub-module 32 is configured to calculate a tilt angle of the grayscale image according to the edge information; and the rotation sub-module 33 And for rotating the grayscale image according to the tilt angle to output the grayscale image without an oblique angle.
  • the obtaining sub-module 31 in this embodiment is also used to obtain the edge information of the grayscale image by the Canny operator; in order to obtain the tilt of the grayscale image more accurately and effectively
  • the calculation sub-module 32 is further configured to perform edge processing on the edge information of the gray image by Hough transform to calculate the horizontal tilt angle of the gray image; and to rotate the gray image quickly and reliably, and reduce The information loss of the grayscale image during the small rotation, the rotation sub-module 33 is also used to perform rotation correction on the grayscale image by the bilinear interpolation algorithm according to the tilt angle.
  • the image tilt correction device of the embodiment obtains the edge information of the gray image and calculates the tilt angle according to the edge information. Finally, the gray image is rotated according to the tilt angle to obtain the gray image without the tilt angle, which can be quickly and effectively The grayscale image that requires the tilt correction processing is processed, which is more advantageous for improving the correction efficiency of the image tilt correction method of the present embodiment.
  • embodiments of the present invention can be provided as a method, system, or computer program product.
  • the present invention can take the form of an entirely hardware embodiment, an entirely software embodiment, or a combination of software and hardware.
  • the present invention may employ a computer usable storage medium (including but not limited to disk storage, in one or more of which contains computer usable program code.
  • the computer program instructions can also be stored in a computer readable memory that can direct a computer or other programmable data processing device to operate in a particular manner, such that the instructions stored in the computer readable memory produce an article of manufacture comprising the instruction device.
  • the apparatus implements the functions specified in one or more blocks of a flow or a flow and/or block diagram of the flowchart.
  • These computer program instructions can also be loaded onto a computer or other programmable data processing device such that a series of operational steps are performed on a computer or other programmable device to produce computer-implemented processing for execution on a computer or other programmable device.
  • the instructions provide steps for implementing the functions specified in one or more of the flow or in a block or blocks of a flow diagram.

Abstract

An image tilt correction method and apparatus are provided, and the method comprises: performing greyscale processing on the acquired image to obtain a greyscale image, performing projection processing on the greyscale image to judge whether the greyscale image is tilted, and performing tilt correction processing on the greyscale image if the greyscale image is tilted. The tilt correction processing is not performed on the greyscale image which is not tilted, thus the efficiency of the image tilt correction method is improved.

Description

图像倾斜校正方法及装置 本申请要求在 2010年 6月 30日提交中国专利局、申请号为 201010221775.3 发明名称为 "图像倾斜校正方法及装置" 的中国专利申请的优先权, 其全部内 容通过引用结合在本申请中。 技术领域  The present invention claims the priority of the Chinese Patent Application entitled "Image Tilt Correction Method and Apparatus", which is filed on June 30, 2010, the Chinese Patent Application No. 201010221775.3, the entire contents of which are incorporated by reference. In this application. Technical field
本发明涉及图像处理技术领域, 尤其涉及一种图像倾斜校正方法及装置。 背景技术  The present invention relates to the field of image processing technologies, and in particular, to an image tilt correction method and apparatus. Background technique
目前, 随着智能交通系统的发展, 图像处理技术被广泛的应用于智能交通 系统中。 在智能交通系统中, 通常采用图像识别技术对车辆的车牌进行图像识 别, 从而实现自动获得车辆的车牌号。  At present, with the development of intelligent transportation systems, image processing technology is widely used in intelligent transportation systems. In the intelligent transportation system, the image recognition technology is usually used to image the license plate of the vehicle, thereby realizing the automatic acquisition of the license plate number of the vehicle.
由于不同道路环境的影响, 行驶在道路上的车辆会出现倾斜的情况。 为了 准确的获得车辆的车牌信息, 现有技术中的车牌图像识别系统, 需要对所有检 测到的车辆的车牌进行图像校正处理,使车牌的图像能够便于图像识别系统识 别出车牌的号码。  Due to the influence of different road environments, vehicles traveling on the road may be inclined. In order to accurately obtain the license plate information of the vehicle, the prior art license plate image recognition system needs to perform image correction processing on the license plates of all the detected vehicles, so that the image of the license plate can facilitate the image recognition system to recognize the license plate number.
由上可知,现有技术中的图像校正处理方法对所有检测到的图像均进行校 正处理, 而对于没有发生倾斜的车辆也进行图像校正处理, 大大增加了图像校 正处理的负担, 影响了对车牌发生倾斜的车辆进行图像校正处理的速度, 降低 了图像校正处理的校正效率。因此,现有技术中的图^交正方法的处理效率低。 发明内容  It can be seen from the above that the image correction processing method in the prior art performs correction processing on all detected images, and performs image correction processing on vehicles that have not tilted, which greatly increases the burden of image correction processing and affects the license plate. The speed at which the tilted vehicle performs image correction processing reduces the correction efficiency of the image correction processing. Therefore, the processing method of the prior art method is low in efficiency. Summary of the invention
本发明提供一种图像倾斜校正方法及装置, 用以解决现有技术中图像倾斜 校正方法效率低的缺陷, 实现提高图像倾斜校正方法的校正效率。  The present invention provides an image tilt correction method and apparatus for solving the defect of low efficiency of the image tilt correction method in the prior art, and improving the correction efficiency of the image tilt correction method.
本发明实施例提供的一种图像倾斜校正方法, 包括:  An image tilt correction method provided by an embodiment of the present invention includes:
对获取的图像进行灰度处理, 以获得灰度图像; 对所述灰度图像进行投影处理, 以判断所述灰度图像是否倾斜; 若所述灰度图像倾斜, 则对所述灰度图像进行倾斜校正处理; Performing grayscale processing on the acquired image to obtain a grayscale image; Performing a projection process on the grayscale image to determine whether the grayscale image is tilted; if the grayscale image is tilted, performing a tilt correction process on the grayscale image;
其中, 所述对灰度图像进行投影处理, 以判断所述灰度图像是否倾斜, 具 体为:  The step of performing a projection process on the grayscale image to determine whether the grayscale image is tilted, specifically:
对所述灰度图像进行二值化处理, 以得到二值化图像;  Performing binarization processing on the grayscale image to obtain a binarized image;
对所述二值化图像进行垂直投影, 以获得所述二值化图像的投影长度; 将所述投影长度与预设的投影长度阈值进行比较;  Vertically projecting the binarized image to obtain a projection length of the binarized image; comparing the projection length with a preset projection length threshold;
根据比较结果确定所述灰度图像是否倾斜。  Whether the grayscale image is tilted is determined based on the comparison result.
本发明实施例还提供一种图像倾斜校正装置, 包括:  An embodiment of the present invention further provides an image tilt correction apparatus, including:
灰度处理模块, 用于对获取的图像进行灰度处理, 以获得灰度图像; 投影处理模块, 用于对所述灰度图像进行投影处理, 以判断所述灰度图像 是否倾斜; 具体包括: 对所述灰度图像进行二值化处理, 以得到二值化图像; 对所述二值化图像进行垂直投影, 以获得所述二值化图像的投影长度; 将所述 投影长度与预设的投影长度阈值进行比较; 根据比较结果确定所述灰度图像是 否倾斜;  a grayscale processing module, configured to perform grayscale processing on the acquired image to obtain a grayscale image; and a projection processing module, configured to perform a projection process on the grayscale image to determine whether the grayscale image is tilted; : performing binarization processing on the grayscale image to obtain a binarized image; performing vertical projection on the binarized image to obtain a projection length of the binarized image; and using the projection length and the pre-projection length Setting a projection length threshold for comparison; determining whether the grayscale image is tilted according to a comparison result;
校正处理模块, 用于若所述灰度图像倾斜, 则对所述灰度图像进行倾斜校 正处理。  And a correction processing module, configured to perform a tilt correction process on the grayscale image if the grayscale image is tilted.
本发明提供的图像倾斜校正方法及装置, 通过对灰度图像进行投影处理, 以判断出灰度图像是否倾斜, 若灰度图像处于倾斜状态则对该灰度图像进行倾 斜校正处理, 而对于没有倾斜的灰度图像不进行倾斜校正处理, 提高了图像倾 斜校正方法的校正效率。 附图说明  The image tilt correction method and apparatus provided by the present invention determines whether the grayscale image is tilted by performing projection processing on the grayscale image, and performs tilt correction processing on the grayscale image if the grayscale image is in an oblique state, and The oblique grayscale image is not subjected to the tilt correction processing, and the correction efficiency of the image tilt correction method is improved. DRAWINGS
图 1为本发明图像倾斜校正方法实施例的流程图;  1 is a flow chart of an embodiment of an image tilt correction method according to the present invention;
图 2为本发明图像倾斜校正方法实施例中步骤 102的具体流程图; 图 3为本发明图像倾斜校正方法实施例中步骤 103的具体流程图; 图 4为本发明图像倾斜校正装置实施例的结构示意图; 2 is a specific flowchart of step 102 in the image tilt correction method embodiment of the present invention; FIG. 3 is a specific flowchart of step 103 in the image tilt correction method embodiment of the present invention; 4 is a schematic structural view of an embodiment of an image tilt correction device according to the present invention;
图 5 为本发明图像倾斜校正装置实施例中投影处理模块的具体结构示意 图;  FIG. 5 is a schematic structural diagram of a projection processing module in an embodiment of an image tilt correction apparatus according to the present invention; FIG.
图 6 为本发明图像倾斜校正装置实施例中校正处理模块的具体结构示意 图。 具体实施方式  Fig. 6 is a schematic view showing the detailed structure of a correction processing module in the embodiment of the image tilt correction device of the present invention. detailed description
为使本发明实施例的目的、 技术方案和优点更加清楚, 下面将结合本发明 实施例中的附图,对本发明实施例中的技术方案进行清楚、完整地描述,显然, 所描述的实施例是本发明一部分实施例, 而不是全部的实施例。 基于本发明中 的实施例,本领域普通技术人员在没有作出创造性劳动前提下所获得的所有其 他实施例, 都属于本发明保护的范围。  The technical solutions in the embodiments of the present invention are clearly and completely described in the following with reference to the accompanying drawings in the embodiments of the present invention. It is a partial embodiment of the invention, and not all of the embodiments. All other embodiments obtained by those skilled in the art based on the embodiments of the present invention without creative efforts are within the scope of the present invention.
图 1为本发明图像倾斜校正方法实施例的流程图。 如图 1所示, 本实施例 图像倾斜校正方法, 包括:  1 is a flow chart of an embodiment of an image tilt correction method of the present invention. As shown in FIG. 1, the image tilt correction method of this embodiment includes:
步骤 101、 对获取的图像进行灰度处理, 以获得灰度图像。  Step 101: Perform grayscale processing on the acquired image to obtain a grayscale image.
具体而言, 本实施例中的步骤 101对获取的图像信息进行处理, 使处理后 的图像变为灰度图像。本实施例以智能交通系统中对车辆车牌进行检测为例进 行说明, 通过道路上设置的摄像头等图像获取设备, 获得道路上行驶的车辆车 牌的图像信息, 然后, 通过步骤 101对车牌的图像信息进行灰度处理, 以得到 车牌图像的灰度图像。  Specifically, step 101 in the present embodiment processes the acquired image information so that the processed image becomes a grayscale image. In the embodiment, the vehicle license plate is detected in the intelligent transportation system as an example. The image information of the vehicle license plate on the road is obtained by the image acquisition device such as the camera provided on the road, and then the image information of the license plate is obtained through step 101. Grayscale processing is performed to obtain a grayscale image of the license plate image.
步骤 102、 对灰度图像进行投影处理, 以判断灰度图像是否倾斜。  Step 102: Perform a projection process on the grayscale image to determine whether the grayscale image is tilted.
具体而言, 通过步骤 101获得车牌的灰度图像后, 通过步骤 102对获得的 灰度图像进行投影处理,根据投影获得的图像信息判断灰度图像是否是倾斜状 态。  Specifically, after obtaining the grayscale image of the license plate by step 101, the obtained grayscale image is subjected to projection processing by step 102, and it is determined whether the grayscale image is tilted based on the image information obtained by the projection.
步骤 103、 若灰度图像倾斜, 则对灰度图像进行倾斜校正处理。  Step 103: If the grayscale image is tilted, the grayscale image is subjected to tilt correction processing.
具体而言, 当灰度图像通过步骤 102投影处理得知该灰度图像为倾斜的图 像后,则通过步骤 103对该灰度图像进行倾斜校正处理。例如: 当通过步骤 102 得知获得的车牌的灰度图像为倾斜状态后, 则可以判断检测到的车辆的车牌为 倾斜的, 需要对倾斜的车牌的灰度图像进行倾斜校正处理, 则通过步骤 103对 车牌的灰度图像进行校正处理, 以获得无倾斜角度的车牌的灰度图像, 以便后 续程序根据无倾斜角度的灰度图像荻得车牌号。 Specifically, when the grayscale image is processed by the step 102, the grayscale image is obtained as a tilted image. After the image, the grayscale image is subjected to tilt correction processing in step 103. For example, after it is known in step 102 that the obtained grayscale image of the license plate is in an inclined state, it can be determined that the detected license plate of the vehicle is inclined, and it is necessary to perform tilt correction processing on the grayscale image of the inclined license plate, and then step through 103 corrects the grayscale image of the license plate to obtain a grayscale image of the license plate without the oblique angle, so that the subsequent program obtains the license plate number according to the grayscale image without the oblique angle.
需要特别说明的是, 本实施例图像倾斜校正方法可以应用于智能交通系统 的车牌识别系统中, 也可以用于其他需要对图像进行倾斜校正处理的场合。  It should be particularly noted that the image tilt correction method of the present embodiment can be applied to the license plate recognition system of the intelligent transportation system, and can also be used for other occasions where the image is subjected to the tilt correction processing.
本实施例图像倾斜校正方法, 通过对灰度图像进行投影处理, 以判断出灰 度图像是否倾斜, 若灰度图像处于倾斜状态则对该灰度图像进行倾斜校正处 理, 而对于没有倾斜的灰度图像不进行倾斜校正处理, 提高了图像倾斜校正方 法的校正效率。 另外, 本实施例图像倾斜校正方法仅对处于倾斜状态的图像进 行倾斜校正处理, 而非倾斜的图像无需进行倾斜校正处理, 从而有效的避免非 倾斜的图像出现图像信息损失, 有利于提高图像整个处理过程的效率。  In the image tilt correction method of the embodiment, the grayscale image is subjected to projection processing to determine whether the grayscale image is tilted, and if the grayscale image is in an oblique state, the grayscale image is subjected to tilt correction processing, and for the grayscale without tilting The degree image is not subjected to the tilt correction processing, and the correction efficiency of the image tilt correction method is improved. In addition, the image tilt correction method of the embodiment performs the tilt correction processing only on the image in the tilt state, and the tilt-free image does not need to perform the tilt correction processing, thereby effectively avoiding image information loss in the non-tilted image, which is beneficial to improving the entire image. The efficiency of the process.
基于上述技术方案, 本实施例中的步骤 102的一种具体实现方式如图 2所 示, 具体包括如下步骤:  Based on the foregoing technical solution, a specific implementation manner of step 102 in this embodiment is shown in FIG. 2, and specifically includes the following steps:
步骤 1021、 对灰度图像进行二值化处理, 以得到二值化图像。 具体的, 步 骤 1021对步骤 101获得的灰度图像进行二值化处理, 从而将灰度图像转化为 二值化图像。 例如: 采用黑白的二值化图像时, 车牌的灰度图像经过二值化处 理后, 车牌号将变为白色, 而背景将变为黑色, 从而形成黑白的二值化图像。  Step 1021: Perform a binarization process on the grayscale image to obtain a binarized image. Specifically, in step 1021, the grayscale image obtained in step 101 is binarized to convert the grayscale image into a binarized image. For example: When using a black and white binarized image, after the grayscale image of the license plate is processed by binarization, the license plate number will turn white and the background will turn black, thus forming a black and white binarized image.
步骤 1022、 对二值化图像进行垂直投影, 以获得二值化图像的投影长度。 具体的, 通过步骤 1021将获得灰度图像的二值化图像, 步骤 1022将对二值化 图像进行垂直投影, 从而可以获得该二值化图像的投影长度。 例如: 将车牌的 黑白二值化图像进行垂直投影后,会在 X轴方向上形成黑白间隔的投影, 而投 影长度可以是白色的车牌号在 X轴上的白色投影的总长度、 或是 X轴上白色 投影之间的黑色投影的总长度。  Step 1022: Perform vertical projection on the binarized image to obtain a projection length of the binarized image. Specifically, a binarized image of the grayscale image is obtained by step 1021, and a binarized image is vertically projected by step 1022, so that the projection length of the binarized image can be obtained. For example: After the black and white binarized image of the license plate is vertically projected, a black and white spaced projection is formed in the X-axis direction, and the projection length can be the total length of the white projection of the white license plate number on the X-axis, or X. The total length of the black projection between the white projections on the axis.
步骤 1023、将投影长度与预设的投影长度阔值进行比较。 具体的, 通过步 骤 1022将二值化图像进行垂直投影后, 将获得该二值化图像的白色投影区域 的长度以及黑色投影区域的长度(以前述车牌为例, 即为白色的车牌号在 X轴 上的白色投影的总长度以及 X轴上白色投影之间的黑色投影的总长度)。 由于 黑白的二值化图像的投影包括黑白两部分, 则投影长度阔值也对应包括有黑色 长度阈值和白色长度阈值。 其中, 黑色长度阈值为处于非倾斜状态的黑白的二 值化图像进行垂直投影处理后,在 X轴上得到的黑色投影长度的长度值, 而白 色长度阁值为处于非倾斜状态的黑白的二值化图像进行垂直投影处理后, 在 X 轴上得到的白色投影长度的长度值。对当前处理的二值化图像在 X轴上的白色 投影长度与所述白色长度阈值进行比较;对当前处理的二值化图像在 X轴上的 黑色投影长度与所述黑色长度阈值进行比较。 Step 1023: Compare the projection length with a preset projection length threshold. Specifically, by step After the vertical projection of the binarized image, the length of the white projection area of the binarized image and the length of the black projection area are obtained (in the case of the license plate, for example, the white license plate number is white on the X-axis). The total length of the projection and the total length of the black projection between the white projections on the X-axis). Since the projection of the binarized image of black and white includes two parts of black and white, the projection length threshold also includes a black length threshold and a white length threshold. Wherein, the black length threshold is the length value of the black projection length obtained on the X-axis after the vertical projection processing of the black-and-white binary image in the non-tilted state, and the white length value is the black and white in the non-tilted state. The value of the length of the white projection length obtained on the X-axis after the vertical projection of the image. The white projection length on the X-axis of the currently processed binarized image is compared to the white length threshold; the black projection length on the X-axis of the currently processed binarized image is compared to the black length threshold.
步骤 1024、 若当前处理的二值化图像在 X轴上的黑色投影长度小于黑色 长度阈值, 则确定该灰度图像为倾斜状态; 或者, 若二值化图像的白色投影长 度大于白色长度阈值, 则确定灰度图像为倾斜状态。 具体的, 以车牌的黑白二 值化图像垂直投影后在 X轴上得到的投影长度进行说明。 车牌的二值化图像 中, 车牌号的图像为白色, 而背景的图像为黑色。 由于车牌号之间的间隔固定 不变, 当车牌倾斜时, 其对应的黑白二值化图像中, 车牌号在 X轴上的白色投 影长度会增长, 而车牌号之间的背景区域在 X轴上的黑色投影长度会相应缩 短,从而当车牌的黑白二值化图像在 X轴上的黑色投影长度小于黑色长度阈值 时, 则确定灰度图像为倾斜状态, 从而确定车牌为倾斜的。 或者, 当车牌的黑 白二值化图像在 X轴上的白色投影长度大于白色长度阈值时,则确定灰度图像 为倾斜状态, 从而确定车牌为倾斜的。  Step 1024: If the black projection length of the currently processed binarized image on the X axis is less than the black length threshold, determine that the grayscale image is in a tilt state; or, if the white projection length of the binarized image is greater than the white length threshold, Then, it is determined that the grayscale image is in an inclined state. Specifically, the projection length obtained on the X-axis after the vertical projection of the black-and-white binary image of the license plate is described. In the binarized image of the license plate, the image of the license plate number is white, and the image of the background is black. Since the interval between the license plate numbers is fixed, when the license plate is tilted, in the corresponding black and white binarized image, the white projection length of the license plate number on the X axis will increase, and the background area between the license plate numbers is on the X axis. The black projection length on the upper side is correspondingly shortened, so that when the black projection length of the black and white binarized image of the license plate on the X axis is smaller than the black length threshold, it is determined that the grayscale image is in an inclined state, thereby determining that the license plate is inclined. Alternatively, when the white projection length of the black and white binarized image of the license plate on the X-axis is greater than the white length threshold, it is determined that the grayscale image is tilted, thereby determining that the license plate is tilted.
实际中, 白色长度阈值和黑色长度阈值可以根据具体的应用场景, 设置相 应的经验值。以上述对车辆的车牌进行图像校正处理为例,车牌号为白色字符, 而车牌号之间的背景区域为黑色, 通常情况下, 车牌号的字符个数以及字符之 间的间隔相对固定不变, 因此, 上述的黑色长度阈值是一个可以根据车牌字符 个数以及字符之间的间隔来预先确定的经验值。 对于白色长度阔值, 在黑白二 值化图像没有任何倾斜度的情况下, 是一个很小的值, 因此, 可以根据允许的 倾斜度设置一个合理的经验值作为白色长度阈值, 当车牌的黑白二值化图像在In practice, the white length threshold and the black length threshold may be set according to specific application scenarios. Taking the above image correction processing for the license plate of the vehicle as an example, the license plate number is a white character, and the background area between the license plate numbers is black. Generally, the number of characters of the license plate number and the interval between the characters are relatively fixed. Therefore, the black length threshold described above is an empirical value that can be predetermined based on the number of license plate characters and the interval between characters. For white lengths, in black and white The valued image is a small value without any inclination. Therefore, a reasonable empirical value can be set as the white length threshold according to the allowable tilt, when the black and white binarized image of the license plate is at
X轴上的白色投影长度大于设置的白色长度阔值时, 则确定对应的车牌为倾斜 状态。 When the white projection length on the X-axis is greater than the set white length threshold, it is determined that the corresponding license plate is tilted.
需要特别说明的是, 上述实施例公开的图像倾斜校正方法, 是以应用于智 能交通系统的车牌为例进行了具体说明, 实际中, 也可以用于其他需要对图像 进行倾斜校正处理的场合。  It should be noted that the image tilt correction method disclosed in the above embodiment is specifically described as an example of a license plate applied to a smart transportation system. In practice, it can also be used in other situations where it is necessary to perform tilt correction processing on an image.
总之, 本实施例图像倾斜校正方法, 通过对灰度图像进行投影处理得知该 灰度图像的投影长度, 然后将投影长度与预设的长度阈值进行比较, 便可以方 便的根据投影长度得知该灰度图像是否为倾斜的,从而更有利于提高本实施例 图像倾斜校正方法的校正效率。  In summary, the image tilt correction method of the present embodiment knows the projection length of the grayscale image by performing projection processing on the grayscale image, and then compares the projection length with the preset length threshold, so that it can be conveniently obtained according to the projection length. Whether or not the grayscale image is oblique is more advantageous for improving the correction efficiency of the image tilt correction method of the present embodiment.
基于上述技术方案, 可选的, 如图 3所述, 本实施例中的步骤 103具体包 括如下步骤:  Based on the foregoing technical solution, optionally, as shown in FIG. 3, step 103 in this embodiment specifically includes the following steps:
步骤 1031、 获取灰度图像的边缘信息。 具体的, 通过步骤 102得知灰度图 像是倾斜之后, 需要通过步骤 103进行倾斜校正处理。 步骤 1031将对该灰度 图像进行处理, 以获取灰度图像的边缘信息。 为了更加可靠的获得灰度图像的 边缘信息, 本实施例中的步骤 1031可以通过 Canny算子获得灰度图像的边缘 信息, 由于 Canny算子能较大范围提高边缘检测的适用范围, 从而更有利于准 确可靠的获得灰度图像的边缘信息。  Step 1031: Acquire edge information of the grayscale image. Specifically, after the gray image is tilted by step 102, the tilt correction process needs to be performed in step 103. Step 1031 processes the grayscale image to obtain edge information of the grayscale image. In order to obtain the edge information of the grayscale image more reliably, the step 1031 in this embodiment can obtain the edge information of the grayscale image by using the Canny operator, and the Canny operator can increase the applicable range of the edge detection in a larger range, thereby further Conducive to accurate and reliable edge information of grayscale images.
步骤 1032、根据边缘信息计算灰度图像的倾斜角。具体的,通过步骤 1031 获得灰度图像的边缘信息后, 通过步骤 1032根据边缘信息计算出该灰度图像 的倾斜角。 为了更加准确有效的得到灰度图像的倾斜角, 本实施例中的步骤 1032可以通过霍夫( Hough )变换对灰度图像的两侧的边缘信息进行对照处理, 以计算出灰度图像的水平倾斜角度。 例如: 对于倾斜车牌所对应的边缘信息, 通过 Hough变换分别对上下两部分车牌的有效边缘信息进行提取,并进行对照 处理, 可以快速准确的计算出车牌的水平倾角, 有效的避免了车牌中部等图像 信息干扰线的影响, 提高了计算出的车牌倾角的正确率。 Step 1032: Calculate a tilt angle of the grayscale image according to the edge information. Specifically, after obtaining the edge information of the gray image by step 1031, the tilt angle of the gray image is calculated according to the edge information by step 1032. In order to obtain the tilt angle of the grayscale image more accurately and efficiently, step 1032 in this embodiment may perform the contrast processing on the edge information of both sides of the grayscale image by Hough transform to calculate the level of the grayscale image. slope. For example: For the edge information corresponding to the inclined license plate, the effective edge information of the upper and lower parts of the license plate is extracted by Hough transform, and the comparison processing is performed, which can quickly and accurately calculate the horizontal inclination of the license plate, effectively avoiding the middle of the license plate, etc. Image The influence of the information interference line improves the calculated correct rate of the license plate inclination.
步骤 1033、根据倾斜角旋转灰度图像, 以输出无倾斜角度的灰度图像。 具 体的, 在通过步骤 1032计算出灰度图像对应的倾斜角后, 可以通过步骤 1033 根据倾斜角对灰度图像进行旋转处理, 以输出无倾斜角度的灰度图像。 为了快 速可靠的将灰度图像进行旋转, 并减小旋转过程中灰度图像的信息损失, 本实 施例中的步骤 1033可以根据倾斜角, 通过双线性插值算法对灰度图像进行旋 转校正, 通过双线性插值算法对灰度图像旋转后, 可以获得无倾斜角度的灰度 图像, 从而可以方便后续的图像处理过程的进行。  Step 1033: Rotate the grayscale image according to the tilt angle to output the grayscale image without the tilt angle. Specifically, after the tilt angle corresponding to the gray image is calculated in step 1032, the gray image may be rotated according to the tilt angle in step 1033 to output the gray image without the tilt angle. In order to rotate the grayscale image quickly and reliably, and reduce the information loss of the grayscale image during the rotation process, step 1033 in this embodiment may perform rotation correction on the grayscale image by the bilinear interpolation algorithm according to the tilt angle. After the gray image is rotated by the bilinear interpolation algorithm, the gray image without tilt angle can be obtained, which can facilitate the subsequent image processing.
本实施例图像倾斜校正方法, 通过获取灰度图像的边缘信息, 并根据边缘 信息计算出倾斜角, 最后, 根据倾斜角旋转灰度图像以获得无倾斜角度的灰度 图像, 可以快速有效的对需要倾斜校正处理的灰度图像进行处理, 更有利于提 高本实施例图像倾斜校正方法的校正效率。  In the image tilt correction method of the embodiment, the edge information of the gray image is obtained, and the tilt angle is calculated according to the edge information. Finally, the gray image is rotated according to the tilt angle to obtain the gray image without the tilt angle, which can be quickly and effectively The grayscale image that requires the tilt correction processing is processed, which is more advantageous for improving the correction efficiency of the image tilt correction method of the present embodiment.
图 4为本发明图像倾斜校正装置实施例的结构示意图。 如图 4所示, 本实 施例图像倾斜校正装置包括: 灰度处理模块 1、 投影处理模块 2和校正处理模 块 3。  4 is a schematic structural view of an embodiment of an image tilt correction device of the present invention. As shown in FIG. 4, the image tilt correction apparatus of the present embodiment includes: a gradation processing module 1, a projection processing module 2, and a correction processing module 3.
灰度处理模块 1用于对获取的图像进行灰度处理, 以获得灰度图像; 投影处理模块 2用于对灰度图像进行投影处理,以判断灰度图像是否倾斜; 校正处理模块 3用于若灰度图像倾斜, 则对灰度图像进行倾斜校正处理。 具体而言, 本实施例中的灰度处理模块 1将获取到的图像进行灰度处理; 然后,投影处理模块 2将对灰度处理模块 1处理生成的灰度图像进行投影处理, 以判断灰度图像是否倾斜; 最后, 校正处理模块 3将对倾斜的灰度图像进行校 正处理, 以得到正常状态非倾斜的灰度图像。 其中, 本实施例图像倾斜校正装 置的具体处理过程可以参见本发明图像倾斜校正方法实施例的记载,在此不再 赘述。  The gradation processing module 1 is configured to perform gradation processing on the acquired image to obtain a grayscale image; the projection processing module 2 is configured to perform projection processing on the grayscale image to determine whether the gradation image is tilted; and the correction processing module 3 is configured to If the grayscale image is tilted, the grayscale image is subjected to tilt correction processing. Specifically, the grayscale processing module 1 in this embodiment performs grayscale processing on the acquired image; then, the projection processing module 2 performs projection processing on the grayscale image generated by the grayscale processing module 1 to determine gray. Whether the degree image is tilted; Finally, the correction processing module 3 performs a correction process on the tilted grayscale image to obtain a normal state non-tilted grayscale image. The specific processing procedure of the image tilting correction apparatus of this embodiment can be referred to the description of the embodiment of the image tilt correction method of the present invention, and details are not described herein again.
本实施例图像倾斜校正装置, 通过对灰度图像进行投影处理, 以判断出灰 度图像是否倾斜, 若灰度图像处于倾斜状态则对该灰度图像进行倾斜校正处 理, 而对于没有倾斜的灰度图像不进行倾斜校正处理, 提高了图像倾斜校正方 法的校正效率。 另外, 本实施例图像倾斜校正方法仅对处于倾斜状态的图像进 行倾斜校正处理, 而非倾斜的图像无需进行倾斜校正处理, 从而有效的避免非 倾斜的图像出现图像信息损失, 有利于提高图像整个处理过程的效率。 In the image tilt correction device of the embodiment, the grayscale image is subjected to projection processing to determine whether the grayscale image is tilted, and if the grayscale image is in an oblique state, the grayscale image is tilt corrected. However, the tilt correction processing is not performed on the grayscale image without tilt, and the correction efficiency of the image tilt correction method is improved. In addition, the image tilt correction method of the embodiment performs the tilt correction processing only on the image in the tilt state, and the tilt-free image does not need to perform the tilt correction processing, thereby effectively avoiding image information loss in the non-tilted image, which is beneficial to improving the entire image. The efficiency of the process.
基于上述技术方案, 可选的, 如图 5所示, 本实施例中的投影处理模块 2 包括: 投影子模块 21、 判断子模块 22、 第一确定子模块 23和第二确定子模块 Based on the foregoing technical solution, optionally, as shown in FIG. 5, the projection processing module 2 in this embodiment includes: a projection sub-module 21, a judging sub-module 22, a first determining sub-module 23, and a second determining sub-module.
24。 twenty four.
投影子模块 21 用于对灰度图像进行投影, 以获得灰度图像的投影长度; 判断子模块 22用于将投影长度与预设的长度阈值进行比较; 第一确定子模块 23用于根据比较结果, 确定灰度图像为倾斜状态; 第二确定子模块 24用于根 据比较结果, 确定灰度图像为正常状态。  The projection sub-module 21 is configured to project a grayscale image to obtain a projection length of the grayscale image; the determining sub-module 22 is configured to compare the projection length with a preset length threshold; the first determining sub-module 23 is configured to compare As a result, the grayscale image is determined to be in a tilted state; the second determining sub-module 24 is configured to determine that the grayscale image is in a normal state based on the comparison result.
结合上述方法实施例, 投影子模块 21具体用于: 对灰度图像进行二值化 处理, 得到黑白的二值化图像, 其中黑色代表图像底色; 对黑白的二值化图像 进行垂直投影, 获得 X轴上的黑色投影长度或白色投影长度;  In combination with the foregoing method embodiment, the projection sub-module 21 is specifically configured to: perform binarization processing on the grayscale image to obtain a binary image of black and white, wherein black represents the background color of the image; and vertically project the binary image of black and white, Obtain a black projection length or a white projection length on the X-axis;
判断子模块 22具体用于: 将黑色投影长度与预设的黑色长度阈值比较, 或将白色投影长度与预设的白色长度阈值比较;  The determining sub-module 22 is specifically configured to: compare the black projection length with a preset black length threshold, or compare the white projection length with a preset white length threshold;
第一确定子模块 23具体用于: 若比较结杲为黑色投影长度小于黑色长度 阈值,则确定灰度图像为倾斜状态;或者,若白色投影长度大于白色长度阈值, 则确定灰度图像为倾斜状态;  The first determining sub-module 23 is specifically configured to: if the comparison result is that the black projection length is less than the black length threshold, determine that the grayscale image is in a tilt state; or, if the white projection length is greater than the white length threshold, determine that the grayscale image is tilted State
第二确定子模块 24具体用于: 若黑色投影长度不小于黑色长度阈值, 则 确定灰度图像为正常状态; 或者, 若白色投影长度不大于白色长度阈值, 则确 定灰度图像为正常状态。  The second determining sub-module 24 is specifically configured to: if the black projection length is not less than the black length threshold, determine that the grayscale image is in a normal state; or, if the white projection length is not greater than the white length threshold, determine that the grayscale image is in a normal state.
本实施例图像倾斜校正装置,通过对灰度图像进行投影处理得知该灰度图 像的投影长度, 然后将投影长度与预设的长度阈值进行比较, 便可以方便的根 据投影长度得知该灰度图像是否为倾斜的,从而更有利于提高本实施例图像倾 斜校正方法的校正效率。 基于上述技术方案, 可选的, 如图 6所示, 本实施例中的校正处理模块 3 包括: 获取子模块 31、 计算子模块 32和旋转子模块 33。 In the image tilt correction device of the embodiment, the projection length of the grayscale image is obtained by performing projection processing on the grayscale image, and then the projection length is compared with a preset length threshold, so that the gray can be conveniently obtained according to the projection length. Whether the degree image is oblique or not is more advantageous for improving the correction efficiency of the image tilt correction method of the present embodiment. Based on the foregoing technical solution, optionally, as shown in FIG. 6, the correction processing module 3 in this embodiment includes: an acquisition sub-module 31, a calculation sub-module 32, and a rotation sub-module 33.
获取子模块 31 用于若所述灰度图像倾斜, 则获取所述灰度图像的边缘信 息; 计算子模块 32用于根据所述边缘信息计算所述灰度图像的倾斜角; 旋转 子模块 33,用于根据所述倾斜角旋转所述灰度图像, 以输出无倾斜角度的所述 灰度图像。  The obtaining sub-module 31 is configured to acquire edge information of the grayscale image if the grayscale image is tilted; the calculation sub-module 32 is configured to calculate a tilt angle of the grayscale image according to the edge information; and the rotation sub-module 33 And for rotating the grayscale image according to the tilt angle to output the grayscale image without an oblique angle.
其中, 为了更加可靠的获得灰度图像的边缘信息, 本实施例中的获取子模 块 31还用于通过 Canny算子荻得灰度图像的边缘信息; 为了更加准确有效的 获得灰度图像的倾斜角, 计算子模块 32还用于通过 Hough变换对灰度图像的 两侧的边缘信息进行对照处理, 以计算出灰度图像的水平倾斜角度; 为了快速 可靠的将灰度图像进行旋转, 并减小旋转过程中灰度图像的信息损失, 旋转子 模块 33还用于根据倾斜角, 通过双线性插值算法对灰度图像进行旋转校正。  In order to obtain the edge information of the grayscale image more reliably, the obtaining sub-module 31 in this embodiment is also used to obtain the edge information of the grayscale image by the Canny operator; in order to obtain the tilt of the grayscale image more accurately and effectively The calculation sub-module 32 is further configured to perform edge processing on the edge information of the gray image by Hough transform to calculate the horizontal tilt angle of the gray image; and to rotate the gray image quickly and reliably, and reduce The information loss of the grayscale image during the small rotation, the rotation sub-module 33 is also used to perform rotation correction on the grayscale image by the bilinear interpolation algorithm according to the tilt angle.
本实施例图像倾斜校正装置, 通过获取灰度图像的边缘信息, 并根据边缘 信息计算出倾斜角, 最后, 根据倾斜角旋转灰度图像以获得无倾斜角度的灰度 图像, 可以快速有效的对需要倾斜校正处理的灰度图像进行处理, 更有利于提 高本实施例图像倾斜校正方法的校正效率。  The image tilt correction device of the embodiment obtains the edge information of the gray image and calculates the tilt angle according to the edge information. Finally, the gray image is rotated according to the tilt angle to obtain the gray image without the tilt angle, which can be quickly and effectively The grayscale image that requires the tilt correction processing is processed, which is more advantageous for improving the correction efficiency of the image tilt correction method of the present embodiment.
本领域内的技术人员应明白, 本发明的实施例可提供为方法、 系统、 或计 算机程序产品。 因此, 本发明可采用完全硬件实施例、 完全软件实施例、 或结 合软件和硬件方面的实施例的形式。 而且, 本发明可采用在一个或多个其中包 含有计算机可用程序代码的计算机可用存储介盾 (包括但不限于磁盘存储器、 Those skilled in the art will appreciate that embodiments of the present invention can be provided as a method, system, or computer program product. Thus, the present invention can take the form of an entirely hardware embodiment, an entirely software embodiment, or a combination of software and hardware. Moreover, the present invention may employ a computer usable storage medium (including but not limited to disk storage, in one or more of which contains computer usable program code.
CD-ROM, 光学存储器等)上实施的计算机程序产品的形式。 The form of a computer program product implemented on a CD-ROM, optical storage, etc.).
本发明是参照根据本发明实施例的方法、 设备(系统)、 和计算机程序产 品的流程图和 /或方框图来描述的。应理解可由计算机程序指令实现流程图和 /或方框图中的每一流程和 /或方框、 以及流程图和 /或方框图中的流程和 / 或方框的结合。 可提供这些计算机程序指令到通用计算机、 专用计算机、 嵌入 式处理机或其他可编程数据处理设备的处理器以产生一个机器,使得通过计算 机或其他可编程数据处理设备的处理器执行的指令产生用于实现在流程图一 个流程或多个流程和 /或方框图一个方框或多个方框中指定的功能的装置。 The present invention has been described with reference to flowchart illustrations and/or block diagrams of methods, apparatus (system), and computer program products according to embodiments of the invention. It will be understood that each flow and/or block of the flowcharts and/or block diagrams, and combinations of flows and/or blocks in the flowcharts and/or <RTIgt; These computer program instructions can be provided to a processor of a general purpose computer, a special purpose computer, an embedded processor or other programmable data processing device to produce a machine such that The instructions executed by the processor of the machine or other programmable data processing device generate means for implementing the functions specified in one or more blocks of the flow or in a block or blocks of the flowchart.
这些计算机程序指令也可存储在能引导计算机或其他可编程数据处理设 备以特定方式工作的计算机可读存储器中,使得存储在该计算机可读存储器中 的指令产生包括指令装置的制造品,该指令装置实现在流程图一个流程或多个 流程和 /或方框图一个方框或多个方框中指定的功能。  The computer program instructions can also be stored in a computer readable memory that can direct a computer or other programmable data processing device to operate in a particular manner, such that the instructions stored in the computer readable memory produce an article of manufacture comprising the instruction device. The apparatus implements the functions specified in one or more blocks of a flow or a flow and/or block diagram of the flowchart.
这些计算机程序指令也可装载到计算机或其他可编程数据处理设备上,使 得在计算机或其他可编程设备上执行一系列操作步骤以产生计算机实现的处 理,从而在计算机或其他可编程设备上执行的指令提供用于实现在流程图一个 流程或多个流程和 /或方框图一个方框或多个方框中指定的功能的步骤。  These computer program instructions can also be loaded onto a computer or other programmable data processing device such that a series of operational steps are performed on a computer or other programmable device to produce computer-implemented processing for execution on a computer or other programmable device. The instructions provide steps for implementing the functions specified in one or more of the flow or in a block or blocks of a flow diagram.
尽管已描述了本发明的优选实施例 ,但本领域内的技术人员一旦得知了基 本创造性概念, 则可对这些实施例作出另外的变更和修改。 所以, 所附权利要 求意欲解释为包括优选实施例以及落入本发明范围的所有变更和修改。 明的精神和范围。 这样, 倘若本发明的这些修改和变型属于本发明权利要求及 其等同技术的范围之内, 则本发明也意图包含这些改动和变型在内。  Although the preferred embodiment of the invention has been described, it will be apparent to those skilled in the art that, Therefore, the appended claims are intended to be interpreted as including the preferred embodiments and the modifications and modifications The spirit and scope of the Ming. Thus, it is intended that the present invention cover the modifications and variations of the inventions

Claims

权 利 要 求 Rights request
1、 一种图像倾斜校正方法, 其特征在于, 包括: An image tilt correction method, comprising:
对获取的图像进行灰度处理, 以获得灰度图像;  Performing grayscale processing on the acquired image to obtain a grayscale image;
对所述灰度图像进行投影处理, 以判断所述灰度图像是否倾斜; 若所述灰度图像倾斜, 则对所述灰度图像进行倾斜校正处理;  Performing a projection process on the grayscale image to determine whether the grayscale image is tilted; if the grayscale image is tilted, performing a tilt correction process on the grayscale image;
其中, 所述对灰度图像进行投影处理, 以判断所述灰度图像是否倾斜, 具 体为:  The step of performing a projection process on the grayscale image to determine whether the grayscale image is tilted, specifically:
对所述灰度图像进行二值化处理, 以得到二值化图像;  Performing binarization processing on the grayscale image to obtain a binarized image;
对所述二值化图像进行垂直投影, 以获得所述二值化图像的投影长度; 将所述投影长度与预设的投影长度阈值进行比较;  Vertically projecting the binarized image to obtain a projection length of the binarized image; comparing the projection length with a preset projection length threshold;
根据比较结果确定所述灰度图像是否倾斜。  Whether the grayscale image is tilted is determined based on the comparison result.
2、 根据权利要求 1 所述的图像倾斜校正方法, 其特征在于, 所述对灰度 图像进行二值化处理, 以得到二值化图像, 具体为: 对所述灰度图像进行二值 化处理, 以得到黑白的二值化图像, 其中黑色代表图像底色;  The image tilt correction method according to claim 1, wherein the grayscale image is binarized to obtain a binarized image, specifically: binarizing the grayscale image Processing to obtain a black and white binarized image, where black represents the background color of the image;
所述对二值化图像进行垂直投影, 以获得所述二值化图像的投影长度, 具 体为: 对所述黑白的二值化图像进行垂直投影,获得 X轴上的黑色投影长度或 白色投影长度;  Performing vertical projection on the binarized image to obtain a projection length of the binarized image, specifically: vertically projecting the black and white binarized image to obtain a black projection length or a white projection on the X axis Length
所述将投影长度与预设的投影长度阈值进行比较, 具体为: 将所述黑色投 影长度与预设的黑色长度阈值比较,或将所述白色投影长度与预设的白色长度 阈值比较;  Comparing the projection length with a preset projection length threshold, specifically: comparing the black projection length with a preset black length threshold, or comparing the white projection length with a preset white length threshold;
所述根据比较结果确定所述灰度图像是否倾斜, 具体为: 若所述黑色投影 长度小于所述黑色长度阈值, 则确定所述灰度图像为倾斜状态; 或者, 若所述 白色投影长度大于所述白色长度闹值, 则确定所述灰度图像为倾斜状态。  Determining whether the grayscale image is tilted according to the comparison result, specifically: if the black projection length is less than the black length threshold, determining that the grayscale image is in an inclined state; or, if the white projection length is greater than The white length alarm value determines that the grayscale image is in an inclined state.
3、 根据权利要求 1或 2所述的图像倾斜校正方法, 其特征在于, 所述对 所述灰度图像进行倾斜校正处理, 具体为:  The image tilt correction method according to claim 1 or 2, wherein the tilt correction processing is performed on the grayscale image, specifically:
获取所述灰度图像的边缘信息; 根据所述边缘信息计算所述灰度图像的倾斜角; Obtaining edge information of the grayscale image; Calculating a tilt angle of the grayscale image according to the edge information;
根据所述倾斜角旋转所述灰度图像, 以输出无倾斜角度的所述灰度图像。 The grayscale image is rotated according to the tilt angle to output the grayscale image without an oblique angle.
4、 根据权利要求 3所述的图像倾斜校正方法, 其特征在于, 所述获取所 述灰度图像的边缘信息, 具体为: 通过 Canny算子获得所述灰度图像的边缘信 息。 The image tilt correction method according to claim 3, wherein the acquiring edge information of the grayscale image is specifically: obtaining edge information of the grayscale image by using a Canny operator.
5、 根据权利要求 3所述的图像倾斜校正方法, 其特征在于, 所述根据所 述边缘信息计算所述灰度图像的倾斜角,具体为: 通过 Hough变换对所述灰度 图像的两侧的所述边缘信息进行对照处理, 以计算出所述灰度图像的水平倾斜 角度。  The image tilt correction method according to claim 3, wherein the calculating the tilt angle of the gray image according to the edge information is specifically: performing two sides of the gray image by Hough transform The edge information is subjected to a collation process to calculate a horizontal tilt angle of the grayscale image.
6、 根据权利要求 3所述的图像倾斜校正方法, 其特征在于, 所述根据所 述倾斜角旋转所述灰度图像, 具体为: 根据所述倾斜角, 通过双线性插值算法 对所述灰度图像进行旋转校正。  The image tilt correction method according to claim 3, wherein the rotating the grayscale image according to the tilt angle is specifically:: according to the tilt angle, by using a bilinear interpolation algorithm The grayscale image is rotated for correction.
7、 一种图像倾斜校正装置, 其特征在于, 包括:  7. An image tilt correction device, comprising:
灰度处理模块, 用于对荻取的图像进行灰度处理, 以获得灰度图像; 投影处理模块, 用于对所述灰度图像进行投影处理, 以判断所述灰度图像 是否倾斜; 具体包括: 对所述灰度图像进行二值化处理, 以得到二值化图像; 对所述二值化图像进行垂直投影, 以获得所述二值化图像的投影长度; 将所述 投影长度与预设的投影长度阔值进行比较; 根据比较结果确定所述灰度图像是 否倾斜;  a grayscale processing module, configured to perform grayscale processing on the captured image to obtain a grayscale image; and a projection processing module, configured to perform projection processing on the grayscale image to determine whether the grayscale image is tilted; The method includes: performing binarization processing on the grayscale image to obtain a binarized image; performing vertical projection on the binarized image to obtain a projection length of the binarized image; Comparing the preset projection length thresholds; determining whether the grayscale image is tilted according to the comparison result;
校正处理模块, 用于若所述灰度图像倾斜, 则对所述灰度图像进行倾斜校 正处理。  And a correction processing module, configured to perform a tilt correction process on the grayscale image if the grayscale image is tilted.
8、 根据权利要求 7所述的图像倾斜校正装置, 其特征在于, 所述投影处 理模块包括:  8. The image tilt correction apparatus according to claim 7, wherein the projection processing module comprises:
投影子模块, 用于对所述灰度图像进行二值化处理, 得到二值化图像, 对 二值化图像进行垂直投影, 以荻得所述二值化图像的投影长度;  a projection submodule, configured to perform binarization processing on the grayscale image to obtain a binarized image, and vertically project the binarized image to obtain a projection length of the binarized image;
判断子模块, 用于将所述投影长度与预设的长度阈值进行比较; 第一确定子模块, 用于根据比较结果, 确定所述灰度图像为倾斜状态; 第二确定子模块, 用于根据比较结果, 确定所述灰度图像为正常状态。a determining submodule, configured to compare the projection length with a preset length threshold; a first determining submodule, configured to determine, according to the comparison result, that the grayscale image is in a tilt state; and a second determining submodule, configured to determine, according to the comparison result, that the grayscale image is in a normal state.
9、 如权利要求 8所述的图像倾斜校正装置, 其特征在于, 所述投影子模 块具体用于: 对所述灰度图像进行二值化处理, 得到黑白的二值化图像, 其中 黑色代表图像底色; 对所述黑白的二值化图像进行垂直投影,获得 X轴上的黑 色投影长度或白色投影长度; The image tilt correction device according to claim 8, wherein the projection sub-module is specifically configured to: perform binarization processing on the grayscale image to obtain a black and white binarized image, wherein black represents Image background color; performing vertical projection on the black and white binarized image to obtain a black projection length or a white projection length on the X axis;
所述判断子模块具体用于: 将所述黑色投影长度与预设的黑色长度阈值比 较, 或将所述白色投影长度与预设的白色长度阈值比较;  The determining sub-module is specifically configured to: compare the black projection length with a preset black length threshold, or compare the white projection length with a preset white length threshold;
所述第一确定子模块具体用于: 若所述黑色投影长度小于所述黑色长度闹 值, 则确定所述灰度图像为倾斜状态; 或者, 若所述白色投影长度大于所述白 色长度阈值, 则确定所述灰度图像为倾斜状态;  The first determining sub-module is specifically configured to: if the black projection length is less than the black length alarm value, determine that the grayscale image is in a tilt state; or if the white projection length is greater than the white length threshold , determining that the grayscale image is in an inclined state;
所述第二确定子模块具体用于: 若所述黑色投影长度不小于所述黑色长度 阈值, 则确定所述灰度图像为正常状态; 或者, 若所述白色投影长度不大于所 述白色长度阈值, 则确定所述灰度图像为正常状态。  The second determining sub-module is specifically configured to: if the black projection length is not less than the black length threshold, determine that the grayscale image is in a normal state; or, if the white projection length is not greater than the white length The threshold determines that the grayscale image is in a normal state.
10、 根据权利要求 7、 8或 9所述的图像倾斜校正装置, 其特征在于, 所 述校正处理模块包括:  The image tilt correction device according to claim 7, 8 or 9, wherein the correction processing module comprises:
获取子模块,用于若所述灰度图像倾斜,则获取所述灰度图像的边缘信息; 计算子模块, 用于根据所述边缘信息计算所述灰度图像的倾斜角; 旋转子模块, 用于根据所述倾斜角旋转所述灰度图像, 以输出无倾斜角度 的所述灰度图像。  Obtaining a submodule, configured to acquire edge information of the grayscale image if the grayscale image is tilted; and a calculation submodule, configured to calculate a tilt angle of the grayscale image according to the edge information; and a rotation submodule, And for rotating the grayscale image according to the tilt angle to output the grayscale image without an oblique angle.
11、 根据权利要求 10所述的图像倾斜校正装置, 其特征在于, 所述获取 子模块还用于通过 Canny算子获得所述灰度图像的边缘信息;  The image tilt correction device according to claim 10, wherein the acquisition sub-module is further configured to obtain edge information of the grayscale image by using a Canny operator;
所述计算子模块还用于通过 Hough 变换对所述灰度图像的两侧的所述边 缘信息进行对照处理, 以计算出所述灰度图像的水平倾斜角度;  The calculation sub-module is further configured to compare the edge information of the two sides of the grayscale image by a Hough transform to calculate a horizontal tilt angle of the grayscale image;
所述旋转子模块还用于根据所述倾斜角,通过双线性插值算法对所述灰度 图像进行旋转校正。  The rotation sub-module is further configured to perform rotation correction on the grayscale image by a bilinear interpolation algorithm according to the tilt angle.
PCT/CN2010/080304 2010-06-30 2010-12-27 Image tilt correction method and apparatus WO2012000296A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN 201010221775 CN101923710A (en) 2010-06-30 2010-06-30 Image tilt correction method and device
CN201010221775.3 2010-06-30

Publications (1)

Publication Number Publication Date
WO2012000296A1 true WO2012000296A1 (en) 2012-01-05

Family

ID=43338620

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2010/080304 WO2012000296A1 (en) 2010-06-30 2010-12-27 Image tilt correction method and apparatus

Country Status (2)

Country Link
CN (1) CN101923710A (en)
WO (1) WO2012000296A1 (en)

Families Citing this family (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101923710A (en) * 2010-06-30 2010-12-22 青岛海信网络科技股份有限公司 Image tilt correction method and device
CN103279924B (en) * 2013-05-24 2015-11-25 中南大学 A kind of bearing calibration of the patent certificate image to arbitrary inclination
JP5598576B1 (en) * 2013-06-24 2014-10-01 富士ゼロックス株式会社 MFP and reader
CN104573655B (en) * 2015-01-09 2018-03-20 安徽清新互联信息科技有限公司 A kind of sidewalk for visually impaired people direction detection method based on video
CN105335760A (en) * 2015-11-16 2016-02-17 南京邮电大学 Image number character recognition method
CN106791736B (en) * 2015-11-25 2020-05-15 中兴通讯股份有限公司 Trapezoidal correction method and projector
CN106951896B (en) * 2017-02-22 2020-01-03 武汉黄丫智能科技发展有限公司 License plate image tilt correction method
CN108052936B (en) * 2017-11-03 2021-06-29 中国科学院计算技术研究所 Automatic inclination correction method and system for Braille image
CN110849326B (en) * 2019-12-25 2022-06-07 深圳供电局有限公司 Telegraph pole monitoring method and monitoring equipment
CN112001238A (en) * 2020-07-14 2020-11-27 浙江大华技术股份有限公司 Terminal block wiring state recognition method, recognition device, and storage medium

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20020028027A1 (en) * 2000-09-07 2002-03-07 Fuji Xerox Co., Ltd. Image processing device, image processing method, and recording medium storing image processing program
US6493470B1 (en) * 1995-06-20 2002-12-10 Canon Kabushiki Kaisha Image processing method and apparatus for detecting the tilt amount of input image data
CN101118596A (en) * 2007-09-04 2008-02-06 西安理工大学 License plate sloped correcting method based on supporting vector machines
CN101923710A (en) * 2010-06-30 2010-12-22 青岛海信网络科技股份有限公司 Image tilt correction method and device

Family Cites Families (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN100487723C (en) * 2006-04-29 2009-05-13 北大方正集团有限公司 Method for recognizing print form italic character
CN101625760A (en) * 2009-07-28 2010-01-13 谭洪舟 Method for correcting certificate image inclination

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6493470B1 (en) * 1995-06-20 2002-12-10 Canon Kabushiki Kaisha Image processing method and apparatus for detecting the tilt amount of input image data
US20020028027A1 (en) * 2000-09-07 2002-03-07 Fuji Xerox Co., Ltd. Image processing device, image processing method, and recording medium storing image processing program
CN101118596A (en) * 2007-09-04 2008-02-06 西安理工大学 License plate sloped correcting method based on supporting vector machines
CN101923710A (en) * 2010-06-30 2010-12-22 青岛海信网络科技股份有限公司 Image tilt correction method and device

Also Published As

Publication number Publication date
CN101923710A (en) 2010-12-22

Similar Documents

Publication Publication Date Title
WO2012000296A1 (en) Image tilt correction method and apparatus
WO2018219054A1 (en) Method, device, and system for license plate recognition
WO2016192494A1 (en) Image processing method and device
JP4488543B2 (en) Search and match embedded images
CN110348264B (en) QR two-dimensional code image correction method and system
US20110299761A1 (en) Image Processing Apparatus, Image Processing Method, and Program
US8428361B2 (en) Image processing apparatus for detecting a face
CN105488501A (en) Method for correcting license plate slant based on rotating projection
US9087253B2 (en) Method and system for determining edge line in QR code binary image
TWI425444B (en) Method and device for detecting and correcting skewed image data
WO2017206444A1 (en) Method and device for detecting imaging difference, and computer storage medium
JP2003051017A (en) White line detector
JP2013025319A (en) Binarization threshold determination device, method, and program
CN112733703A (en) Vehicle parking state detection method and system
US9077926B2 (en) Image processing method and image processing apparatus
CN115272199A (en) PCB carrier plate defect detection method and system, electronic equipment and medium
US20200242391A1 (en) Object detection apparatus, object detection method, and computer-readable recording medium
KR20120009591A (en) Vehicle Collision Alarm System and Method
WO2024002396A2 (en) Vehicle charging port recognition method and related device
JP3659426B2 (en) Edge detection method and edge detection apparatus
JP6772059B2 (en) Electronic control devices, electronic control systems and electronic control methods
US10223583B2 (en) Object detection apparatus
TW201311000A (en) Imaging apparatus and method for positioning thereof
TW202129540A (en) Method and device for recognizing character and storage medium
TW201619577A (en) Image monitoring system and method

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: 10853999

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: 10853999

Country of ref document: EP

Kind code of ref document: A1

32PN Ep: public notification in the ep bulletin as address of the adressee cannot be established

Free format text: NOTING OF LOSS OF RIGHTS PURSUANT TO RULE 112(1) EPC (EPO FORM 1205A DATED 19.07.2013)

122 Ep: pct application non-entry in european phase

Ref document number: 10853999

Country of ref document: EP

Kind code of ref document: A1