A document image illumination processing method, device and computer readable storage medium

By acquiring the binary image and local background color image of the document image, and calculating the shadow image and global background color, the problem of uneven illumination when mobile devices capture documents is solved, thus improving the document capture quality and user experience.

CN114066879BActive Publication Date: 2026-03-03NUBIA TECHNOLOGY CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202111443413.3
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-11-30
Publication Date
2026-03-03
Estimated Expiration
2041-11-30

AI Technical Summary

Technical Problem

When users take photos of documents using mobile devices, uneven image illumination often occurs due to reflections on the document page, complex ambient light sources, and shooting angles, affecting text clarity and reducing the usability and experience of document photography.

Method used

By acquiring the binary image and local background color image of the document image, calculating the shadow image and global background color, and combining the copied image to calculate the illumination enhancement value, efficient and accurate illumination enhancement of the document image is achieved.

Benefits of technology

It improves the quality of document photography, enhances the user's document photography experience, and realizes a user-friendly document image photography solution.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114066879B_ABST
    Figure CN114066879B_ABST
Patent Text Reader

Abstract

The application discloses a document image illumination processing method and device and a computer readable storage medium, wherein the method comprises the following steps: when it is detected that a photographed image is a document image, a binary image of the document image and a local background color image of the document image are acquired; a shadow image of the document image is calculated according to the binary image and the local background color image; a global background color of the document image is calculated according to the binary image, the local background color image and the shadow image; and an illumination enhancement value of the document image is calculated according to a copy image of the document image, the local background color image and the global background color. A humanized document image shooting scheme is realized, the illumination of the document is efficiently and accurately enhanced, the quality of document shooting is greatly improved, and the document shooting experience of a user is enhanced.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of mobile communications, and more particularly to a document image illumination processing method, device, and computer-readable storage medium. Background Technology

[0002] In the existing technology, with the continuous development of smart terminal devices, users using mobile terminals and other devices to photograph documents has become one of the more common usage scenarios.

[0003] Unlike other scenarios, document photography often places stricter demands on image quality, such as requiring higher resolution. However, when users take photos with mobile devices, issues such as document page reflections, complex ambient lighting, and the user's shooting angle often result in uneven illumination in the captured document image, leading to unclear text and significantly reducing the usability and user experience of document photography using mobile devices. Summary of the Invention

[0004] To address the aforementioned technical deficiencies in the prior art, this invention proposes a document image illumination processing method, which includes:

[0005] When the captured image is detected to be a document image, a binary image of the document image and a local background color image of the document image are obtained.

[0006] The shadow image of the document image is calculated based on the binary image and the local background color image.

[0007] The global background color of the document image is calculated based on the binary image, the local background color image, and the shadow image.

[0008] The illuminance enhancement value of the document image is calculated based on the copy image of the document image, the local background color image, and the global background color.

[0009] Optionally, when the captured image is detected to be a document image, obtaining a binary image of the document image and a local background color image of the document image includes:

[0010] Obtain the grayscale image of the document image.

[0011] The binary image corresponding to the document image is calculated based on the grayscale image.

[0012] Optionally, when the captured image is detected to be a document image, obtaining a binary image of the document image and a local background color image of the document image further includes:

[0013] The neighborhood range of each pixel in the document image is calculated based on a preset first threshold parameter.

[0014] The corresponding fusion factor and reflection factor are determined based on the neighborhood range, and the reflection factor of each pixel is assigned to the pixel.

[0015] Optionally, when the captured image is detected to be a document image, obtaining a binary image of the document image and a local background color image of the document image further includes:

[0016] Determine the preset second threshold parameter.

[0017] The assignment operation for each pixel is repeated according to the second threshold parameter to obtain a local background color image with the document image as the original image.

[0018] Optionally, calculating the shadow image of the document image based on the binary image and the local background color image includes:

[0019] Obtain the local background grayscale image of the local background color image.

[0020] The shadow image is obtained by binarizing the local background grayscale image using the Otsu's method.

[0021] Optionally, calculating the global background color of the document image based on the binary image, the local background color image, and the shadow image includes:

[0022] Identify the region where each pixel is located in the local background color image.

[0023] Determine the region where each pixel is located, and determine whether each pixel belongs to the shaded area or the unshaded area.

[0024] Optionally, calculating the global background color of the document image based on the binary image, the local background color image, and the shadow image further includes:

[0025] Calculate the mean value of each channel in the non-shaded area of ​​the background region in the local background color image.

[0026] The average value of each channel is used as the global background color.

[0027] Optionally, calculating the illumination enhancement value of the document image based on the copy image of the document image, the local background color image, and the global background color includes:

[0028] Calculate the background color transformation parameters for each pixel in the copied image.

[0029] The illuminance enhancement value is calculated using the background color transformation parameters.

[0030] The present invention also proposes a document image illumination processing device, the device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the computer program, when executed by the processor, implements the steps of the document image illumination processing method as described in any of the preceding claims.

[0031] The present invention also proposes a computer-readable storage medium storing a document image illumination processing program, which, when executed by a processor, implements the steps of the document image illumination processing method as described in any of the preceding claims.

[0032] The document image illumination processing method, device, and computer-readable storage medium of the present invention, when detecting that the captured image is a document image, acquires a binary image of the document image and a local background color image of the document image; calculates a shadow image of the document image based on the binary image and the local background color image; calculates a global background color of the document image based on the binary image, the local background color image, and the shadow image; and calculates an illumination enhancement value of the document image based on a copy image of the document image, the local background color image, and the global background color. This achieves a user-friendly document image capture solution, greatly improving the quality of document capture and enhancing the user's document capture experience by efficiently and accurately enhancing the illumination of the document. Attached Figure Description

[0033] The present invention will be further described below with reference to the accompanying drawings and embodiments. In the accompanying drawings:

[0034] Figure 1 This is a schematic diagram of the hardware structure of a mobile terminal according to the present invention;

[0035] Figure 2 This is a communication network system architecture diagram provided in an embodiment of the present invention;

[0036] Figure 3 This is a flowchart of the first embodiment of the document image illumination processing method of the present invention;

[0037] Figure 4 This is a flowchart of the second embodiment of the document image illumination processing method of the present invention;

[0038] Figure 5 This is a flowchart of the third embodiment of the document image illumination processing method of the present invention;

[0039] Figure 6This is a flowchart of the fourth embodiment of the document image illumination processing method of the present invention;

[0040] Figure 7 This is a flowchart of the fifth embodiment of the document image illumination processing method of the present invention;

[0041] Figure 8 This is a flowchart of the sixth embodiment of the document image illumination processing method of the present invention;

[0042] Figure 9 This is a flowchart of the seventh embodiment of the document image illumination processing method of the present invention;

[0043] Figure 10 This is a flowchart of the eighth embodiment of the document image illumination processing method of the present invention. Detailed Implementation

[0044] It should be understood that the specific embodiments described herein are for illustrative purposes only and are not intended to limit the scope of the invention.

[0045] In the following description, the use of suffixes such as "module," "part," or "unit" to denote elements is solely for the purpose of illustrative purposes and has no specific meaning in itself. Therefore, "module," "part," or "unit" may be used interchangeably.

[0046] Terminals can be implemented in various forms. For example, the terminals described in this invention may include mobile terminals such as mobile phones, tablets, laptops, handheld computers, personal digital assistants (PDAs), portable media players (PMPs), navigation devices, wearable devices, smart bracelets, pedometers, etc., as well as fixed terminals such as digital TVs and desktop computers.

[0047] The following description will use a mobile terminal as an example. Those skilled in the art will understand that, apart from elements specifically designed for mobile purposes, the construction according to embodiments of the present invention can also be applied to fixed-type terminals.

[0048] Please see Figure 1 This is a schematic diagram of the hardware structure of a mobile terminal implementing various embodiments of the present invention. The mobile terminal 100 may include: an RF (Radio Frequency) unit 101, a WiFi module 102, an audio output unit 103, an A / V (Audio / Video) input unit 104, a sensor 105, a display unit 106, a user input unit 107, an interface unit 108, a memory 109, a processor 110, and a power supply 111, etc. Those skilled in the art will understand that... Figure 1The mobile terminal structure shown does not constitute a limitation on the mobile terminal. The mobile terminal may include more or fewer components than shown, or combine certain components, or have different component arrangements.

[0049] The following is combined Figure 1 A detailed introduction to each component of the mobile terminal:

[0050] The radio frequency unit 101 can be used for receiving and transmitting signals during information transmission or calls. Specifically, it receives downlink information from the base station and processes it with the processor 110; additionally, it transmits uplink data to the base station. Typically, the radio frequency unit 101 includes, but is not limited to, an antenna, at least one amplifier, a transceiver, a coupler, a low-noise amplifier, and a duplexer. Furthermore, the radio frequency unit 101 can also communicate wirelessly with networks and other devices. The aforementioned wireless communications may use any communication standard or protocol, including but not limited to GSM (Global System of Mobile communication), GPRS (General Packet Radio Service), CDMA2000 (Code Division Multiple Access 2000), WCDMA (Wideband Code Division Multiple Access), TD-SCDMA (Time Division-Synchronous Code Division Multiple Access), FDD-LTE (Frequency Division Duplexing-Long Term Evolution), and TDD-LTE (Time Division Duplexing-Long Term Evolution).

[0051] WiFi is a short-range wireless transmission technology. Mobile terminals, through the WiFi module 102, can help users send and receive emails, browse web pages, and access streaming media, providing users with wireless broadband internet access. Although Figure 1 WiFi module 102 is shown, but it is understood that it is not a necessary component of a mobile terminal and can be omitted as needed without changing the nature of the invention.

[0052] The audio output unit 103 can convert audio data received by the radio frequency unit 101 or the WiFi module 102 or stored in the memory 109 into audio signals and output them as sound when the mobile terminal 100 is in call signal receiving mode, call mode, recording mode, voice recognition mode, broadcast receiving mode, etc. Furthermore, the audio output unit 103 can also provide audio output related to specific functions performed by the mobile terminal 100 (e.g., call signal receiving sound, message receiving sound, etc.). The audio output unit 103 may include a speaker, a buzzer, etc.

[0053] The A / V input unit 104 is used to receive audio or video signals. The A / V input unit 104 may include a graphics processing unit (GPU) 1041 and a microphone 1042. The GPU 1041 processes image data of still images or videos acquired by an image capture device (such as a camera) in video capture mode or image capture mode. The processed image frames can be displayed on the display unit 106. The image frames processed by the GPU 1041 can be stored in the memory 109 (or other storage medium) or transmitted via the radio frequency unit 101 or the WiFi module 102. The microphone 1042 can receive sound (audio data) in operating modes such as telephone call mode, recording mode, and voice recognition mode, and can process such sound into audio data. The processed audio (voice) data can be converted into a format that can be transmitted to a mobile communication base station via the radio frequency unit 101 in telephone call mode. The microphone 1042 can implement various types of noise cancellation (or suppression) algorithms to eliminate (or suppress) noise or interference generated during the reception and transmission of audio signals.

[0054] The mobile terminal 100 also includes at least one sensor 105, such as a light sensor, a motion sensor, and other sensors. Specifically, the light sensor includes an ambient light sensor and a proximity sensor. The ambient light sensor can adjust the brightness of the display panel 1061 according to the ambient light level, and the proximity sensor can turn off the display panel 1061 and / or backlight when the mobile terminal 100 is moved to the ear. As a type of motion sensor, the accelerometer sensor can detect the magnitude of acceleration in various directions (generally three axes). When stationary, it can detect the magnitude and direction of gravity and can be used for applications that recognize the phone's posture (such as landscape / portrait switching, related games, magnetometer posture calibration), vibration recognition-related functions (such as pedometer, tapping), etc. Other sensors that may be configured in the phone, such as fingerprint sensors, pressure sensors, iris sensors, molecular sensors, gyroscopes, barometers, hygrometers, thermometers, and infrared sensors, will not be described in detail here.

[0055] The display unit 106 is used to display information input by the user or information provided to the user. The display unit 106 may include a display panel 1061, which may be configured in the form of a liquid crystal display (LCD), an organic light-emitting diode (OLED), or the like.

[0056] User input unit 107 can be used to receive input numerical or character information, and generate key signal inputs related to user settings and function control of the mobile terminal. Specifically, user input unit 107 may include touch panel 1071 and other input devices 1072. Touch panel 1071, also known as touch screen, can collect touch operations on or near the user (such as operations performed by the user using a finger, stylus, or any suitable object or accessory on or near touch panel 1071), and drive corresponding connection devices according to a pre-set program. Touch panel 1071 may include two parts: a touch detection device and a touch controller. The touch detection device detects the user's touch position and the signal generated by the touch operation, and transmits the signal to the touch controller; the touch controller receives touch information from the touch detection device, converts it into touch point coordinates, sends it to processor 110, and can receive and execute commands from processor 110. In addition, touch panel 1071 can be implemented using various types such as resistive, capacitive, infrared, and surface acoustic wave. In addition to the touch panel 1071, the user input unit 107 may also include other input devices 1072. Specifically, other input devices 1072 may include, but are not limited to, one or more of the following: physical keyboard, function keys (such as volume control buttons, power buttons, etc.), trackball, mouse, joystick, etc., without being limited here.

[0057] Furthermore, the touch panel 1071 may cover the display panel 1061. When the touch panel 1071 detects a touch operation on or near it, it transmits the information to the processor 110 to determine the type of touch event. Subsequently, the processor 110 provides corresponding visual output on the display panel 1061 based on the type of touch event. Although in Figure 1 In this embodiment, the touch panel 1071 and the display panel 1061 are two independent components to realize the input and output functions of the mobile terminal. However, in some embodiments, the touch panel 1071 and the display panel 1061 can be integrated to realize the input and output functions of the mobile terminal. The specific implementation is not limited here.

[0058] Interface unit 108 serves as an interface through which at least one external device can connect to mobile terminal 100. For example, the external device may include a wired or wireless headset port, an external power supply (or battery charger) port, a wired or wireless data port, a memory card port, a port for connecting a device with an identification module, an audio input / output (I / O) port, a video I / O port, a headphone port, and so on. Interface unit 108 may be used to receive input (e.g., data, power, etc.) from the external device and transmit the received input to one or more elements within mobile terminal 100, or it may be used to transmit data between mobile terminal 100 and the external device.

[0059] The memory 109 can be used to store software programs and various data. The memory 109 may primarily include a program storage area and a data storage area. The program storage area may store the operating system, applications required for at least one function (such as sound playback, image playback, etc.), etc.; the data storage area may store data created based on the use of the mobile phone (such as audio data, phonebook, etc.). Furthermore, the memory 109 may include high-speed random access memory, and may also include non-volatile memory, such as at least one disk storage device, flash memory device, or other volatile solid-state storage device.

[0060] The processor 110 is the control center of the mobile terminal. It connects various parts of the mobile terminal via various interfaces and lines. By running or executing software programs and / or modules stored in the memory 109, and by calling data stored in the memory 109, it performs various functions and processes data of the mobile terminal, thereby providing overall monitoring of the mobile terminal. The processor 110 may include one or more processing units; preferably, the processor 110 may integrate an application processor and a modem processor. The application processor mainly handles the operating system, user interface, and applications, while the modem processor mainly handles wireless communication. It is understood that the modem processor may not be integrated into the processor 110.

[0061] The mobile terminal 100 may also include a power supply 111 (such as a battery) that supplies power to various components. Preferably, the power supply 111 can be logically connected to the processor 110 through a power management system, thereby enabling functions such as charging, discharging, and power consumption management through the power management system.

[0062] although Figure 1 As not shown, the mobile terminal 100 may also include a Bluetooth module, etc., which will not be described in detail here.

[0063] To facilitate understanding of the embodiments of the present invention, the communication network system on which the mobile terminal of the present invention is based is described below.

[0064] Please see Figure 2 , Figure 2 This invention provides a communication network system architecture diagram. The communication network system is an LTE system based on the universal mobile communication technology. The LTE system includes a UE (User Equipment) 201, an E-UTRAN (Evolved UMTS Terrestrial Radio Access Network) 202, an EPC (Evolved Packet Core) 203, and the operator's IP services 204, which are connected in sequence.

[0065] Specifically, UE201 can be the aforementioned terminal 100, which will not be elaborated here.

[0066] E-UTRAN202 includes eNodeB2021 and other eNodeB2022s. Among them, eNodeB2021 can connect to other eNodeB2022s via backhaul (e.g., X2 interface), and eNodeB2021 connects to EPC203. eNodeB2021 can provide UE201 with access to EPC203.

[0067] EPC203 may include MME (Mobility Management Entity) 2031, HSS (Home Subscriber Server) 2032, other MMEs 2033, SGW (Serving Gateway) 2034, PGW (Packet Data Network Gateway) 2035, and PCRF (Policy and Charging Rules Function) 2036, etc. Among them, MME2031 is the control node that handles signaling between UE201 and EPC203, providing bearer and connection management. HSS2032 provides registers to manage functions such as the Home Location Register (not shown in the diagram) and stores user-specific information such as service characteristics and data rates. All user data can be sent through SGW2034. PGW2035 can provide UE 201 IP address allocation and other functions. PCRF2036 is the policy and charging control decision point for service data flow and IP bearer resources. It selects and provides available policy and charging control decisions for the policy and charging enforcement function unit (not shown in the figure).

[0068] IP services 204 may include the Internet, intranet, IMS (IP Multimedia Subsystem), or other IP services.

[0069] Although the above description uses the LTE system as an example, those skilled in the art should understand that the present invention is not only applicable to the LTE system, but also to other wireless communication systems, such as GSM, CDMA2000, WCDMA, TD-SCDMA, and future new network systems, etc., which are not limited here.

[0070] Based on the aforementioned mobile terminal hardware structure and communication network system, various embodiments of the method of the present invention are proposed.

[0071] Example 1

[0072] Figure 3 This is a flowchart of the first embodiment of the document image illumination processing method of the present invention. A document image illumination processing method, the method comprising:

[0073] S1. When it is detected that the captured image is a document image, obtain the binary image of the document image and the local background color image of the document image.

[0074] S2. Calculate the shadow image of the document image based on the binary image and the local background color image.

[0075] S3. Calculate the global background color of the document image based on the binary image, the local background color image, and the shadow image.

[0076] S4. Calculate the illumination enhancement value of the document image based on the copy image of the document image, the local background color image, and the global background color.

[0077] In this embodiment, the captured image is detected, and if the main body of the image is text content, the captured image is determined to be a document image.

[0078] Optionally, in this embodiment, the captured image is detected in the text recognition software or text scanning software. When text content is present in the image, the captured image is determined to be a document image.

[0079] Optionally, in this embodiment, if the main body of the preview image is detected to be text content during the preview process, the preview image is determined to be a document image.

[0080] The beneficial effect of this embodiment is that, when the captured image is detected to be a document image, it acquires a binary image of the document image and a local background color image of the document image; calculates a shadow image of the document image based on the binary image and the local background color image; calculates a global background color of the document image based on the binary image, the local background color image, and the shadow image; and calculates an illumination enhancement value of the document image based on a copy image of the document image, the local background color image, and the global background color. This achieves a user-friendly document image capture solution, greatly improving the quality of document capture and enhancing the user's document capture experience by efficiently and accurately enhancing the illumination of the document.

[0081] Example 2

[0082] Figure 4 This is a flowchart of a second embodiment of the document image illumination processing method of the present invention. Based on the above embodiment, when the captured image is detected to be a document image, acquiring a binary image of the document image and a local background color image of the document image includes:

[0083] S11. Obtain the grayscale image of the document image.

[0084] S12. Calculate the binary image corresponding to the document image based on the grayscale image.

[0085] Optionally, in this embodiment, the input document image (image), its width, height, and its copy image (image_copy) are obtained.

[0086] Optionally, in this embodiment, the grayscale image of the document image is calculated.

[0087] Optionally, in this embodiment, the binary image of the document image is calculated based on the grayscale image (gray).

[0088] Optionally, in this embodiment, the integral image of the grayscale image image_doc_gray is calculated.

[0089] in,

[0090] Optionally, in this embodiment, the beneficial effect is that by acquiring the grayscale image of the document image and calculating the corresponding binary image based on the grayscale image, a user-friendly document image shooting solution is achieved. This significantly improves the quality of document shooting and enhances the user's document shooting experience by efficiently and accurately enhancing the illumination of the document.

[0091] Example 3

[0092] Figure 5 This is a flowchart of the third embodiment of the document image illumination processing method of the present invention. Based on the above embodiment, when the captured image is detected to be a document image, acquiring the binary image of the document image and the local background color image of the document image further includes:

[0093] S13. Calculate the neighborhood range of each pixel in the document image according to the preset first threshold parameter.

[0094] S14. Determine the corresponding fusion factor and reflection factor according to the neighborhood range, and assign the reflection factor of each pixel to the pixel.

[0095] Optionally, in this embodiment, a predetermined threshold parameter NB_TH1 is obtained for each pixel in the grayscale image gray. i,j The neighborhood range nb_domain is calculated based on the predetermined threshold parameter NB_TH1. i,j :

[0096] nb_domain i,j ={PStart i,j ,PEdn i,j}

[0097] PStart i,j ={x,y}.

[0098] PEdn i,j ={x,y}.

[0099] PStart i,j x = MAX(i - NB_TH1 * width, 0).

[0100] PStart i,j .y=MAX(j-NB_TH1*height,0).

[0101] PEnd i,j .x=MIN(i+NB_TH1*width,width).

[0102] PEnd i,j .y=MIN(j+NB_TH1*height,height).

[0103] Optionally, in this embodiment, the neighborhood nb_domain is calculated based on the integral image. i,j Illuminance intensity: domain_LI i,j .

[0104]

[0105] Optionally, in this embodiment, a predetermined threshold parameter LI_TH is obtained;

[0106] Optionally, in this embodiment, the current pixel is binarized based on a predetermined threshold parameter LI_TH, the grayscale intensity of the previous pixel, and the illumination intensity of the neighboring pixels.

[0107]

[0108] Among them, binary i,j =0 indicates that the pixel is a text area; binary i,j =1 indicates that the pixel is a background area.

[0109] In this embodiment, the local background color image local_bg of the document image is calculated based on the document color image image.

[0110] Optionally, in this embodiment, a predetermined threshold parameter NB_TH2 is obtained.

[0111] Optionally, in this embodiment, for each pixel in the color image, i,j The neighborhood range nb_domain is calculated based on the predetermined threshold parameter NB_TH2. i,j The calculation method is the same as above.

[0112] Optionally, in this embodiment, the image of the pixel is statistically analyzed. i,j within the neighborhood of nb_domain i,j The maximum value (maxvalueRGB) and minimum value (minvalueRGB) of each of the R, G, and B channels:

[0113] maxvalueRGB={maxR, maxG, maxB}.

[0114] minvalueRGB={minR, minG, minB}.

[0115] Optionally, in this embodiment, the fusion factor is calculated for each RGB channel:

[0116] fusionFactor={ffR,ffG,ffB}.

[0117] For example, taking the R channel:

[0118]

[0119] Optionally, in this embodiment, the reflection factor (reflectFactor) is calculated for each RGB channel:

[0120] reflectFactor={rfR, rfG, rfB}.

[0121] For example, taking the R channel:

[0122] rfR=maxR*ffR+minR*(1-ffR).

[0123] Optionally, in this embodiment, the pixel image i,j The reflectance factor is assigned to the pixel image. i,j :

[0124] image i,j ={rfR,rfG,rfB}.

[0125] The beneficial effect of this embodiment is that it calculates the neighborhood range of each pixel in the document image using a preset first threshold parameter; determines the corresponding fusion factor and reflectance factor based on the neighborhood range; and assigns the reflectance factor of each pixel to the pixel. This achieves a user-friendly document image capture solution, greatly improving the quality of document capture and enhancing the user's document capture experience by efficiently and accurately enhancing the illumination of the document.

[0126] Example 4

[0127] Figure 6 This is a flowchart of the fourth embodiment of the document image illumination processing method of the present invention. Based on the above embodiment, when the captured image is detected to be a document image, acquiring the binary image of the document image and the local background color image of the document image further includes:

[0128] S15. Determine the preset second threshold parameter.

[0129] S16. Repeat the assignment operation of each pixel according to the second threshold parameter to obtain a local background color image with the document image as the original image.

[0130] Optionally, in this embodiment, a predetermined threshold parameter RP_NUM is obtained; the above steps are repeated a predetermined threshold parameter RP_NUM times; and the color image obtained at this time is used as the local background color image local_bg of the original image.

[0131] The beneficial effect of this embodiment is that by determining a preset second threshold parameter and repeatedly performing the assignment operation on each pixel according to the second threshold parameter, a local background color image with the document image as the original image is obtained. This achieves a user-friendly document image shooting solution, greatly improving the quality of document shooting and enhancing the user's document shooting experience by efficiently and accurately enhancing the illumination of the document.

[0132] Example 5

[0133] Figure 7 This is a flowchart of the fifth embodiment of the document image illumination processing method of the present invention. Based on the above embodiment, the step of calculating the shadow image of the document image according to the binary image and the local background color image includes:

[0134] S21. Obtain the local background grayscale image of the local background color image.

[0135] S22. The local background grayscale image is binarized using the Otsu's method to obtain the shadow image.

[0136] Optionally, in this embodiment, the shadow image (shadowMap) of the document image is obtained.

[0137] Optionally, in this embodiment, a grayscale image of the local background color image local_bg, local_bg_gray, is obtained.

[0138] Optionally, in this embodiment, the grayscale image local_bg_gray is binarized using the maximum inter-class variance method to obtain the shadow image shadowMap.

[0139] For each pixel in the shadowMap, the shadowMap i,j When shadowMap i,j When = 0, it indicates that the point is in the shadow area. i,j When the value is 1, it means that the point is not in the shaded area.

[0140] The beneficial effect of this embodiment is that by acquiring the local background grayscale image of the local background color image, and performing binarization processing on the local background grayscale image using the Otsu's method, the shadow image is obtained. This achieves a user-friendly document image capture solution, greatly improving the quality of document capture and enhancing the user's document capture experience through efficient and accurate illumination enhancement.

[0141] Example 6

[0142] Figure 8This is a flowchart of the sixth embodiment of the document image illumination processing method of the present invention. Based on the above embodiment, the step of calculating the global background color of the document image according to the binary image, the local background color image, and the shadow image includes:

[0143] S31. Identify the region where each pixel in the local background color image is located.

[0144] S32. Determine the region where each pixel is located, and determine whether each pixel belongs to the shaded region or the unshaded region.

[0145] Optionally, in this embodiment, the global background color global_bg of the non-shadow area is calculated using the local background color image local_bg, the binary image binary, and the shadow image shadowMap:

[0146] global_bg_c = {R, G, B}.

[0147] Optionally, in this embodiment, for each pixel in the local background color image local_bg, local_bg i,j Determine its location:

[0148] When the binary corresponding to this pixel i,j When the value is 1, it indicates that the point is a background area.

[0149] When shadowMap i,j When the value is 0, it indicates that the point is a shaded area; otherwise, it is an unshaded area.

[0150] The beneficial effect of this embodiment is that by identifying the region where each pixel is located in the local background color image, determining the region where each pixel is located, and determining whether each pixel belongs to a shadow area or a non-shadow area, a user-friendly document image shooting solution is achieved. By efficiently and accurately enhancing the illumination of the document, the quality of document shooting is greatly improved, enhancing the user's document shooting experience.

[0151] Example 7

[0152] Figure 9 This is a flowchart of the seventh embodiment of the document image illumination processing method of the present invention. Based on the above embodiment, the step of calculating the global background color of the document image according to the binary image, the local background color image, and the shadow image further includes:

[0153] S33. Calculate the mean value of each channel in the non-shaded area of ​​the background region in the local background color image.

[0154] S34. Use the average value of each channel as the global background color.

[0155] Optionally, in this embodiment, the background (binary) in the local background color image local_bg is statistically analyzed. i,j =1) and not a shadow (shadowMap) i,j The average value of each channel in the region where 1) is equal to the global background color is global_bg_c.

[0156] The beneficial effect of this embodiment is that by calculating the average value of each channel in the non-shaded area of ​​the background region in the local background color image, and using the average value of each channel as the global background color, a user-friendly document image shooting solution is achieved. By efficiently and accurately enhancing the illumination of the document, the quality of document shooting is greatly improved, enhancing the user's document shooting experience.

[0157] Example 8

[0158] Figure 10 This is a flowchart of the eighth embodiment of the document image illumination processing method of the present invention. Based on the above embodiment, the step of calculating the illumination enhancement value of the document image according to the copy image of the document image, the local background color image, and the global background color includes:

[0159] S41. Calculate the background color transformation parameters for each pixel in the copied image.

[0160] S42. The illuminance enhancement value is calculated using the background color transformation parameters.

[0161] Optionally, in this embodiment, the document image is enhanced with a copy of the original document image (image_copy), a local background color image (local_bg), and a global background color (global_bg_c).

[0162] Optionally, in this embodiment, for each pixel in the image_copy, image_copy i,j Calculate the background color transformation parameter TransformRatio i,j :

[0163]

[0164] Optionally, in this embodiment, the document image is enhanced with illumination:

[0165] image_copy i,j =image_copy i,j / TransformRatio i,j .

[0166] Optionally, in this embodiment, the output is an image_copy of the document with enhanced illumination.

[0167] The beneficial effect of this embodiment is that it calculates the background color transformation parameter of each pixel in the copied image, and then calculates the illumination enhancement value using the background color transformation parameter. This achieves a user-friendly document image capture solution, greatly improving the quality of document capture and enhancing the user's document capture experience by efficiently and accurately enhancing the illumination of the document.

[0168] Example 9

[0169] Based on the above embodiments, the present invention also proposes a document image illumination processing device, which includes a memory, a processor, and a computer program stored in the memory and executable on the processor. When the computer program is executed by the processor, it implements the steps of the document image illumination processing method as described in any of the above embodiments.

[0170] It should be noted that the above-described device embodiments and method embodiments belong to the same concept. The specific implementation process can be found in the method embodiments, and the technical features in the method embodiments are also applicable to the device embodiments, which will not be repeated here.

[0171] Example 10

[0172] Based on the above embodiments, the present invention also proposes a computer-readable storage medium storing a document image illumination processing program, which, when executed by a processor, implements the steps of the document image illumination processing method as described in any of the above claims.

[0173] It should be noted that the above-described medium embodiments and method embodiments belong to the same concept. The specific implementation process can be found in the method embodiments, and the technical features in the method embodiments are also applicable to the medium embodiments, which will not be repeated here.

[0174] It should be noted that, in this document, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Unless otherwise specified, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes that element.

[0175] The sequence numbers of the above embodiments of the present invention are for descriptive purposes only and do not represent the superiority or inferiority of the embodiments.

[0176] Through the above description of the embodiments, those skilled in the art can clearly understand that the methods of the above embodiments can be implemented by means of software plus necessary general-purpose hardware platforms. Of course, they can also be implemented by hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk), and includes several instructions to cause a terminal (which may be a mobile phone, computer, server, air conditioner, or network device, etc.) to execute the methods described in the various embodiments of the present invention.

[0177] The embodiments of the present invention have been described above with reference to the accompanying drawings. However, the present invention is not limited to the specific embodiments described above. The specific embodiments described above are merely illustrative and not restrictive. Those skilled in the art can make many other forms under the guidance of the present invention without departing from the spirit and scope of the claims. All of these forms are within the protection scope of the present invention.

Claims

1. A document image illumination processing method characterized by comprising: The method comprises: when detecting that the photographed image is a document image, acquiring a binary image of the document image and a local background color image of the document image; calculating a shadow image of the document image according to the binary image and the local background color image; calculating a global background color of the document image according to the binary image, the local background color image and the shadow image; calculating an illumination enhancement value of the document image according to a copy image of the document image, the local background color image and the global background color; the step of acquiring the binary image of the document image and the local background color image of the document image when detecting that the photographed image is a document image comprises: acquiring a gray-scale image of the document image; calculating the binary image corresponding to the document image according to the gray-scale image; calculating a neighborhood range of each pixel point in the document image according to a preset first threshold parameter; determining a corresponding fusion factor and a reflection factor according to the neighborhood range, and assigning the reflection factor of each pixel point to the pixel point; determining a preset second threshold parameter; repeating the assignment operation of each pixel point according to the second threshold parameter to obtain a local background color image taking the document image as an original image; the step of calculating the shadow image of the document image according to the binary image and the local background color image comprises: acquiring a local background gray-scale image of the local background color image; performing binaryzation processing on the local background gray-scale image by the maximum inter-class variance method to obtain the shadow image; the step of calculating the global background color of the document image according to the binary image, the local background color image and the shadow image comprises: identifying the region where each pixel point in the local background color image is located; determining the region where each pixel point is located, and determining that each pixel point belongs to a shadow region or a non-shadow region; calculating the channel mean value of the non-shadow region of the background region in the local background color image; taking the channel mean value as the global background color.

2. The document image illumination processing method of claim 1, wherein the step of calculating the illumination enhancement value of the document image according to the copy image of the document image, the local background color image and the global background color comprises: calculating a background color transformation parameter of each pixel point in the copy image; calculating the illumination enhancement value through the background color transformation parameter.

3. A document image illumination processing apparatus characterized by comprising: The device comprises a memory, a processor and a computer program stored on the memory and executable on the processor, and the computer program is executed by the processor to implement the steps of the document image illumination processing method according to any one of claims 1 to 2.

4. A computer-readable storage medium, characterized in that, The computer readable storage medium stores a document image illumination processing program, and the document image illumination processing program is executed by the processor to implement the steps of the document image illumination processing method according to any one of claims 1 to 2.

Citation Information

Patent Citations

  • Content aware improvement of captured document images

    US20170289405A1

  • Removing artifacts from document images

    US20170309003A1