WO2020093988A1 - Image processing method and electronic device - Google Patents

Image processing method and electronic device Download PDF

Info

Publication number
WO2020093988A1
WO2020093988A1 PCT/CN2019/115553 CN2019115553W WO2020093988A1 WO 2020093988 A1 WO2020093988 A1 WO 2020093988A1 CN 2019115553 W CN2019115553 W CN 2019115553W WO 2020093988 A1 WO2020093988 A1 WO 2020093988A1
Authority
WO
WIPO (PCT)
Prior art keywords
image
pixel block
electronic device
pixel
merged
Prior art date
Application number
PCT/CN2019/115553
Other languages
French (fr)
Chinese (zh)
Inventor
陈晓晓
陈浩
熊石一
周雄
张凯
Original Assignee
华为技术有限公司
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 华为技术有限公司 filed Critical 华为技术有限公司
Publication of WO2020093988A1 publication Critical patent/WO2020093988A1/en

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T1/00General purpose image data processing
    • G06T1/60Memory management

Definitions

  • This application relates to the field of terminal technology, and in particular, to an image processing method and an electronic device.
  • sequence frame animation is the simplest and most direct way to implement a guide animation with complex paths and rich details, but the general sequence frame animation may contain images ranging from several frames to tens of frames.
  • boot animations there will be hundreds or thousands of boot animations in the operating system of the mobile phone; finally, the number of files in the operating system will rise rapidly, occupying a large amount of ROM space on the terminal.
  • the present application provides an image processing method and an electronic device to realize the benefits of reducing ROM occupation and reducing the total number of files.
  • an embodiment of the present application provides an image processing method that is applicable to a first electronic device.
  • the method includes: dividing N frames of original images in an animation into M pixel blocks in the same manner;
  • the Kth frame original image is any one of the remaining N-1 frame original images, perform the following operations:
  • the second pixel block in the original image of the Kth frame is different from all pixel blocks in the current latest merged image, the second pixel block is written into the current latest merged image, otherwise, the The second pixel block is written into the current latest merged image.
  • K is a positive integer greater than 1.
  • the configuration file including: a first correspondence between the serial number of each pixel block in the finally generated merged image and the serial number of the original image, and each pixel block in the finally generated merged image and the corresponding original image The second correspondence between the location information in.
  • the first electronic device compares whether the pixel blocks in the front and back frame images in the sequence frame image are the same, filters out the same pixel blocks in the front and back frames, and only saves different pixel blocks in the merged image
  • the second electronic device acquires the configuration file and the merged image from the first electronic device. Relatively speaking, the merged image and the configuration file occupy less ROM, which can save a certain amount of ROM space.
  • the first electronic device after generating the configuration file, sends the configuration file and the finally generated combined image to the second electronic device.
  • an embodiment of the present application provides an image processing method that is applicable to a first electronic device.
  • the method includes: dividing N frames of original images in an animation into M pixel blocks in the same manner;
  • a setting operation is performed for each image in the original image of the N-1 frame, and the setting operation includes:
  • the first pixel block in the first image Traverse the first pixel block in the first image, and when the first pixel block in the first image is different from all the pixel blocks in the merged image, the first pixel block is written to the merged In the image, otherwise, the first pixel block is not written into the merged image.
  • the second pixel block in the first image is different from all pixel blocks in the current latest merged image, the second pixel block is written into the current latest merged image, otherwise, the The second pixel block is written into the current latest merged image.
  • the setting operation return to execute the fourth pixel block in the second image in the original image of the N-1 frame, when the fourth pixel block in the second image and all the pixels in the current latest merged image
  • the fourth pixel block is written into the current latest merged image; otherwise, the fourth pixel block is not written into the current latest merged image.
  • the M pixel blocks in the third image in the N-1 frame original image are returned to execution until the traversal of all images in the N-1 frame original image is completed.
  • the configuration file includes: the correspondence between the serial number of each pixel block in the merged image generated last and the serial number of the original image, and each pixel block in the merged image generated last in the corresponding original image location information.
  • the first electronic device compares whether the pixel blocks in the sequence frame image and the newly generated merged image are the same, filters out the same pixel blocks in the before and after frames, and only saves different pixel blocks in the merged image, In this way, the second electronic device acquires the configuration file and the merged image from the first electronic device. Relatively speaking, the merged image and the configuration file occupy less ROM, which can save a certain amount of ROM space.
  • an embodiment of the present application provides an image processing method applicable to a first electronic device.
  • the method includes: dividing N frames of original images in an animation into M pixel blocks in the same manner;
  • a setting operation is performed for each original image in the N-1 frame original images, the setting operation includes:
  • the first pixel block in the second image is different from all the pixel blocks in the first image, the first pixel block is written to the merged image , Otherwise, the first pixel block is not written into the merged image.
  • the second pixel block in the second image is different from all pixel blocks in the first image, the second pixel block is written into the current latest merged image, otherwise, the second pixel block is not written Write to the current latest merged image. Return to traverse to execute the third pixel block in the second image until all the M pixel blocks in the second image are traversed.
  • the fourth pixel block in the third image in the original image of the N-1 frame is executed, when the fourth pixel block in the third image and all the pixel blocks in the first image sum
  • the fourth pixel block is written into the current latest merged image; otherwise, the fourth pixel block is not written into the current latest merged image; return to execution
  • the fifth pixel block in the third image is traversed until all the M pixel blocks in the third image are traversed.
  • the configuration file includes: the correspondence between the serial number of each pixel block in the merged image generated last and the serial number of the original image, and each pixel block in the merged image generated last in the corresponding original image location information.
  • the first electronic device compares whether all the pixel blocks of the sequence frame image and the traversed image are the same, filters out the same pixel blocks in the previous and subsequent frames, and only saves the different pixel blocks in the merged image
  • the second electronic device obtains the configuration file and the merged image from the first electronic device. Relatively speaking, the merged image and the configuration file occupy less ROM, which can save a certain amount of ROM space.
  • an embodiment of the present application provides an image processing method.
  • the method is applicable to a second electronic device.
  • the method includes:
  • the configuration file including: a first correspondence between the serial number of each pixel block in the final generated merged image and the serial number of the original image, and the final generated merged image The second correspondence between each pixel block in the corresponding position information of the corresponding original image;
  • the M target pixel blocks of each group are arranged and combined according to the position information to generate the N frames of original images, and the animation is restored according to the N frames of original images.
  • the second electronic device can restore the animation through the configuration file and the merged image, the combined image and the configuration file occupy less ROM, and a certain ROM space can be saved.
  • an embodiment of the present application provides a first electronic device, including a processor and a memory.
  • the memory is used to store one or more computer programs; when the one or more computer programs stored in the memory are executed by the processor, the electronic device can implement any possible design method of any one of the above aspects.
  • an embodiment of the present application provides a second electronic device, including a processor, a read-only memory, a random access memory, a touch panel, and a display;
  • the processor is used to obtain a configuration file and a finally generated merged image from the first electronic device;
  • the configuration file includes: a first correspondence between the serial number of each pixel block in the finally generated merged image and the serial number of the original image, and The second correspondence between each pixel block in the finally generated merged image and the position information in the corresponding original image;
  • the read-only memory is used to store one or more computer programs, as well as the configuration file and the resulting merged image;
  • the processor determines the sequence number of the original image of the N frames from the finally generated merged image according to the first correspondence Corresponding N groups of M target pixel blocks; according to the second correspondence, determining position information of each group of M target pixel blocks in the corresponding original image; arranging and combining each group of M according to the position information Target pixel blocks, generate the original image of N frames, and restore the animation according to the original image of N frames;
  • the random access memory is used to store the N frames of the original image and the animation; the display is used to display the animation.
  • an embodiment of the present application further provides an apparatus, the apparatus including a module / unit that executes any one of the possible design methods of any of the above aspects.
  • These modules / units can be implemented by hardware, and can also be implemented by hardware executing corresponding software.
  • a computer-readable storage medium is also provided in an embodiment of the present application.
  • the computer-readable storage medium includes a computer program, and when the computer program runs on an electronic device, the electronic device performs any of the above aspects Any possible design method.
  • an embodiment of the present application further provides a method that includes a computer program product that, when the computer program product runs on an electronic device, causes the electronic device to perform any possible design of any of the above aspects.
  • FIG. 1 is a schematic diagram of an interconnection scenario provided by an embodiment of this application.
  • FIG. 2 is a schematic structural diagram of a mobile phone provided by an embodiment of the present application.
  • FIG. 3 is a schematic structural diagram of an Android operating system provided by an embodiment of this application.
  • FIG. 4 is a schematic diagram of a set of frame images of fingerprint animation provided by an embodiment of the present application.
  • FIG. 5 is a schematic diagram of a set of pixel blocks of fingerprint animation difference provided by an embodiment of the present application.
  • FIG. 6 is a schematic diagram of a merged image provided by an embodiment of this application.
  • FIG. 7 is a schematic diagram of an image processing method provided by an embodiment of the present application.
  • FIG. 8 is a schematic diagram of a sequence frame image comparison method provided by an embodiment of the present application.
  • FIG. 9 is a schematic diagram of a sequence frame image division method provided by an embodiment of the present application.
  • FIG. 10 is a schematic diagram of another image processing method provided by an embodiment of the present application.
  • FIG. 11 is a schematic diagram of another image processing method provided by an embodiment of the present application.
  • FIG. 13 is a schematic diagram of another merged image provided by an embodiment of this application.
  • FIG. 14 is a schematic diagram of another image processing method provided by an embodiment of the present application.
  • 15 is a schematic diagram of another merged image provided by an embodiment of this application.
  • 16 is a schematic diagram of an image processing system provided by an embodiment of the present application.
  • FIG. 17 is a schematic structural diagram of a first electronic device provided by an embodiment of the present application.
  • the sequence frame is a continuous sequence of static pictures in multiple frames.
  • Sequential frame animation also known as frame-by-frame animation, is a technique that uses multiple frames of continuous static pictures to quickly switch between video animation effects.
  • first and second are only used for description purposes, and cannot be understood as indicating or implying relative importance or implicitly indicating the number of indicated technical features .
  • the features defined as “first” and “second” may explicitly or implicitly include one or more of the features.
  • the first language and the second language refer to natural language
  • the first voice and the second voice refer to the voice uttered by the user.
  • “multiple” means two or more.
  • the image processing method provided by the embodiment of the present application can be applied to the communication architecture shown in FIG. 1.
  • the communication architecture includes: multiple electronic devices 100 and electronic devices 200.
  • the electronic device 200 can process the multi-frame images in the animation into one frame or multi-frame merged pictures, and a configuration file.
  • the electronic device 100 can obtain the configuration file and the merged image from the electronic device 200, and then restore the animation.
  • the electronic device 100 and the electronic device 200 are interconnected through a communication network
  • the communication network may be a local area network or a wide area network transferred by a relay device.
  • the communication network may be a wifi hotspot network, a wifi P2P network, a Bluetooth network, a zigbee network, or a near field communication (NFC) network and other short-distance communication networks.
  • the communication network may be a third generation mobile communication technology (3rd-generation wireless telephone technology, 3G) network, a fourth generation mobile communication technology (the 4th generation mobile communication technology, 4G ) Network, 5th-generation mobile communication technology (5G) network, future public land mobile network (PLMN) or Internet etc.
  • 3G third generation mobile communication technology
  • 4G fourth generation mobile communication technology
  • 5G 5th-generation mobile communication technology
  • PLMN public land mobile network
  • different electronic devices can exchange data through a communication network, such as interactive pictures, text, and video, or the result of the interactive electronic device processing objects such as pictures, text, or video.
  • the electronic device 100 and the electronic device 200 shown in FIG. 1 may be portable electronic devices that also include other functions such as personal digital assistants and / or music player functions, such as mobile phones, tablet computers, and wireless devices. Wearable devices with communication functions (such as smart watches), etc. Exemplary embodiments of portable electronic devices include, but are not limited to Or portable electronic devices of other operating systems.
  • the above portable electronic device may also be other portable electronic devices, such as a laptop with a touch-sensitive surface (for example, a touch panel) and the like.
  • the electronic device 100 may not be a portable electronic device, but a desktop computer with a touch-sensitive surface (such as a touch panel).
  • the following uses the electronic device 100 as an example to specifically describe the embodiment.
  • the electronic device 100 may include a processor 110, an external memory interface 120, an internal memory 121, a USB interface 130, a charging management module 140, a power management module 141, a battery 142, an antenna 1, an antenna 2, a mobile communication module 150, and a wireless communication module 160 , Audio module 170, speaker 170A, receiver 170B, microphone 170C, headset interface 170D, sensor module 180, button 190, motor 191, indicator 192, camera 193, display screen 194, and SIM card interface 195.
  • a processor 110 an external memory interface 120, an internal memory 121, a USB interface 130, a charging management module 140, a power management module 141, a battery 142, an antenna 1, an antenna 2, a mobile communication module 150, and a wireless communication module 160 , Audio module 170, speaker 170A, receiver 170B, microphone 170C, headset interface 170D, sensor module 180, button 190, motor 191, indicator 192, camera 193, display screen 194, and SIM card interface 195.
  • the sensor module 180 may include a pressure sensor 180A, a gyro 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 structure illustrated in the embodiment of the present invention does not constitute a specific limitation on the electronic device 100.
  • the electronic device 100 may include more or fewer components than shown, or combine some components, or split some components, or arrange different components.
  • the illustrated components can 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), and an image signal processor (image) signal processor (ISP), controller, memory, video codec, digital signal processor (DSP), baseband processor, and / or neural network processor (Neural-network Processing Unit, NPU) Wait.
  • application processor application processor
  • AP application processor
  • modem processor graphics processor
  • ISP image signal processor
  • controller memory
  • video codec video codec
  • DSP digital signal processor
  • baseband processor baseband processor
  • / or neural network processor Neral-network Processing Unit, NPU
  • the controller may be the nerve center and command center of the electronic device 100.
  • the controller can generate the operation control signal according to the instruction operation code and the timing signal to complete the control of fetching instructions and executing instructions.
  • the processor 110 may also be provided with a memory for storing instructions and data.
  • the memory in the processor 110 is a cache memory.
  • the memory may store instructions or data that the processor 110 has just used or recycled. If the processor 110 needs to use the instruction or data again, it can be directly called from the memory. Avoid repeated access, reduce the waiting time of the processor 110, thus improving the efficiency of the system.
  • the processor 110 may include one or more interfaces.
  • Interfaces can include integrated circuit (inter-integrated circuit, I2C) interface, integrated circuit built-in audio (inter-integrated circuit, sound, I2S) interface, pulse code modulation (pulse code modulation (PCM) interface, universal asynchronous transceiver (universal) asynchronous receiver / transmitter, UART) interface, mobile industry processor interface (MIPI), general-purpose input / output (GPIO) interface, subscriber identity module (SIM) interface, and And / or 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, including a serial data line (serial data line, SDA) and a serial clock line (derail clock line, SCL).
  • the processor 110 may include multiple sets of I2C buses.
  • the processor 110 may respectively couple the touch sensor 180K, the charger, the flash, the camera 193, etc. 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 through the I2C bus interface to realize the touch function of the electronic device 100.
  • the I2S interface can be used for audio communication.
  • the processor 110 may include multiple sets of I2S buses.
  • the processor 110 may be coupled to 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, to realize the function of answering the phone call through the Bluetooth headset.
  • the PCM interface can also be used for audio communication, 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 to realize the function of answering the phone call 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.
  • the UART interface is generally used to connect the processor 110 and 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 to peripheral devices such as the display screen 194 and the camera 193.
  • MIPI interface includes camera serial interface (camera serial interface, CSI), display serial interface (display serial interface, DSI) and so on.
  • the processor 110 and the camera 193 communicate through a CSI interface to implement the shooting function of the electronic device 100.
  • the processor 110 and the display screen 194 communicate through the DSI interface to realize the display function of the electronic device 100.
  • the GPIO interface can be configured via software.
  • the GPIO interface can be configured as a control signal or a data signal.
  • the GPIO interface may be used to connect the processor 110 to the camera 193, the display screen 194, the wireless communication module 160, the audio module 170, the sensor module 180, and the like.
  • 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, and may specifically be a Mini USB interface, a Micro USB interface, a USB Type C interface, and so on.
  • the USB interface can be used to connect a charger to charge the electronic device 100, and can also be used to transfer data between the electronic device 100 and peripheral devices. It can also be used to connect headphones and 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 invention is only a schematic description, and does not constitute a limitation on the structure of the electronic device 100.
  • the electronic device 100 may also use different interface connection methods in the foregoing embodiments, or a combination of multiple interface connection methods.
  • 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 the charging input of the wired charger through the USB interface.
  • the charging management module 140 may receive wireless charging input through the 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 to connect the battery 142, the charging management module 140 and the processor 110.
  • the power management module 141 receives input from the battery 142 and / or the charging management module 140, and supplies power to the processor 110, internal memory 121, external memory, display screen 194, camera 193, wireless communication module 160, and the like.
  • the power management module 141 can also be used to monitor battery capacity, battery cycle times, battery health status (leakage, impedance) and other parameters.
  • the power management module 141 may also be disposed in the processor 110.
  • the power management module 141 and the charging management module 140 may also be set in the same device.
  • the wireless communication function of the electronic device 100 can be realized by the antenna module 1, the antenna module 2, the mobile communication module 150, the wireless communication module 160, the modem processor, and the baseband processor.
  • Antenna 1 and antenna 2 are used to transmit and receive electromagnetic wave signals.
  • Each antenna in the 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 cellular antenna can be multiplexed as a wireless LAN diversity antenna. In other embodiments, the antenna may be used in conjunction with a tuning switch.
  • the mobile communication module 150 can provide a wireless communication solution including 2G / 3G / 4G / 5G and the like applied to the electronic device 100.
  • the mobile communication module 150 may include at least one filter, switch, power amplifier, low noise amplifier (Low Noise Amplifier, LNA), and the like.
  • the mobile communication module 150 can receive electromagnetic waves from the antenna 1 and filter, amplify, etc. the received electromagnetic waves, and transmit them to the modem processor for demodulation.
  • the mobile communication module 150 can also amplify the signal modulated by the modulation and demodulation processor and convert it to electromagnetic wave 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 and at least part of the modules of the processor 110 may be provided in the same device.
  • the modem processor may include a modulator and a demodulator.
  • the modulator is used to modulate the low-frequency baseband signal to be transmitted into a high-frequency signal.
  • the demodulator is used to demodulate the received electromagnetic wave signal into a low-frequency baseband signal.
  • the demodulator then transmits the demodulated low-frequency baseband signal to the baseband processor for processing.
  • the low-frequency baseband signal is processed by the baseband processor and then passed to the application processor.
  • the application processor outputs a sound signal through an audio device (not limited to a speaker 170A, a receiver 170B, etc.), or displays an image or video through a display screen 194.
  • the modem processor may be an independent device.
  • the modem processor may be independent of the processor 110, and may be set in the same device as the mobile communication module 150 or other functional modules.
  • the wireless communication module 160 can provide wireless local area network (wireless local area networks, WLAN), Bluetooth (bluetooth, BT), global navigation satellite system (GNSS), frequency modulation (frequency modulation), which are applied to the electronic device 100. FM), Near Field Communication (NFC), Infrared (IR) and other wireless communication solutions.
  • 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 electromagnetic wave signals, and transmits the processed signals to the processor 110.
  • the wireless communication module 160 can also receive the signal to be transmitted from the processor 110, frequency-modulate it, amplify it, and radiate it through the antenna 2 to electromagnetic waves.
  • the wireless communication module 160 is used to send the voice of the first user and the machine voice of the target language after translation, or the voice of the target language sent by the opposite user and the machine voice of the first language after translation.
  • the antenna 1 of the electronic device 100 and the mobile communication module 150 are coupled, and the antenna 2 and the wireless communication module 160 are coupled so that the electronic device 100 can communicate with the network and other devices through wireless communication technology.
  • the wireless communication technology may include a global mobile communication system (global system for mobile communications, GSM), general packet radio service (general packet radio service, GPRS), code division multiple access (code division multiple access, CDMA), broadband Code division multiple access (wideband code division multiple access, WCDMA), time division code division multiple access (time-division code division division multiple access, TD-SCDMA), long-term evolution (long term evolution, LTE), BT, GNSS, WLAN, NFC , FM, and / or IR technology, etc.
  • GSM global system for mobile communications
  • GPRS general packet radio service
  • code division multiple access code division multiple access
  • CDMA broadband Code division multiple access
  • WCDMA wideband code division multiple access
  • TD-SCDMA time division code division multiple access
  • long-term evolution long term evolution
  • LTE
  • the GNSS may include a global positioning system (GPS), a global navigation satellite system (GLONASS), a beidou navigation system (BDS), and a quasi-zenith satellite system (quasi -zenith satellite system (QZSS)) and / or satellite-based augmentation systems (SBAS).
  • GPS global positioning system
  • GLONASS global navigation satellite system
  • BDS beidou navigation system
  • QZSS quasi-zenith satellite system
  • SBAS satellite-based augmentation systems
  • the electronic device 100 realizes a display function through a GPU, a display screen 194, and an application processor.
  • the GPU is a microprocessor for image processing, connecting the display screen 194 and the application processor.
  • the GPU is used to perform mathematical and geometric calculations, and is used for graphics rendering.
  • the processor 110 may include one or more GPUs that execute program instructions to generate or change display information.
  • the display screen 194 is used to display images, videos and the like.
  • the display screen 194 includes a display panel.
  • the display panel can use LCD (liquid crystal), OLED (organic light-emitting diode), active matrix organic light-emitting diode or active matrix organic light-emitting diode (active-matrix organic light) emitting diode, AMOLED), flexible light-emitting diode (FLED), Miniled, MicroLed, Micro-oLed, quantum dot light emitting diode (QLED), etc.
  • the electronic device 100 may include 1 or N display screens, where N is a positive integer greater than 1.
  • the display screen 194 may be used to display a call interface, a translation interface, and a language setting interface.
  • the electronic device 100 can realize 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 processes the data fed back by the camera 193. For example, when taking a picture, the shutter is opened, the light is transmitted to the camera photosensitive element through the lens, and the optical signal is converted into an electrical signal, and the camera photosensitive element transmits the electrical signal to the ISP for processing, which is converted into an image visible to the naked eye.
  • ISP can also optimize the image noise, brightness, and skin color. ISP can also optimize the exposure, color temperature and other parameters of the shooting scene.
  • the ISP may be set in the camera 193.
  • the camera 193 is used to capture still images or video.
  • the object generates an optical image through the lens and projects it onto the photosensitive element.
  • the photosensitive element may be a charge coupled device (charge coupled device, CCD) or a complementary metal-oxide-semiconductor (CMOS) phototransistor.
  • CCD charge coupled device
  • 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 image signals.
  • the electronic device 100 may include 1 or N cameras, where N is a positive integer greater than 1.
  • the digital signal processor is used to process digital signals. In addition to digital image signals, it can also process other digital signals. For example, when the electronic device 100 is selected at a frequency point, the digital signal processor is used to perform Fourier transform on the energy at the frequency point.
  • Video codec is 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 in various encoding formats, for example: MPEG1, MPEG2, MPEG3, MPEG4, and so on.
  • NPU is a neural-network (NN) computing processor.
  • NN neural-network
  • the NPU can realize applications such as intelligent recognition of the electronic device 100, such as image recognition, face recognition, voice recognition, and text understanding.
  • 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, save music, video and other files in an external memory card.
  • the internal memory 121 may be used to store computer executable program code, where the executable program code includes instructions.
  • the processor 110 executes instructions stored in the internal memory 121 to execute various functional applications and data processing of the electronic device 100.
  • the memory 121 may include a storage program area and a storage data area.
  • the storage program area may store an operating system, at least one function required application programs (such as sound playback function, image playback function, etc.).
  • the storage data area may store data (such as audio data, phone book, etc.) created during use of the electronic device 100 and the like.
  • the memory 121 may include a high-speed random access memory, and may also include a non-volatile memory, such as at least one disk storage device, a flash memory device, a universal flash memory (universal flash storage, UFS), and so on.
  • a non-volatile memory such as at least one disk storage device, a flash memory device, a universal flash memory (universal flash storage, UFS), and so on.
  • the electronic device 100 may implement audio functions through an audio module 170, a speaker 170A, a receiver 170B, a microphone 170C, a headphone interface 170D, and an application processor. For example, music playback, recording, etc.
  • the audio module 170 is used to convert digital audio information into analog audio signal output, and also used to convert analog audio input into digital audio signal.
  • the audio module 170 can also be used to encode and decode audio signals.
  • the audio module 170 may be disposed in the processor 110, or some functional modules of the audio module 170 may be disposed in the processor 110.
  • the speaker 170A also called “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 speaker 170A is used to play the translated machine voice.
  • the receiver 170B also known as "handset" is used to convert audio electrical signals into sound signals.
  • the voice can be received by bringing the receiver 170B close to the ear.
  • the microphone 170C also called “microphone”, “microphone”, is used to convert sound signals into electrical signals.
  • the user can make a sound by approaching the microphone 170C through a person's mouth, and input a sound signal to 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. In addition to collecting sound signals, it may also achieve a noise reduction function. In other embodiments, the electronic device 100 may also be provided with three, four, or more microphones to collect sound signals, reduce noise, identify sound sources, and implement directional recording functions. In the embodiment of the present application, the microphone 170C may be used to collect the user's voice, for example, the first voice of the first user in the first language.
  • the headset interface 170D is used to connect wired headsets.
  • the headphone jack can be a USB jack, or a 3.5mm open mobile electronic device (open mobile terminal) platform, OMTP standard interface, and the American Telecommunications Industry Association (cellular telecommunications industry association of the United States, CTIA) standard interface.
  • the pressure sensor 180A is used to sense the pressure signal and can convert the pressure signal into an electrical signal.
  • the pressure sensor 180A may be provided on the display screen 194.
  • the capacitive pressure sensor may be at least two parallel plates with conductive materials. When force is applied to the pressure sensor 180A, the capacitance between the electrodes changes.
  • the electronic device 100 determines the strength of the pressure according to the change in capacitance.
  • the electronic device 100 detects the intensity of the touch operation according to the pressure sensor 180A.
  • the electronic device 100 may calculate the touched position based on the detection signal of the pressure sensor 180A.
  • touch operations that act on the same touch position but have different touch operation intensities may correspond to different operation instructions. For example, when a touch operation with a touch operation intensity less than the first pressure threshold acts on the short message application icon, an instruction to view 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, an instruction to create a new short message is executed.
  • the gyro sensor 180B may be used to determine the movement posture of the electronic device 100. In some embodiments, the angular velocity of the electronic device 100 around three axes (ie, x, y, and z axes) may be determined by the gyro sensor 180B.
  • the gyro sensor 180B can be used for image stabilization. Exemplarily, when the shutter is pressed, the gyro sensor 180B detects the jitter angle of the electronic device 100, calculates the distance that the lens module needs to compensate based on the angle, and allows the lens to counteract the jitter of the electronic device 100 through reverse movement to achieve anti-shake.
  • the gyro sensor 180B can also be used for navigation and somatosensory game scenes.
  • the air pressure sensor 180C is used to measure air pressure.
  • the electronic device 100 calculates the altitude using the air pressure value measured by the air pressure sensor 180C to assist 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 may detect the opening and closing of the clamshell according to the magnetic sensor 180D.
  • features such as automatic unlocking of the flip cover are set.
  • the acceleration sensor 180E can detect the magnitude of acceleration of the electronic device 100 in various directions (generally three axes). When the electronic device 100 is stationary, the magnitude and direction of gravity can be detected. It can also be used to recognize the posture of electronic devices, and be used in applications such as horizontal and vertical screen switching and pedometers.
  • the distance sensor 180F is used to measure the distance.
  • the electronic device 100 can measure the distance by infrared or laser. In some embodiments, when shooting scenes, the electronic device 100 may use the distance sensor 180F to measure distance to achieve fast focusing.
  • the proximity light sensor 180G may include, for example, a light emitting diode (LED) and a light detector, such as a photodiode.
  • the light emitting diode may be an infrared light emitting diode.
  • the electronic device 100 emits infrared light outward through the light emitting diode.
  • the electronic device 100 uses a photodiode to detect infrared reflected light from nearby objects. When sufficient reflected light is detected, it may 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.
  • the proximity light sensor 180G can also be used in leather case mode, pocket mode automatically unlocks and locks the screen.
  • the ambient light sensor 180L is used to sense the brightness of ambient light.
  • 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, access to application locks, fingerprint photographing, and fingerprint answering calls.
  • 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, the electronic device 100 performs performance reduction of the processor located near the temperature sensor 180J in order to reduce power consumption and implement thermal protection. In some other embodiments, when the temperature is below another threshold, the electronic device 100 heats the battery 142 to avoid the abnormal shutdown of the electronic device 100 due to the low temperature. In some other embodiments, when the temperature is below another threshold, the electronic device 100 performs boosting on the output voltage of the battery 142 to avoid abnormal shutdown due to low temperature.
  • Touch sensor 180K also known as "touch panel”. Can be set on the display 194. Used to detect touch operations on or near it. The detected touch operation may be passed to the application processor to determine the type of touch event and provide corresponding visual output through the 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. In the embodiment of the present application, the touch panel is used to receive touch operations such as a first operation, a confirmation operation of a language setting control, a close operation, and an exit operation.
  • touch operations such as a first operation, a confirmation operation of a language setting control, a close operation, and an exit operation.
  • 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 a blood pressure beating signal. In some embodiments, the bone conduction sensor 180M may also be provided in the earphone.
  • the audio module 170 may parse out the voice signal based on the vibration signal of the vibrating bone block of the voice part acquired by the bone conduction sensor 180M to realize the voice function.
  • the application processor may analyze the heart rate information based on the blood pressure beating signal acquired by the bone conduction sensor 180M to implement the heart rate detection function.
  • the key 190 includes a power-on key, a volume key, and the like.
  • the keys can be mechanical keys. It can also be a touch button.
  • the electronic device 100 can receive key input and generate key signal input related to user settings and function control of the electronic device 100.
  • the motor 191 may generate a vibration prompt.
  • the motor 191 can be used for vibration notification of incoming calls and can also be used for touch vibration feedback.
  • touch operations applied to different applications may correspond to different vibration feedback effects.
  • the motor 191 can also correspond to different vibration feedback effects.
  • Different application scenarios for example: time reminder, receiving information, alarm clock, game, etc.
  • Touch vibration feedback effect can also support customization.
  • the indicator 192 may be an indicator light, which may be used to indicate a charging state, a power change, and may 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 subscriber identity module (SIM).
  • SIM subscriber identity module
  • the SIM card can be inserted into or removed from the SIM card interface to achieve contact and separation with the electronic device 100.
  • 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 cards, Micro SIM cards, SIM cards, etc. Multiple cards can be inserted in the same SIM card interface. The types of the multiple 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 can also be compatible with external memory cards.
  • the electronic device 100 interacts with the network through the SIM card to realize functions such as call and data communication.
  • the electronic device 100 uses eSIM, that is, 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 micro-core architecture, a micro-service architecture, or a cloud architecture.
  • the embodiment of the present invention takes an Android system with a layered architecture as an example to exemplarily explain the software structure of the electronic device 100.
  • FIG. 3 is a software block diagram of the electronic device 100 according to an embodiment of the present invention.
  • the layered architecture divides the software into several layers, and each layer has a clear role and division of labor.
  • the layers communicate with each other through a software interface.
  • the Android system is divided into four layers, from top to bottom are the application layer, the application framework layer, the Android runtime and the system library, and the kernel layer.
  • the application layer may include a series of application packages.
  • the application package may include applications such as phone, camera, gallery, calendar, call, map, navigation, WLAN, Bluetooth, music, video, and short message.
  • the application framework layer provides an application programming interface (application programming interface) and programming framework for applications at the application layer.
  • the application framework layer includes some predefined functions.
  • the application framework layer may include a window manager, a content provider, a view system, a phone manager, a resource manager, a notification manager, and so on.
  • the window manager is used to manage window programs.
  • the window manager can obtain the size of the display screen, determine whether there is a status bar, lock the screen, intercept the screen, 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, and so on.
  • the view system includes visual controls, such as controls for displaying text and controls for displaying pictures.
  • the view system can be used to build applications.
  • the display interface can be composed of one or more views.
  • a display interface that includes an SMS notification icon may include a view that displays text and a view that displays pictures.
  • the phone manager is used to provide the communication function of the electronic device 100. For example, the management of call status (including connection, hang up, etc.).
  • the resource manager provides various resources for the application, such as localized 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 after a short stay without user interaction.
  • the notification manager is used to notify the completion of downloading, message reminders, etc.
  • the notification manager can also be a notification that appears in the status bar at the top of the system in the form of a chart or scroll bar text, such as a notification of an application running in the background, or a notification that appears on the screen in the form of a dialog window.
  • the text message is displayed in the status bar, a prompt sound is emitted, the electronic device vibrates, and the indicator light flashes.
  • Android Runtime includes core library and virtual machine. Android runtime is responsible for the scheduling and management of the Android system.
  • the core library contains two parts: one part is the function function that Java language needs to call, and the other part is the core library of Android.
  • the application layer and the application framework layer run in the virtual machine.
  • the virtual machine executes the java files of the application layer and the application framework layer into binary files.
  • the virtual machine is used to perform functions such as object lifecycle management, stack management, thread management, security and exception management, and garbage collection.
  • the system library may include multiple functional modules. For example: surface manager (surface manager), media library (Media library), 3D graphics processing library (for example: OpenGL ES), 2D graphics engine (for example: SGL), etc.
  • surface manager surface manager
  • media library Media library
  • 3D graphics processing library for example: OpenGL ES
  • 2D graphics engine for example: SGL
  • the surface manager is used to manage the display subsystem and provides a combination of 2D and 3D layers for multiple applications.
  • the media library supports a variety of commonly used audio, video format playback and recording, and still image files.
  • the media library can support multiple audio and video encoding formats, such as: MPEG4, H.264, MP3, AAC, AMR, JPG, PNG, etc.
  • the 3D graphics processing library is used to realize 3D graphics drawing, image rendering, synthesis, and layer processing.
  • the 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 the display driver, camera driver, audio driver, and sensor driver.
  • the guide animation in the terminal system is usually stored in a read-only memory (Read Only Memory, ROM) in the form of a sequence frame image, and the general animation may include images of several frames or even tens of frames. Assuming that the size of each frame is the same, the storage size is Mkb, and the number of frames is N, then the entire fingerprint animation occupies the size of (M * N) kb. In most animations, the pixels in most areas of the two frames adjacent to each other are the same, and the proportion of pixels that are not the same is often very small.
  • ROM Read Only Memory
  • embodiments of the present application provide an image processing method, which can enable the server side to pre-process animation into one or more merged images and configuration files, and when the terminal side obtains the one or more merged images from the server side and After the configuration file, the animation can be restored, because one or more merged images and configuration files take up significantly less ROM than sequential frame images, so ROM space can be saved to a certain extent.
  • the fingerprint animation is composed of multiple frames of sequence images, as shown in the figure As shown in FIG. 4, the fingerprint animation includes ten consecutive frames of images, and the implementation method in the prior art is generally to store the ten frames of fingerprint animation in the ROM, which occupies more memory.
  • the first electronic device can process the ten frames of the fingerprint animation in advance to generate multiple merged images and a configuration file, and the first electronic device then combines the multiple merged images and a configuration file Send to the second electronic device, so that the second electronic device restores the fingerprint animation.
  • the first electronic device may cut the ten frames of images into multiple pixel blocks in the same manner, and then sequentially compare whether the pixel blocks at the same position in the next frame image and the adjacent previous frame image are different.
  • FIG. 5a in FIG. 5 is a different pixel block determined after comparing the second frame image in the fingerprint animation with the first frame image (the pixel blocks in the box are different pixel blocks), and FIG.
  • the first electronic device writes the determined pixel blocks in the box into the merged image, and the merged image includes all pixel blocks of the first frame image in advance.
  • the merged image includes all pixel blocks of the first frame image in advance.
  • the configuration file records which frame pixel blocks each pixel block in the merged image is, And the positions of these frames respectively, so that the second electronic device can restore the fingerprint animation according to the configuration file and the merged image.
  • the first electronic device may be a mobile phone, a tablet computer, a personal computer and other devices.
  • Step 201 The first electronic device divides the N frames of the original image in the animation into M pixel blocks in the same manner.
  • the first electronic device divides the first frame image, the second frame image, and the third frame image in the animation into 24 pixel blocks in the same manner, in which pixels in different frame images
  • the position of the block is the same, for example, the coordinate position of the pixel block A of the first frame is the same as the coordinate position of the pixel block a2 of the second frame, and the coordinate position of the pixel block a3 of the third frame, the pixel block B of the first frame It is the same as the coordinate position of the pixel block b2 of the second frame, and the same as the coordinate position of the pixel block b3 of the third frame, and so on.
  • the index value of the pixel block A of the first frame is the same as the index value of the pixel block a2 of the second frame, and the same as the index value of the pixel block a3 of the third frame.
  • Step 202 The first electronic device writes the M pixel blocks of the first frame of the original image in the N frames of the original image into the merged image.
  • M pixel blocks are all pixel blocks of the original image of the first frame.
  • the 24 pixel blocks in the first frame image in FIG. 8 are written into the merged image.
  • Step 203 The first electronic device performs the following operations on the K-th frame original image, which is any one of the remaining N-1 frame original images:
  • the second pixel block in the original image of the Kth frame is different from all pixel blocks in the current latest merged image, the second pixel block is written into the current latest merged image, otherwise, the The second pixel block is written into the current latest merged image.
  • the first electronic device first traverses the 24 pixel blocks a2 to x2 in the second frame image in sequence, where the pixel block a2 is the same as the pixel block A of the first frame image, and the pixel block b2 is The pixel block B of one frame image is different, the first electronic device writes the pixel block b2 into the merged image, the pixel block c2 is the same as the pixel block C of the first frame image, and the pixel block d2 is the same as the pixel block D of the first frame image The same, and so on, until the pixel block x2 is the same as the pixel block X of the first frame image.
  • the first electronic device writes b2, g2, and i2 of the second frame image into the merged image.
  • the first electronic device again traverses the 24 pixel blocks a3 to x3 in the third frame image, where the pixel block a3 is the same as the pixel block a2 of the second frame image, and the pixel block b3 is the same as the pixel block of the second frame image Unlike b2, the first electronic device writes the pixel block b3 into the merged image, the pixel block c3 is the same as the pixel block c2 of the second frame image, the pixel block d3 is the same as the pixel block d2 of the second frame image, and so on, until The pixel block x3 is the same as the pixel block x2 of the second frame image.
  • the first electronic device writes b3, g3, i3, j3, o3, and r3 of the third frame image into the combined image.
  • the merged image finally generated in this way as shown in FIG. 8, the pixel blocks in the merged image include A to X of the first frame image, and b2, g2, and i2 of the second frame image, and b3, g3 of the third frame image , I3, j3, o3, and r3.
  • the N-frame original images in the images of the embodiments of the present application may be various types of images, such as RGB images; YUV images, RGBA images, and YUVA images.
  • RGB images include: red R component, green G component and blue B component.
  • the RGBA image includes a red R component, a green G component, a blue B component, and a transparency A component.
  • YUV images include: luminance Y component, color difference U component and color difference V component.
  • YUVA images include: luminance Y component, color difference U component, color difference V component and transparency A component.
  • each component represents a data value (also called component value) of a certain dimension of a pixel, and these component groups constitute pixel values
  • the first electronic device in this embodiment of the present application performs pixel values of different pixel blocks In comparison, if the pixel value of any one or more of the components is different, the pixel block is different.
  • Step 204 The first electronic device generates a configuration file, the configuration file includes: the correspondence between the serial number of each pixel block in the merged image generated last and the serial number of the original image, and each pixel block in the merged image generated last The position information in the corresponding original image.
  • the first electronic device assigns an index value to the position of each pixel block, as shown in FIG. 8, from upper left to lower right, the index values are (1,1), (1,2) ⁇ ( 1, 4), (2, 1), (2, 2) ⁇ (2, 4), until the last (6, 4).
  • the index value of the position of the pixel block b2 is (2, 2)
  • the index value of the position of the pixel block g2 is (2, 3)
  • the index value of the position of the pixel block i2 is (3, 1).
  • the configuration file finally generated by the first electronic device includes: the correspondence between each pixel block in the merged image in FIG.
  • the configuration file includes: the pixel block A in the merged image in FIG. 8 corresponds to the first frame image, the second frame image, and the third frame image, and the pixel block A corresponds to the pixel A of the first frame image
  • the index value of pixel A corresponds to the index value of the pixel block a2 of the second frame image
  • the pixel block A corresponds to the index value of the pixel block a3 of the third frame image.
  • the pixel block B corresponds to the index value of the pixel B of the first frame image, and so on, until the pixel block r3 in the merged image in FIG. 8 corresponds to the third frame image, and The pixel block r3 corresponds to the index value of the pixel r3 of the third frame image.
  • the first electronic device when the first electronic device is a personal computer, the first electronic device may directly send the finally generated merged image and configuration file to the second electronic device, or may receive the second electronic device ’s When the request is invoked, the finally generated merged image and configuration file are sent to the second electronic device, so that the second electronic device restores the animation.
  • the first electronic device is a mobile phone or a tablet computer
  • the first electronic device can process the animation shared with the second electronic device into a merged image and configuration file according to the above method, and send the resulting merged image and configuration file to the first Two electronic devices to save the ROM space of the second electronic device.
  • the pixel block generated by the first electronic device may be a rectangular block, and the size of the pixel block of different animations may be adjusted as needed, that is, the size of the pixel block should be dynamically configured by the first electronic device
  • the first electronic device can dynamically adjust the pixel block size to divide the sequence frame image, so that the entire system can obtain the best gain for the sequence frame processing.
  • the smaller the pixel block the higher the accuracy of the comparison; the smaller the pixel block, the greater the number of pixel blocks divided by the entire image, resulting in more configuration information used to describe the correspondence, which increases the configuration file. Large, relatively lower comprehensive income.
  • the first electronic device needs to keep the accuracy as well as the amount of configuration information describing the corresponding relationship as small as possible.
  • the amount of configuration information describing the correspondence is called "cost”
  • the factors that affect the "cost” are the resolution of the sequence frame image, the similarity between the sequence frames, the number of frames, etc. According to these parameters, calculations can be found
  • the optimal value of a pixel block size is given.
  • the configuration file includes the image width, height, pixel block size, animation frames and other information.
  • the M pixel blocks in a frame of image may be the same size or different sizes.
  • the resolution of the sequence frame image is W * H
  • the W / N or H / N calculation result is not an integer, according to the segmentation rule, there will be ⁇ 1 * N ⁇ W (or ⁇ 2 * N ⁇ H), that is, after the pixel blocks are rearranged, the total width is less than the sequence Frame image width (or total height is less than sequence frame image height).
  • the configuration file generated in this embodiment of the present application is generally in JSON format. In addition, it can also be in JSON, XML and other formats. Developers can also design their own format to maintain a sufficient compression ratio of the configuration file.
  • the configuration file and the merged image can be sent to the second electronic device and stored on the second electronic device, or the configuration file can be saved on the first electronic device.
  • the electronic device sends a request to obtain the configuration file and the finally generated merged image from the first electronic device. Relatively speaking, storing the configuration file and the merged image on the first electronic device can minimize the occupation of the ROM space of the second electronic device.
  • the merged image generated by the first electronic device will be larger, which will directly cause the second electronic device to When restoring an animation, it takes a long time to load the merged image for the first time, which affects the animation playback effect.
  • the first electronic device can generate a multi-frame merged image, each frame of the merged image contains part of the pixel block, so that when the second electronic device initially plays the animation, it only needs to load part of the merged image to complete the initial animation playback.
  • the second electronic device may continuously load the subsequent merged images of the remaining frames. Since the ROM space occupied by a single merged image becomes smaller, the time taken for the second electronic device to load into the memory will be reduced, thereby improving the animation loading efficiency.
  • the first electronic device is a PC
  • FIG. 10 a flow of a second image processing method provided by an embodiment of the present application is exemplarily shown, and the method is executed by the second electronic device side.
  • Step 301 Obtain a configuration file and a finally generated merged image from the first electronic device, the configuration file includes: a first correspondence between the serial number of each pixel block in the final generated merged image and the serial number of the original image, and the final generation The second correspondence between each pixel block in the merged image and the position information of the corresponding original image.
  • Step 302 According to the first correspondence, determine N sets of M target pixel blocks corresponding to the sequence number of the N frames of original images from the finally generated merged image.
  • Step 303 Determine the position information of each group of M target pixel blocks in the corresponding original image according to the second correspondence.
  • step 304 the M target pixel blocks of each group are arranged and combined according to the position information to generate the N frames of original images, and the animation is restored according to the N frames of original images.
  • the second electronic device first obtains the merged image in FIG. 8 and the configuration file corresponding to the merged image from the first electronic device. Then, according to the first correspondence in the configuration file, the second electronic device determines that the pixel blocks corresponding to the first frame image include pixel block A to pixel block X from the merged image, and determines the second frame from the merged image
  • the pixel blocks corresponding to the image include pixel block A, pixel block b2, pixel block C, pixel block D to pixel block f, pixel block g2, and pixel block H to pixel block X.
  • the second electronic device determines that the pixel blocks corresponding to the first frame image have pixel block A to pixel block X position information in the first frame image, for example, the index values are in order: (1,1), (1,2) to (1,4), (2,1), (2,2) to (2,4). And the position information of the 24 pixel blocks corresponding to the second frame image in the second frame image is determined, and so on until the position information of the 24 pixel blocks corresponding to the third frame image in the third frame image is determined.
  • the second electronic device arranges and combines the first frame image, the second frame image and the third frame image according to the position information, so that the animation is finally restored according to the first frame image, the second frame image and the third frame image .
  • the second electronic device can restore the images from frame 1 to frame 10 shown in FIG. 4, and finally restore the image shown in FIG. 4 Fingerprint animation consisting of 10 frames of images.
  • the second electronic device may store the restored 10-frame image in a random access memory (Random Access Memory, RAM).
  • FIG. 11 an exemplary flowchart of a third image processing method provided by an embodiment of the present application is shown. The method is executed by a first electronic device.
  • step 401 N frames of the original image in the animation are divided into M pixel blocks in the same manner.
  • the first electronic device divides the first frame image, the second frame image, the third frame image, and the fourth frame image in the animation into 24 pixel blocks in the same manner.
  • Step 402 Write M pixel blocks of any one frame of the original images in the N frames of original images into the merged image.
  • 24 pixel blocks in the first frame image in FIG. 12 are written into the merged image.
  • Step 403 Traverse the remaining N-1 frames of original images, and perform a setting operation on each original image in the N-1 frames of original images.
  • the setting operation includes:
  • the first pixel block in the first image Traverse the first pixel block in the first image, and when the first pixel block in the first image is different from all the pixel blocks in the merged image, the first pixel block is written to the merged In the image, otherwise, the first pixel block is not written into the merged image.
  • the second pixel block in the first image is different from all pixel blocks in the current latest merged image, the second pixel block is written into the current latest merged image, otherwise, the The second pixel block is written into the current latest merged image. Return to the traversal and execute the third pixel block in the first image until all the M pixel blocks in the first image are traversed.
  • the M pixel blocks in the third image in the N-1 frame original image are returned to execution until the traversal of all images in the N-1 frame original image is completed.
  • the first electronic device first traverses the 24 pixel blocks a2 to x2 in the second frame image in sequence. Among them, the first electronic device compares the pixel block a2 with the pixel block A of the current merged image. An electronic device does not write the pixel block a2 into the merged image, and records this information in the configuration file (the pixel block a2 in the second frame image is the same as the pixel block A of the current latest merged image); the first electronic device compares The pixel block b2 is different from all pixel blocks of the current merged image.
  • the first electronic device writes the pixel block b2 into the merged image, and records the position information of the pixel block b2 in the second frame image in the merged image in the configuration file
  • the current latest merged image also includes the pixel block b2; the first electronic device compares the pixel block c2 with the pixel block C of the current merged image, the first electronic device does not
  • the pixel block c2 is written to the merged image, and this information is recorded in the configuration file (the pixel block c2 in the second frame image is the same as the pixel block C of the current latest merged image), and so on, until An electronic device compares x2 with the pixel block X of the current latest merged image.
  • the first electronic device does not write the pixel block x2 into the merged image, and records this information in the configuration file (pixel block x2 in the second frame image Same as the pixel block X of the current latest merged image).
  • the first electronic device again sequentially traverses the 24 pixel blocks a3 to x3 in the third frame image and the 24 pixel blocks a4 to x4 in the fourth frame image.
  • the specific processing method is similar to that of the second frame image, and will not be repeated here.
  • the merged image finally generated by the first electronic device is shown in FIG. 13, in addition to all the pixel blocks of the first frame image, the merged image also includes pixel block b2, pixel block g2, pixel block i2, pixel block g34, pixels Block r4.
  • a configuration file is generated, the configuration file includes: the correspondence between the serial number of each pixel block in the last generated merged image and the serial number of the original image, and the corresponding original Location information in the image.
  • the first electronic device assigns an index value to the position of each pixel block in the newly generated merged image and the four frames of the original image, as shown in FIG. 12, from the upper left to the lower right, the four frames of the original image
  • the index value of each pixel block is (1,1), (1,2) ⁇ (1,4), (2,1), (2,2) ⁇ (2,4), until the last one (6 , 4).
  • the index value of the position of the pixel block b2 is (2, 2)
  • the index value of the position of the pixel block g2 is (2, 3)
  • the index value of the position of the pixel block i2 is (3, 1).
  • the configuration file finally generated by the first electronic device includes: the correspondence between each pixel block in the merged image finally generated in FIG. 13 and the first frame image, second frame image, third frame image, and fourth frame image, And the index value of each pixel block in the image corresponding to it.
  • the configuration file includes: the pixel block A in the merged image in FIG.
  • the pixel block A corresponds to the first frame image, the second frame image, the third frame image, and the fourth frame image
  • the pixel block A corresponds to the first
  • the index value of the pixel A of the frame image the pixel A corresponds to the index value of the pixel block a2 of the second frame image
  • the pixel block A corresponds to the index value of the pixel block a3 of the third frame image
  • the pixel block A corresponds to Is the index value of the pixel block a4 of the fourth frame image.
  • the pixel block B corresponds to the index value of the pixel B of the first frame image and the corresponding Is the index value of the pixel b3 of the third frame image, and the corresponding index value of the fourth frame image b4, and so on, until the pixel block X4 in the merged image in FIG.
  • the pixel block x4 corresponds to the index value of the pixel X of the first frame image, the index value of the pixel x2 of the second frame image, and the index value of the third frame image The index value of the pixel x3 and the index value of the pixel x4 of the fourth frame image.
  • the first electronic device may directly send the finally generated merged image and configuration file to the second electronic device, or may receive the finally generated merged image when receiving the call request of the second electronic device And the configuration file are sent to the second electronic device, so that the second electronic device restores the animation.
  • the first electronic device can select all the pixel blocks of any one frame image from the four-frame image to write to the merged image. In addition to the first electronic device can select the pixel blocks of the frame image For comparison of all pixel blocks, you can also choose to compare the pixel blocks of the frame image with all the pixel blocks in the frame image that has been compared. In comparison, the first electronic device chooses to compare the pixel blocks of the frame image with the latest generated Comparing all the pixel blocks in the merged image can reduce the number of comparisons, and can also realize that the same pixel block does not exist in the resulting merged image, which can minimize the ROM space occupied by the merged image.
  • the first electronic device may directly send the finally generated merged image and configuration file to the second electronic device, or may receive the finally generated merged image when receiving the call request of the second electronic device And the configuration file are sent to the second electronic device, so that the second electronic device restores the animation.
  • step 401 the manner in which the first electronic device divides the generated pixel block and the format of the configuration file are the same as the implementation of the first method, and details are not described herein again.
  • the merged image generated by the first electronic device will be larger, which will directly cause the second electronic device to When restoring an animation, it takes a long time to load the merged image for the first time, which affects the animation playback effect.
  • the first electronic device can generate a multi-frame merged image, each frame of the merged image contains part of the pixel block, so that when the second electronic device initially plays the animation, it only needs to load part of the merged image to complete the initial animation playback.
  • the second electronic device may continuously load the subsequent merged images of the remaining frames. Since the ROM space occupied by a single merged image becomes smaller, the time taken for the second electronic device to load into the memory will be reduced, thereby improving the animation loading efficiency.
  • the process of restoring animation is as shown in FIG. 10, and the flow of the second image processing method is the same, which will not be repeated here.
  • FIG. 14 an exemplary flow of a fourth image processing method provided by an embodiment of the present application is exemplarily shown, and the method is executed by a first electronic device.
  • Step 501 Divide N original images in the animation into M pixel blocks in the same manner.
  • Step 502 Write M pixel blocks of the first image into the merged image, where the first image is any one of the original images of the N original images.
  • the first image is the first frame image in FIG. 12, and the first electronic device writes the 24 pixel blocks in the first frame image in FIG. 12 into the merged image.
  • Step 503 traverse the remaining N-1 frames of the original image, and perform a setting operation on each original image in the N-1 frames of the original image.
  • the setting operation includes:
  • the first pixel block in the second image is different from all the pixel blocks in the first image, the first pixel block is written to the merged image , Otherwise, the first pixel block is not written into the merged image.
  • the second pixel block in the second image is different from all pixel blocks in the first image, the second pixel block is written into the current latest merged image, otherwise, the second pixel block is not written Write to the current latest merged image. Return to traverse to execute the third pixel block in the second image until all the M pixel blocks in the second image are traversed.
  • the fourth pixel block in the third image in the original image of the N-1 frame is executed, when the fourth pixel block in the third image and all the pixel blocks in the first image sum
  • the fourth pixel block is written into the current latest merged image; otherwise, the fourth pixel block is not written into the current latest merged image; return to execution
  • the fifth pixel block in the third image is traversed until all the M pixel blocks in the third image are traversed.
  • the M pixel blocks in the fourth image in the original image of the N-1 frame are returned to be executed until the traversal of all images in the original image of the N-1 frame is completed.
  • the first electronic device first traverses the 24 pixel blocks a2 to x2 in the second frame image in sequence, where the first electronic device compares whether the pixel block a2 is the same as all pixel blocks in the first frame image , It is determined that the pixel block a2 is the same as the pixel block A of the first frame image, the first electronic device does not write the pixel block a2 to the merged image, and records this information in the configuration file (the pixel block a2 in the second frame image Same as the pixel block A of the first frame image); the first electronic device compares the pixel block b2 with all the pixel blocks of the pixel block of the first frame image, and the first electronic device writes the pixel block b2 into the merged image And record the position information of the pixel block b2 in the second frame image in the merged image in the configuration file.
  • the current latest merged image includes the pixel block b2 in addition to all the pixel blocks of the first frame image; the first electronic The device compares the pixel block c2 with all the pixel blocks of the first frame image, and determines that the pixel block c2 is the same as the pixel block C of the first frame image.
  • the first electronic device does not write the pixel block c2 into the merged image, and Match The file records this information (the pixel block c2 in the second frame image is the same as the pixel block C in the first frame image), and so on, until the first electronic device compares x2 with the pixel block X in the first frame image, the first The electronic device does not write the pixel block x2 into the merged image, and records this information in the configuration file (the pixel block x2 in the second frame image is the same as the pixel block X in the first frame image).
  • the first electronic device again traverses the 24 pixel blocks a3 to x3 in the third frame image in sequence, wherein the first electronic device compares the pixel block a2 with all pixel blocks of the first frame image and the second frame image The same, it is determined that the pixel block a3 is the same as the pixel block A (or pixel block a2) of the first frame image, the first electronic device does not write the pixel block a3 into the merged image, and records this information in the configuration file (third The pixel block a3 in the frame image is the same as the pixel block A of the first frame image); the first electronic device compares the pixel block b3 with all pixels of the first frame image and the second frame image, and the pixel block b3 and the second frame The pixel block b2 in the image is the same, the first electronic device does not write the pixel block b3 to the merged image, and records this information in the configuration file (the pixel block b3 in the third frame image and the pixel block B in the
  • the merged image finally generated by the first electronic device is shown in FIG. 15, in addition to all the pixel blocks of the first frame image, the merged image also includes pixel block b2, pixel block g2, pixel block i2, pixel block g3, pixels Block i3, pixel block r4.
  • Step 404 the first electronic device generates a configuration file
  • the configuration file includes: the correspondence between the serial number of each pixel block in the merged image generated last and the serial number of the original image, and each pixel block in the merged image generated last The position information in the corresponding original image.
  • the first electronic device assigns an index value to the position of each pixel block in the newly generated merged image and the four frames of the original image, as shown in FIG. 12, from the upper left to the lower right, the four frames of the original image
  • the index value of each pixel block is (1,1), (1,2) ⁇ (1,4), (2,1), (2,2) ⁇ (2,4), until the last one (6 , 4).
  • the index value of the position of the pixel block b2 is (2, 2)
  • the index value of the position of the pixel block g2 is (2, 3)
  • the index value of the position of the pixel block i2 is (3, 1).
  • the configuration file finally generated by the first electronic device includes: the correspondence between each pixel block in the merged image finally generated in FIG. 15 and the first frame image, second frame image, third frame image, and fourth frame image, And the index value of each pixel block in the image corresponding to it.
  • the configuration file includes: the pixel block A in the merged image in FIG.
  • the pixel block A corresponds to the first The index value of the pixel A of the frame image, the pixel A corresponds to the index value of the pixel block a2 of the second frame image, and the pixel block A corresponds to the index value of the pixel block a3 of the third frame image, and the pixel block A corresponds to Is the index value of the pixel block a4 of the fourth frame image.
  • the pixel block B corresponds to the index value of the pixel B of the first frame image and the corresponding Is the index value of the pixel b3 of the third frame image, and the corresponding index value of the fourth frame image b4, and so on, until the pixel block X4 in the merged image in FIG.
  • the pixel block x4 corresponds to the index value of the pixel X of the first frame image, the index value of the pixel x2 of the second frame image, and the index value of the third frame image The index value of the pixel x3 and the index value of the pixel x4 of the fourth frame image.
  • the first electronic device may directly send the finally generated merged image and configuration file to the second electronic device, or may receive the finally generated merged image when receiving the call request of the second electronic device And the configuration file are sent to the second electronic device, so that the second electronic device restores the animation.
  • the first electronic device can select all the pixel blocks of any one frame image from the four-frame image to write to the merged image. In addition to the first electronic device can select the pixel blocks of the frame image and the latest generated merged image For comparison of all pixel blocks, you can also choose to compare the pixel blocks of the frame image with all the pixel blocks in the frame image that has been compared. In comparison, the first electronic device chooses to compare the pixel blocks of the frame image with the latest generated Comparing all the pixel blocks in the merged image can reduce the number of comparisons, and can also realize that the same pixel block does not exist in the resulting merged image, which can minimize the ROM space occupied by the merged image.
  • the first electronic device may directly send the finally generated merged image and configuration file to the second electronic device, or may receive the finally generated merged image when receiving the call request of the second electronic device And the configuration file are sent to the second electronic device, so that the second electronic device restores the animation.
  • step 501 the manner in which the first electronic device divides the generated pixel block and the format of the configuration file are the same as the implementation of the first method, and details are not described herein again.
  • this embodiment can reduce the size of the merged image to a certain extent, but compared to the second method of the embodiment of the present application, and there may be the same in the merged image Compared with pixel blocks, the combined image generated by the second method occupies the smallest ROM and saves the most space.
  • An embodiment of the present application also provides an image processing system, which is composed of a first electronic device and a second electronic device, as shown in FIG. 16, wherein the first electronic device includes an image merging module 601, and the second electronic device includes a sequence Frame restoration module 602 and animation playback module 603.
  • the merging module 601 is used to process the sequence image of the animation into a merged image and a configuration file according to the first image processing method, the third image processing method, or the fourth image processing method provided in the embodiments of the present application.
  • the sequence frame restoration module 602 is configured to restore multiple frames of original images according to the second image processing method provided in the embodiments of the present application, according to the merged image and the configuration file.
  • the animation playing module 603 is used to read the multi-frame original images output by the sequence frame restoration module 602, and encapsulate the multi-frame original images into a sequence frame animation according to requirements.
  • the second electronic device only needs the configuration file and the merged image to restore the animation. Compared with the prior art, the sequence frame is directly played by polling, and the occupied ROM space is significantly reduced.
  • sequence frame restoration module 602 and the playback processing module 603 can be executed in order, that is, the sequence frame restoration module 602 first restores all sequence frames, and the playback processing module 603 then uses the traditional sequence frame technology to process the sequence frame animation,
  • the sequence frame restoration module 602 can also be executed synchronously with the playback processing module 603.
  • Each time the sequence frame restoration module 602 restores a frame it is output to the playback processing module 603, because the two modules can operate synchronously, which can avoid
  • the "sequence frame restoration module" has a long processing time, and the problem of waiting for animation playback occurs, and the interactivity is more friendly.
  • the image processing method provided in the embodiments of the present application can be applied to all scenes involving sequence frame animation playback in a mobile phone. Using this technology can save a lot of ROM space for the mobile phone, and the saved space is convenient for the system to run other important functions.
  • An embodiment of the present application also provides a computer-readable storage medium.
  • the computer-readable storage medium includes a computer program.
  • the computer program runs on an electronic device, the electronic device may perform any one of the foregoing information processing methods. Implementation.
  • An embodiment of the present application further provides a computer program product that, when the computer program product runs on an electronic device, causes the electronic device to execute any possible implementation of the above-mentioned information processing method.
  • the embodiments of the present application disclose a first electronic device.
  • the first electronic device may include: a processor 701; a memory 702; and one or more computers In program 703, the above devices may be connected through one or more communication buses 704.
  • the one or more computer programs 703 are stored in the above-mentioned memory 702 and configured to be executed by the processor 701, the one or more computer programs 703 include instructions, and the above-mentioned instructions may be used to execute as shown in FIG. 7, FIG. 11 and Figure 14 shows the steps in the corresponding embodiment.
  • the processor 701 is used to perform step 201 and step 204 in FIG. 7, the processor 701 is used to perform step 401 and step 404 in FIG. 11, and the processor 701 is used to perform step 501 and step 504 in FIG. .
  • the merged image and configuration file generated by the processor 701 are stored in the memory 702.
  • the functional units in the embodiments of the present application may be integrated into one processing unit, or each unit may exist alone physically, or two or more units are integrated into one unit.
  • the above integrated unit may be implemented in the form of hardware or software functional unit.
  • the integrated unit may be stored in a computer-readable storage medium.
  • the technical solutions of the embodiments of the present application may essentially be part of or contribute to the existing technology, or all or part of the technical solutions may be embodied in the form of software products, and the computer software products are stored in a storage
  • the medium includes several instructions to enable a computer device (which may be a personal computer, a first electronic device, or a network device, etc.) or a processor to perform all or part of the steps of the methods described in the embodiments of the present application.
  • the foregoing storage media include: flash memory, mobile hard disk, read-only memory, random access memory, magnetic disk or optical disk and other media that can store program codes.

Landscapes

  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • User Interface Of Digital Computer (AREA)
  • Controls And Circuits For Display Device (AREA)
  • Processing Or Creating Images (AREA)

Abstract

An image processing method and an electronic device. Said method comprises: a first electronic device dividing N frames of original image in an animation into M pixel blocks in the same manner; then writing the M pixel blocks of the first frame of original image in said N frames of original image into a combined image; with regard to the Kth frame of original image, the Kth frame of original image being any one of the remaining N-1 frames of original image, performing the following operations: traversing each pixel block in the Kth frame of original image, and when a pixel block is different from the pixel block in the previous frame at the same position, writing the pixel block into the combined image, otherwise, not writing the first pixel block into the combined image, finally generating a configuration file, and then sending the configuration file and the combined image to a second electronic device, so that the second electronic device restores the animation. The method saves the ROM space of the second electronic device.

Description

一种图像处理方法及电子设备Image processing method and electronic equipment
本申请要求于2018年11月06日提交中国国家知识产权局,申请号为CN201811315321.5、发明名称为“一种图像处理方法及电子设备”的中国专利申请,其全部内容通过引用结合在本申请中。This application requires a Chinese patent application submitted to the State Intellectual Property Office of China on November 06, 2018 with the application number CN201811315321.5 and the invention titled "An Image Processing Method and Electronic Equipment", the entire contents of which are incorporated herein by reference Applying.
技术领域Technical field
本申请涉及终端技术领域,尤其涉及一种图像处理方法及电子设备。This application relates to the field of terminal technology, and in particular, to an image processing method and an electronic device.
背景技术Background technique
近年来,随着电子产业和通信技术的飞速发展,目前智能家庭设备越来越多,例如手机,智能音箱、智能手环等,人们的生活变得越来越智能化。由于手机的便携性,且可以从应用商店上下载各种功能的应用软件,所以手机已经成为人们日常生活中必不可少的必备品。In recent years, with the rapid development of the electronics industry and communication technology, there are more and more smart home devices, such as mobile phones, smart speakers, smart bracelets, etc., and people's lives have become more and more intelligent. Due to the portability of the mobile phone and the application software with various functions can be downloaded from the application store, the mobile phone has become an indispensable necessity in people's daily lives.
随着手机的操作***提供的功能不断丰富,为提升用户体验,在很多场景都会加入引导动画来辅助用户使用其功能。现有技术领域内,对于路径复杂、细节丰富的引导动画,使用序列帧动画是最简单、最直接的实现方式,但一般的序列帧动画会包含的图像可能是几帧到几十帧不等,而手机的操作***内的引导动画又会有成百上千;最后导致操作***内文件数量急速上升,占用终端的ROM空间较大。As the functions provided by the mobile phone's operating system continue to be enriched, in order to enhance the user experience, guide animations will be added in many scenarios to assist users in using their functions. In the existing technical field, the use of sequence frame animation is the simplest and most direct way to implement a guide animation with complex paths and rich details, but the general sequence frame animation may contain images ranging from several frames to tens of frames. However, there will be hundreds or thousands of boot animations in the operating system of the mobile phone; finally, the number of files in the operating system will rise rapidly, occupying a large amount of ROM space on the terminal.
发明内容Summary of the invention
本申请提供一种图像处理方法及电子设备,用以实现降低ROM占用、减少文件总数量的收益。The present application provides an image processing method and an electronic device to realize the benefits of reducing ROM occupation and reducing the total number of files.
第一方面,本申请实施例提供了一种图像处理方法,所述方法适用于第一电子设备,该方法包括:将动画中的N帧原始图像按照相同的方式均划分成M个像素块;In a first aspect, an embodiment of the present application provides an image processing method that is applicable to a first electronic device. The method includes: dividing N frames of original images in an animation into M pixel blocks in the same manner;
将所述N帧原始图像中的第一帧原始图像的M个像素块写入到合并图像中;Writing M pixel blocks of the first frame of the original image in the N frames of the original image into the merged image;
针对第K帧原始图像,所述第K帧原始图像为其余N-1帧原始图像中的任意一帧原始图像,执行如下操作:For the Kth frame original image, the Kth frame original image is any one of the remaining N-1 frame original images, perform the following operations:
遍历第K帧原始图像中的第一像素块,当所述第K帧原始图像中的第一像素块与第K-1帧原始图像中的相同位置的像素块不同时,则将所述第一像素块写入所述合并图像中,否则,不将所述第一像素块写入所述合并图像中。Traverse the first pixel block in the original image of the Kth frame, when the first pixel block in the original image of the Kth frame is different from the pixel block at the same position in the original image of the K-1th frame, the One pixel block is written into the merged image, otherwise, the first pixel block is not written into the merged image.
当所述第K帧原始图像中的第二像素块与当前最新的合并图像中的所有像素块均不同时,则将所述第二像素块写入当前最新的合并图像中,否则,不将所述第二像素块写入当前最新的合并图像中。When the second pixel block in the original image of the Kth frame is different from all pixel blocks in the current latest merged image, the second pixel block is written into the current latest merged image, otherwise, the The second pixel block is written into the current latest merged image.
返回遍历执行所述第K帧原始图像中的第三像素块,直至第K帧原始图像中的M个像素块全部遍历完成;其中,K为大于1的正整数。Go back and execute the third pixel block in the original image of the Kth frame until all M pixel blocks in the original image of the Kth frame are traversed; wherein, K is a positive integer greater than 1.
生成配置文件,所述配置文件包括:最终生成的合并图像中每个像素块的序号与原始图像的序号的第一对应关系,以及最终生成的合并图像中每个像素块与所对应的原始图像中的位置信息之间的第二对应关系。Generating a configuration file, the configuration file including: a first correspondence between the serial number of each pixel block in the finally generated merged image and the serial number of the original image, and each pixel block in the finally generated merged image and the corresponding original image The second correspondence between the location information in.
本申请实施例中,第一电子设备通过比较序列帧图像中的前后帧图像中的像素块是否相 同,滤除前后帧中相同的像素块,仅将不同的像素块保存在合并图像中,这样,第二电子设备从第一电子设备获取配置文件和合并图像,相对来说,合并图像和配置文件占用ROM变少,可以节省一定的ROM空间。In the embodiment of the present application, the first electronic device compares whether the pixel blocks in the front and back frame images in the sequence frame image are the same, filters out the same pixel blocks in the front and back frames, and only saves different pixel blocks in the merged image The second electronic device acquires the configuration file and the merged image from the first electronic device. Relatively speaking, the merged image and the configuration file occupy less ROM, which can save a certain amount of ROM space.
在一种可能的设计中,在生成配置文件之后,第一电子设备将所述配置文件和所述最终生成的合并图像发送至第二电子设备。In a possible design, after generating the configuration file, the first electronic device sends the configuration file and the finally generated combined image to the second electronic device.
第二方面,本申请实施例提供了一种图像处理方法,所述方法适用于第一电子设备,该方法包括:将动画中的N帧原始图像按照相同的方式均划分成M个像素块;In a second aspect, an embodiment of the present application provides an image processing method that is applicable to a first electronic device. The method includes: dividing N frames of original images in an animation into M pixel blocks in the same manner;
将所述N帧原始图像中的任意一帧原始图像的M个像素块写入到合并图像中;Writing M pixel blocks of any one frame of the original images of the N frames of original images into the merged image;
针对所述N-1帧原始图像中的各个图像执行设定操作,所述设定操作包括:A setting operation is performed for each image in the original image of the N-1 frame, and the setting operation includes:
遍历第一图像中的第一像素块,当所述第一图像中的第一像素块与所述合并图像中的所有像素块均不同时,则将所述第一像素块写入所述合并图像中,否则,不将所述第一像素块写入所述合并图像中。Traverse the first pixel block in the first image, and when the first pixel block in the first image is different from all the pixel blocks in the merged image, the first pixel block is written to the merged In the image, otherwise, the first pixel block is not written into the merged image.
当所述第一图像中的第二像素块与当前最新的合并图像中的所有像素块均不同时,则将所述第二像素块写入当前最新的合并图像中,否则,不将所述第二像素块写入当前最新的合并图像中。When the second pixel block in the first image is different from all pixel blocks in the current latest merged image, the second pixel block is written into the current latest merged image, otherwise, the The second pixel block is written into the current latest merged image.
返回遍历执行所述第一图像中的第三像素块,直至第一图像中的M个像素块全部遍历完成;Return to traverse and execute the third pixel block in the first image until all the M pixel blocks in the first image are traversed;
按照所述设定操作返回执行所述N-1帧原始图像中的第二图像中的第四像素块,当所述第二图像中的第四像素块与当前最新的合并图像中的所有像素块均不同时,则将所述第四像素块写入当前最新的合并图像中,否则,不将所述第四像素块写入当前最新的合并图像中。返回执行所述第二图像中的第五像素块,直至第二图像中的M个像素块全部遍历完成。According to the setting operation, return to execute the fourth pixel block in the second image in the original image of the N-1 frame, when the fourth pixel block in the second image and all the pixels in the current latest merged image When the blocks are different, the fourth pixel block is written into the current latest merged image; otherwise, the fourth pixel block is not written into the current latest merged image. Return to execute the fifth pixel block in the second image until the traversal of all M pixel blocks in the second image is completed.
按照所述设定操作返回执行所述N-1帧原始图像中的第三图像中的M个像素块,直至N-1帧原始图像中的所有图像遍历完成。According to the setting operation, the M pixel blocks in the third image in the N-1 frame original image are returned to execution until the traversal of all images in the N-1 frame original image is completed.
生成配置文件,所述配置文件包括:最后生成的合并图像中每个像素块的序号与原始图像的序号的对应关系,以及最后生成的合并图像中每个像素块在所对应的原始图像中的位置信息。Generate a configuration file, the configuration file includes: the correspondence between the serial number of each pixel block in the merged image generated last and the serial number of the original image, and each pixel block in the merged image generated last in the corresponding original image location information.
本申请实施例中,第一电子设备通过比较序列帧图像与最新生成的合并图像中的像素块是否相同,滤除前后帧中相同的像素块,仅将不同的像素块保存在合并图像中,这样,第二电子设备从第一电子设备获取配置文件和合并图像,相对来说,合并图像和配置文件占用ROM变少,可以节省一定的ROM空间。In the embodiment of the present application, the first electronic device compares whether the pixel blocks in the sequence frame image and the newly generated merged image are the same, filters out the same pixel blocks in the before and after frames, and only saves different pixel blocks in the merged image, In this way, the second electronic device acquires the configuration file and the merged image from the first electronic device. Relatively speaking, the merged image and the configuration file occupy less ROM, which can save a certain amount of ROM space.
第三方面,本申请实施例提供了一种图像处理方法,所述方法适用于第一电子设备,该方法包括:将动画中的N帧原始图像按照相同的方式均划分成M个像素块;In a third aspect, an embodiment of the present application provides an image processing method applicable to a first electronic device. The method includes: dividing N frames of original images in an animation into M pixel blocks in the same manner;
将第一图像的M个像素块写入到合并图像中,其中,第一图像为所述N帧原始图像中的任意一帧原始图像;Writing M pixel blocks of the first image into the merged image, where the first image is any one of the original images of the N original images;
针对所述N-1帧原始图像中的各个原始图像执行设定操作,所述设定操作包括:A setting operation is performed for each original image in the N-1 frame original images, the setting operation includes:
遍历第二图像中的第一像素块,当所述第二图像中的第一像素块与第一图像中的所有像素块均不同时,则将所述第一像素块写入所述合并图像中,否则,不将所述第一像素块写入所述合并图像中。Traverse the first pixel block in the second image, when the first pixel block in the second image is different from all the pixel blocks in the first image, the first pixel block is written to the merged image , Otherwise, the first pixel block is not written into the merged image.
当第二图像中的第二像素块与第一图像中的所有像素块均不同时,则将所述第二像素块写入当前最新的合并图像中,否则,不将所述第二像素块写入当前最新的合并图像中。返回遍历执行所述第二图像中的第三像素块,直至第二图像中的M个像素块全部遍历完成。When the second pixel block in the second image is different from all pixel blocks in the first image, the second pixel block is written into the current latest merged image, otherwise, the second pixel block is not written Write to the current latest merged image. Return to traverse to execute the third pixel block in the second image until all the M pixel blocks in the second image are traversed.
按照所述设定操作返回执行所述N-1帧原始图像中的第三图像中的第四像素块,当所述第三图像中的第四像素块与第一图像中的所有像素块和第二图像中的所有像素块均不同时,则将所述第四像素块写入当前最新的合并图像中,否则,不将所述第四像素块写入当前最新的合并图像中;返回执行所述第三图像中的第五像素块,直至第三图像中的M个像素块全部遍历完成。According to the setting operation, the fourth pixel block in the third image in the original image of the N-1 frame is executed, when the fourth pixel block in the third image and all the pixel blocks in the first image sum When all the pixel blocks in the second image are different, the fourth pixel block is written into the current latest merged image; otherwise, the fourth pixel block is not written into the current latest merged image; return to execution The fifth pixel block in the third image is traversed until all the M pixel blocks in the third image are traversed.
按照所述设定操作返回执行所述N-1帧原始图像中的第四图像中的M个像素块,直至N-1帧原始图像中的所有图像遍历完成;Return to execute M pixel blocks in the fourth image in the N-1 frame original image according to the setting operation until the traversal of all images in the N-1 frame original image is completed;
生成配置文件,所述配置文件包括:最后生成的合并图像中每个像素块的序号与原始图像的序号的对应关系,以及最后生成的合并图像中每个像素块在所对应的原始图像中的位置信息。Generate a configuration file, the configuration file includes: the correspondence between the serial number of each pixel block in the merged image generated last and the serial number of the original image, and each pixel block in the merged image generated last in the corresponding original image location information.
本申请实施例中,第一电子设备通过比较序列帧图像与已遍历完成的图像的所有的像素块是否相同,滤除前后帧中相同的像素块,仅将不同的像素块保存在合并图像中,这样,第二电子设备从第一电子设备获取配置文件和合并图像,相对来说,合并图像和配置文件占用ROM变少,可以节省一定的ROM空间。In the embodiment of the present application, the first electronic device compares whether all the pixel blocks of the sequence frame image and the traversed image are the same, filters out the same pixel blocks in the previous and subsequent frames, and only saves the different pixel blocks in the merged image In this way, the second electronic device obtains the configuration file and the merged image from the first electronic device. Relatively speaking, the merged image and the configuration file occupy less ROM, which can save a certain amount of ROM space.
第四方面,本申请实施例提供了一种图像处理方法,所述方法适用于第二电子设备,该方法包括:According to a fourth aspect, an embodiment of the present application provides an image processing method. The method is applicable to a second electronic device. The method includes:
从第一电子设备获取配置文件和最终生成的合并图像,所述配置文件包括:最终生成的合并图像中每个像素块的序号与原始图像的序号的第一对应关系,以及最终生成的合并图像中每个像素块与所对应的原始图像的位置信息之间的第二对应关系;Obtaining a configuration file and a finally generated merged image from the first electronic device, the configuration file including: a first correspondence between the serial number of each pixel block in the final generated merged image and the serial number of the original image, and the final generated merged image The second correspondence between each pixel block in the corresponding position information of the corresponding original image;
根据所述第一对应关系,从所述最终生成的合并图像中确定与N帧原始图像的序号相对应的N组M个目标像素块;According to the first correspondence, determine N sets of M target pixel blocks corresponding to the sequence number of the N frames of the original image from the finally generated merged image;
根据所述第二对应关系,确定所述每组M个目标像素块在对应的原始图像的位置信息;Determine the position information of each group of M target pixel blocks in the corresponding original image according to the second correspondence;
根据所述位置信息排列组合所述每组M个目标像素块,生成所述N帧原始图像,并根据所述N帧原始图像还原出动画。The M target pixel blocks of each group are arranged and combined according to the position information to generate the N frames of original images, and the animation is restored according to the N frames of original images.
本申请实施例中,第二电子设备通过配置文件和合并图像就可以还原出动画,合并图像和配置文件占用ROM变少,可以节省一定的ROM空间。In the embodiment of the present application, the second electronic device can restore the animation through the configuration file and the merged image, the combined image and the configuration file occupy less ROM, and a certain ROM space can be saved.
第五方面,本申请实施例提供一种第一电子设备,包括处理器和存储器。其中,存储器用于存储一个或多个计算机程序;当存储器存储的一个或多个计算机程序被处理器执行时,使得该电子设备能够实现上述任一方面的任意一种可能的设计的方法。According to a fifth aspect, an embodiment of the present application provides a first electronic device, including a processor and a memory. Wherein, the memory is used to store one or more computer programs; when the one or more computer programs stored in the memory are executed by the processor, the electronic device can implement any possible design method of any one of the above aspects.
第六方面,本申请实施例提供一种第二电子设备,包括处理器、只读存储器、随机存储器、触控面板、显示器;According to a sixth aspect, an embodiment of the present application provides a second electronic device, including a processor, a read-only memory, a random access memory, a touch panel, and a display;
所述处理器用于从第一电子设备获取配置文件和最终生成的合并图像;所述配置文件包括:最终生成的合并图像中每个像素块的序号与原始图像的序号的第一对应关系,以及最终生成的合并图像中每个像素块与所对应的原始图像中的位置信息之间的第二对应关系;The processor is used to obtain a configuration file and a finally generated merged image from the first electronic device; the configuration file includes: a first correspondence between the serial number of each pixel block in the finally generated merged image and the serial number of the original image, and The second correspondence between each pixel block in the finally generated merged image and the position information in the corresponding original image;
所述只读存储器用于存储一个或多个计算机程序,以及所述配置文件和最终生成的合并图像;The read-only memory is used to store one or more computer programs, as well as the configuration file and the resulting merged image;
当所述触控面板将检测到用户作用于播放动画的操作传送至显示器时,所述处理器根据所述第一对应关系,从所述最终生成的合并图像中确定与N帧原始图像的序号相对应的N组M个目标像素块;根据所述第二对应关系,确定所述每组M个目标像素块在对应的原始图像的位置信息;根据所述位置信息排列组合所述每组M个目标像素块,生成所述N帧原始图像,并根据所述N帧原始图像还原出动画;When the touch panel transmits the operation detected by the user to play the animation to the display, the processor determines the sequence number of the original image of the N frames from the finally generated merged image according to the first correspondence Corresponding N groups of M target pixel blocks; according to the second correspondence, determining position information of each group of M target pixel blocks in the corresponding original image; arranging and combining each group of M according to the position information Target pixel blocks, generate the original image of N frames, and restore the animation according to the original image of N frames;
所述随机存储器用于存储所述N帧原始图像和所述动画;所述显示器,用于显示所述动画。The random access memory is used to store the N frames of the original image and the animation; the display is used to display the animation.
第七方面,本申请实施例还提供一种装置,该装置包括执行上述任一方面的任意一种可能的设计的方法的模块/单元。这些模块/单元可以通过硬件实现,也可以通过硬件执行相应的软件实现。In a seventh aspect, an embodiment of the present application further provides an apparatus, the apparatus including a module / unit that executes any one of the possible design methods of any of the above aspects. These modules / units can be implemented by hardware, and can also be implemented by hardware executing corresponding software.
第八方面,本申请实施例中还提供一种计算机可读存储介质,所述计算机可读存储介质包括计算机程序,当计算机程序在电子设备上运行时,使得所述电子设备执行上述任一方面的任意一种可能的设计的方法。In an eighth aspect, a computer-readable storage medium is also provided in an embodiment of the present application. The computer-readable storage medium includes a computer program, and when the computer program runs on an electronic device, the electronic device performs any of the above aspects Any possible design method.
第九方面,本申请实施例还提供一种包含计算机程序产品,当所述计算机程序产品在电子设备上运行时,使得所述电子设备执行上述任一方面的任意一种可能的设计的方法。In a ninth aspect, an embodiment of the present application further provides a method that includes a computer program product that, when the computer program product runs on an electronic device, causes the electronic device to perform any possible design of any of the above aspects.
本申请的这些方面或其他方面在以下实施例的描述中会更加简明易懂。These or other aspects of the present application will be more concise and understandable in the description of the following embodiments.
附图说明BRIEF DESCRIPTION
图1为本申请实施例提供的一种互联场景示意图;1 is a schematic diagram of an interconnection scenario provided by an embodiment of this application;
图2为本申请实施例提供的一种手机的结构示意图;2 is a schematic structural diagram of a mobile phone provided by an embodiment of the present application;
图3为本申请实施例提供的安卓操作***结构示意图;3 is a schematic structural diagram of an Android operating system provided by an embodiment of this application;
图4为本申请实施例提供的一组指纹动画的帧图像示意图;4 is a schematic diagram of a set of frame images of fingerprint animation provided by an embodiment of the present application;
图5为本申请实施例提供的一组指纹动画差异像素块的示意图;FIG. 5 is a schematic diagram of a set of pixel blocks of fingerprint animation difference provided by an embodiment of the present application;
图6为本申请实施例提供的一种合并图像的示意图;6 is a schematic diagram of a merged image provided by an embodiment of this application;
图7为本申请实施例提供的一种图像处理方法示意图;7 is a schematic diagram of an image processing method provided by an embodiment of the present application;
图8为本申请实施例提供的一种序列帧图像比较方式示意图;8 is a schematic diagram of a sequence frame image comparison method provided by an embodiment of the present application;
图9为本申请实施例提供的一种序列帧图像划分方式示意图;9 is a schematic diagram of a sequence frame image division method provided by an embodiment of the present application;
图10为本申请实施例提供的另一种图像处理方法示意图;10 is a schematic diagram of another image processing method provided by an embodiment of the present application;
图11为本申请实施例提供的另一种图像处理方法示意图;11 is a schematic diagram of another image processing method provided by an embodiment of the present application;
图12为本申请实施例提供的另一种序列帧图像比较方式示意图;12 is a schematic diagram of another sequence frame image comparison method provided by an embodiment of the present application;
图13为本申请实施例提供的另一种合并图像的示意图;13 is a schematic diagram of another merged image provided by an embodiment of this application;
图14为本申请实施例提供的另一种图像处理方法示意图;14 is a schematic diagram of another image processing method provided by an embodiment of the present application;
图15为本申请实施例提供的另一种合并图像的示意图;15 is a schematic diagram of another merged image provided by an embodiment of this application;
图16为本申请实施例提供的一种图像处理***的示意图;16 is a schematic diagram of an image processing system provided by an embodiment of the present application;
图17为本申请实施例提供的一种第一电子设备的结构示意图。FIG. 17 is a schematic structural diagram of a first electronic device provided by an embodiment of the present application.
具体实施方式detailed description
为了便于理解,示例的给出了部分与本申请实施例相关概念的说明以供参考。如下所示:For ease of understanding, examples are given to explain some concepts related to the embodiments of the present application for reference. As follows:
序列帧是多帧连续的静态图片序列。The sequence frame is a continuous sequence of static pictures in multiple frames.
序列帧动画,又称为逐帧动画,是使用多帧连续的静态图片快速切换实现视频动画效果的一种技术。Sequential frame animation, also known as frame-by-frame animation, is a technique that uses multiple frames of continuous static pictures to quickly switch between video animation effects.
下面将结合本申请实施例中的附图,对本申请实施例中的技术方案进行描述。其中,在本申请实施例的描述中,以下,术语“第一”、“第二”仅用于描述目的,而不能理解为指示或暗示相对重要性或者隐含指明所指示的技术特征的数量。由此,限定有“第一”、“第二”的特征可以明示或者隐含地包括一个或者更多个该特征。下文中的第一语言、第二语言指代的是自然语言,第一语音、第二语音指代的是用户发出的声音。在本申请实施例的描述中,除非 另有说明,“多个”的含义是两个或两个以上。The technical solutions in the embodiments of the present application will be described below with reference to the drawings in the embodiments of the present application. Among them, in the description of the embodiments of the present application, in the following, the terms “first” and “second” are only used for description purposes, and cannot be understood as indicating or implying relative importance or implicitly indicating the number of indicated technical features . Thus, the features defined as "first" and "second" may explicitly or implicitly include one or more of the features. In the following, the first language and the second language refer to natural language, and the first voice and the second voice refer to the voice uttered by the user. In the description of the embodiments of the present application, unless otherwise stated, "multiple" means two or more.
本申请实施例提供的图像处理方法可以应用于如图1所示通信架构。该通信架构包括:多个电子设备100和电子设备200。电子设备200可以将动画中的多帧图像处理成一帧或者多帧合并图片,以及一个配置文件,电子设备100可以从电子设备200获取该配置文件和该合并图像,然后还原出动画。The image processing method provided by the embodiment of the present application can be applied to the communication architecture shown in FIG. 1. The communication architecture includes: multiple electronic devices 100 and electronic devices 200. The electronic device 200 can process the multi-frame images in the animation into one frame or multi-frame merged pictures, and a configuration file. The electronic device 100 can obtain the configuration file and the merged image from the electronic device 200, and then restore the animation.
其中,电子设备100和电子设备200之间通过通信网络互联,该通信网络可以是局域网,也可以是通过中继(relay)设备转接的广域网。当该通信网络为局域网时,示例性的,该通信网络可以是wifi热点网络、wifi P2P网络、蓝牙网络、zigbee网络或近场通信(near field communication,NFC)网络等近距离通信网络。当该通信网络为广域网时,示例性的,该通信网络可以是第三代移动通信技术(3rd-generation wireless telephone technology,3G)网络、***移动通信技术(the 4th generation mobile communication technology,4G)网络、第五代移动通信技术(5th-generation mobile communication technology,5G)网络、未来演进的公共陆地移动网络(public land mobile network,PLMN)或因特网等。在图1所示的场景中,不同电子设备之间可以通过通信网络交互数据,例如交互图片、文本、视频,或者交互电子设备对图片、文本或视频等对象处理后的结果。Among them, the electronic device 100 and the electronic device 200 are interconnected through a communication network, and the communication network may be a local area network or a wide area network transferred by a relay device. When the communication network is a local area network, for example, the communication network may be a wifi hotspot network, a wifi P2P network, a Bluetooth network, a zigbee network, or a near field communication (NFC) network and other short-distance communication networks. When the communication network is a wide area network, for example, the communication network may be a third generation mobile communication technology (3rd-generation wireless telephone technology, 3G) network, a fourth generation mobile communication technology (the 4th generation mobile communication technology, 4G ) Network, 5th-generation mobile communication technology (5G) network, future public land mobile network (PLMN) or Internet etc. In the scenario shown in FIG. 1, different electronic devices can exchange data through a communication network, such as interactive pictures, text, and video, or the result of the interactive electronic device processing objects such as pictures, text, or video.
在本申请一些实施例中,图1所示的电子设备100和电子设备200可以是还包含其他功能诸如个人数字助理和/或音乐播放器功能的便携式电子设备,诸如手机、平板电脑、具备无线通讯功能的可穿戴设备(如智能手表)等。便携式电子设备的示例性实施例包括但不限于搭载
Figure PCTCN2019115553-appb-000001
或者其他操作***的便携式电子设备。上述便携式电子设备也可以是其他便携式电子设备,诸如具有触敏表面(例如触控面板)的膝上型计算机(laptop)等。还应当理解的是,在本申请其他一些实施例中,上述电子设备100也可以不是便携式电子设备,而是具有触敏表面(例如触控面板)的台式计算机。
In some embodiments of the present application, the electronic device 100 and the electronic device 200 shown in FIG. 1 may be portable electronic devices that also include other functions such as personal digital assistants and / or music player functions, such as mobile phones, tablet computers, and wireless devices. Wearable devices with communication functions (such as smart watches), etc. Exemplary embodiments of portable electronic devices include, but are not limited to
Figure PCTCN2019115553-appb-000001
Or portable electronic devices of other operating systems. The above portable electronic device may also be other portable electronic devices, such as a laptop with a touch-sensitive surface (for example, a touch panel) and the like. It should also be understood that, in some other embodiments of the present application, the electronic device 100 may not be a portable electronic device, but a desktop computer with a touch-sensitive surface (such as a touch panel).
示例性地,如图2所示,下面以电子设备100为例对实施例进行具体说明。Exemplarily, as shown in FIG. 2, the following uses the electronic device 100 as an example to specifically describe the embodiment.
电子设备100可以包括处理器110,外部存储器接口120,内部存储器121,USB接口130,充电管理模块140,电源管理模块141,电池142,天线1,天线2,移动通信模块150,无线通信模块160,音频模块170,扬声器170A,受话器170B,麦克风170C,耳机接口170D,传感器模块180,按键190,马达191,指示器192,摄像头193,显示屏194,以及SIM卡接口195等。其中传感器模块180可以包括压力传感器180A,陀螺仪传感器180B,气压传感器180C,磁传感器180D,加速度传感器180E,距离传感器180F,接近光传感器180G,指纹传感器180H,温度传感器180J,触摸传感器180K,环境光传感器180L,骨传导传感器180M等。The electronic device 100 may include a processor 110, an external memory interface 120, an internal memory 121, a USB interface 130, a charging management module 140, a power management module 141, a battery 142, an antenna 1, an antenna 2, a mobile communication module 150, and a wireless communication module 160 , Audio module 170, speaker 170A, receiver 170B, microphone 170C, headset interface 170D, sensor module 180, button 190, motor 191, indicator 192, camera 193, display screen 194, and SIM card interface 195. The sensor module 180 may include a pressure sensor 180A, a gyro 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 structure illustrated in the embodiment of the present invention does not constitute a specific limitation on the electronic device 100. In other embodiments of the present application, the electronic device 100 may include more or fewer components than shown, or combine some components, or split some components, or arrange different components. The illustrated components can 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), and an image signal processor (image) signal processor (ISP), controller, memory, video codec, digital signal processor (DSP), baseband processor, and / or neural network processor (Neural-network Processing Unit, NPU) Wait. Among them, 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 the operation control signal according to the instruction operation code and the timing signal to complete the control of fetching instructions and executing instructions.
处理器110中还可以设置存储器,用于存储指令和数据。在一些实施例中,处理器110中的存储器为高速缓冲存储器。该存储器可以保存处理器110刚用过或循环使用的指令或数据。如果处理器110需要再次使用该指令或数据,可从所述存储器中直接调用。避免了重复存取,减少了处理器110的等待时间,因而提高了***的效率。The processor 110 may also be provided with a memory for storing instructions and data. In some embodiments, the memory in the processor 110 is a cache memory. The memory may store instructions or data that the processor 110 has just used or recycled. If the processor 110 needs to use the instruction or data again, it can be directly called from the memory. Avoid repeated access, reduce the waiting time of the processor 110, thus improving 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. Interfaces can include integrated circuit (inter-integrated circuit, I2C) interface, integrated circuit built-in audio (inter-integrated circuit, sound, I2S) interface, pulse code modulation (pulse code modulation (PCM) interface, universal asynchronous transceiver (universal) asynchronous receiver / transmitter, UART) interface, mobile industry processor interface (MIPI), general-purpose input / output (GPIO) interface, subscriber identity module (SIM) interface, and And / or 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, including a serial data line (serial data line, SDA) and a serial clock line (derail clock line, SCL). In some embodiments, the processor 110 may include multiple sets of I2C buses. The processor 110 may respectively couple the touch sensor 180K, the charger, the flash, the camera 193, etc. 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 through the I2C bus interface 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 include multiple sets of I2S buses. The processor 110 may be coupled to 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, to realize the function of answering the phone call through the Bluetooth headset.
PCM接口也可以用于音频通信,将模拟信号抽样,量化和编码。在一些实施例中,音频模块170与无线通信模块160可以通过PCM总线接口耦合。在一些实施例中,音频模块170也可以通过PCM接口向无线通信模块160传递音频信号,实现通过蓝牙耳机接听电话的功能。所述I2S接口和所述PCM接口都可以用于音频通信。The PCM interface can also be used for audio communication, sampling, quantizing and encoding analog signals. In some embodiments, the audio module 170 and the wireless communication module 160 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 to realize the function of answering the phone call 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, the UART interface is generally used to connect the processor 110 and the wireless communication module 160. For example, the processor 110 communicates with the Bluetooth module in the wireless communication module 160 through the UART interface to implement the Bluetooth function. In some embodiments, the audio module 170 can transmit 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 to peripheral devices such as the display screen 194 and the camera 193. MIPI interface includes camera serial interface (camera serial interface, CSI), display serial interface (display serial interface, DSI) and so on. In some embodiments, the processor 110 and the camera 193 communicate through a CSI interface to implement the shooting function of the electronic device 100. The processor 110 and the display screen 194 communicate through the DSI interface to realize 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 via software. The GPIO interface can be configured as a control signal or a data signal. In some embodiments, the GPIO interface may be used to connect the processor 110 to the camera 193, the display screen 194, the wireless communication module 160, the audio module 170, the sensor module 180, and the like. 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接口可以用于连接充电器为电子设备100充电,也可以用于电 子设备100与***设备之间传输数据。也可以用于连接耳机,通过耳机播放音频。该接口还可以用于连接其他电子设备,例如AR设备等。The USB interface 130 is an interface that conforms to the USB standard, and may specifically be a Mini USB interface, a Micro USB interface, a USB Type C interface, and so on. The USB interface can be used to connect a charger to charge the electronic device 100, and can also be used to transfer data between the electronic device 100 and peripheral devices. It can also be used to connect headphones and 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 invention is only a schematic description, and does not constitute a limitation on the structure of the electronic device 100. In other embodiments of the present application, the electronic device 100 may also use different interface connection methods in the foregoing embodiments, or a combination of multiple interface connection methods.
充电管理模块140用于从充电器接收充电输入。其中,充电器可以是无线充电器,也可以是有线充电器。在一些有线充电的实施例中,充电管理模块140可以通过USB接口接收有线充电器的充电输入。在一些无线充电的实施例中,充电管理模块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 the charging input of the wired charger through the USB interface. In some wireless charging embodiments, the charging management module 140 may receive wireless charging input through the 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 to connect the battery 142, the charging management module 140 and the processor 110. The power management module 141 receives input from the battery 142 and / or the charging management module 140, and supplies power to the processor 110, internal memory 121, external memory, display screen 194, camera 193, wireless communication module 160, and the like. The power management module 141 can also be used to monitor battery capacity, battery cycle times, battery health status (leakage, impedance) and other parameters. In some other embodiments, the power management module 141 may also be disposed in the processor 110. In other embodiments, the power management module 141 and the charging management module 140 may also be set in the same device.
电子设备100的无线通信功能可以通过天线模块1,天线模块2移动通信模块150,无线通信模块160,调制解调处理器以及基带处理器等实现。The wireless communication function of the electronic device 100 can be realized by the antenna module 1, the antenna module 2, the mobile communication module 150, the wireless communication module 160, the modem processor, and the baseband processor.
天线1和天线2用于发射和接收电磁波信号。电子设备100中的每个天线可用于覆盖单个或多个通信频带。不同的天线还可以复用,以提高天线的利用率。例如:可以将蜂窝网天线复用为无线局域网分集天线。在另外一些实施例中,天线可以和调谐开关结合使用。Antenna 1 and antenna 2 are used to transmit and receive electromagnetic wave signals. Each antenna in the 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 cellular antenna can be multiplexed as a wireless LAN diversity antenna. 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 can provide a wireless communication solution including 2G / 3G / 4G / 5G and the like applied to the electronic device 100. The mobile communication module 150 may include at least one filter, switch, power amplifier, low noise amplifier (Low Noise Amplifier, LNA), and the like. The mobile communication module 150 can receive electromagnetic waves from the antenna 1 and filter, amplify, etc. the received electromagnetic waves, and transmit them to the modem processor for demodulation. The mobile communication module 150 can also amplify the signal modulated by the modulation and demodulation processor and convert it to electromagnetic wave 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 and at least part of the modules of the processor 110 may be provided in the same device.
调制解调处理器可以包括调制器和解调器。其中,调制器用于将待发送的低频基带信号调制成中高频信号。解调器用于将接收的电磁波信号解调为低频基带信号。随后解调器将解调得到的低频基带信号传送至基带处理器处理。低频基带信号经基带处理器处理后,被传递给应用处理器。应用处理器通过音频设备(不限于扬声器170A,受话器170B等)输出声音信号,或通过显示屏194显示图像或视频。在一些实施例中,调制解调处理器可以是独立的器件。在另一些实施例中,调制解调处理器可以独立于处理器110,与移动通信模块150或其他功能模块设置在同一个器件中。The modem processor may include a modulator and a demodulator. Among them, the modulator is used to modulate the low-frequency baseband signal to be transmitted into a high-frequency signal. The demodulator is used to demodulate the received electromagnetic wave signal into a low-frequency baseband signal. The demodulator then transmits the demodulated low-frequency baseband signal to the baseband processor for processing. The low-frequency baseband signal is processed by the baseband processor and then passed to the application processor. The application processor outputs a sound signal through an audio device (not limited to a speaker 170A, a receiver 170B, etc.), or displays an image or video through a display screen 194. In some embodiments, the modem processor may be an independent device. In other embodiments, the modem processor may be independent of the processor 110, and may be set in the same device as the mobile communication module 150 or other functional modules.
无线通信模块160可以提供应用在电子设备100上的包括无线局域网(wireless local area networks,WLAN),蓝牙(bluetooth,BT),全球导航卫星***(global navigation satellite system,GNSS),调频(frequency modulation,FM),近距离无线通信技术(near field communication,NFC),红外技术(infrared,IR)等无线通信的解决方案。无线通信模块160可以是集成至少一个通信处理模块的一个或多个器件。无线通信模块160经由天线2接收电磁波,将电磁波信号调频以及滤波处理,将处理后的信号发送到处理器110。无线通信模块160还可以从处 理器110接收待发送的信号,对其进行调频,放大,经天线2转为电磁波辐射出去。本申请实施例中,无线通信模块160用于发送第一用户的语音,以及翻译之后的目标语言的机器语音,或者对方用户发送的目标语言的语音,以及翻译之后的第一语言的机器语音。The wireless communication module 160 can provide wireless local area network (wireless local area networks, WLAN), Bluetooth (bluetooth, BT), global navigation satellite system (GNSS), frequency modulation (frequency modulation), which are applied to the electronic device 100. FM), Near Field Communication (NFC), Infrared (IR) and other wireless communication solutions. 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 electromagnetic wave signals, and transmits the processed signals to the processor 110. The wireless communication module 160 can also receive the signal to be transmitted from the processor 110, frequency-modulate it, amplify it, and radiate it through the antenna 2 to electromagnetic waves. In the embodiment of the present application, the wireless communication module 160 is used to send the voice of the first user and the machine voice of the target language after translation, or the voice of the target language sent by the opposite user and the machine voice of the first language after translation.
在一些实施例中,电子设备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 and the mobile communication module 150 are coupled, and the antenna 2 and the wireless communication module 160 are coupled so that the electronic device 100 can communicate with the network and other devices through wireless communication technology. The wireless communication technology may include a global mobile communication system (global system for mobile communications, GSM), general packet radio service (general packet radio service, GPRS), code division multiple access (code division multiple access, CDMA), broadband Code division multiple access (wideband code division multiple access, WCDMA), time division code division multiple access (time-division code division division multiple access, TD-SCDMA), long-term evolution (long term evolution, LTE), BT, GNSS, WLAN, NFC , FM, and / or IR technology, etc. The GNSS may include a global positioning system (GPS), a global navigation satellite system (GLONASS), a beidou navigation system (BDS), and a 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 realizes a display function through a GPU, a display screen 194, and an application processor. The GPU is a microprocessor for image processing, connecting the display screen 194 and the application processor. The GPU is used to perform mathematical and geometric calculations, and is used for graphics rendering. The processor 110 may include one or more GPUs that execute program instructions to generate or change display information.
显示屏194用于显示图像,视频等。显示屏194包括显示面板。显示面板可以采用LCD(liquid crystal display,液晶显示屏),OLED(organic light-emitting diode,有机发光二极管),有源矩阵有机发光二极体或主动矩阵有机发光二极体(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个显示屏,N为大于1的正整数。本申请实施例中,显示屏194可以用于显示通话界面和翻译界面,以及语言设置界面等。The display screen 194 is used to display images, videos and the like. The display screen 194 includes a display panel. The display panel can use LCD (liquid crystal), OLED (organic light-emitting diode), active matrix organic light-emitting diode or active matrix organic light-emitting diode (active-matrix organic light) emitting diode, AMOLED), flexible light-emitting diode (FLED), Miniled, MicroLed, Micro-oLed, quantum dot light emitting diode (QLED), etc. In some embodiments, the electronic device 100 may include 1 or N display screens, where N is a positive integer greater than 1. In the embodiment of the present application, the display screen 194 may be used to display a call interface, a translation interface, and a language setting interface.
电子设备100可以通过ISP,摄像头193,视频编解码器,GPU,显示屏194以及应用处理器等实现拍摄功能。The electronic device 100 can realize 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 processes the data fed back by the camera 193. For example, when taking a picture, the shutter is opened, the light is transmitted to the camera photosensitive element through the lens, and the optical signal is converted into an electrical signal, and the camera photosensitive element transmits the electrical signal to the ISP for processing, which is converted into an image visible to the naked eye. ISP can also optimize the image noise, brightness, and skin color. ISP can also optimize the exposure, color temperature and other parameters of the shooting scene. In some embodiments, the ISP may be set in the camera 193.
摄像头193用于捕获静态图像或视频。物体通过镜头生成光学图像投射到感光元件。感光元件可以是电荷耦合器件(charge coupled device,CCD)或互补金属氧化物半导体(complementary metal-oxide-semiconductor,CMOS)光电晶体管。感光元件把光信号转换成电信号,之后将电信号传递给ISP转换成数字图像信号。ISP将数字图像信号输出到DSP加工处理。DSP将数字图像信号转换成标准的RGB,YUV等格式的图像信号。在一些实施例中,电子设备100可以包括1个或N个摄像头,N为大于1的正整数。The camera 193 is used to capture still images or video. The object generates an optical image through the lens and projects it onto the photosensitive element. The photosensitive element may be a charge coupled device (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 image signals. In some embodiments, the electronic device 100 may include 1 or N cameras, where N is a positive integer greater than 1.
数字信号处理器用于处理数字信号,除了可以处理数字图像信号,还可以处理其他数字信号。例如,当电子设备100在频点选择时,数字信号处理器用于对频点能量进行傅里叶变换等。The digital signal processor is used to process digital signals. In addition to digital image signals, it can also process other digital signals. For example, when the electronic device 100 is selected at a frequency point, the digital signal processor is used to perform Fourier transform on the energy at the frequency point.
视频编解码器用于对数字视频压缩或解压缩。电子设备100可以支持一种或多种视频编解码器。这样,电子设备100可以播放或录制多种编码格式的视频,例如:MPEG1,MPEG2, MPEG3,MPEG4等。Video codec is 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 in various encoding formats, for example: MPEG1, MPEG2, MPEG3, MPEG4, and so on.
NPU为神经网络(neural-network,NN)计算处理器,通过借鉴生物神经网络结构,例如借鉴人脑神经元之间传递模式,对输入信息快速处理,还可以不断的自学习。通过NPU可以实现电子设备100的智能认知等应用,例如:图像识别,人脸识别,语音识别,文本理解等。NPU is a neural-network (NN) computing processor. By drawing on the structure of biological neural networks, for example, the transfer mode between neurons in the human brain, it can quickly process the input information and can continuously learn by itself. The NPU can realize applications such as intelligent recognition of the electronic device 100, such as image recognition, face recognition, voice recognition, and text understanding.
外部存储器接口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, save music, video and other files in an external memory card.
内部存储器121可以用于存储计算机可执行程序代码,所述可执行程序代码包括指令。处理器110通过运行存储在内部存储器121的指令,从而执行电子设备100的各种功能应用以及数据处理。存储器121可以包括存储程序区和存储数据区。其中,存储程序区可存储操作***,至少一个功能所需的应用程序(比如声音播放功能,图像播放功能等)等。存储数据区可存储电子设备100使用过程中所创建的数据(比如音频数据,电话本等)等。此外,存储器121可以包括高速随机存取存储器,还可以包括非易失性存储器,例如至少一个磁盘存储器件,闪存器件,通用闪存存储器(universal flash storage,UFS)等。The internal memory 121 may be used to store computer executable program code, where the executable program code includes instructions. The processor 110 executes instructions stored in the internal memory 121 to execute various functional applications and data processing of the electronic device 100. The memory 121 may include a storage program area and a storage data area. Among them, the storage program area may store an operating system, at least one function required application programs (such as sound playback function, image playback function, etc.). The storage data area may store data (such as audio data, phone book, etc.) created during use of the electronic device 100 and the like. In addition, the memory 121 may include a high-speed random access memory, and may also include a non-volatile memory, such as at least one disk storage device, a flash memory device, a universal flash memory (universal flash storage, UFS), and so on.
电子设备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, a headphone interface 170D, and an application processor. For example, music playback, recording, etc.
音频模块170用于将数字音频信息转换成模拟音频信号输出,也用于将模拟音频输入转换为数字音频信号。音频模块170还可以用于对音频信号编码和解码。在一些实施例中,音频模块170可以设置于处理器110中,或将音频模块170的部分功能模块设置于处理器110中。The audio module 170 is used to convert digital audio information into analog audio signal output, and also used to convert analog audio input into digital audio signal. The audio module 170 can also be used to encode and decode audio signals. In some embodiments, the audio module 170 may be disposed in the processor 110, or some functional modules of the audio module 170 may be disposed in the processor 110.
扬声器170A,也称“喇叭”,用于将音频电信号转换为声音信号。电子设备100可以通过扬声器170A收听音乐,或收听免提通话。本申请实施例中,扬声器170A用于播放翻译之后的机器语音。The speaker 170A, also called "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. In the embodiment of the present application, the speaker 170A is used to play the translated machine voice.
受话器170B,也称“听筒”,用于将音频电信号转换成声音信号。当电子设备100接听电话或语音信息时,可以通过将受话器170B靠近人耳接听语音。The receiver 170B, also known as "handset", 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 received by bringing the receiver 170B close to the ear.
麦克风170C,也称“话筒”,“传声器”,用于将声音信号转换为电信号。当拨打电话或发送语音信息时,用户可以通过人嘴靠近麦克风170C发声,将声音信号输入到麦克风170C。电子设备100可以设置至少一个麦克风170C。在另一些实施例中,电子设备100可以设置两个麦克风,除了采集声音信号,还可以实现降噪功能。在另一些实施例中,电子设备100还可以设置三个,四个或更多麦克风,实现采集声音信号,降噪,还可以识别声音来源,实现定向录音功能等。本申请实施例中,麦克风170C可以用于采集用户的语音,例如第一用户的第一语言的第一语音。The microphone 170C, also called "microphone", "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 person's mouth, and input a sound signal to 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. In addition to collecting sound signals, it may also achieve a noise reduction function. In other embodiments, the electronic device 100 may also be provided with three, four, or more microphones to collect sound signals, reduce noise, identify sound sources, and implement directional recording functions. In the embodiment of the present application, the microphone 170C may be used to collect the user's voice, for example, the first voice of the first user in the first language.
耳机接口170D用于连接有线耳机。耳机接口可以是USB接口,也可以是3.5mm的开放移动电子设备平台(open mobile terminal platform,OMTP)标准接口,美国蜂窝电信工业协会(cellular telecommunications industry association of the USA,CTIA)标准接口。The headset interface 170D is used to connect wired headsets. The headphone jack can be a USB jack, or a 3.5mm open mobile electronic device (open mobile terminal) platform, OMTP standard interface, and the American Telecommunications Industry Association (cellular telecommunications industry association of the United States, CTIA) standard interface.
压力传感器180A用于感受压力信号,可以将压力信号转换成电信号。在一些实施例中,压力传感器180A可以设置于显示屏194。压力传感器180A的种类很多,如电阻式压力传感器,电感式压力传感器,电容式压力传感器等。电容式压力传感器可以是包括至少两个具有导电材料的平行板。当有力作用于压力传感器180A,电极之间的电容改变。电子设备100根据电容的变化确定压力的强度。当有触摸操作作用于显示屏194,电子设备100根据压力传感器180A检测所述触摸操作强度。电子设备100也可以根据压力传感器180A的检测信号计 算触摸的位置。在一些实施例中,作用于相同触摸位置,但不同触摸操作强度的触摸操作,可以对应不同的操作指令。例如:当有触摸操作强度小于第一压力阈值的触摸操作作用于短消息应用图标时,执行查看短消息的指令。当有触摸操作强度大于或等于第一压力阈值的触摸操作作用于短消息应用图标时,执行新建短消息的指令。The pressure sensor 180A is used to sense the pressure signal and can convert the pressure signal into an electrical signal. In some embodiments, the pressure sensor 180A may be provided on the display screen 194. There are many types of pressure sensors 180A, such as resistive pressure sensors, inductive pressure sensors, and capacitive pressure sensors. The capacitive pressure sensor may be at least two parallel plates with conductive materials. When force is applied to the pressure sensor 180A, the capacitance between the electrodes changes. The electronic device 100 determines the strength of the pressure according to the change in capacitance. When a touch operation is applied to 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 calculate the touched position based on the detection signal of the pressure sensor 180A. In some embodiments, touch operations that act on the same touch position but have different touch operation intensities may correspond to different operation instructions. For example, when a touch operation with a touch operation intensity less than the first pressure threshold acts on the short message application icon, an instruction to view 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, an 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 movement posture of the electronic device 100. In some embodiments, the angular velocity of the electronic device 100 around three axes (ie, x, y, and z axes) may be determined by the gyro sensor 180B. The gyro sensor 180B can be used for image stabilization. Exemplarily, when the shutter is pressed, the gyro sensor 180B detects the jitter angle of the electronic device 100, calculates the distance that the lens module needs to compensate based on the angle, and allows the lens to counteract the jitter of the electronic device 100 through reverse movement to achieve anti-shake. The gyro sensor 180B can also be used for navigation and somatosensory game scenes.
气压传感器180C用于测量气压。在一些实施例中,电子设备100通过气压传感器180C测得的气压值计算海拔高度,辅助定位和导航。The air pressure sensor 180C is used to measure air pressure. In some embodiments, the electronic device 100 calculates the altitude using the air pressure value measured by the air pressure sensor 180C to assist 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 clamshell machine, the electronic device 100 may detect the opening and closing of the clamshell according to the magnetic sensor 180D. Furthermore, according to the detected opening and closing state of the holster or the opening and closing state of the flip cover, features such as automatic unlocking of the flip cover are set.
加速度传感器180E可检测电子设备100在各个方向上(一般为三轴)加速度的大小。当电子设备100静止时可检测出重力的大小及方向。还可以用于识别电子设备姿态,应用于横竖屏切换,计步器等应用。The acceleration sensor 180E can detect the magnitude of acceleration of the electronic device 100 in various directions (generally three axes). When the electronic device 100 is stationary, the magnitude and direction of gravity can be detected. It can also be used to recognize the posture of electronic devices, and be used in applications such as horizontal and vertical screen switching and pedometers.
距离传感器180F,用于测量距离。电子设备100可以通过红外或激光测量距离。在一些实施例中,拍摄场景,电子设备100可以利用距离传感器180F测距以实现快速对焦。The distance sensor 180F is used to measure the distance. The electronic device 100 can measure the distance by infrared or laser. In some embodiments, when shooting scenes, the electronic device 100 may use the distance sensor 180F to measure distance to achieve fast focusing.
接近光传感器180G可以包括例如发光二极管(LED)和光检测器,例如光电二极管。发光二极管可以是红外发光二极管。电子设备100通过发光二极管向外发射红外光。电子设备100使用光电二极管检测来自附近物体的红外反射光。当检测到充分的反射光时,可以确定电子设备100附近有物体。当检测到不充分的反射光时,电子设备100可以确定电子设备100附近没有物体。电子设备100可以利用接近光传感器180G检测用户手持电子设备100贴近耳朵通话,以便自动熄灭屏幕达到省电的目的。接近光传感器180G也可用于皮套模式,口袋模式自动解锁与锁屏。The proximity light sensor 180G may include, for example, a light emitting diode (LED) and a light detector, such as a photodiode. The light emitting diode may be an infrared light emitting diode. The electronic device 100 emits infrared light outward through the light emitting diode. The electronic device 100 uses a photodiode to detect infrared reflected light from nearby objects. When sufficient reflected light is detected, it may 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. The proximity light sensor 180G can also be used in leather case 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 the brightness of ambient light. 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, access to application locks, fingerprint photographing, and fingerprint answering calls.
温度传感器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, the electronic device 100 performs performance reduction of the processor located near the temperature sensor 180J in order to reduce power consumption and implement thermal protection. In some other embodiments, when the temperature is below another threshold, the electronic device 100 heats the battery 142 to avoid the abnormal shutdown of the electronic device 100 due to the low temperature. In some other embodiments, when the temperature is below another threshold, the electronic device 100 performs boosting on the output voltage of the battery 142 to avoid abnormal shutdown due to low temperature.
触摸传感器180K,也称“触控面板”。可设置于显示屏194。用于检测作用于其上或附近的触摸操作。可以将检测到的触摸操作传递给应用处理器,以确定触摸事件类型,并通过显示屏194提供相应的视觉输出。在另一些实施例中,触摸传感器180K也可以设置于电子设 备100的表面,与显示屏194所处的位置不同。本申请实施例中,触控面板用于接收第一操作、语言设置控件的确认操作、关闭操作、退出操作等触摸操作。Touch sensor 180K, also known as "touch panel". Can be set on the display 194. Used to detect touch operations on or near it. The detected touch operation may be passed to the application processor to determine the type of touch event and provide corresponding visual output through the 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. In the embodiment of the present application, the touch panel is used to receive touch operations such as a first operation, a confirmation operation of a language setting control, a close operation, and an exit operation.
骨传导传感器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 a blood pressure beating signal. In some embodiments, the bone conduction sensor 180M may also be provided in the earphone. The audio module 170 may parse out the voice signal based on the vibration signal of the vibrating bone block of the voice part acquired by the bone conduction sensor 180M to realize the voice function. The application processor may analyze the heart rate information based on the blood pressure beating signal acquired by the bone conduction sensor 180M to implement the heart rate detection function.
按键190包括开机键,音量键等。按键可以是机械按键。也可以是触摸式按键。电子设备100可以接收按键输入,产生与电子设备100的用户设置以及功能控制有关的键信号输入。The key 190 includes a power-on key, a volume key, and the like. The keys can be mechanical keys. It can also be a touch button. The electronic device 100 can receive key input and generate key signal input related to user settings and function control of the electronic device 100.
马达191可以产生振动提示。马达191可以用于来电振动提示,也可以用于触摸振动反馈。例如,作用于不同应用(例如拍照,音频播放等)的触摸操作,可以对应不同的振动反馈效果。作用于显示屏194不同区域的触摸操作,马达191也可对应不同的振动反馈效果。不同的应用场景(例如:时间提醒,接收信息,闹钟,游戏等)也可以对应不同的振动反馈效果。触摸振动反馈效果还可以支持自定义。The motor 191 may generate a vibration prompt. The motor 191 can be used for vibration notification of incoming calls and can also be used for touch vibration feedback. For example, touch operations applied to different applications (such as taking pictures, playing audio, etc.) may correspond to different vibration feedback effects. For the touch operation in different areas of the display screen 194, the motor 191 can also correspond to different vibration feedback effects. Different application scenarios (for example: time reminder, receiving information, alarm clock, game, etc.) can also correspond to different vibration feedback effects. Touch vibration feedback effect can also support customization.
指示器192可以是指示灯,可以用于指示充电状态,电量变化,也可以用于指示消息,未接来电,通知等。The indicator 192 may be an indicator light, which may be used to indicate a charging state, a power change, and may also be used to indicate a message, a missed call, a notification, and the like.
SIM卡接口195用于连接用户标识模块(subscriber identity module,SIM)。SIM卡可以通过***SIM卡接口,或从SIM卡接口拔出,实现和电子设备100的接触和分离。电子设备100可以支持1个或N个SIM卡接口,N为大于1的正整数。SIM卡接口195可以支持Nano SIM卡,Micro SIM卡,SIM卡等。同一个SIM卡接口可以同时***多张卡。所述多张卡的类型可以相同,也可以不同。SIM卡接口195也可以兼容不同类型的SIM卡。SIM卡接口195也可以兼容外部存储卡。电子设备100通过SIM卡和网络交互,实现通话以及数据通信等功能。在一些实施例中,电子设备100采用eSIM,即:嵌入式SIM卡。eSIM卡可以嵌在电子设备100中,不能和电子设备100分离。电子设备100的软件***可以采用分层架构,事件驱动架构,微核架构,微服务架构,或云架构。本发明实施例以分层架构的Android***为例,示例性说明电子设备100的软件结构。The SIM card interface 195 is used to connect a subscriber identity module (SIM). The SIM card can be inserted into or removed from the SIM card interface to achieve contact and separation with the electronic device 100. 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 cards, Micro SIM cards, SIM cards, etc. Multiple cards can be inserted in the same SIM card interface. The types of the multiple 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 can also be compatible with external memory cards. The electronic device 100 interacts with the network through the SIM card to realize functions such as call and data communication. In some embodiments, the electronic device 100 uses eSIM, that is, 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 micro-core architecture, a micro-service architecture, or a cloud architecture. The embodiment of the present invention takes an Android system with a layered architecture as an example to exemplarily explain the software structure of the electronic device 100.
图3是本发明实施例的电子设备100的软件结构框图。FIG. 3 is a software block diagram of the electronic device 100 according to an embodiment of the present invention.
分层架构将软件分成若干个层,每一层都有清晰的角色和分工。层与层之间通过软件接口通信。在一些实施例中,将Android***分为四层,从上至下分别为应用程序层,应用程序框架层,安卓运行时(Android runtime)和***库,以及内核层。The layered architecture divides the software into several layers, and each layer has a clear role and division of labor. The layers communicate with each other through a software interface. In some embodiments, the Android system is divided into four layers, from top to bottom are the application layer, the application framework layer, the Android runtime and the system library, and the kernel layer.
应用程序层可以包括一系列应用程序包。The application layer may include a series of application packages.
如图3所示,应用程序包可以包括电话、相机,图库,日历,通话,地图,导航,WLAN,蓝牙,音乐,视频,短信息等应用程序。As shown in FIG. 3, the application package may include applications such as phone, camera, gallery, calendar, call, map, navigation, WLAN, Bluetooth, music, video, and short message.
应用程序框架层为应用程序层的应用程序提供应用编程接口(application programming interface,API)和编程框架。应用程序框架层包括一些预先定义的函数。The application framework layer provides an application programming interface (application programming interface) and programming framework for applications at the application layer. The application framework layer includes some predefined functions.
如图3所示,应用程序框架层可以包括窗口管理器,内容提供器,视图***,电话管理器,资源管理器,通知管理器等。As shown in FIG. 3, the application framework layer may include a window manager, a content provider, a view system, a phone manager, a resource manager, a notification manager, and so on.
窗口管理器用于管理窗口程序。窗口管理器可以获取显示屏大小,判断是否有状态栏,锁定屏幕,截取屏幕等。The window manager is used to manage window programs. The window manager can obtain the size of the display screen, determine whether there is a status bar, lock the screen, intercept the screen, 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, and so on.
视图***包括可视控件,例如显示文字的控件,显示图片的控件等。视图***可用于构建应用程序。显示界面可以由一个或多个视图组成的。例如,包括短信通知图标的显示界面,可以包括显示文字的视图以及显示图片的视图。The view system includes visual controls, such as controls for displaying text and controls for displaying pictures. The view system can be used to build applications. The display interface can be composed of one or more views. For example, a display interface that includes an SMS notification icon may include a view that displays text and a view that displays 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 connection, hang up, etc.).
资源管理器为应用程序提供各种资源,比如本地化字符串,图标,图片,布局文件,视频文件等等。The resource manager provides various resources for the application, such as localized 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 after a short stay without user interaction. For example, the notification manager is used to notify the completion of downloading, message reminders, etc. The notification manager can also be a notification that appears in the status bar at the top of the system in the form of a chart or scroll bar text, such as a notification of an application running in the background, or a notification that appears on the screen in the form of a dialog window. For example, the text message is displayed in the status bar, a prompt sound is emitted, the electronic device vibrates, and the indicator light flashes.
Android Runtime包括核心库和虚拟机。Android runtime负责安卓***的调度和管理。Android Runtime includes core library and virtual machine. Android runtime is responsible for the scheduling and management of the Android system.
核心库包含两部分:一部分是java语言需要调用的功能函数,另一部分是安卓的核心库。The core library contains two parts: one part is the function function that Java language needs to call, and the other part is the core library of Android.
应用程序层和应用程序框架层运行在虚拟机中。虚拟机将应用程序层和应用程序框架层的java文件执行为二进制文件。虚拟机用于执行对象生命周期的管理,堆栈管理,线程管理,安全和异常的管理,以及垃圾回收等功能。The application layer and the application framework layer run in the virtual machine. The virtual machine executes the java files of the application layer and the application framework layer into binary files. The virtual machine is used to perform functions such as object lifecycle management, stack management, thread management, security and exception management, and garbage collection.
***库可以包括多个功能模块。例如:表面管理器(surface manager),媒体库(Media Libraries),三维图形处理库(例如:OpenGL ES),2D图形引擎(例如:SGL)等。The system library may include multiple functional modules. For example: surface manager (surface manager), media library (Media library), 3D graphics processing library (for example: OpenGL ES), 2D graphics engine (for example: SGL), etc.
表面管理器用于对显示子***进行管理,并且为多个应用程序提供了2D和3D图层的融合。The surface manager is used to manage the display subsystem and provides a combination of 2D and 3D layers for multiple applications.
媒体库支持多种常用的音频,视频格式回放和录制,以及静态图像文件等。媒体库可以支持多种音视频编码格式,例如:MPEG4,H.264,MP3,AAC,AMR,JPG,PNG等。The media library supports a variety of commonly used audio, video format playback and recording, and still image files. The media library can support multiple audio and video encoding formats, such as: MPEG4, H.264, MP3, AAC, AMR, JPG, PNG, etc.
三维图形处理库用于实现三维图形绘图,图像渲染,合成,和图层处理等。The 3D graphics processing library is used to realize 3D graphics drawing, image rendering, synthesis, and layer processing.
2D图形引擎是2D绘图的绘图引擎。The 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 the display driver, camera driver, audio driver, and sensor driver.
现有技术中,终端***内的引导动画通常是以序列帧图像的形式保存在只读存储器(Read Only Memory,ROM)中,一般动画可能会包含几帧甚至几十帧的图像。假设每帧图像大小尺寸相同,存储大小均为M kb,帧数为N,则整个指纹动画占用ROM大小为(M*N)kb。由于大部分动画中前后相邻两帧图像的大部分区域的像素都相同,不相同的像素部分往往占比很小。如果去掉相邻帧中的相同像素部分,不考虑图像数字编码头部中的字节占用,理论上可以将总大小优化到(M+(M/10)*(N-1))kb。为此,本申请实施例提供一种图像处理方法,该方法可以实现服务器侧将动画预先处理成一个或多个合并图像以及配置文件,当终端侧从服务器侧获取该一个或多个合并图像以及配置文件之后,可以还原出该动画,因一个或多个合并图像以及配置文件相较序列帧图像占用ROM明显减少,所以一定程度上可以节省ROM空间。In the prior art, the guide animation in the terminal system is usually stored in a read-only memory (Read Only Memory, ROM) in the form of a sequence frame image, and the general animation may include images of several frames or even tens of frames. Assuming that the size of each frame is the same, the storage size is Mkb, and the number of frames is N, then the entire fingerprint animation occupies the size of (M * N) kb. In most animations, the pixels in most areas of the two frames adjacent to each other are the same, and the proportion of pixels that are not the same is often very small. If the same pixel part in the adjacent frame is removed, the total size can be optimized to (M + (M / 10) * (N-1)) kb in theory, regardless of the byte occupation in the digital encoding header of the image. To this end, embodiments of the present application provide an image processing method, which can enable the server side to pre-process animation into one or more merged images and configuration files, and when the terminal side obtains the one or more merged images from the server side and After the configuration file, the animation can be restored, because one or more merged images and configuration files take up significantly less ROM than sequential frame images, so ROM space can be saved to a certain extent.
举例来说,当用户进入手机的设置菜单添加新的指纹时,用户每在指纹键上按一次,手机界面上都会对应播放一次指纹动画,该指纹动画是由多帧序列帧图像组成,如图4所示, 该指纹动画包括连续的十帧图像,现有技术的实现方式通常是将该指纹动画的十帧图像存储在ROM中,较为占用内存。本申请实施例中,第一电子设备可以预先对该指纹动画中的十帧图像进行处理,生成多个合并图像和一份配置文件,第一电子设备然后将多个合并图像和一份配置文件发送至第二电子设备,以便第二电子设备还原出该指纹动画。示例性的,第一电子设备可以将十帧图像均按照相同的方式切割成多个像素块,然后依次对比后一帧图像与邻近的前一帧图像中的相同位置的像素块是否不同。如图5所示,图5中的图5a为指纹动画中的第二帧图像与第一帧图像对比之后确定出来的不同的像素块(方框中像素块为不同的像素块),图5b为指纹动画中的第三帧图像与第二帧图像对比之后确定出来的不同的像素块(方框中像素块为不同的像素块),依次类推,直至,图5c为指纹动画中的第九帧图像与第八帧图像对比之后确定出来的不同的像素块(方框中像素块为不同的像素块),图5d为指纹动画中的第十帧图像与第九帧图像对比之后确定出来的不同的像素块(方框中像素块为不同的像素块)。For example, when a user enters the phone's settings menu to add a new fingerprint, each time the user presses on the fingerprint key, a fingerprint animation will be played on the phone interface. The fingerprint animation is composed of multiple frames of sequence images, as shown in the figure As shown in FIG. 4, the fingerprint animation includes ten consecutive frames of images, and the implementation method in the prior art is generally to store the ten frames of fingerprint animation in the ROM, which occupies more memory. In the embodiment of the present application, the first electronic device can process the ten frames of the fingerprint animation in advance to generate multiple merged images and a configuration file, and the first electronic device then combines the multiple merged images and a configuration file Send to the second electronic device, so that the second electronic device restores the fingerprint animation. Exemplarily, the first electronic device may cut the ten frames of images into multiple pixel blocks in the same manner, and then sequentially compare whether the pixel blocks at the same position in the next frame image and the adjacent previous frame image are different. As shown in FIG. 5, FIG. 5a in FIG. 5 is a different pixel block determined after comparing the second frame image in the fingerprint animation with the first frame image (the pixel blocks in the box are different pixel blocks), and FIG. 5b Different pixel blocks determined by comparing the third frame image in the fingerprint animation with the second frame image (the pixel blocks in the box are different pixel blocks), and so on, until Figure 5c is the ninth in the fingerprint animation The different pixel blocks determined after comparing the frame image with the eighth frame image (the pixel blocks in the box are different pixel blocks), Figure 5d is the comparison between the tenth frame image and the ninth frame image in the fingerprint animation Different pixel blocks (the pixel blocks in the box are different pixel blocks).
进一步的,第一电子设备将确定出来的方框中的像素块写入包括合并图像中,该合并图像预先包括了第一帧图像的所有像素块。这样,最终就生成了包括第一帧图像的所有像素块以及所有方框中的像素块,参见图6所示,同时配置文件记录了合并图像中的每个像素块是哪些帧的像素块,以及分别在这些帧的位置,这样,第二电子设备根据该配置文件和该合并图像就能够还原出该指纹动画。Further, the first electronic device writes the determined pixel blocks in the box into the merged image, and the merged image includes all pixel blocks of the first frame image in advance. In this way, all the pixel blocks including the first frame image and the pixel blocks in all the boxes are finally generated, as shown in FIG. 6, and the configuration file records which frame pixel blocks each pixel block in the merged image is, And the positions of these frames respectively, so that the second electronic device can restore the fingerprint animation according to the configuration file and the merged image.
以下将结合附图和应用场景,对本申请实施例提供的图像处理方法进行详细介绍。以下实施例均可以在具有上述硬件结构的电子设备100实现。The image processing method provided by the embodiments of the present application will be described in detail below with reference to the drawings and application scenarios. The following embodiments can all be implemented in the electronic device 100 having the above hardware structure.
参见图7,示例性的示出了本申请实施例提供的第一种图像处理方法的流程,该方法由第一电子设备执行。其中,第一电子设备可以是手机、平板电脑、个人计算机等设备。Referring to FIG. 7, an exemplary flow of a first image processing method provided by an embodiment of the present application is exemplarily shown, and the method is executed by a first electronic device. Among them, the first electronic device may be a mobile phone, a tablet computer, a personal computer and other devices.
步骤201,第一电子设备将动画中的N帧原始图像按照相同的方式均划分成M个像素块。Step 201: The first electronic device divides the N frames of the original image in the animation into M pixel blocks in the same manner.
示例性地,如图8所示,第一电子设备将动画中的第一帧图像、第二帧图像和第三帧图像按照同样的方式划分成24个像素块,其中不同帧图像中的像素块的位置相同,例如第一帧的像素块A的坐标位置和第二帧的像素块a2的坐标位置相同,以及和第三帧的像素块a3的坐标位置相同,第一帧的像素块B和第二帧的像素块b2的坐标位置相同,以及和第三帧的像素块b3的坐标位置相同,依次类推。或者例如说,第一帧的像素块A的索引值和第二帧的像素块a2的索引值相同,以及和第三帧的像素块a3的索引值相同。Exemplarily, as shown in FIG. 8, the first electronic device divides the first frame image, the second frame image, and the third frame image in the animation into 24 pixel blocks in the same manner, in which pixels in different frame images The position of the block is the same, for example, the coordinate position of the pixel block A of the first frame is the same as the coordinate position of the pixel block a2 of the second frame, and the coordinate position of the pixel block a3 of the third frame, the pixel block B of the first frame It is the same as the coordinate position of the pixel block b2 of the second frame, and the same as the coordinate position of the pixel block b3 of the third frame, and so on. Or for example, the index value of the pixel block A of the first frame is the same as the index value of the pixel block a2 of the second frame, and the same as the index value of the pixel block a3 of the third frame.
步骤202,第一电子设备将所述N帧原始图像中的第一帧原始图像的M个像素块写入到合并图像中。其中,M个像素块是第一帧原始图像的所有像素块。Step 202: The first electronic device writes the M pixel blocks of the first frame of the original image in the N frames of the original image into the merged image. Among them, M pixel blocks are all pixel blocks of the original image of the first frame.
例如,将图8中的第一帧图像中的24个像素块写入到合并图像中。For example, the 24 pixel blocks in the first frame image in FIG. 8 are written into the merged image.
步骤203,第一电子设备针对第K帧原始图像,所述第K帧原始图像为其余N-1帧原始图像中的任意一帧原始图像,执行如下操作:Step 203: The first electronic device performs the following operations on the K-th frame original image, which is any one of the remaining N-1 frame original images:
遍历第K帧原始图像中的第一像素块,当所述第K帧原始图像中的第一像素块与第K-1帧原始图像中的相同位置的像素块不同时,则将所述第一像素块写入所述合并图像中,否则,不将所述第一像素块写入所述合并图像中。Traverse the first pixel block in the original image of the Kth frame, when the first pixel block in the original image of the Kth frame is different from the pixel block at the same position in the original image of the K-1th frame, the One pixel block is written into the merged image, otherwise, the first pixel block is not written into the merged image.
当所述第K帧原始图像中的第二像素块与当前最新的合并图像中的所有像素块均不同时,则将所述第二像素块写入当前最新的合并图像中,否则,不将所述第二像素块写入当前最新的合并图像中。When the second pixel block in the original image of the Kth frame is different from all pixel blocks in the current latest merged image, the second pixel block is written into the current latest merged image, otherwise, the The second pixel block is written into the current latest merged image.
返回遍历执行所述第K帧原始图像中的第三像素块,直至第K帧原始图像中的M个像 素块全部遍历完成;其中,M、N和K为大于1的正整数。Go back and perform the third pixel block in the original image of the Kth frame until all M pixel blocks in the original image of the Kth frame are traversed; wherein, M, N and K are positive integers greater than 1.
以图8举例来说,第一电子设备首先依次遍历第二帧图像中的a2至x2这24个像素块,其中,像素块a2与第一帧图像的像素块A相同,像素块b2与第一帧图像的像素块B不同,第一电子设备将像素块b2写入到合并图像中,像素块c2与第一帧图像的像素块C相同,像素块d2与第一帧图像的像素块D相同,依次类推,直至像素块x2与第一帧图像的像素块X相同。最终第一电子设备将第二帧图像的b2、g2和i2写入到合并图像中。接着,第一电子设备再次遍历第三帧图像中的a3至x3这24个像素块,其中,像素块a3与第二帧图像的像素块a2相同,像素块b3与第二帧图像的像素块b2不同,第一电子设备将像素块b3写入到合并图像中,像素块c3与第二帧图像的像素块c2相同,像素块d3与第二帧图像的像素块d2相同,依次类推,直至像素块x3与第二帧图像的像素块x2相同。最终第一电子设备将第三帧图像的b3、g3、i3、j3、o3和r3写入到合并图像中。这样最终生成的合并图像,如图8所示,合并图像中的像素块包括第一帧图像的A至X,以及第二帧图像的b2、g2和i2,以及第三帧图像的b3、g3、i3、j3、o3和r3。Taking FIG. 8 as an example, the first electronic device first traverses the 24 pixel blocks a2 to x2 in the second frame image in sequence, where the pixel block a2 is the same as the pixel block A of the first frame image, and the pixel block b2 is The pixel block B of one frame image is different, the first electronic device writes the pixel block b2 into the merged image, the pixel block c2 is the same as the pixel block C of the first frame image, and the pixel block d2 is the same as the pixel block D of the first frame image The same, and so on, until the pixel block x2 is the same as the pixel block X of the first frame image. Finally, the first electronic device writes b2, g2, and i2 of the second frame image into the merged image. Next, the first electronic device again traverses the 24 pixel blocks a3 to x3 in the third frame image, where the pixel block a3 is the same as the pixel block a2 of the second frame image, and the pixel block b3 is the same as the pixel block of the second frame image Unlike b2, the first electronic device writes the pixel block b3 into the merged image, the pixel block c3 is the same as the pixel block c2 of the second frame image, the pixel block d3 is the same as the pixel block d2 of the second frame image, and so on, until The pixel block x3 is the same as the pixel block x2 of the second frame image. Finally, the first electronic device writes b3, g3, i3, j3, o3, and r3 of the third frame image into the combined image. The merged image finally generated in this way, as shown in FIG. 8, the pixel blocks in the merged image include A to X of the first frame image, and b2, g2, and i2 of the second frame image, and b3, g3 of the third frame image , I3, j3, o3, and r3.
需要说明的是,本申请实施例图像中的N帧原始图像可以可为各种类型的图像,例如RGB图像;YUV图像、RGBA图像及YUVA图像等。RGB图像包括:红色R分量、绿色G分量及蓝色B分量。所述RGBA图像包括:红色R分量、绿色G分量、蓝色B分量及透明度A分量。YUV图像包括:亮度Y分量、色差U分量及色差V分量。YUVA图像包括:亮度Y分量、色差U分量、色差V分量及透明度A分量。因每一个分量代表一个像素某一个维度的数据值(又可以称之为分量值),这些分量组构成了像素值,所以本申请实施例中第一电子设备是对不同像素块的像素值进行比较,若其中任意一个或多个分量的像素值不同,则像素块不同。It should be noted that the N-frame original images in the images of the embodiments of the present application may be various types of images, such as RGB images; YUV images, RGBA images, and YUVA images. RGB images include: red R component, green G component and blue B component. The RGBA image includes a red R component, a green G component, a blue B component, and a transparency A component. YUV images include: luminance Y component, color difference U component and color difference V component. YUVA images include: luminance Y component, color difference U component, color difference V component and transparency A component. Since each component represents a data value (also called component value) of a certain dimension of a pixel, and these component groups constitute pixel values, the first electronic device in this embodiment of the present application performs pixel values of different pixel blocks In comparison, if the pixel value of any one or more of the components is different, the pixel block is different.
步骤204,第一电子设备生成配置文件,所述配置文件包括:最后生成的合并图像中每个像素块的序号与原始图像的序号的对应关系,以及最后生成的合并图像中每个像素块在所对应的原始图像中的位置信息。Step 204: The first electronic device generates a configuration file, the configuration file includes: the correspondence between the serial number of each pixel block in the merged image generated last and the serial number of the original image, and each pixel block in the merged image generated last The position information in the corresponding original image.
示例性地,第一电子设备对每个像素块的位置都分配一个索引值,以图8来说,从左上到右下,索引值依次为(1,1)、(1,2)~(1,4),(2,1)、(2,2)~(2,4),直到最后一个(6,4)。例如,像素块b2的位置的索引值为(2,2),像素块g2的位置的索引值为(2,3),像素块i2的位置的索引值为(3,1)。这样第一电子设备最终生成的配置文件包括:图8中合并图像中的每个像素块与第一帧图像、第二帧图像和第三帧图像的对应关系,以及每个像素块在与其对应的图像中的索引值。具体来说,配置文件包括:图8中合并图像中的像素块A与第一帧图像、第二帧图像和第三帧图像相对应,且像素块A对应的是第一帧图像的像素A的索引值,像素A对应的是第二帧图像的像素块a2的索引值,且像素块A对应的是第三帧图像的像素块a3的索引值,图8中合并图像中的像素块B与第一帧图像相对应,且像素块B对应的是第一帧图像的像素B的索引值,依次类推,直至,图8中合并图像中的像素块r3与第三帧图像相对应,且像素块r3对应的是第三帧图像的像素r3的索引值。Exemplarily, the first electronic device assigns an index value to the position of each pixel block, as shown in FIG. 8, from upper left to lower right, the index values are (1,1), (1,2) ~ ( 1, 4), (2, 1), (2, 2) ~ (2, 4), until the last (6, 4). For example, the index value of the position of the pixel block b2 is (2, 2), the index value of the position of the pixel block g2 is (2, 3), and the index value of the position of the pixel block i2 is (3, 1). In this way, the configuration file finally generated by the first electronic device includes: the correspondence between each pixel block in the merged image in FIG. 8 and the first frame image, the second frame image, and the third frame image, and each pixel block corresponds to The index value in the image of. Specifically, the configuration file includes: the pixel block A in the merged image in FIG. 8 corresponds to the first frame image, the second frame image, and the third frame image, and the pixel block A corresponds to the pixel A of the first frame image The index value of pixel A corresponds to the index value of the pixel block a2 of the second frame image, and the pixel block A corresponds to the index value of the pixel block a3 of the third frame image. The pixel block B in the merged image in FIG. 8 Corresponds to the first frame image, and the pixel block B corresponds to the index value of the pixel B of the first frame image, and so on, until the pixel block r3 in the merged image in FIG. 8 corresponds to the third frame image, and The pixel block r3 corresponds to the index value of the pixel r3 of the third frame image.
在一种可能的设计中,当第一电子设备是个人计算机时,第一电子设备可以直接将最终生成的合并图像和配置文件发送至第二电子设备,也可以在接收到第二电子设备的调用请求时,将最终生成的合并图像和配置文件发送至第二电子设备,以便于第二电子设备还原出动画。当第一电子设备是手机或者平板电脑时,第一电子设备可以对与第二电子设备共享的动画按照上述方法处理成合并图像和配置文件,并将最终生成的合并图像和配置文件发送至第二电子设备,以节省第二电子设备的ROM空间。In a possible design, when the first electronic device is a personal computer, the first electronic device may directly send the finally generated merged image and configuration file to the second electronic device, or may receive the second electronic device ’s When the request is invoked, the finally generated merged image and configuration file are sent to the second electronic device, so that the second electronic device restores the animation. When the first electronic device is a mobile phone or a tablet computer, the first electronic device can process the animation shared with the second electronic device into a merged image and configuration file according to the above method, and send the resulting merged image and configuration file to the first Two electronic devices to save the ROM space of the second electronic device.
补充来说,在步骤201中,第一电子设备划分生成的像素块可以为矩形块,且根据需要调整不同动画的像素块的大小,即第一电子设备对像素块的大小应具有动态配置能力,这样第一电子设备通过动态调整像素块大小,对序列帧图像进行划分,可以使得整个***对序列帧处理所获取的收益达到最佳。一般来说,像素块越小,对比精确度越高;由于像素块越小,整张图像划分的像素块数量会越多,导致用来描述对应关系的配置信息量越多,使配置文件增大,综合收益相对降低。所以第一电子设备需要在保证精确度的同时,也要使描述对应关系的配置信息量尽可能少。假设将描述对应关系的配置信息量称为“代价”,影响“代价”的因素有序列帧图像的分辨率、序列帧之间的相似度、帧数等,根据这些参数,进行计算,可以找出一个像素块大小的最优值。且配置文件中包括图像的宽度、高度、像素块的大小,动画的帧数等信息。In addition, in step 201, the pixel block generated by the first electronic device may be a rectangular block, and the size of the pixel block of different animations may be adjusted as needed, that is, the size of the pixel block should be dynamically configured by the first electronic device In this way, the first electronic device can dynamically adjust the pixel block size to divide the sequence frame image, so that the entire system can obtain the best gain for the sequence frame processing. In general, the smaller the pixel block, the higher the accuracy of the comparison; the smaller the pixel block, the greater the number of pixel blocks divided by the entire image, resulting in more configuration information used to describe the correspondence, which increases the configuration file. Large, relatively lower comprehensive income. Therefore, the first electronic device needs to keep the accuracy as well as the amount of configuration information describing the corresponding relationship as small as possible. Assuming that the amount of configuration information describing the correspondence is called "cost", the factors that affect the "cost" are the resolution of the sequence frame image, the similarity between the sequence frames, the number of frames, etc. According to these parameters, calculations can be found The optimal value of a pixel block size is given. And the configuration file includes the image width, height, pixel block size, animation frames and other information.
另外,需要说明的是,一帧图像中的M个像素块可以是大小相同的,也可以是大小不同。假设序列帧图像的分辨率为W*H,则划分像素块数量,横向为ω1=W/N(不能整除,向下取整),纵向为ω2=W/H(不能整除,向下取整);当W/N或H/N计算结果不是整数时,按照切分规则,会出现ω1*N<W(或ω2*N<H)的情况,即像素块重新排列后,总宽度小于序列帧图像宽度(或者总高度小于序列帧图像高度)。参见图9,当序列帧区域不能整倍数划分时,如图9a所示,图9a中宽度和高度均不能够整数倍划分。对剩余区域,以右边界对齐,从右向左扩展,以像素块为基本单位,继续划分出一列,如下图9b右侧所示的矩形区域。In addition, it should be noted that the M pixel blocks in a frame of image may be the same size or different sizes. Assuming that the resolution of the sequence frame image is W * H, the number of pixel blocks is divided, the horizontal direction is ω1 = W / N (cannot be divided, rounded down), and the vertical direction is ω2 = W / H (cannot be divided, rounded down) ); When the W / N or H / N calculation result is not an integer, according to the segmentation rule, there will be ω1 * N <W (or ω2 * N <H), that is, after the pixel blocks are rearranged, the total width is less than the sequence Frame image width (or total height is less than sequence frame image height). Referring to FIG. 9, when the sequence frame area cannot be divided by multiples, as shown in FIG. 9a, neither the width nor the height in FIG. 9a can be divided by integer multiples. For the remaining area, the right border is aligned, extending from right to left, and the pixel block is used as the basic unit to continue to divide a column, as shown in the rectangular area on the right side of Figure 9b.
值得说明的是,在步骤204中,本申请实施例生成的配置文件一般为JSON格式。除此之外,还可以是JSON、XML等格式,开发人员为保持配置文件有足够的压缩率,也可自行设计格式。配置文件和合并图像可以发送至第二电子设备,存储在第二电子设备上,也可以将配置文件保存在第一电子设备上,在第二电子设备需要播放动画时,再通过网络向第一电子设备发送请求,从第一电子设备获取配置文件和最终生成的合并图像。相对而言,将配置文件和合并图像存储在第一电子设备上,可以最大限度的减少占用第二电子设备的ROM空间。It is worth noting that, in step 204, the configuration file generated in this embodiment of the present application is generally in JSON format. In addition, it can also be in JSON, XML and other formats. Developers can also design their own format to maintain a sufficient compression ratio of the configuration file. The configuration file and the merged image can be sent to the second electronic device and stored on the second electronic device, or the configuration file can be saved on the first electronic device. The electronic device sends a request to obtain the configuration file and the finally generated merged image from the first electronic device. Relatively speaking, storing the configuration file and the merged image on the first electronic device can minimize the occupation of the ROM space of the second electronic device.
在一种可能的设计中,当动画的原始图像数量较多,或者是序列帧之间相似度太低,会导致第一电子设备生成的合并图像较大,这会直接导致第二电子设备在还原动画时,首次加载合并图像耗时会比较大,影响动画播放效果。为此,第一电子设备可以生成多帧合并图像,每帧合并图像均包含部分像素块,这样第二电子设备在初始播放动画时,只需要加载部分合并图像就可以完成初始动画播放,在动画播放的过程中,第二电子设备可以不断加载后续其余各帧合并图像。由于单个合并图像所占的ROM空间变小,所以第二电子设备加载到内存的耗时就会减少,从而提升动画加载效率。In a possible design, when the number of original images of the animation is large, or the similarity between sequence frames is too low, the merged image generated by the first electronic device will be larger, which will directly cause the second electronic device to When restoring an animation, it takes a long time to load the merged image for the first time, which affects the animation playback effect. To this end, the first electronic device can generate a multi-frame merged image, each frame of the merged image contains part of the pixel block, so that when the second electronic device initially plays the animation, it only needs to load part of the merged image to complete the initial animation playback. During the playing process, the second electronic device may continuously load the subsequent merged images of the remaining frames. Since the ROM space occupied by a single merged image becomes smaller, the time taken for the second electronic device to load into the memory will be reduced, thereby improving the animation loading efficiency.
在一种可能的设计中,当第一电子设备是PC时In a possible design, when the first electronic device is a PC
参见图10,示例性的示出了本申请实施例提供的第二种图像处理方法的流程,该方法由第二电子设备侧执行。Referring to FIG. 10, a flow of a second image processing method provided by an embodiment of the present application is exemplarily shown, and the method is executed by the second electronic device side.
步骤301,从第一电子设备获取配置文件和最终生成的合并图像,所述配置文件包括:最终生成的合并图像中每个像素块的序号与原始图像的序号的第一对应关系,以及最终生成的合并图像中每个像素块与所对应的原始图像的位置信息之间的第二对应关系。Step 301: Obtain a configuration file and a finally generated merged image from the first electronic device, the configuration file includes: a first correspondence between the serial number of each pixel block in the final generated merged image and the serial number of the original image, and the final generation The second correspondence between each pixel block in the merged image and the position information of the corresponding original image.
步骤302,根据所述第一对应关系,从所述最终生成的合并图像中确定与N帧原始图像的序号相对应的N组M个目标像素块。Step 302: According to the first correspondence, determine N sets of M target pixel blocks corresponding to the sequence number of the N frames of original images from the finally generated merged image.
步骤303,根据所述第二对应关系,确定所述每组M个目标像素块在对应的原始图像的 位置信息。Step 303: Determine the position information of each group of M target pixel blocks in the corresponding original image according to the second correspondence.
步骤304,根据所述位置信息排列组合所述每组M个目标像素块,生成所述N帧原始图像,并根据所述N帧原始图像还原出动画。In step 304, the M target pixel blocks of each group are arranged and combined according to the position information to generate the N frames of original images, and the animation is restored according to the N frames of original images.
示例性地,假设第二电子设备首先从第一电子设备获取图8中的合并图像,以及与该合并图像对应的配置文件。然后第二电子设备根据配置文件中的第一对应关系,从合并图像中确定出与第一帧图像对应的像素块有像素块A至像素块X,以及从合并图像中确定出与第二帧图像对应的像素块有像素块A、像素块b2、像素块C、像素快D至像素块f,像素块g2,像素块H至像素块X。依次类推,直至从合并图像中确定出与第三帧图像对应的像素块有像素块A至像素块F、像素块g3、像素块H、像素块i3、像素块j3、像素块H至像素块N、像素块o3、像素块P至像素块Q、像素块r3、像素块S至像素块X。进一步的,第二电子设备根据配置文件中的第二对应关系,确定与第一帧图像对应的像素块有像素块A至像素块X在第一帧图像中的位置信息,例如索引值依次为(1,1)、(1,2)~(1,4),(2,1)、(2,2)~(2,4)。并且确定出与第二帧图像对应的24个像素块在第二帧图像中的位置信息,依次类推,直至确定与第三帧图像对应的24个像素块在第三帧图像的位置信息。Exemplarily, assume that the second electronic device first obtains the merged image in FIG. 8 and the configuration file corresponding to the merged image from the first electronic device. Then, according to the first correspondence in the configuration file, the second electronic device determines that the pixel blocks corresponding to the first frame image include pixel block A to pixel block X from the merged image, and determines the second frame from the merged image The pixel blocks corresponding to the image include pixel block A, pixel block b2, pixel block C, pixel block D to pixel block f, pixel block g2, and pixel block H to pixel block X. And so on, until it is determined from the merged image that the pixel blocks corresponding to the third frame image are pixel block A to pixel block F, pixel block g3, pixel block H, pixel block i3, pixel block j3, pixel block H to pixel block N, pixel block o3, pixel block P to pixel block Q, pixel block r3, pixel block S to pixel block X. Further, according to the second correspondence in the configuration file, the second electronic device determines that the pixel blocks corresponding to the first frame image have pixel block A to pixel block X position information in the first frame image, for example, the index values are in order: (1,1), (1,2) to (1,4), (2,1), (2,2) to (2,4). And the position information of the 24 pixel blocks corresponding to the second frame image in the second frame image is determined, and so on until the position information of the 24 pixel blocks corresponding to the third frame image in the third frame image is determined.
进一步的,第二电子设备根据位置信息,排列组合成第一帧图像、第二帧图像和第三帧图像,这样最终根据第一帧图像、第二帧图像和第三帧图像就还原出动画。Further, the second electronic device arranges and combines the first frame image, the second frame image and the third frame image according to the position information, so that the animation is finally restored according to the first frame image, the second frame image and the third frame image .
再比如说,第二电子设备根据图6所示的合并图像,以及配置文件中对应关系,就可以还原出图4所示的第1帧至第10帧图像,最终还原出由图4所示的10帧图像组成的指纹动画。第二电子设备可以将还原出来的10帧图像存储在随机存储器(Random Access Memory,RAM)中。For another example, according to the merged image shown in FIG. 6 and the corresponding relationship in the configuration file, the second electronic device can restore the images from frame 1 to frame 10 shown in FIG. 4, and finally restore the image shown in FIG. 4 Fingerprint animation consisting of 10 frames of images. The second electronic device may store the restored 10-frame image in a random access memory (Random Access Memory, RAM).
参见图11,示例性的示出了本申请实施例提供的第三种图像处理方法的流程,该方法由第一电子设备执行。Referring to FIG. 11, an exemplary flowchart of a third image processing method provided by an embodiment of the present application is shown. The method is executed by a first electronic device.
步骤401,将动画中的N帧原始图像按照相同的方式均划分成M个像素块。In step 401, N frames of the original image in the animation are divided into M pixel blocks in the same manner.
示例性地,如图12所示,第一电子设备将动画中的第一帧图像、第二帧图像、第三帧图像和第四帧图像按照同样的方式划分成24个像素块。Exemplarily, as shown in FIG. 12, the first electronic device divides the first frame image, the second frame image, the third frame image, and the fourth frame image in the animation into 24 pixel blocks in the same manner.
步骤402,将所述N帧原始图像中的任意一帧原始图像的M个像素块写入到合并图像中。Step 402: Write M pixel blocks of any one frame of the original images in the N frames of original images into the merged image.
例如,将图12中的第一帧图像中的24个像素块写入到合并图像中。For example, 24 pixel blocks in the first frame image in FIG. 12 are written into the merged image.
步骤403,遍历其余N-1帧原始图像,针对所述N-1帧原始图像中的各个原始图像执行设定操作,所述设定操作包括:Step 403: Traverse the remaining N-1 frames of original images, and perform a setting operation on each original image in the N-1 frames of original images. The setting operation includes:
遍历第一图像中的第一像素块,当所述第一图像中的第一像素块与所述合并图像中的所有像素块均不同时,则将所述第一像素块写入所述合并图像中,否则,不将所述第一像素块写入所述合并图像中。Traverse the first pixel block in the first image, and when the first pixel block in the first image is different from all the pixel blocks in the merged image, the first pixel block is written to the merged In the image, otherwise, the first pixel block is not written into the merged image.
当所述第一图像中的第二像素块与当前最新的合并图像中的所有像素块均不同时,则将所述第二像素块写入当前最新的合并图像中,否则,不将所述第二像素块写入当前最新的合并图像中。返回遍历执行所述第一图像中的第三像素块,直至第一图像中的M个像素块全部遍历完成。When the second pixel block in the first image is different from all pixel blocks in the current latest merged image, the second pixel block is written into the current latest merged image, otherwise, the The second pixel block is written into the current latest merged image. Return to the traversal and execute the third pixel block in the first image until all the M pixel blocks in the first image are traversed.
按照所述设定操作返回执行所述N-1帧原始图像中的第二图像中的第三像素块,当所述第二图像中的第三像素块与当前最新的合并图像中的所有像素块均不同时,则将所述第三像素块写入当前最新的合并图像中,否则,不将所述第三像素块写入当前最新的合并图像中;返回执行所述第二图像中的第四像素块,直至第二图像中的M个像素块全部遍历完成。Return to execute the third pixel block in the second image of the N-1 frame original image according to the setting operation, when the third pixel block in the second image and all pixels in the current latest merged image When the blocks are different, the third pixel block is written into the current latest merged image; otherwise, the third pixel block is not written into the current latest merged image; the execution in the second image is returned to The fourth pixel block until all the M pixel blocks in the second image are traversed.
按照所述设定操作返回执行所述N-1帧原始图像中的第三图像中的M个像素块,直至N-1帧原始图像中的所有图像遍历完成。According to the setting operation, the M pixel blocks in the third image in the N-1 frame original image are returned to execution until the traversal of all images in the N-1 frame original image is completed.
以图12举例来说,第一电子设备首先依次遍历第二帧图像中的a2至x2这24个像素块,其中,第一电子设备比较像素块a2与当前合并图像的像素块A相同,第一电子设备不将像素块a2写入到合并图像中,并在配置文件记录此信息(第二帧图像中的像素块a2与当前最新的合并图像的像素块A相同);第一电子设备比较像素块b2与当前合并图像的所有像素块均不相同,第一电子设备将像素块b2写入到合并图像中,并在配置文件记录第二帧图像中的像素块b2在合并图像的位置信息,这时当前最新的合并图像中除了包括第一帧图像的所有像素块,还包括像素块b2;第一电子设备比较像素块c2与当前合并图像的像素块C相同,第一电子设备不将像素块c2写入到合并图像中,并在配置文件记录此信息(第二帧图像中的像素块c2与当前最新的合并图像的像素块C相同),依次类推,直至第一电子设备比较x2与当前最新的合并图像的像素块X相同,第一电子设备不将像素块x2写入到合并图像中,并在配置文件记录此信息(第二帧图像中的像素块x2与当前最新的合并图像的像素块X相同)。Taking FIG. 12 as an example, the first electronic device first traverses the 24 pixel blocks a2 to x2 in the second frame image in sequence. Among them, the first electronic device compares the pixel block a2 with the pixel block A of the current merged image. An electronic device does not write the pixel block a2 into the merged image, and records this information in the configuration file (the pixel block a2 in the second frame image is the same as the pixel block A of the current latest merged image); the first electronic device compares The pixel block b2 is different from all pixel blocks of the current merged image. The first electronic device writes the pixel block b2 into the merged image, and records the position information of the pixel block b2 in the second frame image in the merged image in the configuration file At this time, in addition to all the pixel blocks of the first frame image, the current latest merged image also includes the pixel block b2; the first electronic device compares the pixel block c2 with the pixel block C of the current merged image, the first electronic device does not The pixel block c2 is written to the merged image, and this information is recorded in the configuration file (the pixel block c2 in the second frame image is the same as the pixel block C of the current latest merged image), and so on, until An electronic device compares x2 with the pixel block X of the current latest merged image. The first electronic device does not write the pixel block x2 into the merged image, and records this information in the configuration file (pixel block x2 in the second frame image Same as the pixel block X of the current latest merged image).
进一步的,第一电子设备再次依次遍历第三帧图像中的a3至x3这24个像素块,以及第四帧图像中的a4至x4这24个像素块。具体处理方式与第二帧图像类似,在此不再赘述。Further, the first electronic device again sequentially traverses the 24 pixel blocks a3 to x3 in the third frame image and the 24 pixel blocks a4 to x4 in the fourth frame image. The specific processing method is similar to that of the second frame image, and will not be repeated here.
这样,第一电子设备最终生成的合并图像如图13所示,合并图像中除了包括第一帧图像的所有像素块,还包括像素块b2、像素块g2、像素块i2、像素块g34、像素块r4。In this way, the merged image finally generated by the first electronic device is shown in FIG. 13, in addition to all the pixel blocks of the first frame image, the merged image also includes pixel block b2, pixel block g2, pixel block i2, pixel block g34, pixels Block r4.
步骤404,生成配置文件,所述配置文件包括:最后生成的合并图像中每个像素块的序号与原始图像的序号的对应关系,以及最后生成的合并图像中每个像素块在所对应的原始图像中的位置信息。In step 404, a configuration file is generated, the configuration file includes: the correspondence between the serial number of each pixel block in the last generated merged image and the serial number of the original image, and the corresponding original Location information in the image.
示例性地,第一电子设备对最新生成的合并图像以及四帧原始图像中的每个像素块的位置都分配一个索引值,以图12来说,从左上到右下,四帧原始图像的每个像素块的索引值依次为(1,1)、(1,2)~(1,4),(2,1)、(2,2)~(2,4),直到最后一个(6,4)。例如,像素块b2的位置的索引值为(2,2),像素块g2的位置的索引值为(2,3),像素块i2的位置的索引值为(3,1)。这样第一电子设备最终生成的配置文件包括:图13中最终生成的合并图像中的每个像素块与第一帧图像、第二帧图像、第三帧图像和第四帧图像的对应关系,以及每个像素块在与其对应的图像中的索引值。具体来说,配置文件包括:图13中合并图像中的像素块A与第一帧图像、第二帧图、第三帧图像和第四帧图像相对应,且像素块A对应的是第一帧图像的像素A的索引值,像素A对应的是第二帧图像的像素块a2的索引值,且像素块A对应的是第三帧图像的像素块a3的索引值,且像素块A对应的是第四帧图像的像素块a4的索引值。图13中合并图像中的像素块B与第一帧图像相对应、第二帧图像和第四帧图像相对于,且像素块B对应的是第一帧图像的像素B的索引值、以及对应的是第三帧图像的像素b3的索引值,以及对应的是第四帧图像b4的索引值,依次类推,直至,图13中合并图像中的像素块X4与第一帧图像、第二帧图像、第三帧图像和第四帧图像相对应,且像素块x4对应的是第一帧图像的像素X的索引值、以及第二帧图像的像素x2的索引值、以及第三帧图像的像素x3的索引值、以及第四帧图像的像素x4的索引值。Exemplarily, the first electronic device assigns an index value to the position of each pixel block in the newly generated merged image and the four frames of the original image, as shown in FIG. 12, from the upper left to the lower right, the four frames of the original image The index value of each pixel block is (1,1), (1,2) ~ (1,4), (2,1), (2,2) ~ (2,4), until the last one (6 , 4). For example, the index value of the position of the pixel block b2 is (2, 2), the index value of the position of the pixel block g2 is (2, 3), and the index value of the position of the pixel block i2 is (3, 1). In this way, the configuration file finally generated by the first electronic device includes: the correspondence between each pixel block in the merged image finally generated in FIG. 13 and the first frame image, second frame image, third frame image, and fourth frame image, And the index value of each pixel block in the image corresponding to it. Specifically, the configuration file includes: the pixel block A in the merged image in FIG. 13 corresponds to the first frame image, the second frame image, the third frame image, and the fourth frame image, and the pixel block A corresponds to the first The index value of the pixel A of the frame image, the pixel A corresponds to the index value of the pixel block a2 of the second frame image, and the pixel block A corresponds to the index value of the pixel block a3 of the third frame image, and the pixel block A corresponds to Is the index value of the pixel block a4 of the fourth frame image. The pixel block B in the merged image in FIG. 13 corresponds to the first frame image, the second frame image and the fourth frame image correspond, and the pixel block B corresponds to the index value of the pixel B of the first frame image and the corresponding Is the index value of the pixel b3 of the third frame image, and the corresponding index value of the fourth frame image b4, and so on, until the pixel block X4 in the merged image in FIG. 13 is combined with the first frame image and the second frame The image, the third frame image and the fourth frame image correspond to each other, and the pixel block x4 corresponds to the index value of the pixel X of the first frame image, the index value of the pixel x2 of the second frame image, and the index value of the third frame image The index value of the pixel x3 and the index value of the pixel x4 of the fourth frame image.
在一种可能的设计中,第一电子设备可以直接将最终生成的合并图像和配置文件发送至第二电子设备,也可以在接收到第二电子设备的调用请求时,将最终生成的合并图像和配置文件发送至第二电子设备,以便于第二电子设备还原出动画。In a possible design, the first electronic device may directly send the finally generated merged image and configuration file to the second electronic device, or may receive the finally generated merged image when receiving the call request of the second electronic device And the configuration file are sent to the second electronic device, so that the second electronic device restores the animation.
补充来说,第一电子设备可以从四帧图像选择任意一帧图像的所有像素块写入到合并图像中,第一电子设备除了可以选择将帧图像的像素块与最新生成的合并图像中的所有像素块 做比较,也可以选择将帧图像的像素块与已完成对比的帧图像中的所有像素块做比较,相较而言,第一电子设备选择将帧图像的像素块与最新生成的合并图像中的所有像素块做比较可以减少对比的次数,也可以实现最终生成的合并图像中不存在相同的像素块,可以最大限度的减小合并图像所占用的ROM空间。In addition, the first electronic device can select all the pixel blocks of any one frame image from the four-frame image to write to the merged image. In addition to the first electronic device can select the pixel blocks of the frame image For comparison of all pixel blocks, you can also choose to compare the pixel blocks of the frame image with all the pixel blocks in the frame image that has been compared. In comparison, the first electronic device chooses to compare the pixel blocks of the frame image with the latest generated Comparing all the pixel blocks in the merged image can reduce the number of comparisons, and can also realize that the same pixel block does not exist in the resulting merged image, which can minimize the ROM space occupied by the merged image.
在一种可能的设计中,第一电子设备可以直接将最终生成的合并图像和配置文件发送至第二电子设备,也可以在接收到第二电子设备的调用请求时,将最终生成的合并图像和配置文件发送至第二电子设备,以便于第二电子设备还原出动画。In a possible design, the first electronic device may directly send the finally generated merged image and configuration file to the second electronic device, or may receive the finally generated merged image when receiving the call request of the second electronic device And the configuration file are sent to the second electronic device, so that the second electronic device restores the animation.
需要说明的是,在步骤401中,第一电子设备划分生成的像素块的方式、配置文件的格式与第一种方法的实现相同,在此不再赘述。It should be noted that, in step 401, the manner in which the first electronic device divides the generated pixel block and the format of the configuration file are the same as the implementation of the first method, and details are not described herein again.
在一种可能的设计中,当动画的原始图像数量较多,或者是序列帧之间相似度太低,会导致第一电子设备生成的合并图像较大,这会直接导致第二电子设备在还原动画时,首次加载合并图像耗时会比较大,影响动画播放效果。为此,第一电子设备可以生成多帧合并图像,每帧合并图像均包含部分像素块,这样第二电子设备在初始播放动画时,只需要加载部分合并图像就可以完成初始动画播放,在动画播放的过程中,第二电子设备可以不断加载后续其余各帧合并图像。由于单个合并图像所占的ROM空间变小,所以第二电子设备加载到内存的耗时就会减少,从而提升动画加载效率。In a possible design, when the number of original images of the animation is large, or the similarity between sequence frames is too low, the merged image generated by the first electronic device will be larger, which will directly cause the second electronic device to When restoring an animation, it takes a long time to load the merged image for the first time, which affects the animation playback effect. To this end, the first electronic device can generate a multi-frame merged image, each frame of the merged image contains part of the pixel block, so that when the second electronic device initially plays the animation, it only needs to load part of the merged image to complete the initial animation playback. During the playing process, the second electronic device may continuously load the subsequent merged images of the remaining frames. Since the ROM space occupied by a single merged image becomes smaller, the time taken for the second electronic device to load into the memory will be reduced, thereby improving the animation loading efficiency.
同理,第二电子设备从第一电子设备获取配置文件和最终生成的合并图像之后,还原动画的过程如图图10示出第二种图像处理方法流程一致,在此不再赘述。Similarly, after the second electronic device obtains the configuration file and the finally generated merged image from the first electronic device, the process of restoring animation is as shown in FIG. 10, and the flow of the second image processing method is the same, which will not be repeated here.
参见图14,示例性的示出了本申请实施例提供的第四种图像处理方法的流程,该方法由第一电子设备执行。Referring to FIG. 14, an exemplary flow of a fourth image processing method provided by an embodiment of the present application is exemplarily shown, and the method is executed by a first electronic device.
步骤501,将动画中的N张原始图像按照相同的方式均划分成M个像素块。Step 501: Divide N original images in the animation into M pixel blocks in the same manner.
步骤502,将第一图像的M个像素块写入到合并图像中,其中,第一图像为所述N帧原始图像中的任意一帧原始图像。Step 502: Write M pixel blocks of the first image into the merged image, where the first image is any one of the original images of the N original images.
例如,第一图像为图12中的第一帧图像,第一电子设备将图12中的第一帧图像中的24个像素块写入到合并图像中。For example, the first image is the first frame image in FIG. 12, and the first electronic device writes the 24 pixel blocks in the first frame image in FIG. 12 into the merged image.
步骤503,遍历其余N-1帧原始图像,针对所述N-1帧原始图像中的各个原始图像执行设定操作,所述设定操作包括: Step 503, traverse the remaining N-1 frames of the original image, and perform a setting operation on each original image in the N-1 frames of the original image. The setting operation includes:
遍历第二图像中的第一像素块,当所述第二图像中的第一像素块与第一图像中的所有像素块均不同时,则将所述第一像素块写入所述合并图像中,否则,不将所述第一像素块写入所述合并图像中。Traverse the first pixel block in the second image, when the first pixel block in the second image is different from all the pixel blocks in the first image, the first pixel block is written to the merged image , Otherwise, the first pixel block is not written into the merged image.
当第二图像中的第二像素块与第一图像中的所有像素块均不同时,则将所述第二像素块写入当前最新的合并图像中,否则,不将所述第二像素块写入当前最新的合并图像中。返回遍历执行所述第二图像中的第三像素块,直至第二图像中的M个像素块全部遍历完成。When the second pixel block in the second image is different from all pixel blocks in the first image, the second pixel block is written into the current latest merged image, otherwise, the second pixel block is not written Write to the current latest merged image. Return to traverse to execute the third pixel block in the second image until all the M pixel blocks in the second image are traversed.
按照所述设定操作返回执行所述N-1帧原始图像中的第三图像中的第四像素块,当所述第三图像中的第四像素块与第一图像中的所有像素块和第二图像中的所有像素块均不同时,则将所述第四像素块写入当前最新的合并图像中,否则,不将所述第四像素块写入当前最新的合并图像中;返回执行所述第三图像中的第五像素块,直至第三图像中的M个像素块全部遍历完成。According to the setting operation, the fourth pixel block in the third image in the original image of the N-1 frame is executed, when the fourth pixel block in the third image and all the pixel blocks in the first image sum When all the pixel blocks in the second image are different, the fourth pixel block is written into the current latest merged image; otherwise, the fourth pixel block is not written into the current latest merged image; return to execution The fifth pixel block in the third image is traversed until all the M pixel blocks in the third image are traversed.
按照所述设定操作返回执行所述N-1帧原始图像中的第四图像中的M个像素块,直至N-1帧原始图像中的所有图像遍历完成。According to the setting operation, the M pixel blocks in the fourth image in the original image of the N-1 frame are returned to be executed until the traversal of all images in the original image of the N-1 frame is completed.
以图12举例来说,第一电子设备首先依次遍历第二帧图像中的a2至x2这24个像素块,其中,第一电子设备比较像素块a2与第一帧图像的所有像素块是否相同,确定出来像素块a2与第一帧图像的像素块A相同,第一电子设备不将像素块a2写入到合并图像中,并在配置文件记录此信息(第二帧图像中的像素块a2与第一帧图像的像素块A相同);第一电子设备比较像素块b2与第一帧图像的像素块的所有像素块均不相同,第一电子设备将像素块b2写入到合并图像中,并在配置文件记录第二帧图像中的像素块b2在合并图像的位置信息,这时当前最新的合并图像中除了包括第一帧图像的所有像素块,还包括像素块b2;第一电子设备将像素块c2与第一帧图像的所有像素块比较,确定出来像素块c2与第一帧图像的像素块C相同,第一电子设备不将像素块c2写入到合并图像中,并在配置文件记录此信息(第二帧图像中的像素块c2与第一帧图像的像素块C相同),依次类推,直至第一电子设备比较x2与第一帧图像中的像素块X相同,第一电子设备不将像素块x2写入到合并图像中,并在配置文件记录此信息(第二帧图像中的像素块x2第一帧图像的像素块X相同)。Taking FIG. 12 as an example, the first electronic device first traverses the 24 pixel blocks a2 to x2 in the second frame image in sequence, where the first electronic device compares whether the pixel block a2 is the same as all pixel blocks in the first frame image , It is determined that the pixel block a2 is the same as the pixel block A of the first frame image, the first electronic device does not write the pixel block a2 to the merged image, and records this information in the configuration file (the pixel block a2 in the second frame image Same as the pixel block A of the first frame image); the first electronic device compares the pixel block b2 with all the pixel blocks of the pixel block of the first frame image, and the first electronic device writes the pixel block b2 into the merged image And record the position information of the pixel block b2 in the second frame image in the merged image in the configuration file. At this time, the current latest merged image includes the pixel block b2 in addition to all the pixel blocks of the first frame image; the first electronic The device compares the pixel block c2 with all the pixel blocks of the first frame image, and determines that the pixel block c2 is the same as the pixel block C of the first frame image. The first electronic device does not write the pixel block c2 into the merged image, and Match The file records this information (the pixel block c2 in the second frame image is the same as the pixel block C in the first frame image), and so on, until the first electronic device compares x2 with the pixel block X in the first frame image, the first The electronic device does not write the pixel block x2 into the merged image, and records this information in the configuration file (the pixel block x2 in the second frame image is the same as the pixel block X in the first frame image).
进一步的,第一电子设备再次依次遍历第三帧图像中的a3至x3这24个像素块,其中,第一电子设备比较像素块a2与第一帧图像和第二帧图像的所有像素块是否相同,确定出来像素块a3与第一帧图像的像素块A(或像素块a2)相同,第一电子设备不将像素块a3写入到合并图像中,并在配置文件记录此信息(第三帧图像中的像素块a3与第一帧图像的像素块A相同);第一电子设备将像素块b3与第一帧图像和第二帧图像的所有像素进行比较,像素块b3与第二帧图像中的像素块b2相同,第一电子设备不将像素块b3写入到合并图像中,并在配置文件记录此信息(第三帧图像中的像素块b3与第一帧图像的像素块B相同);直至第一电子设备比较x3与第一帧图像中的像素块X相同,第一电子设备不将像素块x3写入到合并图像中,并在配置文件记录此信息(第三帧图像中的像素块x3第一帧图像的像素块X相同)。Further, the first electronic device again traverses the 24 pixel blocks a3 to x3 in the third frame image in sequence, wherein the first electronic device compares the pixel block a2 with all pixel blocks of the first frame image and the second frame image The same, it is determined that the pixel block a3 is the same as the pixel block A (or pixel block a2) of the first frame image, the first electronic device does not write the pixel block a3 into the merged image, and records this information in the configuration file (third The pixel block a3 in the frame image is the same as the pixel block A of the first frame image); the first electronic device compares the pixel block b3 with all pixels of the first frame image and the second frame image, and the pixel block b3 and the second frame The pixel block b2 in the image is the same, the first electronic device does not write the pixel block b3 to the merged image, and records this information in the configuration file (the pixel block b3 in the third frame image and the pixel block B in the first frame image Same); until the first electronic device compares x3 with the pixel block X in the first frame image, the first electronic device does not write the pixel block x3 into the merged image, and records this information in the configuration file (third frame image Pixel block in x3 first frame image The same pixel block X).
依次类推,以及第四帧图像中的a4至x4这24个像素块。具体处理方式同上文,在此不再赘述。And so on, and the 24 pixel blocks a4 to x4 in the fourth frame image. The specific processing method is the same as above, and will not be repeated here.
这样,第一电子设备最终生成的合并图像如图15所示,合并图像中除了包括第一帧图像的所有像素块,还包括像素块b2、像素块g2、像素块i2、像素块g3、像素块i3、像素块r4。In this way, the merged image finally generated by the first electronic device is shown in FIG. 15, in addition to all the pixel blocks of the first frame image, the merged image also includes pixel block b2, pixel block g2, pixel block i2, pixel block g3, pixels Block i3, pixel block r4.
步骤404,第一电子设备生成配置文件,所述配置文件包括:最后生成的合并图像中每个像素块的序号与原始图像的序号的对应关系,以及最后生成的合并图像中每个像素块在所对应的原始图像中的位置信息。Step 404, the first electronic device generates a configuration file, the configuration file includes: the correspondence between the serial number of each pixel block in the merged image generated last and the serial number of the original image, and each pixel block in the merged image generated last The position information in the corresponding original image.
示例性地,第一电子设备对最新生成的合并图像以及四帧原始图像中的每个像素块的位置都分配一个索引值,以图12来说,从左上到右下,四帧原始图像的每个像素块的索引值依次为(1,1)、(1,2)~(1,4),(2,1)、(2,2)~(2,4),直到最后一个(6,4)。例如,像素块b2的位置的索引值为(2,2),像素块g2的位置的索引值为(2,3),像素块i2的位置的索引值为(3,1)。这样第一电子设备最终生成的配置文件包括:图15中最终生成的合并图像中的每个像素块与第一帧图像、第二帧图像、第三帧图像和第四帧图像的对应关系,以及每个像素块在与其对应的图像中的索引值。具体来说,配置文件包括:图15中合并图像中的像素块A与第一帧图像、第二帧图像、第三帧图像和第四帧图像相对应,且像素块A对应的是第一帧图像的像素A的索引值,像素A对应的是第二帧图像的像素块a2的索引值,且像素块A对应的是第三帧图像的像素块a3的索引值,且像素块A对应的是第四帧图像的像素块a4的索引值。图15中合并图像中的像素块B与第一帧图像相对应、第二帧图像和第四帧图像相对应,且像素块B对应的是第一帧图像的像素B的索引值、以及对应的是第三帧图像的像素b3的索引值,以及对应的是第四帧图像b4的索引值,依次类推,直至,图13中合并 图像中的像素块X4与第一帧图像、第二帧图像、第三帧图像和第四帧图像相对应,且像素块x4对应的是第一帧图像的像素X的索引值、以及第二帧图像的像素x2的索引值、以及第三帧图像的像素x3的索引值、以及第四帧图像的像素x4的索引值。Exemplarily, the first electronic device assigns an index value to the position of each pixel block in the newly generated merged image and the four frames of the original image, as shown in FIG. 12, from the upper left to the lower right, the four frames of the original image The index value of each pixel block is (1,1), (1,2) ~ (1,4), (2,1), (2,2) ~ (2,4), until the last one (6 , 4). For example, the index value of the position of the pixel block b2 is (2, 2), the index value of the position of the pixel block g2 is (2, 3), and the index value of the position of the pixel block i2 is (3, 1). In this way, the configuration file finally generated by the first electronic device includes: the correspondence between each pixel block in the merged image finally generated in FIG. 15 and the first frame image, second frame image, third frame image, and fourth frame image, And the index value of each pixel block in the image corresponding to it. Specifically, the configuration file includes: the pixel block A in the merged image in FIG. 15 corresponds to the first frame image, the second frame image, the third frame image, and the fourth frame image, and the pixel block A corresponds to the first The index value of the pixel A of the frame image, the pixel A corresponds to the index value of the pixel block a2 of the second frame image, and the pixel block A corresponds to the index value of the pixel block a3 of the third frame image, and the pixel block A corresponds to Is the index value of the pixel block a4 of the fourth frame image. The pixel block B in the merged image in FIG. 15 corresponds to the first frame image, the second frame image and the fourth frame image, and the pixel block B corresponds to the index value of the pixel B of the first frame image and the corresponding Is the index value of the pixel b3 of the third frame image, and the corresponding index value of the fourth frame image b4, and so on, until the pixel block X4 in the merged image in FIG. 13 is combined with the first frame image and the second frame The image, the third frame image and the fourth frame image correspond to each other, and the pixel block x4 corresponds to the index value of the pixel X of the first frame image, the index value of the pixel x2 of the second frame image, and the index value of the third frame image The index value of the pixel x3 and the index value of the pixel x4 of the fourth frame image.
在一种可能的设计中,第一电子设备可以直接将最终生成的合并图像和配置文件发送至第二电子设备,也可以在接收到第二电子设备的调用请求时,将最终生成的合并图像和配置文件发送至第二电子设备,以便于第二电子设备还原出动画。In a possible design, the first electronic device may directly send the finally generated merged image and configuration file to the second electronic device, or may receive the finally generated merged image when receiving the call request of the second electronic device And the configuration file are sent to the second electronic device, so that the second electronic device restores the animation.
补充来说,第一电子设备可以从四帧图像选择任意一帧图像的所有像素块写入到合并图像中,第一电子设备除了可以选择将帧图像的像素块与最新生成的合并图像中的所有像素块做比较,也可以选择将帧图像的像素块与已完成对比的帧图像中的所有像素块做比较,相较而言,第一电子设备选择将帧图像的像素块与最新生成的合并图像中的所有像素块做比较可以减少对比的次数,也可以实现最终生成的合并图像中不存在相同的像素块,可以最大限度的减小合并图像所占用的ROM空间。In addition, the first electronic device can select all the pixel blocks of any one frame image from the four-frame image to write to the merged image. In addition to the first electronic device can select the pixel blocks of the frame image and the latest generated merged image For comparison of all pixel blocks, you can also choose to compare the pixel blocks of the frame image with all the pixel blocks in the frame image that has been compared. In comparison, the first electronic device chooses to compare the pixel blocks of the frame image with the latest generated Comparing all the pixel blocks in the merged image can reduce the number of comparisons, and can also realize that the same pixel block does not exist in the resulting merged image, which can minimize the ROM space occupied by the merged image.
在一种可能的设计中,第一电子设备可以直接将最终生成的合并图像和配置文件发送至第二电子设备,也可以在接收到第二电子设备的调用请求时,将最终生成的合并图像和配置文件发送至第二电子设备,以便于第二电子设备还原出动画。In a possible design, the first electronic device may directly send the finally generated merged image and configuration file to the second electronic device, or may receive the finally generated merged image when receiving the call request of the second electronic device And the configuration file are sent to the second electronic device, so that the second electronic device restores the animation.
需要说明的是,在步骤501中,第一电子设备划分生成的像素块的方式、配置文件的格式与第一种方法的实现相同,在此不再赘述。It should be noted that, in step 501, the manner in which the first electronic device divides the generated pixel block and the format of the configuration file are the same as the implementation of the first method, and details are not described herein again.
该实施例相较于本申请实施例提供的第一种方法,可以一定程度上减少合并图像的大小,但相较于本申请实施例的第二种方法,且可能在合并图像中存在同样的像素块,相比较而言,第二种方法生成的合并图像占用的ROM最小,节省空间的收益最大。Compared with the first method provided by the embodiment of the present application, this embodiment can reduce the size of the merged image to a certain extent, but compared to the second method of the embodiment of the present application, and there may be the same in the merged image Compared with pixel blocks, the combined image generated by the second method occupies the smallest ROM and saves the most space.
本申请实施例还提供一种图像处理***,该***由第一电子设备和第二电子设备组成,如图16所示,其中第一电子设备中包括图像合并模块601,第二电子设备包括序列帧还原模块602和动画播放模块603。An embodiment of the present application also provides an image processing system, which is composed of a first electronic device and a second electronic device, as shown in FIG. 16, wherein the first electronic device includes an image merging module 601, and the second electronic device includes a sequence Frame restoration module 602 and animation playback module 603.
其中,合并模块601,用于按照本申请实施例提供的第一种图像处理方法、第三种图像处理方法或者第四种图像处理方法,将动画的序列帧图像处理成合并图像和配置文件。Among them, the merging module 601 is used to process the sequence image of the animation into a merged image and a configuration file according to the first image processing method, the third image processing method, or the fourth image processing method provided in the embodiments of the present application.
序列帧还原模块602,用于按照本申请实施例提供的第二种图像处理方法、根据合并图像和配置文件还原得到多帧原始图像。The sequence frame restoration module 602 is configured to restore multiple frames of original images according to the second image processing method provided in the embodiments of the present application, according to the merged image and the configuration file.
动画播放模块603,用于读取序列帧还原模块602输出的多帧原始图像,根据需求将多帧原始图像封装成序列帧动画。The animation playing module 603 is used to read the multi-frame original images output by the sequence frame restoration module 602, and encapsulate the multi-frame original images into a sequence frame animation according to requirements.
可见,第二电子设备只需要配置文件和合并图像就可以还原出动画,相较于现有技术直接通过轮询播放序列帧,占用ROM空间明显减少。It can be seen that the second electronic device only needs the configuration file and the merged image to restore the animation. Compared with the prior art, the sequence frame is directly played by polling, and the occupied ROM space is significantly reduced.
其中,序列帧还原模块602和播放处理模块603可以按照先后顺序执行,即序列帧还原模块602先还原出所有序列帧,播放处理模块603再使用传统的序列帧技术,对序列帧动画进行处理,这样做的优势是与传统序列帧技术性的兼容性较好。另外,序列帧还原模块602也可以和播放处理模块603同步执行,序列帧还原模块602每还原出一帧,就输出给播放处理模块603,因这两个模块可以同步运行,进而可避免因“序列帧还原模块”处理时间较长,出现动画播放等待的问题,交互性更加友好。Among them, the sequence frame restoration module 602 and the playback processing module 603 can be executed in order, that is, the sequence frame restoration module 602 first restores all sequence frames, and the playback processing module 603 then uses the traditional sequence frame technology to process the sequence frame animation, The advantage of this is that it is technically compatible with traditional sequence frames. In addition, the sequence frame restoration module 602 can also be executed synchronously with the playback processing module 603. Each time the sequence frame restoration module 602 restores a frame, it is output to the playback processing module 603, because the two modules can operate synchronously, which can avoid The "sequence frame restoration module" has a long processing time, and the problem of waiting for animation playback occurs, and the interactivity is more friendly.
本申请实施例所提供的图像处理方法可以应用到手机中所有涉及序列帧动画播放的场景,利用该技术可以为手机节约大量ROM空间,节省出来的空间便于***运行其它重要的功能。The image processing method provided in the embodiments of the present application can be applied to all scenes involving sequence frame animation playback in a mobile phone. Using this technology can save a lot of ROM space for the mobile phone, and the saved space is convenient for the system to run other important functions.
本申请实施例中还提供一种计算机可读存储介质,所述计算机可读存储介质包括计算机程序,当计算机程序在电子设备上运行时,使得所述电子设备执行上述信息处理方法任意一种可能的实现。An embodiment of the present application also provides a computer-readable storage medium. The computer-readable storage medium includes a computer program. When the computer program runs on an electronic device, the electronic device may perform any one of the foregoing information processing methods. Implementation.
本申请实施例还提供一种包含计算机程序产品,当所述计算机程序产品在电子设备上运行时,使得所述电子设备执行上述信息处理方法任意一种可能的实现。An embodiment of the present application further provides a computer program product that, when the computer program product runs on an electronic device, causes the electronic device to execute any possible implementation of the above-mentioned information processing method.
在本申请的另一些实施例中,本申请实施例公开了一种第一电子设备,如图17所示,该第一电子设备可以包括:处理器701;存储器702;以及一个或多个计算机程序703,上述各器件可以通过一个或多个通信总线704连接。In other embodiments of the present application, the embodiments of the present application disclose a first electronic device. As shown in FIG. 17, the first electronic device may include: a processor 701; a memory 702; and one or more computers In program 703, the above devices may be connected through one or more communication buses 704.
其中该一个或多个计算机程序703被存储在上述存储器702中并被配置为被处理器701执行,该一个或多个计算机程序703包括指令,上述指令可以用于执行如图7、图11和图14相应实施例中的各个步骤。具体地,处理器701用于执行图7中的步骤201和步骤204,处理器701用于执行图11中的步骤401和步骤404,处理器701用于执行图14中的步骤501和步骤504。处理器701生成的合并图像和配置文件保存在存储器702中。Wherein the one or more computer programs 703 are stored in the above-mentioned memory 702 and configured to be executed by the processor 701, the one or more computer programs 703 include instructions, and the above-mentioned instructions may be used to execute as shown in FIG. 7, FIG. 11 and Figure 14 shows the steps in the corresponding embodiment. Specifically, the processor 701 is used to perform step 201 and step 204 in FIG. 7, the processor 701 is used to perform step 401 and step 404 in FIG. 11, and the processor 701 is used to perform step 501 and step 504 in FIG. . The merged image and configuration file generated by the processor 701 are stored in the memory 702.
通过以上的实施方式的描述,所属领域的技术人员可以清楚地了解到,为描述的方便和简洁,仅以上述各功能模块的划分进行举例说明,实际应用中,可以根据需要而将上述功能分配由不同的功能模块完成,即将装置的内部结构划分成不同的功能模块,以完成以上描述的全部或者部分功能。上述描述的***,装置和单元的具体工作过程,可以参考前述方法实施例中的对应过程,在此不再赘述。Through the description of the above embodiments, those skilled in the art can clearly understand that, for convenience and conciseness of description, only the above-mentioned division of each functional module is used as an example for illustration. In practical applications, the above-mentioned functions can be allocated as needed It is completed by different functional modules, that is, the internal structure of the device is divided into different functional modules to complete all or part of the functions described above. For the specific working processes of the system, device and unit described above, reference may be made to the corresponding processes in the foregoing method embodiments, which will not be repeated here.
在本申请实施例各个实施例中的各功能单元可以集成在一个处理单元中,也可以是各个单元单独物理存在,也可以两个或两个以上单元集成在一个单元中。上述集成的单元既可以采用硬件的形式实现,也可以采用软件功能单元的形式实现。The functional units in the embodiments of the present application may be integrated into one processing unit, or each unit may exist alone physically, or two or more units are integrated into one unit. The above integrated unit may be implemented in the form of hardware or software functional unit.
所述集成的单元如果以软件功能单元的形式实现并作为独立的产品销售或使用时,可以存储在一个计算机可读取存储介质中。基于这样的理解,本申请实施例的技术方案本质上或者说对现有技术做出贡献的部分或者该技术方案的全部或部分可以以软件产品的形式体现出来,该计算机软件产品存储在一个存储介质中,包括若干指令用以使得一台计算机设备(可以是个人计算机,第一电子设备,或者网络设备等)或处理器执行本申请各个实施例所述方法的全部或部分步骤。而前述的存储介质包括:快闪存储器、移动硬盘、只读存储器、随机存取存储器、磁碟或者光盘等各种可以存储程序代码的介质。If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it may be stored in a computer-readable storage medium. Based on such an understanding, the technical solutions of the embodiments of the present application may essentially be part of or contribute to the existing technology, or all or part of the technical solutions may be embodied in the form of software products, and the computer software products are stored in a storage The medium includes several instructions to enable a computer device (which may be a personal computer, a first electronic device, or a network device, etc.) or a processor to perform all or part of the steps of the methods described in the embodiments of the present application. The foregoing storage media include: flash memory, mobile hard disk, read-only memory, random access memory, magnetic disk or optical disk and other media that can store program codes.
以上所述,仅为本申请实施例的具体实施方式,但本申请实施例的保护范围并不局限于此,任何在本申请实施例揭露的技术范围内的变化或替换,都应涵盖在本申请实施例的保护范围之内。因此,本申请实施例的保护范围应以所述权利要求的保护范围为准。The above is only the specific implementation of the embodiments of the present application, but the scope of protection of the embodiments of the present application is not limited to this, any changes or replacements within the technical scope disclosed in the embodiments of the present application should be covered in this Within the scope of protection of the application examples. Therefore, the protection scope of the embodiments of the present application shall be subject to the protection scope of the claims.

Claims (10)

  1. 一种图像处理方法,应用于第一电子设备,其特征在于,所述方法包括:An image processing method applied to a first electronic device, characterized in that the method includes:
    将动画中的N帧原始图像按照相同的方式均划分成M个像素块;Divide N frames of the original image in the animation into M pixel blocks in the same way;
    将所述N帧原始图像中的第一帧原始图像的M个像素块写入到合并图像中;Writing M pixel blocks of the first frame of the original image in the N frames of the original image into the merged image;
    针对第K帧原始图像,所述第K帧原始图像为其余N-1帧原始图像中的任意一帧原始图像,执行如下操作:For the Kth frame original image, the Kth frame original image is any one of the remaining N-1 frame original images, perform the following operations:
    遍历第K帧原始图像中的第一像素块,当所述第K帧原始图像中的第一像素块与第K-1帧原始图像中的相同位置的像素块不同时,则将所述第一像素块写入所述合并图像中,否则,不将所述第一像素块写入所述合并图像中;Traverse the first pixel block in the original image of the Kth frame, when the first pixel block in the original image of the Kth frame is different from the pixel block at the same position in the original image of the K-1th frame, the One pixel block is written into the merged image, otherwise, the first pixel block is not written into the merged image;
    当所述第K帧原始图像中的第二像素块与当前最新的合并图像中的所有像素块均不同时,则将所述第二像素块写入当前最新的合并图像中,否则,不将所述第二像素块写入当前最新的合并图像中;When the second pixel block in the original image of the Kth frame is different from all pixel blocks in the current latest merged image, the second pixel block is written into the current latest merged image, otherwise, the The second pixel block is written into the current latest merged image;
    返回遍历执行所述第K帧原始图像中的第三像素块,直至第K帧原始图像中的M个像素块全部遍历完成;其中,K为大于1的正整数;Return to traverse and execute the third pixel block in the original image of the Kth frame until all M pixel blocks in the original image of the Kth frame are traversed; where K is a positive integer greater than 1;
    生成配置文件,所述配置文件包括:最终生成的合并图像中每个像素块的序号与原始图像的序号的第一对应关系,以及最终生成的合并图像中每个像素块与所对应的原始图像中的位置信息之间的第二对应关系。Generating a configuration file, the configuration file including: a first correspondence between the serial number of each pixel block in the finally generated merged image and the serial number of the original image, and each pixel block in the finally generated merged image and the corresponding original image The second correspondence between the location information in.
  2. 根据权利要求1所述的方法,其特征在于,该方法还包括:The method of claim 1, further comprising:
    将所述配置文件和所述最终生成的合并图像发送至第二电子设备。Sending the configuration file and the finally generated combined image to the second electronic device.
  3. 一种图像处理方法,应用于第一电子设备,其特征在于,所述方法包括:An image processing method applied to a first electronic device, characterized in that the method includes:
    将动画中的N帧原始图像按照相同的方式均划分成M个像素块;Divide N frames of the original image in the animation into M pixel blocks in the same way;
    将所述N帧原始图像中的任意一帧原始图像的M个像素块写入到合并图像中;Writing M pixel blocks of any one frame of the original images of the N frames of original images into the merged image;
    针对所述N-1帧原始图像中的各个图像执行设定操作,所述设定操作包括:A setting operation is performed for each image in the original image of the N-1 frame, and the setting operation includes:
    遍历第一图像中的第一像素块,当所述第一图像中的第一像素块与所述合并图像中的所有像素块均不同时,则将所述第一像素块写入所述合并图像中,否则,不将所述第一像素块写入所述合并图像中;Traverse the first pixel block in the first image, and when the first pixel block in the first image is different from all the pixel blocks in the merged image, the first pixel block is written to the merged In the image, otherwise, the first pixel block is not written into the merged image;
    当所述第一图像中的第二像素块与当前最新的合并图像中的所有像素块均不同时,则将所述第二像素块写入当前最新的合并图像中,否则,不将所述第二像素块写入当前最新的合并图像中;When the second pixel block in the first image is different from all pixel blocks in the current latest merged image, the second pixel block is written into the current latest merged image, otherwise, the The second pixel block is written into the current latest merged image;
    返回遍历执行所述第一图像中的第三像素块,直至第一图像中的M个像素块全部遍历完成;Return to traverse and execute the third pixel block in the first image until all the M pixel blocks in the first image are traversed;
    按照所述设定操作返回执行所述N-1帧原始图像中的第二图像中的第四像素块,当所述第二图像中的第四像素块与当前最新的合并图像中的所有像素块均不同时,则将所述第四像素块写入当前最新的合并图像中,否则,不将所述第四像素块写入当前最新的合并图像中;According to the setting operation, return to execute the fourth pixel block in the second image in the original image of the N-1 frame, when the fourth pixel block in the second image and all the pixels in the current latest merged image When the blocks are different, the fourth pixel block is written into the current latest merged image; otherwise, the fourth pixel block is not written into the current latest merged image;
    返回执行所述第二图像中的第五像素块,直至第二图像中的M个像素块全部遍历完成;Return to execute the fifth pixel block in the second image until all the M pixel blocks in the second image are traversed;
    按照所述设定操作返回执行所述N-1帧原始图像中的第三图像中的M个像素块,直至N-1帧原始图像中的所有图像遍历完成;Return to execute M pixel blocks in the third image in the N-1 frame original image according to the setting operation until the traversal of all images in the N-1 frame original image is completed;
    生成配置文件,所述配置文件包括:最后生成的合并图像中每个像素块的序号与原始图像的序号的对应关系,以及最后生成的合并图像中每个像素块在所对应的原始图像中的位置信息。Generate a configuration file, the configuration file includes: the correspondence between the serial number of each pixel block in the merged image generated last and the serial number of the original image, and each pixel block in the merged image generated last in the corresponding original image location information.
  4. 根据权利要求3所述的方法,其特征在于,该方法还包括:The method of claim 3, further comprising:
    将所述配置文件和所述最后生成的合并图像发送至第二电子设备。Sending the configuration file and the finally generated merged image to the second electronic device.
  5. 一种图像处理方法,应用于第一电子设备,其特征在于,所述方法包括:An image processing method applied to a first electronic device, characterized in that the method includes:
    将动画中的N帧原始图像按照相同的方式均划分成M个像素块;Divide N frames of the original image in the animation into M pixel blocks in the same way;
    将第一图像的M个像素块写入到合并图像中,其中,第一图像为所述N帧原始图像中的任意一帧原始图像;Writing M pixel blocks of the first image into the merged image, where the first image is any one of the original images of the N original images;
    针对所述N-1帧原始图像中的各个原始图像执行设定操作,所述设定操作包括:A setting operation is performed for each original image in the N-1 frame original images, the setting operation includes:
    遍历第二图像中的第一像素块,当所述第二图像中的第一像素块与第一图像中的所有像素块均不同时,则将所述第一像素块写入所述合并图像中,否则,不将所述第一像素块写入所述合并图像中;Traverse the first pixel block in the second image, when the first pixel block in the second image is different from all the pixel blocks in the first image, the first pixel block is written to the merged image Medium, otherwise, the first pixel block is not written into the merged image;
    当第二图像中的第二像素块与第一图像中的所有像素块均不同时,则将所述第二像素块写入当前最新的合并图像中,否则,不将所述第二像素块写入当前最新的合并图像中。返回遍历执行所述第二图像中的第三像素块,直至第二图像中的M个像素块全部遍历完成;When the second pixel block in the second image is different from all pixel blocks in the first image, the second pixel block is written into the current latest merged image, otherwise, the second pixel block is not written Write to the current latest merged image. Return to traverse and execute the third pixel block in the second image until all the M pixel blocks in the second image are traversed;
    按照所述设定操作返回执行所述N-1帧原始图像中的第三图像中的第四像素块,当所述第三图像中的第四像素块与第一图像中的所有像素块和第二图像中的所有像素块均不同时,则将所述第四像素块写入当前最新的合并图像中,否则,不将所述第四像素块写入当前最新的合并图像中;返回执行所述第三图像中的第五像素块,直至第三图像中的M个像素块全部遍历完成;According to the setting operation, the fourth pixel block in the third image in the original image of the N-1 frame is executed, when the fourth pixel block in the third image and all the pixel blocks in the first image sum When all the pixel blocks in the second image are different, the fourth pixel block is written into the current latest merged image; otherwise, the fourth pixel block is not written into the current latest merged image; return to execution The fifth pixel block in the third image until all M pixel blocks in the third image are traversed;
    按照所述设定操作返回执行所述N-1帧原始图像中的第四图像中的M个像素块,直至N-1帧原始图像中的所有图像遍历完成;Return to execute M pixel blocks in the fourth image in the N-1 frame original image according to the setting operation until the traversal of all images in the N-1 frame original image is completed;
    生成配置文件,所述配置文件包括:最后生成的合并图像中每个像素块的序号与原始图像的序号的对应关系,以及最后生成的合并图像中每个像素块在所对应的原始图像中的位置信息。Generate a configuration file, the configuration file includes: the correspondence between the serial number of each pixel block in the merged image generated last and the serial number of the original image, and each pixel block in the merged image generated last in the corresponding original image location information.
  6. 根据权利要求5所述的方法,其特征在于,该方法还包括:The method according to claim 5, wherein the method further comprises:
    将所述配置文件和所述最后生成的合并图像发送至第二电子设备。Sending the configuration file and the finally generated merged image to the second electronic device.
  7. 一种图像处理方法,应用于第二电子设备,其特征在于,所述方法包括:An image processing method applied to a second electronic device, characterized in that the method includes:
    从第一电子设备获取配置文件和最终生成的合并图像,所述配置文件包括:最终生成的合并图像中每个像素块的序号与原始图像的序号的第一对应关系,以及最终生成的合并图像中每个像素块与所对应的原始图像的位置信息之间的第二对应关系;Obtaining a configuration file and a finally generated merged image from the first electronic device, the configuration file including: a first correspondence between the serial number of each pixel block in the final generated merged image and the serial number of the original image, and the final generated merged image The second correspondence between each pixel block in the corresponding position information of the corresponding original image;
    根据所述第一对应关系,从所述最终生成的合并图像中确定与N帧原始图像的序号相对应的N组M个目标像素块;According to the first correspondence, determine N sets of M target pixel blocks corresponding to the sequence number of the N frames of the original image from the finally generated merged image;
    根据所述第二对应关系,确定所述每组M个目标像素块在对应的原始图像的位置信息;Determine the position information of each group of M target pixel blocks in the corresponding original image according to the second correspondence;
    根据所述位置信息排列组合所述每组M个目标像素块,生成所述N帧原始图像,并根据所述N帧原始图像还原出动画。The M target pixel blocks of each group are arranged and combined according to the position information to generate the N frames of original images, and the animation is restored according to the N frames of original images.
  8. 一种第一电子设备,其特征在于,包括一个或多个处理器和一个或多个存储器;A first electronic device, characterized in that it includes one or more processors and one or more memories;
    所述一个或多个存储器与所述一个或多个处理器耦合,所述一个或多个存储器用于存储计算机程序代码,所述计算机程序代码包括计算机指令,当所述一个或多个处理器执行所述计算机指令时,所述电子设备执行如权利要求1至6任一项所述的图像处理方法。The one or more memories are coupled to the one or more processors, the one or more memories are used to store computer program code, the computer program codes include computer instructions, when the one or more processors When executing the computer instruction, the electronic device executes the image processing method according to any one of claims 1 to 6.
  9. 一种第二电子设备,其特征在于,包括处理器、只读存储器、随机存储器、触控面板、显示器;A second electronic device, characterized in that it includes a processor, a read-only memory, a random access memory, a touch panel, and a display;
    所述处理器用于从第一电子设备获取配置文件和最终生成的合并图像;所述配置文件包 括:最终生成的合并图像中每个像素块的序号与原始图像的序号的第一对应关系,以及最终生成的合并图像中每个像素块与所对应的原始图像中的位置信息之间的第二对应关系;The processor is used to obtain a configuration file and a finally generated merged image from the first electronic device; the configuration file includes: a first correspondence between the serial number of each pixel block in the finally generated merged image and the serial number of the original image, and The second correspondence between each pixel block in the finally generated merged image and the position information in the corresponding original image;
    所述只读存储器用于存储一个或多个计算机程序,以及所述配置文件和最终生成的合并图像;The read-only memory is used to store one or more computer programs, as well as the configuration file and the resulting merged image;
    当所述触控面板将检测到用户作用于播放动画的操作传送至显示器时,所述处理器根据所述第一对应关系,从所述最终生成的合并图像中确定与N帧原始图像的序号相对应的N组M个目标像素块;根据所述第二对应关系,确定所述每组M个目标像素块在对应的原始图像的位置信息;根据所述位置信息排列组合所述每组M个目标像素块,生成所述N帧原始图像,并根据所述N帧原始图像还原出动画;When the touch panel transmits the operation detected by the user to play the animation to the display, the processor determines the sequence number of the original image of the N frames from the finally generated merged image according to the first correspondence Corresponding N groups of M target pixel blocks; according to the second correspondence, determining position information of each group of M target pixel blocks in the corresponding original image; arranging and combining each group of M according to the position information Target pixel blocks, generate the original image of N frames, and restore the animation according to the original image of N frames;
    所述随机存储器用于存储所述N帧原始图像和所述动画;The random access memory is used to store the N frames of the original image and the animation;
    所述显示器,用于显示所述动画。The display is used to display the animation.
  10. 一种计算机存储介质,其特征在于,所述计算机可读存储介质包括计算机程序,当计算机程序在电子设备上运行时,使得所述电子设备执行如权利要求1至7任一项所述的图像处理方法。A computer storage medium, characterized in that the computer-readable storage medium includes a computer program, and when the computer program runs on an electronic device, causes the electronic device to execute the image according to any one of claims 1 to 7. Approach.
PCT/CN2019/115553 2018-11-06 2019-11-05 Image processing method and electronic device WO2020093988A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201811315321.5A CN109559270B (en) 2018-11-06 2018-11-06 Image processing method and electronic equipment
CN201811315321.5 2018-11-06

Publications (1)

Publication Number Publication Date
WO2020093988A1 true WO2020093988A1 (en) 2020-05-14

Family

ID=65865965

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2019/115553 WO2020093988A1 (en) 2018-11-06 2019-11-05 Image processing method and electronic device

Country Status (2)

Country Link
CN (1) CN109559270B (en)
WO (1) WO2020093988A1 (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114363697A (en) * 2022-01-06 2022-04-15 上海哔哩哔哩科技有限公司 Video file generation and playing method and device
CN116389898A (en) * 2023-02-27 2023-07-04 荣耀终端有限公司 Image processing method, device and storage medium

Families Citing this family (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109559270B (en) * 2018-11-06 2021-12-24 华为技术有限公司 Image processing method and electronic equipment
CN113127161A (en) * 2019-12-30 2021-07-16 上海仙豆智能机器人有限公司 Processing engine selection method, processing engine selection device and computer-readable storage medium
CN112783839A (en) * 2020-06-08 2021-05-11 北京金山办公软件股份有限公司 Method and device for storing document, electronic equipment and storage medium
CN112052050B (en) * 2020-08-20 2021-06-08 腾讯科技(深圳)有限公司 Shared picture generation method, system, storage medium and terminal equipment
CN113286076B (en) * 2021-04-09 2022-12-06 华为技术有限公司 Shooting method and related equipment
CN115473957B (en) * 2021-06-10 2023-11-14 荣耀终端有限公司 Image processing method and electronic equipment
CN114090168A (en) * 2022-01-24 2022-02-25 麒麟软件有限公司 Self-adaptive adjusting method for image output window of QEMU (QEMU virtual machine)
CN116703741B (en) * 2022-09-27 2024-03-15 荣耀终端有限公司 Image contrast generation method and device and electronic equipment
CN116842117B (en) * 2023-06-19 2024-03-12 重庆市规划和自然资源信息中心 Geous image output method based on geotools for repairing self-intersecting

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1074574A (en) * 1992-01-14 1993-07-21 国际商业机器公司 Digital video compression method and device
CN101031085A (en) * 2007-03-30 2007-09-05 中国联合通信有限公司 Method for processing mobile-terminal frame carboon
CN103281538A (en) * 2013-06-06 2013-09-04 上海交通大学 Intra-frame coding method based on rolling hush and block-level intra-frame prediction
CN105025269A (en) * 2015-07-26 2015-11-04 杜春辉 Low-flow image transmission method
CN106559670A (en) * 2016-11-07 2017-04-05 湖南源信光电科技有限公司 A kind of improved piecemeal video compress perception algorithm
CN109559270A (en) * 2018-11-06 2019-04-02 华为技术有限公司 A kind of image processing method and electronic equipment

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1074574A (en) * 1992-01-14 1993-07-21 国际商业机器公司 Digital video compression method and device
CN101031085A (en) * 2007-03-30 2007-09-05 中国联合通信有限公司 Method for processing mobile-terminal frame carboon
CN103281538A (en) * 2013-06-06 2013-09-04 上海交通大学 Intra-frame coding method based on rolling hush and block-level intra-frame prediction
CN105025269A (en) * 2015-07-26 2015-11-04 杜春辉 Low-flow image transmission method
CN106559670A (en) * 2016-11-07 2017-04-05 湖南源信光电科技有限公司 A kind of improved piecemeal video compress perception algorithm
CN109559270A (en) * 2018-11-06 2019-04-02 华为技术有限公司 A kind of image processing method and electronic equipment

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114363697A (en) * 2022-01-06 2022-04-15 上海哔哩哔哩科技有限公司 Video file generation and playing method and device
CN114363697B (en) * 2022-01-06 2024-04-26 上海哔哩哔哩科技有限公司 Video file generation and playing method and device
CN116389898A (en) * 2023-02-27 2023-07-04 荣耀终端有限公司 Image processing method, device and storage medium
CN116389898B (en) * 2023-02-27 2024-03-19 荣耀终端有限公司 Image processing method, device and storage medium

Also Published As

Publication number Publication date
CN109559270B (en) 2021-12-24
CN109559270A (en) 2019-04-02

Similar Documents

Publication Publication Date Title
WO2020093988A1 (en) Image processing method and electronic device
WO2020259452A1 (en) Full-screen display method for mobile terminal, and apparatus
CN113726950B (en) Image processing method and electronic equipment
CN114546190A (en) Application display method and electronic equipment
CN111190681A (en) Display interface adaptation method, display interface adaptation design method and electronic equipment
WO2021258814A1 (en) Video synthesis method and apparatus, electronic device, and storage medium
CN113448382B (en) Multi-screen display electronic device and multi-screen display method of electronic device
CN113961157B (en) Display interaction system, display method and equipment
WO2022007862A1 (en) Image processing method, system, electronic device and computer readable storage medium
WO2022001258A1 (en) Multi-screen display method and apparatus, terminal device, and storage medium
WO2020155875A1 (en) Display method for electronic device, graphic user interface and electronic device
WO2022095744A1 (en) Vr display control method, electronic device, and computer readable storage medium
CN114077464A (en) Display control method and device
CN111522425A (en) Power consumption control method of electronic equipment and electronic equipment
WO2022143180A1 (en) Collaborative display method, terminal device, and computer readable storage medium
CN112437341B (en) Video stream processing method and electronic equipment
WO2023179123A1 (en) Bluetooth audio playback method, electronic device, and storage medium
WO2022135195A1 (en) Method and apparatus for displaying virtual reality interface, device, and readable storage medium
CN115686403A (en) Display parameter adjusting method, electronic device, chip and readable storage medium
CN113495733A (en) Theme pack installation method and device, electronic equipment and computer readable storage medium
WO2024109573A1 (en) Method for floating window display and electronic device
WO2024066834A1 (en) Vsync signal control method, electronic device, storage medium and chip
WO2024066834A9 (en) Vsync signal control method, electronic device, storage medium and chip
CN117692693A (en) Multi-screen display method and related equipment
CN116939090A (en) Method for switching Bluetooth device to play audio data and related 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: 19883293

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: 19883293

Country of ref document: EP

Kind code of ref document: A1