Terminal device, contrast adjustment method, device and medium

By using the target model in the ink screen terminal device to identify the text area and image area, and adjust the pixel value and contrast, the problem of poor display effect of the ink screen is solved, and the clear distinction between text and background and the contrast improvement is achieved.

CN114863432BActive Publication Date: 2025-08-08QINGDAO HISENSE MOBILE COMM TECH CO LTD
View PDF 3 Cites 0 Cited by

Patent Information

Application Number
CN202210615060.9
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-05-31
Publication Date
2025-08-08
Estimated Expiration
2042-05-31

AI Technical Summary

Technical Problem

When the ink screen terminal device displays the reading application interface, the brightness difference between the text and the background is small, resulting in poor display effect. The prior art contrast adjustment methods cannot effectively improve the display clarity of images and text.

Method used

The pre-trained target model recognizes the text area and image area in the image, and adjusts the pixel values of the text area and image area respectively, and adjusts the contrast of the image area in combination with the histogram equalization algorithm to distinguish text and background and improves the display effect.

Benefits of technology

Effectively distinguishing between text and background, improving the display effect of ink screen terminal devices, maintaining image details and improving contrast, and improving user reading comfort.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114863432B_ABST
    Figure CN114863432B_ABST
Patent Text Reader

Abstract

The embodiments of the present application provide a terminal device, a contrast adjustment method, an apparatus, and a medium to address the problem in the prior art that terminals with ink screens have poor display effects on pages containing text and images. In the embodiments of the present application, the processor of the terminal device can obtain text areas and image areas in an image, adjust the pixel values of pixels located on the text in the text area of the image to a first preset value, and adjust the values of other pixels in the text area to a second preset value, thereby distinguishing between text and non-text in the text area of the image. The processor also adjusts the contrast of the image area in the image using a histogram equalization algorithm, thereby improving the display effect of the image.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the technical field of contrast adjustment, and in particular to a terminal device, a contrast adjustment method, an apparatus, and a medium. Background Art

[0002] With the prevalence of smart devices, more and more users are using their fragmented time to read on these devices. LCD screens consume high power, have limited battery life, and prolonged viewing can cause irreversible eye damage. E-ink screens, due to their inherent display principles, are power-efficient and eye-friendly, providing a paper-like reading experience that perfectly meets user reading needs. However, due to the limitations of e-ink display performance, such as a limited number of grayscale levels, low contrast, and slow refresh rates, and the fact that most users typically use LCD screens, most reading applications (Applications, Apps) are designed for LCD screens. They typically set the background color of text reading pages to a lighter gray, yellow, or green, or a dark textured background, or highlight the text against a dark black or dark green background. Because e-ink screens don't emit their own light and rely on ambient light reflection for display, the brightness difference between text and the background on a reading interface with a background is much smaller than on LCD screens, resulting in unclear and spotty displays. As a result, terminal devices with ink screens have poor display effects when displaying reading APP interfaces.

[0003] To improve the display quality of e-ink display devices, existing technologies have proposed using a simple gamma curve adjustment scheme to globally increase contrast. However, this approach can severely lose some image details in the displayed content. Existing technologies also use triangulation to binarize the image, rendering the background white and the text black. While this technique improves contrast and visual clarity, it only works for applications where the entire screen is text, and is incapable of processing both text and images in applications like Weibo, browsers, and WeChat. Summary of the Invention

[0004] The embodiments of the present application provide a terminal device, a contrast adjustment method, an apparatus, and a medium to solve the problem in the prior art that terminal devices with ink screens have poor display effects on pages containing text and images.

[0005] In a first aspect, an embodiment of the present application provides a terminal device, the terminal device comprising:

[0006] a display, wherein the display is used to display a target image;

[0007] A processor configured to execute:

[0008] If a display operation is received, obtaining an image to be displayed corresponding to the display operation;

[0009] Determining the text area and image area in the image using a pre-trained target model;

[0010] The pixel values of the pixel points located on the text in the text area are adjusted to a first preset value, the other pixel values in the text area are adjusted to a second preset value, and the contrast of the image area in the image is adjusted through a histogram equalization algorithm to obtain a target image after processing, and control the display to display the target image.

[0011] In a second aspect, an embodiment of the present application further provides a contrast adjustment method, the method comprising:

[0012] If a display operation is received, obtaining an image to be displayed corresponding to the display operation;

[0013] Determining the text area and image area in the image using a pre-trained target model;

[0014] The pixel values of the pixel points located on the text in the text area are adjusted to a first preset value, and the other pixel values in the text area are adjusted to a second preset value; and the contrast of the image area in the image is adjusted through a histogram equalization algorithm, and the target image after the processing is obtained and the target image is displayed.

[0015] In a third aspect, an embodiment of the present application further provides a contrast adjustment device, the device comprising:

[0016] A receiving and obtaining module, configured to obtain an image to be displayed corresponding to a display operation if a display operation is received;

[0017] A determination module, configured to determine a text area and an image area in the image using a pre-trained target model;

[0018] The processing module is used to adjust the pixel values of the pixels located on the text in the text area to a first preset value, adjust the other pixel values in the text area to a second preset value, adjust the contrast of the image area in the image through a histogram equalization algorithm, obtain a target image after the processing is completed, and control the display to display the target image.

[0019] In a fourth aspect, an embodiment of the present application further provides a computer-readable storage medium storing a computer program, wherein when the computer program is executed by a processor, the steps of the contrast adjustment method as described in any one of the above items are implemented.

[0020] In an embodiment of the present application, a terminal device includes a processor and a display, and the processor is connected to the display. If the processor receives a display operation, it obtains an image to be displayed corresponding to the display operation, determines the text area and image area in the image through a pre-trained target model, adjusts the pixel values of the pixels located on the text in the text area to a first preset value, adjusts the other pixel values in the text area to a second preset value, and adjusts the contrast of the image area in the image through a histogram equalization algorithm, obtains the target image after processing, and controls the display to display the target image. Because in an embodiment of the present application, the processor of the terminal device can obtain the text area and image area in the image, adjust the pixel values of the pixels located on the text in the text area in the image to a first preset value, and adjusts the other pixel values in the text area to a second preset value, thereby distinguishing between text and non-text in the text area in the image, and the processor also adjusts the contrast of the image area in the image through a histogram equalization algorithm, thereby improving the display effect of the image. BRIEF DESCRIPTION OF THE DRAWINGS

[0021] In order to more clearly illustrate the implementation methods in the embodiments of the present application or related technologies, the following is a brief introduction to the drawings required for use in the embodiments or related technology descriptions. Obviously, the drawings described below are some embodiments of the present application. For ordinary technicians in this field, other drawings can also be obtained based on these drawings.

[0022] Figure 1 A schematic structural diagram of a terminal 100 is shown;

[0023] Figure 2 This is a software structure block diagram of a terminal 100 according to an embodiment of the present application;

[0024] Figure 3 A schematic diagram of the structure of a terminal device provided in an embodiment of the present application;

[0025] Figure 4 A schematic diagram of a target image generation process provided in an embodiment of the present application;

[0026] Figure 5a A schematic diagram of an image to be displayed provided in an embodiment of the present application;

[0027] Figure 5b This is a schematic diagram of an output of a first target model provided in an embodiment of the present application;

[0028] Figure 5c A schematic diagram of a text area provided in an embodiment of the present application;

[0029] Figure 5d A schematic diagram of a target image provided in an embodiment of the present application;

[0030] Figure 6 A schematic diagram of a process for obtaining a text area and an image area in an image using a first target model provided in an embodiment of the present application;

[0031] Figure 7a This is a schematic diagram of an output of a second target model provided in an embodiment of the present application;

[0032] Figure 7b A schematic diagram of a text area and an image area provided in an embodiment of the present application;

[0033] Figure 8 A schematic diagram of a target image generation process provided in an embodiment of the present application;

[0034] Figure 9 A schematic diagram of a display process provided in an embodiment of the present application;

[0035] Figure 10 A schematic diagram of a currently displayed image provided in an embodiment of the present application;

[0036] Figure 11 A schematic diagram of a complete image to be displayed provided in an embodiment of the present application;

[0037] Figure 12 A schematic diagram of a detailed process for acquiring a target image when a sliding distance is less than a preset distance threshold provided in an embodiment of the present application;

[0038] Figure 13 A schematic structural diagram of a contrast adjustment device provided in an embodiment of the present application;

[0039] Figure 14 A schematic structural diagram of another contrast adjustment device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0040] The present application will be further described in detail below with reference to the accompanying drawings. It is apparent that the embodiments described are only a portion of the embodiments of the present application, not all of them. All other embodiments derived by persons of ordinary skill in the art based on the embodiments of the present application without creative effort are intended to fall within the scope of protection of the present application.

[0041] With the prevalence of smart devices, more and more users are using their fragmented time to read. LCD screens consume high power, have limited battery life, and prolonged viewing can cause irreversible eye damage. E-ink screens, due to their inherent display principles, are power-efficient, eye-friendly, and provide a paper-like reading experience that perfectly meets user reading needs. However, due to the limitations of e-ink screens, such as a limited number of grayscale levels, low contrast, and slow refresh rates, and the fact that most users typically use LCD screens, most reading apps are designed for these devices. They typically use a lighter background color like gray, yellow, or green, or a dark textured background, or highlight text against a dark black or dark green background. Because e-ink screens don't emit their own light and rely on ambient light reflections, the brightness difference between text and the background on a reading screen with a background is much smaller than on LCD screens, resulting in blurriness and a pockmarked appearance. As a result, terminal devices with ink screens have poor display effects when displaying reading APP interfaces.

[0042] Existing technologies use a simple gamma curve adjustment scheme to globally adjust images and improve contrast. However, this approach can significantly lose detail in the displayed content. Existing technologies also use triangulation to binarize images, rendering the background white and the text black. While this technique improves contrast and visual clarity, it only works for applications where the entire image is text. It's not suitable for applications with both text and images, such as Weibo, browsers, and WeChat.

[0043] In order to improve the display effect of a terminal device with an ink screen on a page containing text and images, an embodiment of the present application provides a terminal device, a contrast adjustment method, an apparatus and a medium.

[0044] In an embodiment of the present application, the terminal device includes a processor and a display, and the processor is connected to the display. If the processor receives a display operation, it obtains the image to be displayed corresponding to the display operation, determines the text area and image area in the image through a pre-trained target model, adjusts the pixel values of the pixels located on the text in the text area to a first preset value, adjusts the other pixel values in the text area to a second preset value, and adjusts the contrast of the image area in the image through a histogram equalization algorithm, obtains the target image after processing, and controls the display to display the target image.

[0045] Figure 1 FIG1 shows a schematic diagram of the structure of a terminal device 100. It should be understood that Figure 1 The terminal device 100 shown is only an example, and the terminal device 100 may have more Figure 1The more or less components shown in the figure can be combined with two or more components, or can have different component configurations. The various components shown in the figure can be implemented in hardware, software, or a combination of hardware and software including one or more signal processing and / or application specific integrated circuits.

[0046] Figure 1 FIG. 1 shows a block diagram of the hardware configuration of the terminal device 100 according to an exemplary embodiment. Figure 1 As shown, the terminal device 100 includes: a radio frequency (RF) circuit 110, a memory 120, a display unit 130, a camera 140, a sensor 150, an audio circuit 160, a wireless fidelity (Wi-Fi) module 170, a processor 180, a Bluetooth module 181, and a power supply 190 and other components.

[0047] RF circuit 110 can be used to receive and transmit signals during information transmission or calls. It can receive downlink data from the base station and pass it to processor 180 for processing; it can also send uplink data to the base station. Typically, RF circuits include but are not limited to antennas, at least one amplifier, a transceiver, a coupler, a low-noise amplifier, a duplexer, and other components.

[0048] The memory 120 can be used to store software programs and data. The processor 180 executes various functions and data processing of the terminal device 100 by running the software programs or data stored in the memory 120. The memory 120 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. The memory 120 stores the operating system that enables the terminal device 100 to run. In the present application, the memory 120 can store the operating system and various application programs, and may also store program code for executing the power saving method of the terminal device according to the embodiment of the present application.

[0049] The display unit 130 may be used to receive input digital or character information and generate signal input related to user settings and function control of the terminal device 100. Specifically, the display unit 130 may include a touch screen 131 disposed on the front of the terminal device 100, which may collect user touch operations on or near it, such as clicking a button.

[0050] The display unit 130 can also be used to display information input by the user or information provided to the user, as well as a graphical user interface (GUI) of various menus of the terminal device 100. Specifically, the display unit 130 may include a display 132 provided on the front of the terminal device 100. The display 132 may be configured in the form of a liquid crystal display, a light-emitting diode, etc. The display unit 130 can be used to display the screen display area of the terminal device in this application.

[0051] The touch screen 131 can be covered on the display 132, or the touch screen 131 and the display 132 can be integrated to realize the input and output functions of the terminal device 100. The integrated touch screen 131 can be simply called a touch display. In this application, the display unit 130 can display applications and corresponding operation steps.

[0052] Camera 140 can be used to capture still images or video. The lens generates an optical image of an object and projects it onto a photosensitive element. The photosensitive element can be a charge coupled device (CCD) or a complementary metal-oxide-semiconductor (CMOS) phototransistor. The photosensitive element converts the optical signal into an electrical signal, which is then transmitted to processor 180 for conversion into a digital image signal.

[0053] The terminal device 100 may further include at least one sensor 150, such as an acceleration sensor 151, a distance sensor 152, a fingerprint sensor 153, and a temperature sensor 154. The terminal device 100 may also be configured with other sensors such as a gyroscope, a barometer, a hygrometer, a thermometer, an infrared sensor, a light sensor, and a motion sensor.

[0054] The audio circuit 160, the speaker 161, and the microphone 162 can provide an audio interface between the user and the terminal device 100. The audio circuit 160 can transmit the electrical signal converted from the received audio data to the speaker 161, which is converted into a sound signal for output. The terminal device 100 can also be equipped with a volume button for adjusting the volume of the sound signal, and can also be used to combine other buttons to adjust the closed area. On the other hand, the microphone 162 converts the collected sound signal into an electrical signal, which is received by the audio circuit 160 and converted into audio data. The audio data is then output to the RF circuit 110 to be sent to, for example, another terminal device, or the audio data is output to the memory 120 for further processing.

[0055] Wi-Fi is a short-range wireless transmission technology. The terminal device 100 can help users send and receive emails, browse web pages, and access streaming media through the Wi-Fi module 170, which provides users with wireless broadband Internet access.

[0056] The processor 180 is the control center of the terminal device 100. It connects the various components of the entire terminal device using various interfaces and lines. It executes various functions of the terminal device 100 and processes data by running or executing software programs stored in the memory 120 and calling data stored in the memory 120. In some embodiments, the processor 180 may include one or more processing units; the processor 180 may also integrate an application processor and a baseband processor, wherein the application processor mainly processes the operating system, user interface, and application programs, and the baseband processor mainly processes wireless communications. It is understood that the above-mentioned baseband processor may not be integrated into the processor 180. In this application, the processor 180 can run the operating system, application programs, user interface display and touch response, as well as the power saving method of the terminal device in the embodiment of the application. In addition, the processor 180 is coupled to the display unit 130.

[0057] The Bluetooth module 181 is used to exchange information with other Bluetooth devices having a Bluetooth module through the Bluetooth protocol. For example, the terminal device 100 can establish a Bluetooth connection with a wearable electronic device (such as a smart watch) that also has a Bluetooth module through the Bluetooth module 181 to exchange data.

[0058] The terminal device 100 also includes a power supply 190 (e.g., a battery) that supplies power to various components. The power supply can be logically connected to the processor 180 via a power management system, thereby enabling the power management system to manage functions such as charging, discharging, and power consumption. The terminal device 100 may also be configured with a power button for turning the terminal device on and off, as well as for locking the screen.

[0059] Figure 2 It is a software structure block diagram of a terminal device 100 according to an embodiment of the present application.

[0060] A layered architecture divides software into several layers, each with distinct roles and responsibilities. Layers communicate with each other through software interfaces. In some embodiments, the Android system can be divided into four layers: the application layer, the application framework layer, the Android runtime and system libraries, and the kernel layer.

[0061] The application layer can include a series of application packages.

[0062] like Figure 2As shown, the application package may include phone, MMS, WiFi, WeChat, information, alarm clock, gallery, calendar, WLAN and other applications.

[0063] The application framework layer provides an application programming interface (API) and programming framework for the applications in the application layer. The application framework layer includes some predefined functions.

[0064] like Figure 2 As shown, the application framework layer may include a window manager, a content provider, a view system, a phone manager, a resource manager, a notification manager, and the like.

[0065] The window manager is used to manage window programs. The window manager can obtain the monitor size, determine whether there is a status bar, lock the screen, take screenshots, etc.

[0066] Content providers are used to store and retrieve data and make it accessible to applications. Data can include videos, images, audio, calls made and received, browsing history and bookmarks, phone books, text messages, etc.

[0067] The view system includes visual controls, such as those for displaying text and images. The view system can be used to build applications. A display interface can consist of one or more views. For example, a display interface containing a text notification icon can include a view for displaying text and a view for displaying images.

[0068] The phone manager is used to provide communication functions of the terminal device 100, such as management of call status (including answering, hanging up, etc.).

[0069] The resource manager provides various resources for applications, such as localized strings, icons, images, layout files, video files, etc.

[0070] The Notification Manager allows applications to display notification information (such as the content of a short message) in the status bar. It can be used to convey notification-type messages and can disappear automatically after a short period of time without user interaction. For example, the Notification Manager is used to notify the completion of downloads, message reminders, etc. The Notification Manager can also be used to display notifications in the form of icons or scrolling text in the top status bar of the system, such as notifications from applications running in the background, or notifications that appear on the screen in the form of dialog windows. For example, text messages can be displayed in the status bar, prompts can be heard, the terminal device can vibrate, and the indicator light can flash.

[0071] Android Runtime includes core libraries and a virtual machine. Android runtime is responsible for scheduling and management of the Android system.

[0072] The core library consists of two parts: one is the function that needs to be called by the Java language, and the other is the Android core library.

[0073] The application layer and application framework layer run in a virtual machine. The virtual machine executes Java files in the application layer and application framework layer as binary files. The virtual machine manages object lifecycles, stack management, thread management, security and exception management, and garbage collection.

[0074] The system library can include multiple functional modules, such as surface manager, media library, 3D graphics processing library (such as OpenGL ES), 2D graphics engine (such as SGL), etc.

[0075] The surface manager is used to manage the display subsystem and provide fusion of 2D and 3D layers for multiple applications.

[0076] The media library supports playback and recording of a variety of common audio and video formats, as well as static image files. The media library can support a variety of audio and video encoding formats, such as: MPEG4, H.264, MP3, AAC, AMR, JPG, PNG, etc.

[0077] The 3D graphics processing library is used to implement 3D graphics drawing, image rendering, compositing, and layer processing.

[0078] A 2D (animation method) graphics engine is a drawing engine for 2D drawing.

[0079] The kernel layer is the layer between hardware and software. The kernel layer includes at least display driver, camera driver, audio driver, and sensor driver.

[0080] The terminal device 100 in the embodiment of the present application may be an electronic device including but not limited to a smart phone, a tablet computer, a wearable electronic device (such as a smart watch), a laptop computer, and a television.

[0081] The display 132 of the terminal device 100 is used to display the target image;

[0082] The processor 180 of the terminal device 100 is configured to execute the following contrast adjustment method.

[0083] For ease of understanding, a terminal device provided in this application is described in detail below through a specific embodiment. The following specific embodiment is described using the terminal device as an example. Figure 3 FIG. 1 shows a flow chart of a contrast adjustment method. Figure 3As shown, the method may include the following steps:

[0084] S301: If a display operation is received, an image to be displayed corresponding to the display operation is obtained.

[0085] In an embodiment of the present application, when a user needs to view certain APPs or browse certain web pages, the user can select a preset page through the device used by the user, and the controller of the display device can receive the display operation sent by the device used by the user. Among them, the device used by the user can be an operating device of the display device, and the operating device can be connected to the display device or to the controller of the display device. In addition, when a user needs to view certain APPs or browse certain web pages, he can also select a preset page through a display device with a touch function, or perform a sliding operation on a display device with a touch function, that is, the display operation can be directly applied to the display device with a touch function.

[0086] After receiving the display operation, the processor of the display device terminal device obtains the image to be displayed corresponding to the display operation. Specifically, the processor can obtain the corresponding image to be displayed based on which page the user has selected. The method of obtaining the image to be displayed after receiving the display operation is a prior art and will not be further described here.

[0087] S302: Determine the text area and image area in the image through the pre-trained target model.

[0088] In an embodiment of the present application, a pre-trained target model is stored in the processor. To improve the image display effect, after acquiring the image to be displayed, the processor inputs the acquired image into the pre-trained target model, uses the target model to detect the text area and image area in the image, and obtains the output of the target model, which identifies the text area and image area in the image. Specifically, the output of the target model may include the position information of the text area and the position information of the image area in the image, and may also include an identifier corresponding to the text area or image area. Through this identifier, the processor can determine whether each position information corresponds to an image area or a text area.

[0089] S303: Adjust the pixel values of the pixels located on the text in the text area to a first preset value, adjust the other pixel values in the text area to a second preset value, and adjust the contrast of the image area in the image through a histogram equalization algorithm to obtain a target image after the processing is completed, and control the display to display the target image.

[0090] After the processor obtains the text area and the image area in the image, the processor can identify the text in the text area. Among them, how to identify the text in a certain area is a prior art and will not be repeated here. After identifying the text in the text area, the processor can obtain the pixel points located on the text in the text area, adjust the pixel values of the obtained pixel points to a first preset value, and adjust the pixel values of other pixel points in the text area to a second preset value. The processor distinguishes the text from non-text in the text area by adjusting the pixel values of the obtained pixel points located on the text to the first preset value and adjusting the pixel values of other pixel points to the second preset value, thereby improving the display effect of the text area.

[0091] Specifically, the processor may adjust the first red (Red, R) value, the first green (Green, G) value, and the first blue (Blue, B) value of the pixel points located on the text in the text area to first preset values, respectively, and adjust each second R value, second G value, and second B value of the other pixel points to second preset values, respectively, wherein the first preset value and the second preset value are different values. In order to further distinguish the text from non-text in the text area in the image, the first preset value and the second preset value are usually quite different. For example, the first preset value may be 0, and the second preset value may be 255. That is, the processor may adjust the first R value, first G value, and first B value of the pixel points located on the text in the text area to 0, and adjust the second R value, second G value, and second B value of the other pixel points to 255, so that the text in the text area is pure black, and the background of the non-text, i.e., the text area, is pure white, thereby distinguishing the text from the non-text.

[0092] In an embodiment of the present application, the processor of the terminal device can also adjust the contrast of the image area in the image, wherein, since the pixel values of the image area are distributed on each grayscale, if the adjustment method of the text area is also adopted, a large amount of details in the image area will be lost, so the image area cannot adopt the adjustment method of the text area. The processor of the terminal device can use a histogram equalization algorithm to perform contrast stretching on the image area in the image, thereby adjusting the contrast of the image area in the image. It is worth noting that by adjusting the contrast of the image area through the histogram equalization algorithm, while improving the contrast, it can also maintain the details in the image area. In an embodiment of the present application, the algorithm for adjusting the contrast of the image area can be any histogram equalization algorithm, for example, it can be a contrast-limited histogram equalization algorithm (CLAHE). After adjusting the text area and the image area, the processed target image can be obtained, and the processor controls the display of the terminal device to display the target image.

[0093] Because in the embodiment of the present application, the processor performs different adjustments on the text area and the image area in the image to be displayed, the contrast between the text area and the image area is greatly improved while maintaining the image details, thereby improving the user's browsing comfort through the display.

[0094] In an embodiment of the present application, the image to be displayed may be captured by a processor from a frame buffer (FrameBuffer), where FrameBuffer is a display driver interface in a computer operating system (Linux). After acquiring the target image, the processor may write the target image into the FrameBuffer, thereby controlling the display to display the target image. The specific methods of acquiring the image to be displayed from the FrameBuffer and writing the target image into the FrameBuffer are prior art and will not be further described here.

[0095] Figure 4 A schematic diagram of a target image generation process provided in an embodiment of the present application.

[0096] Depend on Figure 4 It can be seen that the processor obtains the image to be displayed from the FrameBuffer, determines the text area and image area in the image through the target model, adjusts the pixel values of the pixels on the text in the text area to the first preset value, adjusts the other pixel values in the text area to the second preset value, and uses the histogram equalization algorithm to perform contrast stretching on the image area in the image, thereby adjusting the contrast of the image area, and obtaining the target image after processing. The processor writes the target image into the FrameBuffer.

[0097] Because in the embodiment of the present application, the processor of the terminal device can obtain the text area and the image area in the image, adjust the pixel value of the pixel point located on the text in the text area in the image to a first preset value, and adjust the other pixel values in the text area to a second preset value, thereby distinguishing the text from non-text in the text area in the image. The processor also adjusts the contrast of the image area in the image through a histogram equalization algorithm, thereby improving the display effect of the image.

[0098] In order to accurately determine the text area and the image area in the image, based on the above embodiment, in the embodiment of the present application, the processor 180 is specifically configured to execute:

[0099] Determine each text line in the image using a pre-trained first target model; determine a text area based on each text line, and determine an area outside the text area as an image area; or

[0100] The text area in the image and the image area in the image are determined by using a pre-trained second target model.

[0101] In an embodiment of the present application, a first target model may be pre-stored in the processor, and the processor may input an image into the first target model, and detect the text lines in the image through the first target model. The first target model may output the position information of each text line in the image, so that the processor may determine each text line in the image. In an embodiment of the present application, each character in the text line is located in the same line. The first target model outputs the processed image, wherein the processed image contains each bounding box, and the bounding box contains the characters belonging to the same line of the first target model. The first target model may also output the position information of each bounding box, for example, the first target model may output the coordinates of the upper left corner and the lower right corner of each bounding box, and may also output the coordinates of the upper left corner of each bounding box, the length value of the bounding box in the horizontal direction, and the height value of the vertical direction, wherein left, right, up, and down refer to left, right, up, and down in the image. In an embodiment of the present application, the first target model may also output a mask image of the image, wherein the mask image distinguishes between text lines and non-text lines, and the electronic device may determine the position information of each text line in the image based on the position of each text line in the mask image. Specifically, the electronic device may determine, for each pixel point in the mask image, that the pixel point corresponding to the pixel point in the image is the pixel point in the text line in the image if the pixel point is located in the text line.

[0102] The first target model can be obtained by training models such as scene detection (Detecting Text in Natural Image with Connectionist Text Proposal Network, CTPN), text detection (Shape Robust Text Detection with Progressive Scale Expansion Network, PSENet), and text detection (Fourier Contour Embedding for Arbitrary-Shaped Text Detection, FCEnet).

[0103] Figure 5a A schematic diagram of an image to be displayed provided in an embodiment of the present application.

[0104] Depend on Figure 5a It can be seen that the image to be displayed includes a text area and an image area, and the image to be displayed is an image corresponding to a page of a certain reading APP.

[0105] Figure 5bThis is a schematic diagram of the output of a first target model provided in an embodiment of the present application.

[0106] Figure 5b For the general Figure 5a Input into the first target model, the first target model outputs an image diagram, which is represented by Figure 5b It can be seen that the output of the first target model is the bounding box where each text line is located.

[0107] In the embodiment of the present application, there is usually no image between adjacent text lines. Therefore, the text area can be determined based on each text line. Specifically, after determining each text line in the image, the processor can determine the continuous text lines as the text area. In addition, an image may contain multiple text areas and multiple image areas. The processor then determines the areas other than the text areas as the image areas in the image.

[0108] In an embodiment of the present application, the processor may employ an image morphological closing operation to determine the text region formed by each two adjacent text lines in the text region of the image, thereby determining each text region in the image. For example, if text line A is adjacent to text line B, text line B is adjacent to text line C, and there are no other text lines or non-text lines between text lines A, B, and C, then text lines A, B, and C constitute a text region. The distance between the two text lines may be determined by the kernel size in the image morphological ratio operation, which may be determined experimentally.

[0109] In one possible implementation, if the first target model outputs a mask image of an image, the text area in the mask image can be determined through image morphological closing operations, and the text area in the image can be determined based on the text area in the mask image. Specifically, the electronic device can determine that the pixel point corresponding to each pixel point in the mask image is the pixel point in the text area if the pixel point is located in the text area.

[0110] Figure 5c A schematic diagram of a text area provided in an embodiment of the present application.

[0111] in, Figure 5c is based on Figure 5b The text area determined by the text lines in Figure 5b From the three text areas in the first row, we can see that non-adjacent text lines in the same row do not form the same text area, that is, non-adjacent text lines remain independent.

[0112] Figure 5d A schematic diagram of a target image provided in an embodiment of the present application.

[0113] in, Figure 5d In order to adopt the solution of the embodiment of the present application Figure 5a The target image obtained after processing is Figure 5a and Figure 5d It can be seen that the target image obtained after adjustment has a better display effect and can enhance the user's reading experience.

[0114] In an embodiment of the present application, if the first target model outputs the position information of each text line, the processor can also determine the vertical spacing between each text line and each other text line for each text line in the image, determine the text line whose vertical spacing with the text line is less than a first preset threshold as the target text line, determine the target text line as the text line adjacent to the text line, and then continue to judge for the target text line whether there are other text lines adjacent to the target text line until there are no adjacent text lines, and determine a text area based on the text line, the target text line and the text lines adjacent to the target text line.

[0115] Specifically, the processor determines the vertical spacing between two text lines by: determining a first difference in the vertical coordinates of the upper left corners of the bounding boxes in the position information of the two text lines, and determining the text line with the smaller vertical coordinate of the upper left corner of the bounding box in the position information of the two text lines, determining the height of the bounding box of the text line with the smaller vertical coordinate in the vertical direction, determining a second difference between the first difference and the height value, and determining the absolute value of the second difference as the vertical spacing between the two text lines. Wherein, if the first target model outputs the coordinates of the upper left corner and the lower right corner of each bounding box, then the height of the bounding box of the text line in the vertical direction is the absolute value of the difference between the vertical coordinates of the upper left corner and the vertical coordinates of the lower right corner in the position information of the text line; if the first target model outputs the coordinates of the upper left corner of each bounding box, the horizontal length value of the bounding box, and the vertical height value of the bounding box, then the vertical height value of the bounding box in the position information is the vertical height value of the bounding box of the text line.

[0116] For example, the position information of text line A is (x1, y1, w1, h1), and the position information of text line B is (x2, y2, w2, h2). The coordinate system is determined with the upper left corner of the image as the origin, the rightward direction as the positive x-axis, and the vertically downward direction as the positive y-axis. x1 refers to the horizontal coordinate of the upper left corner of the bounding box of text line A, y1 refers to the vertical coordinate of the upper left corner of the bounding box of text line A, w1 refers to the horizontal length of the bounding box of text line A, and h1 refers to the vertical height of the bounding box of text line A. x2 refers to the horizontal coordinate of the upper left corner of the bounding box of text line B, y2 refers to the vertical coordinate of the upper left corner of the bounding box of text line B, w2 refers to the horizontal length of the bounding box of text line B, and h2 refers to the vertical height of the bounding box of text line B. When y2>y1, the vertical distance between text line A and text line B is Vgap=|y2-y1-h1|; when y1>y2, the vertical distance between text line A and text line B is Vgap=|y1-y2-h2|.

[0117] Furthermore, text lines in the same text area will not differ too much in the horizontal direction. Therefore, if the vertical spacing between two text lines is less than a first preset threshold, the processor may further determine the horizontal spacing between the two text lines. If the horizontal spacing is less than a second preset threshold, the two text lines are determined to be adjacent text lines. Specifically, the processor determines the horizontal spacing between the two text lines by: determining the text line with the smaller horizontal coordinate of the upper left corner of the bounding box in the position information of the two text lines, determining the horizontal length of the bounding box of the text line with the smaller horizontal coordinate, determining the absolute value of a third difference between the horizontal coordinates of the upper left corner of the bounding box in the position information of the two text lines, and determining the difference between the absolute value and the length value as the horizontal spacing between the two text lines. Among them, if the first target model outputs the coordinates of the upper left corner and the lower right corner of each bounding box, then the horizontal length value of the bounding box of the text line is the absolute value of the difference between the horizontal coordinate of the upper left corner and the horizontal coordinate of the lower right corner in the position information of the text line. If the first target model outputs the coordinates of the upper left corner of each bounding box, the horizontal length value of the bounding box and the vertical height value, then the horizontal length value of the bounding box in the position information is the horizontal length value of the text line.

[0118] For example, the position information of text line A is (x1, y1, w1, h1), and the position information of text line B is (x2, y2, w2, h2). The coordinate system is determined with the upper left corner of the image as the origin, the rightward direction as the positive x-axis, and the vertically downward direction as the positive y-axis. x1 refers to the horizontal coordinate of the upper left corner of the bounding box of text line A, y1 refers to the vertical coordinate of the upper left corner of the bounding box of text line A, w1 refers to the horizontal length of the bounding box of text line A, and h1 refers to the vertical height of the bounding box of text line A. x2 refers to the horizontal coordinate of the upper left corner of the bounding box of text line B, y2 refers to the vertical coordinate of the upper left corner of the bounding box of text line B, w2 refers to the horizontal length of the bounding box of text line B, and h2 refers to the vertical height of the bounding box of text line B. When x2>x1, the horizontal distance between text line A and text line B is Ygap=|x2-x1|-w1; when x1>x2, the horizontal distance between text line A and text line B is Ygap=|x2-x1|-w2.

[0119] Figure 6 A schematic diagram of a process for obtaining text areas and image areas in an image using a first target model provided in an embodiment of the present application.

[0120] Depend on Figure 6 It can be seen that after the processor obtains the image to be displayed, it inputs the image to be displayed into the first target model, determines each text line in the image through the first target model, and determines the text area based on each text line, and determines the area outside the text area in the image as the image area in the image.

[0121] In order to train the first target model, the embodiment of the present application stores a first sample set for training. The first sample images in the first sample set include images of typical interfaces of various reading apps, Weibo, browsers, and other apps. Of course, each image contains text content for reading. In order to facilitate the training of the first target model and the second target model, the first sample set also stores the first position information of the text line contained in the first sample image for each first sample image. In the embodiment of the present application, after obtaining any first sample image in the first sample set and the first position information of each text line contained in the first sample image, the first sample image and the first position information are input into the original first model, and the original first model outputs the second position information of the text line contained in the first sample image. After the original first model determines the second position information of the text line contained in the first sample image, the original first model is trained based on the first position information in the first sample image and the second position information output by the original first model. When the preset conditions are met, the trained first target model is obtained. Among them, the preset condition can be that the number of first sample images in the first sample set whose second position information is consistent with the first position information after training with the original first model is greater than the set number; it can also be that the number of iterations of training the original first model reaches the set maximum number of iterations, etc.

[0122] In an embodiment of the present application, a pre-trained second target model may also be stored in the processor, and the processor inputs the image into the pre-trained second target model, identifies the text area and image area in the image through the second target model, and obtains the output of the second target model, which is the text area and image area in the image. Specifically, the output of the second target model may include the position information of the text area and the position information of the image area in the image, and may also include an identifier corresponding to the text area or the image area. Through the identifier, the processor can determine whether each position information corresponds to an image area or a text area. In an embodiment of the present application, the second target model can be obtained by training models such as target detection (fast-rcnn), target detection (mask-rcnn), object recognition (You Only Look Once, yolo), text detection (DocSegTr), and deep learning (L-E3Net).

[0123] In a possible embodiment, the output of the second target model can be a mask image of the input image, which contains text areas, image areas, and backgrounds of non-text and non-image areas. After obtaining the output of the second model, the electronic device can determine the text areas and image areas in the input image based on the text areas and image areas in the mask image. Specifically, the electronic device can determine that for each pixel point in the mask image, if the pixel point is located in the image area of the mask image, the pixel point corresponding to the pixel point in the input image is the pixel point of the image area; if the pixel point is located in the text area of the mask image, the pixel point corresponding to the pixel point in the input image is the pixel point of the text area, so that the electronic device can determine the text area and image area in the image. In an embodiment of the present application, the pixel values of the pixels in the text area, image area, and backgrounds of non-text and non-image areas in the mask image are different.

[0124] In an embodiment of the present application, the second target model can directly output the position information of the text area and the image area, while the first target model cannot directly output the position information of the image area in the image, and the text area in the image is determined by the second target model, without the need to determine the text area based on each text line, so the second target model is more resource-saving.

[0125] Figure 7a This is a schematic diagram of the output of a second target model provided in an embodiment of the present application.

[0126] Figure 7a For input Figure 5a When the image is , the mask map output by the second target model is, Figure 7a The background includes text area, image area and non-text area and non-image area, wherein: Figure 7a The white area in the middle is the text area, the black area is the background of the non-text area and non-image area, and the other areas are the image area.

[0127] Figure 7b A schematic diagram of a text area and an image area provided in an embodiment of the present application.

[0128] in, Figure 7b is based on Figure 7a The text area and image area in the image determined by the mask image are Figure 7b It can be seen that the text area and image area in the image determined according to the mask image are relatively accurate and will not have a large error.

[0129] Figure 8 A schematic diagram of a target image generation process provided in an embodiment of the present application.

[0130] S801: The processor obtains an image to be displayed.

[0131] S802: The processor determines the text area and image area in the image through the target model.

[0132] S803: The processor adjusts the pixel values of the pixels located on the text in the text area in the image to a first preset value, adjusts the pixel values of other pixels to a second preset value, and adjusts the contrast of the image area in the image through a histogram equalization algorithm.

[0133] S804: The processor obtains the processed target image.

[0134] To train the second target model, the present embodiment stores a second sample set for training. The second sample images in the second sample set include images of typical interfaces of various reading apps, Weibo, browsers, and other apps. Each image also contains text for reading. The second sample set also stores, for each second sample image, third position information and corresponding first identification information for each region contained in the second sample image. Specifically, the first identification information can be used to identify whether the corresponding region is a text region or an image region, for example, 01 for a text region and 02 for an image region.

[0135] In an embodiment of the present application, after obtaining any second sample image in the second sample set and the third position information and first identification information of each area contained in the second sample image, the second sample image, each third position information and the corresponding first identification information are input into the original second model, and the original second model outputs the fourth position information of the area contained in the second sample image and the second identification information of the area corresponding to the fourth position information.

[0136] After the original second model determines the fourth position information of the region contained in the second sample image and the second identification information of the region of the fourth position information, the original second model is trained based on the third position information and first identification information in the second sample image, the fourth position information output by the original second model, and the corresponding second identification information. When a preset condition is met, a trained second target model is obtained. The preset condition may be that the number of second sample images in the second sample set whose fourth position information and second identification information, obtained after training with the original second model, are consistent with the third position information and first identification information is greater than a set number; or that the number of iterations of training the original second model reaches a set maximum number of iterations, etc.

[0137] In order to accurately distinguish text from non-text in a text area in an image, based on the above embodiments, in the embodiment of the present application, the processor 180 is specifically configured to execute:

[0138] A triangle binarization algorithm or an OTST (Online Teaching Support Unit) binarization algorithm is used to adjust the pixel values of the pixels on the text in the text area to a first preset value, and the pixel values of other pixels in the text area are adjusted to a second preset value.

[0139] In an embodiment of the present application, the processor of the terminal device can use a triangle binarization algorithm or an Otsu OTST binarization algorithm to adjust the pixel values of the pixel points located on the text in the text area in the image to a first preset value, and adjust the pixel values of other pixel points in the text area in the image to a second preset value.

[0140] Specifically, in an embodiment of the present application, the processor may use a triangle binarization algorithm or an OTST binarization algorithm to determine the pixels located on the text in the text area of the image, and adjust the first R value, first G value, and first B value of the pixels located on the text to first preset values, respectively, and adjust the second R value, second G value, and second B value of other pixels in the text area of the image to second preset values, respectively. The first preset value is different from the second preset value, thereby distinguishing the text from non-text in the text area of the image, and then performing contrast enhancement processing on the text in the text area of the image to improve the display effect of the text area in the image. The first preset value and the second preset value may be different arbitrary values, for example, the first preset value may be 0 and the second preset value may be 255. If the first preset value is 0 and the second preset value is 255, then in this embodiment of the present application, the text in the text area of the image is adjusted to pure black and the non-text in the text area of the image is adjusted to pure white, thereby distinguishing the text from non-text in the text area of the image and improving the display effect of the text area in the image.

[0141] In order to improve the display effect of the text area in the image, based on the above embodiments, in the embodiment of the present application, the processor 180 is further configured to execute:

[0142] A bilateral filtering algorithm or a 3D block matching filtering (BM3D) algorithm is used to filter the text area in the image.

[0143] Since, in the embodiment of the present application, there may be a situation where there are many noise points around the text in the text area in the image, if the pixel values of the pixels located on the text in the text area are adjusted to the first preset value only by the triangle binarization algorithm or the OTST binarization algorithm, and the pixel values of other pixels in the text area are adjusted to the second preset value, it is easy to adjust the pixel values of the noise points around the text to the first preset value, and it is easy to form gaps or protrusions on the strokes. Therefore, in the embodiment of the present application, in order to further improve the display effect, after obtaining the text area in the image, the processor also filters the text area in the image, thereby reducing the noise points around the text in the text area in the image. Specifically, in the embodiment of the present application, the processor can use the bilateral filtering algorithm or the BM3D algorithm to filter the text area in the image, so as to better ensure the clarity of the text edges in the text area in the image and improve the display effect of the text area in the image.

[0144] In an embodiment of the present application, in order to further ensure the image display effect, the processor may also use a bilateral filtering algorithm or a BM3D algorithm to filter the image area in the image.

[0145] Figure 9 A schematic diagram of a display process provided in an embodiment of the present application.

[0146] S901: The processor obtains an image to be displayed.

[0147] S902: The processor determines the text area and image area in the image through the target model.

[0148] S903: The processor performs filtering processing on the text area and the image area in the image.

[0149] S904: The processor adjusts the pixel values of the pixels located on the text in the text area in the image to a first preset value, adjusts the pixel values of other pixels to a second preset value, and adjusts the contrast of the image area in the image through a histogram equalization algorithm.

[0150] S905: The processor obtains the processed target image.

[0151] S906: The processor controls the display to display the target image.

[0152] In the embodiment of the present application, the processor may write the target image into the FrameBuffer, thereby controlling the display to display the target image.

[0153] In order to determine the image to be displayed, based on the above embodiments, in the embodiment of the present application, the processor 180 is specifically configured to execute:

[0154] If the identification display operation carries a sliding direction and a sliding distance, determining whether the sliding distance is greater than a preset distance value;

[0155] If so, the image to be displayed is determined according to the currently displayed image, the sliding direction and the sliding distance.

[0156] In an embodiment of the present application, the complete image to be displayed may contain the same area as the image currently displayed on the display. Since the currently displayed image has been adjusted to a level with a good display effect, if the processor adjusts the complete image to be displayed, it will cause a waste of resources and take a long time to process. Therefore, in an embodiment of the present application, if the display operation carries a sliding direction and a sliding distance, the processor can determine whether the image to be displayed and the image currently displayed on the display contain the same area by whether the sliding distance is greater than a preset distance value. Among them, it may be that when the user is viewing an image, there is a need to view other interfaces, and the user performs a sliding operation on the device he is using. The processor of the terminal device can receive the display operation carrying the sliding direction and sliding distance. If the display operation received by the processor carries a sliding distance, the processor determines whether the sliding distance is greater than the preset distance value.

[0157] In the embodiment of the present application, the sliding distance may specifically refer to the number of pixels slid.

[0158] In the embodiment of the present application, if the processor determines that the sliding distance is greater than a preset distance value, it indicates that the image to be displayed does not have the same area as the currently displayed image. The processor can then determine the image to be displayed based on the currently displayed image, the sliding direction, and the sliding distance. Specifically, how to determine the image to be displayed based on the currently displayed image, the sliding direction, and the sliding distance is known in the art and will not be further described here.

[0159] In order to reduce resource waste and shorten processing time, based on the above embodiments, in the embodiment of the present application, the processor 180 is specifically configured to execute:

[0160] If the sliding distance is less than a preset distance value, determining a complete image to be displayed based on the currently displayed image, the sliding direction, and the sliding distance, determining images that are different from and the same as the currently displayed image in the complete image, and using the different images as the images to be displayed;

[0161] The processor 180 is further configured to execute:

[0162] The processed target image is combined with the same image to update the target image.

[0163] In an embodiment of the present application, if the processor determines that the sliding distance is less than a preset distance value, it indicates that the complete image to be displayed and the currently displayed image have the same area. Since the existing same area has been adjusted to a level that provides a good display effect, if the processor adjusts the entire complete image to be displayed, it will result in a waste of resources. Therefore, in an embodiment of the present application, if the processor determines that the sliding distance is less than a preset distance value, the processor determines the complete image to be displayed based on the currently displayed image, the sliding direction, and the sliding distance. Specifically, the processor may perform movement processing on the currently displayed image corresponding to the sliding direction and sliding distance to obtain the complete image to be displayed. Since the sliding distance is less than the preset distance value, it indicates that the complete image to be displayed and the currently displayed image have the same area. Therefore, the processor can determine a different image and an identical image in the complete image with respect to the currently displayed image. The identical image is the same area described above. The processor uses the different image as the image to be displayed and performs the subsequent step of determining the target image corresponding to the image.

[0164] Since the determined target image is the image after adjusting the difference image, and not the image after adjusting the complete image to be displayed, after the processor obtains the target image obtained by adjusting the difference image as the image to be displayed, the processor combines the target image with the same image, which refers to the image in the currently displayed image corresponding to the same area in the complete image to be displayed, and the processor uses the combined image to update the target image.

[0165] That is to say, in the embodiment of the present application, if the complete image and the currently displayed image have the same image, the difference image in the complete image is cut out, the difference image is used as the image to be displayed, and subsequent adjustment operations are performed on the difference image to obtain the target image, and the target image is combined with the image in the currently displayed image that is the same as the complete image, and the target image is updated.

[0166] Because in the embodiment of the present application, when the user slides, the processor only needs to process the image of the newly appeared content, that is, the difference image between the complete image to be displayed and the currently displayed image, thereby reducing the amount of calculation, reducing resource waste, and improving processing efficiency.

[0167] In an embodiment of the present application, the processor can determine a different image from the currently displayed image in the complete image based on the sliding direction and the sliding distance. Specifically, if the sliding direction is downward, the upper side of the complete image is the newly appeared image, and if the sliding direction is upward, the lower side of the complete image is the newly appeared image. The coordinate system is determined with the upper left corner of the image as the origin, the direction to the right as the positive direction of the x-axis, and the vertically downward as the positive direction of the y-axis. For example, if sliding downward and the sliding distance is Δy, then (0, 0, W, Δy) in the complete image is the different image, where W refers to the length value of the complete image in the horizontal direction. The coordinate system is determined with the upper left corner of the image as the origin, the direction to the right as the positive direction of the x-axis, and the vertically downward as the positive direction of the y-axis. For example, if sliding upward and the sliding distance is Δy, then (0, H-Δy, W, Δy) in the complete image is the different image, where H refers to the height value in the vertical direction of the complete image.

[0168] Figure 10 A schematic diagram of a currently displayed image provided in an embodiment of the present application.

[0169] Depend on Figure 10 It can be seen that the currently displayed image includes text areas and image areas, specifically text areas TextBox1, TextBox2, and TextBox3, and image area InageBox1.

[0170] Figure 11 A schematic diagram of a complete image to be displayed provided in an embodiment of the present application.

[0171] Depend on Figure 11 It can be seen that the complete image to be displayed includes text areas and image areas, specifically including text areas Block1, TextBox1, TextBox2, and image area InageBox1. Figure 11 and Figure 10 It can be seen that Block1 is Figure 11 and Figure 10 The difference area, TextBox1, TextBox2, InageBox1 is Figure 11 and Figure 10 Same area.

[0172] In an embodiment of the present application, the processor may determine whether the text area or image area in the currently displayed image still exists in the complete image to be displayed based on the sliding direction and sliding distance. Figure 10The text area TextBox1 in it has position information (x1, y1, w1, h1) in the image to be displayed. If the sliding direction is downward and the sliding distance is Δy, the position information of the text area TextBox1 after sliding is (x1, y1 + Δy, w1, h1). If y1 + Δy - h1 > H, where H is the height value in the vertical direction of the complete image to be displayed and the currently displayed image, it means that the complete image to be displayed does not include the text area TextBox1; if y1 + Δy > H and y1 + Δy - h1 < H, it means that the complete image to be displayed includes part of the text area TextBox1; if y1 + Δy < H, it means that the complete image to be displayed includes the text area TextBox1. At the same time, the processor can determine whether other areas are included in the complete image to be displayed in the above manner.

[0173] Figure 12 It is a schematic diagram of the detailed process of obtaining a target image when the sliding distance is less than a preset distance threshold provided by an embodiment of the present application.

[0174] S1201: The processor obtains the sliding distance and the sliding direction.

[0175] S1202: The processor determines the complete image to be displayed according to the sliding distance, the sliding direction, and the currently displayed image.

[0176] S1203: The processor determines the different image between the complete image to be displayed and the currently displayed image according to the complete image to be displayed and the currently displayed image, and determines the same image between the currently displayed image and the complete image.

[0177] S1204: The processor determines the text area and the image area in the different image through the target model.

[0178] S1205: The processor adjusts the pixel values of the pixel points on the text in the text area of the complete image to a first preset value, adjusts the pixel values of other pixel points to a second preset value, and adjusts the contrast of the image area in the image through the histogram equalization algorithm.

[0179] S1206: The processor obtains the processed target image.

[0180] S1207: The processor combines the target image with the same image and updates the target image. Figure 13 It is a schematic diagram of the structure of a contrast adjustment device provided by an embodiment of the present application. As shown in this Figure 13 shown, this device includes:

[0181] The receiving and obtaining module 1301 is used to obtain the image to be displayed corresponding to the display operation if a display operation is received;

[0182] A determination module 1302 is configured to determine a text area and an image area in the image using a pre-trained target model;

[0183] The processing module 1303 is used to adjust the pixel values of the pixel points located on the text in the text area to a first preset value, adjust the other pixel values in the text area to a second preset value, and adjust the contrast of the image area in the image through a histogram equalization algorithm, obtain the target image after the processing is completed, and control the display to display the target image.

[0184] In one possible embodiment, the determination module 1302 is specifically used to determine each text line in the image through a pre-trained first target model; determine the text area based on each text line, and determine the area outside the text area as the image area; or, determine the text area in the image and the image area in the image through a pre-trained second target model.

[0185] In one possible implementation, the processing module 1303 is specifically used to adjust the pixel values of the pixel points located on the text in the text area to a first preset value, and adjust the pixel values of other pixel points in the text area to a second preset value using a triangle binarization algorithm or an OTST binarization algorithm.

[0186] In a possible implementation, the processing module 1303 is further configured to perform filtering processing on the text area in the image using a bilateral filtering algorithm or a BM3D algorithm.

[0187] In one possible implementation, the processing module 1303 is specifically used to determine whether the sliding distance is greater than a preset distance value if the display operation carries a sliding direction and a sliding distance; if so, determine the image to be displayed based on the currently displayed image, the sliding direction and the sliding distance.

[0188] In one possible implementation, the processing module 1303 is specifically configured to, if the sliding distance is less than a preset distance value, determine a complete image to be displayed based on the currently displayed image, the sliding direction, and the sliding distance, determine images that are different from and identical to the currently displayed image in the complete image, and use the different images as the images to be displayed;

[0189] The processing module 1303 is further configured to combine the processed target image with the same image to update the target image.

[0190] In the embodiments of this application, Figure 14A structural diagram of another contrast adjustment device provided in an embodiment of the present application is shown in FIG. Figure 14 As shown:

[0191] The device includes: a layout segmentation module 1401, a text detection module 1402 and a processing module 1403.

[0192] The layout segmentation module 1401 and the text detection module 1402 are used to obtain the image to be displayed corresponding to the display operation if a display operation is received; determine the text area and image area in the image through the pre-trained target model; this part of the function is similar to Figure 13 The corresponding functions of the receiving and obtaining module 1301 and the determining module 1302 are consistent.

[0193] The processing module 1403 is used to adjust the pixel values of the pixels located on the text in the text area to a first preset value, adjust the other pixel values in the text area to a second preset value, and adjust the contrast of the image area in the image through a histogram equalization algorithm, obtain the target image after processing, and control the display to display the target image; this part of the function is the same as Figure 13 The corresponding functions of the processing module 1303 are consistent.

[0194] In a possible implementation, the layout segmentation module 1401 is used to determine each text line in the image using a pre-trained first target model; this part of the function is similar to Figure 13 The corresponding function of the determination module 1302 is consistent;

[0195] The text detection module 1402 is used to determine the text area based on each text line and determine the area outside the text area as the image area; this part of the function is similar to Figure 13 The corresponding function of the determination module 1302 in is consistent; or,

[0196] The layout segmentation module 1401 is used to determine the text area in the image and the image area in the image through the pre-trained second target model; this part of the function is similar to Figure 13 The corresponding function of the determination module 1302 is consistent.

[0197] In a possible implementation, the processing module 1403 is specifically configured to use a triangle binarization algorithm or an OTST binarization algorithm to adjust the pixel values of the pixels located on the text in the text area to a first preset value, and to adjust the pixel values of other pixels in the text area to a second preset value; this function is similar to Figure 13 The corresponding function of the determination module 1302 is consistent.

[0198] In a possible implementation manner, the processing module 1403 is further configured to filter the text area in the image using a bilateral filtering algorithm or a BM3D algorithm; this function is similar to Figure 13 The corresponding function of the determination module 1302 is consistent.

[0199] In a possible implementation, the processing module 1403 is specifically configured to, if the display operation includes a sliding direction and a sliding distance, determine whether the sliding distance is greater than a preset distance value; if so, determine the image to be displayed based on the currently displayed image, the sliding direction, and the sliding distance; this function is similar to Figure 13 The corresponding function of the determination module 1302 is consistent.

[0200] In one possible implementation, the processing module 1403 is specifically configured to, if the sliding distance is less than a preset distance value, determine the complete image to be displayed based on the currently displayed image, the sliding direction, and the sliding distance, determine the difference image and the same image in the complete image as the currently displayed image, and use the difference image as the image to be displayed; this part of the function is similar to Figure 13 The corresponding function of the determination module 1302 is consistent;

[0201] The processing module 1403 is also used to combine the processed target image with the same image to update the target image; this part of the function is the same as Figure 13 The corresponding function of the determination module 1302 is consistent.

[0202] Based on the same concept, an embodiment of the present application provides a computer-readable storage medium. When the instructions in the storage medium are executed by a processor, the processor is enabled to perform any of the contrast adjustment methods implemented in the above embodiments, specifically performing the following steps:

[0203] If a display operation is received, obtaining an image to be displayed corresponding to the display operation;

[0204] Determining the text area and image area in the image using a pre-trained target model;

[0205] The pixel values of the pixel points located on the text in the text area are adjusted to a first preset value, the other pixel values in the text area are adjusted to a second preset value, and the contrast of the image area in the image is adjusted through a histogram equalization algorithm to obtain a target image after processing, and the target image is displayed.

[0206] In a possible implementation, determining the text area and the image area in the image using the pre-trained target model includes:

[0207] Determine each text line in the image using a pre-trained first target model; determine a text area based on each text line, and determine an area outside the text area as an image area; or

[0208] The text area in the image and the image area in the image are determined by using a pre-trained second target model.

[0209] In a possible implementation, adjusting the pixel values of pixels located on the text in the text area to a first preset value and adjusting the values of other pixels in the text area to a second preset value includes:

[0210] A triangle binarization algorithm or an OTST binarization algorithm is used to adjust the pixel values of the pixels located on the text in the text area to a first preset value, and to adjust the pixel values of other pixels in the text area to a second preset value.

[0211] In a possible implementation, after determining the text region and the image region in the image using the pre-trained target model, and before adjusting the pixel values of the pixels located on the text in the text region to the first preset value and adjusting the values of other pixels in the text region to the second preset value, the method further includes:

[0212] A bilateral filtering algorithm or a BM3D algorithm is used to perform filtering processing on the text area in the image.

[0213] In a possible implementation, obtaining the image to be displayed corresponding to the display operation includes:

[0214] If the identification display operation carries a sliding direction and a sliding distance, determining whether the sliding distance is greater than a preset distance value;

[0215] If so, the image to be displayed is determined according to the currently displayed image, the sliding direction and the sliding distance.

[0216] In a possible implementation, obtaining the image to be displayed corresponding to the display operation includes:

[0217] If the sliding distance is less than a preset distance value, determining a complete image to be displayed based on the currently displayed image, the sliding direction, and the sliding distance, determining images that are different from and the same as the currently displayed image in the complete image, and using the different images as the images to be displayed;

[0218] After acquiring the processed target image and before displaying the target image, the method further includes:

[0219] The processed target image is combined with the same image to update the target image.

[0220] Those skilled in the art will appreciate that the embodiments of the present application can be provided as methods, systems, or computer program products. Therefore, the present application can adopt the form of a complete hardware embodiment, a complete software embodiment, or an embodiment in combination with software and hardware. Moreover, the present application can adopt the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to magnetic disk storage, CD-ROM, optical storage, etc.) that contain computer-usable program code.

[0221] The present application is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the present application. It should be understood that each process and / or block in the flowchart and / or block diagram, as well as the combination of processes and / or blocks in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 a process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.

[0222] These computer program instructions may also be stored in a computer readable memory that can direct a computer or other programmable data processing device to work in a specific manner, so that the instructions stored in the computer readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 a process or multiple processes and / or boxes Figure 1 The function specified in one or more boxes.

[0223] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing the instructions executed on the computer or other programmable device for implementing the process. Figure 1 a process or multiple processes and / or boxes Figure 1 The steps for the function specified in one or more boxes.

[0224] Obviously, those skilled in the art may make various changes and modifications to this application without departing from the spirit and scope of this application. Thus, if these modifications and variations of this application fall within the scope of the claims of this application and their equivalents, this application is intended to include these modifications and variations.

Claims

1. A terminal device, characterized in that: The terminal device includes: a display, wherein the display is used to display a target image; A processor configured to execute: If a display operation is received, obtaining an image to be displayed corresponding to the display operation; Determining the text area and image area in the image using a pre-trained target model; Adjusting pixel values of pixels located on the text in the text area to a first preset value, adjusting other pixel values in the text area to a second preset value, performing contrast stretching on the image area in the image using a contrast-limited histogram equalization algorithm, obtaining a target image after processing, and controlling the display to display the target image; The processor is specifically configured to execute: The position information of each text line in the image is determined by a pre-trained first target model; for each text line in the image, the vertical spacing between the text line and each other text line is determined, and the text line with a vertical spacing less than a first preset threshold between the text line and the text line is determined to be the target text line, and the target text line is determined to be the text line adjacent to the text line. For the target text line, it is continuously determined whether there are other text lines adjacent to the target text line until there are no adjacent text lines. A text area is determined based on the text line, the target text line and the text lines adjacent to the target text line, and the area outside the text area is determined as the image area.

2. The terminal device according to claim 1, wherein: The processor is specifically configured to execute: A triangle binarization algorithm or an Otsu OTST binarization algorithm is used to adjust the pixel values of the pixels located on the text in the text area to a first preset value, and the pixel values of other pixels in the text area are adjusted to a second preset value.

3. The terminal device according to claim 1, wherein: The processor is further configured to execute: A bilateral filtering algorithm or a three-dimensional block matching filtering BM3D algorithm is used to filter the text area in the image.

4. The terminal device according to claim 1, wherein: The processor is specifically configured to execute: If the identification display operation carries a sliding direction and a sliding distance, determining whether the sliding distance is greater than a preset distance value; If so, the image to be displayed is determined according to the currently displayed image, the sliding direction and the sliding distance.

5. The terminal device according to claim 4, characterized in that The processor is specifically configured to execute: If the sliding distance is less than a preset distance value, determining a complete image to be displayed based on the currently displayed image, the sliding direction, and the sliding distance, determining images that are different from and the same as the currently displayed image in the complete image, and using the different images as the images to be displayed; The processor is further configured to execute: The processed target image is combined with the same image to update the target image.

6. A contrast adjustment method, characterized in that: The method comprises: If a display operation is received, obtaining an image to be displayed corresponding to the display operation; Determining the text area and image area in the image using a pre-trained target model; Adjusting pixel values of pixels located on the text in the text area to a first preset value, adjusting other pixel values in the text area to a second preset value, performing contrast stretching on the image area in the image using a contrast-limited histogram equalization algorithm, obtaining a target image after processing, and displaying the target image; The target model completed in advance training determines the text area and image area in the image, including: The position information of each text line in the image is determined by a pre-trained first target model; for each text line in the image, the vertical spacing between the text line and each other text line is determined, and the text line with a vertical spacing less than a first preset threshold between the text line and the text line is determined to be the target text line, and the target text line is determined to be the text line adjacent to the text line. For the target text line, it is continuously determined whether there are other text lines adjacent to the target text line until there are no adjacent text lines. A text area is determined based on the text line, the target text line and the text lines adjacent to the target text line, and the area outside the text area is determined as the image area.

7. A contrast adjustment device, characterized in that: The device comprises: A receiving and obtaining module, configured to obtain an image to be displayed corresponding to a display operation if a display operation is received; A determination module, configured to determine a text area and an image area in the image using a pre-trained target model; a processing module, configured to adjust pixel values of pixels located on the text in the text area to a first preset value, adjust other pixel values in the text area to a second preset value, perform contrast stretching on the image area in the image using a contrast-limited histogram equalization algorithm, obtain a target image after the processing, and control a display to display the target image; Among them, the determination module is specifically used to determine the position information of each text line in the image through a first target model that has been pre-trained; for each text line in the image, determine the vertical spacing between the text line and each other text line, determine the text line whose vertical spacing with the text line is less than a first preset threshold as the target text line, determine the target text line as the text line adjacent to the text line, continue to judge for the target text line whether there are other text lines adjacent to the target text line, until there are no adjacent text lines, determine a text area based on the text line, the target text line and the text lines adjacent to the target text line, and determine the area outside the text area as the image area.

8. A computer-readable storage medium, characterized in that The device stores a computer program, which, when executed by a processor, implements the steps of the contrast adjustment method according to claim 6.

Citation Information

Patent Citations

  • Text enhancement method and device, computer device, and readable storage medium

    CN107424137A

  • Image adjusting method and terminal thereof

    CN109996017A

  • Interface color adjustment method and apparatus, and webpage color adjustment method and apparatus

    WO2017152762A1