Photographing method and related device
Patent Information
- Application Number
- CN202380057805.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Priority Date
- 2022-08-05
- Filing Date
- 2023-06-06
- Publication Date
- 2025-03-14
AI Technical Summary
When existing electronic devices take photos, the results of multiple photos taken of the same scene are different, resulting in poor photo consistency and reduced user experience.
By displaying the preview image on the photo interface, it can determine whether the current scene is the same as the last photo scene, use the last exposure parameters to take photos, and adjust the exposure parameters when the brightness does not meet the preset conditions to ensure the consistency of the results of multiple photos.
It effectively maintains the consistency of the results of multiple photos of the same scene, improves the user's photo experience, and avoids differences in photo results caused by different exposure parameters and processing methods.
Smart Images

Figure CN119631421A_ABST
Abstract
Description
Photographing method and related device
[0001] This application claims priority to the Chinese patent application filed with the State Intellectual Property Office of China on August 5, 2022, with application number 202210940028.8 and application name “Photographing Method and Related Device”, the entire contents of which are incorporated by reference into this application. Technical Field
[0002] The present application relates to the field of terminal technology, and in particular to a photographing method and related devices. Background Art
[0003] "Photo consistency" is a strong user demand. Specifically, it means that the results of multiple photos taken in the same scene should be consistent. However, currently, electronic devices with camera functions do not have good photo consistency. That is, when a user uses an electronic device with a camera function to take multiple photos of the same scene, the results may vary, which reduces the user's photography experience.
[0004] Therefore, there is an urgent need for a method that can maintain the consistency of photographing to improve the user's photographing experience.
[0005] Summary of the Invention
[0006] This application provides a photographing method and related devices, which can maintain the consistency of photographing results while improving the user's photographing experience.
[0007] In a first aspect, a photographing method is provided, which is applied to an electronic device equipped with a camera, the method comprising: displaying a first image on a photographing interface, where the first image is a preview image captured of a first scene; in response to a user's photographing operation, determining whether the first scene is the same as the scene of the last photograph; if the first scene is the same as the scene of the last photograph, determining the exposure parameters used for the last photograph as target exposure parameters; and taking a photograph of the first scene based on the target exposure parameters.
[0008] In the present application, when the electronic device responds to the user's photo operation, it can determine whether the first scene of the current photo is the same as the scene of the previous photo. In this way, if the scenes of the two photos are the same, the exposure parameters of the previous photo can be used as the exposure parameters of the current photo (target exposure parameters), and the photo is taken based on the exposure parameters. In this way, the same exposure parameters are used to take photos of the same scene, which can better maintain the consistency of multiple photos of the same scene.
[0009] In combination with the first aspect, in certain implementations of the first aspect, the method further includes: when the first scene is different from the scene of the last photograph, determining whether the brightness of the first image meets a preset condition; and when the brightness of the first image meets the preset condition, determining the exposure parameter used to generate the first image as the target exposure parameter; or when the brightness of the first image does not meet the preset condition, adjusting the exposure parameter until the brightness of the second image displayed through the photographing interface meets the preset condition, and determining the exposure parameter used to generate the second image as the target exposure parameter; wherein the second image is another preview image captured of the first scene, and the exposure parameter used to generate the first image is different from the exposure parameter used to generate the second image; the preset condition is: the difference between the target brightness and the current brightness is less than or equal to a first preset threshold, the target brightness is the actual brightness of the first scene, and the current brightness is the brightness of the currently captured preview image.
[0010] Based on this, the first scene is different from the scene photographed last time, that is, the scene photographed this time is a new scene. In this case, it is possible to further determine whether the preview image corresponding to the first scene meets the preset conditions. When the preset conditions are met, it is not necessary to adjust the exposure parameters. The exposure parameters used to generate the current preview image are used as the target exposure parameters to photograph the first scene. This method of determining the target exposure parameters can ensure that the preview images obtained multiple times for the same scene are consistent.
[0011] In combination with the first aspect, in certain implementations of the first aspect, in response to a user's photo-taking operation, determining whether the first scene is the same as the scene of the last photo-taking includes: in response to the user's photo-taking operation, setting the value of a preset flag to a first value, the first value being used to instruct the electronic device to take a photo; and based on the first value, determining whether the first scene is the same as the scene of the last photo-taking.
[0012] The reason for setting the preset flag to the first value is to enable the electronic device to enter a photographing mode. The electronic device in photographing mode can determine whether the first scene in the currently captured preview image is the same as the scene of the last photograph, so that, under the same circumstances, the exposure parameters used in the last photograph can be used.
[0013] In combination with the first aspect, in certain implementations of the first aspect, when the first scene is different from the scene of the last photograph, determining whether the brightness of the first image meets the preset conditions includes: when the first scene is different from the scene of the last photograph, setting the value of the preset flag to a second value; and based on the second value, determining whether the brightness of the first image meets the preset conditions.
[0014] The reason for setting the preset flag to the second value is to enable the electronic device to enter preview mode. Once in preview mode, the electronic device can determine whether to adjust the exposure parameters used to generate the first image based on the brightness of the first image captured in preview mode. After the exposure parameter adjustment is completed, that is, after the target exposure parameter is determined, the preset flag can be set to the first value again, causing the electronic device to enter camera mode again.
[0015] It should be understood that setting the value of the preset flag bit to the second value indicates that the electronic device enters the preview mode.
[0016] In combination with the first aspect, in certain implementations of the first aspect, determining whether the first scene is the same as the scene of the last photo taken includes: calculating the similarity between the first image and the third image captured during the last photo taken; when the similarity is less than or equal to a second preset threshold, determining that the first scene is the same as the scene of the last photo taken.
[0017] In conjunction with the first aspect, in certain implementations of the first aspect, calculating the similarity between the first image and a third image obtained by a previous photograph includes: obtaining a first histogram corresponding to the first image, the first histogram representing a correlation between the number of pixels and grayscale in the first image; obtaining a second histogram corresponding to the third image, the second histogram representing a correlation between the number of pixels and grayscale in the third image; and calculating a similarity diff between the first histogram and the second histogram using the following formula:
[0018] Wherein, H1(k) is the number of pixels corresponding to grayscale k in the first histogram, H2(k) is the number of pixels corresponding to grayscale k in the second histogram, and n=255.
[0019] In combination with the first aspect, in certain implementations of the first aspect, in response to the user's photo-taking operation, it is determined whether the dynamic range DR parameter of the first preview image reaches a preset threshold, and the first preview image is the image displayed on the photo-taking display interface when the electronic device receives the user's photo-taking operation; when the DR parameter reaches the preset threshold, the captured original image is processed by the first processing method and the second processing method respectively to obtain a fourth image and a fifth image respectively, the YUV of the fourth image and the YUR of the fifth image are different, and the preview image and the original image are images captured of the same scene; the fourth image and the fifth image are fused to obtain a target image; and the target image is displayed.
[0020] Among them, the first processing method can be understood as the process of processing the original image obtained when the electronic device responds to the user's photo operation when the DR parameter of the preview image is less than the preset threshold; the second processing method can be understood as the process of processing the original image obtained when the electronic device responds to the user's photo operation when the DR parameter of the preview image is greater than the preset threshold. The two processing methods are different, which leads to differences in the final photo results of the same scene. Since the DR parameter of the preview image will change dynamically, when it is at the critical preset threshold, different photos will enter different processing modes, resulting in the final photo results being inconsistent. This application uses the above two processing methods to process the image respectively for the case where the DR parameter reaches the preset threshold, and then adopts a fusion processing method to obtain the final target image. This method can make the results of multiple photos the same when the DR parameter of the preview image reaches the preset threshold.
[0021] It should be understood that since DR parameters are determined based on preview images, and preview images of the same scene can vary, the DR parameters corresponding to the same scene are also subject to dynamic change. That is, the DR parameters obtained from different shots of the same scene may not necessarily be the same. Therefore, "reaching a preset threshold" as described in this application can be understood as being near or equal to the preset threshold. For example, if the preset threshold is set to 0.5, a determined DR parameter between 0.45 and 0.55 is considered to have reached the preset threshold.
[0022] In combination with the first aspect, in some implementations of the first aspect, the first processing method and the second processing method are used to perform tone mapping on the original image, but the second processing method includes post-processing and the first processing method does not include post-processing.
[0023] Those skilled in the art will appreciate that image signal processing of the original image includes, but is not limited to, tone mapping, and this document does not limit the processing flow for the original image. The tone mapping flow is described separately here simply to distinguish between the first processing method and the second processing method.
[0024] In this application, the first processing method does not perform post-processing when tone mapping the original image; while the second processing method does perform post-processing when tone mapping the original image. By applying the first and second processing methods to the same original image, two images with different YUV values can be obtained. It should be understood that the specific processes of tone mapping and post-processing can be referenced in existing technologies and will not be described in detail here.
[0025] In combination with the first aspect, in certain implementations of the first aspect, the fourth image and the fifth image are fused based on the DR parameter to obtain a target image, including: using the DR parameter as the weight of the fourth image, using the difference between 1 and the DR parameter as the weight of the fifth image, and weighting the pixel values of the fourth image and the pixel values of the fifth image to obtain the target image.
[0026] In a second aspect, the present application provides an electronic device comprising a processor and a memory, wherein the processor is coupled to the memory and can be used to execute instructions in the memory to implement a method in any possible implementation of any of the above aspects.
[0027] Optionally, the electronic device further includes a communication interface, and the processor is coupled to the communication interface.
[0028] In a third aspect, the present application provides a processor comprising: an input circuit, an output circuit, and a processing circuit. The processing circuit is configured to receive a signal through the input circuit and transmit a signal through the output circuit, so that the processor executes the method of any possible implementation of any of the above aspects.
[0029] In a specific implementation, the processor may be a chip, the input circuit may be an input pin, the output circuit may be an output pin, and the processing circuit may be a transistor, a gate circuit, a trigger, or various logic circuits. The input signal received by the input circuit may be, for example, but not limited to, received and input by a receiver, and the signal output by the output circuit may be, for example, but not limited to, output to and transmitted by a transmitter. The input circuit and the output circuit may be the same circuit, which functions as an input circuit and an output circuit at different times. This application does not limit the specific implementation of the processor and various circuits.
[0030] In a fourth aspect, the present application provides a processing device comprising a processor and a memory. The processor is configured to read instructions stored in the memory and receive signals via a receiver and transmit signals via a transmitter to execute the method in any possible implementation of any of the above aspects.
[0031] Optionally, there are one or more processors and one or more memories.
[0032] Optionally, the memory may be integrated with the processor, or the memory may be provided separately from the processor.
[0033] In the specific implementation process, the memory can be a non-transitory memory, such as a read-only memory (ROM), which can be integrated on the same chip as the processor or be set on different chips. This application does not limit the type of memory and the setting method of the memory and the processor.
[0034] It should be understood that related data interaction processes, such as sending indication information, can be the process of outputting indication information from the processor, and receiving capability information can be the process of receiving input capability information from the processor. Specifically, the output data of the processing can be output to the transmitter, and the input data received by the processor can come from the receiver. The transmitter and receiver can be collectively referred to as a transceiver.
[0035] The processing device in the fourth aspect mentioned above can be a chip. The processor can be implemented by hardware or by software. When implemented by hardware, the processor can be a logic circuit, an integrated circuit, etc.; when implemented by software, the processor can be a general-purpose processor, which is implemented by reading the software code stored in the memory. The memory can be integrated in the processor or can be located outside the processor and exist independently.
[0036] In a fifth aspect, the present application provides a computer-readable storage medium, which stores a computer program (also referred to as code, or instructions) which, when run on a computer, enables the computer to execute the method in any possible implementation of the first aspect above.
[0037] In a sixth aspect, the present application provides a computer program product, which includes: a computer program (also referred to as code, or instructions), which, when executed, enables a computer to execute the method in any possible implementation of the first aspect. BRIEF DESCRIPTION OF THE DRAWINGS
[0038] FIG1 is a schematic structural diagram of an electronic device provided in an embodiment of the present application;
[0039] FIG2 is a schematic flow chart of a photographing method provided in an embodiment of the present application;
[0040] FIG3 is a schematic flow chart of another photographing method provided in an embodiment of the present application;
[0041] FIG4 is a schematic flow chart of another photographing method provided in an embodiment of the present application;
[0042] FIG5 is a schematic block diagram of a photographing device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0043] The technical solution in this application will be described below with reference to the accompanying drawings.
[0044] FIG1 is a schematic diagram of the structure of an electronic device provided in an embodiment of the present application. As shown in FIG1 , the electronic device 100 may include a processor 110, an external memory interface 120, an internal memory 121, a universal serial bus (USB) interface 130, a charging management module 140, a power management module 141, an antenna 1, an antenna 2, a mobile communication module 150, a wireless communication module 160, an audio module 170, a speaker 170A, a receiver 170B, a microphone 170C, a sensor module 180, a button 190, an indicator 192, a camera 193, and a display screen 194. The sensor module 180 may include a pressure sensor 180A, a gyroscope sensor 180B, an air pressure sensor 180C, a magnetic sensor 180D, an acceleration sensor 180E, a distance sensor 180F, a proximity light sensor 180G, a fingerprint sensor 180H, a temperature sensor 180J, a touch sensor 180K, an ambient light sensor 180L, a bone conduction sensor 180M, and the like.
[0045] It is understood that the structures illustrated in the embodiments of the present application do not constitute specific limitations on the electronic device. In other embodiments of the present application, the electronic device may include more or fewer components than shown, or may combine or separate certain components, or arrange the components differently. The illustrated components may be implemented in hardware, software, or a combination of software and hardware.
[0046] The processor 110 may include one or more processing units. For example, the processor 110 may include an application processor (AP), a modem processor, a graphics processing unit (GPU), an image signal processor (ISP), a controller, a video codec, a digital signal processor (DSP), a baseband processor, and / or a neural-network processing unit (NPU). The different processing units may be independent devices or integrated into one or more processors.
[0047] In some embodiments, the processor 110 may include one or more interfaces. The interfaces may include an inter-integrated circuit (I2C) interface, an inter-integrated circuit sound (I2S) interface, a pulse code modulation (PCM) interface, a universal asynchronous receiver / transmitter (UART) interface, a mobile industry processor interface (MIPI), a general-purpose input / output (GPIO) interface, a subscriber identity module (SIM) interface, and / or a universal serial bus (USB) interface.
[0048] It is understood that the interface connection relationship between the modules illustrated in the embodiment of the present invention is merely an illustrative illustration and does not constitute a structural limitation on the electronic device 100. In other embodiments of the present application, the electronic device 100 may also adopt different interface connection methods from the above embodiments, or a combination of multiple interface connection methods.
[0049] The electronic device 100 implements display functionality through a graphics processing unit (GPU), a display screen 194, and an application processor. The GPU connects the display screen 194 and the application processor. The GPU is used to perform mathematical and geometric calculations for graphics rendering. The processor 110 may include one or more GPUs that execute program instructions to generate or modify display information.
[0050] Display screen 194 is used to display images, videos, and the like. Display screen 194 includes a display panel. The display panel can be a liquid crystal display (LCD), an organic light-emitting diode (OLED), an active-matrix organic light-emitting diode (AMOLED), a flexible light-emitting diode (FLED), a MiniLED, a MicroLED, a Micro-oLed, a quantum dot light-emitting diode (QLED), a low-temperature polycrystalline oxide (LTPO), or the like. In some embodiments, the electronic device may include one or N display screens 194, where N is a positive integer greater than one.
[0051] The electronic device can implement a shooting function through image signal processing (ISP), camera 193, video codec, GPU, display 194, and application processor. Camera 193 is used to capture still images or videos. In some embodiments, the electronic device may include 1 or N cameras 193, where N is a positive integer greater than 1. For example, the first image and the second image in this application may be images captured by camera 193, and the photo interface in this application may be the interface displayed on the above-mentioned display 194.
[0052] The external memory interface 120 can be used to connect an external memory card to expand the storage capacity of the electronic device. The external memory card communicates with the processor 110 via the external memory interface 120 to implement data storage. For example, files such as music, videos, and pictures can be stored on the external memory card. The internal memory 121 can be used to store computer-executable program code, which includes instructions. The internal memory 121 may include a program storage area and a data storage area.
[0053] The electronic devices in the embodiments of the present application may also be referred to as: terminal equipment, client, user equipment (UE), mobile station (MS), mobile terminal (MT), access terminal, user unit, user station, mobile station, mobile station, remote station, remote terminal, mobile device, wireless communication equipment, user agent or user device, etc.
[0054] At present, some examples of electronic devices include: mobile phones, tablet computers, laptop computers, PDAs, mobile internet devices (MIDs), wearable devices, virtual reality (VR) devices, augmented reality (AR) devices, wireless terminals in industrial control, wireless terminals in self-driving, wireless terminals in remote medical surgery, wireless terminals in smart grids, wireless terminals in transportation safety, wireless terminals in smart cities, wireless terminals in smart homes, cellular phones, cordless phones, session initiation protocol (SIP) phones, wireless local loop (WLL) stations, personal digital assistants (PDAs), handheld devices with wireless communication capabilities, computing devices or other processing devices connected to wireless modems, in-vehicle devices, wearable devices, terminal devices in 5G networks or future evolved public land mobile communication networks (PLMNs). The present application does not limit the terminal equipment in the network (PLMN), etc.
[0055] It should be understood that the electronic device of the embodiment of the present application can be any electronic device with a camera function.
[0056] Typically, when a user uses an electronic device with a camera function to take multiple photos of the same scene, the resulting photos often differ. In other words, the results of multiple photos taken of the same scene lack consistency, which reduces the user's photography experience.
[0057] Currently, the reasons for poor consistency in photography can include the following aspects:
[0058] 1. There is a certain tolerance for determining auto exposure (AE) convergence. Currently, to avoid AE brightness oscillation, the AE convergence determination conditions are as follows:
[0059] |Target brightness - current brightness|≤tolerance.
[0060] For example, if the preset tolerance is 2 and the target brightness is 50, and the current brightness is 48 and 52, then AE convergence is determined based on this convergence judgment condition. However, the brightness difference of the original (raw) image is 4. After processing by the image signal processing (ISP) module, the final image difference is even greater, making the difference noticeable to the human eye.
[0061] 2. Entering different shooting modes can cause significant discrepancies. This is because different shooting modes correspond to different processing methods. In some critical scenarios, different shots may be judged as different shooting modes, resulting in significant differences in the final shooting results.
[0062] In view of this, embodiments of the present application provide a photography method and related apparatus. In a photography interface, a first image captured of a first scene is displayed. At this point, the electronic device, in response to the user's photography operation, further determines whether the current photography scene is the same as the previous photography scene. If the two photography scenes are the same, the current photography adopts the same exposure parameters as the previous photography scene. That is, the same exposure parameters are used for photography of the same scene. This processing method can effectively maintain consistency in multiple photography of the same scene, while also improving the user's photography experience.
[0063] To facilitate a clear description of the technical solutions of the embodiments of the present application, the words "first" and "second" are used in the embodiments of the present application to distinguish between identical or similar items with substantially the same functions and effects. For example, the first image and the second image are merely used to distinguish between images of different times and do not limit their order. Those skilled in the art will understand that the words "first" and "second" do not limit the quantity or execution order, and the words "first" and "second" do not necessarily mean that they are different.
[0064] It should be noted that, in this application, words such as "exemplary" or "for example" are used to indicate examples, illustrations, or descriptions. Any embodiment or design described in this application as "exemplary" or "for example" should not be construed as being preferred or advantageous over other embodiments or designs. Rather, the use of words such as "exemplary" or "for example" is intended to present the relevant concepts in a concrete manner.
[0065] In this application, "at least one" means one or more, and "more" means two or more. "And / or" describes the association relationship of associated objects, indicating that three relationships may exist. For example, A and / or B can mean: A exists alone, A and B exist at the same time, and B exists alone, where A and B can be singular or plural. The character " / " generally indicates that the previous and next associated objects are in an "or" relationship. "At least one of the following items" or similar expressions refers to any combination of these items, including any combination of single or plural items. For example, at least one of a, b, or c can mean: a, b, c, a and b, a and c, b and c, or a, b and c, where a, b, c can be single or multiple.
[0066] The following specific embodiments are used to describe in detail the technical solution of the present application and how the technical solution of the present application solves the above technical problems. The following specific embodiments can be implemented independently or in combination with each other. For the same or similar concepts or processes, some embodiments may not be described in detail.
[0067] It should be understood that the photographing method shown below can be performed by an electronic device with a photographing function, and this application does not limit this. The following takes an electronic device with a photographing function as an example (for ease of description, hereinafter referred to as the electronic device) to describe in detail the technical solutions provided by the embodiments of this application.
[0068] FIG2 is a schematic flow chart of a photographing method 200 provided in an embodiment of the present application. As shown in FIG2 , the method 200 may include S201 to S204. The specific steps are described in detail below:
[0069] S201: Display a first image on a photographing interface, where the first image is a preview image captured of a first scene.
[0070] The first scene may be any scene to be photographed, such as a portrait, the sky and the ground, or other scenes.
[0071] It should be understood that the first image may be displayed on a display screen of an electronic device. The first image may be an image captured by a camera of the electronic device on the first scene.
[0072] S202: In response to a user's photographing operation, determining whether the first scene is the same as the scene of the last photograph.
[0073] It should be understood that the user's photo-taking operation can be the operation of the user clicking the shutter button on the electronic device, or other operations preset on the electronic device for the user to take photos, for example, the user takes a photo when shouting "take a photo", "eggplant", or other commands; or when the subject of the photo is the user, the user takes a photo by making an OK gesture to the camera, or the user takes a photo when smiling at the camera. The specific photo-taking operation is not limited in this application.
[0074] S203 : When the first scene is the same as the scene of the last photograph, determine the exposure parameters used for the last photograph as target exposure parameters.
[0075] It should be understood that the electronic device can record the exposure parameters corresponding to the original image of the first scene each time the electronic device takes a photo. The original image can be understood as the preview image of the first scene displayed on the photo interface when the electronic device receives the user's photo operation.
[0076] S204: Taking a picture of the first scene based on the target exposure parameter.
[0077] In an embodiment of the present application, when the electronic device responds to the user's photo operation, it can determine whether the first scene of the current photo is the same as the scene of the previous photo. When the scenes of the two photos are the same, the exposure parameters of the previous photo can be used as the exposure parameters of the current photo (target exposure parameters), and the photo is taken based on the exposure parameters. In this way, the same exposure parameters are used to take photos of the same scene, which can better maintain the consistency of multiple photos of the same scene, that is, the results of multiple photos of the same scene are the same, which effectively improves the user's photo-taking experience.
[0078] As an optional embodiment, the above method 200 also includes: when the first scene is different from the scene of the last photograph, determining whether the brightness of the first image meets the preset conditions; and when the brightness of the first image meets the preset conditions, determining the exposure parameters used to generate the first image as the target exposure parameters; or when the brightness of the first image does not meet the preset conditions, adjusting the exposure parameters until the brightness of the second image displayed through the photographing interface meets the preset conditions, and determining the exposure parameters used to generate the second image as the target exposure parameters; wherein the second image is another preview image captured of the first scene, and the exposure parameters used to generate the first image are different from the exposure parameters used to generate the second image.
[0079] The above preset conditions are: the difference between the target brightness and the current brightness is less than or equal to the first preset threshold, and the target brightness is greater than or equal to the current brightness, the target brightness is the actual brightness of the first scene, and the current brightness is the brightness of the currently captured preview image.
[0080] It should be understood that the above-mentioned preset conditions can be expressed by the following formula:
[0081] (|target-cur|≤tolerance) and (target≥cur),
[0082] Wherein, target represents the target brightness, cur represents the current brightness, and tolerance is the first preset threshold.
[0083] It should be understood that each preview image displayed on the camera interface of the electronic device is an image captured of the first scene based on the exposure parameters, that is, each preview image has a corresponding set of exposure parameters. The exposure parameters are determined based on the AE module of the electronic device.
[0084] Exemplarily, the AE module of the electronic device corresponds to a preset exposure table, in which each index in the exposure table corresponds to an exposure combination (i.e., the exposure parameters described above), and each exposure combination includes an exposure amount and an exposure time. When shooting in the AE mode, the electronic device can count the target brightness value of the image to be photographed, select an index in the exposure table based on the target brightness value, and then use the exposure combination corresponding to the index to change the current brightness value of the captured image. For example, if the current brightness value of the captured image (i.e., the preview image captured for the first scene described above) corresponds to index i and the target brightness value corresponds to index j, the electronic device first uses an exposure combination corresponding to an index k between index i and index j to change the current brightness value of the captured image, and then selects an exposure combination corresponding to an index between index k and index j to continue changing the current brightness value of the captured image, and so on, until the electronic device finally uses the exposure combination corresponding to index j to change the current brightness value of the captured image to the target brightness value. It should be understood that the current brightness of the captured image can converge to the above-mentioned preset conditions for the exposure combination corresponding to the last used index.
[0085] It should be understood that the above process of adjusting the exposure parameters is the above process of selecting the index.
[0086] It should also be understood that the first preset threshold value may be preset on the electronic device by a developer. For example, the first preset threshold value may be 1 or 2, or other values, which are not limited in this application.
[0087] In an embodiment of the present application, the first scene is different from the scene photographed last time, that is, the scene photographed this time is a new scene. In this case, it is possible to further determine whether the preview image corresponding to the first scene meets the preset conditions. When the preset conditions are met, it is not necessary to adjust the exposure parameters. The exposure parameters for generating the current preview image are used as the target exposure parameters to photograph the first scene. This method of determining the target exposure parameters can ensure that the preview images obtained multiple times for the same scene are consistent.
[0088] As an optional embodiment, in response to a user's photo-taking operation, determining whether the first scene is the same as the scene of the last photo-taking includes: in response to the user's photo-taking operation, setting the value of a preset flag to a first value, the first value being used to instruct the electronic device to take a photo; and determining whether the first scene is the same as the scene of the last photo-taking operation.
[0089] For example, the preset flag may be cap_flag, and the value of the preset flag is set to a first value, i.e., cap_flag == 1, indicating that the electronic device is taking a photo. In other words, when cap_flag == 1, it is determined that the first scene is the same as the scene of the last photo, and the exposure parameters of the last photo can be continued to be used.
[0090] As an optional embodiment, when the first scene is different from the scene of the last photograph, determining whether the brightness of the first image meets the preset conditions includes: when the first scene is different from the scene of the last photograph, setting the value of the preset flag to a second value; and based on the second value, determining whether the brightness of the first image meets the preset conditions.
[0091] In combination with the above flag example, the value of the preset flag is set to the second value, ie, cap_flag==0, and the electronic device enters the photo preview mode, ie, continuously adjusts the exposure parameters until the above preset conditions are met.
[0092] As an optional embodiment, determining whether the first scene is the same as the scene of the last photo includes: calculating the similarity between the first image and the third image captured during the last photo; when the similarity is less than or equal to a second preset threshold, determining that the first scene is the same as the scene of the last photo.
[0093] It should be understood that the third image mentioned above may be an image acquired by the electronic device through a sensor when taking a photo last time.
[0094] It should also be understood that the second preset threshold mentioned above may be preset on the electronic device by a developer.
[0095] The similarity in the embodiment of the present application may also be referred to as a correlation coefficient, or other names, to indicate whether two images are identical or similar.
[0096] As an optional embodiment, calculating the similarity between the first image and the third image obtained by the previous photo taking includes: obtaining a first histogram corresponding to the first image, the first histogram representing the correlation between the number of pixels and grayscale in the first image; obtaining a second histogram corresponding to the third image, the second histogram representing the correlation between the number of pixels and grayscale in the third image; and calculating the similarity diff between the first histogram and the second histogram using the following formula:
[0097] Wherein, H1(k) is the number of pixels corresponding to grayscale k in the first histogram, H2(k) is the number of pixels corresponding to grayscale k in the second histogram, and n=255.
[0098] It should be understood that the above-mentioned histogram can reflect the relationship between the frequency of occurrence of each grayscale pixel in an image and the grayscale level, generally with the grayscale level as the horizontal axis and the number of pixels as the vertical axis. For example, the electronic device can count the number of times each pixel in an image appears.
[0099] In the embodiment of the present application, by calculating the similarity of the images, it is further determined whether the two photographic scenes are the same. When it is determined that the two photographic scenes are the same, the exposure parameters used in the previous photograph can be used for the current photograph, thereby ensuring the consistency of photographing the same scene and improving the user's photographing experience.
[0100] As an optional embodiment, in response to a user's photo operation, a determination is made as to whether a dynamic range (DR) parameter of a first preview image reaches a preset threshold. The first preview image is the image displayed on the photo display interface when the electronic device receives the user's photo operation. When the DR parameter reaches the preset threshold, the captured original image is processed using a first processing method and a second processing method, respectively, to obtain a fourth image and a fifth image. The fourth image and the fifth image have different YUVs, and the first preview image and the original image are images captured of the same scene. The fourth image and the fifth image are fused to obtain a target image, which is then displayed. The target image is the image displayed by the electronic device in response to the user's operation. The original image may be an image of the scene to be photographed captured by a sensor of the electronic device.
[0101] It should be understood that the above-mentioned DR parameters are updated in real time, that is, the DR parameters correspond to the image currently displayed on the electronic device's camera interface. The calculation of the DR parameters can refer to the calculation of DR parameters in the prior art and will not be further described here. The DR parameter reaching the preset threshold can be the DR parameter corresponding to the preview image displayed on the camera interface when the electronic device receives a user's camera action.
[0102] It should be understood that the above-mentioned preset threshold can be preset by the developer on the electronic device, and the preset threshold is used to determine which processing method is used for the acquired original image. For example, if the value is less than the preset threshold, the first processing method may be used, and if the value is greater than the preset threshold, the second processing method may be used.
[0103] It should also be understood that the aforementioned YUV is a color encoding method, where "Y" represents luminance (luma), i.e., grayscale values, and "U" and "V" represent chrominance (chroma), which are used to describe the color and saturation of an image, as well as the color of a specific pixel.
[0104] Currently, when electronic devices enter different camera modes, the resulting photographic results for the same scene may differ significantly. This is because different camera modes correspond to different processing methods. The electronic device determines which processing method to use for image processing primarily based on the image's DR parameter. For example, when the DR parameter is less than a preset threshold, the first processing method is used, and when the DR parameter is greater than the preset threshold, the second processing method is used. However, since the DR parameter is in a dynamic range and in some critical scenarios (i.e., when the DR parameter is equal to or close to the preset threshold), different shots of the same scene may be determined to be in different camera modes, resulting in significantly different photographic results. Based on this, in an embodiment of the present application, when photographing the same scene, the first and second processing methods are performed on images whose DR parameters reach the preset threshold, respectively, to obtain a fourth image and a fifth image. The fourth and fifth images are then fused, and the fused image is used as the photographic result (target image) for the current shot. Even in critical scenarios, inconsistent photographic results will not occur due to different processing modes being entered for different shots, thereby improving the user's photographic experience.
[0105] As an optional embodiment, the first processing method and the second processing method are used to perform tone mapping on the original image, but the second processing method includes post-processing, while the first processing method does not include post-processing.
[0106] It should be understood that the first processing method and the second processing method mentioned above may include other processing methods in addition to the above-mentioned tone mapping.
[0107] Exemplarily, the first processing method mentioned above is: the electronic device inputs the original image obtained by the sensor into the ISP module for processing to obtain a YUV image, that is, the fourth image mentioned above. The second processing method mentioned above is: the electronic device performs post-processing on the original image obtained by the sensor, and inputs it into the ISP for processing to obtain a YUV image, that is, the fifth image mentioned above. For example, the processing flow of the above-mentioned ISP may include, in sequence: black level compensation, lens shading correction, bad pixel correction, color interpolation, noise removal, white balance correction, color correction, gamma correction, color space conversion (RGB to YUV), color noise removal and edge enhancement in the YUV color space, color and contrast enhancement, automatic exposure control, etc., and finally outputs data in YUV format. It should be understood that post-processing can be an image processing algorithm in the ISP.
[0108] As an optional embodiment, the fourth image and the fifth image are fused based on the DR parameter to obtain a target image, including: using the DR parameter as the weight of the fourth image, using the difference between 1 and the DR parameter as the weight of the fifth image, and weighting the pixel values of the fourth image and the pixel values of the fifth image to obtain the target image.
[0109] For example, the above fusion process may be performed in the following manner:
[0110] Target image = DR parameter × pixel value of the first image + (1-DR parameter) × pixel value of the second image.
[0111] It should be understood that the DR parameter in the embodiments of the present application is a number greater than 0 and less than 1.
[0112] FIG3 is a schematic flow chart of another photographing method 300 provided in an embodiment of the present application. As shown in FIG3 , the method 300 includes:
[0113] S301: The camera interface of the electronic device displays a first image, which is a preview image captured of a first scene. The description of the first scene can refer to method 200 and will not be repeated here.
[0114] S302: The electronic device receives a photo-taking operation from the user.
[0115] In step S303, the electronic device determines whether the first scene is the same as the scene of the previous photograph. The specific determination method may be based on the image similarity between the two. Specifically, when the similarity is less than or equal to a preset threshold, the two photographs are determined to be the same scene; when the similarity is greater than the preset threshold, the two photographs are determined to be different scenes. The similarity calculation method can be found in the above description and will not be further elaborated here.
[0116] In the case that the first scene is the same as the scene of the last photograph, S306 is executed and the automatic exposure is stabilized, that is, the exposure parameters of the last photograph can be determined as the target exposure parameters and no further adjustment is performed.
[0117] When the first scene is different from the last photographing scene, S304 is executed to determine whether the brightness of the first image meets a preset condition.
[0118] It should be understood that the description of the preset conditions can refer to the description of the preset conditions in the above embodiment, and will not be repeated here.
[0119] When the brightness of the first image meets the preset condition, S306 is executed and the automatic exposure is stabilized, that is, the exposure parameters for generating the first image can be determined as target exposure parameters and no further adjustment is performed.
[0120] When the brightness of the first image meets the preset condition, step S305 is executed to adjust the exposure parameters to obtain the second image, wherein the brightness of the second image meets the preset condition.
[0121] It should be noted that when the electronic device executes S302 and S303 above, the value of the preset flag is set to the first value, that is, the electronic device enters the photo mode. When the electronic device executes S304 and S305 above, the value of the preset flag is set to the second value, that is, the electronic device enters the preview mode.
[0122] FIG4 is a schematic flow chart of another photographing method 400 provided in an embodiment of the present application. As shown in FIG4 , the method 400 may include the following steps:
[0123] S401: Determine a first target brightness, wherein the first target brightness is scene brightness (LV), which is the mid-gray brightness of the image after ISP processing.
[0124] It should be understood that the first target brightness is related to the scene to be photographed, that is, when the scene does not change or changes slightly, the brightness can be considered stable.
[0125] S402: Acquire a second target brightness. The second target brightness is a target brightness acquired by the electronic device through an AE module, and may be referred to as AE target brightness.
[0126] It should be understood that the process of obtaining the second target brightness can refer to the relevant description of obtaining the AE target brightness in the workflow of the AE module in the prior art, and will not be repeated here. For example, in order to suppress the overexposed area in the current shooting scene, the electronic device will lower the target brightness through the AE module. At this time, AE will be more sensitive to changes in the highlight area, which will cause the AE target brightness (second target brightness) to be unstable. Even in the same scene, the AE target brightness may change.
[0127] S403: Perform gain compensation on the second target brightness based on the first target brightness.
[0128] In the above example of AE adjusting the exposure area, when the AE module suppresses the overexposed areas in the current scene to be photographed, it will also cause underexposed areas of normal brightness in the scene to be photographed. However, in actual applications, users hope to adjust the overexposed areas while keeping the areas of normal brightness unchanged. Based on this, this application can compensate for the underexposed areas by gaining the second target brightness according to the first target brightness, so that the brightness of the final image is normal, improving the user's photography experience.
[0129] For example, the gain compensation coefficient Dgain can be calculated using the following formula:
[0130] Dgain=first target brightness / second target brightness.
[0131] The photographing method according to the embodiment of the present application is described in detail above with reference to FIG. 2 to FIG. 4 . The photographing device according to the embodiment of the present application will be described in detail below with reference to FIG. 5 .
[0132] Figure 5 is a schematic block diagram of a photographing device 500 provided in an embodiment of the present application. As shown in Figure 5 , the device includes a sensor 510 and a processor 520. Sensor 510 is used to capture an image of the scene to be photographed, and processor 520 is used to process the image captured by the sensor. Device 500 can be used to implement any of the aforementioned method embodiments.
[0133] For example, the photographing device 500 shown in FIG5 can be applied to an electronic device. The electronic device can capture a first image of a first scene via a sensor 510 and display the image on a display screen of the electronic device. Upon receiving a user's photographing operation, the electronic device determines via a processor 520 whether the first scene is the same as the scene previously photographed. If the first scene is the same as the scene previously photographed, the electronic device determines the exposure parameters used for the previous photograph as the target exposure parameters.
[0134] It should be understood that the device 500 shown in Figure 5 can be integrated into the electronic device 100 shown in Figure 1. When the photographing device 500 is integrated into the electronic device 100, the processor 100 in Figure 1 can be used to implement the functions of the processor 510 in the device 500, such as image processing; alternatively, the processor 510 in the device 500 can also be deployed separately, which is not limited in this application.
[0135] The present application also provides a computer-readable storage medium, which is used to store a computer program, and the computer program is used to implement the method described in the above method embodiment.
[0136] The present application also provides a computer program product, which includes a computer program (also referred to as code or instruction). When the computer program runs on a computer, the computer can execute the method described in the above method embodiment.
[0137] Those skilled in the art will appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this application.
[0138] Those skilled in the art will clearly understand that, for the convenience and brevity of description, the specific working processes of the systems, devices and units described above can refer to the corresponding processes in the aforementioned method embodiments and will not be repeated here.
[0139] In the several embodiments provided in this application, it should be understood that the disclosed systems, devices and methods can be implemented in other ways. For example, the device embodiments described above are merely schematic. For example, the division of the units is merely a logical function division. In actual implementation, there may be other division methods, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.
[0140] The units described as separate components may or may not be physically separate, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed across multiple network units. Some or all of these units may be selected to achieve the purpose of this embodiment according to actual needs.
[0141] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit.
[0142] If the functions are implemented in the form of software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application, or the part that contributes to the prior art, or the part of the technical solution, can be embodied in the form of a software product. The computer software product is stored in a storage medium and includes several instructions for enabling a computer device (which can be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the method described in each embodiment of the present application. The aforementioned storage medium includes various media that can store program codes, such as a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk.
[0143] The above description is merely a specific embodiment of the present application, but the scope of protection of the present application is not limited thereto. Any changes or substitutions that can be easily conceived by a person skilled in the art within the technical scope disclosed in this application should be included in the scope of protection of this application. Therefore, the scope of protection of this application should be based on the scope of protection of the claims.
Claims
1. A photographing method, characterized in that: Applied to electronic equipment, the method includes: Displaying a first image on the photographing interface, where the first image is a preview image captured of the first scene; In response to a user's photographing operation, determining whether the first scene is the same as a scene photographed last time; If the first scene is the same as the scene of the last photograph, determining the exposure parameters used for the last photograph as target exposure parameters; Taking a picture of the first scene based on the target exposure parameter.
2. The method according to claim 1, characterized in that The method further comprises: If the first scene is different from the scene of the last photograph, determining whether the brightness of the first image meets a preset condition; and In a case where the brightness of the first image satisfies the preset condition, determining the exposure parameter used to generate the first image as the target exposure parameter; or If the brightness of the first image does not satisfy the preset condition, adjusting the exposure parameter until the brightness of the second image displayed through the photographing interface satisfies the preset condition, and determining the exposure parameter used to generate the second image as the target exposure parameter; The second image is another preview image captured of the first scene, and the exposure parameters used to generate the first image are different from the exposure parameters used to generate the second image; the preset condition is: the difference between the target brightness and the current brightness is less than or equal to a first preset threshold, and the target brightness is greater than or equal to the current brightness, the target brightness is the actual brightness of the first scene, and the current brightness is the brightness of the currently captured preview image.
3. The method according to claim 2, characterized in that The step of determining, in response to a user's photographing operation, whether the first scene is the same as a scene of a previous photograph, includes: In response to a user's photo-taking operation, setting a value of a preset flag to a first value, where the first value is used to instruct the electronic device to take a photo; Based on the first value, it is determined whether the first scene is the same as the scene of the last photo.
4. The method according to claim 3, characterized in that The determining whether the brightness of the first image satisfies a preset condition when the first scene is different from the scene of the last photograph includes: If the first scene is different from the scene of the last photograph, setting the value of the preset flag to a second value; Based on the second value, it is determined whether the brightness of the first image meets the preset condition.
5. The method according to any one of claims 1 to 4, characterized in that The determining whether the first scene is the same as the scene of the last photograph comprises: Calculating a similarity between the first image and a third image captured during the last photo taking; When the similarity is less than or equal to a second preset threshold, it is determined that the first scene is the same as the scene of the last photo.
6. The method according to claim 5, characterized in that The calculating the similarity between the first image and the third image obtained by the last photographing includes: Obtaining a first histogram corresponding to the first image, where the first histogram represents a correlation between the number of pixels and grayscale of the first image; Obtaining a second histogram corresponding to the third image, where the second histogram represents a correlation between the number of pixels and grayscale in the third image; The similarity diff between the first histogram and the second histogram is calculated using the following formula: Wherein, H1(k) is the number of pixels corresponding to grayscale k in the first histogram, H2(k) is the number of pixels corresponding to grayscale k in the second histogram, and n=255.
7. The method according to any one of claims 1 to 6, characterized in that The method further comprises: In response to a user's photographing operation, determining whether a dynamic range (DR) parameter of a first preview image reaches a preset threshold, where the first preview image is a preview image displayed on the photographing display interface when the electronic device receives the user's photographing operation; When the DR parameter reaches the preset threshold, processing the captured original image using the first processing method and the second processing method respectively to obtain a fourth image and a fifth image, respectively, wherein the YUV of the fourth image is different from the YUV of the fifth image, and the first preview image and the original image are images captured of the same scene; performing fusion processing on the fourth image and the fifth image to obtain a target image; The target image is displayed.
8. The method according to claim 7, characterized in that The first processing mode and the second processing mode are used to perform tone mapping on the original image, the second processing mode includes post-processing, but the first processing mode does not include post-processing.
9. The method according to claim 7 or 8, characterized in that The fusing the fourth image and the fifth image based on the DR parameter to obtain a target image includes: The DR parameter is used as the weight of the fourth image, the difference between 1 and the DR parameter is used as the weight of the fifth image, and the pixel values of the fourth image and the pixel values of the fifth image are weighted to obtain the target image.
10. An electronic device, characterized in that: include: A processor and a memory, wherein the memory is used to store a computer program; The processor is configured to call and execute the computer program, so that the electronic device performs the method according to any one of claims 1 to 9.
11. A computer-readable storage medium, characterized in that Used to store a computer program, the computer program comprising instructions for implementing the method according to any one of claims 1 to 9.