A method for matching picture background and text color and related device
By configuring text in the background area of the picture cover, the text color is the target color and there is a projection, the aesthetic problem of similar text and background color is solved, and a more readable text display effect is achieved.
Patent Information
- Application Number
- CN202311866222.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-12-29
- Publication Date
- 2025-02-21
- Estimated Expiration
- 2043-12-29
AI Technical Summary
When configuring the text color on the cover of the picture, the text can easily lead to the text color similar to the background color, resulting in the title being unclear and not beautiful.
By obtaining the brightness difference between pixels in the background area of the picture, if it is greater than the preset threshold, then configuring text in the background area so that the text color is the target color and there is a projection to highlight the text.
Effectively highlighting text, making it easier for users to see the text content clearly, and solves the aesthetic problem of similar text and background colors.
Smart Images

Figure CN118446882B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer technology, and in particular to a method for matching image background and text colors and a related device. Background Art
[0002] Configuring text on the cover of an image is used in many scenarios. On the one hand, it can declare the theme of the cover, and on the other hand, it can also improve the visual effect to a certain extent. The current process of configuring text on the cover is as follows: color the area that needs an artistic title, that is, the region of interest (ROI), to obtain the ROI color tone that meets the Google palette (Palatte) standard, and then convert the obtained ROI color tone into the HSV color model to obtain the HSV color palette corresponding to the ROI, and use the color with the largest number of pixels in the HSV color palette as the main color tone; then determine the color of the text configured in the ROI area based on the main color tone. However, using this method, the title on the cover of the image and the background of the cover of the image will both be the target color. In this case, the cover image title is unclear and unsightly. Summary of the invention
[0003] The embodiment of the present application provides a method and related device for adapting the color of a picture background and text, which can highlight the effect of a first text displayed on a second image, allowing a user to more clearly see the content of the first text.
[0004] In a first aspect, an embodiment of the present application provides a method for adapting the background and text colors of an image, the method comprising:
[0005] Acquire a brightness V difference between pixels in a background area of the first image, wherein the background area includes an area for configuring a first text, and the first text corresponds to an initial brightness V and a saturation S;
[0006] When the brightness V difference between the pixels in the background area is greater than a first preset threshold, the first text is arranged in the background area of the first image, and a second image is generated, so that the color of the first text in the second image is the target color and the first text has a projection on the second image;
[0007] The second image is displayed.
[0008] In this method, when configuring text for the first image, the brightness of the background area in the first image is fully considered. When the brightness V difference between pixel points is greater than a first preset threshold, the color fluctuation presented by the background area is relatively large, which is not conducive to the user to see the text content configured in the background area. Therefore, the first text is configured in the background area of the first image. When generating the second image, the text is designed so that the color of the first text in the second image is the target color and the first text has a projection on the second image; the first text can be more prominent, making it easier for the user to observe the position of the first text and the specific content of the first text.
[0009] In combination with the first aspect, in a possible implementation manner of the first aspect, the present invention further includes:
[0010] When the brightness V difference between the pixels in the background area is less than the first preset threshold, if the average saturation S of the background area is greater than the second preset threshold and the average brightness V is greater than the third preset threshold, perform the following operations:
[0011] Performing reverse enhancement processing on the brightness V and saturation S of the first text to obtain an updated first text;
[0012] When the saturation S of the updated first text is within a first preset range and the brightness V of the updated first text is within a second preset range, the updated first text is arranged in a background area of the first image to generate a second image.
[0013] In this implementation, the brightness V and saturation S of the first text are reversely enhanced so that the first text is more prominent in the background, so the user can more easily observe the position of the first text and the specific content of the first text.
[0014] In combination with the first aspect, or any one of the foregoing possible implementations of the first aspect, in another possible implementation of the first aspect, the performing reverse enhancement processing on the brightness and saturation S of the first text includes:
[0015] If the average brightness V of the background area is less than the fourth preset threshold, the brightness V of the first text is added with the fifth preset threshold, and the saturation S of the first text is subtracted with the sixth preset threshold;
[0016] or,
[0017] If the average brightness V of the background area is greater than the fourth preset threshold, the fifth preset threshold is subtracted from the brightness V of the first text, and the sixth preset threshold is added to the saturation S of the first text.
[0018] In combination with the first aspect, or any of the foregoing possible implementations of the first aspect, in another possible implementation of the first aspect, the following further includes:
[0019] If the average saturation S of the background area is less than the second preset threshold or the average brightness V is less than the third preset threshold, the first text is arranged in the background area of the first image to generate a second image so that the color of the first text in the second image is the target color and the first text has a projection on the second image.
[0020] In this implementation, if the average saturation S of the background area is less than the second preset threshold or the average brightness V is less than the third preset threshold, it indicates that the background area does not have a color tendency. Therefore, setting the first text to the target color (such as white) can highlight the display effect of the first text, making it easier for users to observe the position of the first text and the specific content of the first text.
[0021] In combination with the first aspect, or any of the foregoing possible implementations of the first aspect, in another possible implementation of the first aspect, the following further includes:
[0022] When the saturation S of the updated first text is not within the first preset range or the brightness V of the updated first text is not within the second preset range, the first text is arranged in the background area of the first image, and a second image is generated, so that the color of the first text in the second image is the target color and the first text has a projection on the second image.
[0023] In this implementation, when the saturation S of the updated first text is not within the first preset range or the brightness V of the updated first text is not within the second preset range, it means that the updated first text will not be too prominent compared to the background, and therefore the updated first text cannot be displayed directly, but the target color is directly displayed with a projection.
[0024] In combination with the first aspect, or any of the foregoing possible implementations of the first aspect, in another possible implementation of the first aspect, the following further includes:
[0025] When the color complexity of the background area does not exceed a preset level, the brightness V difference between the pixels in the background area is compared with the first preset threshold.
[0026] In combination with the first aspect, or any of the foregoing possible implementations of the first aspect, in another possible implementation of the first aspect, the following further includes:
[0027] When the color complexity of the background area exceeds a preset level, the first text is arranged in the background area of the first image to generate a second image so that the color of the first text in the second image is the target color and the first text has a projection on the second image.
[0028] It can be understood that when the background area is relatively complex, the background color is likely to be the same or similar to the first text color with many discontinuous occurrences, causing the first text to appear to be integrated with the background area and difficult to distinguish. Therefore, the first text is directly displayed as the target color with a projection to clearly distinguish it from the background area.
[0029] In combination with the first aspect, or any of the foregoing possible implementations of the first aspect, in another possible implementation of the first aspect, the following further includes:
[0030] Performing Gaussian blur processing on the background area to obtain a reference area;
[0031] Determine the variance value between the background area and the reference area. If the variance value is greater than a preset reference value, the color complexity of the background area exceeds the preset level. If the variance value is less than the preset reference value, the color complexity of the background area does not exceed the preset level.
[0032] In combination with the first aspect, or any of the foregoing possible implementations of the first aspect, in another possible implementation of the first aspect, the following further includes:
[0033] When the proportion of pixels in the background area whose brightness is greater than the preset brightness value does not exceed the preset proportion, the brightness V difference between the pixels in the background area is compared with the first preset threshold.
[0034] In combination with the first aspect, or any of the foregoing possible implementations of the first aspect, in another possible implementation of the first aspect, the following further includes:
[0035] When the proportion of pixels in the background area whose brightness is greater than a preset brightness value exceeds a preset proportion, the first text is arranged in the background area of the first image, and a second image is generated so that the color of the first text in the second image is the target color and the first text has a projection on the second image.
[0036] It can be understood that when the proportion of pixels in the background area with brightness greater than the preset brightness value exceeds the preset proportion, the background color is likely to overlap with the first text color, causing the first text to appear partially integrated with the background area and difficult to distinguish. Therefore, the first text is directly displayed as the target color with a projection, so as to be clearly distinguished from the background area.
[0037] In combination with the first aspect, or any of the foregoing possible implementations of the first aspect, in another possible implementation of the first aspect, the following further includes:
[0038] When the saturation of the background area is not equal to 0, the brightness V difference between the pixels of the background area is compared with the first preset threshold.
[0039] In combination with the first aspect, or any of the foregoing possible implementations of the first aspect, in another possible implementation of the first aspect, the following further includes:
[0040] When the saturation of the background area is equal to 0, adding or subtracting a fifth preset threshold value from the brightness V of the first text to obtain an updated first text;
[0041] The updated first text is arranged in the background area of the first image to generate a second image.
[0042] It can be understood that adding or subtracting the fifth preset threshold value to the brightness V of the first text can enhance the display difference between the first text and the background area, thereby making it easier to identify the first text from the background area.
[0043] In combination with the first aspect, or any one of the foregoing possible implementations of the first aspect, in another possible implementation of the first aspect, if the color of the updated first text is the target color, the first text has a projection on the second image.
[0044] In combination with the first aspect, or any one of the above possible implementations of the first aspect, in another possible implementation of the first aspect, the brightness V difference between the pixel points includes the brightness difference between the m pixels with the largest brightness and the m pixels with the smallest brightness in the background area, where m is an integer.
[0045] In a second aspect, an embodiment of the present application provides an electronic device, the electronic device comprising: one or more processors; a memory; wherein the memory is coupled to the one or more processors, the memory is used to store computer program code, the computer program code comprises computer instructions, and the one or more processors call the computer instructions to enable the electronic device to execute the image background and text color adaptation method described in the first aspect or any possible implementation of the first aspect.
[0046] In a third aspect, the present application provides a chip or a chip system, the chip or chip system includes at least one processor and a communication interface, the communication interface and the at least one processor are interconnected by a line, and the at least one processor is used to run a computer program or instruction to execute the image background and text color adaptation method described in the first aspect or any possible implementation of the first aspect. Among them, the communication interface in the chip can be an input / output interface, a pin or a circuit, etc.
[0047] In a possible implementation, the chip or chip system described above in the embodiment of the present application further includes at least one memory, in which instructions are stored. The memory may be a storage unit inside the chip, such as a register, a cache, etc., or a storage unit of the chip (e.g., a read-only memory, a random access memory, etc.).
[0048] In a fourth aspect, an embodiment of the present application provides a computer storage medium, which stores a computer program. When the computer program is executed by a processor, the computer executes the image background and text color adaptation method described in the first aspect or any possible implementation of the first aspect.
[0049] In a fifth aspect, an embodiment of the present application provides a computer program product, which, when running on a communication device, enables the communication device to execute the image background and text color adaptation method described in the first aspect or any possible implementation of the first aspect.
[0050] It should be understood that the description of technical features, technical solutions, beneficial effects or similar language in this application does not imply that all features and advantages can be realized in any single embodiment. On the contrary, it is understood that the description of features or beneficial effects means that specific technical features, technical solutions or beneficial effects are included in at least one embodiment. Therefore, the description of technical features, technical solutions or beneficial effects in this specification does not necessarily refer to the same embodiment. Furthermore, the technical features, technical solutions and beneficial effects described in the present embodiment can also be combined in any appropriate manner. Those skilled in the art will understand that the embodiment can be realized without one or more specific technical features, technical solutions or beneficial effects of a specific embodiment. In other embodiments, additional technical features and beneficial effects can also be identified in a specific embodiment that does not embody all embodiments. BRIEF DESCRIPTION OF THE DRAWINGS
[0051] The following is an introduction to the drawings used in the embodiments of the present application.
[0052] Figure 1 The hardware structure of the electronic device of the embodiment of the present application is exemplarily shown;
[0053] Figure 2 The software architecture of the electronic device of the embodiment of the present application is exemplarily shown;
[0054] Figure 3 It is a flowchart of a method for matching image background and text color provided in an embodiment of the present application;
[0055] Figure 4 This is a schematic diagram of color brightness and saturation provided in an embodiment of the present application;
[0056] Figure 5 This is a schematic diagram of a first text display effect provided in an embodiment of the present application;
[0057] Figure 6 This is a schematic diagram of a first text display effect provided in an embodiment of the present application;
[0058] Figure 7 This is a schematic diagram of a first text display effect provided in an embodiment of the present application;
[0059] Figure 8 This is a schematic diagram of a first text display effect provided in an embodiment of the present application;
[0060] Fig. 9 This is a schematic diagram of a first text display effect provided in an embodiment of the present application;
[0061] Fig.10 This is a schematic diagram of a first text display effect provided in an embodiment of the present application;
[0062] Fig.11 This is a schematic diagram of a first text display effect provided in an embodiment of the present application;
[0063] Fig.12 It is a structural schematic diagram of a picture background and text color adaptation device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0064] The terms used in the following embodiments of the present application are only for the purpose of describing specific embodiments, and are not intended to be used as limitations to the present application. As used in the specification and appended claims of the present application, the singular expressions "one", "a kind of", "said", "above", "the" and "this" are intended to also include plural expressions, unless there is a clear indication to the contrary in the context. It should also be understood that the term "and / or" used in the present application refers to and includes any or all possible combinations of one or more listed items.
[0065] In the following, the terms "first" and "second" are used for descriptive purposes only and are not to be understood as suggesting or implying relative importance or implicitly indicating the number of the indicated technical features. Thus, a feature defined as "first" or "second" may explicitly or implicitly include one or more of the features, and in the description of the embodiments of the present application, unless otherwise specified, "plurality" means two or more.
[0066] Exemplarily, the electronic device in the embodiments of the present application may be a smart screen device, a smart television (television, TV), a mobile phone, a tablet computer, an ultra-mobile personal computer (UMPC), a netbook, as well as a cellular phone, a personal digital assistant (PDA), a wearable device (such as a smart watch, a smart bracelet), and other devices with a shooting function. The embodiments of the present application do not impose any special restrictions on the specific form of the electronic device.
[0067] For example, taking the electronic device as a mobile phone, Figure 1 is a schematic diagram of the structure of an electronic device 100 provided in an embodiment of the present application. That is, exemplary, Figure 1 The electronic device shown may be a mobile phone.
[0068] like Figure 1As shown, the electronic device 100 may include a processor 110, an external memory interface 120, an internal memory 129, a universal serial bus (USB) interface 130, a charging management module 140, a power management module 141, a battery 142, an antenna 1, an antenna 2, a mobile communication module 150, a wireless communication module 160, an audio module 170, a speaker 170A, a receiver 170B, a microphone 170C, an earphone interface 170D, a sensor module 180, a button 190, a motor 191, an indicator 192, a camera 193, a display screen 194, and a subscriber identification module (SIM) card interface 195, etc. The sensor module 180 may include a pressure sensor 180A, a gyroscope sensor 180B, an air pressure sensor 180C, a magnetic sensor 180D, an acceleration sensor 180E, a distance sensor 180F, a proximity light sensor 180G, a fingerprint sensor 180H, a temperature sensor 180J, a touch sensor 180K, an ambient light sensor 180L, a bone conduction sensor 180M, etc.
[0069] It is to be understood that the structure illustrated in the embodiment of the present application does not constitute a specific limitation on the electronic device 100. In other embodiments of the present application, the electronic device 100 may include more or fewer components than shown in the figure, or combine some components, or split some components, or arrange the components differently. The components shown in the figure may be implemented in hardware, software, or a combination of software and hardware.
[0070] The processor 110 may include one or more processing units, for example, the processor 110 may include an application processor (AP), a modem processor, a graphics processor (GPU), an image signal processor (ISP), a controller, a video codec, a digital signal processor (DSP), a baseband processor, and / or a neural-network processing unit (NPU), etc. Different processing units may be independent devices or integrated into one or more processors.
[0071] The controller generates an operation control signal based on the instruction operation code and timing signal to complete the control of instruction fetching and execution.
[0072] The processor 110 may also be provided with a memory for storing instructions and data. In some embodiments, the memory in the processor 110 is a cache memory. The memory may store instructions or data that the processor 110 has just used or cyclically used. If the processor 110 needs to use the instruction or data again, it may be directly called from the memory. This avoids repeated access, reduces the waiting time of the processor 110, and thus improves the efficiency of the system.
[0073] In some embodiments, the processor 110 may include one or more interfaces. The interface may include an inter-integrated circuit (I2C) interface, an inter-integrated circuit sound (I2S) interface, a pulse code modulation (PCM) interface, a universal asynchronous receiver / transmitter (UART) interface, a mobile industry processor interface (MIPI), a general-purpose input / output (GPIO) interface, a subscriber identity module (SIM) interface, and / or a universal serial bus (USB) interface, etc.
[0074] The I2C interface is a bidirectional synchronous serial bus, including a serial data line (SDA) and a serial clock line (SCL). In some embodiments, the processor 110 may include multiple groups of I2C buses. The processor 110 may be coupled to the touch sensor 180K, the charger, the flash, the camera 193, etc. through different I2C bus interfaces. For example: the processor 110 may be coupled to the touch sensor 180K through the I2C interface, so that the processor 110 communicates with the touch sensor 180K through the I2C bus interface, thereby realizing the touch function of the electronic device 100.
[0075] The I2S interface can be used for audio communication. In some embodiments, the processor 110 can include multiple I2S buses. The processor 110 can be coupled to the audio module 170 via the I2S bus to achieve communication between the processor 110 and the audio module 170. In some embodiments, the audio module 170 can transmit an audio signal to the wireless communication module 160 via the I2S interface to achieve the function of answering a call through a Bluetooth headset.
[0076] The PCM interface can also be used for audio communication, sampling, quantizing and encoding analog signals. In some embodiments, the audio module 170 and the wireless communication module 160 can be coupled via a PCM bus interface. In some embodiments, the audio module 170 can also transmit audio signals to the wireless communication module 160 via the PCM interface to realize the function of answering calls via a Bluetooth headset. Both the I2S interface and the PCM interface can be used for audio communication.
[0077] The UART interface is a universal serial data bus for asynchronous communication. The bus can be a bidirectional communication bus. It converts the data to be transmitted between serial communication and parallel communication. In some embodiments, the UART interface is generally used to connect the processor 110 and the wireless communication module 160. For example, the processor 110 communicates with the Bluetooth module in the wireless communication module 160 through the UART interface to implement the Bluetooth function. In some embodiments, the audio module 170 can transmit an audio signal to the wireless communication module 160 through the UART interface to implement the function of playing music through a Bluetooth headset.
[0078] The MIPI interface can be used to connect the processor 110 with peripheral devices such as the display screen 194 and the camera 193. The MIPI interface includes a camera serial interface (CSI), a display serial interface (DSI), etc. In some embodiments, the processor 110 and the camera 193 communicate via the CSI interface to implement the shooting function of the electronic device 100. The processor 110 and the display screen 194 communicate via the DSI interface to implement the display function of the electronic device 100.
[0079] The GPIO interface can be configured by software. The GPIO interface can be configured as a control signal or as a data signal. In some embodiments, the GPIO interface can be used to connect the processor 110 with the camera 193, the display 194, the wireless communication module 160, the audio module 170, the sensor module 180, etc. The GPIO interface can also be configured as an I2C interface, an I2S interface, a UART interface, a MIPI interface, etc.
[0080] The USB interface 130 is an interface that complies with the USB standard specification, and can be a Mini USB interface, a Micro USB interface, a USB Type C interface, etc. The USB interface 130 can be used to connect a charger to charge the electronic device 100, and can also be used to transfer data between the electronic device 100 and a peripheral device. It can also be used to connect headphones to play audio through the headphones. The interface can also be used to connect other terminal devices, such as AR devices, etc.
[0081] It is understandable that the interface connection relationship between the modules illustrated in the embodiment of the present application is only a schematic illustration and does not constitute a structural limitation on the electronic device 100. In other embodiments of the present application, the electronic device 100 may also adopt different interface connection methods in the above embodiments, or a combination of multiple interface connection methods.
[0082] The charging management module 140 is used to receive charging input from a charger. The charger may be a wireless charger or a wired charger. In some wired charging embodiments, the charging management module 140 may receive charging input from a wired charger through the USB interface 130. In some wireless charging embodiments, the charging management module 140 may receive wireless charging input through a wireless charging coil of the electronic device 100. While the charging management module 140 is charging the battery 142, it may also power the terminal device through the power management module 141.
[0083] The power management module 141 is used to connect the battery 142, the charging management module 140 and the processor 110. The power management module 141 receives input from the battery 142 and / or the charging management module 140, and supplies power to the processor 110, the internal memory 129, the display screen 194, the camera 193, and the wireless communication module 160. The power management module 141 can also be used to monitor parameters such as battery capacity, battery cycle number, battery health status (leakage, impedance), etc. In some other embodiments, the power management module 141 can also be set in the processor 110. In other embodiments, the power management module 141 and the charging management module 140 can also be set in the same device.
[0084] The wireless communication function of the electronic device 100 can be implemented through the antenna 1, the antenna 2, the mobile communication module 150, the wireless communication module 160, the modem processor and the baseband processor.
[0085] Antenna 1 and antenna 2 are used to transmit and receive electromagnetic wave signals. Each antenna in electronic device 100 can be used to cover a single or multiple communication frequency bands. Different antennas can also be reused to improve the utilization of antennas. For example, antenna 1 can be reused as a diversity antenna for a wireless local area network. In some other embodiments, the antenna can be used in combination with a tuning switch.
[0086] The mobile communication module 150 can provide solutions for wireless communications including 2G / 3G / 4G / 5G, etc., applied to the electronic device 100. The mobile communication module 150 may include at least one filter, a switch, a power amplifier, a low noise amplifier (LNA), etc. The mobile communication module 150 can receive electromagnetic waves from the antenna 1, and filter, amplify, and process the received electromagnetic waves, and transmit them to the modulation and demodulation processor for demodulation. The mobile communication module 150 can also amplify the signal modulated by the modulation and demodulation processor, and convert it into electromagnetic waves for radiation through the antenna 1. In some embodiments, at least some of the functional modules of the mobile communication module 150 can be set in the processor 110. In some embodiments, at least some of the functional modules of the mobile communication module 150 can be set in the same device as at least some of the modules of the processor 110.
[0087] The modem processor may include a modulator and a demodulator. Among them, the modulator is used to modulate the low-frequency baseband signal to be sent into a medium-high frequency signal. The demodulator is used to demodulate the received electromagnetic wave signal into a low-frequency baseband signal. The demodulator then transmits the demodulated low-frequency baseband signal to the baseband processor for processing. After the low-frequency baseband signal is processed by the baseband processor, it is passed to the application processor. The application processor outputs a sound signal through an audio device (not limited to a speaker 170A, a receiver 170B, etc.), or displays an image or video through a display screen 194. In some embodiments, the modem processor may be an independent device. In other embodiments, the modem processor may be independent of the processor 110 and be set in the same device as the mobile communication module 150 or other functional modules.
[0088] The wireless communication module 160 can provide wireless communication solutions including wireless local area networks (WLAN) (such as wireless fidelity (Wi-Fi) networks), bluetooth (BT), global navigation satellite system (GNSS), frequency modulation (FM), near field communication (NFC), infrared (IR), etc., which are applied to the electronic device 100. The wireless communication module 160 can be one or more devices integrating at least one communication processing module. The wireless communication module 160 receives electromagnetic waves via the antenna 2, demodulates and filters the electromagnetic wave signals, and sends the processed signals to the processor 110. The wireless communication module 160 can also receive the signal to be sent from the processor 110, modulate the frequency, amplify it, and convert it into electromagnetic waves for radiation through the antenna 2.
[0089] In some embodiments, the antenna 1 of the electronic device 100 is coupled to the mobile communication module 150, and the antenna 2 is coupled to the wireless communication module 160, so that the electronic device 100 can communicate with the network and other devices through wireless communication technology. The wireless communication technology may include global system for mobile communications (GSM), general packet radio service (GPRS), code division multiple access (CDMA), wideband code division multiple access (WCDMA), time-division code division multiple access (TD-SCDMA), long term evolution (LTE), BT, GNSS, WLAN, NFC, FM, and / or IR technology, etc. GNSS may include the global positioning system (GPS), the global navigation satellite system (GLONASS), the Beidou navigation satellite system (BDS), the quasi-zenith satellite system (QZSS) and / or the satellite based augmentation system (SBAS).
[0090] The electronic device 100 implements the display function through a GPU, a display screen 194, and an application processor. The GPU is a microprocessor for image processing, which connects the display screen 194 and the application processor. The GPU is used to perform mathematical and geometric calculations for graphics rendering. The processor 110 may include one or more GPUs that execute program instructions to generate or change display information.
[0091] The display screen 194 is used to display images, videos, etc. The display screen 194 includes a display panel. The display panel can be a liquid crystal display (LCD), an organic light-emitting diode (OLED), an active-matrix organic light-emitting diode or an active-matrix organic light-emitting diode (AMOLED), a flexible light-emitting diode (FLED), Miniled, MicroLed, Micro-oLed, a quantum dot light-emitting diode (QLED), etc. In some embodiments, the electronic device 100 may include 1 or N display screens 194, where N is a positive integer greater than 1.
[0092] The electronic device 100 can realize the shooting function through ISP, camera 193, video codec, GPU, display screen 194 and application processor.
[0093] The ISP is used to process the data fed back by the camera 193. For example, when taking a photo, the shutter is opened, and the light is transmitted to the camera photosensitive element through the lens. The light signal is converted into an electrical signal, and the camera photosensitive element transmits the electrical signal to the ISP for processing and converts it into an image visible to the naked eye. The ISP can also perform algorithm optimization on the noise and brightness of the image. The ISP can also optimize the exposure, color temperature and other parameters of the shooting scene. In some embodiments, the ISP can be set in the camera 193.
[0094] The camera 193 is used to capture still images or videos. The object generates an optical image through the lens and projects it onto the 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, and then passes the electrical signal to the ISP to be converted into a digital image signal. The ISP outputs the digital image signal to the DSP for processing. The DSP converts the digital image signal into an image signal in a standard RGB, YUV or other format. In some embodiments, the electronic device 100 may include 1 or N cameras 193, where N is a positive integer greater than 1.
[0095] The digital signal processor is used to process digital signals, and can process not only digital image signals but also other digital signals. For example, when the electronic device 100 selects a frequency point, the digital signal processor is used to perform Fourier transform on the frequency point energy.
[0096] Video codecs are used to compress or decompress digital videos. The electronic device 100 may support one or more video codecs. Thus, the electronic device 100 may play or record videos in a variety of coding formats, such as Moving Picture Experts Group (MPEG) 1, MPEG2, MPEG3, MPEG4, etc.
[0097] NPU is a neural network (NN) computing processor. By drawing on the structure of biological neural networks, such as the transmission mode between neurons in the human brain, it can quickly process input information and can also continuously self-learn. Through NPU, applications such as intelligent cognition of electronic device 100 can be realized, such as image recognition, face recognition, voice recognition, text understanding, etc.
[0098] The internal memory 129 may include one or more random access memories (RAM) and one or more non-volatile memories (NVM).
[0099] Random access memory may include static random-access memory (SRAM), dynamic random access memory (DRAM), synchronous dynamic random access memory (SDRAM), double data rate synchronous dynamic random access memory (DDR SDRAM, for example, the fifth generation DDR SDRAM is generally referred to as DDR5 SDRAM), etc.; non-volatile memory may include disk storage devices and flash memory.
[0100] Flash memory can be divided into NOR FLASH, NAND FLASH, 3D NAND FLASH, etc. according to the operating principle; single-level cell (SLC), multi-level cell (MLC), triple-level cell (TLC), quad-level cell (QLC), etc. according to the storage unit potential level; universal flash storage (UFS), embedded multi media card (eMMC), etc. according to the storage specification.
[0101] The random access memory can be directly read and written by the processor 110, and can be used to store executable programs (such as machine instructions) of the operating system or other running programs, and can also be used to store user and application data.
[0102] The non-volatile memory may also store executable programs and user and application data, etc., and may be loaded into the random access memory in advance for direct reading and writing by the processor 110 .
[0103] The external memory interface 120 can be used to connect to an external non-volatile memory to expand the storage capacity of the electronic device 100. The external non-volatile memory communicates with the processor 110 through the external memory interface 120 to implement a data storage function. For example, files such as music and videos are stored in the external non-volatile memory.
[0104] The electronic device 100 can implement audio functions such as music playing and recording through the audio module 170, the speaker 170A, the receiver 170B, the microphone 170C, the headphone jack 170D, and the application processor.
[0105] The audio module 170 is used to convert digital audio information into analog audio signal output, and is also used to convert analog audio input into digital audio signals. The audio module 170 can also be used to encode and decode audio signals. In some embodiments, the audio module 170 can be arranged in the processor 110, or some functional modules of the audio module 170 can be arranged in the processor 110.
[0106] The speaker 170A, also called a "speaker", is used to convert an audio electrical signal into a sound signal. The electronic device 100 can listen to music or listen to a hands-free call through the speaker 170A.
[0107] The receiver 170B, also called a "earpiece", is used to convert audio electrical signals into sound signals. When the electronic device 100 receives a call or voice message, the voice can be received by placing the receiver 170B close to the human ear.
[0108] Microphone 170C, also called "microphone" or "microphone", is used to convert sound signals into electrical signals. When making a call or sending a voice message, the user can speak by approaching the microphone 170C with his mouth to input the sound signal into the microphone 170C.
[0109] The earphone interface 170D is used to connect a wired earphone and can be a USB interface 130 or a 3.5 mm open mobile terminal platform (OMTP) standard interface or a cellular telecommunications industry association of the USA (CTIA) standard interface.
[0110] The pressure sensor 180A is used to sense the pressure signal and can convert the pressure signal into an electrical signal. In some embodiments, the pressure sensor 180A can be disposed on the display screen 194 .
[0111] The gyro sensor 180B may be used to determine the motion posture of the electronic device 100. In some embodiments, the angular velocity of the electronic device 100 around three axes (ie, x, y, and z axes) may be determined by the gyro sensor 180B.
[0112] The air pressure sensor 180C is used to measure air pressure. In some embodiments, the electronic device 100 calculates the altitude through the air pressure value measured by the air pressure sensor 180C to assist positioning and navigation.
[0113] The magnetic sensor 180D includes a Hall sensor.
[0114] The acceleration sensor 180E can detect the magnitude of the acceleration of the electronic device 100 in various directions (generally three axes).
[0115] The distance sensor 180F is used to measure the distance. The electronic device 100 can measure the distance by infrared or laser. In some embodiments, when shooting a scene, the electronic device 100 can use the distance sensor 180F to measure the distance to achieve fast focusing.
[0116] The proximity light sensor 180G may include, for example, a light emitting diode (LED) and a light detector such as a photodiode.
[0117] The ambient light sensor 180L is used to sense the brightness of the ambient light. The electronic device 100 can adaptively adjust the brightness of the display screen 194 according to the sensed brightness of the ambient light.
[0118] The fingerprint sensor 180H is used to collect fingerprints. The electronic device 100 can use the collected fingerprint characteristics to implement fingerprint unlocking, access application locks, fingerprint photography, fingerprint call answering, etc.
[0119] The temperature sensor 180J is used to detect temperature. In some embodiments, the electronic device 100 uses the temperature detected by the temperature sensor 180J to execute a temperature processing strategy.
[0120] The touch sensor 180K is also called a "touch control device". The touch sensor 180K can be set on the display screen 194. The touch sensor 180K and the display screen 194 form a touch screen, also called a "touch control screen". The touch sensor 180K is used to detect touch operations acting on or near it. The touch sensor can pass the detected touch operation to the application processor to determine the type of touch event. Visual output related to the touch operation can be provided through the display screen 194. In other embodiments, the touch sensor 180K can also be set on the surface of the electronic device 100, which is different from the position of the display screen 194.
[0121] The bone conduction sensor 180M can obtain a vibration signal. In some embodiments, the bone conduction sensor 180M can obtain a vibration signal of a vibrating bone block of a human vocal part.
[0122] The buttons 190 include a power button, a volume button, etc. The buttons 190 may be mechanical buttons or touch buttons.
[0123] Motor 191 can generate vibration prompts. Motor 191 can be used for incoming call vibration prompts and can also be used for touch vibration feedback.
[0124] The indicator 192 may be an indicator light, which may be used to indicate the charging status, power changes, messages, missed calls, notifications, etc.
[0125] The SIM card interface 195 is used to connect a SIM card. The SIM card can be connected to or disconnected from the electronic device 100 by inserting the SIM card interface 195 or removing the SIM card from the SIM card interface 195 .
[0126] The software system of an electronic device (such as a mobile phone) can adopt a layered architecture, a transaction-driven architecture, a micro-kernel architecture, a micro-service architecture, or a cloud architecture. This application embodiment takes the Android system with a layered architecture as an example to illustrate the software architecture of a mobile phone. Figure 2 , Figure 2 It is a schematic diagram of the software architecture of the electronic device provided in the embodiment of the present application.
[0127] The layered architecture divides the software into several layers, each with clear roles and division of labor. The layers communicate with each other through software interfaces. In some embodiments, the Android system is divided into five layers, from top to bottom, namely, the application layer, the application framework layer (frame), the system library, and the kernel layer.
[0128] The application layer can include a series of application packages.
[0129] like Figure 2 As shown, the applications may include gallery, video, call, message, memo, file, navigation, Bluetooth, browser and other applications.
[0130] The call application is a call application. When the call application is turned on, the user can make a call through the electronic device. The electronic device can determine that the audio scene is a voice call scene according to the running application. For example, in response to the user's operation of answering a call on the phone application, the phone application can determine that the call is connected through the phone manager of the application framework layer. Then, the phone manager can call the audio hardware abstraction of the abstract layer to start the hardware involved in the call process such as the microphone, the receiver, and the screen sound device, so that the electronic device starts the call application, and the user can start the call.
[0131] By opening music applications and video applications, users can play audio through electronic devices, and the electronic devices can determine the audio scene as an audio file playback scene based on the running application. For example, in response to the user's operation of playing a music file on a music application, the music application can determine the audio file through the audio playback management service of the application framework layer. Then, the audio playback management service can call the audio hardware of the abstract layer to start the hardware involved in the music playback process such as speakers and earpieces, so that the electronic device starts the music application and starts playing the music file.
[0132] Optionally, the image background and text color adaptation method in the embodiment of the present application can be implemented at the application layer, and specifically, corresponding algorithms and program codes can be configured to implement the method.
[0133] The application framework layer provides an application programming interface (API) and a programming framework for the applications in the application layer. The application framework layer includes some predefined functions.
[0134] Therefore, the electronic device can determine the output device scenario through the application and the application framework layer.
[0135] like Figure 2As shown, the application framework layer is provided with an audio playback management service and a phone manager. The audio playback management service can be used to initialize the audio player, obtain the volume of the current audio file, adjust the audio playback volume, add sound effects, etc. The phone manager is used to provide communication functions for electronic devices, such as the management of call status (including connected, hung up, etc.).
[0136] In addition, the application framework layer may also include a window manager, a content provider, a view system, a resource manager, a notification manager, an input manager, and the like.
[0137] The window manager is used to manage window programs. The window management service can obtain the size of the display screen, determine whether there is a status bar, lock the screen, capture the screen, etc. The above-mentioned content provision service is used to store and obtain data and make these data accessible to applications. The data may include video, images, audio, calls made and received, browsing history and bookmarks, phone books, etc. The above-mentioned view system can be used to build the display interface of the application. Each display interface can be composed of one or more controls. Generally speaking, controls can include icons, buttons, menus, tabs, text boxes, dialog boxes, status bars, navigation bars, widgets, and other interface elements. The above-mentioned resource management service provides various resources for applications, such as localized strings, icons, pictures, layout files, video files, etc. The above-mentioned notification management service enables applications to display notification information in the status bar, which can be used to convey notification-type messages and can disappear automatically after a short stay without user interaction. For example, the notification management service is used to notify download completion, message reminders, etc. The notification manager can also be a notification that appears in the system top status bar in the form of a chart or scroll bar text, such as a notification of an application running in the background, or a notification that appears on the screen in the form of a dialog window. For example, displaying text messages in the status bar, making beep sounds, vibrating, or flashing indicator lights, etc.
[0138] The system library includes surface manager, 3D graphics processing library, 2D graphics engine, media library, rendering module, etc.
[0139] The kernel layer is a layer between hardware and software, which includes drivers for various hardware. The kernel layer may include camera drivers, display drivers, audio drivers, sensor drivers, digital signal processor drivers, and image processor drivers. Among them, the camera driver is used to drive the image sensor of one or more cameras in the camera to collect images and drive the image signal processor to pre-process the image. The digital signal processor driver is used to drive the digital signal processor to process images. The image processor driver is used to drive the graphics processor to process images.
[0140] The term "user interface (UI)" in the specification, claims and drawings of this application refers to the medium interface for interaction and information exchange between an application or operating system and a user, which realizes the conversion between the internal form of information and the form acceptable to the user. The user interface of an application is source code written in a specific computer language such as Java and extensible markup language (XML). The interface source code is parsed and rendered on the terminal device, and finally presented as content that the user can recognize, such as pictures, text, buttons and other controls. Controls, also known as widgets, are the basic elements of the user interface. Typical controls include toolbars, menu bars, text boxes, buttons, scroll bars, pictures and text. The properties and contents of controls in the interface are defined by tags or nodes, such as XML through <textview> 、 <imgview> 、 <videoview>The controls contained in the interface are specified by nodes such as . A node corresponds to a control or attribute in the interface. After parsing and rendering, the node is presented as user-visible content. In addition, many applications, such as hybrid applications, usually also contain web pages in their interfaces. A web page, also known as a page, can be understood as a special control embedded in the application interface. A web page is source code written in a specific computer language, such as hypertext markup language (HTML), cascading style sheets (CSS), JavaScript (JS), etc. The web page source code can be loaded and displayed as user-recognizable content by a browser or a web page display component with similar functions to a browser. The specific content contained in a web page is also defined by tags or nodes in the web page source code. For example, HTML is defined by 、 、 <video> 、 <canvas>To define the elements and attributes of a web page.
[0141] The most common form of user interface is graphical user interface (GUI), which refers to a user interface related to computer operation that is displayed in a graphical manner. It can be an icon, window, control or other interface element displayed on the display screen of an electronic device, where a control can include icons, buttons, menus, tabs, text boxes, dialog boxes, status bars, navigation bars, widgets and other visual interface elements.
[0142] See also Figure 3 , Figure 3 is a flow chart of a method for matching the background and text colors of an image provided by an embodiment of the present application. The method can be based on Figure 1 The hardware architecture of the electronic device shown and / or Figure 2 The method is implemented based on the software architecture of the electronic device shown in the figure, and can also be implemented based on other architectures. The method includes but is not limited to the following steps:
[0143] Step S301: the electronic device obtains a brightness V difference between pixel points in a background area of a first image.
[0144] In many image applications, such as applications with image editing, image display and other functions, an image can be used as the cover image of an image collection (such as an album). Corresponding text will be displayed on the cover image to describe the theme or main information of the image collection corresponding to the cover image. For example, the theme may include one or more of "birthday", "travel", "on the road", "at the beach", etc. The main information may be the shooting location of the image collection, such as city A, city B, scenic spot C, scenic spot D, etc. Of course, it is not limited to the shooting location, as long as it can reflect some characteristics of the image collection.
[0145] Of course, the cover image may not have a corresponding image set. It only represents the characteristics of the cover image itself, not the characteristics of the image set.
[0146] In an embodiment of the present application, the first image may be the cover image mentioned above, and a portion of the first image is used as a background area, which is an area for configuring a first text, and the first text is used to describe the characteristics of the first image or the image set corresponding to the first image (such as theme, main information, etc.).
[0147] In the embodiment of the present application, the position of the background area in the first image can be selected by a preset algorithm, or the position of the background area in the first image can be manually specified, which is not limited here. The content of the first text can also be determined by a corresponding algorithm or manually determined, which is not limited here. Among them, the first text corresponds to an initial brightness V and saturation S, and optionally, it can also correspond to an initial hue H, such as blue, yellow, red, etc.
[0148] In the embodiment of the present application, the brightness V can also be expressed as B. In addition, the value ranges of the brightness V, saturation S and hue H can all be 0 to 255.
[0149] It can be understood that each pixel in the background area corresponds to brightness V, saturation S and hue H. Therefore, the brightness V difference between any two pixels in the background area can be determined. Optionally, the brightness V difference between the pixels in the background area of the first image mentioned above can specifically refer to: obtaining the brightness difference between the m pixels with the largest brightness and the m pixels with the smallest brightness in the background area, where m is an integer, such as 1 or 2 or other values, and the size of m can be set according to needs. For example, from the pixels in the background area, select the pixels whose brightness V ranks in the first m positions, and select the pixels whose brightness V ranks in the last m positions, subtract the sum of the brightness V of the first m pixels from the sum of the brightness V of the last m pixels, and divide the difference by m to obtain the difference, which is the brightness V difference between the pixels in the background area that needs to be calculated.
[0150] It should be noted that this is just one calculation method for the brightness V difference. In fact, there are many other calculation methods, as long as they can reflect the fluctuation range of the brightness of the background area, and no specific limitation is made here.
[0151] It can be understood that the brightness V can also be expressed as B.
[0152] Step S302: the electronic device generates a second image.
[0153] In an embodiment of the present application, a method for generating the second image is determined based on factors such as brightness V, saturation S, hue H, etc. of the background area and / or the first text. For ease of understanding, an example is given below.
[0154] Case 1: When the brightness V difference between the pixels in the background area is greater than the first preset threshold, it indicates that the brightness in the background area fluctuates greatly, so the first text is arranged in the background area of the first image, and a second image is generated, so that the color of the first text in the second image is the target color and the first text is projected on the second image. In the embodiment of the present application, the size of the first preset threshold can be set as needed.
[0155] For example, according to historical experience, when the brightness difference between pixels exceeds 40, it is considered a relatively large fluctuation, so the first preset threshold can be set to 40. When the brightness difference exceeds 50, it is considered a relatively large fluctuation, so the first preset threshold can be set to 50. The specific numerical value is not limited here.
[0156] In addition, when the brightness V difference between the pixel points in the background area is equal to the first preset threshold, this situation can be classified as the situation where the brightness V difference between the pixel points in the background area is greater than the first preset threshold, or it can be classified as the situation where the brightness V difference between the pixel points in the background area is less than the first preset threshold, depending on the specific needs.
[0157] In the embodiment of the present application, the target color can be standard white, or a color close to white (for example, the difference between brightness V, saturation S and white is within a preset range, which can be a very small range), or other lighter colors. What kind of color is lighter can be distinguished by pre-setting a standard threshold.
[0158] Optionally, the projection can also be regarded as a shadow of the first text projected onto the background area, and its shape is similar to the first text, and its color can be the same as or different from the first text, and its size can be smaller than the first text, and of course it can be set according to actual needs. It can be understood that the projection of the first text on the second image can set off the first text, so that the user can perceive or more easily see the existence of the first text and the content of the first text.
[0159] Case 2: When the brightness V difference between the pixels in the background area is less than the first preset threshold:
[0160] A. If the average saturation S of the background area is greater than the second preset threshold and the average brightness V is greater than the third preset threshold, it indicates that the background area has a color tendency. For example, the second preset threshold can be set to 1, and the third preset threshold can be set to 25. The specific setting can be set according to actual needs. Optionally, Figure 4 A color scene is shown. For example, when the brightness V in the color parameter part 401 is 25 and the saturation is 1, the corresponding color code is "#403F3F" 402. The color is at position 403 on the color picker template. Figure 4 The gradual change of color on the color picker template is not illustrated, but those skilled in the art should know from experience that there is a slight color component at position 403, so the second preset threshold can be set to 1, and the third preset threshold can be set to 25 as an optional solution.
[0161] Optionally, the situation where the average saturation S is equal to the second preset threshold can be classified into the situation where the average saturation S is greater than the second preset threshold, or can be classified into the situation where the average saturation S is less than the second preset threshold, and is not limited here; in addition, the situation where the average brightness V is equal to the third preset threshold can be classified into the situation where the average brightness V is greater than the third preset threshold, or can be classified into the situation where the average brightness V is less than the third preset threshold, and is not limited here.
[0162] Optionally, the average saturation S and average brightness V of the background area here may be calculated based on parameters of some sampled pixel points, or may be calculated based on parameters of all pixel points in the background area.
[0163] In the embodiment of the present application, if the background area has a color tendency, the following operations can be performed:
[0164] a1. Perform reverse enhancement processing on the brightness V and saturation S of the first text to obtain an updated first text. Optionally, the reverse enhancement processing may include:
[0165] If the average brightness V of the background area is less than the fourth preset threshold, then the brightness V of the first text is added with the fifth preset threshold, and the saturation S of the first text is subtracted with the sixth preset threshold; or,
[0166] If the average brightness V of the background area is greater than the fourth preset threshold, the fifth preset threshold is subtracted from the brightness V of the first text, and the sixth preset threshold is added to the saturation S of the first text.
[0167] The fourth preset threshold, the fifth preset threshold, and the sixth preset threshold here can be set according to actual needs. For example, the fourth preset threshold is set to 50, the fifth preset threshold is set to 50, and the sixth preset threshold is 25. In addition, the situation where the relevant parameter is equal to the corresponding threshold can be classified as a situation greater than or as a situation less than, depending on actual needs. In the embodiment of the present application, the reverse enhancement processing can increase the color difference between the first text and the background area, thereby facilitating the user to identify the first text from the background area.
[0168] After obtaining the updated first text in the above manner, continue to execute according to the following process:
[0169] (a1-1) When the saturation S of the updated first text is within the first preset range and the brightness V of the updated first text is within the second preset range, the color-related parameters of the first text obtained by the above reverse enhancement process are considered to be valid. The first preset range and the second preset range can be set according to actual needs. For example, the first preset range is set to 10 to 100, and the second preset range is set to 25 to 100. When it is determined that the result of the reverse enhancement is valid, the updated first text is arranged in the background area of the first image to generate a second image.
[0170] For example, if the first preset range is set to 10-100 and the second preset range is set to 25-100, Figure 5 A color is provided, its color number is "#4D2E2E" 502, and its position on the color picker swatch is position 503, Figure 5 The gradual change of color on the color picker template is not illustrated, but those skilled in the art should know the color situation at position 503 based on experience. As shown in parameter part 501, the initial brightness of the first text is 30, and the initial saturation of the first text is 40. For example, after reverse enhancement, the brightness 30 is enhanced by the fifth preset threshold 50 to 80, and the saturation 40 minus the sixth preset threshold 25 is 15. The brightness of the updated first text is 80 and the saturation is 15, and the brightness 80 falls within the second preset range of 25 to 100, and the saturation 15 falls within the first preset range of 10 to 100. Therefore, the updated first text is directly configured in the background area of the first image to generate (or obtain) the second image. If the first text is "Beach Coast", the display effect of the first text on the second image is as shown in text 504 (because the focus here is on the display method of the first text, the background of the second image is not shown).
[0171] (a1-2) When the saturation S of the updated first text is not within the first preset range or the brightness V of the updated first text is not within the second preset range, the color-related parameters of the first text obtained by the above reverse enhancement process are considered invalid, so the first text is then arranged in the background area of the first image to generate a second image, so that the color of the first text in the second image is the target color and the first text has a projection on the second image. The explanation of the target color and the projection can be referred to the previous description, and will not be repeated here or in the following links.
[0172] For example, if the first preset range is set to 10-100 and the second preset range is set to 25-100, Figure 6 A color is provided, with a color number of "#4D3C3C”602 and a position on the color picker template at position 603. Figure 6 The gradual change of colors on the color picker template is not illustrated, but those skilled in the art should know the color situation at position 603 based on experience. As shown in parameter section 601, the initial brightness of the first text is 30, and the initial saturation is 22. For example, in reverse enhancement, when the brightness of 30 is enhanced by the fifth preset threshold of 50, it becomes 80, and when the saturation of 22 is subtracted by the sixth preset threshold of 25, it is -3. The updated brightness of the first text is 80 and the saturation is -3. The brightness of 80 falls within the second preset range of 25 - 100, but the saturation of -3 does not fall within the first preset range of 10 - 100. Therefore, the first text is configured in the background area of the first image to generate a second image, so that the color of the first text in the second image is the target color and the first text has a projection on the second image. If the first text is "beach coast", then the display effect of the first text on the second image is as shown in text 604 (since the focus here is on the display method of the first text, the background of the second image is not shown).
[0173] B. If the average saturation S of the background area is less than the second preset threshold or the average brightness V is less than the third preset threshold, it indicates that the background area does not have a color tendency. Therefore, the first text is configured in the background area of the first image to generate a second image, so that the color of the first text in the second image is the target color and the first text has a projection on the second image.
[0174] In an alternative solution, there may also be a third situation, which is as follows:
[0175] Situation three: Determine the color complexity of the background area. For example, perform Gaussian blur processing on the background area to obtain a reference area; then calculate the variance value between the background area and the reference area. When calculating the variance value, some pixel points in the background area and the reference area can be collected for calculation, or it can be calculated based on all pixel points in the background area and the reference area; optionally, in the specific calculation, the two pixel points being subtracted have the same position in the background area and the reference area.
[0176] In the embodiments of the present application, there are many situations regarding the color complexity of the background area. For example, the color complexity of the entire background area, or the color complexity of the contour part of the position in the background area where the first text is configured.
[0177] In the case where the color complexity of the background area exceeds a preset level, the first text is arranged in the background area of the first image to generate a second image so that the color of the first text in the second image is the target color and the first text is projected on the second image. Optionally, the color complexity can be reflected by the above-mentioned variance value. For example, if the variance value is greater than a preset reference value, the color complexity of the background area exceeds the preset level. If the variance value is less than the preset reference value, the color complexity of the background area does not exceed the preset level. The preset reference value here can be set according to actual needs and is not limited here.
[0178] like Figure 7 As shown, there are many branches in the entire background area 701, and the color complexity is relatively high. Therefore, in the second image finally generated, the first text 702 appears white and has a projection effect.
[0179] like Figure 8 As shown, the color continuity of the outline portion of the position for configuring the first text in the background area 801 is poor, which also belongs to the case of high color complexity. Therefore, in the second image finally generated, the first text 802 appears white and has a projection effect.
[0180] Optionally, when the color complexity of the background area does not exceed the preset level, that is, when the conditions for execution in case three are not met, the brightness V difference between the pixels in the background area is compared with the first preset threshold, and then the above case one or case two is executed, that is, it can be considered that the priority of case three is higher than that of case one and case two.
[0181] In an optional solution, there may also be a fourth situation, which is as follows:
[0182] Case 4: When the proportion of pixels in the background area with brightness greater than a preset brightness value exceeds a preset proportion, the first text is arranged in the background area of the first image, and a second image is generated so that the color of the first text in the second image is the target color and the first text has a projection on the second image.
[0183] Optionally, the size of the preset brightness value can be set as needed. For example, according to historical experience, when the brightness value is greater than 50, it is considered to be relatively bright, so the preset brightness value is set to 50. Of course, it can also be set to other values. Optionally, the size of the preset ratio can be set as needed. For example, it is set to 40%, and of course it can also be set to other values.
[0184] For example, if Fig. 9 As shown, in the background area 901, the desktop is bright (i.e., the brightness is greater than the preset brightness value), the bowl is dark, and the area of the desktop accounts for a proportion of more than a preset proportion (e.g., 40%) in the background area 901. Therefore, the first text is configured in the background area of the first image, and a second image is generated so that the color of the first text in the second image is the target color and the first text is projected on the second image. The presentation effect is as shown in the first text 902.
[0185] Optionally, when the proportion of pixels in the background area whose brightness is greater than the preset brightness value does not exceed the preset proportion, that is, when the condition for execution in case four is not met, the brightness V difference between the pixels in the background area is compared with the first preset threshold value, and then the above case one or case two is executed, that is, it can be considered that the priority of case four is higher than that of case one and case two.
[0186] In yet another optional implementation, there may also be a fifth situation, which is as follows:
[0187] Case 5: When the saturation of the background area is equal to 0, the brightness V of the first text is increased or subtracted by a fifth preset threshold (for example, 50) to obtain an updated first text; the updated first text is configured in the background area of the first image to generate a second image.
[0188] Optionally, if the color of the updated first text is the target color, the first text has a projection on the second image.
[0189] For example, if the fifth preset threshold is set to 50:
[0190] Fig.10 A color is provided, its color number is "#FFFFFF" 1002, and its position on the color picker swatch is position 1003. Fig.10 The gradual change of color on the color picker template is not illustrated, but those skilled in the art should know the color situation at position 1003 based on experience. As shown in parameter part 1001, the initial brightness of the first text is 100, and the brightness 100 minus the fifth preset threshold 50 is 50, and the brightness of the updated first text is 50. Therefore, the updated first text is directly configured in the background area of the first image to generate (or obtain) the second image. If the first text is "Beach Coast", the display effect of the first text on the second image is as shown in text 1004 (because the focus here is on the display method of the first text, the background of the second image is not shown).
[0191] Fig.11 A color is provided, its color number is "#808080" 1102, and its position on the color picker swatch is position 1103, Fig.11 The gradual change of color on the color picker template is not illustrated, but those skilled in the art should know the color situation at position 1103 based on their experience. As shown in parameter part 1101, the initial brightness of the first text is 50, and the brightness of 50 plus the fifth preset threshold 50 is 100, and the brightness of the updated first text is 100. Therefore, the updated first text is directly arranged in the background area of the first image to generate (or obtain) the second image. Since the brightness of the updated first text is 100 and the saturation remains at 0, it is pure white, so a projection effect is required. Therefore, if the first text is "Beach Coast", the display effect of the first text on the second image is as shown in text 1104 (because the focus here is on the display of the first text, the background of the second image is not shown).
[0192] Optionally, when the saturation of the background area is not equal to 0, that is, when the conditions for execution in case five are not met, the brightness V difference between the pixels in the background area is compared with the first preset threshold, and then the above case one or case two is executed, that is, it can be considered that the priority of case five is higher than the above case one and case two.
[0193] In an optional solution, the technical features of the above-mentioned case 1, case 2, case 3, case 4 and case 5 can be combined to obtain a corresponding solution, and the specific selection of which features to combine is not limited here. For example, the technical features of these five cases can be combined together, and optionally, the execution priorities of these cases can be case 5, case 4, case 3, case 1, case 2; optionally, the execution priorities of these cases can also be case 3, case 4, case 5, case 1, case 2; of course, there are other situations in the order of precedence, which are not listed here one by one.
[0194] In the above scheme, many situations are divided around brightness V and saturation S, and different situations correspond to methods of generating the second image. It should be noted that the method of generating the second image in each situation can also be replaced by other methods. The implementation method in each situation mentioned here is an optional method. The scheme features of different situations can be superimposed or decoupled. The implementation methods listed in any situation can improve the display effect of the first text to a certain extent.
[0195] Step S303: the electronic device displays the second image.
[0196] Specifically, the electronic device may directly display the second image, or may display the second image in response to a selection operation of the user; of course, the electronic device may also send the second image to other devices for display by the other devices.
[0197] exist Figure 3 In the method shown, when configuring text for the first image, the brightness of the background area in the first image is fully considered. When the brightness V difference between pixel points is greater than a first preset threshold, the color fluctuation presented by the background area is relatively large, which is not conducive to the user to see the text content configured in the background area. Therefore, the first text is configured in the background area of the first image. When generating the second image, the text is designed so that the color of the first text in the second image is the target color and the first text has a projection on the second image; the first text can be more prominent, making it easier for the user to observe the position of the first text and the specific content of the first text.
[0198] The method of the embodiment of the present application is described in detail above, and the device of the embodiment of the present application is provided below.
[0199] See also Fig.12 , Fig.12 It is a structural schematic diagram of a picture background and text color adaptation device provided in an embodiment of the present application. The device 120 can be the above-mentioned electronic device 100 or a device or module in the electronic device 100. The device may include a processing unit 1201 and a display unit 1202, wherein each unit is described in detail as follows.
[0200] The processing unit 1201 is configured to obtain a brightness V difference between pixels in a background area of a first image, wherein the background area includes an area for configuring a first text, and the first text corresponds to an initial brightness V and a saturation S;
[0201] The processing unit 1201 is further configured to, when a brightness V difference between pixels in the background area is greater than a first preset threshold, arrange the first text in the background area of the first image, and generate a second image, so that the color of the first text in the second image is a target color and the first text has a projection on the second image;
[0202] The display unit 1202 is configured to display the second image.
[0203] In this method, when configuring text for the first image, the brightness of the background area in the first image is fully considered. When the brightness V difference between pixel points is greater than a first preset threshold, the color fluctuation presented by the background area is relatively large, which is not conducive to the user to see the text content configured in the background area. Therefore, the first text is configured in the background area of the first image. When generating the second image, the text is designed so that the color of the first text in the second image is the target color and the first text has a projection on the second image; the first text can be more prominent, making it easier for the user to observe the position of the first text and the specific content of the first text.
[0204] In a possible implementation, the processing unit 1201 is further configured to:
[0205] When the brightness V difference between the pixels in the background area is less than the first preset threshold, if the average saturation S of the background area is greater than the second preset threshold and the average brightness V is greater than the third preset threshold, perform the following operations:
[0206] Performing reverse enhancement processing on the brightness V and saturation S of the first text to obtain an updated first text;
[0207] When the saturation S of the updated first text is within a first preset range and the brightness V of the updated first text is within a second preset range, the updated first text is arranged in a background area of the first image to generate a second image.
[0208] In this implementation, the brightness V and saturation S of the first text are reversely enhanced so that the first text is more prominent in the background, so the user can more easily observe the position of the first text and the specific content of the first text.
[0209] In yet another possible implementation, in terms of performing reverse enhancement processing on the brightness and saturation S of the first text, the processing unit 1201 is specifically configured to:
[0210] If the average brightness V of the background area is less than the fourth preset threshold, the brightness V of the first text is added with the fifth preset threshold, and the saturation S of the first text is subtracted with the sixth preset threshold;
[0211] or,
[0212] If the average brightness V of the background area is greater than the fourth preset threshold, the fifth preset threshold is subtracted from the brightness V of the first text, and the sixth preset threshold is added to the saturation S of the first text.
[0213] In yet another possible implementation, the processing unit 1201 is further configured to:
[0214] If the average saturation S of the background area is less than the second preset threshold or the average brightness V is less than the third preset threshold, the first text is arranged in the background area of the first image to generate a second image so that the color of the first text in the second image is the target color and the first text has a projection on the second image.
[0215] In this implementation, if the average saturation S of the background area is less than the second preset threshold or the average brightness V is less than the third preset threshold, it indicates that the background area does not have a color tendency. Therefore, setting the first text to the target color (such as white) can highlight the display effect of the first text, making it easier for users to observe the position of the first text and the specific content of the first text.
[0216] In yet another possible implementation, the processing unit 1201 is further configured to:
[0217] When the saturation S of the updated first text is not within the first preset range or the brightness V of the updated first text is not within the second preset range, the first text is arranged in the background area of the first image, and a second image is generated, so that the color of the first text in the second image is the target color and the first text has a projection on the second image.
[0218] In this implementation, when the saturation S of the updated first text is not within the first preset range or the brightness V of the updated first text is not within the second preset range, it means that the updated first text will not be too prominent compared to the background, and therefore the updated first text cannot be displayed directly, but the target color is directly displayed with a projection.
[0219] In yet another possible implementation, the processing unit 1201 is further configured to:
[0220] When the color complexity of the background area does not exceed a preset level, the brightness V difference between the pixels in the background area is compared with the first preset threshold.
[0221] In yet another possible implementation, the processing unit 1201 is further configured to:
[0222] When the color complexity of the background area exceeds a preset level, the first text is arranged in the background area of the first image to generate a second image so that the color of the first text in the second image is the target color and the first text has a projection on the second image.
[0223] It can be understood that when the background area is relatively complex, the background color is likely to be the same or similar to the first text color with many discontinuous occurrences, causing the first text to appear to be integrated with the background area and difficult to distinguish. Therefore, the first text is directly displayed as the target color with a projection to clearly distinguish it from the background area.
[0224] In yet another possible implementation, the processing unit 1201 is further configured to:
[0225] Performing Gaussian blur processing on the background area to obtain a reference area;
[0226] Determine the variance value between the background area and the reference area. If the variance value is greater than a preset reference value, the color complexity of the background area exceeds the preset level. If the variance value is less than the preset reference value, the color complexity of the background area does not exceed the preset level.
[0227] In yet another possible implementation, the processing unit 1201 is further configured to:
[0228] When the proportion of pixels in the background area whose brightness is greater than the preset brightness value does not exceed the preset proportion, the brightness V difference between the pixels in the background area is compared with the first preset threshold.
[0229] In yet another possible implementation, the processing unit 1201 is further configured to:
[0230] When the proportion of pixels in the background area whose brightness is greater than a preset brightness value exceeds a preset proportion, the first text is arranged in the background area of the first image, and a second image is generated so that the color of the first text in the second image is the target color and the first text has a projection on the second image.
[0231] It can be understood that when the proportion of pixels in the background area with brightness greater than the preset brightness value exceeds the preset proportion, the background color is likely to overlap with the first text color, causing the first text to appear partially integrated with the background area and difficult to distinguish. Therefore, the first text is directly displayed as the target color with a projection, so as to be clearly distinguished from the background area.
[0232] In yet another possible implementation, the processing unit 1201 is further configured to:
[0233] When the saturation of the background area is not equal to 0, the brightness V difference between the pixels of the background area is compared with the first preset threshold.
[0234] In yet another possible implementation, the processing unit 1201 is further configured to:
[0235] When the saturation of the background area is equal to 0, adding or subtracting a fifth preset threshold value from the brightness V of the first text to obtain an updated first text;
[0236] The updated first text is arranged in the background area of the first image to generate a second image.
[0237] It can be understood that adding or subtracting the fifth preset threshold value to the brightness V of the first text can enhance the display difference between the first text and the background area, thereby making it easier to identify the first text from the background area.
[0238] In yet another possible implementation, if the color of the updated first text is the target color, the first text has a projection on the second image.
[0239] In another possible implementation, the brightness V difference between the pixels includes the brightness difference between m pixels with the largest brightness and m pixels with the smallest brightness in the background area, where m is an integer.
[0240] It should be noted that the implementation and effects of each unit can be referred to Figure 3 The corresponding description of the method embodiment shown.
[0241] It should be understood that each step in the above method embodiment provided by the present application can be completed by an integrated logic circuit of hardware in a processor or by instructions in the form of software. The method steps disclosed in the embodiments of the present application can be directly embodied as being executed by a hardware processor, or by a combination of hardware and software modules in a processor.
[0242] The present application also provides an electronic device, which may include: a memory and a processor. The memory may be used to store a computer program; the processor may be used to call the computer program in the memory so that the electronic device executes all or part of the steps in any of the above method embodiments (for example, when there are multiple devices or multiple modules interacting, the steps corresponding to one side of the device or prediction module are executed). Optionally, a possible implementation of the memory and the processor is as mentioned above in the memory and the processor in the electronic device.
[0243] The present application also provides a chip system, which includes at least one processor for implementing the functions involved in the method executed by the electronic device in any of the above embodiments.
[0244] In one possible design, the chip system also includes a memory, which is used to store program instructions and data, and the memory is located inside or outside the processor.
[0245] The chip system may be composed of the chip, or may include the chip and other discrete devices.
[0246] Optionally, the processor in the chip system may be one or more. The processor may be implemented by hardware or by software. When implemented by hardware, the processor may be a logic circuit, an integrated circuit, etc. When implemented by software, the processor may be a general-purpose processor implemented by reading software code stored in a memory.
[0247] Optionally, the memory in the chip system may also be one or more. The memory may be integrated with the processor or may be separately arranged with the processor, which is not limited in the embodiments of the present application. Exemplarily, the memory may be a non-transient processor, such as a read-only memory ROM, which may be integrated with the processor on the same chip or may be arranged on different chips respectively. The embodiments of the present application do not specifically limit the type of memory and the arrangement of the memory and the processor.
[0248] Exemplarily, the chip system can be a field programmable gate array (FPGA), an application specific integrated circuit (ASIC), a system on chip (SoC), a central processor unit (CPU), a network processor (NP), a digital signal processor (DSP), a microcontroller unit (MCU), a programmable logic device (PLD) or other integrated chips.
[0249] The present application also provides a computer program product, which includes: a computer program (also referred to as code, or instruction), which enables a computer to execute the method executed by the electronic device in any of the above embodiments when the computer program is executed.
[0250] The present application also provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program (also referred to as code or instruction). When the computer program is executed, the computer executes the method executed by the electronic device in any of the above embodiments.
[0251] The various implementation modes of the present application can be combined arbitrarily to achieve different technical effects.
[0252] In the above embodiments, it can be implemented in whole or in part by software, hardware, firmware or any combination thereof. When implemented using software, it can be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, the process or function described in this application is generated in whole or in part. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions can be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another computer-readable storage medium. For example, the computer instructions can be transmitted from a website site, computer, server or data center to another website site, computer, server or data center by wired (e.g., coaxial cable, optical fiber, digital subscriber line) or wireless (e.g., infrared, wireless, microwave, etc.) mode. The computer-readable storage medium can be any available medium that a computer can access or a data storage device such as a server or data center that includes one or more available media integration. The available medium can be a magnetic medium (e.g., a floppy disk, a hard disk, a tape), an optical medium (e.g., a DVD), or a semiconductor medium (e.g., a solid-state hard disk Solid State Disk), etc.
[0253] Those skilled in the art can understand that to implement all or part of the processes in the above-mentioned embodiments, the processes can be completed by computer programs to instruct related hardware, and the programs can be stored in computer-readable storage media. When the programs are executed, they can include the processes of the above-mentioned method embodiments. The aforementioned storage media include: ROM or random access memory RAM, magnetic disk or optical disk and other media that can store program codes.
[0254] In short, the above is only an embodiment of the technical solution of this application, and is not intended to limit the protection scope of this application. Any modification, equivalent replacement, improvement, etc. made according to the disclosure of this application shall be included in the protection scope of this application.< / canvas> < / video> < / videoview> < / imgview> < / textview>
Claims
1. A method for adapting the color of a picture background and text, characterized in that: include: Acquire a brightness V difference between pixels in a background area of a first image, wherein the background area includes an area for configuring a first text, and the first text corresponds to an initial brightness V and a saturation S; the brightness V difference can reflect the fluctuation amplitude of the brightness of the background area; When the brightness V difference between the pixels in the background area is greater than a first preset threshold, the first text is arranged in the background area of the first image, and a second image is generated, so that the color of the first text in the second image is the target color and the first text has a projection on the second image; When the brightness V difference between the pixels in the background area is less than the first preset threshold, if the average saturation S of the background area is greater than the second preset threshold and the average brightness V is greater than the third preset threshold, perform the following operations: Performing reverse enhancement processing on the brightness V and saturation S of the first text to obtain an updated first text; When the saturation S of the updated first text is within a first preset range and the brightness V of the updated first text is within a second preset range, configuring the updated first text in the background area of the first image to generate a second image; The performing reverse enhancement processing on the brightness and saturation S of the first text includes: If the average brightness V of the background area is less than the fourth preset threshold, the brightness V of the first text is added with the fifth preset threshold, and the saturation S of the first text is subtracted with the sixth preset threshold; or, If the average brightness V of the background area is greater than the fourth preset threshold, subtract the fifth preset threshold from the brightness V of the first text, and add the sixth preset threshold to the saturation S of the first text; The second image is displayed.
2. The method according to claim 1, characterized in that: Also includes: If the average saturation S of the background area is less than the second preset threshold or the average brightness V is less than the third preset threshold, the first text is arranged in the background area of the first image to generate a second image so that the color of the first text in the second image is the target color and the first text has a projection on the second image.
3. The method according to any one of claims 1 to 2, characterized in that: Also includes: When the saturation S of the updated first text is not within the first preset range or the brightness V of the updated first text is not within the second preset range, the first text is arranged in the background area of the first image, and a second image is generated, so that the color of the first text in the second image is the target color and the first text has a projection on the second image.
4. The method according to any one of claims 1 to 2, characterized in that: Also includes: When the color complexity of the background area does not exceed a preset level, the brightness V difference between the pixels in the background area is compared with the first preset threshold.
5. The method according to claim 4, characterized in that Also includes: When the color complexity of the background area exceeds a preset level, the first text is arranged in the background area of the first image to generate a second image so that the color of the first text in the second image is the target color and the first text has a projection on the second image.
6. The method according to claim 5, characterized in that Also includes: Performing Gaussian blur processing on the background area to obtain a reference area; Determine the variance value between the background area and the reference area. If the variance value is greater than a preset reference value, the color complexity of the background area exceeds the preset level. If the variance value is less than the preset reference value, the color complexity of the background area does not exceed the preset level.
7. The method according to any one of claims 1-2, characterized in that: Also includes: When the proportion of pixels in the background area whose brightness is greater than the preset brightness value does not exceed the preset proportion, the brightness V difference between the pixels in the background area is compared with the first preset threshold.
8. The method according to claim 7, characterized in that Also includes: When the proportion of pixels in the background area whose brightness is greater than a preset brightness value exceeds a preset proportion, the first text is arranged in the background area of the first image, and a second image is generated so that the color of the first text in the second image is the target color and the first text has a projection on the second image.
9. The method according to any one of claims 1-2, characterized in that: Also includes: When the saturation of the background area is not equal to 0, the brightness V difference between the pixels of the background area is compared with the first preset threshold.
10. The method according to claim 9, characterized in that Also includes: When the saturation of the background area is equal to 0, a fifth preset threshold is added to or subtracted from the brightness V of the first text to obtain an updated first text; The updated first text is arranged in the background area of the first image to generate a second image.
11. The method according to claim 10, characterized in that If the updated color of the first text is the target color, then the first text has a projection on the second image.
12. The method according to any one of claims 1-2, characterized in that: The brightness V difference between the pixels includes an average value of the brightness difference between m pixels with the largest brightness and m pixels with the smallest brightness in the background area, where m is an integer.
13. An electronic device, characterized in that: The electronic device comprises: one or more processors; a memory; wherein the memory is coupled to the one or more processors, the memory is used to store computer program code, the computer program code comprises computer instructions, and the one or more processors call the computer instructions so that the electronic device executes the method as described in any one of claims 1-12.
14. A chip system, characterized in that: The chip system is applied to an electronic device, and the chip system includes one or more processors, and the processor is used to call computer instructions so that the electronic device executes the method as described in any one of claims 1-12.
15. A computer program product comprising instructions, characterized in that When the computer program product is executed on an electronic device, the electronic device is enabled to execute the method according to any one of claims 1 to 12.
16. A computer-readable storage medium comprising instructions, characterized in that: When the instructions are executed on an electronic device, the electronic device is caused to execute the method as claimed in any one of claims 1 to 12.
Citation Information
Patent Citations
Text legibility over images
US20160358592A1