Photograph generation method and apparatus, electronic device, and medium

By storing and using a limited number of raw images to generate photos when a photo-taking instruction is received, the problem of excessive power consumption in electronic devices caused by zero-latency photography is solved, resulting in a significant reduction in power consumption.

CN119094887BActive Publication Date: 2026-07-07VIVO MOBILE COMM CO LTD

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
VIVO MOBILE COMM CO LTD
Filing Date
2024-08-19
Publication Date
2026-07-07

Smart Images

  • Figure CN119094887B_ABST
    Figure CN119094887B_ABST
Patent Text Reader

Abstract

The application discloses a method and device for generating a photo, electronic equipment and a medium, and belongs to the technical field of image processing. The method comprises the following steps: receiving a first input of a user, the input time of the first input being a first time, the first input being used for indicating that a photo is taken; in response to the first input, storing N original images in a cache queue, wherein the original images are stored in the cache queue from the first time, and N is a positive integer; and generating a photo according to the N original images.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application belongs to the field of image processing technology, specifically relating to a method, apparatus, electronic device, and medium for generating photographs. Background Technology

[0002] Nowadays, more and more electronic devices have camera functions, and these devices typically use zero-latency shooting. When an electronic device performs zero-latency shooting, it continuously captures raw images whenever it enters preview mode, storing each frame of the raw image in the device's memory area until the user clicks the shutter button.

[0003] This method requires caching a large number of raw images in electronic devices, but only a small number of raw images are used to generate photos, resulting in excessive power consumption in electronic devices. Summary of the Invention

[0004] The purpose of this application is to provide a method, apparatus, electronic device, and medium for generating photographs, which can solve the technical problem of excessive power consumption in existing zero-delay photography.

[0005] In a first aspect, embodiments of this application provide a method for generating a photograph, the method comprising:

[0006] Receive the user's first input, the input time of the first input is the first moment, and the first input is used to instruct to take a photo;

[0007] In response to the first input, N original images are stored in a buffer queue, wherein the storage of original images into the buffer queue begins from the first moment, and N is a positive integer;

[0008] A photograph is generated based on the N original images.

[0009] Secondly, embodiments of this application provide a photograph generation apparatus, the apparatus comprising:

[0010] The first receiving module is used to receive the user's first input, the input time of the first input is the first moment, and the first input is used to instruct the user to take a photo.

[0011] The first storage module is configured to store N original images in a cache queue in response to the first input, wherein the storage of original images into the cache queue begins from the first moment, and N is a positive integer;

[0012] A generation module is used to generate a photograph based on the N original images.

[0013] Thirdly, embodiments of this application provide an electronic device including a processor and a memory, the memory storing a program or instructions executable on the processor, the program or instructions, when executed by the processor, implementing the steps of the method provided in the first aspect.

[0014] Fourthly, embodiments of this application provide a readable storage medium on which a program or instructions are stored, which, when executed by a processor, implement the steps of the method provided in the first aspect.

[0015] Fifthly, embodiments of this application provide a chip, which includes a processor and a communication interface, the communication interface and the processor being coupled together, the processor being used to run programs or instructions to implement the method provided in the first aspect.

[0016] In a sixth aspect, embodiments of this application provide a computer program product stored in a storage medium, which is executed by at least one processor to implement the method as provided in the first aspect.

[0017] In the photo generation method, apparatus, electronic device, and medium of this application, a first input from a user is received, the input time of which is a first moment, and the first input is used to instruct the user to take a photo. In response to the first input, N original images are stored in a buffer queue, wherein the storage of original images in the buffer queue begins from the first moment, and N is a positive integer. A photo is generated based on these N original images. In this way, capturing and storing original images only begins when a user's instruction to take a photo is confirmed, and only N original images are stored. Storage stops once N images are reached, and a photo can be generated based on these N original images. This significantly reduces unnecessary image capture and storage operations during photo taking, thereby reducing power consumption. Attached Figure Description

[0018] Figure 1 This is one of the schematic flowcharts of a photo generation method provided in one embodiment of this application;

[0019] Figure 2 This is a second schematic flowchart of a photo generation method provided in one embodiment of this application;

[0020] Figure 3 This is the third schematic flowchart of a method for generating a photograph provided in one embodiment of this application;

[0021] Figure 4 This is the fourth flowchart illustrating a method for generating a photograph according to an embodiment of this application;

[0022] Figure 5 This is the fifth flowchart illustrating a method for generating a photograph according to an embodiment of this application;

[0023] Figure 6 This is a schematic diagram of the structure of a photograph generation apparatus provided in another embodiment of this application;

[0024] Figure 7 This is a schematic diagram of the structure of an electronic device provided in another embodiment of this application;

[0025] Figure 8 This is a schematic diagram of the hardware structure of the electronic device provided in the embodiments of this application. Detailed Implementation

[0026] The technical solutions of the embodiments of this application will be clearly described below with reference to the accompanying drawings. Obviously, the described embodiments are only some, not all, of the embodiments of this application. All other embodiments obtained by those skilled in the art based on the embodiments of this application are within the scope of protection of this application.

[0027] The terms "first," "second," etc., used in the specification and claims of this application are used to distinguish similar objects and not to describe a specific order or sequence. It should be understood that such terms can be used interchangeably where appropriate so that embodiments of this application can be implemented in orders other than those illustrated or described herein, and the objects distinguished by "first," "second," etc., are generally of the same class and the number of objects is not limited; for example, a first object can be one or more. Furthermore, in the specification and claims, "and / or" indicates at least one of the connected objects, and the character " / " generally indicates that the preceding and following objects are in an "or" relationship.

[0028] In related technologies, the methods of taking photos are as follows: Figure 1 As shown, the electronic device includes a camera application and a Hardware Abstraction Layer (HAL). When the electronic device is in the shooting preview interface, the HAL saves each raw image to a cache queue. Only when the user triggers the taking of a photo is received will the most recently stored raw image be selected from the cache queue, and a photo be generated based on that raw image.

[0029] Specifically, such as Figure 1 As shown, the electronic device can enter the shooting preview interface at the third moment, which is before the storage time of the original image R101. The user triggers the input of taking a photo at the fourth moment, which is the storage time of the original image R101. The electronic device can only respond to the input of taking a photo at the storage time of the original image R104.

[0030] In this process, the electronic device stores at least 8 original images in its cache queue, which are R97 to R104. The electronic device will only generate a photo based on the most recently stored original image R104. Therefore, the caching process of the other 7 original images R97 to R103 in the cache queue consumes a lot of power, but does not play a role in the photo generation process, resulting in a waste of power.

[0031] To address the aforementioned technical problems, this application provides a method for generating photographs. The photograph generation method provided by this application will be described in detail below with reference to the accompanying drawings, through specific embodiments and application scenarios.

[0032] like Figure 2 As shown, Figure 2 This is a flowchart illustrating a photograph generation method according to an embodiment of this application. This application provides a photograph generation method, which may include:

[0033] S201, Receive the user's first input, the input time of the first input is the first moment, the first input is used to instruct to take a photo;

[0034] In this embodiment, after the electronic device activates the camera application, its display interface becomes a shooting preview interface, where a real-time preview image is displayed. On this preview interface, the user can immediately instruct the electronic device to take a photo using a first input.

[0035] For example, the shooting preview interface may display shooting controls, which users can use to give initial input to instruct the user to take a photo. This initial input can be a tap, a long press, or a swipe on the shooting controls.

[0036] S202, in response to the first input, N original images are stored in the buffer queue, wherein the storage of original images into the buffer queue starts from the first moment, and N is a positive integer;

[0037] In this embodiment, after the electronic device receives the first input, it can respond to the first input by continuously capturing N raw images and storing them in the cache queue starting from the first moment.

[0038] Specifically, the raw image is the unprocessed or uncompressed raw data directly captured by the camera sensor. When the electronic device is in the shooting preview interface and has not received the first input, the sensor in the electronic device will capture one raw image at a first time interval, perform preliminary processing on each raw image to obtain a preview image, and display the preview image on the electronic device, but will not save the captured raw image.

[0039] Once the user's first input is received, the electronic device will store the raw images captured from that initial moment into a buffer queue, continuing to buffer until the queue contains N raw images. Then, a photo can be generated based on the N raw images in the buffer queue.

[0040] In some embodiments, the method is applied to an electronic device, the electronic device including a hardware abstraction layer and a camera server, and S202 above includes:

[0041] In response to the first input, the camera server generates an interface call request and sends the interface call request to the hardware abstraction layer.

[0042] Based on the interface call request, the hardware abstraction layer stores N original images into a cache queue.

[0043] In this embodiment, the electronic device includes a camera application and a hardware abstraction layer. The hardware abstraction layer is used to translate higher-level operation requests into instructions that the lower-level hardware can understand. When the electronic device is in the shooting preview interface, the user can make the first input through the camera application.

[0044] For example, such as Figure 3 As shown, an interface can be pre-defined between the camera application and the hardware abstraction layer. The camera application can then use this interface to control the hardware abstraction layer to store the raw image. When the electronic device is an Android device, this interface can be defined using the Android Interface Definition Language (AIDL).

[0045] An electronic device displays a camera button. When a user taps this button on the touchscreen using the "capture touch" action, it becomes the first input to the device. Upon receiving this initial input, the camera application generates an API call request and sends it to the Hardware Abstraction Layer (HAL) to invoke the AIDL interface. This AIDL call instructs the HAL to store N original images in a cache queue. Figure 3 As shown, N is 8.

[0046] In this way, the application can control the hardware abstraction layer to capture and store raw images in real time through interface calls, thus flexibly enabling the storage of raw images.

[0047] S203, Generate a photograph based on the N original images.

[0048] In this embodiment, after storing N original images in the cache queue, a reference image can be selected from the N original images in the cache queue. The reference image can be the original image closest to the first time step among the N original images, or it can be the one with the best quality among the N original images. Then, the N original images can be aligned, and noise reduction and High Dynamic Range (HDR) processing can be performed on the reference image based on the N original images to obtain the final photograph.

[0049] In this application, when a shooting preview interface is displayed, a first input from the user is received, the input time of which is designated as "first moment," and the first input is used to instruct the user to take a photo. In response to the first input, N original images are stored in a buffer queue. Starting from the first moment, one original image is stored in the buffer queue at intervals of a first time duration until N original images (N being a positive integer) are present in the buffer queue. A photo is then generated based on these N original images. In this way, capturing and storing original images only begins when a user's instruction to take a photo is confirmed, and only N original images are stored. Storage stops once N images are reached, and a photo can be generated based on these N original images. This significantly reduces unnecessary image capture and storage operations during photo shooting, thereby reducing power consumption.

[0050] In some embodiments, S203 includes:

[0051] At the second time point, P original images are obtained from the cache queue. The second time point is the time after the first time point, and P is a positive integer less than N.

[0052] Determine the reference image from the P original images;

[0053] The reference image is enhanced based on (N-1) first original images to obtain the photograph, wherein the first original image is the original image other than the reference image among the N original images.

[0054] In this embodiment, in addition to the camera application and hardware abstraction layer, the electronic device also includes a camera server and an image signal processor (ISP). The camera server is used to manage and coordinate access requests from camera devices, and the image signal processor processes image data captured by the sensor.

[0055] Whenever the camera application receives the first input from the user, it generates a photo capture request and sends it to the camera server. The camera server receives the request, packages it into a complete capture request, and passes it to the hardware abstraction layer (HAL). Upon receiving the capture request from the camera server, the HAL breaks it down into specific hardware instructions. The HAL then sends these instructions to the image signal processor (ISP) driver pipeline.

[0056] The image signal processor can retrieve P original images from the buffer queue at the second time step. These P original images are the original images stored from the first time step to the second time step. Then, a reference image is determined from the P original images, and the reference image is enhanced by the first original image to obtain the final photo.

[0057] As an alternative embodiment, such as Figure 3 As shown, the first and second time points can differ by 132ms, P is 4, and N is 8. The first time point is the storage time of the original image R101. At the first time point, the electronic device calls the AIDL interface and instructs the hardware abstraction layer to store 8 original images into the cache queue. These 8 original images are R101 to R108. The second time point is the storage time of image R104. Therefore, the first 4 original images are R101 to R104, and the last 4 original images are R105 to R108.

[0058] The storage of original images can begin when the photo is triggered. Since there is a time difference between the first moment of triggering the photo and the second moment of taking the photo, there is enough time to store P original images. A reference image can be selected based on these P original images. After the second moment, (NP) original images are still captured and stored. The reference image is then enhanced based on (N-1) first original images to obtain a photograph.

[0059] In this way, by utilizing the time difference between triggering and executing the photo capture, the amount of raw image stored can be minimized while ensuring shooting quality and efficiency, thus reducing the power consumption of the photo capture process.

[0060] In some embodiments, determining the reference image from the P original images includes:

[0061] The original image with the highest clarity among the P original images is determined as the reference image.

[0062] In this embodiment, the moment when the user triggers the photo taking through the first input is the first moment, and the actual photo taking is the second moment. The P original images are the original images stored in the cache queue between the first moment and the second moment.

[0063] Since the acquisition time of the P original images is close to the time when the user triggers the photo, a reference image can be determined from the P original images. Since the reference image is the original image that best represents the final photo among multiple original images, selecting the original image with the highest clarity from the P original images as the reference image can make the final photo better match the user's needs.

[0064] In some embodiments, the image enhancement of the reference image based on (N-1) first original images includes:

[0065] The reference image is denoised based on the (N-1) first original images, or the (N-1) first original images and the reference image are fused.

[0066] In this embodiment, after selecting a reference image from P original images, (N-1) first original images can be aligned based on the reference image. At least one of noise reduction and high dynamic range processing can be performed on the reference image. Specifically, noise reduction involves using the (N-1) first original images as a reference and reducing noise in the reference image through methods such as weighted averaging to improve image clarity; high dynamic range processing involves using the reference image as the standard exposure image, fusing the (N-1) first original images with the reference image to expand the dynamic range of the reference image, ultimately generating an image with higher dynamic range and detail.

[0067] The above method allows for image enhancement processing of the reference image using multiple original images, resulting in a final photograph with higher quality and detail.

[0068] In some embodiments, the electronic device is in recording mode, the electronic device includes a hardware abstraction layer and a flash memory, and before generating a photograph from the N original images, the method further includes:

[0069] When the hardware abstraction layer receives an interface call request, the hardware abstraction layer stores N original images in the flash memory based on the interface call request;

[0070] Receive a second input from the user, which is used to indicate the end of video recording;

[0071] The process of generating a photograph based on the N original images includes:

[0072] In response to the second input, a photograph is generated based on the N original images in the flash memory.

[0073] In this embodiment, when the electronic device is in recording mode, the camera sensor continuously captures raw images, processes them to provide preview images, and stores the recording data. When a user wants to take a photo during recording, they can make a first input to the electronic device in recording mode. In response to the user's first input, N raw images are continuously captured and stored in a buffer queue starting from the first moment. Specifically, the camera application can call a pre-set interface through an interface call request to control the hardware abstraction layer to store the raw images.

[0074] The user can instruct the electronic device to end recording via a second input. The electronic device then responds to the second input, stops recording, and exits recording mode. After exiting recording mode, the electronic device can retrieve N original images from the buffer queue and generate the final photo based on the N original images.

[0075] In this way, if a user wants to take a photo during video recording, the system can only start storing N original images when it receives the user's photo-taking instruction, and can generate a photo based on these N original images after recording stops, thus avoiding excessive power consumption during the recording process.

[0076] As an alternative embodiment, such as Figure 4 The above-described photo generation method is illustrated in one embodiment:

[0077] S401: The user launches the camera application on the electronic device.

[0078] S402: The electronic device enters the photo preview interface in the camera application.

[0079] S403: The camera sensor begins capturing data from the raw image and transmits this data to the image signal processor.

[0080] S404: Before receiving the first input for shooting, the ISP sends only the raw image output by the sensor to the display screen for preview after receiving the raw image.

[0081] S405: The user triggers a photo-taking action in the camera application and calls the interface provided by HAL.

[0082] S406: When the HAL layer receives a call notification from the camera application, it saves the raw image output by the sensor to the buffer queue, which can be done using Double Data Rate (DDR).

[0083] S407: Generates a photo based on the original image stored in the cache queue.

[0084] As an alternative embodiment, such as Figure 5 The following is another implementation of the above photo generation method:

[0085] S501: The user launches the camera application on the electronic device.

[0086] S502: The electronic device enters the recording interface in the camera application.

[0087] S503: The camera sensor begins capturing data from the raw image and transmits this data to the image signal processor.

[0088] S504: Before receiving the first input for shooting, the ISP sends only the raw image output by the sensor to the display screen for preview and video recording storage.

[0089] S505: During recording, the user triggers a photo-taking action in the camera application and calls the interface provided by HAL.

[0090] S506: The HAL layer receives a call notification from the camera application and saves the raw image output by the sensor to Universal Flash Storage (UFS).

[0091] S507: Receive the user's second input and end recording.

[0092] S508: After recording ends, a photograph is generated based on the original image in general flash memory.

[0093] Figure 6 This is a schematic diagram of the structure of a photograph generation apparatus provided in another embodiment of this application, as shown below. Figure 6 As shown, the apparatus for generating the photograph may include:

[0094] The first receiving module 601 is used to receive a first input from a user, wherein the input time of the first input is a first moment, and the first input is used to instruct the user to take a photo.

[0095] The first storage module 602 is configured to store N original images in a cache queue in response to the first input, wherein the storage of original images into the cache queue begins from the first moment, and N is a positive integer;

[0096] The generation module 603 is used to generate a photograph based on the N original images.

[0097] In this application, a first input from a user can be received, the input time of which is designated as "first moment," and the first input is used to instruct the user to take a photo. In response to the first input, N original images are stored in a buffer queue, where the storage of original images begins from the first moment, and N is a positive integer. A photo is generated based on these N original images. In this way, capturing and storing original images only begins when a user's instruction to take a photo is confirmed, and only N original images are stored. Storage stops once N images are reached, and a photo can be generated based on these N original images. This significantly reduces unnecessary image capture and storage operations during photo taking, thereby reducing power consumption.

[0098] In another alternative example, the first storage module 602 includes:

[0099] The calling unit is used to respond to the first input, wherein the camera server generates an interface calling request and the camera server sends the interface calling request to the hardware abstraction layer;

[0100] A storage unit is used for storing N original images into a cache queue based on the interface call request.

[0101] In another alternative example, the generation module 603 includes:

[0102] The acquisition unit is used to acquire P original images from the cache queue at a second time, where the second time is the time after the first time, and P is a positive integer less than N.

[0103] A determining unit is used to determine a reference image from the P original images;

[0104] An enhancement unit is used to perform image enhancement on the reference image based on (N-1) first original images to obtain the photograph, wherein the first original image is the original image other than the reference image among the N original images.

[0105] In another alternative example, the determining unit is specifically used for:

[0106] The original image with the highest clarity among the P original images is determined as the reference image.

[0107] In another alternative example, the enhancement unit is further configured to perform noise reduction processing on the reference image based on the (N-1) first original images, or to perform image fusion on the (N-1) first original images and the reference image.

[0108] In another alternative example, the photograph generating apparatus further includes:

[0109] The second storage module is used to store N original images into the flash memory based on the interface call request when the hardware abstraction layer receives the interface call request.

[0110] The second receiving module is used to receive the user's second input, which is used to indicate the end of video recording.

[0111] The generation module 603 includes:

[0112] A generation unit is configured to generate a photograph based on N original images stored in the flash memory in response to a second input.

[0113] The photo generating device in this application embodiment can be an electronic device or a component within an electronic device, such as an integrated circuit or a chip. The electronic device can be a terminal or other devices besides a terminal. For example, the electronic device can be a mobile phone, tablet computer, laptop computer, PDA, in-vehicle electronic device, mobile internet device (MID), augmented reality (AR) / virtual reality (VR) device, robot, wearable device, ultra-mobile personal computer (UMPC), netbook, or personal digital assistant (PDA), etc. It can also be a server, network attached storage (NAS), personal computer (PC), television (TV), ATM, or self-service machine, etc. This application embodiment does not specifically limit the specific type of device.

[0114] The photo generation device in this application embodiment can be a device with an operating system. This operating system can be Android, iOS, or other possible operating systems; this application embodiment does not specifically limit the specific operating system used.

[0115] The photograph generation apparatus provided in this application embodiment can achieve Figure 2 The various processes implemented in the method implementation examples will not be described again here to avoid repetition.

[0116] Optionally, such as Figure 7 As shown, this application embodiment also provides an electronic device 100, including a processor 110, a memory 119, and a program or instructions stored in the memory 119 and executable on the processor 110. When the program or instructions are executed by the processor 110, they implement the various processes of the above-described photo generation method embodiment and achieve the same technical effect. To avoid repetition, they will not be described again here.

[0117] It should be noted that the electronic devices in the embodiments of this application include the aforementioned mobile electronic devices and non-mobile electronic devices.

[0118] Please refer to the following: Figure 8 , Figure 8 This is a schematic diagram of the hardware structure of an electronic device according to an embodiment of this application. The electronic device 100 includes, but is not limited to, components such as: a radio frequency unit 121, a network module 122, an audio output unit 123, an input unit 124, a sensor 125, a display unit 126, a user input unit 127, an interface unit 128, a memory 129, and a processor 120.

[0119] Those skilled in the art will understand that the electronic device 100 may also include a power supply (such as a battery) for supplying power to various components. The power supply may be logically connected to the processor 120 through a power management system, thereby enabling functions such as managing charging, discharging, and power consumption through the power management system. Figure 8 The electronic device structure shown does not constitute a limitation on the electronic device. The electronic device may include more or fewer components than shown, or combine certain components, or have different component arrangements, which will not be elaborated here.

[0120] The input unit 124 is used to receive a first input from the user, the input time of the first input is a first moment, and the first input is used to instruct the user to take a photo.

[0121] The memory 129 is used to store N original images in a buffer queue in response to the first input, wherein the storage of original images into the buffer queue begins from the first moment, and N is a positive integer;

[0122] Processor 120 is used to generate a photograph based on the N original images.

[0123] In this application, a first input from a user can be received, the input time of which is "first moment," and the first input is used to instruct the user to take a photo. In response to the first input, N original images are stored in a buffer queue. Starting from the first moment, one original image is stored in the buffer queue at intervals of a first time duration until N original images (N being a positive integer) are present in the buffer queue. A photo is then generated based on these N original images. In this way, capturing and storing original images only begins when a user's instruction to take a photo is confirmed, and only N original images are stored. Storage stops once N images are reached. A photo can be generated based on these N original images. This significantly reduces unnecessary image capture and storage operations during photo taking, thereby reducing power consumption.

[0124] In another alternative example, the processor 120 is further configured to, in response to the first input, generate an interface call request and send the interface call request to the hardware abstraction layer;

[0125] The memory 129 is also used to store N original images into a cache queue based on the interface call request.

[0126] In another alternative example, the processor 120 is also used for:

[0127] At the second time point, P original images are obtained from the cache queue. The second time point is the time after the first time point, and P is a positive integer less than N.

[0128] Determine the reference image from the P original images;

[0129] The reference image is enhanced based on (N-1) first original images to obtain the photograph, wherein the first original image is the original image other than the reference image among the N original images.

[0130] In another alternative example, the processor 120 is also used for:

[0131] The original image with the highest clarity among the P original images is determined as the reference image.

[0132] In another alternative example, the processor 120 is further configured to perform noise reduction processing on the reference image based on the (N-1) first original images, or to perform image fusion on the (N-1) first original images and the reference image.

[0133] In another alternative example, the input unit 124 is configured to, upon receiving an interface call request, store N original images in the flash memory based on the interface call request;

[0134] The processor 120 is also used to receive a second input from the user, which is used to indicate the end of video recording;

[0135] The processor 120 is also configured to generate a photograph based on N original images in the flash memory in response to a second input.

[0136] It should be understood that, in this embodiment, the input unit 124 may include a graphics processing unit (GPU) 1241 and a microphone 1242. The GPU 1241 processes image data of still images or videos obtained by an image capture device (such as a camera) in video capture mode or image capture mode. The display unit 126 may include a display panel 1261, which may be configured in the form of a liquid crystal display, an organic light-emitting diode, or the like. The user input unit 127 includes at least one of a touch panel 1271 and other input devices 1272. The touch panel 1271 is also called a touch screen. The touch panel 1271 may include a touch detection device and a touch controller. Other input devices 1272 may include, but are not limited to, physical keyboards, function keys (such as volume control buttons, power buttons, etc.), trackballs, mice, and joysticks, which will not be described in detail here.

[0137] The memory 129 can be used to store software programs and various data. The memory 129 may primarily include a first storage area for storing programs or instructions and a second storage area for storing data. The first storage area may store the operating system, application programs or instructions required for at least one function (such as sound playback, image playback, etc.). Furthermore, the memory 129 may include volatile memory or non-volatile memory, or both. The non-volatile memory may be read-only memory (ROM), programmable read-only memory (PROM), erasable programmable read-only memory (EPROM), electrically erasable programmable read-only memory (EEPROM), or flash memory. Volatile memory can be random access memory (RAM), static random access memory (SRAM), dynamic random access memory (DRAM), synchronous dynamic random access memory (SDRAM), double data rate synchronous dynamic random access memory (DDRSDRAM), enhanced synchronous dynamic random access memory (ESDRAM), synchronous link dynamic random access memory (SLDRAM), and direct memory bus RAM (DRRAM). The memory 129 in the embodiments of this application includes, but is not limited to, these and any other suitable types of memory.

[0138] Processor 120 may include one or more processing units; optionally, processor 120 integrates an application processor and a modem processor, wherein the application processor mainly handles operations involving the operating system, user interface, and applications, and the modem processor mainly handles wireless communication signals, such as a baseband processor. It is understood that the aforementioned modem processor may also not be integrated into processor 120.

[0139] This application also provides a readable storage medium storing a program or instructions. When the program or instructions are executed by a processor, they implement the various processes of the above-described photo generation method embodiments and achieve the same technical effect. To avoid repetition, they will not be described again here.

[0140] The processor is the processor in the electronic device described in the above embodiments. The readable storage medium includes computer-readable storage media, such as computer read-only memory (ROM), random access memory (RAM), magnetic disk, or optical disk.

[0141] This application embodiment also provides a chip, which includes a processor and a communication interface. The communication interface and the processor are coupled. The processor is used to run programs or instructions to implement the various processes of the above-described photo generation method embodiment and achieve the same technical effect. To avoid repetition, it will not be described again here.

[0142] It should be understood that the chip mentioned in the embodiments of this application may also be referred to as a system-on-a-chip, system chip, chip system, or system-on-a-chip, etc.

[0143] This application provides a computer program product, which is stored in a storage medium and executed by at least one processor to implement the various processes of the above-described method for generating photos, and achieves the same technical effect. To avoid repetition, it will not be described again here.

[0144] It should be noted that, in this document, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitations, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes that element. Furthermore, it should be noted that the scope of the methods and apparatuses in the embodiments of this application is not limited to performing functions in the order shown or discussed, but may also include performing functions substantially simultaneously or in the reverse order, depending on the functions involved. For example, the described methods may be performed in a different order than described, and various steps may be added, omitted, or combined. Additionally, features described with reference to certain examples may be combined in other examples.

[0145] Through the above description of the embodiments, those skilled in the art can clearly understand that the methods of the above embodiments can be implemented by means of software plus necessary general-purpose hardware platforms. Of course, they can also be implemented by hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, can be embodied in the form of a computer software product. This computer software product is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk) and includes several instructions to cause a terminal (which may be a mobile phone, computer, server, or network device, etc.) to execute the methods described in the various embodiments of this application.

[0146] The embodiments of this application have been described above with reference to the accompanying drawings. However, this application is not limited to the specific embodiments described above. The specific embodiments described above are merely illustrative and not restrictive. Those skilled in the art can make many other forms under the guidance of this application without departing from the spirit and scope of the claims, and all of these forms are within the protection scope of this application.

Claims

1. A method for generating a photograph, characterized in that, The method includes: The system receives the user's first input, which is input at the first moment. The first input is used to instruct the user to take a photo. If the electronic device is in the shooting preview interface and the first input is not received, the captured original image will not be saved. In response to the first input, N original images are stored in a cache queue, wherein the storage of original images into the cache queue begins from the first moment and stops when the cache queue has stored N original images, where N is a positive integer; At the second time, P original images are obtained from the cache queue. The second time is the time after the first time, where P is a positive integer less than N. The P original images are the original images stored in the cache queue between the first time and the second time. The (NP) original images are the original images stored in the cache queue after the second time. Determine the reference image from the P original images; The reference image is enhanced based on (N-1) first original images to obtain a photograph, wherein the first original image is the original image other than the reference image among the N original images.

2. The method according to claim 1, characterized in that, Applied to electronic devices, which include a hardware abstraction layer and a camera server; The step of storing N original images in a cache queue in response to the first input includes: In response to the first input, the camera server generates an interface call request and sends the interface call request to the hardware abstraction layer. Based on the interface call request, the hardware abstraction layer stores N original images into a cache queue.

3. The method according to claim 1, characterized in that, Determining the reference image from the P original images includes: The original image with the highest clarity among the P original images is determined as the reference image.

4. The method according to claim 1, characterized in that, The image enhancement based on (N-1) first original images of the reference image includes: The reference image is denoised based on the (N-1) first original images, or the (N-1) first original images and the reference image are fused together.

5. The method according to claim 1, characterized in that, The method is applied to an electronic device in recording mode, the electronic device including a hardware abstraction layer and a flash memory, and before acquiring P original images from the buffer queue at the second moment, the method further includes: When the hardware abstraction layer receives an interface call request, the hardware abstraction layer stores N original images in the flash memory based on the interface call request; Receive a second input from the user, which is used to indicate the end of video recording; The step of acquiring P original images from the cache queue at the second time step includes: At the second moment, acquire P original images from the flash memory; The process of enhancing the reference image based on (N-1) first original images to obtain a photograph includes: The reference image is enhanced based on (N-1) first original images in the flash memory to obtain a photograph.

6. A photograph generating apparatus, characterized in that, include: The first receiving module is used to receive the user's first input. The input time of the first input is the first moment. The first input is used to instruct the user to take a photo. If the electronic device is in the shooting preview interface and the first input is not received, the captured original image will not be saved. The first storage module is configured to store N original images in a cache queue in response to the first input, wherein the storage of original images into the cache queue begins from the first moment and stops caching when the cache queue has stored N original images, where N is a positive integer; The acquisition unit is used to acquire P original images in the cache queue at a second time, where the second time is the time after the first time, P is a positive integer less than N, the P original images are the original images stored in the cache queue from the first time to the second time, and (NP) original images are the original images stored in the cache queue after the second time. A determining unit is used to determine a reference image from the P original images; An enhancement unit is used to enhance the reference image based on (N-1) first original images to obtain a photograph, wherein the first original image is an original image other than the reference image among the N original images.

7. The apparatus according to claim 6, characterized in that, The device further includes: The second storage module is used to store N original images into a flash memory based on an interface call request received by the hardware abstraction layer. The second receiving module is used to receive the user's second input, which is used to indicate the end of video recording. Specifically, the acquisition unit is used to acquire P original images in the flash memory at a second time. The enhancement unit is specifically used to enhance the reference image based on (N-1) first original images in the flash memory to obtain a photograph.

8. An electronic device, characterized in that, It includes a processor and a memory, the memory storing a program or instructions that can run on the processor, the program or instructions being executed by the processor to implement the steps of the photograph generation method as described in any one of claims 1-5.

9. A readable storage medium, characterized in that, The readable storage medium stores a program or instructions that, when executed by a processor, implement the steps of the photograph generation method as described in any one of claims 1-5.