A method, device and computer equipment for deepening the color of text in document images
Through the deep learning model, the seal and fingerprint areas are detected and segmented, and combined with the machine learning model, local color protection and global image enhancement are solved, which reduces contrast and color distortion of key areas caused by too light color of document images, and improves the quality of image processing and efficiency.
Patent Information
- Application Number
- CN202410903285.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-05
- Publication Date
- 2025-01-14
- Estimated Expiration
- 2044-07-05
AI Technical Summary
In the prior art, when processing document images, the problem of light colors leads to lower contrast and difficult to clearly identify, especially for files with light backgrounds or small handwriting. Global manual processing may cause color distortion in key areas, affecting the integrity of information and Processing efficiency.
Use pre-trained deep learning models to detect and segment seals and fingerprint areas, record their original color information, and predict the adjustment parameters of contrast, brightness and gamma index through machine learning models, local color protection and global image enhancement, ensuring the key The integrity of the area color information.
It realizes color protection in local key areas, avoids the color distortion problem caused by global processing, improves the quality and accuracy of image processing, and improves processing efficiency.
Smart Images

Figure CN118736060B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the technical field of document data processing, and in particular to a method, device and computer equipment for deepening the color of text in a document image. Background Art
[0002] During the scanning, photographing or digitization of documents such as archives and files, the problem of too light a color of the document image often occurs. This situation is usually caused by a variety of factors, such as: the quality of the paper document itself is poor, or the scanner or camera is improperly set up during imaging. Documents that are too light in color will not only significantly affect the user's reading experience, but also reduce the contrast between text and images, making them difficult to clearly identify, especially for documents with light backgrounds or fine handwriting. In addition, for documents that require subsequent processing technologies such as optical character recognition (OCR), images that are too light in color may cause recognition errors or misrecognition problems. These technologies rely on the quality and clarity of the image to accurately identify the text content. Therefore, documents that are too light in color may prevent the OCR algorithm from correctly distinguishing characters or words, thereby introducing data processing errors.
[0003] Most of the existing technologies for the problem of too light color of document images are to perform global manual processing on the entire image, that is, to perform gamma correction on the image by adjusting the brightness and contrast of the image. However, this global manual processing method may cause color distortion in key areas of the image (such as seals, handprints, etc.), thereby affecting the integrity and authenticity of the information; in addition, this image processing method requires manual intervention when adjusting the brightness and contrast of the image, and cannot automatically determine whether the current brightness and contrast of the image are appropriate, resulting in low processing efficiency. Summary of the invention
[0004] To this end, the present application provides a method, device and computer equipment for darkening the color of text in a document image to solve the problem that the color enhancement technology in the prior art may cause color distortion in key areas when performing global processing on the entire image.
[0005] In order to achieve the above objectives, this application provides the following technical solutions:
[0006] In a first aspect, a method for darkening the color of text in a document image comprises:
[0007] Step 1: Obtain document image data;
[0008] Step 2: Detect the seal and fingerprint areas in the document image data using a pre-trained deep learning model;
[0009] Step 3: Segment the detected seal and fingerprint areas by image segmentation technology;
[0010] Step 4: Record the original color information of the seal and fingerprint area, and protect the original color information of the seal and fingerprint area using a color protection algorithm;
[0011] Step 5: using a pre-trained machine learning model to predict adjustment parameters of contrast, brightness and gamma index of the document image data;
[0012] Step 6: adjusting the global contrast, brightness and gamma index of the document image data according to the adjustment parameters, and restoring the seal and fingerprint according to the segmented seal and fingerprint areas and the recorded original color information of the seal and fingerprint areas.
[0013] Preferably, in step 2, the training process of the deep learning model specifically includes:
[0014] Step 201: Acquire image datasets of various scenes, lighting conditions and sharpness;
[0015] Step 202: cleaning the image data set, and marking the seals and fingerprints in the image data set to obtain a marked image;
[0016] Step 203: Screening out images containing seals and fingerprints according to the annotated images, and classifying them to obtain classified images;
[0017] Step 204: further clean the classified images, adjust the size and resolution of the images, and then input them into the deep learning model for training, thereby obtaining a trained deep learning model.
[0018] Preferably, in step 202, cleaning the image data set includes removing duplicate, blurred, low-quality or damaged images, and correcting the format, resolution and encoding of the images.
[0019] Preferably, in step 204, further cleaning the classified images includes removing blurred, incomplete or severely disturbed images of stamps or fingerprints, and adjusting the size and resolution of the images.
[0020] Preferably, in step 3, the image segmentation technology adopts semantic segmentation or instance segmentation.
[0021] Preferably, in step 5, the training process of the machine learning model specifically includes:
[0022] Step 501: Acquire image datasets of various scenes, lighting conditions and sharpness;
[0023] Step 502: cleaning the image data set, and marking the contrast, brightness and gamma index of the images in the image data set to obtain a marked image;
[0024] Step 503: extract the contrast, brightness and gamma index of the image from the annotated image, and input them into the machine learning model for training, thereby obtaining a trained machine learning model.
[0025] In a second aspect, a document image text color darkening device comprises:
[0026] An image data acquisition module, used for acquiring document image data;
[0027] A seal and fingerprint detection module, used to detect seal and fingerprint areas in the document image data using a pre-trained deep learning model;
[0028] A seal and fingerprint segmentation module, used to segment the detected seal and fingerprint areas by using image segmentation technology;
[0029] A seal fingerprint color protection module, used to record the original color information of the seal and fingerprint area, and protect the original color information of the seal and fingerprint area using a color protection algorithm;
[0030] An adjustment parameter prediction module, used to predict adjustment parameters of contrast, brightness and gamma index of the document image data using a pre-trained machine learning model;
[0031] The image enhancement module is used to adjust the global contrast, brightness and gamma index of the document image data according to the adjustment parameters, and restore the seal and fingerprint according to the segmented seal and fingerprint areas and the recorded original color information of the seal and fingerprint areas.
[0032] In a third aspect, a computer device includes a memory and a processor, wherein the memory stores a computer program, and the processor implements the steps of a method for darkening the color of text in a document image when executing the computer program.
[0033] In a fourth aspect, a computer-readable storage medium stores a computer program, which, when executed by a processor, implements the steps of a method for darkening the color of text in a document image.
[0034] In a fifth aspect, a computer program product includes a computer program or instructions, which, when executed by a processor, implement the steps of a method for darkening the color of text in a document image.
[0035] Compared with the prior art, this application has at least the following beneficial effects:
[0036] The present application provides a method, device and computer equipment for deepening the color of text in a document image, the method comprising: obtaining document image data; detecting seal and fingerprint areas in the document image data using a pre-trained deep learning model; segmenting the detected seal and fingerprint areas using image segmentation technology; recording the original color information of the seal and fingerprint areas, and protecting the original color information of the seal and fingerprint areas using a color protection algorithm; predicting the contrast, brightness and gamma index adjustment parameters of the document image data using a pre-trained machine learning model; adjusting the global contrast, brightness and gamma index of the document image data according to the adjustment parameters, and restoring the seal and fingerprint according to the segmented seal and fingerprint areas and the recorded original color information of the seal and fingerprint areas. The present application realizes color protection of local key areas by detecting and segmenting key areas, avoids the color distortion problem of key areas caused by global processing, and improves the quality and accuracy of image processing. BRIEF DESCRIPTION OF THE DRAWINGS
[0037] In order to more intuitively illustrate the prior art and the present application, exemplary drawings are given below. It should be understood that the specific shapes and structures shown in the drawings should not generally be regarded as limiting conditions for implementing the present application; for example, those skilled in the art are capable of easily making conventional adjustments or further optimizations to the addition / reduction / attribution division, specific shapes, positional relationships, connection methods, dimensional ratios, etc. of certain units (components) based on the technical concepts and exemplary drawings disclosed in the present application.
[0038] Figure 1 A flow chart of a method for darkening the color of text in a document image provided in Example 1 of the present application. DETAILED DESCRIPTION
[0039] The present application is further described below in detail through specific embodiments in conjunction with the accompanying drawings.
[0040] In the description of this application: unless otherwise specified, the meaning of "plurality" is two or more. The terms "first", "second", "third", etc. in this application are intended to distinguish the objects referred to, and do not have special meanings in terms of technical connotations (for example, they should not be understood as emphasizing the importance or order, etc.). Expressions such as "including", "comprising", "having", etc. also mean "not limited to" (certain units, components, materials, steps, etc.).
[0041] The terms such as "upper", "lower", "left", "right", "middle", etc. cited in this application are usually used to indicate the general relative position relationship for the purpose of intuitive understanding by referring to the drawings, and are not absolute limitations on the position relationship in the actual product.
[0042] Embodiment 1
[0043] See also Figure 1 This embodiment provides a method for darkening the color of text in a document image, comprising:
[0044] S1: Acquire document image data;
[0045] S2: Detect seal and fingerprint regions in document image data using a pre-trained deep learning model;
[0046] In this step, the training process of the deep learning model specifically includes:
[0047] S201: Acquire image datasets of various scenes, lighting conditions and clarity;
[0048] Specifically, by acquiring image datasets of various scenes, lighting conditions, and clarity, the diversity and extensiveness of the image dataset can be ensured, thereby improving the generalization ability and prediction accuracy of the model.
[0049] S202: cleaning the image data set, and marking the seals and fingerprints in the image data set to obtain a marked image;
[0050] Specifically, this step includes removing duplicate, blurred, low-quality or damaged images, and correcting the format, resolution and encoding of the images when cleaning the image dataset.
[0051] S203: Filtering images containing seals and fingerprints according to the annotated images, and classifying them to obtain classified images;
[0052] S204: Further clean the classified images, adjust the size and resolution of the images, and then input them into the deep learning model for training, thereby obtaining a trained deep learning model.
[0053] Specifically, in this step, further cleaning of the classified images includes removing blurred, incomplete or severely disturbed images of stamps or fingerprints, and adjusting the size and resolution of the images to meet the needs of model training and optimize the detection performance of the model.
[0054] This step uses the trained deep learning model to achieve accurate detection of seal and fingerprint areas in the image, providing important support for subsequent color protection and image enhancement processing.
[0055] S3: Segment the detected seal and fingerprint areas through image segmentation technology;
[0056] Specifically, the image segmentation technology may adopt semantic segmentation or instance segmentation.
[0057] S4: recording the original color information of the seal and fingerprint area, and protecting the original color information of the seal and fingerprint area by using a color protection algorithm;
[0058] Specifically, before performing global image enhancement processing, it is necessary to record the original color information of the seal and fingerprint areas, and during the global image enhancement processing, the colors of the seal and fingerprint areas are specially protected to prevent color distortion or change, thereby improving the overall quality and accuracy of image processing.
[0059] S5: Use the pre-trained machine learning model to predict the adjustment parameters of contrast, brightness and gamma index of the document image data;
[0060] In this step, the training process of the machine learning model specifically includes:
[0061] S501: Acquire image datasets of various scenes, lighting conditions and clarity;
[0062] S502: cleaning the image data set, and annotating the contrast, brightness, and gamma index of the images in the image data set to obtain an annotated image;
[0063] Specifically, this step includes removing duplicate, blurred, low-quality or damaged images when cleaning the image dataset, and correcting the image format, resolution and encoding, thereby improving the generalization ability and prediction accuracy of the model.
[0064] S503: Extracting the contrast, brightness and gamma index of the image from the annotated image, and inputting them into the machine learning model for training, thereby obtaining a trained machine learning model.
[0065] This step extracts features related to contrast, brightness, and gamma index in the image and uses a machine learning algorithm to train a model to predict appropriate contrast, brightness, and gamma index adjustment parameters.
[0066] S6: adjusting the global contrast, brightness and gamma index of the document image data according to the adjustment parameters, and restoring the seal and fingerprint according to the segmented seal and fingerprint areas and the original color information of the recorded seal and fingerprint areas.
[0067] During the adjustment process in this step, it is necessary to ensure that the colors of the seal and fingerprint areas are restored and protected, and to ensure that the final processed image contains both the global image enhancement effect and the original color information of the seal and fingerprint areas is retained.
[0068] The method for darkening the text color of a document image provided by this embodiment has the following advantages:
[0069] 1. Global issues of color enhancement: Traditional color enhancement techniques often perform global processing on the entire image, which may cause color distortion in key areas (such as seals, handprints, etc.). This embodiment can accurately detect these key areas through a deep learning model and perform segmentation, thereby achieving local color protection and avoiding the problems caused by global processing.
[0070] 2. Key information color loss: In document image processing, the color information of key areas such as seals and handprints is crucial. The existing technology may change the color of these key areas when performing color enhancement, thereby affecting the integrity and authenticity of the information. This embodiment detects and locates the specific image color to be protected based on the deep learning method, and ensures that the color of these key areas is protected during the enhancement process through a specific color protection algorithm.
[0071] 3. Processing accuracy: Traditional image processing methods may not be able to accurately identify and segment complex areas such as seals and handprints, resulting in poor processing results. This embodiment uses the powerful learning and segmentation capabilities of the deep learning model to improve the processing accuracy.
[0072] 4. Processing efficiency: Traditional image processing methods require manual intervention when adjusting the brightness and contrast of an image, and cannot automatically determine whether the current brightness and contrast of the image are appropriate, resulting in low efficiency. This embodiment uses a machine learning model to automatically identify the contrast and brightness of the current image, and can calculate the appropriate brightness, contrast and gamma index, thereby improving processing efficiency.
[0073] In summary, the method for darkening the color of text in document images provided in this embodiment achieves the goal of combining global image enhancement processing with color protection of specific areas (seals, fingerprints) through the use of deep learning algorithms and machine learning algorithms, thereby improving the quality and accuracy of image processing and solving the problems of color distortion in key areas, information loss, and insufficient processing accuracy and efficiency that may be caused by traditional color enhancement technology when processing document images.
[0074] Embodiment 2
[0075] This embodiment provides a document image text color darkening device, comprising:
[0076] An image data acquisition module, used for acquiring document image data;
[0077] A seal and fingerprint detection module, used to detect seal and fingerprint areas in the document image data using a pre-trained deep learning model;
[0078] A seal and fingerprint segmentation module, used to segment the detected seal and fingerprint areas by using image segmentation technology;
[0079] A seal fingerprint color protection module, used to record the original color information of the seal and fingerprint area, and protect the original color information of the seal and fingerprint area using a color protection algorithm;
[0080] An adjustment parameter prediction module, used to predict adjustment parameters of contrast, brightness and gamma index of the document image data using a pre-trained machine learning model;
[0081] The image enhancement module is used to adjust the global contrast, brightness and gamma index of the document image data according to the adjustment parameters, and restore the seal and fingerprint according to the segmented seal and fingerprint areas and the recorded original color information of the seal and fingerprint areas.
[0082] The specific implementation contents of each module in a device for darkening the color of text in a document image can be found in the above definition of a method for darkening the color of text in a document image, and will not be repeated here.
[0083] Embodiment 3
[0084] This embodiment provides a computer device, including a memory and a processor, wherein the memory stores a computer program, and the processor implements the steps of a method for darkening the color of text in a document image when executing the computer program.
[0085] Embodiment 4
[0086] This embodiment provides a computer-readable storage medium on which a computer program is stored. When the computer program is executed by a processor, the steps of a method for darkening the color of text in a document image are implemented.
[0087] Embodiment 5
[0088] This embodiment provides a computer program product, including a computer program or instructions, which, when executed by a processor, implements the steps of a method for darkening the color of text in a document image.
[0089] The technical features of the above embodiments may be arbitrarily combined (as long as there is no contradiction in the combination of these technical features). To make the description concise, not all possible combinations of the technical features in the above embodiments are described; these embodiments that are not explicitly written should also be considered to be within the scope of this specification.
Claims
1. A method for deepening the color of text in a document image, characterized in that: include: Step 1: Obtain document image data; Step 2: Detect the seal and fingerprint areas in the document image data using a pre-trained deep learning model; Step 3: Segment the detected seal and fingerprint areas by image segmentation technology; Step 4: Record the original color information of the seal and fingerprint area, and protect the original color information of the seal and fingerprint area using a color protection algorithm; Step 5: using a pre-trained machine learning model to predict adjustment parameters of contrast, brightness and gamma index of the document image data; Step 6: adjusting the global contrast, brightness and gamma index of the document image data according to the adjustment parameters, and restoring the seal and fingerprint according to the segmented seal and fingerprint areas and the recorded original color information of the seal and fingerprint areas.
2. The method for deepening the color of text in a document image according to claim 1, characterized in that: In step 2, the training process of the deep learning model specifically includes: Step 201: Acquire image datasets of various scenes, lighting conditions and sharpness; Step 202: cleaning the image data set, and marking the seals and fingerprints in the image data set to obtain a marked image; Step 203: Screening out images containing seals and fingerprints according to the annotated images, and classifying them to obtain classified images; Step 204: further clean the classified images, adjust the size and resolution of the images, and then input them into the deep learning model for training, thereby obtaining a trained deep learning model.
3. The method for deepening the color of text in a document image according to claim 2, characterized in that: In step 202, cleaning the image data set includes removing duplicate, blurred, low-quality or damaged images, and correcting the format, resolution and encoding of the images.
4. The method for deepening the color of text in a document image according to claim 2, characterized in that: In step 204, further cleaning of the classified images includes removing blurred, incomplete or severely disturbed images of stamps or fingerprints, and adjusting the size and resolution of the images.
5. The method for deepening the color of text in a document image according to claim 1, characterized in that: In step 3, the image segmentation technology adopts semantic segmentation or instance segmentation.
6. The method for deepening the color of text in a document image according to claim 1, characterized in that: In step 5, the training process of the machine learning model specifically includes: Step 501: Acquire image datasets of various scenes, lighting conditions and sharpness; Step 502: cleaning the image data set, and marking the contrast, brightness and gamma index of the images in the image data set to obtain a marked image; Step 503: extract the contrast, brightness and gamma index of the image from the annotated image, and input them into the machine learning model for training, thereby obtaining a trained machine learning model.
7. A document image text color darkening device, characterized in that: include: An image data acquisition module, used for acquiring document image data; A seal and fingerprint detection module, used to detect seal and fingerprint areas in the document image data using a pre-trained deep learning model; A seal and fingerprint segmentation module, used to segment the detected seal and fingerprint areas by using image segmentation technology; A seal fingerprint color protection module, used to record the original color information of the seal and fingerprint area, and protect the original color information of the seal and fingerprint area using a color protection algorithm; An adjustment parameter prediction module, used to predict adjustment parameters of contrast, brightness and gamma index of the document image data using a pre-trained machine learning model; The image enhancement module is used to adjust the global contrast, brightness and gamma index of the document image data according to the adjustment parameters, and restore the seal and fingerprint according to the segmented seal and fingerprint areas and the recorded original color information of the seal and fingerprint areas.
8. A computer device comprising a memory and a processor, wherein the memory stores a computer program, wherein: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 6 are implemented.
9. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 6 are implemented.
10. A computer program product comprising a computer program or instructions, characterized in that When the computer program or instruction is executed by a processor, the steps of the method according to any one of claims 1 to 6 are implemented.
Citation Information
Patent Citations
Deep-reinforcement-learning-based scene text detection method and system
CN108090443A
Authentication method and apparatus based on seal and signature, and computer device
WO2021027336A1