[go: up one dir, main page]

WO2022105702A1 - Method and electronic device for saving image - Google Patents

Method and electronic device for saving image Download PDF

Info

Publication number
WO2022105702A1
WO2022105702A1 PCT/CN2021/130540 CN2021130540W WO2022105702A1 WO 2022105702 A1 WO2022105702 A1 WO 2022105702A1 CN 2021130540 W CN2021130540 W CN 2021130540W WO 2022105702 A1 WO2022105702 A1 WO 2022105702A1
Authority
WO
WIPO (PCT)
Prior art keywords
electronic device
angle
user
plane
photo
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Ceased
Application number
PCT/CN2021/130540
Other languages
French (fr)
Chinese (zh)
Inventor
何小祥
丁匡正
何刚
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Huawei Technologies Co Ltd
Original Assignee
Huawei Technologies Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Huawei Technologies Co Ltd filed Critical Huawei Technologies Co Ltd
Publication of WO2022105702A1 publication Critical patent/WO2022105702A1/en
Anticipated expiration legal-status Critical
Ceased legal-status Critical Current

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N23/00Cameras or camera modules comprising electronic image sensors; Control thereof
    • H04N23/60Control of cameras or camera modules
    • H04N23/63Control of cameras or camera modules by using electronic viewfinders
    • H04N23/631Graphical user interfaces [GUI] specially adapted for controlling image capture or setting capture parameters
    • H04N23/632Graphical user interfaces [GUI] specially adapted for controlling image capture or setting capture parameters for displaying or modifying preview images prior to image capturing, e.g. variety of image resolutions or capturing parameters

Definitions

  • the present application relates to the field of electronic technologies, and in particular, to a method and electronic device for saving images.
  • the direction in which the photos are saved is generally related to the posture of the user holding the electronic device. For example, when the user holds the electronic device vertically to shoot horizontally, the user's intention is to let the electronic device vertically save the captured photos. , but since the user is holding the electronic device for horizontal shooting, the plane where the panel of the electronic device is located may not be parallel to the horizontal plane. Therefore, the gravity sensor in the electronic device may mistakenly think that the user is shooting horizontally, so the photo is saved horizontally. .
  • the user generally manually rotates the photo in the wrong direction, or the electronic device prompts the user whether to save the photo horizontally or vertically. In either case, the user needs to manually adjust it. To a certain extent, it affects the user's shooting experience.
  • the present application provides a method and electronic device for saving an image.
  • the electronic device can automatically save and the direction of the target shot that the user sees in the shooting preview interface. Consistent photo.
  • a method for saving an image is provided, the method is applied to an electronic device, and the method includes: the electronic device displays a first interface in response to a first operation of a user, and the first interface is a shooting preview interface of the electronic device ; the electronic device acquires a first photo in response to the user's shooting operation; the electronic device determines a first angle, and the first angle is the position of the first preset part of the electronic device and the first angle when acquiring the first photo The angle between the line connecting the positions of the two preset parts and the preset geographic direction; when the electronic device determines that the first angle is within the range of the first preset angle, it rotates the first photo; the electronic device saves the rotated first photo photo.
  • the electronic device when the electronic device acquires the first photo in response to the user's operation, the electronic device determines the connection between the position of the first preset part and the position of the second preset part and the first position of the preset geographic direction. When the angle is within the preset angle range, the first photo is rotated, and the rotated first photo is saved. When the user holds the electronic device in different postures to take pictures, the taken photo can be automatically rotated and saved, and the technical solution is beneficial to the user to check the taken photo more comfortably.
  • the method further includes: the electronic device detects a second operation of the user; the electronic device displays a second interface in response to the second operation, the second interface The rotated first photo is included, wherein the direction of the target photographed object in the first interface is the same as the direction of the target photographed object in the second interface.
  • the direction of the target photograph in the first interface is the same as the direction of the target photograph in the second interface.
  • the technical solution can make what the user see is what you get when shooting horizontally, that is, when the user views the photographed photograph, the direction of the target photographed object in the photograph is consistent with the direction that the user sees in the photographing preview interface of the electronic device, thereby It is beneficial for the user to view the photographed photos in a normal posture without rotating the electronic device or manually rotating the photos, which improves the user's photographing experience.
  • determining the first angle by the electronic device includes: determining a second plane, where the second plane is the plane where the user's eyes are located; according to the normal vector of the second plane and the The included angle information between the first planes determines the first angle, wherein the first plane is parallel to the plane where the upper surface of the electronic device is located.
  • the second plane is the plane where the user's eyes are located, and the second plane is perpendicular to the central axis of the user's head.
  • the first angle may be determined according to the angle information between the normal vector of the second plane and the first plane.
  • determining the first angle according to the angle information between the normal vector of the second plane and the first plane includes: according to the normal vector of the second plane The first angle is determined by the second preset angle range in which the angle with the first plane is located.
  • the first angle may be determined according to a second preset range in which the angle between the normal vector of the second plane and the first plane is located. For example, if the second preset angle range is 45 degrees to 135 degrees, the first angle is determined to be 45 degrees or 90 degrees, etc., which is not limited in this embodiment of the present application.
  • determining the first angle by the electronic device includes: when the user holds the electronic device, determining touch information between the user and the electronic device; determining the touch information according to the touch information first angle.
  • the first angle may be determined according to touch information between the user's finger, palm and the electronic device when the user uses the electronic device, and the touch information may be touch information between the user and the frame or screen of the electronic device.
  • determining the first angle according to the touch information includes: inputting the touch information into a neural network model; determining the first angle according to an output result of the neural network model first angle.
  • the electronic device can collect touch information between the user and the electronic device when the user uses the mobile phone, and train a neural network model according to the touch information, and when the user uses the electronic device to shoot, according to the output result of the neural network model
  • the first angle can be determined.
  • the neural network model is pre-trained, which is not limited in this embodiment of the present application.
  • rotating the first photo includes: when the first angle is within the first preset angle When the angle is within the range, rotate the first photo by the first angle counterclockwise.
  • the electronic device determines that the first angle is within the range of the first preset angle, it rotates the first photograph taken counterclockwise according to the first angle, and the technical solution can realize that in the photographed photograph
  • the direction of the target shooting object is consistent with the direction that the user sees in the shooting preview interface of the electronic device, which is beneficial for the user to view the captured photos in a normal posture without rotating the electronic device or manually rotating the photos, which is beneficial for the user to view the photos. , which improves the user's shooting experience.
  • the included angle between the plane where the upper surface of the electronic device is located and the horizontal plane is within a third preset angle range.
  • the electronic device is in a horizontal state
  • the horizontal state can be understood as a plane on which the upper surface of the electronic device is located is parallel or nearly parallel to the horizontal plane.
  • the third preset angle range may be minus 3 degrees to 3 degrees, -5 degrees to 5 degrees, and so on.
  • an electronic device comprising: one or more processors; one or more memories; the one or more memories stores one or more computer programs, the one or more computer programs Including an instruction, when the instruction is executed by one or more processors, causing the electronic device to perform the following steps: in response to the user's first operation, displaying a first interface, the first interface is the shooting preview interface of the electronic device; responding to Obtain a first photo based on a user's shooting operation; determine a first angle, where the first angle is a line connecting the position of the first preset part of the electronic device and the position of the second preset part when the first photo is obtained The included angle with the preset geographic direction; when it is determined that the first angle is within the range of the first preset angle, the first photo is rotated; and the rotated first photo is saved.
  • the electronic device when the instruction is executed by one or more processors, the electronic device is caused to perform the following steps: detecting a second operation of the user; responding to the first operation The second operation is to display a second interface, the second interface includes the rotated first photo, wherein the direction of the target photographed object in the first interface is the same as the direction of the target photographed object in the second interface.
  • the electronic device is specifically configured to: determine a second plane, where the second plane is the plane where the user's eyes are located; according to the normal vector of the second plane and the first plane The angle information between the planes determines the first angle, wherein the first plane is parallel to the plane on which the upper surface of the electronic device is located.
  • the electronic device is specifically configured to: determine according to a second preset angle range in which the angle between the normal vector of the second plane and the first plane is located the first angle.
  • the electronic device is specifically configured to: determine touch information between the user and the electronic device when the user holds the electronic device; determine the first touch information according to the touch information angle.
  • the electronic device is specifically configured to: input the touch information into a neural network model; and determine the first angle according to an output result of the neural network model.
  • the electronic device is specifically configured to: when the first angle is within a first preset angle range, rotate the first photo by the first angle counterclockwise .
  • the included angle between the plane where the upper surface of the electronic device is located and the horizontal plane is within a third preset angle range.
  • a computer-readable storage medium which is characterized in that it includes computer instructions, and when the computer instructions are executed on an electronic device, the electronic device is made to perform the above-mentioned first aspect and any one of the implementations thereof.
  • a computer program product which is characterized in that it includes computer instructions, and when the computer instructions are executed on an electronic device, the electronic device is made to execute the above-mentioned first aspect and any one of its implementation manners. The described method of saving images.
  • FIG. 1 is a schematic diagram of a hardware structure of an electronic device provided by an embodiment of the present application.
  • FIG. 2 is a schematic diagram of a software structure of an electronic device provided by an embodiment of the present application.
  • FIG. 3 is a schematic diagram of a group of GUIs provided by an embodiment of the present application.
  • FIG. 4 is a schematic diagram of the relationship between the plane where the terminal panel is located and the normal vector of the plane where the user's eyes are located according to an embodiment of the present application.
  • FIG. 5 is a schematic diagram of another group of GUIs provided by an embodiment of the present application.
  • FIG. 6 is a schematic diagram of another group of GUIs provided by an embodiment of the present application.
  • FIG. 7 is a schematic diagram of another group of GUIs provided by an embodiment of the present application.
  • FIG. 8 is a schematic flowchart of a method for saving an image provided by an embodiment of the present application.
  • FIG. 9 is a schematic flowchart of another method for saving an image provided by an embodiment of the present application.
  • FIG. 10 is a schematic flowchart of another method for saving an image provided by an embodiment of the present application.
  • FIG. 11 is a schematic flowchart of another method for saving an image provided by an embodiment of the present application.
  • FIG. 12 is a schematic flowchart of a method for saving an image provided by an embodiment of the present application.
  • first and second are only used for descriptive purposes, and should not be construed as indicating or implying relative importance or implicitly indicating the number of indicated technical features.
  • a feature defined as “first” or “second” may expressly or implicitly include one or more of that feature.
  • the method for saving images provided by the embodiments of the present application can be applied to mobile phones, tablet computers, wearable devices, in-vehicle devices, augmented reality (AR)/virtual reality (VR) devices, notebook computers, super mobile personal On electronic devices such as a computer (ultra-mobile personal computer, UMPC), a netbook, and a personal digital assistant (personal digital assistant, PDA), the embodiments of the present application do not impose any restrictions on the specific type of the electronic device.
  • AR augmented reality
  • VR virtual reality
  • notebook computers notebook computers
  • super mobile personal On electronic devices such as a computer (ultra-mobile personal computer, UMPC), a netbook, and a personal digital assistant (personal digital assistant, PDA)
  • PDA personal digital assistant
  • FIG. 1 shows a schematic structural diagram of an electronic device 100 .
  • the electronic device 100 may include a processor 110, an external memory interface 120, an internal memory 121, a universal serial bus (USB) interface 130, a charge management module 140, a power management module 141, a battery 142, an antenna 1, an antenna 2 , mobile communication module 150, wireless communication module 160, audio module 170, speaker 170A, receiver 170B, microphone 170C, headphone jack 170D, sensor module 180, buttons 190, motor 191, indicator 192, camera 193, display screen 194, and Subscriber identification module (subscriber identification module, SIM) card interface 195 and so on.
  • SIM Subscriber identification module
  • the sensor module 180 may include a pressure sensor 180A, a gyroscope sensor 180B, an air pressure sensor 180C, a magnetic sensor 180D, an acceleration sensor 180E, a distance sensor 180F, a proximity light sensor 180G, a fingerprint sensor 180H, a temperature sensor 180J, a touch sensor 180K, and ambient light. Sensor 180L, bone conduction sensor 180M, etc.
  • the structures illustrated in the embodiments of the present application do not constitute a specific limitation on the electronic device 100 .
  • the electronic device 100 may include more or less components than shown, or combine some components, or separate some components, or arrange different components.
  • the illustrated components may be implemented in hardware, software, or a combination of software and hardware.
  • the processor 110 may include one or more processing units, for example, the processor 110 may include an application processor (application processor, AP), a modem processor, a graphics processor (graphics processing unit, GPU), an image signal processor (image signal processor, ISP), controller, memory, video codec, digital signal processor (digital signal processor, DSP), baseband processor, and/or neural-network processing unit (NPU) Wait. Wherein, different processing units may be independent devices, or may be integrated in one or more processors.
  • application processor application processor, AP
  • modem processor graphics processor
  • graphics processor graphics processor
  • ISP image signal processor
  • controller memory
  • video codec digital signal processor
  • DSP digital signal processor
  • NPU neural-network processing unit
  • the controller may be the nerve center and command center of the electronic device 100 .
  • the controller can generate an operation control signal according to the instruction operation code and timing signal, and complete the control of fetching and executing instructions.
  • a memory may also be provided in the processor 110 for storing instructions and data.
  • the memory in processor 110 is cache memory. This memory may hold instructions or data that have just been used or recycled by the processor 110 . If the processor 110 needs to use the instruction or data again, it can be called directly from the memory. Repeated accesses are avoided and the latency of the processor 110 is reduced, thereby increasing the efficiency of the system.
  • the processor 110 may include one or more interfaces.
  • the interface may include an integrated circuit (inter-integrated circuit, I2C) interface, an integrated circuit built-in audio (inter-integrated circuit sound, I2S) interface, a pulse code modulation (pulse code modulation, PCM) interface, a universal asynchronous transceiver (universal asynchronous transmitter) receiver/transmitter, UART) interface, mobile industry processor interface (MIPI), general-purpose input/output (GPIO) interface, subscriber identity module (SIM) interface, and / or universal serial bus (universal serial bus, USB) interface, etc.
  • I2C integrated circuit
  • I2S integrated circuit built-in audio
  • PCM pulse code modulation
  • PCM pulse code modulation
  • UART universal asynchronous transceiver
  • MIPI mobile industry processor interface
  • GPIO general-purpose input/output
  • SIM subscriber identity module
  • USB universal serial bus
  • the I2C interface is a bidirectional synchronous serial bus that includes a serial data line (SDA) and a serial clock line (SCL).
  • the processor 110 may contain multiple sets of I2C buses.
  • the processor 110 can be respectively coupled to the touch sensor 180K, the charger, the flash, the camera 193 and the like through different I2C bus interfaces.
  • the processor 110 may couple the touch sensor 180K through the I2C interface, so that the processor 110 and the touch sensor 180K communicate with each other through the I2C bus interface, so as to realize the touch function of the electronic device 100 .
  • the I2S interface can be used for audio communication.
  • the processor 110 may contain multiple sets of I2S buses.
  • the processor 110 may be coupled with the audio module 170 through an I2S bus to implement communication between the processor 110 and the audio module 170 .
  • the audio module 170 can transmit audio signals to the wireless communication module 160 through the I2S interface, so as to realize the function of answering calls through a Bluetooth headset.
  • the PCM interface can also be used for audio communications, sampling, quantizing and encoding analog signals.
  • the audio module 170 and the wireless communication module 160 may be coupled through a PCM bus interface.
  • the audio module 170 can also transmit audio signals to the wireless communication module 160 through the PCM interface, so as to realize the function of answering calls through the Bluetooth headset. Both the I2S interface and the PCM interface can be used for audio communication.
  • the UART interface is a universal serial data bus used for asynchronous communication.
  • the bus may be a bidirectional communication bus. It converts the data to be transmitted between serial communication and parallel communication.
  • a UART interface is typically used to connect the processor 110 with the wireless communication module 160 .
  • the processor 110 communicates with the Bluetooth module in the wireless communication module 160 through the UART interface to implement the Bluetooth function.
  • the audio module 170 can transmit audio signals to the wireless communication module 160 through the UART interface, so as to realize the function of playing music through the Bluetooth headset.
  • the MIPI interface can be used to connect the processor 110 with peripheral devices such as the display screen 194 and the camera 193 .
  • MIPI interfaces include camera serial interface (CSI), display serial interface (DSI), etc.
  • the processor 110 communicates with the camera 193 through a CSI interface, so as to realize the photographing function of the electronic device 100 .
  • the processor 110 communicates with the display screen 194 through the DSI interface to implement the display function of the electronic device 100 .
  • the GPIO interface can be configured by software.
  • the GPIO interface can be configured as a control signal or as a data signal.
  • the GPIO interface may be used to connect the processor 110 with the camera 193, the display screen 194, the wireless communication module 160, the audio module 170, the sensor module 180, and the like.
  • the GPIO interface can also be configured as I2C interface, I2S interface, UART interface, MIPI interface, etc.
  • the USB interface 130 is an interface that conforms to the USB standard specification, and may specifically be a Mini USB interface, a Micro USB interface, a USB Type C interface, and the like.
  • the USB interface 130 can be used to connect a charger to charge the electronic device 100, and can also be used to transmit data between the electronic device 100 and peripheral devices. It can also be used to connect headphones to play audio through the headphones.
  • the interface can also be used to connect other electronic devices, such as AR devices.
  • the interface connection relationship between the modules illustrated in the embodiments of the present application is only a schematic illustration, and does not constitute a structural limitation of the electronic device 100 .
  • the electronic device 100 may also adopt different interface connection manners in the foregoing embodiments, or a combination of multiple interface connection manners.
  • the charging management module 140 is used to receive charging input from the charger.
  • the charger may be a wireless charger or a wired charger.
  • the charging management module 140 may receive charging input from the wired charger through the USB interface 130 .
  • the charging management module 140 may receive wireless charging input through a wireless charging coil of the electronic device 100 . While the charging management module 140 charges the battery 142 , it can also supply power to the electronic device through the power management module 141 .
  • the power management module 141 is used for connecting the battery 142 , the charging management module 140 and the processor 110 .
  • the power management module 141 receives input from the battery 142 and/or the charging management module 140 and supplies power to the processor 110 , the internal memory 121 , the external memory, the display screen 194 , the camera 193 , and the wireless communication module 160 .
  • the power management module 141 can also be used to monitor parameters such as battery capacity, battery cycle times, battery health status (leakage, impedance).
  • the power management module 141 may also be provided in the processor 110 .
  • the power management module 141 and the charging management module 140 may also be provided in the same device.
  • the wireless communication function of the electronic device 100 may be implemented by the antenna 1, the antenna 2, the mobile communication module 150, the wireless communication module 160, the modulation and demodulation processor, the baseband processor, and the like.
  • Antenna 1 and Antenna 2 are used to transmit and receive electromagnetic wave signals.
  • Each antenna in electronic device 100 may be used to cover a single or multiple communication frequency bands. Different antennas can also be reused to improve antenna utilization.
  • the antenna 1 can be multiplexed as a diversity antenna of the wireless local area network. In other embodiments, the antenna may be used in conjunction with a tuning switch.
  • the mobile communication module 150 may provide wireless communication solutions including 2G/3G/4G/5G etc. applied on the electronic device 100 .
  • the mobile communication module 150 may include at least one filter, switch, power amplifier, low noise amplifier (LNA) and the like.
  • the mobile communication module 150 can receive electromagnetic waves from the antenna 1, filter and amplify the received electromagnetic waves, and transmit them to the modulation and demodulation processor for demodulation.
  • the mobile communication module 150 can also amplify the signal modulated by the modulation and demodulation processor, and then turn it into an electromagnetic wave for radiation through the antenna 1 .
  • at least part of the functional modules of the mobile communication module 150 may be provided in the processor 110 .
  • at least part of the functional modules of the mobile communication module 150 may be provided in the same device as at least part of the modules of the processor 110 .
  • the modem processor may include a modulator and a demodulator.
  • the modulator is used to modulate the low frequency baseband signal to be sent into a medium and high frequency signal.
  • the demodulator is used to demodulate the received electromagnetic wave signal into a low frequency baseband signal. Then the demodulator transmits the demodulated low-frequency baseband signal to the baseband processor for processing.
  • the low frequency baseband signal is processed by the baseband processor and passed to the application processor.
  • the application processor outputs sound signals through audio devices (not limited to the speaker 170A, the receiver 170B, etc.), or displays images or videos through the display screen 194 .
  • the modem processor may be a stand-alone device.
  • the modem processor may be independent of the processor 110, and may be provided in the same device as the mobile communication module 150 or other functional modules.
  • the wireless communication module 160 can provide applications on the electronic device 100 including wireless local area networks (WLAN) (such as wireless fidelity (Wi-Fi) networks), bluetooth (BT), global navigation satellites Wireless communication solutions such as global navigation satellite system (GNSS), frequency modulation (FM), near field communication (NFC), and infrared technology (IR).
  • WLAN wireless local area networks
  • BT Bluetooth
  • GNSS global navigation satellite system
  • FM frequency modulation
  • NFC near field communication
  • IR infrared technology
  • the wireless communication module 160 may be one or more devices integrating at least one communication processing module.
  • the wireless communication module 160 receives electromagnetic waves via the antenna 2 , frequency modulates and filters the electromagnetic wave signals, and sends the processed signals to the processor 110 .
  • the wireless communication module 160 can also receive the signal to be sent from the processor 110 , perform frequency modulation on it, amplify it, and convert it into electromagnetic waves for radiation through the antenna 2 .
  • the antenna 1 of the electronic device 100 is coupled with the mobile communication module 150, and the antenna 2 is coupled with the wireless communication module 160, so that the electronic device 100 can communicate with the network and other devices through wireless communication technology.
  • the wireless communication technology may include global system for mobile communications (GSM), general packet radio service (GPRS), code division multiple access (CDMA), broadband Code Division Multiple Access (WCDMA), Time Division Code Division Multiple Access (TD-SCDMA), Long Term Evolution (LTE), BT, GNSS, WLAN, NFC , FM, and/or IR technology, etc.
  • the GNSS may include global positioning system (global positioning system, GPS), global navigation satellite system (global navigation satellite system, GLONASS), Beidou navigation satellite system (beidou navigation satellite system, BDS), quasi-zenith satellite system (quasi -zenith satellite system, QZSS) and/or satellite based augmentation systems (SBAS).
  • global positioning system global positioning system, GPS
  • global navigation satellite system global navigation satellite system, GLONASS
  • Beidou navigation satellite system beidou navigation satellite system, BDS
  • quasi-zenith satellite system quadsi -zenith satellite system, QZSS
  • SBAS satellite based augmentation systems
  • the electronic device 100 implements a display function through a GPU, a display screen 194, an application processor, and the like.
  • the GPU is a microprocessor for image processing, and is connected to the 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 alter display information.
  • Display screen 194 is used to display images, videos, and the like.
  • Display screen 194 includes a display panel.
  • the display panel can be a liquid crystal display (LCD), an organic light-emitting diode (OLED), an active-matrix organic light-emitting diode or an active-matrix organic light-emitting diode (active-matrix organic light).
  • LED diode AMOLED
  • flexible light-emitting diode flexible light-emitting diode (flex light-emitting diode, FLED), Miniled, MicroLed, Micro-oLed, quantum dot light-emitting diode (quantum dot light emitting diodes, QLED) and so on.
  • the electronic device 100 may include one or N display screens 194 , where N is a positive integer greater than one.
  • the electronic device 100 may implement a shooting function through an ISP, a camera 193, a video codec, a GPU, a display screen 194, an application processor, and the like.
  • the ISP is used to process the data fed back by the camera 193 .
  • the shutter is opened, the light is transmitted to the camera photosensitive element through the lens, the light signal is converted into an electrical signal, and the camera photosensitive element transmits the electrical signal to the ISP for processing, and converts it into an image visible to the naked eye.
  • ISP can also perform algorithm optimization on image noise, brightness, and skin tone.
  • ISP can also optimize the exposure, color temperature and other parameters of the shooting scene.
  • the ISP may be provided in the camera 193 .
  • Camera 193 is used to capture still images or video.
  • the object is projected through the lens to generate an optical image onto the photosensitive element.
  • the photosensitive element may be a charge coupled device (CCD) or a complementary metal-oxide-semiconductor (CMOS) phototransistor.
  • CMOS complementary metal-oxide-semiconductor
  • the photosensitive element converts the optical signal into an electrical signal, and then transmits the electrical signal to the ISP to convert it into a digital image signal.
  • the ISP outputs the digital image signal to the DSP for processing.
  • DSP converts digital image signals into standard RGB, YUV and other formats of image signals.
  • the electronic device 100 may include 1 or N cameras 193 , where N is a positive integer greater than 1.
  • a digital signal processor is used to process digital signals, in addition to processing digital image signals, it can also process other digital signals. For example, when the electronic device 100 selects a frequency point, the digital signal processor is used to perform Fourier transform on the frequency point energy and so on.
  • Video codecs are used to compress or decompress digital video.
  • the electronic device 100 may support one or more video codecs.
  • the electronic device 100 can play or record videos of various encoding formats, such as: Moving Picture Experts Group (moving picture experts group, MPEG) 1, MPEG2, MPEG3, MPEG4 and so on.
  • MPEG Moving Picture Experts Group
  • MPEG2 moving picture experts group
  • MPEG3 MPEG4
  • MPEG4 Moving Picture Experts Group
  • the NPU is a neural-network (NN) computing processor.
  • NN neural-network
  • Applications such as intelligent cognition of the electronic device 100 can be implemented through the NPU, such as image recognition, face recognition, speech recognition, text understanding, and the like.
  • 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 100 .
  • the external memory card communicates with the processor 110 through the external memory interface 120 to realize the data storage function. For example to save files like music, video etc in external memory card.
  • Internal memory 121 may 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 100 by executing the instructions stored in the internal memory 121 .
  • the internal memory 121 may include a storage program area and a storage data area.
  • the storage program area can store an operating system, an application program required for at least one function (such as a sound playback function, an image playback function, etc.), and the like.
  • the storage data area may store data (such as audio data, phone book, etc.) created during the use of the electronic device 100 and the like.
  • the internal memory 121 may include high-speed random access memory, and may also include non-volatile memory, such as at least one magnetic disk storage device, flash memory device, universal flash storage (UFS), and the like.
  • the electronic device 100 may implement audio functions through an audio module 170, a speaker 170A, a receiver 170B, a microphone 170C, an earphone interface 170D, an application processor, and the like. Such as music playback, recording, etc.
  • the audio module 170 is used for converting digital audio information into analog audio signal output, and also for converting analog audio input into digital audio signal. Audio module 170 may also be used to encode and decode audio signals. In some embodiments, the audio module 170 may be provided in the processor 110 , or some functional modules of the audio module 170 may be provided in the processor 110 .
  • Speaker 170A also referred to as a "speaker" is used to convert audio electrical signals into sound signals.
  • the electronic device 100 can listen to music through the speaker 170A, or listen to a hands-free call.
  • the receiver 170B also referred to as "earpiece" is used to convert audio electrical signals into sound signals.
  • the voice can be answered by placing the receiver 170B close to the human ear.
  • the microphone 170C also called “microphone” or “microphone” is used to convert sound signals into electrical signals.
  • the user can make a sound by approaching the microphone 170C through a human mouth, and input the sound signal into the microphone 170C.
  • the electronic device 100 may be provided with at least one microphone 170C. In other embodiments, the electronic device 100 may be provided with two microphones 170C, which can implement a noise reduction function in addition to collecting sound signals. In other embodiments, the electronic device 100 may further be provided with three, four or more microphones 170C to collect sound signals, reduce noise, identify sound sources, and implement directional recording functions.
  • the earphone jack 170D is used to connect wired earphones.
  • the earphone interface 170D may be the USB interface 130, or may be a 3.5mm open mobile terminal platform (OMTP) standard interface, a cellular telecommunications industry association of the USA (CTIA) standard interface.
  • OMTP open mobile terminal platform
  • CTIA cellular telecommunications industry association of the USA
  • the pressure sensor 180A is used to sense pressure signals, and can convert the pressure signals into electrical signals.
  • the pressure sensor 180A may be provided on the display screen 194 .
  • the capacitive pressure sensor may be comprised of at least two parallel plates of conductive material. When a force is applied to the pressure sensor 180A, the capacitance between the electrodes changes.
  • the electronic device 100 determines the intensity of the pressure according to the change in capacitance. When a touch operation acts on the display screen 194, the electronic device 100 detects the intensity of the touch operation according to the pressure sensor 180A.
  • the electronic device 100 may also calculate the touched position according to the detection signal of the pressure sensor 180A.
  • touch operations acting on the same touch position but with different touch operation intensities may correspond to different operation instructions. For example, when a touch operation whose intensity is less than the first pressure threshold acts on the short message application icon, the instruction for viewing the short message is executed. When a touch operation with a touch operation intensity greater than or equal to the first pressure threshold acts on the short message application icon, the instruction to create a new short message is executed.
  • the gyro sensor 180B may be used to determine the motion attitude of the electronic device 100 .
  • the angular velocity of electronic device 100 about three axes ie, x, y, and z axes
  • the gyro sensor 180B can be used for image stabilization.
  • the gyro sensor 180B detects the shaking angle of the electronic device 100, calculates the distance that the lens module needs to compensate according to the angle, and allows the lens to offset the shaking of the electronic device 100 through reverse motion to achieve anti-shake.
  • the gyro sensor 180B can also be used for navigation and somatosensory game scenarios.
  • the air pressure sensor 180C is used to measure air pressure.
  • the electronic device 100 calculates the altitude through the air pressure value measured by the air pressure sensor 180C to assist in positioning and navigation.
  • the magnetic sensor 180D includes a Hall sensor.
  • the electronic device 100 can detect the opening and closing of the flip holster using the magnetic sensor 180D.
  • the electronic device 100 can detect the opening and closing of the flip according to the magnetic sensor 180D. Further, according to the detected opening and closing state of the leather case or the opening and closing state of the flip cover, characteristics such as automatic unlocking of the flip cover are set.
  • the acceleration sensor 180E can detect the magnitude of the acceleration of the electronic device 100 in various directions (generally three axes).
  • the magnitude and direction of gravity can be detected when the electronic device 100 is stationary. It can also be used to identify the posture of electronic devices, and can be used in applications such as horizontal and vertical screen switching, pedometers, etc.
  • the electronic device 100 can measure the distance through infrared or laser. In some embodiments, when shooting a scene, the electronic device 100 can use the distance sensor 180F to measure the distance to achieve fast focusing.
  • Proximity light sensor 180G may include, for example, light emitting diodes (LEDs) and light detectors, such as photodiodes.
  • the light emitting diodes may be infrared light emitting diodes.
  • the electronic device 100 emits infrared light to the outside through the light emitting diode.
  • Electronic device 100 uses photodiodes to detect infrared reflected light from nearby objects. When sufficient reflected light is detected, it can be determined that there is an object near the electronic device 100 . When insufficient reflected light is detected, the electronic device 100 may determine that there is no object near the electronic device 100 .
  • the electronic device 100 can use the proximity light sensor 180G to detect that the user holds the electronic device 100 close to the ear to talk, so as to automatically turn off the screen to save power.
  • Proximity light sensor 180G can also be used in holster mode, pocket mode automatically unlocks and locks the screen.
  • the ambient light sensor 180L is used to sense ambient light brightness.
  • the electronic device 100 can adaptively adjust the brightness of the display screen 194 according to the perceived ambient light brightness.
  • the ambient light sensor 180L can also be used to automatically adjust the white balance when taking pictures.
  • the ambient light sensor 180L can also cooperate with the proximity light sensor 180G to detect whether the electronic device 100 is in a pocket to prevent accidental touch.
  • the fingerprint sensor 180H is used to collect fingerprints.
  • the electronic device 100 can use the collected fingerprint characteristics to realize fingerprint unlocking, accessing application locks, taking pictures with fingerprints, answering incoming calls with fingerprints, and the like.
  • the temperature sensor 180J is used to detect the temperature.
  • the electronic device 100 uses the temperature detected by the temperature sensor 180J to execute a temperature processing strategy. For example, when the temperature reported by the temperature sensor 180J exceeds a threshold value, the electronic device 100 reduces the performance of the processor located near the temperature sensor 180J in order to reduce power consumption and implement thermal protection.
  • the electronic device 100 when the temperature is lower than another threshold, the electronic device 100 heats the battery 142 to avoid abnormal shutdown of the electronic device 100 caused by the low temperature.
  • the electronic device 100 boosts the output voltage of the battery 142 to avoid abnormal shutdown caused by low temperature.
  • Touch sensor 180K also called “touch panel”.
  • the touch sensor 180K may be disposed on the display screen 194 , and the touch sensor 180K and the display screen 194 form a touch screen, also called a “touch screen”.
  • the touch sensor 180K is used to detect a touch operation on or near it.
  • the touch sensor can pass the detected touch operation to the application processor to determine the type of touch event.
  • Visual output related to touch operations may be provided through display screen 194 .
  • the touch sensor 180K may also be disposed on the surface of the electronic device 100 , which is different from the location where the display screen 194 is located.
  • the bone conduction sensor 180M can acquire vibration signals.
  • the bone conduction sensor 180M can acquire the vibration signal of the vibrating bone mass of the human voice.
  • the bone conduction sensor 180M can also contact the pulse of the human body and receive the blood pressure beating signal.
  • the bone conduction sensor 180M can also be disposed in the earphone, combined with the bone conduction earphone.
  • the audio module 170 can analyze the voice signal based on the vibration signal of the vocal vibration bone block obtained by the bone conduction sensor 180M, so as to realize the voice function.
  • the application processor can analyze the heart rate information based on the blood pressure beat signal obtained by the bone conduction sensor 180M, and realize the function of heart rate detection.
  • the keys 190 include a power-on key, a volume key, and the like. Keys 190 may be mechanical keys. It can also be a touch key.
  • the electronic device 100 may receive key inputs and generate key signal inputs related to user settings and function control of the electronic device 100 .
  • Motor 191 can generate vibrating cues.
  • the motor 191 can be used for vibrating alerts for incoming calls, and can also be used for touch vibration feedback.
  • touch operations acting on different applications can correspond to different vibration feedback effects.
  • the motor 191 can also correspond to different vibration feedback effects for touch operations on different areas of the display screen 194 .
  • Different application scenarios for example: time reminder, receiving information, alarm clock, games, etc.
  • the touch vibration feedback effect can also support customization.
  • the indicator 192 can be an indicator light, which can be used to indicate the charging state, the change of the power, and can also be used to indicate a message, a missed call, a notification, and the like.
  • the SIM card interface 195 is used to connect a SIM card.
  • the SIM card can be contacted and separated from the electronic device 100 by inserting into the SIM card interface 195 or pulling out from the SIM card interface 195 .
  • the electronic device 100 may support 1 or N SIM card interfaces, where N is a positive integer greater than 1.
  • the SIM card interface 195 can support Nano SIM card, Micro SIM card, SIM card and so on. Multiple cards can be inserted into the same SIM card interface 195 at the same time. The types of the plurality of cards may be the same or different.
  • the SIM card interface 195 can also be compatible with different types of SIM cards.
  • the SIM card interface 195 is also compatible with external memory cards.
  • the electronic device 100 interacts with the network through the SIM card to implement functions such as call and data communication.
  • the electronic device 100 employs an eSIM, ie: an embedded SIM card.
  • the eSIM card can be embedded in the electronic device 100 and cannot be separated from the electronic device 100 .
  • the software system of the electronic device 100 may adopt a layered architecture, an event-driven architecture, a microkernel architecture, a microservice architecture, or a cloud architecture.
  • the embodiments of the present application take an Android system with a layered architecture as an example to exemplarily describe the software structure of the electronic device 100 .
  • FIG. 2 is a block diagram of the software structure of the electronic device 100 according to the embodiment of the present application.
  • the layered architecture divides the software into several layers, and each layer has a clear role and division of labor. Layers communicate with each other through software interfaces.
  • the Android system is divided into four layers, which are, from top to bottom, an application layer, an application framework layer, an Android runtime (Android runtime) and a system library, and a kernel layer.
  • the application layer can include a series of application packages.
  • the application package can include applications such as camera, gallery, calendar, call, map, navigation, WLAN, Bluetooth, music, video, short message and so on.
  • the application framework layer provides an application programming interface (application programming interface, API) and a programming framework for applications in the application layer.
  • the application framework layer includes some predefined functions.
  • the application framework layer may include window managers, content providers, view systems, telephony managers, resource managers, notification managers, and the like.
  • a window manager is used to manage window programs.
  • the window manager can get the size of the display screen, determine whether there is a status bar, lock the screen, take screenshots, etc.
  • Content providers are used to store and retrieve data and make these data accessible to applications.
  • the data may include video, images, audio, calls made and received, browsing history and bookmarks, phone book, etc.
  • the view system includes visual controls, such as controls for displaying text, controls for displaying pictures, and so on. View systems can be used to build applications.
  • a display interface can consist of one or more views.
  • the display interface including the short message notification icon may include a view for displaying text and a view for displaying pictures.
  • the phone manager is used to provide the communication function of the electronic device 100 .
  • the management of call status including connecting, hanging up, etc.).
  • the resource manager provides various resources for the application, such as localization strings, icons, pictures, layout files, video files and so on.
  • the notification manager enables applications to display notification information in the status bar, which can be used to convey notification-type messages, and can disappear automatically after a brief pause without user interaction. For example, the notification manager is used to notify download completion, message reminders, etc.
  • the notification manager can also display notifications in the status bar at the top of the system in the form of graphs or scroll bar text, such as notifications of applications running in the background, and notifications on the screen in the form of dialog windows. For example, text information is prompted in the status bar, a prompt sound is issued, the electronic device vibrates, and the indicator light flashes.
  • the Android runtime includes core libraries and a virtual machine. Android runtime is responsible for scheduling and management of the Android system.
  • the core library consists of two parts: one is the function functions that the java language needs to call, and the other is the core library of Android.
  • the application layer and the application framework layer run in virtual machines.
  • the virtual machine executes the java files of the application layer and the application framework layer as binary files.
  • the virtual machine is used to perform functions such as object lifecycle management, stack management, thread management, safety and exception management, and garbage collection.
  • a system library can include multiple functional modules. For example: surface manager (surface manager), media library (media library), 3D graphics processing library (eg: OpenGL ES), 2D graphics engine (eg: SGL), etc.
  • surface manager surface manager
  • media library media library
  • 3D graphics processing library eg: OpenGL ES
  • 2D graphics engine eg: SGL
  • the Surface Manager is used to manage the display subsystem and provides a fusion of 2D and 3D layers for multiple applications.
  • the media library supports playback and recording of a variety of commonly used audio and video formats, as well as still image files.
  • the media library can support a variety of audio and video encoding formats, such as: MPEG4, H.264, MP3, AAC, AMR, JPG, PNG, etc.
  • the 3D graphics processing library is used to implement 3D graphics drawing, image rendering, compositing, and layer processing.
  • 2D graphics engine is a drawing engine for 2D drawing.
  • the kernel layer is the layer between hardware and software.
  • the kernel layer contains at least display drivers, camera drivers, audio drivers, and sensor drivers.
  • the horizontal shooting in the embodiments of the present application refers to the plane on which the upper surface of the mobile phone (ie, the first plane) is parallel or approximately parallel to the horizontal plane when the user uses the mobile phone to shoot.
  • the included angle between the first plane and the horizontal plane is within a preset angle range, such as minus 3 degrees to 3 degrees, minus 6 degrees to 6 degrees, and so on.
  • Inverted vertical screen rotate 180 degrees clockwise/counterclockwise in the forward direction.
  • the direction in which the photos are saved is generally related to the posture of the user holding the mobile phone. For example, when the user holds the mobile phone vertically to take pictures horizontally, the user's intention is to let the mobile phone save the photos taken vertically. The user holds the mobile phone for horizontal shooting. At this time, the plane on which the panel of the mobile phone is located may not be parallel to the horizontal plane. Therefore, the gravity sensor in the mobile phone may mistake the user for the horizontal shooting, so the photo is saved in the horizontal direction. Faced with this situation, the user generally manually rotates the photo with the wrong orientation, or the mobile phone prompts the user whether to save the photo horizontally or vertically when saving the photo. In either case, the user needs to manually adjust it. It affects the user's shooting experience.
  • An embodiment of the present application provides a method for saving an image, which enables the electronic device of the mobile phone to automatically save the image that the user sees in the viewfinder shooting preview interface of the screen when the user uses different holding postures to hold the electronic device for horizontal shooting. Photos with the same direction as the target.
  • FIG. 3 is a schematic diagram of a set of graphical user interfaces (graphical user interface, GUI) provided by an embodiment of the present application.
  • Fig. 3 (a) to (d) show the process of the user holding the mobile phone horizontally in the vertical screen
  • Fig. 3 (e) to (h) show that the user is holding the mobile phone horizontally and shooting horizontally the process of.
  • the GUI is the desktop 300 of the mobile phone.
  • the camera can be activated to display a GUI as shown in (b) in FIG. 3, which can be called a camera interface.
  • the camera may be called from other applications to display the GUI shown in (b) of FIG. 3 .
  • the user holds the mobile phone in the vertical screen to shoot the subject 304a on the horizontal plane horizontally (for example, the 304a is placed on the horizontal plane in a direction rotated 90 degrees counterclockwise relative to the forward direction), when After the mobile phone detects that the user clicks on the photographing control 302, the GUI as shown in (c) of FIG. 3 can be displayed.
  • the photo taken by the user can be displayed in the area 303.
  • the GUI shown in (d) in FIG. 3 can be displayed.
  • the GUI is The interface for saving the captured photos in the album.
  • the photo 304 is stored in the album in a direction rotated 90° counterclockwise with respect to the forward direction, that is, the photo of the subject 304a
  • the final saved orientation is the same as the orientation displayed on the screen of the user's mobile phone when the user shoots.
  • the mobile phone when the user holds the mobile phone horizontally (for example, the mobile phone is rotated 90 degrees counterclockwise with respect to the forward direction), the mobile phone horizontally shoots the subject 304a located on the horizontal plane, in the display interface of the camera, the The object 304a to be photographed is placed on the horizontal plane in a direction rotated 90° counterclockwise relative to the forward direction.
  • the mobile phone detects that the user clicks the photographing control 307, the GUI shown in (g) of FIG. 3 can be displayed.
  • the photo taken by the user can be displayed in the area 308 , and when the mobile phone detects the operation of the user clicking on the area 303 , the GUI shown in (h) in FIG. 3 can be displayed.
  • the photo 309 when the user views the photo 309 vertically, the photo 309 is stored in the album in a landscape orientation, that is, in a direction rotated 90° counterclockwise with respect to the forward direction, that is, the object to be photographed.
  • the direction in which the photo in 304a is saved is consistent with the direction in which the object to be photographed is displayed on the screen of the mobile phone when the user takes the photo.
  • FIG. 4 is a schematic diagram of the relationship between the plane where the terminal panel is located and the normal vector of the plane where the user's eyes are located according to an embodiment of the present application.
  • the front camera in the mobile phone can collect the information of the user's face.
  • the front camera can be a 3-dimensions (3D) sensing camera.
  • 3D 3-dimensions
  • the camera can be used to obtain 3D information of the user's face, and according to the 3D information, the second plane where the user's two eyes are located and the normal vector of the second plane can be determined, wherein the second plane is perpendicular to the user.
  • the plane on which the mobile phone panel is located is the first plane.
  • the angle information between the normal vector of the second plane and the first plane can be used to determine the holding posture of the user currently using the mobile phone for horizontal shooting, and according to The user's holding pose rotates the photo and saves it.
  • the included angle When the included angle is within the first threshold range, it can be considered that the user is holding the mobile phone in a vertical orientation for horizontal shooting, and the photographed photo is directly saved vertically; when the included angle is within the second threshold range When the angle is within, it can be considered that the user holds the mobile phone in a horizontal orientation to the left (rotated 90 degrees counterclockwise with respect to the forward direction) for horizontal shooting, and the captured photo is rotated 90 degrees counterclockwise to save; When it is within the third threshold range, it can be considered that the user holds the mobile phone with the vertical screen upside down (rotated 180 degrees counterclockwise with respect to the positive direction) for horizontal screen shooting, and the captured photo is rotated 180 degrees counterclockwise and saved.
  • the included angle is within the fourth threshold range, it can be considered that the user holds the mobile phone in a horizontal screen (rotated 270 degrees counterclockwise relative to the positive direction) to take a horizontal screen shot, and then the captured photo is reversed Rotate the clock 270 degrees to save.
  • the included angle is a clockwise included angle between the normal vector of the second plane and the first plane
  • the first threshold range X1 may be -45° ⁇ X1 ⁇ 45°
  • the second threshold range X2 may be 45° ⁇ X2 ⁇ 135°
  • the third threshold range X3 may be 135° ⁇ X1 ⁇ -135°
  • the fourth threshold range X4 may be -135° ⁇ X1 ⁇ -45°.
  • the posture of the user holding the mobile phone can be determined through the threshold range, and the mobile phone rotates and saves the photographed photos according to the holding posture, so that the final saved direction of the photograph of the object is always the same as that displayed on the mobile phone screen. direction, that is, what you see is what you get.
  • FIG. 5 is a schematic diagram of a holding posture of a group of users using a mobile phone according to an embodiment of the present application.
  • the user's holding posture can be determined by detecting the contact or touch surface information on the edge of the mobile phone, and then the direction in which the user intends to save the photo when shooting horizontally can be determined.
  • the user holds the mobile phone with the right hand, and the upper right side of the mobile phone has a contact point that contacts the user's right thumb, and the bottom of the right side of the terminal contacts the user's palm. There are four contact points on the left side of the phone that are in contact with the user's finger.
  • the mobile phone can directly save the photographed photo vertically, as shown in (c) of FIG. 5 .
  • the mobile phone can rotate the photographed photo 90 degrees counterclockwise to save it, so that when the user views the photographed photo 222 vertically, the photograph 222 is displayed in a vertical direction.
  • the orientation is displayed in the album, that is, the orientation saved by 304a is consistent with the orientation displayed on the screen of the mobile phone when shooting, as shown in (f) of FIG. 5 .
  • the user holds the mobile phone with the right hand facing the horizontal screen, that is, the mobile phone is rotated 90 degrees clockwise relative to the positive direction, then the top of the right side of the mobile phone has a contact surface that contacts the user's right thumb , the top vertex of the left side of the mobile phone has a contact point with the user's finger, and the top of the left side of the mobile phone has at least one contact point with the user's finger.
  • the mobile phone can rotate the photos taken 90 degrees clockwise relative to the positive direction to save, so that the user is in the vertical direction.
  • the photo 222 is displayed in the album in a vertical direction, that is, the direction saved by 304a is the same as the direction displayed on the screen of the mobile phone when photographed, as shown in (f) of FIG. 5 .
  • each user's holding posture of the user is related to the user's habit of using a mobile phone, and each user's holding posture may be different, that is, each user may have different touch information from the mobile phone in the above-mentioned holding posture.
  • the user holds the mobile phone upside down with the left hand, that is, the mobile phone is rotated 180 degrees counterclockwise relative to the positive direction, then the top right side of the mobile phone has a contact surface that contacts the user's palm, and the bottom right side of the mobile phone has a contact surface with the user's palm.
  • the user holds the mobile phone upside down with the right hand, then the top left side of the mobile phone has a contact surface that contacts the user's palm, the bottom left side of the mobile phone has a contact point that contacts the user's fingers, and the right side of the mobile phone has a contact surface. Four points of contact with the user's finger.
  • the phone can save the photos taken clockwise or counterclockwise by 180 degrees, so that the user can view the photos in the vertical direction. 223, the photo 223 is displayed in the album in a vertical direction, that is, the direction saved in 304a is consistent with the direction displayed on the screen of the mobile phone when shooting, as shown in (I) in FIG. 5 .
  • the mobile phone in the embodiment of the present application may be a mobile phone with a waterfall screen or a curved screen.
  • an additional sensor may be provided on the side of the mobile phone to sense the contact between the mobile phone and the user. information.
  • the user's holding posture is determined by detecting the contact points or touch surface information on the edge of the mobile phone.
  • the direction displayed on the mobile phone screen is consistent, that is, what you see is what you get.
  • FIG. 6 is a schematic diagram of another group of GUIs provided by an embodiment of the present application. Wherein, from (a) to (d) of FIG. 6 shows the process of the user holding the mobile phone vertically and shooting horizontally.
  • the GUI is the desktop 300 of the mobile phone.
  • the camera can be activated to display a GUI as shown in (b) in FIG. 3, which can be called a camera interface.
  • the picture taken by the user can be displayed in the area 303 , and when the mobile phone detects the operation of the user clicking on the area 303 , the GUI shown in (d) in FIG. 6 can be displayed.
  • the GUI is an interface for saving the photo taken by the user in the album. It can be seen that when the user is viewing the photo in the vertical screen (vertical), the photo 304 is saved in a positive way in the album.
  • FIG. 7 is a schematic diagram of another group of GUIs provided by an embodiment of the present application. Wherein, from (a) to (d) of FIG. 7 shows the process of the user holding the mobile phone horizontally and shooting horizontally.
  • the mobile phone when the user holds the mobile phone horizontally (for example, the mobile phone is rotated 90 degrees counterclockwise with respect to the forward direction), the mobile phone horizontally shoots the subject 304a located on the horizontal plane, in the display interface of the camera, the The object 304a to be photographed is placed on a horizontal plane rotated 90° clockwise relative to the forward direction.
  • the mobile phone detects that the user clicks the photographing control 302, the GUI shown in (c) of FIG. 7 can be displayed.
  • the picture taken by the user can be displayed in the area 303 , and when the mobile phone detects the operation of the user clicking on the area 303 , the GUI shown in (d) in FIG. 7 can be displayed.
  • the photo 304 is saved in the album in the forward direction.
  • the mobile phone when the user uses the mobile phone to shoot horizontally, the mobile phone automatically saves the photographed photo in the direction most suitable for the user to read, thereby avoiding the mobile phone from saving the photo direction by mistake, and does not require the user to manually adjust, thereby improving the user experience.
  • FIG. 8 is an exemplary flowchart of a method for saving an image according to an embodiment of the present application. As shown in FIG. 8 , the method may include steps 301 to 305 .
  • the user starts the camera and turns on the rear camera.
  • the mobile phone determines that the angle between the mobile phone panel and the horizontal plane satisfies a preset value
  • the mobile phone inputs the photographed photo into the image rotation direction recognition model.
  • the plane on which the panel of the mobile phone is located is parallel to the plane on which the upper surface of the mobile phone is located.
  • the gravity sensor in the mobile phone can obtain the upward gravitational acceleration value of the X axis (for example, the bottom direction of the mobile phone) and the Y axis (for example, the side direction of the mobile phone) of the mobile phone panel, and the plane formed by the X axis and the Y axis is the mobile phone panel. the plane on which it is located. If the gravitational acceleration value on the X-axis is less than the first preset acceleration value, and the gravitational acceleration value on the Y-axis is less than the second preset acceleration value, it can be determined that the angle of the plane where the phone panel is located deviates from the horizontal plane is within the preset range Inside, that is, the plane where the mobile phone panel is located is nearly parallel to the horizontal plane. At this time, it can be determined that the user is using the mobile phone to shoot horizontally.
  • the gravitational acceleration value on the X-axis is less than the first preset acceleration value
  • the gravitational acceleration value on the Y-axis is less than
  • the image rotation direction recognition model can output multiple A result, for example, forward photo, rotate 90 degrees clockwise, rotate 180 degrees clockwise, rotate 270 degrees clockwise, etc.
  • the training method of the image rotation direction recognition model is as follows:
  • a large number of forward (rotation angle is 0) sample photos can be obtained, and the sample photos can be rotated clockwise by 90 degrees, 180 degrees, and 270 degrees respectively, and saved, to obtain photos in four directions.
  • a large number of sample photos in the forward direction (rotation angle is 0) can be obtained, and the sample photos can be rotated clockwise by 45 degrees, 90 degrees, 135 degrees, 180 degrees, 225 degrees, 270 degrees, and 315 degrees respectively and saved. , to get photos in eight directions.
  • sample photos in more directions may also be stored, and the sample photos may also be rotated counterclockwise and stored, which is not specifically limited in the embodiment of the present application.
  • Each sample photo and the photos in multiple directions saved after rotation form a sample training data set to obtain multiple training sets;
  • each training set includes the above four sample photos in different directions
  • the forward photos in each training set are marked as "0”
  • the photos rotated 90 degrees clockwise are marked as "1”
  • the clockwise photos are marked as "1”.
  • 180-degree photos are marked as "2”
  • photos rotated 90 degrees clockwise are marked as "3" resulting in a labeled training dataset.
  • the neural network model can be a convolutional neural network (CNN), a deep belief network (DBN), a recurrent neural network (RNN), a generative adversarial network, GAN), etc., which are not specifically limited in the embodiments of the present application.
  • CNN convolutional neural network
  • DNN deep belief network
  • RNN recurrent neural network
  • GAN generative adversarial network
  • the labeled training data set in step (1) can be input into the CNN model for training.
  • step (2) when the loss function of the CNN model is minimized and kept stable, the trained CNN image rotation direction recognition model can be obtained.
  • the image rotation direction recognition model can output four results. Rotate the clockwise angle of the photo, and then rotate the currently shot photo counterclockwise at the same angle and save it, or rotate the currently shot photo clockwise by a certain angle to the positive direction.
  • the output result of the image rotation direction recognition model shows that the clockwise rotation angle of the current photo relative to the forward photo is 90 degrees, then the currently captured photo is rotated 90 degrees counterclockwise and saved. in the album.
  • the currently captured photo is rotated 270 degrees clockwise and saved in the album.
  • the currently taken photos can be rotated 90 degrees, 180 degrees, and 270 degrees clockwise respectively and then input into the conventional CNN target recognition model to obtain four confidence results, and save the photo with the highest confidence value.
  • the direction of the photo that is most suitable for the user can be intelligently identified, and the image taken horizontally by the user can be saved in a direction suitable for the user to refer to, that is, the photo is saved in the forward direction, thereby preventing the user from When the handheld terminal device is taken horizontally, the wrong orientation of the photo is saved, which improves the user's shooting experience.
  • the user himself wants to save a horizontal photo
  • the above technical solution will automatically rotate the horizontal photo to save the photo in a positive direction, which goes against the user's original intention.
  • the present application provides another method for saving an image, which can make the direction in which the terminal saves the photo consistent with the direction of the image that the user sees in the viewfinder of the screen of the terminal.
  • FIG. 9 is a schematic flowchart of a method for saving an image according to an embodiment of the present application. As shown in FIG. 9 , the method may include steps 401 to 405 .
  • the user starts the camera and turns on the rear camera.
  • the mobile phone when the mobile phone determines that the angle between the mobile phone panel and the horizontal plane satisfies a preset value, the mobile phone activates the front camera to acquire the first image.
  • step 302 the method of judging that the angle between the mobile phone panel and the horizontal plane satisfies the preset value may refer to the relevant description in step 302, and will not be repeated here.
  • the first image is an image obtained from the perspective of the front camera.
  • the front camera may be a three-dimensional 3D sensing camera.
  • the camera can be used to obtain the image.
  • the 3D information of the user's face, according to which the second plane on which the user's two eyes are located and the normal vector of the second plane can be determined, wherein the second plane is perpendicular to the center line of the user's head.
  • the included angle may be a clockwise included angle between the normal vector of the second plane and the first plane, or a counterclockwise included angle.
  • the included angle When the included angle is within the first threshold range, it can be considered that the user is holding the mobile phone in a vertical orientation for horizontal shooting; when the included angle is within the second threshold range, it can be considered that the user is taking the left Hold the mobile phone in a horizontal orientation (rotate 90 degrees counterclockwise relative to the forward direction) for horizontal shooting; when the included angle is within the third threshold range, it can be considered that the user is in an upside-down portrait orientation (relative to the forward orientation). When the angle is within the fourth threshold range, it can be considered that the user is facing the right horizontal screen (rotated 270 degrees counterclockwise relative to the positive direction) The posture of holding the mobile phone for horizontal screen shooting.
  • the included angle is a clockwise included angle between the normal vector of the second plane and the first plane
  • the first threshold range X1 is -45° ⁇ X1 ⁇ 45°
  • the second threshold range X2 is 45° ° ⁇ X2 ⁇ 135°
  • the third threshold range X3 is 135° ⁇ X1 ⁇ -135°
  • the fourth threshold range X4 is -135° ⁇ X1 ⁇ -45°.
  • the included angle is a clockwise included angle between the normal vector of the second plane and the first plane
  • the first threshold range X1 is 0° ⁇ X1 ⁇ 45°
  • the second threshold range X2 is 45° ⁇ X1 ⁇ 90°
  • the third threshold range X3 is 90° ⁇ X1 ⁇ 135°
  • the fourth threshold range X4 is 135° ⁇ X1 ⁇ 180°.
  • the photographed photo will be saved;
  • the photos are saved by rotating 90 degrees counterclockwise or 270 degrees clockwise relative to the forward direction; if it is judged that the user is holding the phone in an upside-down portrait orientation, the photos will be taken counterclockwise or clockwise relative to the forward direction.
  • the orientation of the final saved photo is the same as the orientation of the image that the user sees in the viewfinder of the phone screen.
  • the angle between the normal vector of the second plane where the user's eyes are located and the first plane where the panel of the mobile phone is located can be obtained according to the front camera of the mobile phone, and the current holding posture of the user can be obtained.
  • the captured photo is rotated and saved, and the technical solution can make what the user sees is what you get, that is, when the user vertically views the captured photo, the direction of the photo is the same as the direction of the image that the user sees in the shooting preview interface of the mobile phone screen consistent.
  • FIG. 10 is an exemplary flowchart of another method for saving an image according to an embodiment of the present application. As shown in FIG. 10 , the method may include steps 501 to 504 .
  • the user starts the camera, and turns on the rear camera.
  • the mobile phone acquires the touch information of the mobile phone when judging that the angle between the plane where the mobile phone panel is located and the horizontal plane satisfies a preset value.
  • step 302 the method of judging that the angle between the mobile phone panel and the horizontal plane satisfies the preset value may refer to the relevant description in step 302, and will not be repeated here.
  • the touch information may be the touch information of the user's finger or palm and the side of the mobile phone when the user holds the mobile phone, for example, it may be a touch point or a touch surface.
  • the mobile phone has a curved screen or a waterfall screen.
  • the touch information between the side of the mobile phone and the user will be recorded.
  • a touch sensor may be installed on the side of the mobile phone to record touch information between the side of the mobile phone and the user.
  • Table 1 shows the correspondence between a user's holding posture and touch information during normal shooting.
  • the recognition model can be trained for the corresponding relationship between the touch information and the holding posture.
  • the above-mentioned CNN, DBN, RNN, GAN, etc. can be used. network model.
  • the touch information of the mobile phone is collected and input into the above-mentioned trained correspondence recognition model, that is, the holding posture of the user can be obtained.
  • the photographed photo will be saved;
  • the photos are saved by rotating 90 degrees counterclockwise or 270 degrees clockwise relative to the forward direction; if it is judged that the user is holding the phone in an upside-down portrait orientation, the photos taken are rotated counterclockwise or clockwise relative to the forward direction. Save 180 degrees; if it is judged that the user is holding the phone in the right-facing landscape orientation, the captured photos will be saved by rotating 270 degrees counterclockwise or 90 degrees clockwise with respect to the forward direction.
  • the user may temporarily change the holding position, which may cause the output of the model to be wrong, in which case the user may manually rotate the photo in the album to the correct orientation.
  • the mobile phone can record the result of the error and the touch information collected during shooting, and feed it back to the recognition model of the correspondence between the holding posture and the touch information, so as to achieve the purpose of updating the recognition model. Therefore, the model can continuously learn the user's usage habits. , making the recognition model more and more accurate.
  • FIG. 11 is a schematic flowchart of another method for saving an image according to an embodiment of the present application. As shown in FIG. 11 , the method may include steps 601 to 608 .
  • the user starts the camera, and turns on the rear camera.
  • the mobile phone when judging that the angle between the panel and the horizontal plane meets a preset value, activates the front camera to acquire the first image.
  • the user's face is not within the viewing angle of the front camera of the mobile phone.
  • steps 606 to 608 may refer to steps 502 to 504, which are not repeated for brevity.
  • the user's holding posture is determined according to the angle between the normal vector of the plane where the user's eyes are located and the plane where the phone panel is located.
  • the front camera does not capture the user's eyes.
  • the user's holding posture can be determined according to the touch information sensed by the mobile phone, and the captured photo can be rotated and saved according to the user's holding posture.
  • the technical solution can make what the user see is what you get when shooting horizontally, that is, when viewing the shot vertically, the orientation of the photo is consistent with the orientation of the image the user sees in the shooting preview interface of the mobile phone screen.
  • FIG. 12 is a schematic flowchart of a method for saving an image provided by an embodiment of the present application. As shown in FIG. 12 , the method is applied to an electronic device, and the method may include steps 701 to 705 .
  • the electronic device displays, in response to a first operation of the user, a first interface, where the first interface is a shooting preview interface of the electronic device.
  • the user can click the camera from the desktop, and in response to the user's operation, the electronic device displays a first interface, where the first interface is a camera shooting preview interface; or the user can call the camera from other applications, and the electronic device enters the camera shooting interface.
  • a preview interface, the shooting preset interface may also be called a preview interface, a viewfinder interface, and the like.
  • the mobile phone in response to the operation for clicking on the camera 301, the mobile phone performs a camera shooting preview interface.
  • the electronic device acquires a first photo in response to the user's photographing operation.
  • the electronic device determines a first angle, where the first angle is the included angle between the line connecting the position of the first preset part and the position of the second preset part of the electronic device and the preset geographic direction when the first photo is acquired .
  • the first preset portion may be the center position of the charging interface of the electronic device, the charging port is located at the middle position of the bottom frame of the electronic device, and the second preset portion may be the center position of the screen of the electronic device;
  • the first preset portion may be the center position of the screen of the electronic device, and the second preset portion may be the center position of the front camera of the electronic device, which is not limited in this embodiment of the present application.
  • the preset geographic direction may be due north, due east, etc., which is not limited in this embodiment of the present application.
  • steps 702 and 703 are executed is not limited in this embodiment of the present application.
  • the position of the first preset part is the center position of the charging interface of the electronic device
  • the position of the second preset part is the center position of the screen of the electronic device
  • the preset geographic direction is the true north direction.
  • the first angle is 0 degrees.
  • the user can move from the true north direction to the position of the first preset part and the second preset angle.
  • the first preset angle range can be 45 degrees to 315 degrees
  • the first preset angle range can also be 30 degrees to 330 degrees , which is not limited in the embodiments of the present application.
  • the electronic device in Figure (e) can be understood as the first angle is 0 degrees, and the first angle of the electronic device in Figure (f) is 90 degrees , the electronic device rotates the first photo when determining that the first angle is within the first preset angle range.
  • the first angle may be 180 degrees. As shown in (e) of FIG. 5 , the first angle may be 270 degrees. In other embodiments , the first angle may also be other values, which are not limited in this embodiment of the present application.
  • the electronic device saves the rotated first photo.
  • the electronic device saves the rotated first photo.
  • the electronic device when the electronic device acquires the first photo in response to the user's operation, the electronic device determines the connection between the position of the first preset part and the position of the second preset part and the first position of the preset geographic direction. When the angle is within the preset angle range, the first photo is rotated, and the rotated first photo is saved. When the user holds the electronic device in different postures to take pictures, the taken photo can be automatically rotated and saved, and the technical solution is beneficial to the user to check the taken photo more comfortably.
  • the method may further include steps 706 to 707 .
  • the electronic device detects the second operation of the user.
  • the second operation may be an operation of the user clicking on the area 308 .
  • the electronic device displays a second interface, where the second interface includes the rotated first photo, wherein the direction of the target photographed object in the first interface is the same as that of the target photographed object in the second image.
  • the orientation in the interface is the same.
  • the electronic device displays a second interface in response to the second operation, and the second interface may be the interface shown in (h) in FIG. 3 , wherein the The orientation of the subject 304a in the photo 309 is the same as its orientation in the first interface.
  • the direction of the target photograph in the first interface is the same as the direction of the target photograph in the second interface.
  • the technical solution can make what the user see is what you get when shooting horizontally, that is, when the user views the photographed photograph, the direction of the target photographed object in the photograph is consistent with the direction that the user sees in the photographing preview interface of the electronic device, thereby It is beneficial for the user to view the photographed photos in a normal posture without rotating the electronic device or manually rotating the photos, which improves the user's photographing experience.
  • the electronic device determines the first angle, including:
  • the second plane is the plane where the user's eyes are located
  • the first angle is determined according to the angle information between the normal vector of the second plane and the first plane, wherein the first plane is parallel to the plane on which the upper surface of the electronic device is located.
  • the second plane is the plane where the eyes of the user are located, the second plane is perpendicular to the central axis of the user's head, the first plane is parallel to the plane where the upper surface of the electronic device is located, or The first plane is parallel to the plane on which the panel of the electronic device is located.
  • the electronic device determines the first angle according to the angle information between the normal vector of the second plane and the first plane, including: according to the position of the angle between the normal vector of the second plane and the first plane.
  • the second preset angle range is determined to determine the first angle.
  • the first angle may be determined according to a second preset angle range in which the angle between the normal vector of the second plane and the first plane is located.
  • the first angle is determined to be 45 degrees or 90 degrees.
  • the second preset angle range is 135 degrees to 225 degrees, it is determined that the first angle is 135 degrees or 180 degrees, etc., which is not limited in this embodiment of the present application.
  • determining the first angle by the electronic device includes: when the user holds the electronic device, determining touch information between the user and the electronic device; and determining the first angle according to the touch information.
  • the first angle may be determined according to touch information between the user's finger, palm and the electronic device when the user uses the electronic device, and the touch information may be touch information between the user and the frame or screen of the electronic device.
  • the touch information between the user and the electronic device may be associated with the first angle, and then the first angle may be determined according to the touch information between the user and the electronic device.
  • determining the first angle by the electronic device according to the touch information includes: inputting the touch information into a neural network model; and determining the first angle according to an output result of the neural network model.
  • the electronic device may collect touch information between the user and the electronic device when the user uses the mobile phone, and train a neural network model according to the touch information, and when the user uses the electronic device to shoot, according to the output result of the neural network model
  • the first angle can be determined.
  • the neural network model is pre-trained, which is not limited in this embodiment of the present application.
  • rotating the first photo includes: when the first angle is within the first preset angle range, inverting the first photo. The hour hand is rotated by the first angle.
  • the first angle is 90 degrees
  • the first photo is rotated 90 degrees counterclockwise to save, then when the user views the first photo vertically, the The direction of the photographed object 304a is the same as the direction that the user sees in the viewfinder interface.
  • the electronic device when the electronic device determines that the first angle is within the range of the first preset angle, it rotates the first photograph taken counterclockwise according to the first angle.
  • the direction of the target shooting object is consistent with the direction that the user sees in the shooting preview interface of the electronic device, so that the user can view the captured photos in a normal posture without rotating the electronic device or manually rotating the photos, which is conducive to the user's comfortable Viewing photos improves the user's shooting experience.
  • the included angle between the plane where the upper surface of the electronic device is located and the horizontal plane is within a third preset angle range.
  • the third preset angle range may be minus 3 degrees to 3 degrees, minus 5 degrees and 5 degrees, etc., which is not limited in this embodiment of the present application.
  • Embodiments of the present application further provide an electronic device, including one or more processors; one or more memories; the one or more memories stores one or more computer programs, and the one or more computer programs include instructions, When executed by one or more processors, the instructions cause the electronic device to execute the method for saving an image described in any one of the foregoing.
  • the electronic device includes corresponding hardware and/or software modules for executing each function.
  • the present application can be implemented in hardware or in the form of a combination of hardware and computer software in conjunction with the algorithm steps of each example described in conjunction with the embodiments disclosed herein. Whether a function is performed by hardware or computer software driving hardware depends on the specific application and design constraints of the technical solution. Those skilled in the art may use different methods to implement the described functionality for each particular application in conjunction with the embodiments, but such implementations should not be considered beyond the scope of this application.
  • the electronic device can be divided into functional modules according to the above method examples.
  • each functional module can be divided corresponding to each function, or two or more functions can be integrated into one processing module.
  • the above-mentioned integrated modules can be implemented in the form of hardware. It should be noted that, the division of modules in this embodiment is schematic, and is only a logical function division, and there may be other division manners in actual implementation.
  • This embodiment also provides a computer-readable storage medium, where computer instructions are stored in the computer-readable storage medium, and when the computer instructions are executed on the electronic device, the electronic device executes the above-mentioned related method steps to realize the above-mentioned embodiments. Method to save the image.
  • This embodiment also provides a computer program product, when the computer program product runs on the computer, the computer executes the above-mentioned relevant steps, so as to realize the method for saving an image in the above-mentioned embodiment.
  • the embodiments of the present application also provide an apparatus, which may specifically be a chip, a component or a module, and the apparatus may include a connected processor and a memory; wherein, the memory is used for storing computer execution instructions, and when the apparatus is running, The processor can execute the computer-executed instructions stored in the memory, so that the chip executes the method for saving an image in each of the foregoing method embodiments.
  • the electronic device, computer-readable storage medium, computer program product or chip provided in this embodiment are all used to execute the corresponding method provided above. Therefore, for the beneficial effects that can be achieved, reference may be made to the above-provided method. The beneficial effects in the corresponding method will not be repeated here.
  • the disclosed apparatus and method may be implemented in other manners.
  • the apparatus embodiments described above are only illustrative.
  • the division of modules or units is only a logical function division. In actual implementation, there may be other division methods.
  • multiple units or components may be combined or May be integrated into another device, or some features may be omitted, or not implemented.
  • the shown or discussed mutual coupling or direct coupling or communication connection may be through some interfaces, indirect coupling or communication connection of devices or units, and may be in electrical, mechanical or other forms.
  • Units described as separate components may or may not be physically separated, and components shown as units may be one physical unit or multiple physical units, that is, may be located in one place, or may be distributed in multiple different places. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution in this embodiment.
  • each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically alone, or two or more units may be integrated into one unit.
  • the above-mentioned integrated units may be implemented in the form of hardware, or may be implemented in the form of software functional units.
  • the integrated unit if implemented in the form of a software functional unit and sold or used as a stand-alone product, may be stored in a readable storage medium.
  • a readable storage medium including several instructions to make a device (which may be a single chip microcomputer, a chip, etc.) or a processor (processor) to execute all or part of the steps of the methods in the various embodiments of the present application.
  • the aforementioned storage medium includes: U disk, mobile hard disk, read only memory (ROM), random access memory (random access memory, RAM), magnetic disk or optical disk and other media that can store program codes.

Landscapes

  • Engineering & Computer Science (AREA)
  • Human Computer Interaction (AREA)
  • Multimedia (AREA)
  • Signal Processing (AREA)
  • User Interface Of Digital Computer (AREA)

Abstract

Provided by the present application are a method and electronic device for saving an image. The method is applied to the electronic device. The electronic device may display a photographing preview interface in response to an operation of a user. The electronic device obtains a first photo in response to the operation of the user. The electronic device can determine a first angle according to angle information between a normal vector of a plane where the user's eyes are located and a plane where the upper surface of the electronic device is located, or touch information between the user and the electronic device. When it is determined that the first angle is within a preset angle range, the first photo is rotated by the first angle, and the rotated first photo is saved. When the user holds the electronic device in different holding positions for photographing, the technical solution can enable the electronic device to automatically save the photos consistent with the photographing subject direction seen by the user in the photographing preview interface, which helps the user to comfortably view photos and improves the photographing experience of the user.

Description

保存图像的方法及电子设备Method and electronic device for saving images

本申请要求于2020年11月18日提交中国专利局、申请号为202011295395.4、申请名称为“保存图像的方法及电子设备”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。This application claims the priority of the Chinese patent application with the application number 202011295395.4 and the application title "Method and Electronic Device for Preserving Images" filed with the China Patent Office on November 18, 2020, the entire contents of which are incorporated into this application by reference .

技术领域technical field

本申请涉及电子技术领域,尤其涉及一种保存图像的方法及电子设备。The present application relates to the field of electronic technologies, and in particular, to a method and electronic device for saving images.

背景技术Background technique

用户使用电子设备进行拍摄时,照片保存的方向一般和用户握持电子设备的姿势有关,例如,当用户竖直握持电子设备水平拍摄时,用户的本意是让电子设备竖直保存拍摄的照片,但是由于是用户手持电子设备进行水平拍摄,此时电子设备的面板所在的平面和水平面可能不平行,因此,电子设备中的重力传感器可能会误以为用户是横向拍摄,因此将照片以横向保存。When a user shoots with an electronic device, the direction in which the photos are saved is generally related to the posture of the user holding the electronic device. For example, when the user holds the electronic device vertically to shoot horizontally, the user's intention is to let the electronic device vertically save the captured photos. , but since the user is holding the electronic device for horizontal shooting, the plane where the panel of the electronic device is located may not be parallel to the horizontal plane. Therefore, the gravity sensor in the electronic device may mistakenly think that the user is shooting horizontally, so the photo is saved horizontally. .

面对这种情况,用户一般会手动旋转该保存方向错误的照片,或者电子设备在保存该照片时提示用户是横向保存还是竖直保存,无论哪种情况,都需要用户手动调节,这在一定程度上影响了用户的拍摄体验。Faced with this situation, the user generally manually rotates the photo in the wrong direction, or the electronic device prompts the user whether to save the photo horizontally or vertically. In either case, the user needs to manually adjust it. To a certain extent, it affects the user's shooting experience.

发明内容SUMMARY OF THE INVENTION

本申请提供了一种保存图像的方法及电子设备,在用户采用不同握持姿势握持电子设备进行水平拍摄时,能够使得电子设备自动保存和用户在拍摄预览界面中看到的目标拍摄物方向相一致的照片。The present application provides a method and electronic device for saving an image. When a user uses different holding postures to hold the electronic device for horizontal shooting, the electronic device can automatically save and the direction of the target shot that the user sees in the shooting preview interface. Consistent photo.

第一方面,提供了一种保存图像的方法,该方法应用于电子设备,该方法包括:电子设备响应于用户的第一操作,显示第一界面,该第一界面为电子设备的拍摄预览界面;该电子设备响应于用户的拍摄操作,获取第一照片;该电子设备确定第一角度,第一角度为在获取所述第一照片时,该电子设备的第一预设部的位置与第二预设部的位置的连线与预设地理方向的夹角;该电子设备判断第一角度处于第一预设角度范围内时,旋转该第一照片;该电子设备保存旋转后的第一照片。In a first aspect, a method for saving an image is provided, the method is applied to an electronic device, and the method includes: the electronic device displays a first interface in response to a first operation of a user, and the first interface is a shooting preview interface of the electronic device ; the electronic device acquires a first photo in response to the user's shooting operation; the electronic device determines a first angle, and the first angle is the position of the first preset part of the electronic device and the first angle when acquiring the first photo The angle between the line connecting the positions of the two preset parts and the preset geographic direction; when the electronic device determines that the first angle is within the range of the first preset angle, it rotates the first photo; the electronic device saves the rotated first photo photo.

基于本申请实施例,当电子设备响应于用户的操作,获取第一照片,电子设备确定其第一预设部的位置与第二预设部的位置的连线与预设地理方向的第一角度处于预设角度范围之内时,对该第一照片进行旋转,并保存旋转后的第一照片。在用户以不同的姿势握持该电子设备进行拍摄时,可以自动旋转并保存该拍摄的照片,该技术方案有利于用户更加舒适的查阅拍摄的照片。Based on the embodiments of the present application, when the electronic device acquires the first photo in response to the user's operation, the electronic device determines the connection between the position of the first preset part and the position of the second preset part and the first position of the preset geographic direction. When the angle is within the preset angle range, the first photo is rotated, and the rotated first photo is saved. When the user holds the electronic device in different postures to take pictures, the taken photo can be automatically rotated and saved, and the technical solution is beneficial to the user to check the taken photo more comfortably.

结合第一方面,在第一方面的一种实现方式中,该方法还包括:电子设备检测到用户的第二操作;电子设备响应于所述第二操作,显示第二界面,该第二界面包括旋转后的第一照片,其中,目标拍摄物在该第一界面中的方向与该目标拍摄物在第二界面中的方向相 同。With reference to the first aspect, in an implementation manner of the first aspect, the method further includes: the electronic device detects a second operation of the user; the electronic device displays a second interface in response to the second operation, the second interface The rotated first photo is included, wherein the direction of the target photographed object in the first interface is the same as the direction of the target photographed object in the second interface.

基于本申请实施例,当用户打开第二界面查看该第一照片时,目标拍摄物在第一界面中的方向与该目标拍摄物在第二界面中的方向相同。该技术方案可以使得用户在水平拍摄时所见即所得,即用户查看拍摄的照片时,该照片中的目标拍摄物的方向与用户在电子设备的拍摄预览界面中看到的方向相一致,从而有利于用户以正常姿势查阅拍摄的照片,无需旋转电子设备或手动旋转照片,提升了用户的拍摄体验。Based on the embodiment of the present application, when the user opens the second interface to view the first photo, the direction of the target photograph in the first interface is the same as the direction of the target photograph in the second interface. The technical solution can make what the user see is what you get when shooting horizontally, that is, when the user views the photographed photograph, the direction of the target photographed object in the photograph is consistent with the direction that the user sees in the photographing preview interface of the electronic device, thereby It is beneficial for the user to view the photographed photos in a normal posture without rotating the electronic device or manually rotating the photos, which improves the user's photographing experience.

结合第一方面,在第一方面的一种实现方式中,电子设备确定第一角度,包括:确定第二平面,该第二平面为用户双眼所在的平面;根据该第二平面的法向量与第一平面之间的夹角信息,确定该第一角度,其中,该第一平面平行于电子设备的上表面所在的平面。With reference to the first aspect, in an implementation manner of the first aspect, determining the first angle by the electronic device includes: determining a second plane, where the second plane is the plane where the user's eyes are located; according to the normal vector of the second plane and the The included angle information between the first planes determines the first angle, wherein the first plane is parallel to the plane where the upper surface of the electronic device is located.

本申请实施例中,该第二平面为用户双眼所在的平面,该第二平面垂直于用户头部的中轴线。In the embodiment of the present application, the second plane is the plane where the user's eyes are located, and the second plane is perpendicular to the central axis of the user's head.

基于本申请实施例,可以根据第二平面的法向量与第一平面之间的夹角信息来确定第一角度。Based on the embodiment of the present application, the first angle may be determined according to the angle information between the normal vector of the second plane and the first plane.

结合第一方面,在第一方面的一种实现方式中,根据该第二平面的法向量与第一平面之间的夹角信息,确定第一角度,包括:根据该第二平面的法向量与第一平面之间的角度所处的第二预设角度范围,确定该第一角度。With reference to the first aspect, in an implementation manner of the first aspect, determining the first angle according to the angle information between the normal vector of the second plane and the first plane includes: according to the normal vector of the second plane The first angle is determined by the second preset angle range in which the angle with the first plane is located.

本申请实施例中,可以根据第二平面的法向量与第一平面之间的角度所处的第二预设范围,来确定该第一角度。例如,该第二预设角度范围为45度至135度,则确定第一角度为45度或90度等,本申请实施例对此不予限定。In this embodiment of the present application, the first angle may be determined according to a second preset range in which the angle between the normal vector of the second plane and the first plane is located. For example, if the second preset angle range is 45 degrees to 135 degrees, the first angle is determined to be 45 degrees or 90 degrees, etc., which is not limited in this embodiment of the present application.

结合第一方面,在第一方面的一种实现方式中,电子设备确定第一角度,包括:在用户握持电子设备时,确定用户与该电子设备的触摸信息;根据该触摸信息,确定该第一角度。With reference to the first aspect, in an implementation manner of the first aspect, determining the first angle by the electronic device includes: when the user holds the electronic device, determining touch information between the user and the electronic device; determining the touch information according to the touch information first angle.

本申请实施例中,可以根据用户使用电子设备时,用户的手指、手掌与电子设备的触摸信息来确定该第一角度,该触摸信息可以是用户与电子设备的边框或屏幕的触摸信息。In this embodiment of the present application, the first angle may be determined according to touch information between the user's finger, palm and the electronic device when the user uses the electronic device, and the touch information may be touch information between the user and the frame or screen of the electronic device.

结合第一方面,在第一方面的一种实现方式中,根据该触摸信息,确定该第一角度,包括:将该触摸信息输入至神经网络模型中;根据该神经网络模型的输出结果确定该第一角度。With reference to the first aspect, in an implementation manner of the first aspect, determining the first angle according to the touch information includes: inputting the touch information into a neural network model; determining the first angle according to an output result of the neural network model first angle.

本申请实施例中,电子设备可以在用户使用手机时采集用户与电子设备的触摸信息,并根据该触摸信息训练神经网络模型,当用户使用电子设备进行拍摄时,根据该神经网络模型的输出结果可以确定该第一角度。或者,该神经网络模型是事先训练好的,本申请实施例对此不予限定。In the embodiment of the present application, the electronic device can collect touch information between the user and the electronic device when the user uses the mobile phone, and train a neural network model according to the touch information, and when the user uses the electronic device to shoot, according to the output result of the neural network model The first angle can be determined. Alternatively, the neural network model is pre-trained, which is not limited in this embodiment of the present application.

结合第一方面,在第一方面的一种实现方式中,电子设备判断该第一角度处于第一预设角度内时,旋转该第一照片,包括:当该第一角度处于第一预设角度范围内时,将该第一照片逆时针旋转该第一角度。With reference to the first aspect, in an implementation manner of the first aspect, when the electronic device determines that the first angle is within the first preset angle, rotating the first photo includes: when the first angle is within the first preset angle When the angle is within the range, rotate the first photo by the first angle counterclockwise.

基于本申请实施例,当电子设备判断该第一角度处于第一预设角度范围内时,将拍摄的第一照片按照该第一角度进行逆时针旋转,该技术方案可以实现拍摄得到的照片中的目标拍摄物的方向与用户在电子设备的拍摄预览界面中看到的方向相一致,从而有利于用户以正常姿势查阅拍摄的照片,无需旋转电子设备或手动旋转照片,从而有利于用户对照片的查阅,提升了用户的拍摄体验。Based on the embodiments of the present application, when the electronic device determines that the first angle is within the range of the first preset angle, it rotates the first photograph taken counterclockwise according to the first angle, and the technical solution can realize that in the photographed photograph The direction of the target shooting object is consistent with the direction that the user sees in the shooting preview interface of the electronic device, which is beneficial for the user to view the captured photos in a normal posture without rotating the electronic device or manually rotating the photos, which is beneficial for the user to view the photos. , which improves the user's shooting experience.

结合第一方面,在第一方面的一种实现方式中,该电子设备的上表面所在的平面与水 平面之间的夹角处于第三预设角度范围内。With reference to the first aspect, in an implementation manner of the first aspect, the included angle between the plane where the upper surface of the electronic device is located and the horizontal plane is within a third preset angle range.

示例性地,该电子设备处于水平状态,该水平状态可以理解为电子设备的上表面所在的平面与水平面平行或接近平行。例如,该第三预设角度范围可以为负3度至3度、-5度至5度,等等。Exemplarily, the electronic device is in a horizontal state, and the horizontal state can be understood as a plane on which the upper surface of the electronic device is located is parallel or nearly parallel to the horizontal plane. For example, the third preset angle range may be minus 3 degrees to 3 degrees, -5 degrees to 5 degrees, and so on.

第二方面,提供一种电子设备,该电子设备包括:一个或多个处理器;一个或多个存储器;该一个或多个存储器存储有一个或多个计算机程序,该一个或多个计算机程序包括指令,当该指令被一个或多个处理器执行时,使得该电子设备执行以下步骤:响应于用户的第一操作,显示第一界面,该第一界面为电子设备的拍摄预览界面;响应于用户的拍摄操作,获取第一照片;确定第一角度,第一角度为在获取所述第一照片时,电子设备的第一预设部的位置与第二预设部的位置的连线与预设地理方向的夹角;判断第一角度处于第一预设角度范围内时,旋转该第一照片;保存旋转后的第一照片。In a second aspect, an electronic device is provided, the electronic device comprising: one or more processors; one or more memories; the one or more memories stores one or more computer programs, the one or more computer programs Including an instruction, when the instruction is executed by one or more processors, causing the electronic device to perform the following steps: in response to the user's first operation, displaying a first interface, the first interface is the shooting preview interface of the electronic device; responding to Obtain a first photo based on a user's shooting operation; determine a first angle, where the first angle is a line connecting the position of the first preset part of the electronic device and the position of the second preset part when the first photo is obtained The included angle with the preset geographic direction; when it is determined that the first angle is within the range of the first preset angle, the first photo is rotated; and the rotated first photo is saved.

结合第二方面,在第二方面的一种实现方式中,当该指令被一个或多个处理器执行时,使得该电子设备执行以下步骤:检测到用户的第二操作;响应于所述第二操作,显示第二界面,该第二界面包括旋转后的第一照片,其中,目标拍摄物在该第一界面中的方向与该目标拍摄物在第二界面中的方向相同。With reference to the second aspect, in an implementation manner of the second aspect, when the instruction is executed by one or more processors, the electronic device is caused to perform the following steps: detecting a second operation of the user; responding to the first operation The second operation is to display a second interface, the second interface includes the rotated first photo, wherein the direction of the target photographed object in the first interface is the same as the direction of the target photographed object in the second interface.

结合第二方面,在第二方面的一种实现方式中,该电子设备具体用于:确定第二平面,该第二平面为用户双眼所在的平面;根据该第二平面的法向量与第一平面之间的夹角信息,确定该第一角度,其中,该第一平面平行于电子设备的上表面所在的平面。In combination with the second aspect, in an implementation manner of the second aspect, the electronic device is specifically configured to: determine a second plane, where the second plane is the plane where the user's eyes are located; according to the normal vector of the second plane and the first plane The angle information between the planes determines the first angle, wherein the first plane is parallel to the plane on which the upper surface of the electronic device is located.

结合第二方面,在第二方面的一种实现方式中,该电子设备具体用于:根据该第二平面的法向量与第一平面之间的角度所处的第二预设角度范围,确定该第一角度。With reference to the second aspect, in an implementation manner of the second aspect, the electronic device is specifically configured to: determine according to a second preset angle range in which the angle between the normal vector of the second plane and the first plane is located the first angle.

结合第二方面,在第二方面的一种实现方式中,该电子设备具体用于:在用户握持电子设备时,确定用户与该电子设备的触摸信息;根据该触摸信息,确定该第一角度。With reference to the second aspect, in an implementation manner of the second aspect, the electronic device is specifically configured to: determine touch information between the user and the electronic device when the user holds the electronic device; determine the first touch information according to the touch information angle.

结合第二方面,在第二方面的一种实现方式中,该电子设备具体用于:将该触摸信息输入至神经网络模型中;根据该神经网络模型的输出结果确定该第一角度。With reference to the second aspect, in an implementation manner of the second aspect, the electronic device is specifically configured to: input the touch information into a neural network model; and determine the first angle according to an output result of the neural network model.

结合第二方面,在第二方面的一种实现方式中,该电子设备具体用于:当该第一角度处于第一预设角度范围内时,将该第一照片逆时针旋转该第一角度。With reference to the second aspect, in an implementation manner of the second aspect, the electronic device is specifically configured to: when the first angle is within a first preset angle range, rotate the first photo by the first angle counterclockwise .

结合第二方面,在第二方面的一种实现方式中,该电子设备的上表面所在的平面与水平面之间的夹角处于第三预设角度范围内。With reference to the second aspect, in an implementation manner of the second aspect, the included angle between the plane where the upper surface of the electronic device is located and the horizontal plane is within a third preset angle range.

第三方面,提供一种计算机可读存储介质,其特征在于,包括计算机指令,当所述计算机指令在电子设备上运行时,使得所述电子设备执行如上述第一方面及其任一种实现方式中所述的保存图像的方法In a third aspect, a computer-readable storage medium is provided, which is characterized in that it includes computer instructions, and when the computer instructions are executed on an electronic device, the electronic device is made to perform the above-mentioned first aspect and any one of the implementations thereof. Methods of saving images as described in

第四方面,提供一种计算机程序产品,其特征在于,包括计算机指令,当所述计算机指令在电子设备上运行时,使得所述电子设备执行如上述第一方面及其任一种实现方式中所述的保存图像的方法。In a fourth aspect, a computer program product is provided, which is characterized in that it includes computer instructions, and when the computer instructions are executed on an electronic device, the electronic device is made to execute the above-mentioned first aspect and any one of its implementation manners. The described method of saving images.

附图说明Description of drawings

图1是本申请实施例提供的一种电子设备的硬件结构示意图。FIG. 1 is a schematic diagram of a hardware structure of an electronic device provided by an embodiment of the present application.

图2是本申请实施例提供的一种电子设备的软件结构示意图。FIG. 2 is a schematic diagram of a software structure of an electronic device provided by an embodiment of the present application.

图3是本申请实施例提供的一组GUI的示意图。FIG. 3 is a schematic diagram of a group of GUIs provided by an embodiment of the present application.

图4是本申请实施例提供的终端面板所在平面与用户双眼所在平面的法向量之间的 关系的示意图。4 is a schematic diagram of the relationship between the plane where the terminal panel is located and the normal vector of the plane where the user's eyes are located according to an embodiment of the present application.

图5是本申请实施例提供的另一组GUI的示意图。FIG. 5 is a schematic diagram of another group of GUIs provided by an embodiment of the present application.

图6是本申请实施例提供的另一组GUI的示意图。FIG. 6 is a schematic diagram of another group of GUIs provided by an embodiment of the present application.

图7是本申请实施例提供的另一组GUI的示意图。FIG. 7 is a schematic diagram of another group of GUIs provided by an embodiment of the present application.

图8是本申请实施例提供的一种保存图像方法的示意性流程图。FIG. 8 is a schematic flowchart of a method for saving an image provided by an embodiment of the present application.

图9是本申请实施例提供的另一种保存图像方法的示意性流程图。FIG. 9 is a schematic flowchart of another method for saving an image provided by an embodiment of the present application.

图10是本申请实施例提供的另一种保存图像方法的示意性流程图。FIG. 10 is a schematic flowchart of another method for saving an image provided by an embodiment of the present application.

图11是本申请实施例提供的另一种保存图像方法的示意性流程图。FIG. 11 is a schematic flowchart of another method for saving an image provided by an embodiment of the present application.

图12是本申请实施例提供的一种保存图像方法的示意性流程图。FIG. 12 is a schematic flowchart of a method for saving an image provided by an embodiment of the present application.

具体实施方式Detailed ways

下面将结合本申请实施例中的附图,对本申请实施例中的技术方案进行描述。其中,在本申请实施例的描述中,除非另有说明,“/”表示或的意思,例如,A/B可以表示A或B;本文中的“和/或”仅仅是一种描述关联对象的关联关系,表示可以存在三种关系,例如,A和/或B,可以表示:单独存在A,同时存在A和B,单独存在B这三种情况。另外,在本申请实施例的描述中,“多个”是指两个或多于两个。The technical solutions in the embodiments of the present application will be described below with reference to the accompanying drawings in the embodiments of the present application. Wherein, in the description of the embodiments of the present application, unless otherwise stated, “/” means or means, for example, A/B can mean A or B; “and/or” in this document is only a description of the associated object The association relationship of , indicates that there can be three kinds of relationships, for example, A and/or B, can indicate that A exists alone, A and B exist at the same time, and B exists alone. In addition, in the description of the embodiments of the present application, "plurality" refers to two or more than two.

以下,术语“第一”、“第二”仅用于描述目的,而不能理解为指示或暗示相对重要性或者隐含指明所指示的技术特征的数量。由此,限定有“第一”、“第二”的特征可以明示或者隐含地包括一个或者更多个该特征。Hereinafter, the terms "first" and "second" are only used for descriptive purposes, and should not be construed as indicating or implying relative importance or implicitly indicating the number of indicated technical features. Thus, a feature defined as "first" or "second" may expressly or implicitly include one or more of that feature.

本申请实施例提供的保存图像的方法可以应用于手机、平板电脑、可穿戴设备、车载设备、增强现实(augmented reality,AR)/虚拟现实(virtual reality,VR)设备、笔记本电脑、超级移动个人计算机(ultra-mobile personal computer,UMPC)、上网本、个人数字助理(personal digital assistant,PDA)等电子设备上,本申请实施例对电子设备的具体类型不作任何限制。The method for saving images provided by the embodiments of the present application can be applied to mobile phones, tablet computers, wearable devices, in-vehicle devices, augmented reality (AR)/virtual reality (VR) devices, notebook computers, super mobile personal On electronic devices such as a computer (ultra-mobile personal computer, UMPC), a netbook, and a personal digital assistant (personal digital assistant, PDA), the embodiments of the present application do not impose any restrictions on the specific type of the electronic device.

示例性的,图1示出了电子设备100的结构示意图。电子设备100可以包括处理器110,外部存储器接口120,内部存储器121,通用串行总线(universal serial bus,USB)接口130,充电管理模块140,电源管理模块141,电池142,天线1,天线2,移动通信模块150,无线通信模块160,音频模块170,扬声器170A,受话器170B,麦克风170C,耳机接口170D,传感器模块180,按键190,马达191,指示器192,摄像头193,显示屏194,以及用户标识模块(subscriber identification module,SIM)卡接口195等。其中传感器模块180可以包括压力传感器180A,陀螺仪传感器180B,气压传感器180C,磁传感器180D,加速度传感器180E,距离传感器180F,接近光传感器180G,指纹传感器180H,温度传感器180J,触摸传感器180K,环境光传感器180L,骨传导传感器180M等。Exemplarily, FIG. 1 shows a schematic structural diagram of an electronic device 100 . The electronic device 100 may include a processor 110, an external memory interface 120, an internal memory 121, a universal serial bus (USB) interface 130, a charge management module 140, a power management module 141, a battery 142, an antenna 1, an antenna 2 , mobile communication module 150, wireless communication module 160, audio module 170, speaker 170A, receiver 170B, microphone 170C, headphone jack 170D, sensor module 180, buttons 190, motor 191, indicator 192, camera 193, display screen 194, and Subscriber identification module (subscriber identification module, SIM) card interface 195 and so on. The sensor module 180 may include a pressure sensor 180A, a gyroscope sensor 180B, an air pressure sensor 180C, a magnetic sensor 180D, an acceleration sensor 180E, a distance sensor 180F, a proximity light sensor 180G, a fingerprint sensor 180H, a temperature sensor 180J, a touch sensor 180K, and ambient light. Sensor 180L, bone conduction sensor 180M, etc.

可以理解的是,本申请实施例示意的结构并不构成对电子设备100的具体限定。在本申请另一些实施例中,电子设备100可以包括比图示更多或更少的部件,或者组合某些部件,或者拆分某些部件,或者不同的部件布置。图示的部件可以以硬件,软件或软件和硬件的组合实现。It can be understood that the structures illustrated in the embodiments of the present application do not constitute a specific limitation on the electronic device 100 . In other embodiments of the present application, the electronic device 100 may include more or less components than shown, or combine some components, or separate some components, or arrange different components. The illustrated components may be implemented in hardware, software, or a combination of software and hardware.

处理器110可以包括一个或多个处理单元,例如:处理器110可以包括应用处理器(application processor,AP),调制解调处理器,图形处理器(graphics processing unit,GPU),图像信号处理器(image signal processor,ISP),控制器,存储器,视频编解码器,数字信 号处理器(digital signal processor,DSP),基带处理器,和/或神经网络处理器(neural-network processing unit,NPU)等。其中,不同的处理单元可以是独立的器件,也可以集成在一个或多个处理器中。The processor 110 may include one or more processing units, for example, the processor 110 may include an application processor (application processor, AP), a modem processor, a graphics processor (graphics processing unit, GPU), an image signal processor (image signal processor, ISP), controller, memory, video codec, digital signal processor (digital signal processor, DSP), baseband processor, and/or neural-network processing unit (NPU) Wait. Wherein, different processing units may be independent devices, or may be integrated in one or more processors.

其中,控制器可以是电子设备100的神经中枢和指挥中心。控制器可以根据指令操作码和时序信号,产生操作控制信号,完成取指令和执行指令的控制。The controller may be the nerve center and command center of the electronic device 100 . The controller can generate an operation control signal according to the instruction operation code and timing signal, and complete the control of fetching and executing instructions.

处理器110中还可以设置存储器,用于存储指令和数据。在一些实施例中,处理器110中的存储器为高速缓冲存储器。该存储器可以保存处理器110刚用过或循环使用的指令或数据。如果处理器110需要再次使用该指令或数据,可从所述存储器中直接调用。避免了重复存取,减少了处理器110的等待时间,因而提高了系统的效率。A memory may also be provided in the processor 110 for storing instructions and data. In some embodiments, the memory in processor 110 is cache memory. This memory may hold instructions or data that have just been used or recycled by the processor 110 . If the processor 110 needs to use the instruction or data again, it can be called directly from the memory. Repeated accesses are avoided and the latency of the processor 110 is reduced, thereby increasing the efficiency of the system.

在一些实施例中,处理器110可以包括一个或多个接口。接口可以包括集成电路(inter-integrated circuit,I2C)接口,集成电路内置音频(inter-integrated circuit sound,I2S)接口,脉冲编码调制(pulse code modulation,PCM)接口,通用异步收发传输器(universal asynchronous receiver/transmitter,UART)接口,移动产业处理器接口(mobile industry processor interface,MIPI),通用输入输出(general-purpose input/output,GPIO)接口,用户标识模块(subscriber identity module,SIM)接口,和/或通用串行总线(universal serial bus,USB)接口等。In some embodiments, the processor 110 may include one or more interfaces. The interface may include an integrated circuit (inter-integrated circuit, I2C) interface, an integrated circuit built-in audio (inter-integrated circuit sound, I2S) interface, a pulse code modulation (pulse code modulation, PCM) interface, a universal asynchronous transceiver (universal asynchronous transmitter) receiver/transmitter, UART) interface, mobile industry processor interface (MIPI), general-purpose input/output (GPIO) interface, subscriber identity module (SIM) interface, and / or universal serial bus (universal serial bus, USB) interface, etc.

I2C接口是一种双向同步串行总线,包括一根串行数据线(serial data line,SDA)和一根串行时钟线(derail clock line,SCL)。在一些实施例中,处理器110可以包含多组I2C总线。处理器110可以通过不同的I2C总线接口分别耦合触摸传感器180K,充电器,闪光灯,摄像头193等。例如:处理器110可以通过I2C接口耦合触摸传感器180K,使处理器110与触摸传感器180K通过I2C总线接口通信,实现电子设备100的触摸功能。The I2C interface is a bidirectional synchronous serial bus that includes a serial data line (SDA) and a serial clock line (SCL). In some embodiments, the processor 110 may contain multiple sets of I2C buses. The processor 110 can be respectively coupled to the touch sensor 180K, the charger, the flash, the camera 193 and the like through different I2C bus interfaces. For example, the processor 110 may couple the touch sensor 180K through the I2C interface, so that the processor 110 and the touch sensor 180K communicate with each other through the I2C bus interface, so as to realize the touch function of the electronic device 100 .

I2S接口可以用于音频通信。在一些实施例中,处理器110可以包含多组I2S总线。处理器110可以通过I2S总线与音频模块170耦合,实现处理器110与音频模块170之间的通信。在一些实施例中,音频模块170可以通过I2S接口向无线通信模块160传递音频信号,实现通过蓝牙耳机接听电话的功能。The I2S interface can be used for audio communication. In some embodiments, the processor 110 may contain multiple sets of I2S buses. The processor 110 may be coupled with the audio module 170 through an I2S bus to implement communication between the processor 110 and the audio module 170 . In some embodiments, the audio module 170 can transmit audio signals to the wireless communication module 160 through the I2S interface, so as to realize the function of answering calls through a Bluetooth headset.

PCM接口也可以用于音频通信,将模拟信号抽样,量化和编码。在一些实施例中,音频模块170与无线通信模块160可以通过PCM总线接口耦合。在一些实施例中,音频模块170也可以通过PCM接口向无线通信模块160传递音频信号,实现通过蓝牙耳机接听电话的功能。所述I2S接口和所述PCM接口都可以用于音频通信。The PCM interface can also be used for audio communications, sampling, quantizing and encoding analog signals. In some embodiments, the audio module 170 and the wireless communication module 160 may be coupled through a PCM bus interface. In some embodiments, the audio module 170 can also transmit audio signals to the wireless communication module 160 through the PCM interface, so as to realize the function of answering calls through the Bluetooth headset. Both the I2S interface and the PCM interface can be used for audio communication.

UART接口是一种通用串行数据总线,用于异步通信。该总线可以为双向通信总线。它将要传输的数据在串行通信与并行通信之间转换。在一些实施例中,UART接口通常被用于连接处理器110与无线通信模块160。例如:处理器110通过UART接口与无线通信模块160中的蓝牙模块通信,实现蓝牙功能。在一些实施例中,音频模块170可以通过UART接口向无线通信模块160传递音频信号,实现通过蓝牙耳机播放音乐的功能。The UART interface is a universal serial data bus used for asynchronous communication. The bus may be a bidirectional communication bus. It converts the data to be transmitted between serial communication and parallel communication. In some embodiments, a UART interface is typically used to connect the processor 110 with the wireless communication module 160 . For example, the processor 110 communicates with the Bluetooth module in the wireless communication module 160 through the UART interface to implement the Bluetooth function. In some embodiments, the audio module 170 can transmit audio signals to the wireless communication module 160 through the UART interface, so as to realize the function of playing music through the Bluetooth headset.

MIPI接口可以被用于连接处理器110与显示屏194,摄像头193等外围器件。MIPI接口包括摄像头串行接口(camera serial interface,CSI),显示屏串行接口(display serial interface,DSI)等。在一些实施例中,处理器110和摄像头193通过CSI接口通信,实现电子设备100的拍摄功能。处理器110和显示屏194通过DSI接口通信,实现电子设备100的显示功能。The MIPI interface can be used to connect the processor 110 with peripheral devices such as the display screen 194 and the camera 193 . MIPI interfaces include camera serial interface (CSI), display serial interface (DSI), etc. In some embodiments, the processor 110 communicates with the camera 193 through a CSI interface, so as to realize the photographing function of the electronic device 100 . The processor 110 communicates with the display screen 194 through the DSI interface to implement the display function of the electronic device 100 .

GPIO接口可以通过软件配置。GPIO接口可以被配置为控制信号,也可被配置为数据 信号。在一些实施例中,GPIO接口可以用于连接处理器110与摄像头193,显示屏194,无线通信模块160,音频模块170,传感器模块180等。GPIO接口还可以被配置为I2C接口,I2S接口,UART接口,MIPI接口等。The GPIO interface can be configured by software. The GPIO interface can be configured as a control signal or as a data signal. In some embodiments, the GPIO interface may be used to connect the processor 110 with the camera 193, the display screen 194, the wireless communication module 160, the audio module 170, the sensor module 180, and the like. The GPIO interface can also be configured as I2C interface, I2S interface, UART interface, MIPI interface, etc.

USB接口130是符合USB标准规范的接口,具体可以是Mini USB接口,Micro USB接口,USB Type C接口等。USB接口130可以用于连接充电器为电子设备100充电,也可以用于电子设备100与外围设备之间传输数据。也可以用于连接耳机,通过耳机播放音频。该接口还可以用于连接其他电子设备,例如AR设备等。The USB interface 130 is an interface that conforms to the USB standard specification, and may specifically be a Mini USB interface, a Micro USB interface, a USB Type C interface, and the like. The USB interface 130 can be used to connect a charger to charge the electronic device 100, and can also be used to transmit data between the electronic device 100 and peripheral devices. It can also be used to connect headphones to play audio through the headphones. The interface can also be used to connect other electronic devices, such as AR devices.

可以理解的是,本申请实施例示意的各模块间的接口连接关系,只是示意性说明,并不构成对电子设备100的结构限定。在本申请另一些实施例中,电子设备100也可以采用上述实施例中不同的接口连接方式,或多种接口连接方式的组合。It can be understood that the interface connection relationship between the modules illustrated in the embodiments of the present application is only a schematic illustration, and does not constitute a structural limitation of the electronic device 100 . In other embodiments of the present application, the electronic device 100 may also adopt different interface connection manners in the foregoing embodiments, or a combination of multiple interface connection manners.

充电管理模块140用于从充电器接收充电输入。其中,充电器可以是无线充电器,也可以是有线充电器。在一些有线充电的实施例中,充电管理模块140可以通过USB接口130接收有线充电器的充电输入。在一些无线充电的实施例中,充电管理模块140可以通过电子设备100的无线充电线圈接收无线充电输入。充电管理模块140为电池142充电的同时,还可以通过电源管理模块141为电子设备供电。The charging management module 140 is used to receive charging input from the charger. The charger may be a wireless charger or a wired charger. In some wired charging embodiments, the charging management module 140 may receive charging input from the wired charger through the USB interface 130 . In some wireless charging embodiments, the charging management module 140 may receive wireless charging input through a wireless charging coil of the electronic device 100 . While the charging management module 140 charges the battery 142 , it can also supply power to the electronic device through the power management module 141 .

电源管理模块141用于连接电池142,充电管理模块140与处理器110。电源管理模块141接收电池142和/或充电管理模块140的输入,为处理器110,内部存储器121,外部存储器,显示屏194,摄像头193,和无线通信模块160等供电。电源管理模块141还可以用于监测电池容量,电池循环次数,电池健康状态(漏电,阻抗)等参数。在其他一些实施例中,电源管理模块141也可以设置于处理器110中。在另一些实施例中,电源管理模块141和充电管理模块140也可以设置于同一个器件中。The power management module 141 is used for connecting the battery 142 , the charging management module 140 and the processor 110 . The power management module 141 receives input from the battery 142 and/or the charging management module 140 and supplies power to the processor 110 , the internal memory 121 , the external memory, the display screen 194 , the camera 193 , and the wireless communication module 160 . The power management module 141 can also be used to monitor parameters such as battery capacity, battery cycle times, battery health status (leakage, impedance). In some other embodiments, the power management module 141 may also be provided in the processor 110 . In other embodiments, the power management module 141 and the charging management module 140 may also be provided in the same device.

电子设备100的无线通信功能可以通过天线1,天线2,移动通信模块150,无线通信模块160,调制解调处理器以及基带处理器等实现。The wireless communication function of the electronic device 100 may be implemented by the antenna 1, the antenna 2, the mobile communication module 150, the wireless communication module 160, the modulation and demodulation processor, the baseband processor, and the like.

天线1和天线2用于发射和接收电磁波信号。电子设备100中的每个天线可用于覆盖单个或多个通信频带。不同的天线还可以复用,以提高天线的利用率。例如:可以将天线1复用为无线局域网的分集天线。在另外一些实施例中,天线可以和调谐开关结合使用。Antenna 1 and Antenna 2 are used to transmit and receive electromagnetic wave signals. Each antenna in electronic device 100 may be used to cover a single or multiple communication frequency bands. Different antennas can also be reused to improve antenna utilization. For example, the antenna 1 can be multiplexed as a diversity antenna of the wireless local area network. In other embodiments, the antenna may be used in conjunction with a tuning switch.

移动通信模块150可以提供应用在电子设备100上的包括2G/3G/4G/5G等无线通信的解决方案。移动通信模块150可以包括至少一个滤波器,开关,功率放大器,低噪声放大器(low noise amplifier,LNA)等。移动通信模块150可以由天线1接收电磁波,并对接收的电磁波进行滤波,放大等处理,传送至调制解调处理器进行解调。移动通信模块150还可以对经调制解调处理器调制后的信号放大,经天线1转为电磁波辐射出去。在一些实施例中,移动通信模块150的至少部分功能模块可以被设置于处理器110中。在一些实施例中,移动通信模块150的至少部分功能模块可以与处理器110的至少部分模块被设置在同一个器件中。The mobile communication module 150 may provide wireless communication solutions including 2G/3G/4G/5G etc. applied on the electronic device 100 . The mobile communication module 150 may include at least one filter, switch, power amplifier, low noise amplifier (LNA) and the like. The mobile communication module 150 can receive electromagnetic waves from the antenna 1, filter and amplify the received electromagnetic waves, and transmit them to the modulation and demodulation processor for demodulation. The mobile communication module 150 can also amplify the signal modulated by the modulation and demodulation processor, and then turn it into an electromagnetic wave for radiation through the antenna 1 . In some embodiments, at least part of the functional modules of the mobile communication module 150 may be provided in the processor 110 . In some embodiments, at least part of the functional modules of the mobile communication module 150 may be provided in the same device as at least part of the modules of the processor 110 .

调制解调处理器可以包括调制器和解调器。其中,调制器用于将待发送的低频基带信号调制成中高频信号。解调器用于将接收的电磁波信号解调为低频基带信号。随后解调器将解调得到的低频基带信号传送至基带处理器处理。低频基带信号经基带处理器处理后,被传递给应用处理器。应用处理器通过音频设备(不限于扬声器170A,受话器170B等)输出声音信号,或通过显示屏194显示图像或视频。在一些实施例中,调制解调处理器可以是独立的器件。在另一些实施例中,调制解调处理器可以独立于处理器110,与移动通信 模块150或其他功能模块设置在同一个器件中。The modem processor may include a modulator and a demodulator. Wherein, the modulator is used to modulate the low frequency baseband signal to be sent into a medium and high frequency signal. The demodulator is used to demodulate the received electromagnetic wave signal into a low frequency baseband signal. Then the demodulator transmits the demodulated low-frequency baseband signal to the baseband processor for processing. The low frequency baseband signal is processed by the baseband processor and passed to the application processor. The application processor outputs sound signals through audio devices (not limited to the speaker 170A, the receiver 170B, etc.), or displays images or videos through the display screen 194 . In some embodiments, the modem processor may be a stand-alone device. In other embodiments, the modem processor may be independent of the processor 110, and may be provided in the same device as the mobile communication module 150 or other functional modules.

无线通信模块160可以提供应用在电子设备100上的包括无线局域网(wireless local area networks,WLAN)(如无线保真(wireless fidelity,Wi-Fi)网络),蓝牙(bluetooth,BT),全球导航卫星系统(global navigation satellite system,GNSS),调频(frequency modulation,FM),近距离无线通信技术(near field communication,NFC),红外技术(infrared,IR)等无线通信的解决方案。无线通信模块160可以是集成至少一个通信处理模块的一个或多个器件。无线通信模块160经由天线2接收电磁波,将电磁波信号调频以及滤波处理,将处理后的信号发送到处理器110。无线通信模块160还可以从处理器110接收待发送的信号,对其进行调频,放大,经天线2转为电磁波辐射出去。The wireless communication module 160 can provide applications on the electronic device 100 including wireless local area networks (WLAN) (such as wireless fidelity (Wi-Fi) networks), bluetooth (BT), global navigation satellites Wireless communication solutions such as global navigation satellite system (GNSS), frequency modulation (FM), near field communication (NFC), and infrared technology (IR). The wireless communication module 160 may be one or more devices integrating at least one communication processing module. The wireless communication module 160 receives electromagnetic waves via the antenna 2 , frequency modulates and filters the electromagnetic wave signals, and sends the processed signals to the processor 110 . The wireless communication module 160 can also receive the signal to be sent from the processor 110 , perform frequency modulation on it, amplify it, and convert it into electromagnetic waves for radiation through the antenna 2 .

在一些实施例中,电子设备100的天线1和移动通信模块150耦合,天线2和无线通信模块160耦合,使得电子设备100可以通过无线通信技术与网络以及其他设备通信。所述无线通信技术可以包括全球移动通讯系统(global system for mobile communications,GSM),通用分组无线服务(general packet radio service,GPRS),码分多址接入(code division multiple access,CDMA),宽带码分多址(wideband code division multiple access,WCDMA),时分码分多址(time-division code division multiple access,TD-SCDMA),长期演进(long term evolution,LTE),BT,GNSS,WLAN,NFC,FM,和/或IR技术等。所述GNSS可以包括全球卫星定位系统(global positioning system,GPS),全球导航卫星系统(global navigation satellite system,GLONASS),北斗卫星导航系统(beidou navigation satellite system,BDS),准天顶卫星系统(quasi-zenith satellite system,QZSS)和/或星基增强系统(satellite based augmentation systems,SBAS)。In some embodiments, the antenna 1 of the electronic device 100 is coupled with the mobile communication module 150, and the antenna 2 is coupled with the wireless communication module 160, so that the electronic device 100 can communicate with the network and other devices through wireless communication technology. The wireless communication technology may include global system for mobile communications (GSM), general packet radio service (GPRS), code division multiple access (CDMA), broadband Code Division Multiple Access (WCDMA), Time Division Code Division Multiple Access (TD-SCDMA), Long Term Evolution (LTE), BT, GNSS, WLAN, NFC , FM, and/or IR technology, etc. The GNSS may include global positioning system (global positioning system, GPS), global navigation satellite system (global navigation satellite system, GLONASS), Beidou navigation satellite system (beidou navigation satellite system, BDS), quasi-zenith satellite system (quasi -zenith satellite system, QZSS) and/or satellite based augmentation systems (SBAS).

电子设备100通过GPU,显示屏194,以及应用处理器等实现显示功能。GPU为图像处理的微处理器,连接显示屏194和应用处理器。GPU用于执行数学和几何计算,用于图形渲染。处理器110可包括一个或多个GPU,其执行程序指令以生成或改变显示信息。The electronic device 100 implements a display function through a GPU, a display screen 194, an application processor, and the like. The GPU is a microprocessor for image processing, and is connected to the 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 alter display information.

显示屏194用于显示图像,视频等。显示屏194包括显示面板。显示面板可以采用液晶显示屏(liquid crystal display,LCD),有机发光二极管(organic light-emitting diode,OLED),有源矩阵有机发光二极体或主动矩阵有机发光二极体(active-matrix organic light emitting diode的,AMOLED),柔性发光二极管(flex light-emitting diode,FLED),Miniled,MicroLed,Micro-oLed,量子点发光二极管(quantum dot light emitting diodes,QLED)等。在一些实施例中,电子设备100可以包括1个或N个显示屏194,N为大于1的正整数。Display screen 194 is used to display images, videos, and the like. Display screen 194 includes a display panel. The display panel can be a liquid crystal display (LCD), an organic light-emitting diode (OLED), an active-matrix organic light-emitting diode or an active-matrix organic light-emitting diode (active-matrix organic light). emitting diode, AMOLED), flexible light-emitting diode (flex light-emitting diode, FLED), Miniled, MicroLed, Micro-oLed, quantum dot light-emitting diode (quantum dot light emitting diodes, QLED) and so on. In some embodiments, the electronic device 100 may include one or N display screens 194 , where N is a positive integer greater than one.

电子设备100可以通过ISP,摄像头193,视频编解码器,GPU,显示屏194以及应用处理器等实现拍摄功能。The electronic device 100 may implement a shooting function through an ISP, a camera 193, a video codec, a GPU, a display screen 194, an application processor, and the like.

ISP用于处理摄像头193反馈的数据。例如,拍照时,打开快门,光线通过镜头被传递到摄像头感光元件上,光信号转换为电信号,摄像头感光元件将所述电信号传递给ISP处理,转化为肉眼可见的图像。ISP还可以对图像的噪点,亮度,肤色进行算法优化。ISP还可以对拍摄场景的曝光,色温等参数优化。在一些实施例中,ISP可以设置在摄像头193中。The ISP is used to process the data fed back by the camera 193 . For example, when taking a photo, the shutter is opened, the light is transmitted to the camera photosensitive element through the lens, the light signal is converted into an electrical signal, and the camera photosensitive element transmits the electrical signal to the ISP for processing, and converts it into an image visible to the naked eye. ISP can also perform algorithm optimization on image noise, brightness, and skin tone. ISP can also optimize the exposure, color temperature and other parameters of the shooting scene. In some embodiments, the ISP may be provided in the camera 193 .

摄像头193用于捕获静态图像或视频。物体通过镜头生成光学图像投射到感光元件。感光元件可以是电荷耦合器件(charge coupled device,CCD)或互补金属氧化物半导体(complementary metal-oxide-semiconductor,CMOS)光电晶体管。感光元件把光信号转换成 电信号,之后将电信号传递给ISP转换成数字图像信号。ISP将数字图像信号输出到DSP加工处理。DSP将数字图像信号转换成标准的RGB,YUV等格式的图像信号。在一些实施例中,电子设备100可以包括1个或N个摄像头193,N为大于1的正整数。Camera 193 is used to capture still images or video. The object is projected through the lens to generate an optical image onto the photosensitive element. The photosensitive element may be a charge coupled device (CCD) or a complementary metal-oxide-semiconductor (CMOS) phototransistor. The photosensitive element converts the optical signal into an electrical signal, and then transmits the electrical signal to the ISP to convert it into a digital image signal. The ISP outputs the digital image signal to the DSP for processing. DSP converts digital image signals into standard RGB, YUV and other formats of image signals. In some embodiments, the electronic device 100 may include 1 or N cameras 193 , where N is a positive integer greater than 1.

数字信号处理器用于处理数字信号,除了可以处理数字图像信号,还可以处理其他数字信号。例如,当电子设备100在频点选择时,数字信号处理器用于对频点能量进行傅里叶变换等。A digital signal processor is used to process digital signals, in addition to processing digital image signals, it can also process other digital signals. For example, when the electronic device 100 selects a frequency point, the digital signal processor is used to perform Fourier transform on the frequency point energy and so on.

视频编解码器用于对数字视频压缩或解压缩。电子设备100可以支持一种或多种视频编解码器。这样,电子设备100可以播放或录制多种编码格式的视频,例如:动态图像专家组(moving picture experts group,MPEG)1,MPEG2,MPEG3,MPEG4等。Video codecs are used to compress or decompress digital video. The electronic device 100 may support one or more video codecs. In this way, the electronic device 100 can play or record videos of various encoding formats, such as: Moving Picture Experts Group (moving picture experts group, MPEG) 1, MPEG2, MPEG3, MPEG4 and so on.

NPU为神经网络(neural-network,NN)计算处理器,通过借鉴生物神经网络结构,例如借鉴人脑神经元之间传递模式,对输入信息快速处理,还可以不断的自学习。通过NPU可以实现电子设备100的智能认知等应用,例如:图像识别,人脸识别,语音识别,文本理解等。The NPU is a neural-network (NN) computing processor. By drawing on the structure of biological neural networks, such as the transfer mode between neurons in the human brain, it can quickly process the input information, and can continuously learn by itself. Applications such as intelligent cognition of the electronic device 100 can be implemented through the NPU, such as image recognition, face recognition, speech recognition, text understanding, and the like.

外部存储器接口120可以用于连接外部存储卡,例如Micro SD卡,实现扩展电子设备100的存储能力。外部存储卡通过外部存储器接口120与处理器110通信,实现数据存储功能。例如将音乐,视频等文件保存在外部存储卡中。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 100 . The external memory card communicates with the processor 110 through the external memory interface 120 to realize the data storage function. For example to save files like music, video etc in external memory card.

内部存储器121可以用于存储计算机可执行程序代码,所述可执行程序代码包括指令。处理器110通过运行存储在内部存储器121的指令,从而执行电子设备100的各种功能应用以及数据处理。内部存储器121可以包括存储程序区和存储数据区。其中,存储程序区可存储操作系统,至少一个功能所需的应用程序(比如声音播放功能,图像播放功能等)等。存储数据区可存储电子设备100使用过程中所创建的数据(比如音频数据,电话本等)等。此外,内部存储器121可以包括高速随机存取存储器,还可以包括非易失性存储器,例如至少一个磁盘存储器件,闪存器件,通用闪存存储器(universal flash storage,UFS)等。Internal memory 121 may 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 100 by executing the instructions stored in the internal memory 121 . The internal memory 121 may include a storage program area and a storage data area. The storage program area can store an operating system, an application program required for at least one function (such as a sound playback function, an image playback function, etc.), and the like. The storage data area may store data (such as audio data, phone book, etc.) created during the use of the electronic device 100 and the like. In addition, the internal memory 121 may include high-speed random access memory, and may also include non-volatile memory, such as at least one magnetic disk storage device, flash memory device, universal flash storage (UFS), and the like.

电子设备100可以通过音频模块170,扬声器170A,受话器170B,麦克风170C,耳机接口170D,以及应用处理器等实现音频功能。例如音乐播放,录音等。The electronic device 100 may implement audio functions through an audio module 170, a speaker 170A, a receiver 170B, a microphone 170C, an earphone interface 170D, an application processor, and the like. Such as music playback, recording, etc.

音频模块170用于将数字音频信息转换成模拟音频信号输出,也用于将模拟音频输入转换为数字音频信号。音频模块170还可以用于对音频信号编码和解码。在一些实施例中,音频模块170可以设置于处理器110中,或将音频模块170的部分功能模块设置于处理器110中。The audio module 170 is used for converting digital audio information into analog audio signal output, and also for converting analog audio input into digital audio signal. Audio module 170 may also be used to encode and decode audio signals. In some embodiments, the audio module 170 may be provided in the processor 110 , or some functional modules of the audio module 170 may be provided in the processor 110 .

扬声器170A,也称“喇叭”,用于将音频电信号转换为声音信号。电子设备100可以通过扬声器170A收听音乐,或收听免提通话。Speaker 170A, also referred to as a "speaker", is used to convert audio electrical signals into sound signals. The electronic device 100 can listen to music through the speaker 170A, or listen to a hands-free call.

受话器170B,也称“听筒”,用于将音频电信号转换成声音信号。当电子设备100接听电话或语音信息时,可以通过将受话器170B靠近人耳接听语音。The receiver 170B, also referred to as "earpiece", is used to convert audio electrical signals into sound signals. When the electronic device 100 answers a call or a voice message, the voice can be answered by placing the receiver 170B close to the human ear.

麦克风170C,也称“话筒”,“传声器”,用于将声音信号转换为电信号。当拨打电话或发送语音信息时,用户可以通过人嘴靠近麦克风170C发声,将声音信号输入到麦克风170C。电子设备100可以设置至少一个麦克风170C。在另一些实施例中,电子设备100可以设置两个麦克风170C,除了采集声音信号,还可以实现降噪功能。在另一些实施例中,电子设备100还可以设置三个,四个或更多麦克风170C,实现采集声音信号,降噪,还可以识别声音来源,实现定向录音功能等。The microphone 170C, also called "microphone" or "microphone", is used to convert sound signals into electrical signals. When making a call or sending a voice message, the user can make a sound by approaching the microphone 170C through a human mouth, and input the sound signal into the microphone 170C. The electronic device 100 may be provided with at least one microphone 170C. In other embodiments, the electronic device 100 may be provided with two microphones 170C, which can implement a noise reduction function in addition to collecting sound signals. In other embodiments, the electronic device 100 may further be provided with three, four or more microphones 170C to collect sound signals, reduce noise, identify sound sources, and implement directional recording functions.

耳机接口170D用于连接有线耳机。耳机接口170D可以是USB接口130,也可以是 3.5mm的开放移动电子设备平台(open mobile terminal platform,OMTP)标准接口,美国蜂窝电信工业协会(cellular telecommunications industry association of the USA,CTIA)标准接口。The earphone jack 170D is used to connect wired earphones. The earphone interface 170D may be the USB interface 130, or may be a 3.5mm open mobile terminal platform (OMTP) standard interface, a cellular telecommunications industry association of the USA (CTIA) standard interface.

压力传感器180A用于感受压力信号,可以将压力信号转换成电信号。在一些实施例中,压力传感器180A可以设置于显示屏194。压力传感器180A的种类很多,如电阻式压力传感器,电感式压力传感器,电容式压力传感器等。电容式压力传感器可以是包括至少两个具有导电材料的平行板。当有力作用于压力传感器180A,电极之间的电容改变。电子设备100根据电容的变化确定压力的强度。当有触摸操作作用于显示屏194,电子设备100根据压力传感器180A检测所述触摸操作强度。电子设备100也可以根据压力传感器180A的检测信号计算触摸的位置。在一些实施例中,作用于相同触摸位置,但不同触摸操作强度的触摸操作,可以对应不同的操作指令。例如:当有触摸操作强度小于第一压力阈值的触摸操作作用于短消息应用图标时,执行查看短消息的指令。当有触摸操作强度大于或等于第一压力阈值的触摸操作作用于短消息应用图标时,执行新建短消息的指令。The pressure sensor 180A is used to sense pressure signals, and can convert the pressure signals into electrical signals. In some embodiments, the pressure sensor 180A may be provided on the display screen 194 . There are many types of pressure sensors 180A, such as resistive pressure sensors, inductive pressure sensors, capacitive pressure sensors, and the like. The capacitive pressure sensor may be comprised of at least two parallel plates of conductive material. When a force is applied to the pressure sensor 180A, the capacitance between the electrodes changes. The electronic device 100 determines the intensity of the pressure according to the change in capacitance. When a touch operation acts on the display screen 194, the electronic device 100 detects the intensity of the touch operation according to the pressure sensor 180A. The electronic device 100 may also calculate the touched position according to the detection signal of the pressure sensor 180A. In some embodiments, touch operations acting on the same touch position but with different touch operation intensities may correspond to different operation instructions. For example, when a touch operation whose intensity is less than the first pressure threshold acts on the short message application icon, the instruction for viewing the short message is executed. When a touch operation with a touch operation intensity greater than or equal to the first pressure threshold acts on the short message application icon, the instruction to create a new short message is executed.

陀螺仪传感器180B可以用于确定电子设备100的运动姿态。在一些实施例中,可以通过陀螺仪传感器180B确定电子设备100围绕三个轴(即,x,y和z轴)的角速度。陀螺仪传感器180B可以用于拍摄防抖。示例性的,当按下快门,陀螺仪传感器180B检测电子设备100抖动的角度,根据角度计算出镜头模组需要补偿的距离,让镜头通过反向运动抵消电子设备100的抖动,实现防抖。陀螺仪传感器180B还可以用于导航,体感游戏场景。The gyro sensor 180B may be used to determine the motion attitude of the electronic device 100 . In some embodiments, the angular velocity of electronic device 100 about three axes (ie, x, y, and z axes) may be determined by gyro sensor 180B. The gyro sensor 180B can be used for image stabilization. Exemplarily, when the shutter is pressed, the gyro sensor 180B detects the shaking angle of the electronic device 100, calculates the distance that the lens module needs to compensate according to the angle, and allows the lens to offset the shaking of the electronic device 100 through reverse motion to achieve anti-shake. The gyro sensor 180B can also be used for navigation and somatosensory game scenarios.

气压传感器180C用于测量气压。在一些实施例中,电子设备100通过气压传感器180C测得的气压值计算海拔高度,辅助定位和导航。The air pressure sensor 180C is used to measure air pressure. In some embodiments, the electronic device 100 calculates the altitude through the air pressure value measured by the air pressure sensor 180C to assist in positioning and navigation.

磁传感器180D包括霍尔传感器。电子设备100可以利用磁传感器180D检测翻盖皮套的开合。在一些实施例中,当电子设备100是翻盖机时,电子设备100可以根据磁传感器180D检测翻盖的开合。进而根据检测到的皮套的开合状态或翻盖的开合状态,设置翻盖自动解锁等特性。The magnetic sensor 180D includes a Hall sensor. The electronic device 100 can detect the opening and closing of the flip holster using the magnetic sensor 180D. In some embodiments, when the electronic device 100 is a flip machine, the electronic device 100 can detect the opening and closing of the flip according to the magnetic sensor 180D. Further, according to the detected opening and closing state of the leather case or the opening and closing state of the flip cover, characteristics such as automatic unlocking of the flip cover are set.

加速度传感器180E可检测电子设备100在各个方向上(一般为三轴)加速度的大小。当电子设备100静止时可检测出重力的大小及方向。还可以用于识别电子设备姿态,应用于横竖屏切换,计步器等应用。The acceleration sensor 180E can detect the magnitude of the acceleration of the electronic device 100 in various directions (generally three axes). The magnitude and direction of gravity can be detected when the electronic device 100 is stationary. It can also be used to identify the posture of electronic devices, and can be used in applications such as horizontal and vertical screen switching, pedometers, etc.

距离传感器180F,用于测量距离。电子设备100可以通过红外或激光测量距离。在一些实施例中,拍摄场景,电子设备100可以利用距离传感器180F测距以实现快速对焦。Distance sensor 180F for measuring distance. The electronic device 100 can measure the distance through infrared or laser. In some embodiments, when shooting a scene, the electronic device 100 can use the distance sensor 180F to measure the distance to achieve fast focusing.

接近光传感器180G可以包括例如发光二极管(LED)和光检测器,例如光电二极管。发光二极管可以是红外发光二极管。电子设备100通过发光二极管向外发射红外光。电子设备100使用光电二极管检测来自附近物体的红外反射光。当检测到充分的反射光时,可以确定电子设备100附近有物体。当检测到不充分的反射光时,电子设备100可以确定电子设备100附近没有物体。电子设备100可以利用接近光传感器180G检测用户手持电子设备100贴近耳朵通话,以便自动熄灭屏幕达到省电的目的。接近光传感器180G也可用于皮套模式,口袋模式自动解锁与锁屏。Proximity light sensor 180G may include, for example, light emitting diodes (LEDs) and light detectors, such as photodiodes. The light emitting diodes may be infrared light emitting diodes. The electronic device 100 emits infrared light to the outside through the light emitting diode. Electronic device 100 uses photodiodes to detect infrared reflected light from nearby objects. When sufficient reflected light is detected, it can be determined that there is an object near the electronic device 100 . When insufficient reflected light is detected, the electronic device 100 may determine that there is no object near the electronic device 100 . The electronic device 100 can use the proximity light sensor 180G to detect that the user holds the electronic device 100 close to the ear to talk, so as to automatically turn off the screen to save power. Proximity light sensor 180G can also be used in holster mode, pocket mode automatically unlocks and locks the screen.

环境光传感器180L用于感知环境光亮度。电子设备100可以根据感知的环境光亮度自适应调节显示屏194亮度。环境光传感器180L也可用于拍照时自动调节白平衡。环境光传感器180L还可以与接近光传感器180G配合,检测电子设备100是否在口袋里,以 防误触。The ambient light sensor 180L is used to sense ambient light brightness. The electronic device 100 can adaptively adjust the brightness of the display screen 194 according to the perceived ambient light brightness. The ambient light sensor 180L can also be used to automatically adjust the white balance when taking pictures. The ambient light sensor 180L can also cooperate with the proximity light sensor 180G to detect whether the electronic device 100 is in a pocket to prevent accidental touch.

指纹传感器180H用于采集指纹。电子设备100可以利用采集的指纹特性实现指纹解锁,访问应用锁,指纹拍照,指纹接听来电等。The fingerprint sensor 180H is used to collect fingerprints. The electronic device 100 can use the collected fingerprint characteristics to realize fingerprint unlocking, accessing application locks, taking pictures with fingerprints, answering incoming calls with fingerprints, and the like.

温度传感器180J用于检测温度。在一些实施例中,电子设备100利用温度传感器180J检测的温度,执行温度处理策略。例如,当温度传感器180J上报的温度超过阈值,电子设备100执行降低位于温度传感器180J附近的处理器的性能,以便降低功耗实施热保护。在另一些实施例中,当温度低于另一阈值时,电子设备100对电池142加热,以避免低温导致电子设备100异常关机。在其他一些实施例中,当温度低于又一阈值时,电子设备100对电池142的输出电压执行升压,以避免低温导致的异常关机。The temperature sensor 180J is used to detect the temperature. In some embodiments, the electronic device 100 uses the temperature detected by the temperature sensor 180J to execute a temperature processing strategy. For example, when the temperature reported by the temperature sensor 180J exceeds a threshold value, the electronic device 100 reduces the performance of the processor located near the temperature sensor 180J in order to reduce power consumption and implement thermal protection. In other embodiments, when the temperature is lower than another threshold, the electronic device 100 heats the battery 142 to avoid abnormal shutdown of the electronic device 100 caused by the low temperature. In some other embodiments, when the temperature is lower than another threshold, the electronic device 100 boosts the output voltage of the battery 142 to avoid abnormal shutdown caused by low temperature.

触摸传感器180K,也称“触控面板”。触摸传感器180K可以设置于显示屏194,由触摸传感器180K与显示屏194组成触摸屏,也称“触控屏”。触摸传感器180K用于检测作用于其上或附近的触摸操作。触摸传感器可以将检测到的触摸操作传递给应用处理器,以确定触摸事件类型。可以通过显示屏194提供与触摸操作相关的视觉输出。在另一些实施例中,触摸传感器180K也可以设置于电子设备100的表面,与显示屏194所处的位置不同。Touch sensor 180K, also called "touch panel". The touch sensor 180K may be disposed on the display screen 194 , and the touch sensor 180K and the display screen 194 form a touch screen, also called a “touch screen”. The touch sensor 180K is used to detect a touch operation on or near it. The touch sensor can pass the detected touch operation to the application processor to determine the type of touch event. Visual output related to touch operations may be provided through display screen 194 . In other embodiments, the touch sensor 180K may also be disposed on the surface of the electronic device 100 , which is different from the location where the display screen 194 is located.

骨传导传感器180M可以获取振动信号。在一些实施例中,骨传导传感器180M可以获取人体声部振动骨块的振动信号。骨传导传感器180M也可以接触人体脉搏,接收血压跳动信号。在一些实施例中,骨传导传感器180M也可以设置于耳机中,结合成骨传导耳机。音频模块170可以基于所述骨传导传感器180M获取的声部振动骨块的振动信号,解析出语音信号,实现语音功能。应用处理器可以基于所述骨传导传感器180M获取的血压跳动信号解析心率信息,实现心率检测功能。The bone conduction sensor 180M can acquire vibration signals. In some embodiments, the bone conduction sensor 180M can acquire the vibration signal of the vibrating bone mass of the human voice. The bone conduction sensor 180M can also contact the pulse of the human body and receive the blood pressure beating signal. In some embodiments, the bone conduction sensor 180M can also be disposed in the earphone, combined with the bone conduction earphone. The audio module 170 can analyze the voice signal based on the vibration signal of the vocal vibration bone block obtained by the bone conduction sensor 180M, so as to realize the voice function. The application processor can analyze the heart rate information based on the blood pressure beat signal obtained by the bone conduction sensor 180M, and realize the function of heart rate detection.

按键190包括开机键,音量键等。按键190可以是机械按键。也可以是触摸式按键。电子设备100可以接收按键输入,产生与电子设备100的用户设置以及功能控制有关的键信号输入。The keys 190 include a power-on key, a volume key, and the like. Keys 190 may be mechanical keys. It can also be a touch key. The electronic device 100 may receive key inputs and generate key signal inputs related to user settings and function control of the electronic device 100 .

马达191可以产生振动提示。马达191可以用于来电振动提示,也可以用于触摸振动反馈。例如,作用于不同应用(例如拍照,音频播放等)的触摸操作,可以对应不同的振动反馈效果。作用于显示屏194不同区域的触摸操作,马达191也可对应不同的振动反馈效果。不同的应用场景(例如:时间提醒,接收信息,闹钟,游戏等)也可以对应不同的振动反馈效果。触摸振动反馈效果还可以支持自定义。Motor 191 can generate vibrating cues. The motor 191 can be used for vibrating alerts for incoming calls, and can also be used for touch vibration feedback. For example, touch operations acting on different applications (such as taking pictures, playing audio, etc.) can correspond to different vibration feedback effects. The motor 191 can also correspond to different vibration feedback effects for touch operations on different areas of the display screen 194 . Different application scenarios (for example: time reminder, receiving information, alarm clock, games, etc.) can also correspond to different vibration feedback effects. The touch vibration feedback effect can also support customization.

指示器192可以是指示灯,可以用于指示充电状态,电量变化,也可以用于指示消息,未接来电,通知等。The indicator 192 can be an indicator light, which can be used to indicate the charging state, the change of the power, and can also be used to indicate a message, a missed call, a notification, and the like.

SIM卡接口195用于连接SIM卡。SIM卡可以通过插入SIM卡接口195,或从SIM卡接口195拔出,实现和电子设备100的接触和分离。电子设备100可以支持1个或N个SIM卡接口,N为大于1的正整数。SIM卡接口195可以支持Nano SIM卡,Micro SIM卡,SIM卡等。同一个SIM卡接口195可以同时插入多张卡。所述多张卡的类型可以相同,也可以不同。SIM卡接口195也可以兼容不同类型的SIM卡。SIM卡接口195也可以兼容外部存储卡。电子设备100通过SIM卡和网络交互,实现通话以及数据通信等功能。在一些实施例中,电子设备100采用eSIM,即:嵌入式SIM卡。eSIM卡可以嵌在电子设备100中,不能和电子设备100分离。The SIM card interface 195 is used to connect a SIM card. The SIM card can be contacted and separated from the electronic device 100 by inserting into the SIM card interface 195 or pulling out from the SIM card interface 195 . The electronic device 100 may support 1 or N SIM card interfaces, where N is a positive integer greater than 1. The SIM card interface 195 can support Nano SIM card, Micro SIM card, SIM card and so on. Multiple cards can be inserted into the same SIM card interface 195 at the same time. The types of the plurality of cards may be the same or different. The SIM card interface 195 can also be compatible with different types of SIM cards. The SIM card interface 195 is also compatible with external memory cards. The electronic device 100 interacts with the network through the SIM card to implement functions such as call and data communication. In some embodiments, the electronic device 100 employs an eSIM, ie: an embedded SIM card. The eSIM card can be embedded in the electronic device 100 and cannot be separated from the electronic device 100 .

电子设备100的软件系统可以采用分层架构,事件驱动架构,微核架构,微服务架构, 或云架构。本申请实施例以分层架构的Android系统为例,示例性说明电子设备100的软件结构。The software system of the electronic device 100 may adopt a layered architecture, an event-driven architecture, a microkernel architecture, a microservice architecture, or a cloud architecture. The embodiments of the present application take an Android system with a layered architecture as an example to exemplarily describe the software structure of the electronic device 100 .

图2是本申请实施例的电子设备100的软件结构框图。分层架构将软件分成若干个层,每一层都有清晰的角色和分工。层与层之间通过软件接口通信。在一些实施例中,将Android系统分为四层,从上至下分别为应用程序层,应用程序框架层,安卓运行时(Android runtime)和系统库,以及内核层。应用程序层可以包括一系列应用程序包。FIG. 2 is a block diagram of the software structure of the electronic device 100 according to the embodiment of the present application. The layered architecture divides the software into several layers, and each layer has a clear role and division of labor. Layers communicate with each other through software interfaces. In some embodiments, the Android system is divided into four layers, which are, from top to bottom, an application layer, an application framework layer, an Android runtime (Android runtime) and a system library, and a kernel layer. The application layer can include a series of application packages.

如图2所示,应用程序包可以包括相机,图库,日历,通话,地图,导航,WLAN,蓝牙,音乐,视频,短信息等应用程序。As shown in Figure 2, the application package can include applications such as camera, gallery, calendar, call, map, navigation, WLAN, Bluetooth, music, video, short message and so on.

应用程序框架层为应用程序层的应用程序提供应用编程接口(application programming interface,API)和编程框架。应用程序框架层包括一些预先定义的函数。The application framework layer provides an application programming interface (application programming interface, API) and a programming framework for applications in the application layer. The application framework layer includes some predefined functions.

如图2所示,应用程序框架层可以包括窗口管理器,内容提供器,视图系统,电话管理器,资源管理器,通知管理器等。As shown in Figure 2, the application framework layer may include window managers, content providers, view systems, telephony managers, resource managers, notification managers, and the like.

窗口管理器用于管理窗口程序。窗口管理器可以获取显示屏大小,判断是否有状态栏,锁定屏幕,截取屏幕等。A window manager is used to manage window programs. The window manager can get the size of the display screen, determine whether there is a status bar, lock the screen, take screenshots, etc.

内容提供器用来存放和获取数据,并使这些数据可以被应用程序访问。所述数据可以包括视频,图像,音频,拨打和接听的电话,浏览历史和书签,电话簿等。Content providers are used to store and retrieve data and make these data accessible to applications. The data may include video, images, audio, calls made and received, browsing history and bookmarks, phone book, etc.

视图系统包括可视控件,例如显示文字的控件,显示图片的控件等。视图系统可用于构建应用程序。显示界面可以由一个或多个视图组成的。例如,包括短信通知图标的显示界面,可以包括显示文字的视图以及显示图片的视图。The view system includes visual controls, such as controls for displaying text, controls for displaying pictures, and so on. View systems can be used to build applications. A display interface can consist of one or more views. For example, the display interface including the short message notification icon may include a view for displaying text and a view for displaying pictures.

电话管理器用于提供电子设备100的通信功能。例如通话状态的管理(包括接通,挂断等)。The phone manager is used to provide the communication function of the electronic device 100 . For example, the management of call status (including connecting, hanging up, etc.).

资源管理器为应用程序提供各种资源,比如本地化字符串,图标,图片,布局文件,视频文件等等。The resource manager provides various resources for the application, such as localization strings, icons, pictures, layout files, video files and so on.

通知管理器使应用程序可以在状态栏中显示通知信息,可以用于传达告知类型的消息,可以短暂停留后自动消失,无需用户交互。比如通知管理器被用于告知下载完成,消息提醒等。通知管理器还可以是以图表或者滚动条文本形式出现在系统顶部状态栏的通知,例如后台运行的应用程序的通知,还可以是以对话窗口形式出现在屏幕上的通知。例如在状态栏提示文本信息,发出提示音,电子设备振动,指示灯闪烁等。The notification manager enables applications to display notification information in the status bar, which can be used to convey notification-type messages, and can disappear automatically after a brief pause without user interaction. For example, the notification manager is used to notify download completion, message reminders, etc. The notification manager can also display notifications in the status bar at the top of the system in the form of graphs or scroll bar text, such as notifications of applications running in the background, and notifications on the screen in the form of dialog windows. For example, text information is prompted in the status bar, a prompt sound is issued, the electronic device vibrates, and the indicator light flashes.

Android runtime包括核心库和虚拟机。Android runtime负责安卓系统的调度和管理。The Android runtime includes core libraries and a virtual machine. Android runtime is responsible for scheduling and management of the Android system.

核心库包含两部分:一部分是java语言需要调用的功能函数,另一部分是安卓的核心库。The core library consists of two parts: one is the function functions that the java language needs to call, and the other is the core library of Android.

应用程序层和应用程序框架层运行在虚拟机中。虚拟机将应用程序层和应用程序框架层的java文件执行为二进制文件。虚拟机用于执行对象生命周期的管理,堆栈管理,线程管理,安全和异常的管理,以及垃圾回收等功能。The application layer and the application framework layer run in virtual machines. The virtual machine executes the java files of the application layer and the application framework layer as binary files. The virtual machine is used to perform functions such as object lifecycle management, stack management, thread management, safety and exception management, and garbage collection.

系统库可以包括多个功能模块。例如:表面管理器(surface manager),媒体库(media libraries),三维图形处理库(例如:OpenGL ES),2D图形引擎(例如:SGL)等。A system library can include multiple functional modules. For example: surface manager (surface manager), media library (media library), 3D graphics processing library (eg: OpenGL ES), 2D graphics engine (eg: SGL), etc.

表面管理器用于对显示子系统进行管理,并且为多个应用程序提供了2D和3D图层的融合。The Surface Manager is used to manage the display subsystem and provides a fusion of 2D and 3D layers for multiple applications.

媒体库支持多种常用的音频,视频格式回放和录制,以及静态图像文件等。媒体库可以支持多种音视频编码格式,例如:MPEG4,H.264,MP3,AAC,AMR,JPG,PNG等。The media library supports playback and recording of a variety of commonly used audio and video formats, as well as still image files. The media library can support a variety of audio and video encoding formats, such as: MPEG4, H.264, MP3, AAC, AMR, JPG, PNG, etc.

三维图形处理库用于实现三维图形绘图,图像渲染,合成,和图层处理等。The 3D graphics processing library is used to implement 3D graphics drawing, image rendering, compositing, and layer processing.

2D图形引擎是2D绘图的绘图引擎。2D graphics engine is a drawing engine for 2D drawing.

内核层是硬件和软件之间的层。内核层至少包含显示驱动,摄像头驱动,音频驱动,传感器驱动。The kernel layer is the layer between hardware and software. The kernel layer contains at least display drivers, camera drivers, audio drivers, and sensor drivers.

为了便于理解,本申请以下实施例将以具有图1和图2所示结构的电子设备为例,结合附图和应用场景,对本申请实施例提供的保存图像的方法进行具体阐述。For ease of understanding, the following embodiments of the present application will take the electronic device having the structure shown in FIG. 1 and FIG. 2 as an example, and combine the drawings and application scenarios to specifically describe the method for saving images provided by the embodiments of the present application.

在描述本申请实施例的技术方案之前,首先简单介绍本申请涉及的相关术语。Before describing the technical solutions of the embodiments of the present application, related terms involved in the present application are briefly introduced first.

水平拍摄:本申请实施例中的水平拍摄指的是用户使用手机进行拍摄时,手机的上表面所在的平面(即第一平面)与水平面平行或近似平行。例如,该第一平面与水平面之间的夹角处于预设角度范围内,如负3度至3度、负6度至6度等等。Horizontal shooting: The horizontal shooting in the embodiments of the present application refers to the plane on which the upper surface of the mobile phone (ie, the first plane) is parallel or approximately parallel to the horizontal plane when the user uses the mobile phone to shoot. For example, the included angle between the first plane and the horizontal plane is within a preset angle range, such as minus 3 degrees to 3 degrees, minus 6 degrees to 6 degrees, and so on.

正向(竖屏):在水平拍摄状态下,用户竖屏握持手机的方向。Forward (Portrait): In the horizontal shooting state, the user holds the phone in the vertical orientation.

左向横屏:正向方向逆时针旋转90度。Landscape Left: Rotate 90 degrees counterclockwise in the forward direction.

右向横屏:正向方向顺时针旋转90度。Landscape right: rotate 90 degrees clockwise in the forward direction.

倒置竖屏:正向方向顺/逆时针旋转180度。Inverted vertical screen: rotate 180 degrees clockwise/counterclockwise in the forward direction.

用户使用手机进行拍摄时,照片保存的方向一般和用户握持手机的姿势有关,例如,当用户竖直握持手机水平拍摄时,用户的本意是让手机竖直保存拍摄的照片,但是由于是用户手持手机进行水平拍摄,此时手机的面板所在的平面和水平面可能不平行,因此,手机中的重力传感器可能会误以为用户是横向拍摄,因此将照片以横向保存。面对这种情况,用户一般会手动旋转该保存方向错误的照片,或者手机在保存该照片时提示用户是横向保存还是竖直保存,无论哪种情况,都需要用户手动调节,这在一定程度上影响了用户的拍摄体验。When a user uses a mobile phone to take pictures, the direction in which the photos are saved is generally related to the posture of the user holding the mobile phone. For example, when the user holds the mobile phone vertically to take pictures horizontally, the user's intention is to let the mobile phone save the photos taken vertically. The user holds the mobile phone for horizontal shooting. At this time, the plane on which the panel of the mobile phone is located may not be parallel to the horizontal plane. Therefore, the gravity sensor in the mobile phone may mistake the user for the horizontal shooting, so the photo is saved in the horizontal direction. Faced with this situation, the user generally manually rotates the photo with the wrong orientation, or the mobile phone prompts the user whether to save the photo horizontally or vertically when saving the photo. In either case, the user needs to manually adjust it. It affects the user's shooting experience.

本申请实施例提供一种保存图像的方法,在用户使用采用不同握持姿势握持电子设备进行水平拍摄时,能够使得手机电子设备自动保存和用户在屏幕的取景器拍摄预览界面中看到的被目标拍摄物方向相一致的照片。An embodiment of the present application provides a method for saving an image, which enables the electronic device of the mobile phone to automatically save the image that the user sees in the viewfinder shooting preview interface of the screen when the user uses different holding postures to hold the electronic device for horizontal shooting. Photos with the same direction as the target.

图3是本申请实施例的提供的一组图形用户界面(graphical user interface,GUI)的示意图。其中,从图3的(a)至(d)示出了用户正向竖屏握持手机水平拍摄的过程,图3中的(e)至(h)示出了用户横向握持手机水平拍摄的过程。FIG. 3 is a schematic diagram of a set of graphical user interfaces (graphical user interface, GUI) provided by an embodiment of the present application. Among them, Fig. 3 (a) to (d) show the process of the user holding the mobile phone horizontally in the vertical screen, and Fig. 3 (e) to (h) show that the user is holding the mobile phone horizontally and shooting horizontally the process of.

参见图3中的(a),该GUI为手机的桌面300。当手机检测到用户点击桌面300上的相机应用的图标301的操作后,可以启动相机,显示如图3中(b)所示的GUI,该GUI可以称为相机界面。Referring to (a) in FIG. 3 , the GUI is the desktop 300 of the mobile phone. When the mobile phone detects that the user clicks the icon 301 of the camera application on the desktop 300, the camera can be activated to display a GUI as shown in (b) in FIG. 3, which can be called a camera interface.

本申请实施例中还可以从其他应用中通过调用相机,来显示如图3中的(b)所示的GUI。In this embodiment of the present application, the camera may be called from other applications to display the GUI shown in (b) of FIG. 3 .

参见图3中的(b),用户竖屏握持手机水平拍摄位于水平面上的被拍摄物304a(例如,该304a以相对于正向方向逆时针旋转90度的方向放置在水平面上),当手机检测到用户点击拍照控件302的操作后,可以显示如图3中的(c)所示的GUI。Referring to (b) in FIG. 3 , the user holds the mobile phone in the vertical screen to shoot the subject 304a on the horizontal plane horizontally (for example, the 304a is placed on the horizontal plane in a direction rotated 90 degrees counterclockwise relative to the forward direction), when After the mobile phone detects that the user clicks on the photographing control 302, the GUI as shown in (c) of FIG. 3 can be displayed.

参见图3中的(c),用户拍摄的照片可以显示在区域303中,当手机检测到用户点击区域303的操作后,可以显示如图3中的(d)所示的GUI,该GUI是拍摄的照片在相册中的保存界面。Referring to (c) in FIG. 3 , the photo taken by the user can be displayed in the area 303. When the mobile phone detects the operation of the user clicking on the area 303, the GUI shown in (d) in FIG. 3 can be displayed. The GUI is The interface for saving the captured photos in the album.

参见图3中的(d),当用户竖直查看该照片304时,该照片304以相对于正向方向逆时针旋转90°的方向保存在相册中,也就是说,被拍摄物304a的照片最终保存的方向 和用户拍摄时在用户手机屏幕上显示的方向一致。Referring to (d) in FIG. 3 , when the user views the photo 304 vertically, the photo 304 is stored in the album in a direction rotated 90° counterclockwise with respect to the forward direction, that is, the photo of the subject 304a The final saved orientation is the same as the orientation displayed on the screen of the user's mobile phone when the user shoots.

图3中的(e),可以参考图3中的(a)的描述,为了简洁,不再赘述。For (e) in FIG. 3 , reference may be made to the description in (a) in FIG. 3 , which will not be repeated for brevity.

参见图3中的(f),当用户以横向握持(例如,手机相对于正向方向逆时针旋转90度)手机水平拍摄位于水平面上的被拍摄物304a时,相机的显示界面中,该被拍摄物304a以相对于正向方向逆时针旋转90°的方向放置在水平面上,当手机检测到用户点击拍摄控件307的操作之后,可以显示如图3中的(g)所示的GUI。Referring to (f) in FIG. 3 , when the user holds the mobile phone horizontally (for example, the mobile phone is rotated 90 degrees counterclockwise with respect to the forward direction), the mobile phone horizontally shoots the subject 304a located on the horizontal plane, in the display interface of the camera, the The object 304a to be photographed is placed on the horizontal plane in a direction rotated 90° counterclockwise relative to the forward direction. When the mobile phone detects that the user clicks the photographing control 307, the GUI shown in (g) of FIG. 3 can be displayed.

参见图3中的(g),用户拍摄的照片可以显示在区域308中,当手机检测到用户点击区域303的操作后,可以显示如图3中的(h)所示的GUI。Referring to (g) in FIG. 3 , the photo taken by the user can be displayed in the area 308 , and when the mobile phone detects the operation of the user clicking on the area 303 , the GUI shown in (h) in FIG. 3 can be displayed.

参见图3中的(h),当用户竖直查看该照片309时,该照片309以横向即以相对于正向方向逆时针旋转90°的方向保存在相册中,也就是说,被拍摄物304a的照片保存的方向和用户拍摄时被拍摄物在手机屏幕上显示的方向一致。Referring to (h) in FIG. 3 , when the user views the photo 309 vertically, the photo 309 is stored in the album in a landscape orientation, that is, in a direction rotated 90° counterclockwise with respect to the forward direction, that is, the object to be photographed. The direction in which the photo in 304a is saved is consistent with the direction in which the object to be photographed is displayed on the screen of the mobile phone when the user takes the photo.

应理解,本申请实施例中仅以用户竖直握持手机和左向横屏(竖直方向逆时针旋转90度)握持手机为例进行说明,但本申请实施例不限于此,实际上,无论用户以何种姿势握持手机进行水平拍摄,最终被拍摄物的照片保存的方向始终和其在手机屏幕上显示的方向相一致,即可以做到所见即所得。It should be understood that, in the embodiments of the present application, only the user holds the mobile phone vertically and the mobile phone is held in the left horizontal landscape (the vertical direction is rotated 90 degrees counterclockwise) as an example for description, but the embodiments of the present application are not limited to this, in fact , no matter what posture the user holds the mobile phone for horizontal shooting, the direction of the final photo of the object to be saved is always consistent with the direction displayed on the mobile phone screen, that is, what you see is what you get.

图4是本申请实施例提供的终端面板所在平面与用户双眼所在平面的法向量之间的关系的示意图。FIG. 4 is a schematic diagram of the relationship between the plane where the terminal panel is located and the normal vector of the plane where the user's eyes are located according to an embodiment of the present application.

如图4所示,用户使用手机进行水平拍摄时,手机中的前置摄像头可以采集用户面部的信息,该前置摄像头可以是三维(3 dimensions,3D)感应摄像头,当用户面部处在前置摄像头视角内时,利用该摄像头可以获取用户面部的3D信息,根据该3D信息可以确定用户两个眼睛所在的第二平面,以及该第二平面的法向量,其中,该第二平面垂直于用户头部的中心线。手机面板所在的平面为第一平面,本申请实施例可以通过该第二平面的法向量和第一平面之间的夹角信息,来确定用户当前使用手机进行水平拍摄的握持姿势,并根据用户的握持姿势旋转照片并保存。As shown in Figure 4, when the user uses the mobile phone to shoot horizontally, the front camera in the mobile phone can collect the information of the user's face. The front camera can be a 3-dimensions (3D) sensing camera. When the user's face is in the front When the camera is within the viewing angle, the camera can be used to obtain 3D information of the user's face, and according to the 3D information, the second plane where the user's two eyes are located and the normal vector of the second plane can be determined, wherein the second plane is perpendicular to the user. The centerline of the head. The plane on which the mobile phone panel is located is the first plane. In this embodiment of the present application, the angle information between the normal vector of the second plane and the first plane can be used to determine the holding posture of the user currently using the mobile phone for horizontal shooting, and according to The user's holding pose rotates the photo and saves it.

当该夹角位于第一阈值范围之内时,则可以认为用户以正向竖屏的姿势握持手机进行水平拍摄,则直接竖直保存该拍摄的照片;当该夹角位于第二阈值范围之内时,则可以认为用户以左向横屏(相对于正向方向逆时针旋转90度)的姿势握持手机进行水平拍摄,则将拍摄的照片逆时针旋转90度保存;当该夹角位于第三阈值范围之内时,则可以认为用户以倒置竖屏(相对于正向方向逆时针旋转180度)的姿势握持手机进行水平屏拍摄,则将拍摄的照片逆时针旋转180度保存;当该夹角位于第四阈值范围之内时,则可以认为用户以右向横屏(相对于正向逆时针旋转270度)的姿势握持手机进行水平屏拍摄,则将拍摄的照片逆时针旋转270度保存。When the included angle is within the first threshold range, it can be considered that the user is holding the mobile phone in a vertical orientation for horizontal shooting, and the photographed photo is directly saved vertically; when the included angle is within the second threshold range When the angle is within, it can be considered that the user holds the mobile phone in a horizontal orientation to the left (rotated 90 degrees counterclockwise with respect to the forward direction) for horizontal shooting, and the captured photo is rotated 90 degrees counterclockwise to save; When it is within the third threshold range, it can be considered that the user holds the mobile phone with the vertical screen upside down (rotated 180 degrees counterclockwise with respect to the positive direction) for horizontal screen shooting, and the captured photo is rotated 180 degrees counterclockwise and saved. ; When the included angle is within the fourth threshold range, it can be considered that the user holds the mobile phone in a horizontal screen (rotated 270 degrees counterclockwise relative to the positive direction) to take a horizontal screen shot, and then the captured photo is reversed Rotate the clock 270 degrees to save.

示例性地,该夹角是第二平面的法向量与第一平面之间的顺时针夹角,该第一阈值范围X1可以为-45°<X1≤45°,该第二阈值范围X2可以为45°<X2≤135°,该第三阈值范围X3可以为135°<X1≤-135°,该第四阈值范围为X4可以为-135°<X1≤-45°。Exemplarily, the included angle is a clockwise included angle between the normal vector of the second plane and the first plane, the first threshold range X1 may be -45°<X1≤45°, and the second threshold range X2 may be 45°<X2≤135°, the third threshold range X3 may be 135°<X1≤-135°, and the fourth threshold range X4 may be -135°<X1≤-45°.

基于本申请实施例,通过该阈值范围可以判断用户握持手机的姿势,手机根据该握持姿势旋转并保存拍摄的照片,使得最终被拍摄物的照片保存的方向始终和其在手机屏幕上显示的方向相一致,即可以做到所见即所得。图5是本申请实施例的一组用户使用手机的握持姿势的示意图。本申请实施例可以通过检测手机边缘的触点或触面信息来判断用户的握持姿势,进而判断用户在水平拍摄时意图保存照片的方向。Based on the embodiments of the present application, the posture of the user holding the mobile phone can be determined through the threshold range, and the mobile phone rotates and saves the photographed photos according to the holding posture, so that the final saved direction of the photograph of the object is always the same as that displayed on the mobile phone screen. direction, that is, what you see is what you get. FIG. 5 is a schematic diagram of a holding posture of a group of users using a mobile phone according to an embodiment of the present application. In the embodiment of the present application, the user's holding posture can be determined by detecting the contact or touch surface information on the edge of the mobile phone, and then the direction in which the user intends to save the photo when shooting horizontally can be determined.

如图5中的(a)所示,用户左手正向竖屏握持手机,则手机左侧面的上方有与用户的左手大拇指接触的接触点,终端左侧面的下方有与用户的手掌接触的接触面,手机右侧面有与用户的手指接触的四个接触点。As shown in (a) of Figure 5, if the user's left hand is holding the mobile phone in the vertical direction, there is a contact point with the user's left thumb above the left side of the mobile phone, and there is a contact point with the user's thumb on the bottom of the left side of the terminal. The contact surface that the palm contacts, there are four contact points on the right side of the phone that are in contact with the user's fingers.

如图5中的(b)所示,用户右手正向握持手机,则手机右侧面的上方有与用户的右手大拇指接触的接触点,终端右侧面的下方有与用户的手掌接触的接触面,手机左侧面有与用户的手指接触的四个接触点。As shown in (b) of FIG. 5 , the user holds the mobile phone with the right hand, and the upper right side of the mobile phone has a contact point that contacts the user's right thumb, and the bottom of the right side of the terminal contacts the user's palm. There are four contact points on the left side of the phone that are in contact with the user's finger.

当用户正向握持手机时,无论用户是左手握持还是右手握持,则手机可以直接竖直保存拍摄的照片,如图5中的(c)所示。When the user is holding the mobile phone forward, no matter whether the user holds the mobile phone with the left hand or the right hand, the mobile phone can directly save the photographed photo vertically, as shown in (c) of FIG. 5 .

如图5中的(d)所示,用户左手左向横屏握持手机,即手机相对于正向逆时针旋转90度,则手机左侧面的顶部有与用户左手大拇指接触的接触面,手机右侧顶点有与用户手指接触的接触点,右侧面的顶部有与用户的手指接触的至少一个接触点。As shown in (d) in Figure 5, if the user holds the mobile phone with the left hand in the horizontal screen, that is, the mobile phone is rotated 90 degrees counterclockwise relative to the positive direction, the top of the left side of the mobile phone has a contact surface that contacts the user's left thumb , the right vertex of the mobile phone has a contact point with the user's finger, and the top of the right side has at least one contact point with the user's finger.

当用户以左向横屏的方式握持手机时,则手机可以将拍摄的照片相对于正向逆时针旋转90度保存,使得用户在竖直查看拍摄的照片222时,该照片222以竖直方向显示在相册中,即该304a保存的方向与其在拍摄时显示在手机屏幕上的方向一致,如图5中的(f)所示。When the user holds the mobile phone in the left-to-landscape manner, the mobile phone can rotate the photographed photo 90 degrees counterclockwise to save it, so that when the user views the photographed photo 222 vertically, the photograph 222 is displayed in a vertical direction. The orientation is displayed in the album, that is, the orientation saved by 304a is consistent with the orientation displayed on the screen of the mobile phone when shooting, as shown in (f) of FIG. 5 .

如图5中的(e)所示,用户右手右向横屏握持手机,即手机相对于正向顺时针旋转90度,则手机右侧面的顶部有与用户右手大拇指接触的接触面,手机左侧顶部顶点有与用户手指接触的接触点,手机左侧面的顶部有与用户手指接触的至少一个接触点。As shown in (e) in Figure 5, the user holds the mobile phone with the right hand facing the horizontal screen, that is, the mobile phone is rotated 90 degrees clockwise relative to the positive direction, then the top of the right side of the mobile phone has a contact surface that contacts the user's right thumb , the top vertex of the left side of the mobile phone has a contact point with the user's finger, and the top of the left side of the mobile phone has at least one contact point with the user's finger.

当用户以右向横屏的方式握持手机时,当用户以左向横屏的方式握持手机时,则手机可以将拍摄的照片相对于正向顺时针旋转90度保存,使得用户在竖直查看拍摄的照片222时,该照片222以竖直方向显示在相册中,即该304a保存的方向与其在拍摄时显示在手机屏幕上的方向一致,如图5中的(f)所示。When the user holds the mobile phone in the right-to-landscape way, when the user holds the mobile phone in the left-to-landscape way, the mobile phone can rotate the photos taken 90 degrees clockwise relative to the positive direction to save, so that the user is in the vertical direction. When looking directly at the photographed photo 222, the photo 222 is displayed in the album in a vertical direction, that is, the direction saved by 304a is the same as the direction displayed on the screen of the mobile phone when photographed, as shown in (f) of FIG. 5 .

可以理解的是,上述用户的握持姿势与用户使用手机的习惯相关,每个用户的握持姿势会有不同,即每个用户在上述握持姿势下和手机的触摸信息可能不同。It can be understood that the above-mentioned holding posture of the user is related to the user's habit of using a mobile phone, and each user's holding posture may be different, that is, each user may have different touch information from the mobile phone in the above-mentioned holding posture.

参见图5中的(g),用户左手倒置竖直握持手机,即手机相对于正向逆时针旋转180度,则手机右侧顶部有与用户手掌接触的接触面、手机右侧底部有与用户手指接触的接触点、手机左侧面有与用户手指接触的四个接触点。Referring to (g) in Figure 5, the user holds the mobile phone upside down with the left hand, that is, the mobile phone is rotated 180 degrees counterclockwise relative to the positive direction, then the top right side of the mobile phone has a contact surface that contacts the user's palm, and the bottom right side of the mobile phone has a contact surface with the user's palm. There are four contact points on the left side of the mobile phone that are in contact with the user's finger.

参见图5中的(h),用户右手倒置竖直握持手机,则手机左侧顶部有与用户手掌接触的接触面、手机左侧底部有与用户手指接触的接触点、手机右侧面有与用户手指接触的四个接触点。Referring to (h) in Figure 5, the user holds the mobile phone upside down with the right hand, then the top left side of the mobile phone has a contact surface that contacts the user's palm, the bottom left side of the mobile phone has a contact point that contacts the user's fingers, and the right side of the mobile phone has a contact surface. Four points of contact with the user's finger.

当用户倒置竖直握持手机时,无论用户是左手握持还是右手握持,手机可以将拍摄的照片相对于正向顺时针或逆时针旋转180度保存,使得用户在竖直查看拍摄的照片223时,该照片223以竖直方向显示在相册中,即该304a保存的方向与其在拍摄时显示在手机屏幕上的方向一致,如图5中的(I)所示。When the user holds the phone upside down, no matter whether the user holds the phone with the left hand or the right hand, the phone can save the photos taken clockwise or counterclockwise by 180 degrees, so that the user can view the photos in the vertical direction. 223, the photo 223 is displayed in the album in a vertical direction, that is, the direction saved in 304a is consistent with the direction displayed on the screen of the mobile phone when shooting, as shown in (I) in FIG. 5 .

应理解,本申请实施例中的手机可以是具有瀑布屏或者是曲面屏的手机,对于不具有瀑布屏或者是曲面屏的手机,可以在手机的侧面设置额外的传感器来感知手机和用户的接触信息。It should be understood that the mobile phone in the embodiment of the present application may be a mobile phone with a waterfall screen or a curved screen. For a mobile phone without a waterfall screen or a curved screen, an additional sensor may be provided on the side of the mobile phone to sense the contact between the mobile phone and the user. information.

基于本申请实施例,通过检测手机边缘的触点或触面信息来判断用户的握持姿势手机根据该握持姿势旋转并保存拍摄的照片,使得最终被拍摄物的照片保存的方向始终和其在手机屏幕上显示的方向相一致,即可以做到所见即所得。Based on the embodiments of the present application, the user's holding posture is determined by detecting the contact points or touch surface information on the edge of the mobile phone. The direction displayed on the mobile phone screen is consistent, that is, what you see is what you get.

图6是本申请实施例提供的另一组GUI的示意图。其中,从图6的(a)至(d)示出了用户竖直握持手机水平拍摄的过程。FIG. 6 is a schematic diagram of another group of GUIs provided by an embodiment of the present application. Wherein, from (a) to (d) of FIG. 6 shows the process of the user holding the mobile phone vertically and shooting horizontally.

参见图6中的(a),该GUI为手机的桌面300。当手机检测到用户点击桌面300上的相机应用的图标301的操作后,可以启动相机,显示如图3中(b)所示的GUI,该GUI可以称为相机界面。Referring to (a) in FIG. 6 , the GUI is the desktop 300 of the mobile phone. When the mobile phone detects that the user clicks the icon 301 of the camera application on the desktop 300, the camera can be activated to display a GUI as shown in (b) in FIG. 3, which can be called a camera interface.

参见图6中的(b),当用户水平拍摄位于水平面上的被拍摄物304a时,可以看到,在相机的显示界面中,该被拍摄物304a以相对于正向方向顺时针旋转90°的方向放置在水平面上,当手机检测到用户点击拍摄控件302的操作之后,可以显示如图6中的(c)所示的GUI。Referring to (b) in FIG. 6 , when the user horizontally shoots the subject 304a on the horizontal plane, it can be seen that in the display interface of the camera, the subject 304a is rotated 90° clockwise relative to the forward direction The direction of the camera is placed on a horizontal plane, and when the mobile phone detects that the user clicks on the shooting control 302, the GUI as shown in (c) in FIG. 6 can be displayed.

参见图6中的(c),用户拍摄的图片可以显示在区域303中,当手机检测到用户点击区域303的操作后,可以显示如图6中的(d)所示的GUI。Referring to (c) in FIG. 6 , the picture taken by the user can be displayed in the area 303 , and when the mobile phone detects the operation of the user clicking on the area 303 , the GUI shown in (d) in FIG. 6 can be displayed.

参见图6中的(d),该GUI为用户拍摄的照片保存在相册中的界面,可以看到,当用户正向竖屏(竖直)查看照片时,该照片304以正向的方式保存在相册中。Referring to (d) in FIG. 6 , the GUI is an interface for saving the photo taken by the user in the album. It can be seen that when the user is viewing the photo in the vertical screen (vertical), the photo 304 is saved in a positive way in the album.

图7是本申请实施例提供的另一组GUI的示意图。其中,从图7的(a)至(d)示出了用户横向握持手机水平拍摄的过程。FIG. 7 is a schematic diagram of another group of GUIs provided by an embodiment of the present application. Wherein, from (a) to (d) of FIG. 7 shows the process of the user holding the mobile phone horizontally and shooting horizontally.

图7中的(a),可以参考图6中的(a)的描述,为了简洁,不再赘述。For (a) in FIG. 7 , reference may be made to the description of (a) in FIG. 6 , which will not be repeated for brevity.

参见图7中的(b),当用户以横向握持(例如,手机相对于正向方向逆时针旋转90度)手机水平拍摄位于水平面上的被拍摄物304a时,相机的显示界面中,该被拍摄物304a以相对于正向方向顺时针旋转90°的方向放置在水平面上,当手机检测到用户点击拍摄控件302的操作之后,可以显示如图7中的(c)所示的GUI。Referring to (b) of FIG. 7 , when the user holds the mobile phone horizontally (for example, the mobile phone is rotated 90 degrees counterclockwise with respect to the forward direction), the mobile phone horizontally shoots the subject 304a located on the horizontal plane, in the display interface of the camera, the The object 304a to be photographed is placed on a horizontal plane rotated 90° clockwise relative to the forward direction. When the mobile phone detects that the user clicks the photographing control 302, the GUI shown in (c) of FIG. 7 can be displayed.

参见图7中的(c),用户拍摄的图片可以显示在区域303中,当手机检测到用户点击区域303的操作后,可以显示如图7中的(d)所示的GUI。Referring to (c) in FIG. 7 , the picture taken by the user can be displayed in the area 303 , and when the mobile phone detects the operation of the user clicking on the area 303 , the GUI shown in (d) in FIG. 7 can be displayed.

参见图7中的(d),当用户竖直查看照片时,照片304以正向保存在相册中。Referring to (d) in FIG. 7 , when the user views the photo vertically, the photo 304 is saved in the album in the forward direction.

上文结合图6和图7描述了本申请实施例中的两种保存图像的方式,应理解,本申请实施例中仅是以上述两种方式作为示例,实际上,当用户使用手机水平拍摄时,无论用户以何种姿势握持(例如,横向握持或竖直握持或者以其他角度握持)手机,被拍摄物体无论以何种方向放置在水平面上(例如,正向放置、旋转90、180度放置,或其他角度放置),手机始终以正向方向保存该拍摄的照片,即始终以最适合用户阅读的方向保存该照片。Two ways of saving images in the embodiments of the present application are described above with reference to FIG. 6 and FIG. 7 . It should be understood that the embodiments of the present application only use the above two ways as examples. In fact, when the user uses a mobile phone to shoot horizontally When the user holds the phone in any position (for example, horizontally or vertically or at other angles), the object to be photographed is placed on a horizontal plane in any direction (for example, forward, rotated 90, 180 degrees, or other angles), the phone always saves the photo in the forward direction, that is, always saves the photo in the direction that is most suitable for the user to read.

基于本申请实施例,当用户使用手机水平拍摄时,手机将拍摄的照片自动保存成最适合用户阅读的方向,从而避免了手机错误保存照片方向,且无需用户手动调节,提升了用户体验。Based on the embodiments of the present application, when the user uses the mobile phone to shoot horizontally, the mobile phone automatically saves the photographed photo in the direction most suitable for the user to read, thereby avoiding the mobile phone from saving the photo direction by mistake, and does not require the user to manually adjust, thereby improving the user experience.

图8是本申请实施例的一种保存图像的方法的示例性流程图。如图8所示,该方法可以包括步骤301至步骤305。FIG. 8 is an exemplary flowchart of a method for saving an image according to an embodiment of the present application. As shown in FIG. 8 , the method may include steps 301 to 305 .

301,用户启动相机,打开后置摄像头。301, the user starts the camera and turns on the rear camera.

302,将拍摄的照片输入图像旋转方向识别模型中。302. Input the photographed photo into the image rotation direction recognition model.

可选地,手机在判断手机面板与水平面之间的夹角满足预设值时,将拍摄的照片输入图像旋转方向识别模型中。该手机面板所在的平面平行于手机的上表面所在的平面。Optionally, when the mobile phone determines that the angle between the mobile phone panel and the horizontal plane satisfies a preset value, the mobile phone inputs the photographed photo into the image rotation direction recognition model. The plane on which the panel of the mobile phone is located is parallel to the plane on which the upper surface of the mobile phone is located.

其中,手机中的重力传感器可以获取手机面板的X轴(例如,手机底部方向)和Y轴(例如,手机侧面方向)向上的重力加速度值,该X轴和Y轴组成的平面为该手机面板所在的平面。若X轴向上的重力加速度值小于第一预设加速度值,且Y轴向上的重力 加速度值小于第二预设加速度值,则可以判断手机面板所在平面偏离水平面的角度在预设范围之内,即手机面板所在平面与水平面接近平行。此时,可以判断到用户正在使用手机进行水平拍摄。The gravity sensor in the mobile phone can obtain the upward gravitational acceleration value of the X axis (for example, the bottom direction of the mobile phone) and the Y axis (for example, the side direction of the mobile phone) of the mobile phone panel, and the plane formed by the X axis and the Y axis is the mobile phone panel. the plane on which it is located. If the gravitational acceleration value on the X-axis is less than the first preset acceleration value, and the gravitational acceleration value on the Y-axis is less than the second preset acceleration value, it can be determined that the angle of the plane where the phone panel is located deviates from the horizontal plane is within the preset range Inside, that is, the plane where the mobile phone panel is located is nearly parallel to the horizontal plane. At this time, it can be determined that the user is using the mobile phone to shoot horizontally.

在用户水平拍摄时,可能会出现拍摄的照片以错误的方向保存的情形,此时,将用户拍摄的照片输入到预先训练好的图像旋转方向识别模型中,该图像旋转方向识别模型可以输出多个结果,例如,正向照片,顺时针旋转90度,顺时针旋转180度,顺时针旋转270度等。When the user shoots horizontally, the photos taken may be saved in the wrong direction. At this time, the photos taken by the user are input into the pre-trained image rotation direction recognition model. The image rotation direction recognition model can output multiple A result, for example, forward photo, rotate 90 degrees clockwise, rotate 180 degrees clockwise, rotate 270 degrees clockwise, etc.

该图像旋转方向识别模型的训练方法如下:The training method of the image rotation direction recognition model is as follows:

(1)、获取带有标记的训练数据集。(1) Obtain a labeled training data set.

示例性的,可以获取大量的正向(旋转角度为0)样本照片,并对该样本照片分别顺时针旋转90度、180度、270度并保存,得到四个方向的照片。Exemplarily, a large number of forward (rotation angle is 0) sample photos can be obtained, and the sample photos can be rotated clockwise by 90 degrees, 180 degrees, and 270 degrees respectively, and saved, to obtain photos in four directions.

示例性的,可以获取大量的正向(旋转角度为0)样本照片,并对该样本照片分别顺时针旋转45度、90度、135度、180度、225度、270度、315度并保存,得到八个方向的照片。Exemplarily, a large number of sample photos in the forward direction (rotation angle is 0) can be obtained, and the sample photos can be rotated clockwise by 45 degrees, 90 degrees, 135 degrees, 180 degrees, 225 degrees, 270 degrees, and 315 degrees respectively and saved. , to get photos in eight directions.

应理解,本申请实施例中还可以保存更多方向的样本照片,该样本照片也可以是逆时针旋转并保存,本申请实施例不做具体限定。It should be understood that in the embodiment of the present application, sample photos in more directions may also be stored, and the sample photos may also be rotated counterclockwise and stored, which is not specifically limited in the embodiment of the present application.

将每个样本照片及其旋转后保存的多个方向的照片组成样本训练数据集,得到多个训练集;Each sample photo and the photos in multiple directions saved after rotation form a sample training data set to obtain multiple training sets;

对该每个训练集中的不同方向的照片进行数据标记,得到标记后的各个训练集。例如,每个训练集中包括上述四个不同方向的样本照片,则将每个训练集中的正向照片标记为“0”,将顺时针旋转90度的照片标记为“1”,将顺时针旋转180度的照片标记为“2”,将顺时针旋转90度的照片标记为“3”,得到带有标记的训练数据集。The photos in different directions in each training set are marked with data to obtain each marked training set. For example, if each training set includes the above four sample photos in different directions, the forward photos in each training set are marked as "0", the photos rotated 90 degrees clockwise are marked as "1", and the clockwise photos are marked as "1". 180-degree photos are marked as "2", and photos rotated 90 degrees clockwise are marked as "3", resulting in a labeled training dataset.

(2)、将标记后的训练数据集输入神经网络模型中进行训练。(2) Input the labeled training data set into the neural network model for training.

应理解,该神经网络模型可以卷积神经网络(convolutional neural network,CNN)、深度置信网络(deep belief network,DBN)、循环神经网络(recurrent neural network,RNN)、生成对抗网络(generative adversarial networks,GAN)等,本申请实施例对此不做具体限定。It should be understood that the neural network model can be a convolutional neural network (CNN), a deep belief network (DBN), a recurrent neural network (RNN), a generative adversarial network, GAN), etc., which are not specifically limited in the embodiments of the present application.

例如,该神经网络模型为CNN,则可以将步骤(1)中的带有标记的训练数据集输入至该CNN模型中进行训练。For example, if the neural network model is a CNN, the labeled training data set in step (1) can be input into the CNN model for training.

(3)、得到图像旋转方向识别模型。(3), obtain the image rotation direction recognition model.

其中,步骤(2)中该CNN模型的损失函数降至最低并保持平稳时,可以得到该训练好的CNN图像旋转方向识别模型。Wherein, in step (2), when the loss function of the CNN model is minimized and kept stable, the trained CNN image rotation direction recognition model can be obtained.

303,根据该图像旋转方向识别模型的输出结果,旋转图片并保存。303. According to the output result of the image rotation direction recognition model, rotate the picture and save it.

例如,该图像旋转方向识别模型的训练数据集包括四个不同方向的样本照片,则该图像旋转方向识别模型可以输出四个结果,根据该模型的输出结果,可以判断当前拍摄的照片相对于正向照片的顺时针旋转角度,然后将该当前拍摄的照片以相同的角度逆时针旋转后保存,或者,将该当前拍摄的照片顺指针旋转一定的角度至正向。For example, if the training data set of the image rotation direction recognition model includes four sample photos in different directions, the image rotation direction recognition model can output four results. Rotate the clockwise angle of the photo, and then rotate the currently shot photo counterclockwise at the same angle and save it, or rotate the currently shot photo clockwise by a certain angle to the positive direction.

示例性的,如图7所示,该图像旋转方向识别模型的输出结果显示当前照片相对于正向照片的顺时针旋转角度为90度,则将该当前拍摄的照片逆时针旋转90度后保存在相册中。Exemplarily, as shown in FIG. 7 , the output result of the image rotation direction recognition model shows that the clockwise rotation angle of the current photo relative to the forward photo is 90 degrees, then the currently captured photo is rotated 90 degrees counterclockwise and saved. in the album.

示例性的,该图像旋转方向识别模型的输出结果显示当前照片相对于正向照片的顺时针旋转角度为90度,则将该当前拍摄的照片顺时针旋转270度后保存在相册中。Exemplarily, if the output result of the image rotation direction recognition model shows that the clockwise rotation angle of the current photo relative to the forward photo is 90 degrees, the currently captured photo is rotated 270 degrees clockwise and saved in the album.

可选地,可以将当前拍摄的照片分别顺时针旋转90度,180度,270度之后输入至常规的CNN目标识别模型中,得到四个置信度结果,保存置信度值最大的照片。Optionally, the currently taken photos can be rotated 90 degrees, 180 degrees, and 270 degrees clockwise respectively and then input into the conventional CNN target recognition model to obtain four confidence results, and save the photo with the highest confidence value.

本申请实施例中,可以在用户使用终端水平拍摄时,智能识别最适合用户查阅的照片方向,并将用户水平拍摄的图像保存成适合用户查阅的方向即正向保存照片,从而避免了用户由于手持终端设备水平拍摄时,照片方向保存错误的现象,进而提升了用户的拍摄体验。In this embodiment of the present application, when the user uses the terminal to shoot horizontally, the direction of the photo that is most suitable for the user can be intelligently identified, and the image taken horizontally by the user can be saved in a direction suitable for the user to refer to, that is, the photo is saved in the forward direction, thereby preventing the user from When the handheld terminal device is taken horizontally, the wrong orientation of the photo is saved, which improves the user's shooting experience.

在一些情况下,用户本身就是想保存一张横向的照片,而上述技术方案会自动旋转该横向的照片,将该照片保存成正向,这违背了用户的本意。In some cases, the user himself wants to save a horizontal photo, and the above technical solution will automatically rotate the horizontal photo to save the photo in a positive direction, which goes against the user's original intention.

针对这种情况,本申请提供了另一种保存图像的方法,可以使得终端保存照片的方向与用户在终端的屏幕的取景器中看见的图像的方向相一致。In response to this situation, the present application provides another method for saving an image, which can make the direction in which the terminal saves the photo consistent with the direction of the image that the user sees in the viewfinder of the screen of the terminal.

图9是本申请实施例的一种保存图像的方法的示意性流程图。如图9所示,该方法可以包括步骤401至步骤405。FIG. 9 is a schematic flowchart of a method for saving an image according to an embodiment of the present application. As shown in FIG. 9 , the method may include steps 401 to 405 .

401,用户启动相机,打开后置摄像头。401, the user starts the camera and turns on the rear camera.

402,启动前置摄像头,获取第一图像。402. Start the front camera to acquire a first image.

可选地,手机在判断手机面板与水平面的夹角满足预设值时,启动前置摄像头,获取第一图像。Optionally, when the mobile phone determines that the angle between the mobile phone panel and the horizontal plane satisfies a preset value, the mobile phone activates the front camera to acquire the first image.

应理解,该步骤中判断手机面板与水平面的夹角满足预设值的方式可以参考步骤302中的相关描述,不再赘述。It should be understood that, in this step, the method of judging that the angle between the mobile phone panel and the horizontal plane satisfies the preset value may refer to the relevant description in step 302, and will not be repeated here.

该第一图像为前置摄像头视角内获取的图像,例如,如图4所示,该前置摄像头可以是三维3D感应摄像头,当用户脸部在前置摄像头视角内时,利用该摄像头可以获取用户脸部的3D信息,根据该3D信息可以确定用户两个眼睛所在的第二平面,以及该第二平面的法向量,其中,该第二平面垂直与用户头部的中心线。The first image is an image obtained from the perspective of the front camera. For example, as shown in FIG. 4 , the front camera may be a three-dimensional 3D sensing camera. When the user's face is within the perspective of the front camera, the camera can be used to obtain the image. The 3D information of the user's face, according to which the second plane on which the user's two eyes are located and the normal vector of the second plane can be determined, wherein the second plane is perpendicular to the center line of the user's head.

403,计算用户双眼所在的第二平面的法向量与手机面板所在第一平面之间的夹角。403. Calculate the angle between the normal vector of the second plane where the user's eyes are located and the first plane where the mobile phone panel is located.

其中,该夹角可以是第二平面的法向量与第一平面之间的顺时针夹角,也可是逆时针夹角。The included angle may be a clockwise included angle between the normal vector of the second plane and the first plane, or a counterclockwise included angle.

404,根据夹角判断用户的握持姿势。404. Determine the holding posture of the user according to the included angle.

当该夹角位于第一阈值范围之内时,则可以认为用户以正向竖屏的姿势握持手机进行水平拍摄;当该夹角位于第二阈值范围之内时,则可以认为用户以左向横屏(相对于正向方向逆时针旋转90度)的姿势握持手机进行水平拍摄;当该夹角位于第三阈值范围之内时,则可以认为用户以倒置竖屏(相对于正向方向逆时针旋转180度)的姿势握持手机进行水平屏拍摄;当该夹角位于第四阈值范围之内时,则可以认为用户以右向横屏(相对于正向逆时针旋转270度)的姿势握持手机进行水平屏拍摄。When the included angle is within the first threshold range, it can be considered that the user is holding the mobile phone in a vertical orientation for horizontal shooting; when the included angle is within the second threshold range, it can be considered that the user is taking the left Hold the mobile phone in a horizontal orientation (rotate 90 degrees counterclockwise relative to the forward direction) for horizontal shooting; when the included angle is within the third threshold range, it can be considered that the user is in an upside-down portrait orientation (relative to the forward orientation). When the angle is within the fourth threshold range, it can be considered that the user is facing the right horizontal screen (rotated 270 degrees counterclockwise relative to the positive direction) The posture of holding the mobile phone for horizontal screen shooting.

示例性地,该夹角是第二平面的法向量与第一平面之间的顺时针夹角,该第一阈值范围X1为-45°<X1≤45°,该第二阈值范围X2为45°<X2≤135°,该第三阈值范围X3为135°<X1≤-135°,该第四阈值范围为X4为-135°<X1≤-45°。Exemplarily, the included angle is a clockwise included angle between the normal vector of the second plane and the first plane, the first threshold range X1 is -45°<X1≤45°, and the second threshold range X2 is 45° °<X2≤135°, the third threshold range X3 is 135°<X1≤-135°, and the fourth threshold range X4 is -135°<X1≤-45°.

示例性地,该夹角是第二平面的法向量与第一平面之间的顺时针夹角,该第一阈值范围X1为0°≤X1<45°,该第二阈值范围X2为45°≤X1<90°,该第三阈值范围X3为90°≤X1<135°,该第四阈值范围X4为135°≤X1<180°。Exemplarily, the included angle is a clockwise included angle between the normal vector of the second plane and the first plane, the first threshold range X1 is 0°≤X1<45°, and the second threshold range X2 is 45° ≤X1<90°, the third threshold range X3 is 90°≤X1<135°, and the fourth threshold range X4 is 135°≤X1<180°.

405,根据用户的握持姿势,旋转图片并保存。405. According to the holding posture of the user, rotate the picture and save it.

示例性地,若手机判断用户以正向竖屏的姿势握持手机,则正向保存拍摄的照片;若判断用户以左向横屏的姿势握持手机,如图3所示,则将拍摄的照片以相对于正向方向逆时针旋转90度或顺时针旋转270度保存;若判断用户以倒置竖屏的姿势握持手机,则将拍摄的照片以相对于正向方向逆时针或顺时针旋转180度保存;若判断用户以右向横屏的姿势握持手机,则将将拍摄的照片以相对于正向方向逆时针旋转270度或顺指针旋转90度保存,使得用户在竖直查看拍摄的照片时,最终保存的照片的方向和用户在手机屏幕的取景器中看到的图像的方向相一致。Exemplarily, if the mobile phone determines that the user is holding the mobile phone in a vertical orientation, the photographed photo will be saved; The photos are saved by rotating 90 degrees counterclockwise or 270 degrees clockwise relative to the forward direction; if it is judged that the user is holding the phone in an upside-down portrait orientation, the photos will be taken counterclockwise or clockwise relative to the forward direction. Rotate 180 degrees to save; if it is judged that the user is holding the phone in the right landscape orientation, the captured photo will be rotated 270 degrees counterclockwise or 90 degrees clockwise relative to the forward direction, so that the user can view it vertically. When taking a photo, the orientation of the final saved photo is the same as the orientation of the image that the user sees in the viewfinder of the phone screen.

本申请实施例中,根据手机的前置摄像头获取用户眼睛所在的第二平面的法向量与手机面板所在的第一平面的夹角,可以获取用户当前的握持姿势,根据该握持姿势对拍摄的照片进行旋转并保存,该技术方案可以使得用户所见即所得,即当用户竖直查看拍摄的照片时,该照片的方向与用户在手机屏幕的拍摄预览界面中看到的图像的方向相一致。In this embodiment of the present application, the angle between the normal vector of the second plane where the user's eyes are located and the first plane where the panel of the mobile phone is located can be obtained according to the front camera of the mobile phone, and the current holding posture of the user can be obtained. The captured photo is rotated and saved, and the technical solution can make what the user sees is what you get, that is, when the user vertically views the captured photo, the direction of the photo is the same as the direction of the image that the user sees in the shooting preview interface of the mobile phone screen consistent.

图10是本申请实施例的另一种保存图像的方法的示例性流程图。如图10所示,该方法可以包括步骤501至步骤504。FIG. 10 is an exemplary flowchart of another method for saving an image according to an embodiment of the present application. As shown in FIG. 10 , the method may include steps 501 to 504 .

501,用户启动相机,打开后置摄像头。501, the user starts the camera, and turns on the rear camera.

502,获取手机的触摸信息。502: Acquire touch information of the mobile phone.

可选地,手机在判断手机面板所在平面与水平面的夹角满足预设值时,获取手机的触摸信息。Optionally, the mobile phone acquires the touch information of the mobile phone when judging that the angle between the plane where the mobile phone panel is located and the horizontal plane satisfies a preset value.

应理解,该步骤中判断手机面板与水平面的夹角满足预设值的方式可以参考步骤302中的相关描述,不再赘述。It should be understood that, in this step, the method of judging that the angle between the mobile phone panel and the horizontal plane satisfies the preset value may refer to the relevant description in step 302, and will not be repeated here.

其中,该触摸信息可以是用户握持手机时手指或手掌与手机侧面的触摸信息,例如,可以是触摸点或触摸面等。The touch information may be the touch information of the user's finger or palm and the side of the mobile phone when the user holds the mobile phone, for example, it may be a touch point or a touch surface.

在一个示例中,手机具有曲面屏或者瀑布屏,当用户握持手机进行水平拍摄时,手机侧面与用户的触摸信息会被记录下来。In one example, the mobile phone has a curved screen or a waterfall screen. When the user holds the mobile phone for horizontal shooting, the touch information between the side of the mobile phone and the user will be recorded.

在另一个示例中,当手机不具有曲面屏或者瀑布屏时,可以在手机的侧面安装接触传感器,来记录手机侧面与用户的触摸信息。In another example, when the mobile phone does not have a curved screen or a waterfall screen, a touch sensor may be installed on the side of the mobile phone to record touch information between the side of the mobile phone and the user.

如上文的图5中(a)、(b)、(d)、(e)、(g)、(h)所示,当用户采用不同的姿势握持手机时,用户的手指或手掌与手机的接触点或接触面是不同的,因此,可以根据手机侧面感应到的触摸信息来判断用户的握持姿势。As shown in (a), (b), (d), (e), (g), and (h) in Figure 5 above, when the user holds the mobile phone in different postures, the user's fingers or palms are in contact with the mobile phone. The contact points or contact surfaces of the mobile phone are different, so the user's holding posture can be judged according to the touch information sensed on the side of the mobile phone.

应理解,针对不同的用户,其握持手机的姿势也不尽相同,相应的,该触摸信息与用户的握持姿势的对应关系也有会所变化。It should be understood that different users have different postures for holding the mobile phone, and correspondingly, the corresponding relationship between the touch information and the user's holding posture also varies.

表1是某个用户在正常拍摄时握持姿势与触摸信息的对应关系。Table 1 shows the correspondence between a user's holding posture and touch information during normal shooting.

Figure PCTCN2021130540-appb-000001
Figure PCTCN2021130540-appb-000001

Figure PCTCN2021130540-appb-000002
Figure PCTCN2021130540-appb-000002

在用户正常使用手机时,记录用户的握持姿势和触摸信息的对应关系,并可以对该触摸信息和握持姿势的对应关系进行识别模型训练,可以采用上述的CNN、DBN、RNN、GAN等网络模型。When the user uses the mobile phone normally, the corresponding relationship between the user's holding posture and the touch information is recorded, and the recognition model can be trained for the corresponding relationship between the touch information and the holding posture. The above-mentioned CNN, DBN, RNN, GAN, etc. can be used. network model.

503,根据触摸信息,判断用户握持手机的姿势。503. Determine the posture of the user holding the mobile phone according to the touch information.

其中,当用户采用水平拍摄时,采集手机的触摸信息,输入至上述训练好的对应关系识别模型中,即可以得到用户的握持姿势。Wherein, when the user adopts horizontal shooting, the touch information of the mobile phone is collected and input into the above-mentioned trained correspondence recognition model, that is, the holding posture of the user can be obtained.

504,根据用户握持手机的姿势,旋转照片并保存。504. According to the posture of the user holding the mobile phone, rotate the photo and save it.

示例性地,若判断用户以正向竖屏的姿势握持手机,则正向保存拍摄的照片;若判断用户以左向横屏的姿势握持手机,如图5所示,则将拍摄的照片以相对于正向方向逆时针旋转90度或顺时针旋转270度保存;若判断用户以倒置竖屏的姿势握持手机,则将拍摄的照片以相对于正向方向逆时针或顺时针旋转180度保存;若判断用户以右向横屏的姿势握持手机,则将将拍摄的照片以相对于正向方向逆时针旋转270度或顺指针旋转90度保存。Exemplarily, if it is judged that the user is holding the mobile phone in a vertical orientation, the photographed photo will be saved; The photos are saved by rotating 90 degrees counterclockwise or 270 degrees clockwise relative to the forward direction; if it is judged that the user is holding the phone in an upside-down portrait orientation, the photos taken are rotated counterclockwise or clockwise relative to the forward direction. Save 180 degrees; if it is judged that the user is holding the phone in the right-facing landscape orientation, the captured photos will be saved by rotating 270 degrees counterclockwise or 90 degrees clockwise with respect to the forward direction.

在一些情况下,用户可能会临时改变握持的姿势,所以可能会导致模型的输出结果出错,这种情况下,用户可能会在相册中手动旋转该照片至正确的方向。此时手机可以记录该错误的结果和拍摄时采集的触摸信息,并反馈给握持姿势与触摸信息对应关系识别模型,达到更新该识别模型的目的,因此,该模型可以不断学习用户的使用习惯,使得该识别模型越来越准确。In some cases, the user may temporarily change the holding position, which may cause the output of the model to be wrong, in which case the user may manually rotate the photo in the album to the correct orientation. At this time, the mobile phone can record the result of the error and the touch information collected during shooting, and feed it back to the recognition model of the correspondence between the holding posture and the touch information, so as to achieve the purpose of updating the recognition model. Therefore, the model can continuously learn the user's usage habits. , making the recognition model more and more accurate.

基于该技术方案,通过手机感应到的触摸信息,可以判断用户使用手机进行水平拍摄的握持姿势,根据该握持姿势对拍摄的照片进行旋转并保存,该技术方案可以使得用户在水平拍摄时所见即所得,即竖直查看拍摄的照片时,该照片的方向与用户在手机屏幕的拍摄预览界面中看到的图像的方向相一致。Based on the technical solution, through the touch information sensed by the mobile phone, it is possible to determine the holding posture of the user for horizontal shooting with the mobile phone, and rotate and save the photographed photos according to the holding posture. This technical solution enables the user to shoot horizontally. What you see is what you get, that is, when viewing a photographed photo vertically, the direction of the photo is consistent with the direction of the image that the user sees in the photographing preview interface of the mobile phone screen.

图11是本申请实施例的另一种保存图像的方法的示意性流程图。如图11所示,该方法可以包括步骤601至步骤608。FIG. 11 is a schematic flowchart of another method for saving an image according to an embodiment of the present application. As shown in FIG. 11 , the method may include steps 601 to 608 .

601,用户启动相机,打开后置摄像头。601, the user starts the camera, and turns on the rear camera.

602,启动前置摄像头,获取第一图像。602. Start the front camera to acquire a first image.

可选地,手机在判断其面板与水平面之间的夹角满足预设值时,启动前置摄像头,获取第一图像。Optionally, when judging that the angle between the panel and the horizontal plane meets a preset value, the mobile phone activates the front camera to acquire the first image.

应理解,上述步骤601和602可以参考步骤401至402的相关描述,为了简洁,不再赘述。It should be understood that for the above steps 601 and 602, reference may be made to the relevant descriptions of steps 401 to 402, which will not be repeated for brevity.

603,当第一图像中包含用户眼睛时,计算用户双眼所在的第二平面的法向量与第一平面之间的夹角。603. When the user's eyes are included in the first image, calculate the angle between the normal vector of the second plane where the user's eyes are located and the first plane.

604,根据该夹角判断用户的握持姿势。604. Determine the holding posture of the user according to the included angle.

605,根据用户的握持姿势,旋转图片并保存。605. According to the holding posture of the user, rotate the picture and save it.

应理解,上述步骤603至步骤605可以参考步骤403至步骤405中的描述,为了简洁,不再赘述。It should be understood that, for the above steps 603 to 605, reference may be made to the descriptions in steps 403 to 405, which will not be repeated for brevity.

606,当第一图像中不包含用户眼睛时,获取手机的触摸信息。606. Obtain touch information of the mobile phone when the user's eyes are not included in the first image.

此时,用户的脸部并不在手机前置摄像头的视角之内。At this time, the user's face is not within the viewing angle of the front camera of the mobile phone.

607,根据触摸信息,判断用户握持手机的姿势。607. Determine the posture of the user holding the mobile phone according to the touch information.

608,根据用户握持手机的姿势,旋转照片并保存。608. According to the posture of the user holding the mobile phone, rotate the photo and save it.

应理解,上述步骤606至608可以参考步骤502至504,为了简洁,不再赘述。It should be understood that the above steps 606 to 608 may refer to steps 502 to 504, which are not repeated for brevity.

基于该技术方案,当用户使用手机水平拍摄时,若前置摄像头能够捕捉到用户的眼睛,则根据用户眼睛所在平面的法向量与手机面板所在平面的夹角关系判断用户的握持姿势,若前置摄像头未捕捉到用户的眼睛,此时可以根据手机感应到的触摸信息判断用户的握持姿势,并根据用户的握持姿势,旋转拍摄的照片并保存。该技术方案可以使得用户在水平拍摄时所见即所得,即竖直查看拍摄的照片时,该照片的方向与用户在手机屏幕的拍摄预览界面中看到的图像的方向相一致。Based on this technical solution, when the user uses the mobile phone to shoot horizontally, if the front camera can capture the user's eyes, the user's holding posture is determined according to the angle between the normal vector of the plane where the user's eyes are located and the plane where the phone panel is located. The front camera does not capture the user's eyes. At this time, the user's holding posture can be determined according to the touch information sensed by the mobile phone, and the captured photo can be rotated and saved according to the user's holding posture. The technical solution can make what the user see is what you get when shooting horizontally, that is, when viewing the shot vertically, the orientation of the photo is consistent with the orientation of the image the user sees in the shooting preview interface of the mobile phone screen.

图12是本申请实施例提供的一种保存图像的方法的示意性流程图。如图12所示,该方法应用于电子设备,该方法可以包括步骤701至步骤705。FIG. 12 is a schematic flowchart of a method for saving an image provided by an embodiment of the present application. As shown in FIG. 12 , the method is applied to an electronic device, and the method may include steps 701 to 705 .

701,电子设备响应于用户的第一操作,显示第一界面,该第一界面所述电子设备的拍摄预览界面。701. The electronic device displays, in response to a first operation of the user, a first interface, where the first interface is a shooting preview interface of the electronic device.

示例性地,用户可以从桌面点击相机,则响应于用户的操作,电子设备显示第一界面,该第一界面为相机拍摄预览界面;或者用户可以从其他应用中调用相机,电子设备进入相机拍摄预览界面,该拍摄预设界面也可以称为预览界面、取景界面等。如图3所示,响应于用于点击相机301的操作,手机进行相机拍摄预览界面,。Exemplarily, the user can click the camera from the desktop, and in response to the user's operation, the electronic device displays a first interface, where the first interface is a camera shooting preview interface; or the user can call the camera from other applications, and the electronic device enters the camera shooting interface. A preview interface, the shooting preset interface may also be called a preview interface, a viewfinder interface, and the like. As shown in FIG. 3, in response to the operation for clicking on the camera 301, the mobile phone performs a camera shooting preview interface.

702,电子设备响应于用户的拍摄操作,获取第一照片。702. The electronic device acquires a first photo in response to the user's photographing operation.

703,电子设备确定第一角度,该第一角度为在获取第一照片时,电子设备的第一预设部的位置与第二预设部的位置的连线与预设地理方向的夹角。703. The electronic device determines a first angle, where the first angle is the included angle between the line connecting the position of the first preset part and the position of the second preset part of the electronic device and the preset geographic direction when the first photo is acquired .

本申请实施例中,该第一预设部可以是电子设备的充电接口的中心位置,该充电接口位于电子设备底部边框的中间位置,该第二预设部可以是电子设备的屏幕中心位置;或者,该第一预设部可以是电子设备的屏幕中心位置,该第二预设部可以是电子设备的前置摄像头的中心位置,本申请实施例对此不予限定。In the embodiment of the present application, the first preset portion may be the center position of the charging interface of the electronic device, the charging port is located at the middle position of the bottom frame of the electronic device, and the second preset portion may be the center position of the screen of the electronic device; Alternatively, the first preset portion may be the center position of the screen of the electronic device, and the second preset portion may be the center position of the front camera of the electronic device, which is not limited in this embodiment of the present application.

该预设地理方向可以是正北、正东等,本申请实施例对此不予限定。The preset geographic direction may be due north, due east, etc., which is not limited in this embodiment of the present application.

应理解,对于步骤上述702和步骤703执行的先后顺序,本申请实施例不予限定。It should be understood that the order in which steps 702 and 703 are executed is not limited in this embodiment of the present application.

704,电子设备判断所述第一角度处于第一预设角度范围内时,旋转所述第一照片。704. When the electronic device determines that the first angle is within a first preset angle range, rotate the first photo.

示例性地,该第一预设部的位置是电子设备的充电接口的中心位置,该第二预设部的位置是电子设备的屏幕中心位置,该预设地理方向为正北方向,当用户正向握持电子设备时,可以理解为该第一角度为0度,当用户以其他姿势握持电子设备时,可以将从该正北方向到该第一预设部的位置和第二预设部的位置的连线之间的逆时针角度作为该第一角度,则该第一预设角度范围可以是45度至315度,该第一预设角度范围也可以是30度至330度,本申请实施例对此不予限定。Exemplarily, the position of the first preset part is the center position of the charging interface of the electronic device, the position of the second preset part is the center position of the screen of the electronic device, and the preset geographic direction is the true north direction. When holding the electronic device in the forward direction, it can be understood that the first angle is 0 degrees. When the user holds the electronic device in other postures, the user can move from the true north direction to the position of the first preset part and the second preset angle. Set the counterclockwise angle between the lines connecting the positions of the parts as the first angle, then the first preset angle range can be 45 degrees to 315 degrees, and the first preset angle range can also be 30 degrees to 330 degrees , which is not limited in the embodiments of the present application.

如图3中的(e)、(f)所示,图(e)中的电子设备,可以理解为该第一角度为0度,图(f)中的电子设备的第一角度为90度,则电子设备判断该第一角度处于第一预设 角度范围内时,旋转该第一照片。As shown in (e) and (f) in Figure 3, the electronic device in Figure (e) can be understood as the first angle is 0 degrees, and the first angle of the electronic device in Figure (f) is 90 degrees , the electronic device rotates the first photo when determining that the first angle is within the first preset angle range.

如图5中的(g)、(h)所示,该第一角度可以为180度,如图5中的(e)所示,该第一角度可以为270度,在其他的实施例中,该第一角度还可以为其他值,本申请实施例对此不予限定。As shown in (g) and (h) of FIG. 5 , the first angle may be 180 degrees. As shown in (e) of FIG. 5 , the first angle may be 270 degrees. In other embodiments , the first angle may also be other values, which are not limited in this embodiment of the present application.

705,电子设备保存旋转后的该第一照片。705. The electronic device saves the rotated first photo.

示例性地,如图3中的(g)、(h)所示,电子设备保存该旋转后的第一照片。Exemplarily, as shown in (g) and (h) of FIG. 3 , the electronic device saves the rotated first photo.

基于本申请实施例,当电子设备响应于用户的操作,获取第一照片,电子设备确定其第一预设部的位置与第二预设部的位置的连线与预设地理方向的第一角度处于预设角度范围之内时,对该第一照片进行旋转,并保存旋转后的第一照片。在用户以不同的姿势握持该电子设备进行拍摄时,可以自动旋转并保存该拍摄的照片,该技术方案有利于用户更加舒适的查阅拍摄的照片。Based on the embodiments of the present application, when the electronic device acquires the first photo in response to the user's operation, the electronic device determines the connection between the position of the first preset part and the position of the second preset part and the first position of the preset geographic direction. When the angle is within the preset angle range, the first photo is rotated, and the rotated first photo is saved. When the user holds the electronic device in different postures to take pictures, the taken photo can be automatically rotated and saved, and the technical solution is beneficial to the user to check the taken photo more comfortably.

可选地,该方法还可以包括步骤706至707。Optionally, the method may further include steps 706 to 707 .

706,电子设备检测到用户的第二操作。706. The electronic device detects the second operation of the user.

示例性地,如图3中的(g)所示,该第二操作可以是用户点击区域308的操作。Exemplarily, as shown in (g) of FIG. 3 , the second operation may be an operation of the user clicking on the area 308 .

707,电子设备响应于所述第二操作,显示第二界面,该第二界面包括旋转后的第一照片,其中,目标拍摄物在该第一界面中的方向与该目标拍摄物在第二界面中的方向相同。707. In response to the second operation, the electronic device displays a second interface, where the second interface includes the rotated first photo, wherein the direction of the target photographed object in the first interface is the same as that of the target photographed object in the second image. The orientation in the interface is the same.

示例性地,如图3中的(h)所示,该电子设备响应于该第二操作,显示第二界面,该第二界面可以是图3中的(h)显示的界面,其中,该照片309中的被拍摄物304a的方向与其在第一界面中的方向相同。Exemplarily, as shown in (h) in FIG. 3 , the electronic device displays a second interface in response to the second operation, and the second interface may be the interface shown in (h) in FIG. 3 , wherein the The orientation of the subject 304a in the photo 309 is the same as its orientation in the first interface.

基于本申请实施例,当用户打开第二界面查看该第一照片时,目标拍摄物在第一界面中的方向与该目标拍摄物在第二界面中的方向相同。该技术方案可以使得用户在水平拍摄时所见即所得,即用户查看拍摄的照片时,该照片中的目标拍摄物的方向与用户在电子设备的拍摄预览界面中看到的方向相一致,从而有利于用户以正常姿势查阅拍摄的照片,无需旋转电子设备或手动旋转照片,提升了用户的拍摄体验。Based on the embodiment of the present application, when the user opens the second interface to view the first photo, the direction of the target photograph in the first interface is the same as the direction of the target photograph in the second interface. The technical solution can make what the user see is what you get when shooting horizontally, that is, when the user views the photographed photograph, the direction of the target photographed object in the photograph is consistent with the direction that the user sees in the photographing preview interface of the electronic device, thereby It is beneficial for the user to view the photographed photos in a normal posture without rotating the electronic device or manually rotating the photos, which improves the user's photographing experience.

可选地,该电子设备确定第一角度,包括:Optionally, the electronic device determines the first angle, including:

确定第二平面,该第二平面为用户双眼所在的平面;determining a second plane, where the second plane is the plane where the user's eyes are located;

根据该第二平面的法向量与第一平面之间的夹角信息,确定该第一角度,其中,该第一平面平行于所述电子设备的上表面所在的平面。The first angle is determined according to the angle information between the normal vector of the second plane and the first plane, wherein the first plane is parallel to the plane on which the upper surface of the electronic device is located.

示例性地,如图4所示,该第二平面为用户双眼所在的平面,该第二平面垂直于用户头部的中轴线,该第一平面平行于电子设备的上表面所在的平面,或该第一平面平行于电子设备的面板所在的平面。Exemplarily, as shown in FIG. 4 , the second plane is the plane where the eyes of the user are located, the second plane is perpendicular to the central axis of the user's head, the first plane is parallel to the plane where the upper surface of the electronic device is located, or The first plane is parallel to the plane on which the panel of the electronic device is located.

可选地,电子设备根据该第二平面的法向量与第一平面之间的夹角信息,确定第一角度,包括:根据该第二平面的法向量与第一平面之间的角度所处的第二预设角度范围,确定该第一角度。Optionally, the electronic device determines the first angle according to the angle information between the normal vector of the second plane and the first plane, including: according to the position of the angle between the normal vector of the second plane and the first plane. The second preset angle range is determined to determine the first angle.

本申请实施例中,可以根据第二平面的法向量与第一平面之间的角度所处的第二预设角度范围,来确定该第一角度。In this embodiment of the present application, the first angle may be determined according to a second preset angle range in which the angle between the normal vector of the second plane and the first plane is located.

例如,该第二预设角度范围为45度至135度时,则确定第一角度为45度或90度等。该第二预设角度范围为135度至225度时,则确定该第一角度为135度或180度等,本申请实施例对此不予限定。For example, when the second preset angle range is 45 degrees to 135 degrees, the first angle is determined to be 45 degrees or 90 degrees. When the second preset angle range is 135 degrees to 225 degrees, it is determined that the first angle is 135 degrees or 180 degrees, etc., which is not limited in this embodiment of the present application.

可选地,电子设备确定第一角度,包括:在用户握持电子设备时,确定用户与该电子 设备的触摸信息;根据该触摸信息,确定该第一角度。Optionally, determining the first angle by the electronic device includes: when the user holds the electronic device, determining touch information between the user and the electronic device; and determining the first angle according to the touch information.

本申请实施例中,可以根据用户使用电子设备时,用户的手指、手掌与电子设备的触摸信息来确定该第一角度,该触摸信息可以是用户与电子设备的边框或屏幕的触摸信息。In this embodiment of the present application, the first angle may be determined according to touch information between the user's finger, palm and the electronic device when the user uses the electronic device, and the touch information may be touch information between the user and the frame or screen of the electronic device.

示例性地,如图5所示,可以将用户与电子设备的触摸信息和第一角度相关联起来,则根据用户与电子设备的触摸信息可以确定该第一角度。Exemplarily, as shown in FIG. 5 , the touch information between the user and the electronic device may be associated with the first angle, and then the first angle may be determined according to the touch information between the user and the electronic device.

可选地,电子设备根据该触摸信息,确定该第一角度,包括:将该触摸信息输入至神经网络模型中;根据该神经网络模型的输出结果确定该第一角度。Optionally, determining the first angle by the electronic device according to the touch information includes: inputting the touch information into a neural network model; and determining the first angle according to an output result of the neural network model.

本申请实施例中,电子设备可以在用户使用手机时采集用户与电子设备的触摸信息,并根据该触摸信息训练神经网络模型,当用户使用电子设备进行拍摄时,根据该神经网络模型的输出结果可以确定该第一角度。或者,该神经网络模型是事先训练好的,本申请实施例对此不予限定。In this embodiment of the present application, the electronic device may collect touch information between the user and the electronic device when the user uses the mobile phone, and train a neural network model according to the touch information, and when the user uses the electronic device to shoot, according to the output result of the neural network model The first angle can be determined. Alternatively, the neural network model is pre-trained, which is not limited in this embodiment of the present application.

可选地,电子设备判断该第一角度处于第一预设角度范围内时,旋转该第一照片,包括:当该第一角度处于第一预设角度范围内时,将该第一照片逆时针旋转该第一角度。Optionally, when the electronic device determines that the first angle is within the first preset angle range, rotating the first photo includes: when the first angle is within the first preset angle range, inverting the first photo. The hour hand is rotated by the first angle.

示例性地,如图3所示,该第一角度为90度,则将该第一照片逆时针旋转90度保存,则当用户竖直查看该第一照片时,该第一照片309中的被拍摄物304a的方向与用户在取景界面中看到的方向是相同的。Exemplarily, as shown in FIG. 3 , if the first angle is 90 degrees, then the first photo is rotated 90 degrees counterclockwise to save, then when the user views the first photo vertically, the The direction of the photographed object 304a is the same as the direction that the user sees in the viewfinder interface.

本申请实施例中,当电子设备判断该第一角度处于第一预设角度范围内时,将拍摄的第一照片按照该第一角度进行逆时针旋转,该技术方案可以实现拍摄得到的照片中的目标拍摄物的方向与用户在电子设备的拍摄预览界面中看到的方向相一致,从而有利于用户以正常姿势查阅拍摄的照片,无需旋转电子设备或手动旋转照片,从而有利于用户舒适的查阅照片,提升了用户的拍摄体验。In the embodiment of the present application, when the electronic device determines that the first angle is within the range of the first preset angle, it rotates the first photograph taken counterclockwise according to the first angle. The direction of the target shooting object is consistent with the direction that the user sees in the shooting preview interface of the electronic device, so that the user can view the captured photos in a normal posture without rotating the electronic device or manually rotating the photos, which is conducive to the user's comfortable Viewing photos improves the user's shooting experience.

可选地,该电子设备的上表面所在的平面与水平面之间的夹角处于第三预设角度范围内。Optionally, the included angle between the plane where the upper surface of the electronic device is located and the horizontal plane is within a third preset angle range.

示例性地,该第三预设角度范围可以是负3度至3度、负5度5度,等等,本申请实施例对此不予限定。Exemplarily, the third preset angle range may be minus 3 degrees to 3 degrees, minus 5 degrees and 5 degrees, etc., which is not limited in this embodiment of the present application.

本申请实施例还提供一种电子设备,包括一个或多个处理器;一个或多个存储器;该一个或多个存储器存储有一个或多个计算机程序,该一个或多个计算机程序包括指令,当该指令被一个或多个处理器执行时,使得该电子设备执行前文中任一项所述的保存图像的方法。Embodiments of the present application further provide an electronic device, including one or more processors; one or more memories; the one or more memories stores one or more computer programs, and the one or more computer programs include instructions, When executed by one or more processors, the instructions cause the electronic device to execute the method for saving an image described in any one of the foregoing.

可以理解的是,电子设备为了实现上述功能,其包含了执行各个功能相应的硬件和/或软件模块。结合本文中所公开的实施例描述的各示例的算法步骤,本申请能够以硬件或硬件和计算机软件的结合形式来实现。某个功能究竟以硬件还是计算机软件驱动硬件的方式来执行,取决于技术方案的特定应用和设计约束条件。本领域技术人员可以结合实施例对每个特定的应用来使用不同方法来实现所描述的功能,但是这种实现不应认为超出本申请的范围。It can be understood that, in order to realize the above-mentioned functions, the electronic device includes corresponding hardware and/or software modules for executing each function. The present application can be implemented in hardware or in the form of a combination of hardware and computer software in conjunction with the algorithm steps of each example described in conjunction with the embodiments disclosed herein. Whether a function is performed by hardware or computer software driving hardware depends on the specific application and design constraints of the technical solution. Those skilled in the art may use different methods to implement the described functionality for each particular application in conjunction with the embodiments, but such implementations should not be considered beyond the scope of this application.

本实施例可以根据上述方法示例对电子设备进行功能模块的划分,例如,可以对应各个功能划分各个功能模块,也可以将两个或两个以上的功能集成在一个处理模块中。上述集成的模块可以采用硬件的形式实现。需要说明的是,本实施例中对模块的划分是示意性的,仅仅为一种逻辑功能划分,实际实现时可以有另外的划分方式。In this embodiment, the electronic device can be divided into functional modules according to the above method examples. For example, each functional module can be divided corresponding to each function, or two or more functions can be integrated into one processing module. The above-mentioned integrated modules can be implemented in the form of hardware. It should be noted that, the division of modules in this embodiment is schematic, and is only a logical function division, and there may be other division manners in actual implementation.

本实施例还提供一种计算机可读存储介质,该计算机可读存储介质中存储有计算机指 令,当该计算机指令在电子设备上运行时,使得电子设备执行上述相关方法步骤实现上述实施例中的保存图像的方法。This embodiment also provides a computer-readable storage medium, where computer instructions are stored in the computer-readable storage medium, and when the computer instructions are executed on the electronic device, the electronic device executes the above-mentioned related method steps to realize the above-mentioned embodiments. Method to save the image.

本实施例还提供了一种计算机程序产品,当该计算机程序产品在计算机上运行时,使得计算机执行上述相关步骤,以实现上述实施例中的保存图像的方法。This embodiment also provides a computer program product, when the computer program product runs on the computer, the computer executes the above-mentioned relevant steps, so as to realize the method for saving an image in the above-mentioned embodiment.

另外,本申请的实施例还提供一种装置,这个装置具体可以是芯片,组件或模块,该装置可包括相连的处理器和存储器;其中,存储器用于存储计算机执行指令,当装置运行时,处理器可执行存储器存储的计算机执行指令,以使芯片执行上述各方法实施例中的保存图像的方法。In addition, the embodiments of the present application also provide an apparatus, which may specifically be a chip, a component or a module, and the apparatus may include a connected processor and a memory; wherein, the memory is used for storing computer execution instructions, and when the apparatus is running, The processor can execute the computer-executed instructions stored in the memory, so that the chip executes the method for saving an image in each of the foregoing method embodiments.

其中,本实施例提供的电子设备、计算机可读存储介质、计算机程序产品或芯片均用于执行上文所提供的对应的方法,因此,其所能达到的有益效果可参考上文所提供的对应的方法中的有益效果,此处不再赘述。Wherein, the electronic device, computer-readable storage medium, computer program product or chip provided in this embodiment are all used to execute the corresponding method provided above. Therefore, for the beneficial effects that can be achieved, reference may be made to the above-provided method. The beneficial effects in the corresponding method will not be repeated here.

通过以上实施方式的描述,所属领域的技术人员可以了解到,为描述的方便和简洁,仅以上述各功能模块的划分进行举例说明,实际应用中,可以根据需要而将上述功能分配由不同的功能模块完成,即将装置的内部结构划分成不同的功能模块,以完成以上描述的全部或者部分功能。From the description of the above embodiments, those skilled in the art can understand that for the convenience and brevity of the description, only the division of the above functional modules is used as an example for illustration. In practical applications, the above functions can be allocated by different The function module is completed, that is, the internal structure of the device is divided into different function modules, so as to complete all or part of the functions described above.

在本申请所提供的几个实施例中,应该理解到,所揭露的装置和方法,可以通过其它的方式实现。例如,以上所描述的装置实施例仅仅是示意性的,例如,模块或单元的划分,仅仅为一种逻辑功能划分,实际实现时可以有另外的划分方式,例如多个单元或组件可以结合或者可以集成到另一个装置,或一些特征可以忽略,或不执行。另一点,所显示或讨论的相互之间的耦合或直接耦合或通信连接可以是通过一些接口,装置或单元的间接耦合或通信连接,可以是电性,机械或其它的形式。In the several embodiments provided in this application, it should be understood that the disclosed apparatus and method may be implemented in other manners. For example, the apparatus embodiments described above are only illustrative. For example, the division of modules or units is only a logical function division. In actual implementation, there may be other division methods. For example, multiple units or components may be combined or May be integrated into another device, or some features may be omitted, or not implemented. On the other hand, the shown or discussed mutual coupling or direct coupling or communication connection may be through some interfaces, indirect coupling or communication connection of devices or units, and may be in electrical, mechanical or other forms.

作为分离部件说明的单元可以是或者也可以不是物理上分开的,作为单元显示的部件可以是一个物理单元或多个物理单元,即可以位于一个地方,或者也可以分布到多个不同地方。可以根据实际的需要选择其中的部分或者全部单元来实现本实施例方案的目的。Units described as separate components may or may not be physically separated, and components shown as units may be one physical unit or multiple physical units, that is, may be located in one place, or may be distributed in multiple different places. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution in this embodiment.

另外,在本申请各个实施例中的各功能单元可以集成在一个处理单元中,也可以是各个单元单独物理存在,也可以两个或两个以上单元集成在一个单元中。上述集成的单元既可以采用硬件的形式实现,也可以采用软件功能单元的形式实现。In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically alone, or two or more units may be integrated into one unit. The above-mentioned integrated units may be implemented in the form of hardware, or may be implemented in the form of software functional units.

集成的单元如果以软件功能单元的形式实现并作为独立的产品销售或使用时,可以存储在一个可读取存储介质中。基于这样的理解,本申请实施例的技术方案本质上或者说对现有技术做出贡献的部分或者该技术方案的全部或部分可以以软件产品的形式体现出来,该软件产品存储在一个存储介质中,包括若干指令用以使得一个设备(可以是单片机,芯片等)或处理器(processor)执行本申请各个实施例方法的全部或部分步骤。而前述的存储介质包括:U盘、移动硬盘、只读存储器(read only memory,ROM)、随机存取存储器(random access memory,RAM)、磁碟或者光盘等各种可以存储程序代码的介质。The integrated unit, if implemented in the form of a software functional unit and sold or used as a stand-alone product, may be stored in a readable storage medium. Based on such understanding, the technical solutions of the embodiments of the present application can be embodied in the form of software products in essence, or the parts that contribute to the prior art, or all or part of the technical solutions, which are stored in a storage medium , including several instructions to make a device (which may be a single chip microcomputer, a chip, etc.) or a processor (processor) to execute all or part of the steps of the methods in the various embodiments of the present application. The aforementioned storage medium includes: U disk, mobile hard disk, read only memory (ROM), random access memory (random access memory, RAM), magnetic disk or optical disk and other media that can store program codes.

以上内容,仅为本申请的具体实施方式,但本申请的保护范围并不局限于此,任何熟悉本技术领域的技术人员在本申请揭露的技术范围内,可轻易想到变化或替换,都应涵盖在本申请的保护范围之内。因此,本申请的保护范围应以权利要求的保护范围为准。The above content is only a specific embodiment of the present application, but the protection scope of the present application is not limited to this. Covered within the scope of protection of this application. Therefore, the protection scope of the present application shall be subject to the protection scope of the claims.

Claims (18)

一种保存图像的方法,其特征在于,所述方法应用于电子设备,所述方法包括:A method for saving an image, wherein the method is applied to an electronic device, and the method comprises: 所述电子设备响应于用户的第一操作,显示第一界面,所述第一界面为所述电子设备的拍摄预览界面;The electronic device displays a first interface in response to the user's first operation, where the first interface is a shooting preview interface of the electronic device; 所述电子设备响应于所述用户的拍摄操作,获取第一照片;acquiring, by the electronic device, a first photo in response to the user's photographing operation; 所述电子设备确定第一角度,所述第一角度为在获取所述第一照片时,所述电子设备的第一预设部的位置与第二预设部的位置的连线与预设地理方向的夹角;The electronic device determines a first angle, and the first angle is the connection and the preset of the position of the first preset part and the position of the second preset part of the electronic device when the first photo is acquired the included angle of the geographic direction; 所述电子设备判断所述第一角度处于第一预设角度范围内时,旋转所述第一照片;When the electronic device determines that the first angle is within a first preset angle range, rotate the first photo; 所述电子设备保存旋转后的所述第一照片。The electronic device stores the rotated first photo. 根据权利要求1所述的方法,其特征在于,所述方法还包括:The method according to claim 1, wherein the method further comprises: 所述电子设备检测到用户的第二操作;the electronic device detects the second operation of the user; 所述电子设备响应于所述第二操作,显示第二界面,所述第二界面包括旋转后的所述第一照片,其中,目标拍摄物在所述第一界面中的方向与所述目标拍摄物在所述第二界面中的方向相同。The electronic device displays a second interface in response to the second operation, and the second interface includes the rotated first photo, wherein the direction of the target photographed object in the first interface is the same as that of the target. The directions of the photographed objects in the second interface are the same. 根据权利要求1或2所述的方法,其特征在于,所述电子设备确定第一角度,包括:The method according to claim 1 or 2, wherein the electronic device determines the first angle, comprising: 确定第二平面,所述第二平面为用户双眼所在的平面;determining a second plane, where the second plane is the plane where the user's eyes are located; 根据所述第二平面的法向量与第一平面之间的夹角信息,确定所述第一角度,其中,所述第一平面平行于所述电子设备的上表面所在的平面。The first angle is determined according to the angle information between the normal vector of the second plane and the first plane, wherein the first plane is parallel to the plane on which the upper surface of the electronic device is located. 根据权利要求3所述的方法,其特征在于,所述根据所述第二平面的法向量与第一平面之间的夹角信息,确定所述第一角度,包括:The method according to claim 3, wherein the determining the first angle according to the angle information between the normal vector of the second plane and the first plane comprises: 根据所述第二平面的法向量与第一平面之间的角度所处的第二预设角度范围,确定所述第一角度。The first angle is determined according to a second preset angle range in which the angle between the normal vector of the second plane and the first plane is located. 根据权利要求1或2所述的方法,其特征在于,所述电子设备确定第一角度,包括:The method according to claim 1 or 2, wherein the electronic device determines the first angle, comprising: 在用户握持所述电子设备时,确定用户与所述电子设备的触摸信息;When the user holds the electronic device, determining touch information between the user and the electronic device; 根据所述触摸信息,确定所述第一角度。The first angle is determined according to the touch information. 根据权利要求5所述的方法,其特征在于,所述根据所述触摸信息,确定所述第一角度,包括:The method according to claim 5, wherein the determining the first angle according to the touch information comprises: 将所述触摸信息输入至神经网络模型中;inputting the touch information into a neural network model; 根据所述神经网络模型的输出结果确定所述第一角度。The first angle is determined according to the output result of the neural network model. 根据权利要求1-6中任一项所述的方法,其特征在于,所述电子设备判断所述第一角度处于第一预设角度范围内时,旋转所述第一照片,包括:The method according to any one of claims 1-6, wherein when the electronic device determines that the first angle is within a first preset angle range, rotating the first photo includes: 当所述第一角度处于第一预设角度范围内时,将所述第一照片逆时针旋转所述第一角度。When the first angle is within a first preset angle range, the first photo is rotated by the first angle counterclockwise. 根据权利要求1-7中任一项所述的方法,其特征在于,所述电子设备的上表面所在的平面与水平面之间的夹角处于第三预设角度范围内。The method according to any one of claims 1-7, wherein an included angle between a plane where the upper surface of the electronic device is located and a horizontal plane is within a third preset angle range. 一种电子设备,其特征在于,包括:An electronic device, comprising: 一个或多个处理器;one or more processors; 一个或多个存储器;one or more memories; 所述一个或多个存储器存储有一个或多个计算机程序,所述一个或多个计算机程序包括指令,当所述指令被所述一个或多个处理器执行时,使得所述电子设备执行以下步骤:The one or more memories store one or more computer programs comprising instructions that, when executed by the one or more processors, cause the electronic device to perform the following: step: 响应于用户的第一操作,显示第一界面,所述第一界面为所述电子设备的拍摄预览界面;In response to the user's first operation, displaying a first interface, where the first interface is a shooting preview interface of the electronic device; 响应于所述用户的拍摄操作,获取第一照片;obtaining a first photo in response to the user's photographing operation; 确定第一角度,所述第一角度为在获取所述第一照片时,所述电子设备的第一预设部的位置与第二预设部的位置的连线与预设地理方向的夹角;A first angle is determined, and the first angle is a clip between a line connecting the position of the first preset part and the position of the second preset part of the electronic device and the preset geographic direction when the first photo is obtained. horn; 判断所述第一角度处于第一预设角度范围内时,旋转所述第一照片;When judging that the first angle is within a first preset angle range, rotating the first photo; 保存旋转后的所述第一照片。The rotated first photo is saved. 根据权利要求9所述的电子设备,其特征在于,当所述指令被所述一个或多个处理器执行时,使得所述电子设备执行以下步骤:The electronic device of claim 9, wherein the instructions, when executed by the one or more processors, cause the electronic device to perform the following steps: 检测到用户的第二操作;A second operation of the user is detected; 响应于所述第二操作,显示第二界面,所述第二界面包括旋转后的所述第一照片,其中,目标拍摄物在所述第一界面中的方向与所述目标拍摄物在所述第二界面中的方向相同。In response to the second operation, a second interface is displayed, and the second interface includes the rotated first photo, wherein the direction of the target photograph in the first interface is the same as where the target photograph is located. The directions in the second interface are the same. 根据权利要求9或10所述的电子设备,其特征在于,所述电子设备具体用于:The electronic device according to claim 9 or 10, wherein the electronic device is specifically used for: 确定第二平面,所述第二平面为用户双眼所在的平面;determining a second plane, where the second plane is the plane where the user's eyes are located; 根据所述第二平面的法向量与第一平面之间的夹角信息,确定所述第一角度,其中,所述第一平面平行于所述电子设备的上表面所在的平面。The first angle is determined according to the angle information between the normal vector of the second plane and the first plane, wherein the first plane is parallel to the plane on which the upper surface of the electronic device is located. 根据权利要求11所述的电子设备,其特征在于,所述电子设备具体用于:The electronic device according to claim 11, wherein the electronic device is specifically used for: 根据所述第二平面的法向量与第一平面之间的角度所处的第二预设角度范围,确定所述第一角度。The first angle is determined according to a second preset angle range in which the angle between the normal vector of the second plane and the first plane is located. 根据权利要求9或10所述的电子设备,其特征在于,所述电子设备具体用于:The electronic device according to claim 9 or 10, wherein the electronic device is specifically used for: 在用户握持所述电子设备时,确定用户与所述电子设备的触摸信息;When the user holds the electronic device, determining touch information between the user and the electronic device; 根据所述触摸信息,确定所述第一角度。The first angle is determined according to the touch information. 根据权利要求13所述的电子设备,其特征在于,所述电子设备具体用于:The electronic device according to claim 13, wherein the electronic device is specifically used for: 将所述触摸信息输入至神经网络模型中;inputting the touch information into a neural network model; 根据所述神经网络模型的输出结果确定所述第一角度。The first angle is determined according to the output result of the neural network model. 根据权利要求9-14中任一项所述的电子设备,其特征在于,所述电子设备具体用于:The electronic device according to any one of claims 9-14, wherein the electronic device is specifically used for: 当所述第一角度处于第一预设角度范围内时,将所述第一照片逆时针旋转所述第一角度。When the first angle is within a first preset angle range, the first photo is rotated by the first angle counterclockwise. 根据权利要求9-15中任一项所述的电子设备,其特征在于,所述电子设备的上表面所在的平面与水平面之间的夹角处于第三预设角度范围内。The electronic device according to any one of claims 9-15, wherein an angle between a plane where the upper surface of the electronic device is located and a horizontal plane is within a third preset angle range. 一种计算机可读存储介质,其特征在于,包括计算机指令,当所述计算机指令在电子设备上运行时,使得所述电子设备执行如权利要求1至8中任一项所述的保存图像的方法。A computer-readable storage medium, characterized in that it includes computer instructions that, when the computer instructions are executed on an electronic device, cause the electronic device to perform the image saving process according to any one of claims 1 to 8. method. 一种计算机程序产品,其特征在于,包括计算机指令,当所述计算机指令在电子设备上运行时,使得所述电子设备执行如权利要求1至8中任一项所述的保存图像的方法。A computer program product, characterized by comprising computer instructions, which, when executed on an electronic device, cause the electronic device to perform the method of saving an image according to any one of claims 1 to 8.
PCT/CN2021/130540 2020-11-18 2021-11-15 Method and electronic device for saving image Ceased WO2022105702A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN202011295395.4A CN112584037B (en) 2020-11-18 2020-11-18 Method for saving image and electronic equipment
CN202011295395.4 2020-11-18

Publications (1)

Publication Number Publication Date
WO2022105702A1 true WO2022105702A1 (en) 2022-05-27

Family

ID=75123116

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2021/130540 Ceased WO2022105702A1 (en) 2020-11-18 2021-11-15 Method and electronic device for saving image

Country Status (2)

Country Link
CN (1) CN112584037B (en)
WO (1) WO2022105702A1 (en)

Families Citing this family (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112584037B (en) * 2020-11-18 2023-02-07 华为技术有限公司 Method for saving image and electronic equipment
CN114785958B (en) * 2022-05-31 2024-08-02 维沃移动通信有限公司 Angle measuring method and device
CN115294320B (en) * 2022-10-08 2022-12-20 平安银行股份有限公司 Method and device for determining image rotation angle, electronic equipment and storage medium

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101068309A (en) * 2007-05-24 2007-11-07 中兴通讯股份有限公司 Method and device for automatic rotating mobile terminal camera head shooting results
CN105657260A (en) * 2015-12-31 2016-06-08 宇龙计算机通信科技(深圳)有限公司 Shooting method and terminal
CN106293077A (en) * 2016-07-29 2017-01-04 雷仲魁 A kind of based on human eye and the face image automatic rotating method in direction and device
CN108108114A (en) * 2017-12-19 2018-06-01 维沃移动通信有限公司 A kind of thumbnail display control method and mobile terminal
CN112584037A (en) * 2020-11-18 2021-03-30 华为技术有限公司 Method for saving image and electronic equipment

Family Cites Families (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
KR100632091B1 (en) * 2005-07-08 2006-10-04 주식회사 팬택앤큐리텔 Camera phone that supports dual shooting mode and its dual shooting mode control method
CN201639664U (en) * 2010-02-10 2010-11-17 青岛海信移动通信技术股份有限公司 Photographing system and mobile terminal with same
CN104252302A (en) * 2013-06-26 2014-12-31 富泰华工业(深圳)有限公司 Self-adaptive image adjusting system and method
CN109451216B (en) * 2018-11-16 2021-07-13 歌尔科技有限公司 Display processing method and device for shot photos
CN109922322B (en) * 2019-04-10 2021-06-11 Oppo广东移动通信有限公司 Photographing method, image processor, photographing device and electronic equipment

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101068309A (en) * 2007-05-24 2007-11-07 中兴通讯股份有限公司 Method and device for automatic rotating mobile terminal camera head shooting results
CN105657260A (en) * 2015-12-31 2016-06-08 宇龙计算机通信科技(深圳)有限公司 Shooting method and terminal
CN106293077A (en) * 2016-07-29 2017-01-04 雷仲魁 A kind of based on human eye and the face image automatic rotating method in direction and device
CN108108114A (en) * 2017-12-19 2018-06-01 维沃移动通信有限公司 A kind of thumbnail display control method and mobile terminal
CN112584037A (en) * 2020-11-18 2021-03-30 华为技术有限公司 Method for saving image and electronic equipment

Also Published As

Publication number Publication date
CN112584037B (en) 2023-02-07
CN112584037A (en) 2021-03-30

Similar Documents

Publication Publication Date Title
JP7743836B2 (en) Display method and related device for foldable screens
WO2020259452A1 (en) Full-screen display method for mobile terminal, and apparatus
WO2021052016A1 (en) Body posture detection method and electronic device
WO2021213164A1 (en) Application interface interaction method, electronic device, and computer readable storage medium
WO2020119493A1 (en) Response method for touch screen and electronic device
CN114257671B (en) Image display method and electronic equipment
CN110381282A (en) A kind of display methods and relevant apparatus of the video calling applied to electronic equipment
WO2022127787A1 (en) Image display method and electronic device
WO2020168965A1 (en) Method for controlling electronic device having folding screen, and electronic device
CN110058777A (en) The method and electronic equipment of shortcut function starting
CN111669459A (en) Keyboard display method, electronic device and computer-readable storage medium
CN109976626A (en) A kind of switching method and electronic equipment of application icon
WO2021036770A1 (en) Split-screen processing method and terminal device
WO2022095744A1 (en) Vr display control method, electronic device, and computer readable storage medium
WO2021082815A1 (en) Display element display method and electronic device
WO2022001258A1 (en) Multi-screen display method and apparatus, terminal device, and storage medium
WO2022206494A1 (en) Target tracking method and device
CN113641271A (en) Application window management method, terminal device and computer-readable storage medium
WO2022105702A1 (en) Method and electronic device for saving image
WO2022170856A1 (en) Method for establishing connection, and electronic device
WO2022143180A1 (en) Collaborative display method, terminal device, and computer readable storage medium
CN114637392A (en) Display method and electronic equipment
CN110058729A (en) Adjust the method and electronic equipment of the sensitivity of touch detection
WO2022135144A1 (en) Self-adaptive display method, electronic device, and storage medium
WO2022062902A1 (en) File transfer method and electronic device

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 21893849

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 21893849

Country of ref document: EP

Kind code of ref document: A1