[go: up one dir, main page]

CN111079738B - Image processing method, system and terminal equipment - Google Patents

Image processing method, system and terminal equipment Download PDF

Info

Publication number
CN111079738B
CN111079738B CN201911160211.0A CN201911160211A CN111079738B CN 111079738 B CN111079738 B CN 111079738B CN 201911160211 A CN201911160211 A CN 201911160211A CN 111079738 B CN111079738 B CN 111079738B
Authority
CN
China
Prior art keywords
image
color space
processed
cropped
image processing
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.)
Active
Application number
CN201911160211.0A
Other languages
Chinese (zh)
Other versions
CN111079738A (en
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.)
Changchun Institute of Optics Fine Mechanics and Physics of CAS
Original Assignee
Changchun Institute of Optics Fine Mechanics and Physics of CAS
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 Changchun Institute of Optics Fine Mechanics and Physics of CAS filed Critical Changchun Institute of Optics Fine Mechanics and Physics of CAS
Priority to CN201911160211.0A priority Critical patent/CN111079738B/en
Publication of CN111079738A publication Critical patent/CN111079738A/en
Application granted granted Critical
Publication of CN111079738B publication Critical patent/CN111079738B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V10/00Arrangements for image or video recognition or understanding
    • G06V10/20Image preprocessing
    • G06V10/26Segmentation of patterns in the image field; Cutting or merging of image elements to establish the pattern region, e.g. clustering-based techniques; Detection of occlusion
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V10/00Arrangements for image or video recognition or understanding
    • G06V10/20Image preprocessing
    • G06V10/24Aligning, centring, orientation detection or correction of the image
    • G06V10/243Aligning, centring, orientation detection or correction of the image by compensating for image skew or non-uniform image deformations
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V10/00Arrangements for image or video recognition or understanding
    • G06V10/40Extraction of image or video features
    • G06V10/44Local feature extraction by analysis of parts of the pattern, e.g. by detecting edges, contours, loops, corners, strokes or intersections; Connectivity analysis, e.g. of connected components

Landscapes

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

Abstract

The application is applicable to the technical field of image processing, and provides an image processing method, an image processing system and terminal equipment, wherein the method comprises the following steps: obtaining an image to be processed by scanning an original image or photographing the original image; acquiring the outline of an image to be processed so as to cut the outline to obtain a cut image; if the ground color exists in the image to be processed, extracting an RGB color space and a YCbCr color space of the cut image, and converting the cut image in the RGB color space and the YCbCr color space twice to obtain the image with the ground color removed. The method can remarkably remove the background color of the image, perform inclination calibration and clipping, and improve the image quality.

Description

一种图像处理方法、系统及终端设备An image processing method, system and terminal equipment

技术领域Technical field

本发明涉及图像处理领域,尤其涉及一种图像处理方法、系统、终端设备及计算机可读存储介质。The present invention relates to the field of image processing, and in particular, to an image processing method, system, terminal equipment and computer-readable storage medium.

背景技术Background technique

现阶段,使用扫描仪、手机或相机等设备对文档资料等进行扫描或拍照,以完成资料的电子化或进行信息传输已变得越来越普遍。但是,由于设备、光照、文档自身等原因,扫描或拍摄的文档图像经常会有底色,一方面影响打印质量,另一方面影响后续的OCR识别。At this stage, it has become more and more common to use devices such as scanners, mobile phones, or cameras to scan or take photos of documents and materials to complete electronic data or transmit information. However, due to reasons such as equipment, lighting, and the document itself, scanned or photographed document images often have background colors, which affects the print quality on the one hand and subsequent OCR recognition on the other.

此外,文档图像经常存在黑边等用户不感兴趣的区域以及倾斜等问题,影响用户体验。In addition, document images often have problems such as black edges and areas that users are not interested in, as well as problems such as tilt, which affects the user experience.

故有必要提出一种新的技术方案,以解决上述技术问题。Therefore, it is necessary to propose a new technical solution to solve the above technical problems.

发明内容Contents of the invention

鉴于此,本发明实施例提供了一种图像处理方法、系统及终端设备,以解决现有技术中扫描或拍摄等方式获取图像时不能得到理想图像的问题。In view of this, embodiments of the present invention provide an image processing method, system and terminal device to solve the problem in the prior art that ideal images cannot be obtained when images are obtained by scanning or photographing.

本发明实施例的第一方面提供了一种图像处理方法,所述图像处理方法包括:A first aspect of the embodiment of the present invention provides an image processing method. The image processing method includes:

通过扫描原始图像或对原始图像进行拍照的方式获取待处理图像;Obtain the image to be processed by scanning the original image or taking a photo of the original image;

获取所述待处理图像的轮廓以对其进行裁剪,得到裁剪后图像;Obtain the outline of the image to be processed to crop it to obtain a cropped image;

检测所述裁剪后图像中是否存在底色,所述底色指不包含在所述原始图像中的部分;Detect whether there is a background color in the cropped image, where the background color refers to the part not included in the original image;

若存在,则提取所述裁剪后图像的RGB颜色空间和YCbCr颜色空间,将裁剪后图像在RGB颜色空间和YCbCr颜色空间进行两次转换,得到去除底色后的图像。If it exists, extract the RGB color space and YCbCr color space of the cropped image, convert the cropped image twice in the RGB color space and YCbCr color space, and obtain the image with the background color removed.

可选地,所述获取所述待处理图像的轮廓以对其进行裁剪,包括:Optionally, obtaining the outline of the image to be processed to crop it includes:

获取所述待处理图像对应的原始图像的轮廓;Obtain the outline of the original image corresponding to the image to be processed;

通过霍夫变换获取所述轮廓对应的边缘线以及边缘线之间的交点;Obtain the edge lines corresponding to the contour and the intersection points between the edge lines through Hough transformation;

根据所述边缘线和所述交点进行映射变换,以对所述待处理图像进行倾斜校正并进行裁剪。Mapping transformation is performed according to the edge line and the intersection point to perform tilt correction and cropping of the image to be processed.

可选地,所述获取所述待处理图像对应的原始图像的轮廓,包括:Optionally, obtaining the outline of the original image corresponding to the image to be processed includes:

若所述待处理图像为彩色图像,则对所述待处理图像进行灰度化;If the image to be processed is a color image, grayscale the image to be processed;

通过大津法将灰度化的待处理图像二值化,并进行形态学运算,以获取所述待处理图像的轮廓。The grayscale image to be processed is binarized by the Otsu method, and morphological operations are performed to obtain the outline of the image to be processed.

可选地,所述通过霍夫变换获取所述轮廓对应的边缘线以及边缘线之间的交点,包括:Optionally, obtaining the edge lines corresponding to the contour and the intersection points between the edge lines through Hough transformation includes:

通过霍夫变换检测所述待处理图像的边缘线;Detect the edge lines of the image to be processed through Hough transform;

根据设定预设条件选取所述边缘线中的直线部分;Select the straight part of the edge line according to the set preset conditions;

根据所述选取的直线确定直线与直线之间的交点。The intersection point between the straight lines is determined based on the selected straight lines.

可选地,所述将裁剪后图像在RGB颜色空间和YCbCr颜色空间进行两次转换包括:Optionally, converting the cropped image twice in RGB color space and YCbCr color space includes:

将裁剪后图像由RGB颜色空间转换到YCbCr颜色空间,并提取其中的各分量;Convert the cropped image from RGB color space to YCbCr color space and extract each component;

对Y分量进行缩放、滤波得到变换分量G,将Y分量与变换分量G转换成浮点数矩阵,两者相除得到M=Y/G,并转换回整型矩阵;Scale and filter the Y component to obtain the transformation component G, convert the Y component and the transformation component G into a floating point matrix, divide the two to obtain M=Y/G, and convert them back to an integer matrix;

将Y、Cb、Cr合并并进行Gamma变换,将待处理图像由YCbCr颜色空间转换回RGB颜色空间。Combine Y, Cb, and Cr and perform Gamma transformation to convert the image to be processed from YCbCr color space back to RGB color space.

可选地,所述将待处理图像由YCbCr颜色空间转换回RGB颜色空间之后还包括:Optionally, after converting the image to be processed from the YCbCr color space back to the RGB color space, it also includes:

对转换会RGB颜色空间之后的图像进行校正、填充,去除多余区域。Correct and fill the image converted to RGB color space to remove redundant areas.

本发明实施例的第二方面提供了一种图像处理系统,所述图像处理系统包括:A second aspect of the embodiment of the present invention provides an image processing system. The image processing system includes:

图像获取单元,用于通过扫描原始图像或对原始图像进行拍照的方式获取待处理图像;An image acquisition unit, used to acquire the image to be processed by scanning the original image or taking a photo of the original image;

裁剪单元,用于获取所述待处理图像的轮廓以对其进行裁剪,得到裁剪后图像;A cropping unit, used to obtain the outline of the image to be processed to crop it to obtain a cropped image;

检测单元,检测所述裁剪后图像中是否存在底色,所述底色指不包含在所述原始图像中的部分;A detection unit that detects whether there is a background color in the cropped image, where the background color refers to the part not included in the original image;

底色去除单元,用于提取所述裁剪后图像的RGB颜色空间和YCbCr颜色空间,将裁剪后图像在RGB颜色空间和YCbCr颜色空间进行两次转换,得到去除底色后的图像。The background color removal unit is used to extract the RGB color space and YCbCr color space of the cropped image, and convert the cropped image twice in the RGB color space and YCbCr color space to obtain an image with the background color removed.

可选地,所述裁剪单元,具体用于:Optionally, the cutting unit is specifically used for:

获取所述待处理图像对应的原始图像的轮廓;Obtain the outline of the original image corresponding to the image to be processed;

通过霍夫变换获取所述轮廓对应的边缘线以及边缘线之间的交点;Obtain the edge lines corresponding to the contour and the intersection points between the edge lines through Hough transformation;

根据所述边缘线和所述交点进行映射变换,以对所述待处理图像进行倾斜校正并进行裁剪。Mapping transformation is performed according to the edge line and the intersection point to perform tilt correction and cropping of the image to be processed.

本发明实施例的第三方面提供了一种终端设备,包括存储器,处理器及存储在存储器上并可在处理器上运行的计算机程序,上述处理器执行上述计算机程序时实现上述第一方面提及的方法。A third aspect of the embodiment of the present invention provides a terminal device, which includes a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, the first aspect is implemented. and methods.

本发明实施例的第四方面提供了一种计算机可读存储介质,该计算机可读存储介质上存储有计算机程序,上述计算机程序被处理器执行时实现上述第一方面提及的方法。A fourth aspect of the embodiments of the present invention provides a computer-readable storage medium. The computer-readable storage medium stores a computer program. When the computer program is executed by a processor, the method mentioned in the first aspect is implemented.

本发明实施例与现有技术相比存在的有益效果是:本申请中在获取待处理图像之后,对图像进行校正和裁剪,之后进行底色的去除以得到理想图像。通过上述方法可以显著地去除图像底色并进行倾斜校准与裁剪,提高图像质量。Compared with the prior art, the beneficial effects of the embodiments of the present invention are: in this application, after acquiring the image to be processed, the image is corrected and cropped, and then the background color is removed to obtain the ideal image. Through the above method, the image background can be significantly removed and tilt calibration and cropping can be performed to improve image quality.

附图说明Description of the drawings

为了更清楚地说明本发明实施例中的技术方案,下面将对实施例或现有技术描述中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图仅仅是本发明的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动性的前提下,还可以根据这些附图获得其他的附图。In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the drawings needed to be used in the description of the embodiments or prior art will be briefly introduced below. Obviously, the drawings in the following description are only illustrative of the present invention. For some embodiments, for those of ordinary skill in the art, other drawings can be obtained based on these drawings without exerting creative efforts.

图1为本发明实施例提供的一种图像处理方法的实现流程图;Figure 1 is an implementation flow chart of an image processing method provided by an embodiment of the present invention;

图2为本发明实施例提供的待处理图像的示意图;Figure 2 is a schematic diagram of an image to be processed provided by an embodiment of the present invention;

图3为本发明实施例提供的修正、裁剪后待处理图像;Figure 3 is an image to be processed after correction and cropping provided by the embodiment of the present invention;

图4为本发明实施例提供的底色后的图像;Figure 4 is an image after background color provided by an embodiment of the present invention;

图5为本发明实施例提供图像处理系统的结构示意图;Figure 5 is a schematic structural diagram of an image processing system according to an embodiment of the present invention;

图6为本发明实施例提供的终端设备的结构示意图。Figure 6 is a schematic structural diagram of a terminal device provided by an embodiment of the present invention.

具体实施方式Detailed ways

以下描述中,为了说明而不是为了限定,提出了诸如特定系统结构、技术之类的具体细节,以便透彻理解本发明实施例。然而,本领域的技术人员应当清楚,在没有这些具体细节的其它实施例中也可以实现本发明。在其它情况中,省略对众所周知的系统、装置、电路以及方法的详细说明,以免不必要的细节妨碍本发明的描述。In the following description, specific details such as specific system structures and technologies are provided for the purpose of illustration rather than limitation, so as to provide a thorough understanding of the embodiments of the present invention. However, it will be apparent to those skilled in the art that the present invention may be practiced in other embodiments without these specific details. In other instances, detailed descriptions of well-known systems, devices, circuits, and methods are omitted so as not to obscure the present invention in unnecessary detail.

应当理解,当在本说明书和所附权利要求书中使用时,术语“包括”指示所描述特征、整体、步骤、操作、元素和/或组件的存在,但并不排除一个或多个其它特征、整体、步骤、操作、元素、组件和/或其集合的存在或添加。It will be understood that, when used in this specification and the appended claims, the term "comprising" indicates the presence of described features, integers, steps, operations, elements and/or components but does not exclude one or more other features , the presence or addition of a whole, a step, an operation, an element, a component, and/or a collection thereof.

为了说明本发明所述的技术方案,下面通过具体实施例来进行说明。In order to illustrate the technical solution of the present invention, specific examples will be described below.

实施例一:Example 1:

图1是本发明实施例一提供的图像处理方法方法的流程示意图,该方法可以包括以下步骤:Figure 1 is a schematic flowchart of an image processing method provided by Embodiment 1 of the present invention. The method may include the following steps:

S11:通过扫描原始图像或对原始图像进行拍照的方式获取待处理图像。S11: Obtain the image to be processed by scanning the original image or taking a photo of the original image.

S12:获取所述待处理图像的轮廓以对其进行裁剪,得到裁剪后图像。S12: Obtain the outline of the image to be processed and crop it to obtain a cropped image.

具体地:获取待处理图像中包含的原始图像的轮廓,通过霍夫变换获取感兴趣区域及交点坐标,通过映射变换进行校正并裁剪。Specifically: obtain the outline of the original image contained in the image to be processed, obtain the area of interest and intersection coordinates through Hough transformation, correct and crop through mapping transformation.

更进一步的,对所述待处理图像进行自适应二值化,形态学处理,获取最大轮廓。对所述待处理图像进行霍夫变换,得到四条边缘直线;根据边缘直线确定四个交点坐标,利用映射变换对图像进行倾斜校正与裁剪。Furthermore, the image to be processed is subjected to adaptive binarization and morphological processing to obtain the maximum contour. Hough transform is performed on the image to be processed to obtain four edge straight lines; four intersection coordinates are determined based on the edge straight lines, and mapping transformation is used to perform tilt correction and cropping of the image.

S13:检测所述裁剪后图像中是否存在底色,所述底色指不包含在所述原始图像中的部分。S13: Detect whether there is a background color in the cropped image, where the background color refers to the part not included in the original image.

S14:在存在底色时,提取所述裁剪后图像的RGB颜色空间和YCbCr颜色空间,将裁剪后图像在RGB颜色空间和YCbCr颜色空间进行两次转换,得到去除底色后的图像。S14: When there is a background color, extract the RGB color space and YCbCr color space of the cropped image, and convert the cropped image twice in the RGB color space and YCbCr color space to obtain an image with the background color removed.

具体地,将所述原始图像从第一颜色空间转换到第二颜色空间;将所述原始图像在所述第二颜色空间中进行去底色处理;将图像从第二颜色空间转换回第一颜色空间;对图像进行填充,去掉黑边等不感兴趣区域。所述第一颜色空间为RGB颜色空间且所述第二颜色空间为YCbCr颜色空间。Specifically, the original image is converted from the first color space to the second color space; the original image is subjected to background color removal processing in the second color space; and the image is converted from the second color space back to the first color space. Color space; fill the image and remove uninteresting areas such as black edges. The first color space is an RGB color space and the second color space is a YCbCr color space.

更进一步的,上述将所述原始图像在所述第二颜色空间中进行去底色处理包括:对第二颜色空间的图像M进行图像缩放,Y分量进行高斯滤波得到G;G图像恢复,去底色后得到的图像M=Y/G;第二颜色空间转换到第一颜色空间;进行对比度调整,以使图像在不同颜色空间之间进行转换。Furthermore, the above-mentioned process of removing the background color of the original image in the second color space includes: performing image scaling on the image M in the second color space, performing Gaussian filtering on the Y component to obtain G; restoring the G image, and removing The image obtained after background coloring is M=Y/G; the second color space is converted to the first color space; the contrast is adjusted to convert the image between different color spaces.

本发明实施例与现有技术相比存在的有益效果是:本申请中在获取待处理图像之后,对图像进行校正和裁剪,之后进行底色的去除以得到理想图像。通过上述方法可以显著地去除图像底色并进行倾斜校准与裁剪,提高图像质量。Compared with the prior art, the beneficial effects of the embodiments of the present invention are: in this application, after acquiring the image to be processed, the image is corrected and cropped, and then the background color is removed to obtain the ideal image. Through the above method, the image background can be significantly removed and tilt calibration and cropping can be performed to improve image quality.

实施例二:Example 2:

下面结合具体实施例分步骤对上述过程进行说明:The above process will be explained step by step with reference to specific embodiments:

参见图2-4,本发明一种文档图像快速校正方法,包括如下步骤:Referring to Figures 2-4, a document image rapid correction method of the present invention includes the following steps:

步骤101,获取待处理图像,如图2所示;Step 101, obtain the image to be processed, as shown in Figure 2;

步骤102,对输入取待处理图像进行倾斜于裁剪处理,图3为裁剪后的待处理图像;Step 102: Perform oblique cropping on the input image to be processed. Figure 3 shows the cropped image to be processed;

具体的,包括如下步骤:Specifically, it includes the following steps:

步骤1021,在待处理图像为彩色图像时,对其灰度化;Step 1021, when the image to be processed is a color image, grayscale it;

步骤1022,利用大津法对灰度化的图像进行二值化,形态学运算;Step 1022: Use the Otsu method to binarize the grayscale image and perform morphological operations;

步骤1023,获取待处理图像外层轮廓;Step 1023, obtain the outer contour of the image to be processed;

步骤1024,利用霍夫变换检测边缘直线,设定阈值条件去掉不符直线;Step 1024, use Hough transform to detect edge straight lines, and set threshold conditions to remove inconsistent straight lines;

步骤1025,根据边缘直线,确定四个交点坐标,利用映射变换,对图像进行倾斜校正并裁剪。Step 1025: Determine the coordinates of four intersection points based on the edge straight lines, and use mapping transformation to perform tilt correction and crop the image.

步骤103,对步骤102得到的图像进行去底色处理;Step 103, perform background color removal processing on the image obtained in step 102;

具体的,包括如下步骤:Specifically, it includes the following steps:

步骤1031,将图像有RGB颜色空间转换到YCbCr颜色空间;Step 1031, convert the image from RGB color space to YCbCr color space;

步骤1032,将颜色空间进行分离,Y分量进行缩放以提高快速性;Step 1032, separate the color space and scale the Y component to improve speed;

步骤1033,对缩放后的Y进行高斯滤波,核尺寸为Y的宽度、Y的高度中的较小者,滤波后得到G,并恢复成原尺寸;Step 1033: Perform Gaussian filtering on the scaled Y. The kernel size is the smaller of the width of Y and the height of Y. After filtering, G is obtained and restored to its original size;

步骤1034,Y与G转换成浮点数矩阵,两者相除得到M=Y/G,并转换回整型矩阵;Step 1034, Y and G are converted into floating-point matrices, divided by the two to obtain M=Y/G, and converted back to integer matrices;

步骤1035,图像的Y、Cb、Cr合并并进行Gamma变换;Step 1035: The Y, Cb, and Cr of the image are combined and Gamma transformed;

步骤1036,图像由YCbCr颜色空间转换回RGB颜色空间;Step 1036, the image is converted from YCbCr color space back to RGB color space;

步骤1037,图像颜色校正;Step 1037, image color correction;

步骤1037,图像填充,去掉不感兴趣的黑边等区域,以得到理想图片(图4示出了去底色后的图像)。Step 1037: Fill the image and remove uninteresting black edges and other areas to obtain the ideal picture (Figure 4 shows the image after background color removal).

实施例三Embodiment 3

图5是本发明实施例三提供的图像处理系统的结构示意图,为了便于说明,仅示出了与本发明实施例相关的部分。FIG. 5 is a schematic structural diagram of an image processing system provided in Embodiment 3 of the present invention. For convenience of explanation, only parts related to the embodiment of the present invention are shown.

该图像处理系统可以是内置于终端设备内的软件单元、硬件单元或者软硬结合的单元。The image processing system may be a software unit, a hardware unit, or a combination of software and hardware built into the terminal device.

所述图像处理系统,包括:The image processing system includes:

图像获取单元51,用于通过扫描原始图像或对原始图像进行拍照的方式获取待处理图像;The image acquisition unit 51 is used to acquire the image to be processed by scanning the original image or taking a photo of the original image;

裁剪单元52,用于获取所述待处理图像的轮廓以对其进行裁剪,得到裁剪后图像;The cropping unit 52 is used to obtain the outline of the image to be processed to crop it to obtain a cropped image;

检测单元53,检测所述裁剪后图像中是否存在底色,所述底色指不包含在所述原始图像中的部分;The detection unit 53 detects whether there is a background color in the cropped image, where the background color refers to the part not included in the original image;

底色去除单元54,用于提取所述裁剪后图像的RGB颜色空间和YCbCr颜色空间,将裁剪后图像在RGB颜色空间和YCbCr颜色空间进行两次转换,得到去除底色后的图像。The background color removal unit 54 is used to extract the RGB color space and YCbCr color space of the cropped image, and convert the cropped image twice in the RGB color space and YCbCr color space to obtain an image with the background color removed.

可选地,所述裁剪单元52,具体用于:Optionally, the cutting unit 52 is specifically used for:

获取所述待处理图像对应的原始图像的轮廓;Obtain the outline of the original image corresponding to the image to be processed;

通过霍夫变换获取所述轮廓对应的边缘线以及边缘线之间的交点;Obtain the edge lines corresponding to the contour and the intersection points between the edge lines through Hough transformation;

根据所述边缘线和所述交点进行映射变换,以对所述待处理图像进行倾斜校正并进行裁剪。Mapping transformation is performed according to the edge line and the intersection point to perform tilt correction and cropping of the image to be processed.

上述图像处理系统的具体工作过程参见上述图像处理方法的实现过程,在此不再赘述。For the specific working process of the above image processing system, please refer to the implementation process of the above image processing method, which will not be described again here.

实施例四Embodiment 4

图6是本发明实施例四提供的终端设备的结构示意图。如图6所示,该实施例的终端设备6包括:处理器60、存储器61以及存储在所述存储器61中并可在所述处理器60上运行的计算机程序62。所述处理器60执行所述计算机程序62时实现上述方法实施例一中的步骤,例如图1所示的步骤S11至S14。所述处理器60执行所述计算机程序62时实现上述各装置实施例中各模块/单元的功能,例如图5所示单元51至54的功能。Figure 6 is a schematic structural diagram of a terminal device provided in Embodiment 4 of the present invention. As shown in FIG. 6 , the terminal device 6 of this embodiment includes: a processor 60 , a memory 61 , and a computer program 62 stored in the memory 61 and executable on the processor 60 . When the processor 60 executes the computer program 62 , the steps in the first method embodiment are implemented, such as steps S11 to S14 shown in FIG. 1 . When the processor 60 executes the computer program 62, it implements the functions of each module/unit in each of the above device embodiments, such as the functions of units 51 to 54 shown in Figure 5 .

以上所述,以上实施例仅用以说明本发明的技术方案,而非对其限制;尽管参照前述实施例对本发明进行了详细的说明,本领域的普通技术人员应当理解:其依然可以对前述各实施例所记载的技术方案进行修改,或者对其中部分技术特征进行等同替换;而这些修改或者替换,并不使相应技术方案的本质脱离本发明各实施例技术方案的精神和范围。As mentioned above, the above embodiments are only used to illustrate the technical solution of the present invention, but not to limit it. Although the present invention has been described in detail with reference to the foregoing embodiments, those of ordinary skill in the art should understand that they can still modify the foregoing. The technical solutions described in each embodiment may be modified, or some of the technical features may be equivalently replaced; however, these modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of each embodiment of the present invention.

Claims (9)

1.一种图像处理方法,其特征在于,所述图像处理方法包括:1. An image processing method, characterized in that the image processing method includes: 通过扫描原始图像或对原始图像进行拍照的方式获取待处理图像;Obtain the image to be processed by scanning the original image or taking a photo of the original image; 获取所述待处理图像的轮廓以对其进行裁剪,得到裁剪后图像;Obtain the outline of the image to be processed to crop it to obtain a cropped image; 检测所述裁剪后图像中是否存在底色,所述底色指不包含在所述原始图像中的部分;Detect whether there is a background color in the cropped image, where the background color refers to the part not included in the original image; 若存在,则提取所述裁剪后图像的RGB颜色空间和YCbCr颜色空间,将裁剪后图像在RGB颜色空间和YCbCr颜色空间进行两次转换,得到去除底色后的图像;If it exists, extract the RGB color space and YCbCr color space of the cropped image, convert the cropped image twice in the RGB color space and YCbCr color space, and obtain the image after removing the background color; 所述将裁剪后图像在RGB颜色空间和YCbCr颜色空间进行两次转换包括:The two conversions of the cropped image into RGB color space and YCbCr color space include: 将裁剪后图像由RGB颜色空间转换到YCbCr颜色空间,并提取其中的各分量;Convert the cropped image from RGB color space to YCbCr color space and extract each component; 对Y分量进行缩放、滤波得到变换分量G,将Y分量与变换分量G转换成浮点数矩阵,两者相除得到M=Y/G,并转换回整型矩阵;Scale and filter the Y component to obtain the transformation component G, convert the Y component and the transformation component G into a floating point matrix, divide the two to obtain M=Y/G, and convert them back to an integer matrix; 将Y、Cb、Cr合并并进行Gamma变换,将待处理图像由YCbCr颜色空间转换回RGB颜色空间;Combine Y, Cb, and Cr and perform Gamma transformation to convert the image to be processed from YCbCr color space back to RGB color space; YCbCr颜色空间中去除底色具体包括:Specific background color removal in YCbCr color space includes: 对YCbCr颜色空间的图像M进行图像缩放,对Y分量进行高斯滤波,核尺寸采用Y的宽度、Y的高度中的较小者,得到变换分量G;将Y分量与变换分量G转换成浮点数矩阵,两者相除得到去底色后的图像,M=Y/G;并转换回整形矩阵。Perform image scaling on the image M in the YCbCr color space, perform Gaussian filtering on the Y component, and use the smaller of the width of Y and the height of Y as the kernel size to obtain the transformation component G; convert the Y component and the transformation component G into floating point numbers. Matrix, divide the two to get the image after removing the background color, M=Y/G; and convert it back to the shaping matrix. 2.根据权利要求1所述的图像处理方法,其特征在于,所述获取所述待处理图像的轮廓以对其进行裁剪,包括:2. The image processing method according to claim 1, characterized in that said obtaining the outline of the image to be processed to crop it includes: 获取所述待处理图像对应的原始图像的轮廓;Obtain the outline of the original image corresponding to the image to be processed; 通过霍夫变换获取所述轮廓对应的边缘线以及边缘线之间的交点;Obtain the edge lines corresponding to the contour and the intersection points between the edge lines through Hough transformation; 根据所述边缘线和所述交点进行映射变换,以对所述待处理图像进行倾斜校正并进行裁剪。Mapping transformation is performed according to the edge line and the intersection point to perform tilt correction and cropping of the image to be processed. 3.根据权利要求2所述的图像处理方法,其特征在于,所述获取所述待处理图像对应的原始图像的轮廓,包括:3. The image processing method according to claim 2, wherein said obtaining the outline of the original image corresponding to the image to be processed includes: 若所述待处理图像为彩色图像,则对所述待处理图像进行灰度化;If the image to be processed is a color image, grayscale the image to be processed; 通过大津法将灰度化的待处理图像二值化,并进行形态学运算,以获取所述待处理图像的轮廓。The grayscale image to be processed is binarized by the Otsu method, and morphological operations are performed to obtain the outline of the image to be processed. 4.根据权利要求1所述的图像处理方法,其特征在于,所述通过霍夫变换获取所述轮廓对应的边缘线以及边缘线之间的交点,包括:4. The image processing method according to claim 1, wherein obtaining the edge line corresponding to the contour and the intersection between the edge lines through Hough transformation includes: 通过霍夫变换检测所述待处理图像的边缘线;Detect the edge lines of the image to be processed through Hough transform; 根据设定预设条件选取所述边缘线中的直线部分;Select the straight part of the edge line according to the set preset conditions; 5.根据权利要求1所述的图像处理方法,其特征在于,所述将待处理图像由YCbCr颜色空间转换回RGB颜色空间之后还包括:5. The image processing method according to claim 1, characterized in that, after converting the image to be processed from the YCbCr color space back to the RGB color space, it further includes: 对转换回RGB颜色空间之后的图像进行校正、填充,去除多余区域。Correct and fill the image after converting it back to RGB color space, and remove redundant areas. 6.一种采用如权利要求1至5任意一项所述的图像处理方法的图像处理系统,其特征在于,所述图像处理系统包括:6. An image processing system using the image processing method according to any one of claims 1 to 5, characterized in that the image processing system includes: 图像获取单元,用于通过扫描原始图像或对原始图像进行拍照的方式获取待处理图像;An image acquisition unit, used to acquire the image to be processed by scanning the original image or taking a photo of the original image; 裁剪单元,用于获取所述待处理图像的轮廓以对其进行裁剪,得到裁剪后图像;A cropping unit, used to obtain the outline of the image to be processed to crop it to obtain a cropped image; 检测单元,检测所述裁剪后图像中是否存在底色,所述底色指不包含在所述原始图像中的部分;A detection unit that detects whether there is a background color in the cropped image, where the background color refers to the part not included in the original image; 底色去除单元,用于提取所述裁剪后图像的RGB颜色空间和YCbCr颜色空间,将裁剪后图像在RGB颜色空间和YCbCr颜色空间进行两次转换并在YCbCr颜色空间去除底色,得到去除底色后的图像。The background color removal unit is used to extract the RGB color space and YCbCr color space of the cropped image, convert the cropped image twice in the RGB color space and the YCbCr color space, and remove the background color in the YCbCr color space to obtain the background removal Colored image. 7.根据权利要求6所述的图像处理系统,其特征在于,所述裁剪单元,具体用于:7. The image processing system according to claim 6, characterized in that the cropping unit is specifically used to: 获取所述待处理图像对应的原始图像的轮廓;Obtain the outline of the original image corresponding to the image to be processed; 通过霍夫变换获取所述轮廓对应的边缘线以及边缘线之间的交点;Obtain the edge lines corresponding to the contour and the intersection points between the edge lines through Hough transformation; 根据所述边缘线和所述交点进行映射变换,以对所述待处理图像进行倾斜校正并进行裁剪。Mapping transformation is performed according to the edge line and the intersection point to perform tilt correction and cropping of the image to be processed. 8.一种终端设备,包括存储器、处理器以及存储在所述存储器中并可在所述处理器上运行的计算机程序,其特征在于,所述处理器执行所述计算机程序时实现如权利要求1至5中任一项所述方法的步骤。8. A terminal device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that when the processor executes the computer program, it implements the claims as claimed in The steps of the method of any one of 1 to 5. 9.一种计算机可读存储介质,所述计算机可读存储介质存储有计算机程序,其特征在于,所述计算机程序被处理器执行时实现如权利要求1至5中任一项所述方法的步骤。9. A computer-readable storage medium, the computer-readable storage medium stores a computer program, characterized in that, when the computer program is executed by a processor, the method of any one of claims 1 to 5 is implemented. step.
CN201911160211.0A 2019-11-23 2019-11-23 Image processing method, system and terminal equipment Active CN111079738B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201911160211.0A CN111079738B (en) 2019-11-23 2019-11-23 Image processing method, system and terminal equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201911160211.0A CN111079738B (en) 2019-11-23 2019-11-23 Image processing method, system and terminal equipment

Publications (2)

Publication Number Publication Date
CN111079738A CN111079738A (en) 2020-04-28
CN111079738B true CN111079738B (en) 2023-09-29

Family

ID=70311412

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201911160211.0A Active CN111079738B (en) 2019-11-23 2019-11-23 Image processing method, system and terminal equipment

Country Status (1)

Country Link
CN (1) CN111079738B (en)

Families Citing this family (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111832423A (en) * 2020-06-19 2020-10-27 北京邮电大学 A kind of bill information identification method, device and system
CN111861922B (en) * 2020-07-21 2024-09-17 浙江大华技术股份有限公司 Color correction matrix adjusting method and device and storage medium
CN116721034A (en) * 2023-06-25 2023-09-08 建信金融科技有限责任公司 Image processing method, device and equipment

Citations (12)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101026677A (en) * 2006-02-23 2007-08-29 佳能株式会社 Image processing apparatus and method, computer program, and storage medium
CN101141548A (en) * 2006-09-06 2008-03-12 村田机械株式会社 Apparatus and method for deciding image color
CN102646195A (en) * 2012-02-21 2012-08-22 北京工业大学 License Plate Locating Method Based on JPEG Compressed Image
CN102890785A (en) * 2011-07-19 2013-01-23 上海上大海润信息系统有限公司 Method for service robot to recognize and locate target
CN103679769A (en) * 2012-09-26 2014-03-26 奥林巴斯映像株式会社 Image editing device and image editing method
CN103716506A (en) * 2012-09-28 2014-04-09 兄弟工业株式会社 Image processing device and computer-readable medium
CN106105205A (en) * 2014-03-14 2016-11-09 高通股份有限公司 Quantization parameter for color space conversion decoding
JP2016192680A (en) * 2015-03-31 2016-11-10 ブラザー工業株式会社 Image processing program, image processing device, and image processing method
CN106210883A (en) * 2016-08-11 2016-12-07 浙江大华技术股份有限公司 A kind of method of Video Rendering, equipment
JP2017208715A (en) * 2016-05-18 2017-11-24 株式会社リコー Image processing apparatus, image processing method, and image processing system
CN108182654A (en) * 2017-12-27 2018-06-19 上海理工大学 Anti- printing, printing and shooting method for anti-counterfeit based on coloured image
CN110298282A (en) * 2019-06-21 2019-10-01 华南师范大学 Document image processing method, storage medium and calculating equipment

Patent Citations (12)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101026677A (en) * 2006-02-23 2007-08-29 佳能株式会社 Image processing apparatus and method, computer program, and storage medium
CN101141548A (en) * 2006-09-06 2008-03-12 村田机械株式会社 Apparatus and method for deciding image color
CN102890785A (en) * 2011-07-19 2013-01-23 上海上大海润信息系统有限公司 Method for service robot to recognize and locate target
CN102646195A (en) * 2012-02-21 2012-08-22 北京工业大学 License Plate Locating Method Based on JPEG Compressed Image
CN103679769A (en) * 2012-09-26 2014-03-26 奥林巴斯映像株式会社 Image editing device and image editing method
CN103716506A (en) * 2012-09-28 2014-04-09 兄弟工业株式会社 Image processing device and computer-readable medium
CN106105205A (en) * 2014-03-14 2016-11-09 高通股份有限公司 Quantization parameter for color space conversion decoding
JP2016192680A (en) * 2015-03-31 2016-11-10 ブラザー工業株式会社 Image processing program, image processing device, and image processing method
JP2017208715A (en) * 2016-05-18 2017-11-24 株式会社リコー Image processing apparatus, image processing method, and image processing system
CN106210883A (en) * 2016-08-11 2016-12-07 浙江大华技术股份有限公司 A kind of method of Video Rendering, equipment
CN108182654A (en) * 2017-12-27 2018-06-19 上海理工大学 Anti- printing, printing and shooting method for anti-counterfeit based on coloured image
CN110298282A (en) * 2019-06-21 2019-10-01 华南师范大学 Document image processing method, storage medium and calculating equipment

Non-Patent Citations (3)

* Cited by examiner, † Cited by third party
Title
一种基于二值图像灰度变化特征的车牌定位方法;单瑾;周娟;;成都电子机械高等专科学校学报(03) *
一种基于二值图像灰度变化特征的车牌定位方法;单瑾等;《成都电子机械高等专科学校学报》(第03期);全文 *
基于YCbCr颜色空间的Retinex低照度图像增强方法研究;田会娟等;《光子学报》(第02期);全文 *

Also Published As

Publication number Publication date
CN111079738A (en) 2020-04-28

Similar Documents

Publication Publication Date Title
US9122921B2 (en) Method for detecting a document boundary
US9898808B1 (en) Systems and methods for removing defects from images
US8467606B2 (en) Method for segmenting a composite image
AU2007224085B2 (en) Model- based dewarping method and apparatus
EP2288135B1 (en) Deblurring and supervised adaptive thresholding for print-and-scan document image evaluation
US8712188B2 (en) System and method for document orientation detection
JP4261005B2 (en) Region-based image binarization system
US20020012462A1 (en) Optical character recognition device and method and recording medium
CN111079738B (en) Image processing method, system and terminal equipment
RU2631765C1 (en) Method and system of correcting perspective distortions in images occupying double-page spread
US7437002B2 (en) Image recognition system utilizing an edge image and a binary image
CN114283156B (en) Method and device for removing document image color and handwriting
EP2270746A2 (en) Method for detecting alterations in printed document using image comparison analyses
US20100189345A1 (en) System And Method For Removing Artifacts From A Digitized Document
JP2001358925A (en) Unit and method for image processing and recording medium
US7542608B2 (en) Method for automatically cropping image objects
CN101520846B (en) Image processing method, image processing apparatus and image forming apparatus
CN101315664A (en) Text Image Preprocessing Method for Text Recognition
CN101320425A (en) Image processing device and method, image forming device, image processing system
CN111445402A (en) Image denoising method and device
JP6542230B2 (en) Method and system for correcting projected distortion
CN115272362A (en) Method and device for segmenting effective area of digital pathology full-field image
CN113793264B (en) Archive image processing method and system based on convolution model and electronic equipment
Shamqoli et al. Border detection of document images scanned from large books
Konya et al. Adaptive methods for robust document image understanding

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant