Wallpaper setting method and electronic device

By determining and cropping the highest point of the object in the photo, setting the user's photos as depth of field wallpaper is achieved, solving the problem that the existing technology cannot meet the user's personalized needs, and providing a richer way to display the lock screen interface.

WO2025025657A9PCT designated stage expired Publication Date: 2025-09-04HONOR DEVICE CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
PCT/CN2024/085663
Authority / Receiving Office
WO · WO
Patent Type
Applications
Current Assignee / Owner
Priority Date
2023-07-31
Filing Date
2024-04-02
Publication Date
2025-09-04

AI Technical Summary

Technical Problem

The prior art is difficult to set photos taken or downloaded by users as depth of field wallpapers, which cannot meet users' personalized needs.

Method used

By determining the highest point of the object in the photo and cropping the photo based on this point, the depth of field effect can be displayed. The method includes receiving an operation of a user, acquiring pixel point position information of the image, determining the highest point of the object, and displaying the cropped image with a depth of field effect.

Benefits of technology

It realizes setting users' photos as depth of field wallpaper, meeting users' personalized needs and providing a richer way to display lock screen interfaces.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN2024085663_04092025_PF_FP_ABST
    Figure CN2024085663_04092025_PF_FP_ABST
Patent Text Reader

Abstract

Embodiments of the present application relate to the technical field of terminals, and provide a wallpaper setting method and an electronic device. The method comprises: receiving a first operation of a user of setting a first picture as wallpaper, wherein a foreground of the first picture comprises one or more objects; acquiring position information of a first-type pixel point of a first image, wherein the first-type pixel point is a pixel point belonging to the foreground of the first picture; determining the highest object point of the first picture on the basis of the position information of the first-type pixel point, wherein the highest object point is the highest point among the highest points of a target object among the objects comprised in the foreground of the first picture; and cropping the first picture on the basis of the highest object point, and displaying the cropped first picture with the depth of field effect. Therefore, according to the present application, by determining the highest object point of a picture, the picture captured or downloaded by a user is set as the depth of field wallpaper, thereby meeting the personalized requirements of the user.
Need to check novelty before this filing date? Find Prior Art

Description

Method for setting wallpaper and electronic device

[0001] This application claims priority to the Chinese patent application filed with the State Intellectual Property Office on July 31, 2023, with application number 202310955084.3 and invention name “A method for setting wallpaper and electronic device”, the entire contents of which are incorporated by reference into this application. Technical Field

[0002] The present application relates to the field of terminal technology, and in particular to a method for setting wallpaper and an electronic device. Background Art

[0003] The lock screen image is the image displayed on the lock screen interface. For example, when an electronic device is set with a lock screen password, the lock screen image is displayed on the lock screen interface when the electronic device turns on the screen after turning it off. With the rapid development of terminal technology, the display methods of lock screen images on electronic devices are becoming more and more diverse, including but not limited to static lock screen images, dynamic lock screen images, magazine lock screen images, etc.

[0004] Summary of the Invention

[0005] The embodiments of the present application provide a method and electronic device for setting wallpaper, which can determine the highest point of an object in a photo, so that users can set the photos they have taken or downloaded as depth of field wallpapers to meet their personalized needs.

[0006] To achieve the above objectives, the embodiments of the present application adopt the following technical solutions:

[0007] In a first aspect, the present application provides a method for setting wallpaper, which is applied to an electronic device including a display screen, the method comprising: receiving a first operation of a user to set a first picture as wallpaper, the foreground of the first picture including one or more objects; obtaining position information of a first type of pixel points of the first image, the first type of pixel points being pixel points belonging to the foreground in the first picture; determining the highest point of the object of the first picture based on the position information of the first type of pixel points; wherein the highest point of the object is the highest point among the highest points of the target object among the objects included in the foreground of the first picture; cropping the first picture based on the highest point of the object, and displaying the cropped first picture with a depth of field effect.

[0008] That is, the application can first determine the highest point of the object, then crop the first image based on the highest point of the object, and finally display the cropped image with a depth of field effect. Thus, the application can set a photo taken or downloaded by the user as a depth of field wallpaper to meet the user's personalized needs.

[0009] In one implementation provided in the first aspect, obtaining the position information of the first category of pixels in the first image includes: performing a cutout process on the first image to obtain a cutout result, wherein the cutout process is used to separate the foreground from the non-foreground of the first image, the cutout result including the first category of pixels; and obtaining the position information of the first category of pixels in the first image based on the cutout result. In other words, the position information of the first category of pixels can be determined by separating the foreground from the first image through cutout.

[0010] In an implementation provided in the first aspect, the target object is an object within a first range of the first image, the first range includes a first boundary and a second boundary, and the method further includes: determining the object center of the first image, the object center being used to reflect the center of the one or more objects in the horizontal direction; moving the object center in a first horizontal direction by a first distance to obtain the first boundary, and moving the object center in a second horizontal direction by a first distance to obtain the second boundary, so as to obtain the first range; wherein the first horizontal direction and the second horizontal direction are opposite.

[0011] In an implementation provided in the first aspect, the foreground includes an object, and the distance between the first boundary and the second boundary is greater than or equal to the width of the key area of ​​the object; or, the foreground includes multiple objects, the distance between the first boundary and the second boundary is greater than or equal to the width of a first control, the first control is a control in the interface when the cropped first image is displayed with a depth of field effect, the first control is a control included in the first interface, and the first interface is an interface for displaying the cropped first image with a depth of field effect.

[0012] That is, when the foreground includes one object or multiple objects, the first range used to determine the highest point of the object is different. When the foreground includes one object, the distance between the first boundary and the second boundary is greater than or equal to the width of the key area of ​​the object, so that the first range can cover the area where the object is located, that is, the highest point of the object is the highest point of the object; when the foreground includes multiple objects, the distance between the first boundary and the second boundary is greater than or equal to the width of the first control, so that the first range can cover the area where the second control is located, that is, the highest point of the object is the highest point of the object within the area covered by the first control.

[0013] In an implementation provided in the first aspect, the object is a person image, and the key area of ​​the object is the face area of ​​the person object. That is, when the object is a person image, the first range is based on covering the face area.

[0014] In an implementation provided in the first aspect, the object center is the axis of symmetry between the third boundary perpendicular to the first direction and the fourth boundary perpendicular to the first direction, the position information of the object center is the coordinate of the axis of symmetry in the first direction, and the third boundary and the fourth boundary are the two boundaries of the one or more objects in the first direction.

[0015] In an implementation method provided in the first aspect, determining the object center of the first picture includes: detecting one or more objects in the first picture to obtain position information of key points of the first picture, wherein the position information of the key points includes the coordinates of the key points in the first direction; using the minimum coordinates of the key points in the first direction as the coordinates of the third boundary, and using the maximum coordinates of the key points in the first direction as the coordinates of the fourth boundary; and determining the axis of symmetry between the third boundary and the fourth boundary as the object center of the first picture based on the coordinates of the third boundary and the coordinates of the fourth boundary.

[0016] In an implementation provided by the first aspect, the object is a person image, and the key point is a face.

[0017] In a second aspect, the present application provides an electronic device, the electronic device comprising: a memory, a processor, and a display screen;

[0018] The processor is coupled to a memory and a display screen; wherein the memory is used to store computer program code, and the computer program code includes computer instructions; when the computer instructions are executed by the processor, the electronic device executes a method as in any one of the embodiments of the first aspect.

[0019] In a third aspect, the present application provides a computer-readable storage medium comprising computer instructions; when the computer instructions are executed on an electronic device, the electronic device executes a method as described in any one of the embodiments of the first aspect.

[0020] In a fourth aspect, the present application provides a computer program product, which, when executed on a terminal device, enables the terminal device to execute a method as described in any one of the embodiments of the first aspect.

[0021] Among them, the technical effects brought about by any implementation method in the second to fourth aspects can refer to the technical effects brought about by different design methods in the first aspect, and will not be repeated here. BRIEF DESCRIPTION OF THE DRAWINGS

[0022] FIG1A is a schematic diagram of a lock screen interface using a depth of field wallpaper;

[0023] FIG1B is a schematic diagram of a lock screen interface using a non-depth-of-field wallpaper;

[0024] FIG2 is a schematic diagram showing a notification bar displayed on a lock screen interface;

[0025] FIG3 is a schematic structural diagram of an electronic device provided in an embodiment of the present application;

[0026] FIG4 is a schematic diagram of the software hierarchy of an electronic device provided in an embodiment of the present application;

[0027] FIG5 is a schematic diagram of a set of interfaces provided in an embodiment of the present application;

[0028] FIG6 is a schematic diagram of an interface provided in an embodiment of the present application;

[0029] 7A-7B are a set of interface schematic diagrams provided in an embodiment of the present application;

[0030] 8A-8B are a set of interface schematic diagrams provided in an embodiment of the present application;

[0031] FIG9A is a schematic diagram of a foldable screen mobile phone provided in an embodiment of the present application;

[0032] FIG9B is a schematic diagram of an interface provided in an embodiment of the present application;

[0033] FIG9C is a schematic diagram of an interface provided in an embodiment of the present application;

[0034] FIG10 is a flowchart of a method for setting wallpaper provided in an embodiment of the present application;

[0035] FIG11 is a schematic diagram of face location information provided in an embodiment of the present application;

[0036] FIG12 is a schematic diagram of a person distribution provided in an embodiment of the present application;

[0037] FIG13 is a schematic diagram of a distribution of a first range provided in an embodiment of the present application;

[0038] FIG14 is a diagram illustrating parameter information provided in an embodiment of the present application;

[0039] FIG15 is a schematic diagram of a first cropping area provided in an embodiment of the present application;

[0040] FIG16 is a schematic diagram of a method for setting wallpaper according to an embodiment of the present application;

[0041] FIG17 is a flowchart of another method for setting wallpaper provided in an embodiment of the present application;

[0042] FIG18 is a schematic diagram of a process for determining a second cropping area according to an embodiment of the present application;

[0043] FIG19 is a comparison diagram of the cropping areas provided in an embodiment of the present application;

[0044] FIG20 is a flowchart of another method for setting wallpaper provided in an embodiment of the present application;

[0045] FIG21A is a schematic diagram of a cutout process according to an embodiment of the present application;

[0046] FIG21B is a flow chart of determining the highest point of a portrait provided by an embodiment of the present application;

[0047] FIG22 is a flowchart of another method for setting wallpaper provided in an embodiment of the present application. DETAILED DESCRIPTION

[0048] The technical solutions in the embodiments of the present application are described below in conjunction with the drawings in the embodiments of the present application. Among them, in the description of the embodiments of the present application, the terms used in the following embodiments are only for the purpose of describing specific embodiments, and are not intended to be used as limitations on the present application. As used in the specification and claims of the present application, the singular expressions "a", "said", "above", "the" and "this" are intended to also include expressions such as "one or more", unless there is a clear contrary indication in the context. It should also be understood that in the following embodiments of the present application, "at least one", "one or more" refer to one or more (including two). The term "and / or" is used to describe the association relationship of associated objects, indicating that three relationships can exist; for example, A and / or B can represent: the existence of A alone, the existence of A and B at the same time, and the existence of B alone, where A and B can be singular or plural. The character " / " generally indicates that the associated objects before and after are in an "or" relationship.

[0049] References to "one embodiment" or "some embodiments" etc. described in this specification mean that the specific features, structures or characteristics described in conjunction with the embodiment are included in one or more embodiments of the present application. Therefore, the phrases "in one embodiment", "in some embodiments", "in some other embodiments", "in some other embodiments", etc. appearing in different places in this specification do not necessarily refer to the same embodiment, but mean "one or more but not all embodiments", unless otherwise specifically emphasized. The terms "including", "comprising", "having" and their variations all mean "including but not limited to", unless otherwise specifically emphasized. "First" and "second" are used for descriptive purposes only and are not to be understood as indicating or implying relative importance or implicitly indicating the number of technical features indicated.

[0050] In the embodiments of this application, words such as "exemplary" or "for example" are used to indicate examples, illustrations, or descriptions. Any embodiment or design described as "exemplary" or "for example" in the embodiments of this application should not be interpreted as being preferred or advantageous over other embodiments or designs. Rather, the use of words such as "exemplary" or "for example" is intended to present the relevant concepts in a concrete manner.

[0051] To facilitate understanding of this solution, the following is a brief description of the relevant concepts involved in the embodiments of this application.

[0052] The lock screen interface refers to the interface displayed when the device is in lock screen state.

[0053] Lock screen wallpaper refers to the image used as the background on the lock screen. Lock screen wallpaper can be static or dynamic.

[0054] The depth of field effect is a 3D visual layering effect that can highlight the main subject of the wallpaper. The main subject can be called the foreground of the wallpaper, such as people, mountains, flowers, animals, etc. In the embodiment of the present application, when the lock screen wallpaper is displayed with the depth of field effect, part of the control area on the lock screen interface (such as the clock control) is blocked by the foreground.

[0055] Depth of Field wallpapers are wallpapers that display a depth of field effect. Depth of Field wallpapers can include a foreground and background, with the background including the foreground content.

[0056] Non-depth of field wallpaper refers to wallpaper that does not display with a depth of field effect.

[0057] For example, refer to Figure 1A, which is a schematic diagram of a lock screen interface using a depth of field wallpaper. As shown in (a) of Figure 1A, the lock screen interface 101 includes a lock screen wallpaper 102 and a clock control 103. The lock screen wallpaper 102 includes a background 102a and a foreground 102b. As shown in (b) of Figure 1A, the lock screen interface 101 includes at least three layers: the layer where the background 102a is located, the layer where the clock control 103 is located, and the layer where the foreground 102b is located. Among them, the layer where the clock control 103 is located is located above the layer where the background 102a is located, and the layer where the foreground 102b is located is located above the layer where the clock control 103 is located. When the above three layers overlap, as shown in (a) of Figure 1A, part of the clock control 103 is obscured by the foreground 102b. In addition, as shown in (b) of Figure 1A, the background 102a includes all the content on the lock screen wallpaper 102, and the foreground 102b only includes the main objects on the lock screen wallpaper 102, that is, the people on the lock screen wallpaper 102.

[0058] It should be noted that the dotted lines in FIG1A are only used to identify the area and do not actually exist. For example, the clock control 103 is a view control and does not include the dotted lines around it. In addition, the clock control can also be called a time indicator or other names.

[0059] Refer to Figure 1B, which is a schematic diagram of a lock screen interface using a non-depth of field wallpaper. As shown in (a) of Figure 1B, the lock screen interface 104 includes a lock screen wallpaper 105 and a clock control 106. As shown in (b) of Figure 1B, the lock screen interface 104 includes at least two layers, namely the layer where the lock screen wallpaper 105 is located, and the layer where the clock control 106 is located. Among them, the layer where the clock control 106 is located is located above the layer where the lock screen wallpaper 105 is located. When the above two layers overlap, the lock screen wallpaper 105 is partially obscured by the clock control 106, and the clock control 106 can be displayed in its entirety.

[0060] Optionally, in other embodiments, the lock screen interface 104 may also be similar to the lock screen interface 101 shown in (b) of Figure 1A, and also include at least three layers. The difference is that in Figure 1B, the layer where the clock control 106 is located is above the foreground layer and background layer of the lock screen wallpaper 105.

[0061] By comparing Figure 1A and Figure 1B, it can be seen that the depth of field wallpaper sets the foreground and background, and embeds the controls on the lock screen interface (such as the clock control 106) between the background (such as the background 102a) and the foreground (such as the foreground 102b) of the lock screen wallpaper, so that the foreground can be presented to the user in the form of a 3D effect, making the visual effect of the foreground more three-dimensional, which can bring a good visual experience to the user.

[0062] If a device receives a notification while in the lock screen state, the notification can be displayed on the lock screen. For example, see Figure 2, which shows a schematic diagram of the lock screen interface when the device receives a notification. As shown in Figure 2 (a), the lock screen interface 101 also includes a notification bar 201. As shown in Figure 2 (b), the layer where the notification bar 201 is located is located above the layer where the foreground 102b is located.

[0063] It should be noted that the notification shown in Figure 2 is for illustration only, and the lock screen interface 101 can also display detailed information of the notification. Alternatively, the notification can be a notification of other applications such as social applications, game applications, etc., and no specific restrictions are made here.

[0064] In the related art, only the wallpapers with foreground and background pre-set by the developer can support the depth of field effect. Photos taken by users or pictures downloaded do not support the depth of field effect and cannot meet the personalized needs of users.

[0065] In view of this, an embodiment of the present application provides a method for setting wallpaper, which can determine the highest point of an object in a photo and crop the photo based on the highest point of the object, so that the device can display the cropped photo according to the depth of field effect, making it convenient for users to set the photos they have taken or downloaded as depth of field wallpapers to meet the user's personalized needs.

[0066] It should be noted that the wallpaper setting method provided in the embodiments of the present application can be applied to electronic devices. The electronic devices can be mobile phones, tablet computers, desktop computers, laptop computers, handheld computers, notebook computers, ultra-mobile personal computers (UMPCs), netbooks, as well as cellular phones, personal digital assistants (PDAs), augmented reality (AR) devices, virtual reality (VR) devices, artificial intelligence (AI) devices, wearable devices, in-vehicle devices, smart home devices, and / or smart city devices. The embodiments of the present application do not impose any special restrictions on the specific types of the electronic devices.

[0067] Figure 3 is a schematic diagram of the structure of an electronic device provided in an embodiment of the present application. As shown in Figure 3, the electronic device may include: a processor 110, an external memory interface 120, an internal memory 121, 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 194, and a subscriber identification module (SIM) card interface 195, etc.

[0068] 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 processing unit (GPU), an image signal processor (ISP), a controller, a memory, a video codec, a digital signal processor (DSP), a baseband processor, and / or a neural-network processing unit (NPU). Different processing units may be independent devices or integrated into one or more processors.

[0069] The controller can be the nerve center and command center of the electronic device. The controller can generate operation control signals based on the instruction opcode and timing signals to complete the control of instruction fetching and execution.

[0070] 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. This memory can store instructions or data that the processor 110 has just used or is reusing. If the processor 110 needs to use the instruction or data again, it can be directly called from the memory. This avoids repeated accesses, reduces the waiting time of the processor 110, and thus improves the efficiency of the system. In an embodiment of the present application, the processor 110 can determine a cropping area for an image and perform operations such as cropping the image according to the determined cropping area.

[0071] In some embodiments, the processor 110 may include one or more interfaces. The interfaces 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.

[0072] It is understood that the interface connection relationship between the modules illustrated in this embodiment is only for illustrative purposes and does not constitute a structural limitation on the electronic device. In other embodiments, the electronic device may also adopt different interface connection methods from the above embodiments, or a combination of multiple interface connection methods.

[0073] The external memory interface 120 can be used to connect an external memory card, such as a Micro SD card, to expand the storage capacity of the electronic device. The external memory card communicates with the processor 110 via the external memory interface 120 to implement data storage functions. For example, files such as music and videos can be stored on the external memory card.

[0074] The internal memory 121 can be used to store computer executable program code, which includes instructions. The processor 110 executes various functional applications and data processing of the electronic device by running the instructions stored in the internal memory 121. For example, in an embodiment of the present application, the processor 110 can execute instructions stored in the internal memory 121, and the internal memory 121 can include a program storage area and a data storage area.

[0075] Among them, the program storage area can store an operating system, an application required for at least one function (such as a sound playback function, an image playback function, etc.), etc. The data storage area can store data created during the use of the electronic device (such as audio data, a phone book, etc.), etc. In addition, the internal memory 121 may include a high-speed random access memory, and may also include a non-volatile memory, such as at least one disk storage device, a flash memory device, a universal flash storage (UFS), etc. In an embodiment of the present application, the internal memory 121 may also store image data, parameters required for use by the processor 110 in determining the cropping area, and parameters of the cropping area determined by the processor 110, etc.

[0076] The charging management module 140 is used to receive charging input from a charger. The charger can be a wireless charger or a wired charger. While charging the battery 142, the charging management module 140 can also power the electronic device through the power management module 141.

[0077] 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 provides power to the processor 110, the internal memory 121, the external memory, the display 194, the camera 193, and the wireless communication module 160. In some embodiments, the power management module 141 and the charging management module 140 can also be provided in the same device.

[0078] The wireless communication function of the electronic device can be implemented through antenna 1, antenna 2, mobile communication module 150, wireless communication module 160, a modem processor, and a baseband processor. In some embodiments, antenna 1 and mobile communication module 150 of the electronic device are coupled, and antenna 2 and wireless communication module 160 are coupled, so that the electronic device can communicate with the network and other devices through wireless communication technology.

[0079] Antenna 1 and Antenna 2 are used to transmit and receive electromagnetic wave signals. Each antenna in an electronic device can be used to cover a single or multiple communication frequency bands. Different antennas can also be reused to improve antenna utilization. For example, antenna 1 can be reused as a diversity antenna for a wireless local area network. In other embodiments, the antennas can be used in conjunction with a tuning switch.

[0080] Mobile communication module 150 can provide wireless communication solutions for electronic devices, including 2G / 3G / 4G / 5G. It can include at least one filter, switch, power amplifier, and low-noise amplifier (LNA). Mobile communication module 150 receives electromagnetic waves from antenna 1, filters and amplifies the received electromagnetic waves, and transmits them to a modem processor for demodulation.

[0081] The mobile communication module 150 can also amplify the signal modulated by the modem processor and convert it into electromagnetic waves for radiation via 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.

[0082] The wireless communication module 160 can provide wireless communication solutions for electronic devices, including WLAN (such as wireless fidelity, Wi-Fi network), Bluetooth (BT), global navigation satellite system (GNSS), frequency modulation (FM), near field communication technology (NFC), infrared technology (IR), etc.

[0083] Wireless communication module 160 can be one or more devices that integrate at least one communication processing module. Wireless communication module 160 receives electromagnetic waves via antenna 2, frequency-modulates and filters the electromagnetic wave signals, and transmits the processed signals to processor 110. Wireless communication module 160 can also receive signals to be transmitted from processor 110, frequency-modulate and amplify them, and then convert them into electromagnetic waves for radiation via antenna 2.

[0084] The electronic device implements display functionality through a GPU, display screen 194, and an application processor. A GPU is a microprocessor for image processing that connects display screen 194 and the application processor. The GPU is used to perform mathematical and geometric calculations for graphics rendering. Processor 110 may include one or more GPUs that execute program instructions to generate or modify display information.

[0085] Display screen 194 is used to display images, videos, etc. Display screen 194 includes a display panel. In the embodiment of the present application, display screen 194 can be used to display the lock screen interface, lock screen preview interface, etc. Optionally, display screen 194 can be a touch screen, which can receive the user's operation to set wallpaper and display the lock screen preview interface.

[0086] The electronic device can implement a camera function using an ISP, camera 193, a video codec, a GPU, a display 194, and an application processor. The ISP processes data fed back by camera 193. Camera 193 is used to capture still images or video. In some embodiments, the electronic device may include one or N cameras 193, where N is a positive integer greater than 1.

[0087] The electronic device can implement audio functions through the audio module 170, speaker 170A, receiver 170B, microphone 170C, headphone jack 170D, and application processor. For example, music playback and recording. Buttons 190 include a power button, volume button, etc. Buttons 190 can be mechanical buttons or touch buttons. Motor 191 can generate vibration prompts. Motor 191 can be used for incoming call vibration prompts or for touch vibration feedback. Indicator 192 can be an indicator light that can be used to indicate charging status, power changes, messages, missed calls, notifications, etc. SIM card interface 195 is used to connect a SIM card. The SIM card can be connected to and disconnected from the electronic device by inserting or removing it from the SIM card interface 195. The electronic device can support one or N SIM card interfaces, where N is a positive integer greater than 1. SIM card interface 195 can support Nano SIM cards, Micro SIM cards, SIM cards, etc.

[0088] Among them, the above-mentioned sensor module 180 may include sensors such as pressure sensor, gyroscope sensor, air pressure sensor, magnetic sensor, acceleration sensor, distance sensor, proximity light sensor, fingerprint sensor, temperature sensor, touch sensor, ambient light sensor and bone conduction sensor.

[0089] It should be understood that the structure illustrated in this embodiment does not constitute a specific limitation on the electronic device. In other embodiments, the electronic device may include more or fewer components than shown, or may combine or separate certain components, or have different component arrangements. The illustrated components may be implemented in hardware, software, or a combination of software and hardware.

[0090] The software system of the electronic device can adopt a layered architecture, an event-driven architecture, a micro-kernel architecture, a micro-service architecture, or a cloud architecture. Here, the layered architecture shown in FIG4 is used as an example to illustrate the software structure of the electronic device.

[0091] The layered architecture divides the software into several layers, each with a clear role and division of labor. The layers communicate with each other through interfaces. In some embodiments, the terminal device may include an application layer, an application framework layer, and a kernel layer. It should be noted that the layered architecture shown in FIG4 is only an example. TM system, IOS system, etc.), as long as the functions implemented by each functional module are similar to the embodiments of the present application, the solution of the present application can also be implemented.

[0092] The application layer can include a series of applications. As shown in Figure 4, the application layer can include applications such as the Gallery application. The Gallery application allows users to view and manage photos they have taken or downloaded, and provides an entry for setting photos as lock screen wallpapers.

[0093] The application framework layer provides an application programming interface (API) and a programming framework for the applications in the application layer. The API may include an object detection interface (also called a first interface) and a clipping interface (a second interface).

[0094] The application framework layer also includes some predefined functions, such as an object detection module, a cutout module, a peak point detection module, and a cropping module, etc., which are not limited in this embodiment of the present application.

[0095] The object detection module is used to perform object detection on images (e.g., images to be processed, transmitted by the gallery application), determine whether the image contains an object, and determine the location of the object if it does. The object can be a person (referred to as a portrait), flowers, trees, animals, fruit, etc.

[0096] The object detection module may include one or more of a face detection module, an animal detection module, and a fruit detection module, which are respectively used to detect faces, animals, fruits, etc. in the image and obtain corresponding location information.

[0097] In an embodiment of the present application, an application (such as the above-mentioned gallery application) can call the object detection module through the above-mentioned object detection interface and use the object detection module to detect whether a corresponding object exists in the picture.

[0098] The cutout module is used to separate the foreground of an image from the image to obtain a cutout result.

[0099] The highest point detection module is used to determine the highest point of an object in an image (also called a target point). The explanation of the highest point of an object can be found later and will not be described here.

[0100] The cropping module is used to determine the cropping area according to the highest point and the center of the object.

[0101] In an embodiment of the present application, the gallery application can call the cropping module through the above-mentioned cropping interface to determine the cropping area of ​​the image.

[0102] The kernel layer is the layer between hardware and software. The kernel layer includes at least display drivers, etc.

[0103] As shown in Figure 4, the electronic device further includes a hardware layer. The hardware layer may include the display screen 194 described above, which is used to display all interfaces involved in setting the lock screen wallpaper and for interaction between the electronic device and the user.

[0104] The following takes the electronic device as a mobile phone and the object as a portrait as an example, and describes in detail the method for setting wallpaper provided by the present application in conjunction with the accompanying drawings.

[0105] In some embodiments, the mobile phone has a function for users to set wallpapers.

[0106] For example, as shown in FIG5(a), the mobile phone may set a "More" button 502 in a location such as the picture preview interface 501. The picture preview interface 501 also includes previewed pictures, for example, the picture preview interface 501 includes previewed picture 503. When the user needs to perform further operations on picture 503, such as moving, copying, or setting it as wallpaper, the user can click the "More" button 502. In response to the user clicking the "More" button 502, the mobile phone may present multiple operation options to the user for selection.

[0107] In an embodiment of the present application, in response to a user's operation on the "More" button 502, the mobile phone may display a function bar 504. As shown in FIG5(b), the function bar 504 may provide multiple options, including but not limited to "Move", "Copy", "Set to" 505, and other options. In response to a user's operation on the "Set to" 505 option, the mobile phone may display an options bar 506. The options bar 506 is used to provide the user with multiple usage options for the image 503, each usage option corresponding to a usage of the image 503. As shown in FIG5(c), the multiple usage options may include "Wallpaper" 506a, "Off-screen display" 506b, "Contact picture" 506c, etc., which are respectively used to set the image 503 as wallpaper, set the image 503 as the picture displayed on the off-screen, and set the image 503 as a contact picture.

[0108] In response to the user's operation on "Wallpaper" 506a, the mobile phone may display a lock screen preview interface. This lock screen preview interface is used to preview the lock screen interface of the mobile phone, and the lock screen preview interface may include a lock screen wallpaper. The lock screen wallpaper can be a picture obtained by cropping picture 503 by the mobile phone, or picture 503 itself.

[0109] For example, a mobile phone can also set a wallpaper setting function in the thumbnail interface of the gallery application. The thumbnail interface is used to display thumbnails of photos or videos. In this way, users can use this function to set a photo as a depth of field wallpaper without clicking on the full image, simplifying the user operation.

[0110] In the embodiment of the present application, depending on whether image 503 supports the depth of field effect, the mobile phone can display the lock screen wallpaper with or without the depth of field effect on the lock screen preview interface. The process of determining whether image 503 supports the depth of field effect can be seen in S210 to S250 and S310 to S360, which will not be described here.

[0111] Among them, if picture 503 supports depth of field effect, the mobile phone displays the lock screen wallpaper with depth of field effect on the lock screen preview interface; if picture 503 does not support depth of field effect, the mobile phone displays the lock screen wallpaper without depth of field effect on the lock screen preview interface.

[0112] Exemplarily, when image 503 supports depth of field effect, the lock screen preview interface can be the lock screen preview interface 507 shown in (d) of Figure 5. As shown in (d) of Figure 5, the lock screen preview interface 507 includes a clock control 508, a lock screen wallpaper 509, and a function bar 510. Among them, the clock control 508 is used to display the current time, including year, month, day, hour, minute, etc. The lock screen wallpaper 509 includes a background 509a and a foreground 509b. The clock control 508 is partially obscured by the foreground 509b to indicate that the lock screen wallpaper 509 is displayed with a depth of field effect. The function bar 510 includes options such as Cancel 510a, Blur 510b, Depth of Field Effect 510c, and Confirm 510d.

[0113] In other embodiments, the display form of the clock control 508 is not limited to that in FIG. 5 . For example, the clock control may not include the date or day of the week, or the numbers in the clock control used to indicate the current time (e.g., “16:37”) may be presented in the form of Chinese characters (e.g., 16:37) or images.

[0114] If it is detected that the user clicks the cancel button 510a, the mobile phone may stop displaying the lock screen preview interface 507 and redisplay the interface 501.

[0115] If it is detected that the user clicks on the blur 510b, the mobile phone can blur / cancel the blurring of the background of the lock screen wallpaper 509 (ie, other areas except the foreground).

[0116] If the mobile phone detects that the user clicks on the depth of field effect 510 c , the mobile phone can enable / disable the depth of field effect of the lock screen wallpaper 509 .

[0117] If the user clicks OK 510d, the phone can save the wallpaper setting operation. After the phone saves the wallpaper setting operation, the phone's lock screen interface can be as shown in Figure 1A (a). Optionally, in response to the user clicking OK 510d, the phone can also redisplay interface 501.

[0118] For example, if image 503 does not support depth of field effects, the lock screen preview interface may be lock screen preview interface 601 shown in FIG6 . Lock screen preview interface 601 includes a clock control 602, a lock screen wallpaper 603, and a function bar 604. Lock screen preview interface 601 shown in FIG6 is similar to lock screen preview interface 507 shown in FIG5(d), except that, in lock screen preview interface 601, clock control 602 is located above lock screen wallpaper 603 and partially obscures lock screen wallpaper 603.

[0119] In an embodiment of the present application, in response to a user's preset operation on the lock screen wallpaper on the lock screen preview interface, the mobile phone can adjust the lock screen wallpaper, such as enlarging / reducing the lock screen wallpaper, moving the wallpaper in any direction, etc. The preset operations include pinching in, spreading out, sliding / swiping in any direction, etc.

[0120] In addition, in response to the above-mentioned preset operations, the mobile phone can also display the adjusted lock screen wallpaper with a depth of field effect if the adjusted lock screen wallpaper supports the depth of field effect, and display the adjusted lock screen wallpaper with a non-depth of field effect if the adjusted lock screen wallpaper does not support the depth of field effect.

[0121] If the lock screen wallpaper before adjustment supports depth of field, but the adjusted lock screen wallpaper does not, the lock screen wallpaper switches from depth of field to non-depth of field. Alternatively, if the lock screen wallpaper before adjustment does not support depth of field, but the adjusted lock screen wallpaper supports depth of field, the lock screen wallpaper switches from non-depth of field to depth of field. This means that during the process of adjusting the lock screen wallpaper on a mobile phone, the lock screen wallpaper can switch between depth of field and non-depth of field effects.

[0122] For example, in response to receiving a two-finger pinch operation by the user on the lock screen preview interface, the mobile phone can reduce the lock screen wallpaper on the lock screen preview interface. Exemplarily, as shown in (a) of Figure 7A, the mobile phone can display a lock screen preview interface 701, which includes a clock control 702 and a lock screen wallpaper 703 displayed with a depth of field effect. The mobile phone can receive a two-finger pinch operation by the user on the lock screen wallpaper 703. In response to the operation, as shown in (b) of Figure 7A, the mobile phone displays a lock screen wallpaper 704 on the lock screen preview interface 701. Among them, the lock screen wallpaper 704 is the reduced lock screen wallpaper 703, and the lock screen wallpaper 704 is displayed without a depth of field effect.

[0123] For another example, in response to receiving a two-finger pinch-out operation on the lock screen wallpaper, the mobile phone can enlarge the lock screen wallpaper on the lock screen preview interface. For example, in response to the user's two-finger pinch-out operation on lock screen wallpaper 704, the mobile phone can switch from lock screen wallpaper 704 in Figure 7A to lock screen wallpaper 703, that is, enlarge the lock screen wallpaper and switch from displaying the lock screen wallpaper with no depth of field effect to displaying the lock screen wallpaper with a depth of field effect.

[0124] For another example, as shown in FIG7B (a), the mobile phone may receive a user's pinch-to-open operation on lock screen wallpaper 703. In response to this operation, as shown in FIG7B (b), the mobile phone displays lock screen wallpaper 705 on lock screen preview interface 701. Lock screen wallpaper 705 is an enlarged version of lock screen wallpaper 703, and is displayed without a depth of field effect.

[0125] For another example, in response to receiving a user's sliding operation on the lock screen preview interface, the phone can move the lock screen wallpaper downward. Exemplarily, as shown in (a) in Figure 8A, the phone can display a lock screen preview interface 801, which includes a clock control 802 and a lock screen wallpaper 803 displayed with a depth of field effect. The phone can receive a user's sliding operation on the lock screen wallpaper 803, and in response to the operation, the phone displays a lock screen wallpaper 804 on the lock screen preview interface 801. Among them, the lock screen wallpaper 804 is the lock screen wallpaper 803 after moving downward, and the lock screen wallpaper 804 is displayed with a non-depth of field effect.

[0126] For another example, in response to a user swiping up on the lock screen preview interface, the phone can move the lock screen wallpaper upward. For example, after receiving a user swiping up on lock screen wallpaper 804, the phone can switch from lock screen wallpaper 804 in (b) of Figure 8A to lock screen wallpaper 803, that is, move the lock screen wallpaper upward and switch from displaying the lock screen wallpaper with no depth of field effect to displaying the lock screen wallpaper with depth of field effect.

[0127] For another example, as shown in FIG8B (a), the mobile phone may receive a user's upward swipe operation on lock screen wallpaper 803. In response to this operation, as shown in FIG8B (b), the mobile phone displays lock screen wallpaper 805 on lock screen preview interface 801. Lock screen wallpaper 805 is lock screen wallpaper 803 after being moved upward, and lock screen wallpaper 805 is displayed without a depth of field effect.

[0128] In an optional embodiment, when the display screen of the mobile phone is a folding screen, the user can choose to set the picture as the lock screen wallpaper of the inner screen or the lock screen wallpaper of the outer screen. Referring to Figure 9A, it is a schematic diagram of the appearance of a folding screen mobile phone. Among them, (a) in Figure 9A is a schematic diagram of the shape of the mobile phone when it is fully unfolded. (b) in Figure 9A is a schematic diagram of the shape of the mobile phone in a semi-expanded state. (c) in Figure 9A is a schematic diagram of the shape of the mobile phone in a folded state. Among them, the folding screen shown in (a) in Figure 9A can be folded along the folding edge to form screen A and screen B shown in (b) in Figure 9A. As shown in Figure 9A, the mobile phone may include an inner screen and an outer screen. Among them, when the mobile phone is in a folded state, the outer screen can be used to display the picture; when the mobile phone is in an unfolded state, both the inner screen and the outer screen can be used to display the picture.

[0129] Both the inner and outer screens of the mobile phone support the user's operation of setting wallpapers. Refer to Figure 9B, which shows an interface diagram for setting depth of field wallpaper on the outer screen of a folding screen mobile phone. As shown in Figure 9B, when the mobile phone is a folding screen mobile phone, the lock screen preview interface also includes an inner screen option 901a and an outer screen option 901b. Among them, when the inner screen option 901a is selected, the mobile phone can display interface 901 as shown in (a) of Figure 9B, and interface 901 can be used to preview the lock screen preview interface of the inner screen. When the outer screen option 901b is selected, the mobile phone can display interface 902 as shown in (b) of Figure 9B, and interface 902 can be used to preview the lock screen preview interface of the outer screen.

[0130] Refer to Figure 9C, which shows an interface diagram for setting a depth of field wallpaper on the outer screen of a foldable screen phone. As shown in Figure 9C, if the user sets a depth of field wallpaper on the outer screen, when the outer screen option 901b is selected, the phone may display interface 903 as shown in Figure 9C (a), and interface 901 can be used to preview the lock screen preview interface of the outer screen. When the inner screen option 901a is selected, the phone may display interface 904 as shown in Figure 9C (b), and interface 904 can be used to preview the lock screen preview interface of the inner screen.

[0131] By comparing interface 901 and interface 902, as well as interface 903 and interface 904, it can be seen that when previewing the lock screen preview interface, the mobile phone can refer to the shape of the inner screen or outer screen for preview, which not only makes it easier for users to distinguish, but also makes it easier for users to understand the unlock screen effect.

[0132] The following will describe in detail the specific implementation of the method for setting wallpaper provided by the embodiment of the present application with reference to the accompanying drawings.

[0133] 10 is a flowchart of a method for setting wallpaper according to an embodiment of the present application, which can be applied to the electronic device shown in FIG3. As shown in FIG10, the method for setting wallpaper includes S210 to S250.

[0134] S210: Receive a first operation of setting a first picture as wallpaper from a user.

[0135] The first picture is a picture selected by the user to be set as wallpaper. It can be a photo taken by the user himself, or a picture downloaded by the user from the Internet or a picture from other sources. There is no specific limitation here.

[0136] For example, the first image may be image 503 in Figure 5 . The first operation may be the user clicking wallpaper 506a. Alternatively, the first operation may include the user clicking more button 502, clicking set as 505, and clicking wallpaper 506a. Alternatively, the first operation may be any other operation capable of setting the first image as wallpaper, without specific limitation herein.

[0137] S220: In response to the first operation, obtain first parameter information of the first picture.

[0138] The first parameter information includes the size of the first image, the position information of the center of the portrait in the first image, and the position information of the highest point of the portrait.

[0139] In an embodiment of the present application, the mobile phone can obtain the size of the first image. The size of the first image can refer to the width and height of the first image, which can be expressed as "width × height". For example, if the size of the first image is 1980 × 1080, it means that the width of the first image is 1980 pixels and the height is 1080 pixels. For another example, the size of the first image can also be 800 × 600, 1280 × 720, etc., which is not specifically limited here.

[0140] The first picture may include one or more character images (which may be referred to as portraits).

[0141] In this embodiment of the present application, the portrait center is used to reflect the horizontal distribution of all the person images in the first image. The portrait center can be the axis of symmetry between the third boundary perpendicular to the x-axis and the fourth boundary perpendicular to the x-axis. The third boundary and the fourth boundary are two boundaries of one or more person images in the first direction.

[0142] The position information of the center of the portrait may be the coordinate of the symmetry axis on the x-axis, where the x-axis is a straight line along the width of the image. The direction of the x-axis may also be referred to as the first direction.

[0143] It should be noted that the portrait center is the symmetry axis between the third boundary perpendicular to the x-axis and the fourth boundary perpendicular to the x-axis, and does not indicate that the first image is symmetrical about the portrait center in the x-axis direction.

[0144] In an optional embodiment, the third boundary is the left boundary of the face frame of the leftmost person image in the first image, and the fourth boundary is the right boundary of the face frame of the rightmost person image in the first image. The mobile phone can determine the third boundary based on the position information of the leftmost face in the first image, and determine the fourth boundary based on the position information of the rightmost face in the first image. It should be noted that when the first image includes only one person image, the leftmost person image and the rightmost person image are the same person image. Accordingly, the leftmost face and the rightmost face are faces of the same person image.

[0145] For ease of understanding, the face position information is first described below with reference to the accompanying drawings.

[0146] In an optional embodiment, the position information of the face may include the coordinates of two diagonally opposite vertices of the face frame. The two diagonally opposite vertices may be the upper left vertex and the lower right vertex of the face frame, or the lower left vertex and the upper right vertex of the face frame, without specific limitation.

[0147] For example, as shown in FIG11 , the coordinate system of the above-mentioned vertex coordinates has the upper left corner of the image as the coordinate origin, the straight line along which the width of the image lies as the x-axis, and the straight line along which the height of the image lies as the y-axis. It should be noted that, unless otherwise specified, the coordinates involved in the embodiments of this application are all based on the above-mentioned coordinate system as the reference coordinate system.

[0148] For example, as shown in (a) in Figure 11, the position information of the face may include the coordinates of the upper left vertex (x1, y1) of the face frame, and the coordinates of the lower right vertex (x2, y2), which can be expressed as [(x1, y1), (x2, y2)].

[0149] In another optional implementation, the position information of the face may include the distances from the four sides of the face frame to the corresponding sides of the image.

[0150] For example, as shown in (b) of Figure 11, the face frame includes an upper boundary, a lower boundary, a left boundary, and a right boundary, and the picture includes an upper boundary, a lower boundary, a left boundary, and a right boundary. The position information of the face includes the distance L1 from the upper boundary of the face frame to the upper boundary of the picture, the distance L2 from the lower boundary of the face frame to the lower boundary of the picture, the distance L3 from the left boundary of the face frame to the left boundary of the picture, and the distance L4 from the right boundary of the face frame to the right boundary of the picture, which can be expressed as [L1, L2, L3, L4].

[0151] The following example illustrates a process in which the mobile phone determines the third boundary based on the position information of the leftmost face, and determines the fourth boundary based on the position information of the rightmost face.

[0152] For example, the face position information includes the coordinates of the upper left vertex and the lower right vertex of the face frame. As shown in (a) of Figure 12, the first picture only includes face a, and the position information of face a is [(x a1 ,y a1 ), (x a2 ,y a2 )], then the third boundary is x=x a1 , the fourth boundary is x=x a2 , so the center of the portrait is x=(x a1 +x a2 ) / 2.

[0153] For another example, as shown in (b) of FIG12 , the first picture includes face a, face b, face c, and face d. Face a is located at the leftmost side of all the person images in the first picture, face c is located at the rightmost side of all the person images in the first picture, and the position information of face a is [(x a1 ,y a1 ), (x a2 ,y a2 )], the position information of face c is [(x c1 ,y c1 ), (x c2 ,y c2 )], then the third boundary is x=x a1 , the fourth boundary is x=x c2 , so the center of the portrait is x=(x a1 +x c2 ) / 2.

[0154] In another optional embodiment, the third boundary may be the left boundary of the body frame of the leftmost person image, and the fourth boundary may be the right boundary of the body frame of the rightmost person image. The mobile phone may determine the third boundary based on the position information of the leftmost person image in the first image, and the fourth boundary based on the position information of the rightmost person image in the first image. The principle behind this is similar to the principle of determining the center of a portrait using facial position information, and will not be further elaborated here.

[0155] In another optional embodiment, the mobile phone may determine the third boundary based on the center of gravity of the leftmost person image, and determine the fourth boundary based on the center of gravity of the rightmost person image. Specifically, the third boundary is a straight line passing through the center of gravity of the leftmost person image and perpendicular to the x-axis, and the fourth boundary is a straight line passing through the center of gravity of the rightmost person image and perpendicular to the x-axis.

[0156] In an optional embodiment, the mobile phone can use a key point detection algorithm to detect key points on the character image, such as the eyes, nose, mouth, neck, arms, knees, ankles and other human body positions, and then use the position of the key points to determine the center of gravity of the character image.

[0157] In the embodiment of the present application, the highest point of the portrait is the highest point among the highest points of the target portrait in the portraits included in the first image. The position information of the highest point of the portrait may include the distance from the highest point of the portrait to the upper boundary and / or the lower boundary of the first image.

[0158] In an optional embodiment, the target object may be a portrait within a first range of the first image. The two boundaries of the first range are a first boundary obtained by moving the portrait's center to the left (also referred to as a first horizontal direction) by a first distance, and a second boundary obtained by moving the portrait's center to the right (also referred to as a second horizontal direction) by a second distance. Optionally, the first range also includes an upper boundary, a lower boundary, etc., which are not specifically limited herein.

[0159] If the first image includes only a portrait, the first distance and the second distance can be determined based on the width of the face frame. The first distance and the second distance are greater than or equal to half the width of the face frame to ensure that the first range covers the face frame. It should be noted that the first distance and the second distance can be the same or different.

[0160] Taking (a) in Figure 13 as an example, the position information of the face is [(x a1 ,y a1 ), (x a2 ,y a2 )] (not shown), the width of the face frame is x a2 -x a1 , the portrait center is x=(x a1 +xa2 ) / 2. The first distance can be (x a2 -x a1 ) / 2+Δ1, the second distance can be (x a2 -x a1 ) / 2+Δ2, Δ1≥0, Δ2≥0. Thus, the first boundary can be x=(x a1 +x a2 ) / 2-[(x a2 -x a1 ) / 2+Δ1]=x a1 -Δ1, the second boundary can be x=(x a1 +x a2 ) / 2+[(x a2 -x a1 ) / 2+Δ2]=x a2 +Δ2, the first range is x a1 -Δ1≤x≤x a2 +Δ2 (i.e., the range where the shadow part is located). In this way, it can be ensured that the first range can cover the face frame.

[0161] The portrait included in the first range is the target object, and the highest point of the portrait is the top of the head A. Therefore, the highest point of the portrait is the top of the head A, and the position information of the highest point of the portrait can be the distance M1 from the top of the head A to the upper boundary of the first image.

[0162] If the first image includes multiple portraits, the first distance and the second distance can be determined based on the width of the first control. The first distance and the second distance are greater than or equal to half the width of the first control to ensure that the first range covers the first control. It should be noted that the first distance and the second distance can be the same or different. The first control can be a clock view for displaying time, and the width of the first control is the width of the clock view.

[0163] It should also be noted that the first control is a control displayed on the lock screen preview interface (also referred to as the first interface), such as the clock control 508 in Figure 5. The width of the first control refers to the width of the first control when the size of the lock screen preview interface is scaled to the preset cropping size.

[0164] For example, if the size of the lock screen preview interface is 800*600, the width of the first control in the lock screen preview interface is 500. If the preset size is 400*300, the width of the first control is 250.

[0165] For example, taking (b) in Figure 13 as an example, the width of the first control is L, and the center of the portrait is x = a. The first distance can be L / 2 + Δ3, and the second distance can be L / 2 + Δ4, where Δ3 ≥ 0 and Δ4 ≥ 0. Therefore, the first boundary can be x = a - (L / 2 + Δ3) = m1, and the second boundary can be x = a + (L / 2 + Δ4) = m2. The first range is the area formed by m1 ≤ x ≤ m2 (i.e., the area of ​​the shaded portion). In this way, it is ensured that the first range can cover the first control.

[0166] The first range includes portraits A and B, and the target objects are portraits A and B. The highest point of portrait A is the top of its head, i.e., point B1; the highest point of portrait B is the top of its head, i.e., point B2. Since points B1 and B2 have the same vertical coordinate, the highest points of the portraits are the highest points B1 and B2 of the person images in the first range. The position information of the highest points of the portraits can be the distance M2 from the highest point B1 / B2 to the upper edge of the first image.

[0167] In an optional embodiment, if the ordinate value of point B1 is less than the ordinate value of point B2, the highest point among the highest points of the target object is point B1, and thus the highest point of the portrait is point B1; if the ordinate value of point B1 is greater than the ordinate value of point B2, the highest point among the highest points of the target object is point B2, and thus the highest point of the portrait is point B2.

[0168] In other embodiments, the first range may be other ranges that can cover the face frame or the first control, and the area where the first range is located may be open, closed, regular or irregular, which is specifically limited here.

[0169] In another optional implementation, the target objects may be all portraits in the first picture.

[0170] Continuing with Figure 13 (b) as an example, the target objects are portrait C, portrait A, portrait B, and portrait D. Among them, the highest point of portrait C is higher than the highest points of the other portraits, so the highest point of the object is the highest point of portrait C, that is, the top of portrait C's head.

[0171] The above explains the relevant concepts of the highest point of the portrait. The following will explain in detail the process of the mobile phone determining the highest point of the portrait. For details, see S410 to S440, which will not be described here.

[0172] S230: Determine a first cropping area according to the first parameter information and the second parameter information.

[0173] The second parameter information includes the cropping size and the position information of the first control.

[0174] The cropping size is pre-set, for example, the cropping size may be 2340×1080 pixels.

[0175] In an optional embodiment, in order to avoid deformation problems when displaying the cropped image, the ratio of the cropped size is the same as the ratio of the display screen. For example, the ratio of width to height is the aspect ratio of the internal screen of devices such as foldable screen mobile phones and straight-screen mobile phones. No specific restrictions are made here.

[0176] The position information of the first control is used to indicate the position of the first control in the adjusted lock screen preview interface, where the adjusted lock screen preview interface refers to the interface obtained by adjusting the size of the lock screen preview interface to the cropped size. Alternatively, it can be understood as the position of the first control in the first cropped area when the first control is mapped to the first cropped area.

[0177] For example, the position information of the first control may include the width of the first control, the height of the first control, and the distance from the upper boundary of the first control to the upper boundary and / or lower boundary of the adjusted first interface (or the first cropping area).

[0178] For another example, the location information of the first control can be similar to the location information of a face, including the coordinates of two diagonally opposite vertices of the first control. In this case, the mobile phone can calculate the width and height of the first control and the distance from the upper boundary of the first control to the upper boundary and / or lower boundary of the adjusted first interface based on the location information of the first control.

[0179] In an embodiment of the present application, the mobile phone can determine the size and position of the first cropping area according to the first parameter information and the second parameter information.

[0180] The size of the first cropping area is the same as the cropping size. For example, if the cropping size is 2340×1080 pixels, the size of the first cropping area is also 2340×1080 pixels. In addition, since the ratio of the cropping size is the same as the ratio of the display screen, the ratio of the first cropping area is also the same as the ratio of the display screen.

[0181] The position of the first cropping area is used to indicate the relative position of the first cropping area and the first image. In an optional embodiment, the position of the first cropping area may include a distance S1 from the upper boundary of the first cropping area to the upper boundary of the first image, a distance S2 from the lower boundary of the first cropping area to the lower boundary of the first image, a distance S3 from the left boundary of the first cropping area to the left boundary of the first image, and a distance S4 from the right boundary of the first cropping area to the right boundary of the first image.

[0182] In the embodiment of the present application, the mobile phone can determine the position of the cropping area from the x-axis direction and the y-axis direction respectively.

[0183] Among them, in the y-axis direction, the distance from the highest point of the portrait to the first side of the first cropping area meets the first condition; in the x-axis direction, the distance from the highest point of the portrait to the second side of the first cropping area meets the second condition, so that when the second picture cropped according to the first cropping area is displayed, the portrait included in the second picture blocks part of the area of ​​the first control.

[0184] The first side may be an upper boundary of the first cropping area or a lower boundary of the first cropping area.

[0185] When the first side is the upper boundary of the first cropping area, the first condition includes: the distance from the highest point of the portrait to the first side of the first cropping area is less than the distance from the lower boundary of the first control to the first side of the first cropping area. Optionally, the distance from the highest point of the portrait to the first side of the first cropping area is greater than the distance from the upper boundary of the first control to the first side of the first cropping area.

[0186] When the first side is the lower boundary of the first cropping area, the first condition includes: the distance from the highest point of the portrait to the first side of the first cropping area is greater than the distance from the lower boundary of the first control to the first side of the first cropping area. Optionally, the distance from the highest point of the portrait to the first side of the first cropping area is less than the distance from the upper boundary of the first control to the first side of the first cropping area.

[0187] In this case, if the ratio of the distance from the highest point of the portrait to the lower boundary of the first control to the height of the first control is k, and 0<k<1, the distance from the highest point of the portrait to the first side of the first cropping area can meet the first condition. Therefore, the mobile phone determines the above distances S1 and S2 based on k, the height of the first image, the height of the first cropping area, the height of the first control, and the distance from the upper boundary of the first control to the upper boundary / lower boundary of the first cropping area.

[0188] In this way, the highest point of the portrait can be located in the area where the first control is located in the y-axis direction, so that the mobile phone can achieve a depth of field effect by adjusting the position of the first control and the portrait in the first picture.

[0189] The second side is the left boundary of the first cropping area or the right boundary of the first cropping area, and the second condition includes: the distance from the highest point of the portrait to the second side of the first cropping area is the same as the distance from the center line of the first control to the second side of the first cropping area.

[0190] In this embodiment of the present application, the mobile phone can use the center of the portrait in the first image as the symmetry axis of the first cropping area in the x-axis direction, and the symmetry axis of the first cropping area coincides with the symmetry axis of the first control. Distances S3 and S4 are determined based on the width of the first image and the width of the first cropping area. In this way, when the display screen displays the content contained in the first cropping area (i.e., the second image), the people in the image can be evenly distributed on the display screen, making the picture more harmonious.

[0191] For example, the first parameter information and the second parameter information may be as shown in FIG14 , wherein the cropping size is w1×h1, the height of the first control is h3, the distance from the upper boundary of the first control to the upper boundary of the first cropping area is h4, the size of the first image is w2×h2, the distance from the highest point of the portrait to the upper edge of the first image is M1, and the center of the portrait is x=a.

[0192] According to the first parameter information and the second parameter information shown in FIG14 , the mobile phone can determine a first cropping area, and the first cropping area can be the shaded area shown in FIG15 .

[0193] Among them, in the x-axis direction, the mobile phone takes the portrait center of the first picture as the symmetry axis of the first cropping area, and the symmetry axis of the first cropping area coincides with the symmetry axis of the first control, and the width of the first cropping area is w1 and the width of the first picture is w2, so it can be determined that: S3 = a-w1 / 2, S4 = w2-(a-w1 / 2).

[0194] On the y-axis, the phone can determine that the distance between the highest point of the portrait and the lower edge of the first control is k*h3, and thus the distance from the highest point of the portrait to the upper edge of the first control is (1-k)*h3. Based on this, the phone can determine: S1 = M1-h4-(1-k)*h3, S2 = h2-h1-S1 = h2-h1-(M1-h4-(1-k)*h3).

[0195] S240: If the first cropping area meets the first preset condition, crop the first image according to the first cropping area to obtain a second image.

[0196] The first preset condition is used to predict whether the second image can be displayed with a depth of field effect.

[0197] In an optional embodiment, the first preset condition may include at least two of the following:

[0198] (1) The first cropping area does not exceed the area where the first image is located.

[0199] In an optional embodiment, the mobile phone can determine whether all four vertices of the first cropping area are located within the area where the first image is located. If all four vertices of the first cropping area are located within the area where the first image is located, it means that the first cropping area does not exceed the area where the first image is located. In this case, the mobile phone can crop the first image according to the first cropping area.

[0200] If any vertex is not within the area where the first image is located, it means that the first cropping area exceeds the area where the first image is located. In this case, since the first image cannot meet the first cropping area, the mobile phone may not crop the first image according to the first cropping area.

[0201] (2) The area ratio of the portrait in the first cropping area is within a first preset range.

[0202] In an embodiment of the present application, the area ratio of the portrait can be the ratio of the area of ​​the person in the first cropped area to the area of ​​the first cropped area. Optionally, the mobile phone can perform human body recognition on the first cropped area to obtain a human body frame and calculate the area of ​​the human body frame. The area of ​​the human body frame is then used as the area of ​​the person in the first cropped area, and the area ratio of the portrait is calculated in combination with the area of ​​the first cropped area.

[0203] Among them, the first preset range can be a range determined by a first threshold and a second threshold, and the first threshold is less than the second threshold. For example, the first threshold can be 3%, and the second threshold can be 18%, that is, the first preset range is 3% to 18%. In other embodiments, the preset range can also be other, and there is no specific limitation here. In an optional embodiment, the first preset range can be associated with the number of portraits in the first picture. For example, when the first picture includes a portrait, the first preset range can be 3% to 18%, and when the first picture includes multiple portraits, the first preset range can be 2% to 9%.

[0204] If the area ratio of the portrait is within the first preset range, it means that the size of the person in the first cropping area is moderate, and a better display effect can be achieved when displayed with a depth of field effect. The mobile phone can crop the first picture according to the first cropping area.

[0205] If the area ratio of the portrait is not within the first preset range, it means that the person in the first cropping area is too large or too small, and the effect when displayed with the depth of field effect is poor. It is not recommended to display with the depth of field effect. Therefore, the mobile phone can not crop the first picture according to the first cropping area.

[0206] If the first cropping area does not meet any one of the above conditions (1) and (2), it means that the first cropping area does not meet the first preset condition. The mobile phone can crop the first image according to the above first cropping area or in other ways, and display the cropped image with a non-depth of field effect, or the mobile phone can directly display the first image with a non-depth of field effect.

[0207] S250: Display the second picture with a depth of field effect.

[0208] For example, as shown in Figure 16, the mobile phone can determine a first cropping area from the first image, and if the first cropping area meets the first preset condition, the mobile phone can crop the first image according to the first cropping area to obtain the second image. In this way, when the second image is displayed, the second image, the first control, and the cropping result of the second image can be superimposed so that the cropping result (i.e., the portrait portion of the second image) can block part of the first control area, creating a depth of field effect.

[0209] In an optional embodiment, to achieve a better display effect, the mobile phone can enlarge the first image into multiple third images and obtain a second cropping area corresponding to each third image. The mobile phone can then select the optimal cropping area from the multiple second cropping areas as the first cropping area, crop the corresponding third image according to the first cropping area to obtain a second image, and display the second image with a depth of field effect. This embodiment is described below with reference to Figure 17.

[0210] FIG17 is a flow chart of another method for setting wallpaper provided in an embodiment of the present application. The method for setting wallpaper provided in an embodiment of the present application is similar to the method for setting wallpaper shown in FIG10. As shown in FIG17, the method for setting wallpaper may include steps S310 to S370.

[0211] S310: Receive a first operation of setting a first picture as wallpaper from a user.

[0212] For the description of the first operation, please refer to S210 and will not be repeated here.

[0213] S320: Enlarge the size of the first picture by n times to obtain a third picture.

[0214] Where n is the adjustment coefficient, and n min ≤n≤n max .n max The maximum value of the adjustment coefficient n pre-stored in the mobile phone, for example, it can be 2, 3, 3.5, 4, etc.; n min The minimum value of the adjustment coefficient n pre-stored in the mobile phone, for example, 1.

[0215] In an optional embodiment, in response to the first operation, the mobile phone may obtain the maximum value n of the adjustment coefficient n. max , and enlarge the size of the first image by n max times to get the third picture.

[0216] In an optional implementation, the mobile phone can zoom in on the first image using the coordinate origin (eg, the upper left vertex of the first image) as an anchor point, so that the images before and after zooming in can have the same coordinate system for ease of calculation.

[0217] For example, the size of the first picture is w1*h1, the distance from the highest point of the portrait in the first picture to the upper boundary of the third picture is M1, and the center of the portrait in the first picture is x=a, then the size of the third picture is (n*w1)*

[0218] (n*h1), and the distance from the highest point of the portrait in the third picture to the upper boundary of the third picture is n*M1, and the center of the portrait in the third picture is x=n*a.

[0219] S330: Obtain third parameter information of the third image.

[0220] The third parameter information includes the size of the third image, the position information of the highest point of the object in the third image, and the position information of the center of the object in the third image.

[0221] The process of obtaining the third parameter information of the third image is described in S220 and S410 to S440 and will not be described in detail here.

[0222] In an optional embodiment, if the first and third images include only one portrait, the mobile phone may determine the third parameter information by combining the first parameter information, the second parameter information, and the adjustment coefficient n. For example, if the size of the first image is w×h, the center of the portrait in the first image is x=a, the distance from the highest point of the portrait to the top edge of the first image is m, and the third image is n times the size of the first image, then the size of the third image is nw×nh, the center of the portrait in the third image is x=na, and the distance from the highest point of the portrait to the top edge of the third image is n×m.

[0223] S340: Determine a second cropping area in the third picture according to the third parameter information and the second parameter information.

[0224] The size of the second cropping area is the same as the cropping size.

[0225] In an embodiment of the present application, the mobile phone can determine the position of the second cropping area in the third picture based on the size of the third picture, the distance from the highest point of the portrait in the third picture to the upper boundary of the third picture, the position of the center of the portrait, and the second parameter information.

[0226] The process of determining the position of the second cropping area is similar to the process of determining the first cropping area in S230 , and will not be described in detail here.

[0227] For example, the first parameter information and the second parameter information may be as shown in (a) of FIG18 , where the size of the display screen is w1×h1, the height of the first control is h3, the distance from the upper boundary of the first control to the upper boundary of the cropping area is h4, the size of the first image is w2×h2, the distance from the highest point of the portrait to the upper edge of the first image is M1, and the center of the portrait is x=a.

[0228] Among them, the third picture is obtained after the first picture is enlarged n times, as shown in (b) in Figure 18, the size of the third picture is (n*w2)*(n*h2), the distance from the highest point of the portrait in the third picture to the upper boundary of the third picture is n*M1, and the center of the portrait in the third picture is x=n*a.

[0229] According to the parameter information shown in (b) of FIG. 18 , the position of the second cropping area shown in (c) of FIG. 18 can be obtained.

[0230] In the x-axis direction, the mobile phone uses the portrait center of the third picture as the symmetry axis of the second cropping area, and the symmetry axis of the second cropping area coincides with the symmetry axis of the first control, and the width of the display screen is w1 and the width of the third picture is w2. It can be determined that: S3 = n*a-w1 / 2, S4 = n*w2-(n*a-w1 / 2).

[0231] In the y-axis direction, the phone can determine that the distance between the highest point of the portrait and the lower boundary of the first control is k*h3, and the distance between the highest point of the portrait and the upper boundary of the first control is (1-k)*h3. Based on this, the phone can determine S1 = n*M1-h4-(1-k)*h3, S2 = n*h2-h1-S1 = n*h2-h1-[n*M1-h4-(1-k)*h3].

[0232] S350: Determine whether the second cropping area meets a second preset condition.

[0233] The second preset condition is used to determine whether the content in the second cropping area supports the depth of field effect and to determine whether the mobile phone needs to continue to determine a new second cropping area. In an optional embodiment, the second preset condition includes:

[0234] (1) The second cropped area does not exceed the area where the third image is located; (2) The area ratio of the portrait in the second cropped area is greater than or equal to a first threshold, and the first threshold is the minimum area ratio of the portrait.

[0235] In the case that the second cropping area exceeds the area where the third picture is located, if the adjustment coefficient n is further reduced, the new second cropping area obtained according to the adjusted adjustment coefficient n will still exceed the area where the first picture is located.

[0236] When the area ratio of the portrait in the cropped area is less than the first threshold, further reducing the adjustment coefficient n will reduce the area ratio of the portrait in the new second cropped area, that is, it will still be less than the first threshold, affecting the display effect.

[0237] For example, as shown in Figure 19 (a), Image 1 is the image obtained by magnifying the first image by a factor of n1, and Cropped Region 1 is the second cropped region corresponding to Image 1. As shown in Figure 19 (b), Image 2 is the image obtained by magnifying the first image by a factor of n2, and Cropped Region 2 is the second cropped region corresponding to Image 2, where n1>n2. The dotted line represents the straight line containing the highest portrait point in Images 1 and 2.

[0238] If cropped area 1 exceeds the area of ​​image 1, cropped area 2 must also exceed the area of ​​image 2. If the area ratio of the portrait in cropped area 1 is less than the first threshold, the area ratio of the portrait in cropped area 2 must also be less than the first threshold. In other words, if it is determined that cropped area 1 does not meet the second preset condition, there is no need to further reduce the adjustment coefficient n.

[0239] If the second cropping area meets the second preset condition, S350 is executed; if the second cropping area does not meet the second preset condition, S360 is executed.

[0240] S360, reduce n.

[0241] In an optional implementation, the mobile phone can determine whether n is greater than the minimum adjustment coefficient n min , and when n>n min Reduce n in the case of n≤n min In the case of , n is not reduced, and S360 is directly executed.

[0242] The mobile phone may reduce the adjustment coefficient n according to a preset step size, for example, the preset step size may be 0.1, 0.2, etc.

[0243] For example, n1=3, and the preset step size is 0.1, then n can be 2.9, 2.8, 2.7...1 in sequence.

[0244] In an optional embodiment, the initial value of the adjustment coefficient n can also be the minimum value (i.e., 1). Furthermore, the second preset condition is adjusted to: (1) the second cropping area does not exceed the area where the third image is located; (2) the area ratio of the portrait in the second cropping area is greater than a second threshold, where the second threshold is the maximum area ratio of the portrait. Furthermore, S350 can be replaced by: enlarging n.

[0245] In the embodiment of the present application, through S320 to S350, the mobile phone can obtain at least one third picture and the second cropping area corresponding to each third picture, wherein the adjustment coefficient n corresponding to each third picture is different.

[0246] For example, at least one third picture includes picture 1, picture 2, picture 3... picture m, where picture 1 is a picture obtained by magnifying the first picture by A1 times, picture 2 is a picture obtained by magnifying the first picture by A2 times, picture 3 is a picture obtained by magnifying the first picture by A3 times,..., picture n is a picture obtained by magnifying the first picture by Am times.

[0247] In addition, the mobile phone can also determine the second cropping area 1 corresponding to the picture 1, the second cropping area 2 corresponding to the picture 2, the second cropping area 3 corresponding to the picture 3, ... the second cropping area m corresponding to the picture m.

[0248] S370: Crop and display the corresponding third image according to the first cropping area.

[0249] The first cropping area is the cropping area that meets at most the third preset condition among all the second cropping areas.

[0250] In the embodiment of the present application, the third preset condition is a condition for predicting the display effect of the cropped image.

[0251] In this embodiment of the present application, the third preset condition may include:

[0252] Condition A: When the first picture includes two portraits, the second cropping area also includes the two portraits.

[0253] In an optional implementation, when the first image includes two portraits, the mobile phone can determine the face positions of the two portraits, and the mobile phone can determine whether the face positions of the two portraits are located within the second cropping area.

[0254] If both faces are located within the first cropping area, it means that the first cropping area includes the two portraits. In this way, the portraits in the image cropped according to the second cropping area are evenly distributed, and the display effect is good.

[0255] If the face position of at least one portrait is not located in the second cropping area, it means that the second cropping area does not include the two portraits. In this way, the image cropped according to the second cropping area does not include the two portraits, and the cropping effect is poor.

[0256] Condition B: When the first image includes only a human portrait, the human body is not cut off within the cropping area.

[0257] Condition C: The composition index of the cropped area is greater than the first value. The composition index is used to reflect the composition effect of the image. The higher the composition index, the better the composition effect of the image.

[0258] It should be noted that the third preset condition is merely an example, and the third preset condition may also be other conditions for predicting the display effect of the cropped image.

[0259] For example, the mobile phone obtains picture 1, picture 2, and picture 3 according to S320 to S350, and determines that the second cropping area of ​​picture 1 is cropping area 1, the second cropping area of ​​picture 2 is cropping area 2, and the second cropping area of ​​picture 3 is cropping area 3.

[0260] Among them, if cropping area 1 and cropping area 3 meet the above-mentioned condition C, and cropping area 3 meets the above-mentioned condition A and condition C, then cropping area 2 is the second cropping area that meets at most the third preset condition. The mobile phone can use cropping area 2 as the first cropping area, and crop the third picture corresponding to cropping area 2 according to the first cropping area to obtain the second picture, and display the second picture with a depth of field effect.

[0261] In an optional embodiment, if multiple second cropping areas satisfy the same number of the third preset conditions, and the number is the largest, the phone may select the second cropping area with the largest adjustment coefficient among the multiple second cropping areas as the first cropping area. This way, the portrait in the resulting second image will be the largest among all images supporting the depth of field effect, providing a better display effect.

[0262] In an optional embodiment, before executing S320, the mobile phone may first determine a third cropping region in the first image (i.e., the second cropping region when n=1) based on the first parameter information and the second parameter information. If the area ratio of the portrait in the third cropping region is less than or equal to the second threshold, the size of the first image is enlarged by n times to obtain the third image.

[0263] If the area ratio of the portrait in the third cropping area is greater than the second threshold, it means that the cropping area with the smallest area ratio of the portrait cannot achieve a good display effect. As the first image is zoomed in, the area ratio of the portrait in the second cropping area will only increase, and a good display effect will be even less likely to be achieved. Therefore, if the area ratio of the portrait in the third cropping area is greater than the second threshold, S340 can be skipped and the first image can be directly cropped and the cropped image can be displayed without a depth of field effect, or the mobile phone can directly display the first image without a depth of field effect.

[0264] In another optional embodiment, the mobile phone can obtain all values ​​of the adjustment coefficient n and amplify the first image according to all values ​​of the adjustment coefficient n to obtain corresponding third images. The mobile phone can then obtain the second cropping area corresponding to each third image and determine the first cropping area from all the second cropping areas. The corresponding third image can then be cropped according to the first cropping area and displayed.

[0265] Comparing the flowcharts shown in Figures 10 and 17, both can achieve the setting of a depth-of-field wallpaper. However, the results achieved are different. The process shown in Figure 10 is simpler and requires less computation, thus conserving computing resources. The process shown in Figure 17 generates multiple cropping regions, then selects the optimal cropping region from these regions for cropping, resulting in a better display effect.

[0266] Refer to FIG20 , which is a method for determining the highest point of an object provided by an embodiment of the present application, which specifically illustrates the process of determining the position information of the highest point of the portrait. As shown in FIG20 , the method includes:

[0267] S410~S440.

[0268] S410: Perform face detection on the first image to determine position information of all faces.

[0269] In an embodiment of the present application, the mobile phone can use the face detection module of the application framework layer to perform face detection on the original image, identify all faces in the first image, and the location information of each face.

[0270] Among them, the face detection module can be implemented using face recognition algorithms such as recognition algorithms based on facial feature points, recognition algorithms based on the entire face image, recognition algorithms based on templates, and algorithms using neural networks for recognition, without specific restrictions here.

[0271] S420: Determine a first range.

[0272] In an embodiment of the present application, the mobile phone obtains a third boundary by moving the portrait center to the left by a first distance and a fourth boundary by moving the portrait center to the right by a second distance, and the first range is determined by the third boundary and the fourth boundary.

[0273] If the first image includes only a portrait, the mobile phone may determine the first distance and the second distance based on the width of the face frame. The first distance and the second distance are greater than or equal to half the width of the face frame. For details, see the relevant description in S220 and will not be repeated here.

[0274] If the first image includes multiple portraits, the mobile phone can determine the first distance and the second distance based on the width of the first control, wherein the first distance and the second distance are greater than or equal to half the width of the first control.

[0275] S430: Perform cutout on the first image to obtain a cutout result.

[0276] The cutout result is the result of separating the foreground and non-foreground of the first image. In an optional embodiment, the cutout result may also be referred to as a fourth image.

[0277] In an embodiment of the present application, the cutout result includes a first type of pixel points and a second type of pixel points. The first type of pixel points are pixel points belonging to the foreground in the first image, and the second type of pixel points are pixel points other than the foreground in the first image.

[0278] For example, the cutout result may be a grayscale image, where the grayscale value of each pixel indicates whether each pixel in the first image belongs to a foreground object or not. For example, a pixel value of 0 (i.e., a black pixel) may indicate that the pixel belongs to the foreground of the first image, and a pixel value of 0 (i.e., a white pixel) may indicate that the pixel does not belong to the foreground of the first image.

[0279] For example, by performing a cutout on the first image shown in (a) of FIG21A , a cutout result as shown in (b) of FIG21A can be obtained, wherein the foreground portion is black and the non-foreground portion is white.

[0280] S440: Determine the highest point of the portrait based on the first range and the cutout result.

[0281] In an embodiment of the present application, the electronic device can determine the position information of the target pixel point in the cutout result, and use the position information of the target pixel point as the position information of the highest point of the object.

[0282] In an optional implementation, the target pixel point is the highest point among all first-category pixel points in the cutout result.

[0283] In another optional embodiment, the target pixel is the highest point among all first-category pixels within a first range of the cutout result. The first range is related to the number of portraits included in the first image. For details, see S220 regarding the highest point of the portraits, which will not be repeated here.

[0284] It should be noted that, when the electronic device executes S310 to S360 , the electronic device needs to determine the highest point of the portrait in the third picture. The process of determining the highest point of the portrait in the third picture can be referred to S410 to S440 .

[0285] For example, as shown in FIG21B , the electronic device may obtain the size w*h of the first image, then magnify the first image n times to obtain a third image, and determine the size of the third image to be nw*nh. The electronic device may then determine the center of the portrait of the third image. If the third image includes only one portrait, the electronic device may determine the first range based on the center of the portrait and the width of the face frame, and then determine the highest point of the portrait in combination with the cutout result of the third image and the first range; if the third image includes multiple portraits, the electronic device may determine the first range based on the center of the portrait and the width of the first control, and then determine the highest point of the portrait in combination with the cutout result of the third image and the first range.

[0286] The method for setting wallpaper provided in the embodiment of the present application is described below with reference to the layered architecture shown in FIG4 .

[0287] 22 is a flowchart of another method for setting wallpaper provided in an embodiment of the present application. As shown in FIG22 , the method for setting wallpaper may include S501 to S516.

[0288] S501: A first application receives a first operation of a user to set a first picture as wallpaper.

[0289] For example, the first application may be a gallery application, or other applications that have a wallpaper setting function.

[0290] S502: The first application sends a face detection request to the face detection module.

[0291] The face detection request carries the data of the first image.

[0292] In an optional implementation, the first application may send a face detection request to the face detection module through a face detection interface.

[0293] S503: The face detection module sends the face detection result to the first application.

[0294] The face detection result includes the position information of all faces in the first image.

[0295] S504: The first application determines whether there is a face in the first image based on the face detection result.

[0296] If there is a face in the first picture, S505 is executed; if there is no face in the first picture, the first application can preview the first picture without the depth of field effect.

[0297] S505: The first application sends a cropping request to the cropping module.

[0298] The cropping request may carry the face detection result and the data of the first image.

[0299] In an optional implementation, the first application may send a cropping request to the cropping module through a cropping interface.

[0300] S506: The cropping module sends a cutout request to the cutout module.

[0301] The cutout request carries the data of the first image.

[0302] S507: The cutout module sends the cutout result to the cropping module.

[0303] S508: The cropping module determines first parameter information according to the image cutout result and the face detection result.

[0304] For the description of the first parameter information, please refer to S220 and will not be repeated here.

[0305] S509: The cropping module enlarges the size of the first image by n times to obtain a third image.

[0306] S510: The cropping module determines a second cropping area in the third picture according to the first parameter information and the second parameter information.

[0307] S511: The cropping module determines whether the second cropping area meets a second preset condition.

[0308] If the second cropping area meets the second preset condition, S512 is executed; if the second cropping area does not meet the second preset condition, S514 is executed.

[0309] S512: Determine whether n is greater than the minimum adjustment coefficient.

[0310] Among them, the minimum adjustment coefficient is the minimum value n of the adjustment coefficient n min .

[0311] If n>n min , then execute 513; if n≤n min , then execute S514.

[0312] S513, the cropping module reduces n.

[0313] S514: The cropping module determines a first cropping area from the second cropping area.

[0314] S515: The cropping module sends the first cropping area to the first application.

[0315] S516: The first application crops the corresponding third image according to the first cropping area and displays the cropped image.

[0316] To sum up, the method for setting wallpaper provided in the embodiment of the present application crops the photos taken by the user or the pictures downloaded so that they can be displayed with a depth of field effect, and can meet the user's personalized needs when using depth of field wallpaper.

[0317] In an optional embodiment, the face detection module can perform face detection on all images in the gallery application during a preset time period (e.g., 12:00 AM to 3:00 AM, when the user is asleep) to obtain face detection results. In this way, when the first application receives the first operation from the user to set the first image as wallpaper, the first application can directly obtain the face detection result of the first image from the face detection module, without the need for the face detection module to perform temporary detection. This shortens the time consumed by face detection and makes the process of setting the depth of field wallpaper by the user smoother.

[0318] In an optional embodiment, the cutout result can be obtained by cutting out all images in the gallery application during a preset time period (e.g., 12:00 AM to 3:00 AM, when the user is asleep). In this way, after receiving the cropping request, the cropping module can directly obtain the cutout result of the first image from the cutout module, without the need for a temporary cutout operation based on the cutout result. This shortens the time consumed by the cutout operation and makes the process of setting the depth of field wallpaper more smooth.

[0319] It should be noted that the above embodiment describes a specific process when the object is a portrait, the highest point of the portrait is the highest point of the object, the center of the portrait is the center of the object, and the area ratio of the portrait is the area ratio of the object.

[0320] The above embodiments can also be applied to situations where the objects are other objects, such as animals, scenery, and fruit. The difference lies in the fact that the electronic device uses different object recognition algorithms when the objects are animals, scenery, fruit, and other objects. For example, when the objects are animals, an animal recognition algorithm can be used to identify the animal in the image. In other words, the image can be recognized using an algorithm corresponding to the object being identified.

[0321] In addition, if the object is not a portrait, the third boundary may be the left boundary of the leftmost object in the first image, and the fourth boundary may be the right boundary of the rightmost object in the first image. The left boundary of the leftmost object may be a straight line passing through the leftmost pixel of the leftmost object and perpendicular to the x-axis, and the right boundary of the rightmost object may be a straight line passing through the rightmost pixel of the rightmost object and perpendicular to the x-axis.

[0322] Furthermore, when the first image includes an object, the first distance and the second distance are greater than or equal to half of the width of the object, where the width of the object may be the distance from the leftmost pixel of the object to the rightmost pixel of the object.

[0323] An embodiment of the present application further provides a chip system, which includes at least one processor and at least one interface circuit. The processor and the interface circuit can be interconnected via lines. For example, the interface circuit can be used to receive signals from other devices (such as a memory of an electronic device). For another example, the interface circuit can be used to send signals to other devices (such as a processor). Exemplarily, the interface circuit can read instructions stored in the memory and send the instructions to the processor. When the instructions are executed by the processor, the electronic device or server can perform the various steps in the above embodiments. Of course, the chip system can also include other discrete devices, which is not specifically limited in the embodiment of the present application.

[0324] This embodiment further provides a computer-readable storage medium, in which computer instructions are stored. When the computer instructions are executed on an electronic device, the electronic device executes each function or step in the above method embodiment.

[0325] This embodiment further provides a computer program product. When the computer program product is run on an electronic device, the electronic device is enabled to perform each function or step in the above method embodiment.

[0326] In addition, an embodiment of the present application also provides a device, which can specifically be a chip, component or module, and the device may include a connected processor and memory; wherein the memory is used to store computer-executable instructions, and when the device is running, the processor can execute the computer-executable instructions stored in the memory to enable the chip to perform the various functions or steps performed by the mobile phone in the above method embodiment.

[0327] Among them, the electronic device, communication system, computer-readable storage medium, computer program product or chip provided in this embodiment are all used to execute the corresponding methods provided above. Therefore, the beneficial effects that can be achieved can refer to the beneficial effects in the corresponding methods provided above, and will not be repeated here.

[0328] Through the description of the above implementation methods, technical personnel in the relevant field can clearly understand that for the convenience and simplicity of description, only the division of the above-mentioned functional modules is used as an example. In actual applications, the above-mentioned functions can be assigned to different functional modules as needed, that is, the internal structure of the device can be divided into different functional modules to complete all or part of the functions described above.

[0329] In the several embodiments provided in this application, it should be understood that the disclosed devices and methods can be implemented in other ways. For example, the device embodiments described above are merely schematic. For example, the division of the modules or units is only a logical function division. In actual implementation, there may be other division methods, such as multiple units or components can be combined or integrated into another device, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.

[0330] The units described as separate components may or may not be physically separate, and the components shown as units may be one physical unit or multiple physical units, that is, they may be located in one place or distributed in multiple places. Some or all of the units may be selected according to actual needs to achieve the purpose of the present embodiment.

[0331] In addition, the functional units in the various embodiments of the present application may be integrated into a single processing unit, or each unit may exist physically separately, or two or more units may be integrated into a single unit. The aforementioned integrated units may be implemented in the form of hardware or software functional units.

[0332] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a readable storage medium. Based on this understanding, the technical solution of the embodiment of the present application is essentially or the part that contributes to the prior art or all or part of the technical solution can be embodied in the form of a software product, which is stored in a storage medium and includes several instructions for enabling a device (which can be a single-chip microcomputer, chip, etc.) or a processor (processor) to execute all or part of the steps of the various embodiments of the present application. The aforementioned storage medium includes: various media that can store program codes, such as a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk.

[0333] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present application and are not intended to limit the present application. Although the present application has been described in detail with reference to the preferred embodiments, those skilled in the art should understand that the technical solutions of the present application may be modified or replaced by equivalents without departing from the spirit and scope of the technical solutions of the present application.

Claims

1. A method for setting wallpaper, characterized in that: Applied to an electronic device including a display screen, the method comprises: receiving a first operation of a user setting a first picture as a wallpaper, wherein a foreground of the first picture includes one or more objects; In response to the first operation, a first interface is displayed; wherein the first interface includes a second picture and a first control, an object in the second picture obstructs a portion of the first control, and the second picture is obtained by cropping the first picture based on a target point of the first picture, the target point is the highest point among candidate points in the first picture, and the candidate point is the highest point of the one or more objects.

2. The method according to claim 1, characterized in that The method further comprises: Acquire position information of first-category pixel points of the first image, where the first-category pixel points are pixel points belonging to the foreground in the first image; Determine the target point of the first picture according to the position information of the first type of pixel points.

3. The method according to claim 2, characterized in that The acquiring the position information of the first type of pixel points of the first image includes: Performing a cutout process on the first image to obtain a cutout result, wherein the cutout process is used to separate a foreground and a non-foreground of the first image, and the cutout result includes the first type of pixel points; According to the cutout result, position information of the first type of pixel points of the first image is obtained.

4. The method according to claim 1, characterized in that: The candidate point is the highest point of a target object among the one or more objects, and the target object is an object within a first range of the first picture.

5. The method according to claim 4, characterized in that The method further comprises: Determine an object center of the first picture, where the object center is used to reflect the center of the one or more objects in a horizontal direction; The first boundary of the first range is obtained by moving the center of the object in a first horizontal direction by a first distance, and the second boundary of the first range is obtained by moving the center of the object in a second horizontal direction by a first distance; wherein the first horizontal direction is opposite to the second horizontal direction.

6. The method according to claim 5, characterized in that The foreground includes an object, and the distance between the first boundary and the second boundary is greater than or equal to the width of the key area of ​​the object; or The foreground includes a plurality of objects, and a distance between the first border and the second border is greater than or equal to a width of the first control.

7. The method according to claim 6, characterized in that The object is a person image, and the key area of ​​the object is a face area of ​​the person object.

8. The method according to any one of claims 5 to 7, characterized in that: The object center is the axis of symmetry between the third boundary perpendicular to the first direction and the fourth boundary perpendicular to the first direction, the position information of the object center is the coordinate of the axis of symmetry in the first direction, and the third boundary and the fourth boundary are two boundaries of the one or more objects in the first direction.

9. The method according to claim 8, characterized in that The determining the object center of the first picture includes: Detecting one or more objects in the first image to obtain position information of key points in the first image, where the position information of the key points includes coordinates of the key points in the first direction; Using the minimum coordinate of the key point in the first direction as the coordinate of the third boundary, and using the maximum coordinate of the key point in the first direction as the coordinate of the fourth boundary; According to the coordinates of the third boundary and the coordinates of the fourth boundary, a symmetry axis between the third boundary and the fourth boundary is determined as the object center of the first picture.

10. The method according to claim 9, characterized in that The object is a person image, and the key point is a face.

11. An electronic device, characterized in that: The electronic device comprises: a memory, a processor and a display screen; The processor is coupled to the memory and the display screen; wherein the memory is used to store computer program codes, and the computer program codes include computer instructions; When the computer instructions are executed by the processor, the electronic device executes the method according to any one of claims 1 to 10.

12. A computer-readable storage medium, characterized in that: The method comprises computer instructions; when the computer instructions are executed on an electronic device, the electronic device executes the method as claimed in any one of claims 1 to 10.