Image processing method and device
By adjusting the focus position and aperture size after shooting, the electronic device achieves flexible image blur processing, solves the limitations of blur effect adjustment in existing technologies, and improves the accuracy of blur processing and user experience.
Patent Information
- Application Number
- CN202410672707.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-05-27
- Publication Date
- 2025-10-10
- Estimated Expiration
- 2044-05-27
AI Technical Summary
In the prior art, users cannot flexibly adjust the blur effect of the captured image in the camera application, which is limited.
By adjusting the focus position and aperture size after shooting, electronic devices can blur the image, provide multiple interfaces for users to adjust the blur effect, and compress or enlarge the image when necessary to optimize the processing process.
It improves the user experience of the blur adjustment function, enhances the accuracy and flexibility of blur processing, reduces the amount of data processed by the algorithm, saves memory usage, and improves the user experience.
Smart Images

Figure CN120769181A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of terminal technology, and in particular to an image processing method and device. Background Art
[0002] With the popularization and development of the Internet, people's functional requirements for terminal devices are becoming increasingly diverse. For example, in response to a user clicking a photo button in a camera application, an electronic device can blur the image captured by the camera to obtain a captured image with a blurred effect.
[0003] Typically, users can adjust the aperture size to change the blur effect of the image before shooting. However, the above solution has certain limitations. Summary of the Invention
[0004] The embodiments of the present application provide an image processing method and apparatus, which enable an electronic device to flexibly adjust the blurring effect of an image by adjusting the focus position and aperture size after shooting.
[0005] In a first aspect, an embodiment of the present application provides an image processing method, which is applied to an electronic device, the method comprising: in response to a photo-taking operation, acquiring first image data, the first image data comprising: a first object, a second object, the first object corresponding to a first plane in the first image, the second object corresponding to a second plane in the first image, and a first focus position, the depth information of any pixel point in the first plane is different from the depth information of any pixel point in the second plane, and the first focus position corresponding to the first plane in the first image; blurring the second object in the first image based on the first image data to obtain a second image; displaying a first interface of a gallery application, the first interface comprising: a second image and a first button, the first button being used to blur the second image; in response to an operation on the first button, displaying a second interface, the second interface comprising: a second image; in response to an operation on the second object in the second image, acquiring a second focus position, the second focus position corresponding to a second plane in the second image; blurring the first object in the first image based on the second image data to obtain a third image, and displaying the third image, the second image data comprising: the first object, the second object, the first object corresponding to the first plane in the first image, the second object corresponding to the second plane in the first image, and a second focus position.
[0006] The first image data may be the shooting parameters corresponding to image 0 or the shooting parameters corresponding to image 1 described in the embodiment of the present application.
[0007] The first object may be object 2, the first plane may be plane 2, the second object may be object 3, the second plane may be plane 3. The first focus position may be focus position information 1, and the second focus position may be focus position information 3.
[0008] The first interface can be Figure 4B , the first button can be Figure 4B The second interface can be Figure 4C .
[0009] The first image may be image 0, the second image may be image 1 (or image 2), and the third image may be image 3.
[0010] In this way, when the electronic device detects a change in the focus position information, it can determine the plane where the focus position information is located, and then blur objects in other planes in the image except for this plane, so as to improve the user experience of using the blur adjustment function.
[0011] In a possible implementation, the first focus position corresponds to a first plane in the first image, including: the first plane in the first image corresponds to a first focus position range, and the first focus position is within the first focus position range.
[0012] The first focus position range may be focus position range 2.
[0013] In this way, the electronic device can determine in which plane the first focus position is located based on the relationship between the first focus position and the first focus position range, and retain the clarity of the plane during blurring to improve the accuracy of blurring.
[0014] In a possible implementation, the second image corresponds to a first F value. After responding to an operation on the second object in the second image, the method further includes: acquiring the first F value. The second image data also includes the first F value.
[0015] The first F value may be aperture information 1.
[0016] In this way, when the F value does not change, the electronic device can perform blurring processing on the second object in the second image based on the first F value to retain the blurring degree of the picture.
[0017] In one possible implementation, the second interface also includes: a sliding bar for adjusting the F value of the first image. After displaying the second interface and before responding to an operation on the second object in the second image, the method also includes: obtaining a second F value in response to the operation on the sliding bar; blurring the second object in the first image based on the third image data to obtain a fourth image, and displaying the fourth image, wherein the third image data includes: a first object, a second object, the first object corresponding to the first plane in the first image, the second object corresponding to the second plane in the first image, a second F value, and a first focus position.
[0018] The slider for adjusting the F value of the first image can be Figure 4C Slider bar 424 in.
[0019] The fourth image may be image 4. The second F value may be aperture information 2.
[0020] In this way, when the F value changes, the electronic device can obtain the third image data and perform blurring processing based on the third image data, so that the focus position of the picture remains unchanged after the blurring processing.
[0021] In one possible implementation, after responding to an operation on the first button, the method further includes: determining a first image ratio corresponding to the second image, and recording a first size corresponding to the second image; determining a second size corresponding to the first image ratio based on a correspondence between the image ratio and a preset size, where the preset size is the maximum size allowed by the electronic device for image processing; when the first size is larger than the second size, compressing the second image to the second size, or compressing the second image based on a preset compression ratio and the first size to obtain a compressed second image.
[0022] In this way, electronic devices can reduce the data processing process of the algorithm through compression processing.
[0023] In a possible implementation, the compression ratio is related to the image ratio, and / or the compression ratio is related to the chip type of the electronic device.
[0024] In one possible implementation, the size of the third image is the second size, or the size of the third image is the ratio between the first size and a preset compression ratio. The second interface also includes: a save button. After obtaining the third image, the method also includes: in response to an operation on the save button, enlarging the third image to the first size to obtain a fifth image, and storing the fifth image.
[0025] The fifth image may be Image 5 .
[0026] In this way, the electronic device can restore the image to the original size through the zooming processing of the third image, so as to improve the user experience.
[0027] In a possible implementation, after obtaining the first image, the method further includes: converting the format of the first image from JPEG to YUV; and after obtaining the third image, the method further includes: converting the format of the third image from YUV to bitmap.
[0028] In this way, the electronic device can save the memory occupation in the algorithm processing through the format conversion processing.
[0029] In a possible implementation, the first interface further includes: a first identifier, the first identifier being used to frame the first object in the second image; and after responding to the operation on the second object in the second image, the first identifier is used to frame the second object in the second image.
[0030] The first identifier can be Figure 4C the focusing frame 423 in the first interface or Figure 4E the focusing frame 432 in the second interface.
[0031] In this way, the user can determine the focus position through the first identifier, so as to adjust the focus position at any time.
[0032] In a possible implementation, the second image is an image obtained by the electronic device based on a portrait mode or an aperture mode. In this way, the image processing method described in the embodiments of the present application can be applied to the image obtained based on the aperture mode and the portrait mode.
[0033] In a possible implementation, before responding to the operation on the first button, the method further includes: generating the first button in the case that the first image data includes the first focus position information and the first F value.
[0034] In this way, the electronic device can generate the first button in the case that the focus position information and the F value are detected based on the judgment of whether the first button is generated, so as to improve the security of the scheme.
[0035] In one possible implementation, the first image data includes depth image data, and the depth image data includes: depth information of any pixel point in the first plane and depth information of any pixel point in the second plane. The electronic device includes: a gallery application and a camera algorithm library. The gallery application includes: a first module. After responding to an operation on the first button, the method also includes: the first module obtains the first image data; the first module sends a first request to the camera algorithm library, and the first request includes: the first image data; in response to the first request, the camera algorithm library determines that the first focus position corresponds to the first plane; the camera algorithm library blurs the second object in the first image based on the first image data to obtain the second image.
[0036] The first module may be a virtualization editing module. The first request may be request 1.
[0037] In this way, the electronic device can set the blur processing process in the camera algorithm library to save data processing on the application processor side.
[0038] In one possible implementation, the second image data includes depth image data. After obtaining the second focus position, the method also includes: the first module sends a second request to the camera algorithm library, and the second request includes: the second image data; based on the second focus position, the first object in the first image is blurred to obtain a third image, including: in response to the second request, the camera algorithm library determines that the second focus position corresponds to the second plane; based on the second image data, the first object in the first image is blurred to obtain a third image, including: the camera algorithm library blurs the first object in the first image based on the second image data to obtain the third image.
[0039] The second request may be Request 2 .
[0040] In a second aspect, an embodiment of the present application provides an image processing device, which may be an electronic device or a chip or chip system within an electronic device. The image processing device may include a display unit and a processing unit. When the image processing device is an electronic device, the display unit may be a display screen. The display unit is configured to perform the display step so that the electronic device implements an image processing method described in the first aspect or any possible implementation of the first aspect, or implements an image processing method described in the second aspect or any possible implementation of the second aspect. When the image processing device is an electronic device, the processing unit may be a processor. The image processing device may also include a storage unit, which may be a memory. The storage unit is configured to store instructions, and the processing unit executes the instructions stored in the storage unit so that the electronic device implements an image processing method described in the first aspect or any possible implementation of the first aspect, or implements an image processing method described in the second aspect or any possible implementation of the second aspect. When the image processing device is a chip or chip system within an electronic device, the processing unit may be a processor. The processing unit executes the instructions stored in the storage unit to cause the electronic device to implement an image processing method described in the first aspect or any possible implementation of the first aspect, or to implement an image processing method described in the second aspect or any possible implementation of the second aspect. The storage unit may be a storage unit within the chip (e.g., a register, a cache, etc.), or a storage unit within the electronic device that is located outside the chip (e.g., a read-only memory, a random access memory, etc.).
[0041] Specifically, in response to a photographing operation, the processing unit is configured to acquire first image data, the first image data including a first object, a second object, the first object corresponding to a first plane in a first image, the second object corresponding to a second plane in the first image, and a first focal point position, depth information of any pixel point in the first plane being different from depth information of any pixel point in the second plane, the first focal point position corresponding to the first plane in the first image; the processing unit is further configured to perform a blurring process on the second object in the first image based on the first image data to obtain a second image; the display unit is configured to display a first interface of a gallery application, the first interface including the second image and a first button, the first button being used for blurring adjustment of the second image; in response to an operation on the first button, the display unit is further configured to display a second interface, the second interface including the second image; in response to an operation on the second object in the second image, the processing unit is further configured to acquire a second focal point position, the second focal point position corresponding to the second plane in the second image; the processing unit is further configured to perform a blurring process on the first object in the first image based on second image data to obtain a third image, the display unit being further configured to display the third image, the second image data including the first object, the second object, the first object corresponding to the first plane in the first image, the second object corresponding to the second plane in the first image, and the second focal point position.
[0042] In a third aspect, an embodiment of the present application provides an electronic device, the electronic device comprising: one or more processors and a memory; the memory is coupled to the one or more processors, and the memory is configured to store computer program codes, the computer program codes comprising computer instructions, and the one or more processors are configured to invoke the computer instructions to enable the electronic device to perform the method described in the first aspect or any possible implementation manner of the first aspect.
[0043] In a fourth aspect, an embodiment of the present application provides a computer readable storage medium, the computer readable storage medium comprising computer instructions, and when the computer instructions run on an electronic device, the computer instructions enable the electronic device to perform the method described in the first aspect or any possible implementation manner of the first aspect.
[0044] In a fifth aspect, an embodiment of the present application provides a computer program product comprising a computer program, and when the computer program product comprises computer program codes, and when the computer program codes run on an electronic device, the computer program codes enable the electronic device to perform the method described in the first aspect or any possible implementation manner of the first aspect.
[0045] In a sixth aspect, the present application provides a chip system, the chip system being applied to an electronic device, and the chip system comprising one or more processors, and the one or more processors are configured to invoke computer instructions to enable the electronic device to perform the method described in the first aspect or any possible implementation manner of the first aspect.
[0046] In one possible implementation, the chip system described above in this application further includes at least one memory, in which instructions are stored. The memory may be a storage unit within the chip system, such as a register, a cache, etc., or a storage unit of the chip system (e.g., a read-only memory, a random access memory, etc.).
[0047] It should be understood that the second to sixth aspects of the present application correspond to the technical solutions of the first aspect of the present application, and the beneficial effects achieved by each aspect and the corresponding feasible implementation methods are similar and will not be repeated here. BRIEF DESCRIPTION OF THE DRAWINGS
[0048] Figure 1A-Figure 1D A schematic diagram of a scenario provided in an embodiment of the present application;
[0049] Figure 2 A schematic diagram of the hardware structure of an electronic device provided in an embodiment of the present application;
[0050] Figure 3 A schematic diagram of the software structure of an electronic device provided in an embodiment of the present application;
[0051] Figures 4A-4K A schematic diagram of an interface provided in an embodiment of the present application;
[0052] Figure 5 A flowchart of an image processing method provided in an embodiment of the present application;
[0053] Figure 6 A schematic diagram of module interaction of an image processing method provided in an embodiment of the present application;
[0054] Figure 7 A flowchart of another image processing method provided in an embodiment of the present application;
[0055] Figure 8 A schematic diagram of module interaction of another image processing method provided in an embodiment of the present application;
[0056] Figure 9 A flowchart of another image processing method provided in an embodiment of the present application;
[0057] Figure 10 A schematic diagram of module interaction of another image processing method provided in an embodiment of the present application;
[0058] Figure 11 A flowchart of another image processing method provided in an embodiment of the present application;
[0059] Figure 12A flowchart of another image processing method provided in an embodiment of the present application;
[0060] Figure 13 A schematic diagram of the hardware structure of another electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0061] To facilitate a clear description of the technical solutions of the embodiments of the present application, some of the terms and technologies involved in the embodiments of the present application are briefly introduced below:
[0062] 1. Camera aperture and F value
[0063] The camera aperture is a device used to control the amount of light entering the camera. The camera aperture can control the amount of light entering the camera, that is, control the camera's exposure.
[0064] The parameter used to describe aperture size is called the F-number. The F-number doesn't directly indicate the diameter of the aperture, but rather represents the ratio between the aperture diameter and the focal length of the lens. A smaller F-number indicates a larger aperture, allowing more light in. Conversely, a larger F-number indicates a smaller aperture, allowing less light in. For example, F2.8 (i.e., F-number = 2.8) has a larger aperture than F8.
[0065] 2. Camera Depth of Field
[0066] Depth of field can be understood as the range of images within a camera lens or other imager that allows for a clear image to be captured, or the range of clarity before and after the focal point. The focal point can be the sharpest point achieved when light passes through the lens and focuses on the photosensitive element. Foreground depth of field can include the clear range before the focal point, while back depth of field can include the clear range after the focal point.
[0067] Important factors affecting depth of field include aperture size, lens, and distance to the subject. A larger aperture (i.e., a smaller F-number) results in a shallower depth of field, while a smaller aperture (i.e., a larger F-number) results in a deeper depth of field. Furthermore, a longer focal length lens results in a shallower depth of field, while a shorter focal length lens results in a deeper depth of field.
[0068] 3. Depth Image
[0069] A depth map can be a grayscale image that includes the depth information of any pixel. The depth information can represent the distance between each point in the scene and the camera.
[0070] In this embodiment of the present application, the electronic device can group pixels with the same (or similar) depth information into a plane (or layer), in which case the image may include multiple planes. During the blurring process, in response to the user selecting the focus position information, the electronic device can obtain plane 1 where the focus position information is located, preserve the clarity of plane 1, and blur the other planes in the image.
[0071] It is understood that the depth image can reflect the geometric shape of the visible surface in the scene. The depth image can be obtained by one or more of the following methods, such as: laser radar depth imaging, computer stereo vision imaging, or coordinate measuring machine method.
[0072] 4. Electronic devices
[0073] The electronic devices of the embodiments of the present application may include handheld devices with display functions, vehicle-mounted devices, etc. For example, some electronic devices include: mobile phones, tablet computers, PDAs, laptop computers, mobile internet devices (MIDs), wearable devices, virtual reality (VR) devices, augmented reality (AR) devices, vehicle-mounted devices, wearable devices, terminal devices in 5G networks or terminal devices in future evolved public land mobile networks (PLMNs), etc., which are not limited in the embodiments of the present application. Among them, wearable devices may include one or more of the following: smart watches, smart glasses, smart bracelets, smart jewelry, etc.
[0074] The electronic devices in the embodiments of the present application may also be referred to as: terminal equipment, 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, user terminal, terminal, wireless communication equipment, user agent or user device, etc.
[0075] 5. Other nouns
[0076] In the embodiments of this application, terms such as "first" and "second" are used to distinguish between identical or similar items with substantially the same functions and effects. For example, the terms "first chip" and "second chip" are used solely to distinguish between different chips and do not define their order. Those skilled in the art will understand that terms such as "first" and "second" do not define the quantity or execution order, and do not necessarily define differences.
[0077] It should be noted that in the embodiments of this application, words such as "exemplary" or "for example" are used to indicate examples, illustrations, or descriptions. Any embodiment or design described 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.
[0078] In the embodiments of the present application, "at least one" refers to one or more, and "more" refers to 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 represent: the existence of A alone, the existence of A and B at the same time, and the existence of B alone, where A and B can be singular or plural. The character " / " generally indicates that the 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 items or plural items. For example, at least one of a, b, or c can represent: a, b, c, ab, a--c, bc, or abc, where a, b, c can be single or multiple.
[0079] For example, Figure 1 is a schematic diagram of a scenario provided by an embodiment of the present application. In the embodiment corresponding to Figure 1, an electronic device is taken as an example of a mobile phone, which does not constitute a limitation on the embodiment of the present application.
[0080] The embodiments of the present application provide multiple shooting modes, namely, large aperture mode and portrait mode.
[0081] In wide aperture mode, electronic devices primarily use wide aperture lenses to capture photos with a blurred background effect. For example, electronic devices can adjust the aperture size of the lens to change the depth of field, achieving a clear foreground and blurred background effect, thereby highlighting the subject in the foreground.
[0082] In portrait mode, electronic devices can focus on the capture task, using photo algorithms to separate the subject from the background while also providing features like beautification and skin enhancement to enhance the portrait. For example, electronic devices can use facial recognition to identify the face area and blur the background area outside the face area to preserve the clarity of the face area.
[0083] It is understandable that users can capture images with a blurred effect through large aperture mode or portrait mode.
[0084] In response to the user opening the camera application, the electronic device may display Figure 1A The interface shown in the figure is as follows. Figure 1A As shown, the interface may display: a preview window 101, a camera mode option bar 102, a review button 103, a photo button 104, a camera flip button 105, and the like.
[0085] The preview window 101 may display a preview image and a photo setting button.
[0086] The preview image in the preview window 101 may be an image captured in real time by a camera of the electronic device based on a viewing range.
[0087] The preview image may include: a person 10 in the portrait area, a building 20 in the building area, and grass 30 in the grass area.
[0088] During the shooting process, the distance between the grass area and the electronic device is distance 1, the distance between the portrait area and the electronic device is distance 2, and the distance between the building area and the electronic device is distance 3. Distance 3 is greater than distance 2, and distance 2 is greater than distance 1, indicating that the grass area is closer to the electronic device and the building area is farther away.
[0089] It is understandable that the electronic device can capture image 1 based on the preview screen. In the depth image corresponding to image 1, the depth information of the grass area can be 3 meters, the depth information of the building area can be 20 meters, and the depth information of the portrait area can be 5 meters. The depth information described here is only for illustration.
[0090] In portrait mode, the electronic device can determine the area where the person is located through portrait recognition. Therefore, when blurring the preview image, the electronic device can preserve the clarity of the person and blur the area other than the person. The user can then view the clear person 10, as well as the blurred building 20 and the blurred grass 30 in the preview window 101.
[0091] It is understandable that the embodiment of the present application can reflect the blurring effect through the dotted lines in the image, which will not be described in detail later.
[0092] The photo setting buttons may include: a blur setting button 106 , a shooting magnification option 107 , and a beauty and skin beautification button 108 .
[0093] The blur setting button 106 can be used to adjust the blur effect of the picture before shooting. The blur effect can be adjusted from strong to weak. Figure 1B Description.
[0094] The shooting magnification option 107 can be used to adjust the shooting magnification before shooting. The shooting magnification option 107 can display: a button for setting the shooting magnification to 1x, a button for setting the shooting magnification to 2x, a button for setting the shooting magnification to 2.5x, and a button for setting the shooting magnification to 5x, etc.
[0095] The beauty and skin beautification button 108 can be used to adjust the beauty and skin beautification effect of the picture, such as increasing the beauty and skin beautification effect, or adjusting the strength of the beauty and skin beautification effect.
[0096] At least one shooting mode button may be displayed in the camera mode option bar 102. For example, the camera mode option bar may display, from left to right, a large aperture mode button 109, a night scene mode button, a portrait mode button 110, a photo mode button, and a video mode button.
[0097] The upper side of the portrait mode button 110 may display a selected mark, which may be displayed as an upward arrow. When the portrait mode button 110 is in the selected state, Figure 1A It can also be called the shooting interface corresponding to portrait mode.
[0098] The replay button 103 can be used to view a previously captured image or video. The replay button 103 can display a thumbnail of the previously captured image 111, or a thumbnail of the image 111 at the first frame of the previously captured video. For example, in response to a user clicking the replay button 103, the electronic device can open a gallery application and display the image 111.
[0099] The photo button 104 may be used to receive a user's photo operation. In portrait mode, in response to a user's click operation on the photo button 104, the electronic device may acquire a captured image in portrait mode.
[0100] The camera flip button 105 can be used to switch the camera in use. If the camera currently being used to capture images is the front camera, when the electronic device detects a user clicking the camera flip button 105, the electronic device can enable the rear camera to capture images. Conversely, if the camera currently being used to capture images is the rear camera, when the electronic device detects a user clicking the camera flip button 105, the electronic device can enable the front camera to capture images.
[0101] In response to user Figure 1A By clicking the blur setting button 106 in the image, the electronic device can display the following Figure 1B The interface shown. Figure 1B A slide bar 112 may be displayed on the right side of the middle blur setting button 106. Figure 1BOther content displayed in the Figure 1A The same is true in , so I will not repeat it here.
[0102] Slider bar 112 can be used to adjust the degree of blur. For example, in response to a user sliding slider bar 112 to the right, the electronic device can enhance the blur effect of the image before shooting; or in response to a user sliding slider bar 112 to the left, the electronic device can reduce the blur effect of the image before shooting. Each sliding position of slider bar 112 can correspond to an F value. For example, in the case of enhancing the blur effect, the F value can be F1.2, and in the case of reducing the blur effect, the F value can be F16.
[0103] In response to user Figure 1A The large aperture mode button 109 is clicked, and the electronic device displays the following Figure 1C The interface shown. Figure 1C A preview window 113, a camera mode option bar, a review button, a photo button 115, a camera flip button, etc. can be displayed.
[0104] The preview window 113 may display: a preview image and an F value adjustment button 114 . The F value adjustment button 114 may be used to adjust the aperture size of the camera.
[0105] In response to a click operation for the F value adjustment button 114, the electronic device may display the following information: Figure 1D The interface shown. Figure 1D The preview window 113 may include a slide bar 116 , where any sliding position of the slide bar 116 may correspond to an F value. For example, when the sliding position is F4 , the slide bar 116 may display F4 .
[0106] Understandably, users can Figure 1B The slider 112 in the image is used to adjust the blur effect before shooting, or based on Figure 1D The slider 116 in the image processing apparatus is used to adjust the blur effect before shooting. After the user clicks the photo button 104 or the photo button 115, the electronic device generates a captured image. However, while the above method can achieve blur adjustment before shooting, it has certain limitations.
[0107] It is understandable that the above-mentioned electronic devices may also be referred to as terminals, user equipment (UE), mobile stations (MS), mobile terminals (MT), etc. The electronic devices may be mobile phones with touch screens, smart TVs, wearable devices, tablet computers (Pads), computers with wireless transceiver functions, virtual reality (VR) electronic devices, augmented reality (AR) electronic devices, etc. The embodiments of the present application do not limit the specific technologies and specific device forms used by the electronic devices.
[0108] In order to better understand the embodiments of the present application, the structure of the electronic device according to the embodiments of the present application is introduced below. Figure 2 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application.
[0109] The electronic device may include a processor 110, an internal memory 121, a universal serial bus (USB) interface 130, an antenna 2, a wireless communication module 160, an audio module 170, a speaker 170A, a receiver 170B, a microphone 170C, an earphone interface 170D, a sensor module 180, and a display screen 194, etc.
[0110] The sensor module 180 may include a touch sensor and other sensors. The touch sensor may be provided on the display screen 194, and the touch sensor and the display screen 194 form a touch screen. The touch sensor is used to receive a user's trigger operation on the touch screen.
[0111] 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.
[0112] The processor 110 may include one or more processing units. The different processing units may be independent devices or integrated into one or more processors. The processor 110 may also include a memory for storing instructions and data. For example, the processor 110 may be used to store instructions and data related to an image processing method provided in an embodiment of the present application.
[0113] The USB interface 130 is an interface that complies with USB standards, and may be a Mini USB interface, a Micro USB interface, a USB Type C interface, etc. The USB interface 130 may be used to transfer data between the electronic device and peripheral devices.
[0114] The wireless communication module 160 may provide functions applied to electronic devices, including wireless local area networks (WLAN) (such as wireless fidelity (Wi-Fi) networks) or Bluetooth (BT).
[0115] The electronic device realizes the display function through the GPU, the display screen 194, and the application processor. The GPU is a microprocessor for image processing, which connects the display screen 194 and the application processor.
[0116] The display screen 194 is used to display images, videos, etc. The display screen 194 includes a display panel. For example, the display screen 194 can display Figure 1A-1D ,as well as Figures 4A-4K Any of the interfaces described in .
[0117] The software system of the electronic device can adopt a layered architecture, event-driven architecture, micro-kernel architecture, microservice architecture, or cloud architecture, etc., which will not be described here.
[0118] For example, Figure 3 A schematic diagram of the software structure of an electronic device provided in an embodiment of the present application.
[0119] like Figure 3 As shown, the layered architecture divides the software into several layers, each with a clear role and division of labor. Layers communicate with each other through software interfaces. In some embodiments, the Android system is divided into multiple layers, from top to bottom, including the application (APP) layer, the application framework layer, the hardware abstraction layer (HAL), and the kernel layer, etc., which are not limited in the embodiments of this application.
[0120] The application layer can include a series of application packages. The application layer can include one or more of the following: a camera application, a gallery application, etc.
[0121] The camera application can be used to capture images. The camera application can implement multiple shooting modes. For example, the shooting modes can be found in Figure 1A Description in .
[0122] The gallery application, which may also be called an album application, can implement functions such as image search and image editing. For example, the gallery application may include a large image preview (photo browser) module, a blur editing module, and a storage module.
[0123] The large image preview module can be used to determine whether to generate a blur adjustment button according to the shooting parameters corresponding to the image 1.
[0124] The blur editing module can be used to initiate a request to the camera algorithm library through the media center, requesting the library to process the image. The blur editing module can also implement image compression, image amplification, and image format conversion. The blur editing module's functions can be implemented by the WideAperturePhotoImp class in the electronic device.
[0125] The storage module can be used to store images, image thumbnails, image capture times, and corresponding capture parameters in the gallery application. For example, if the gallery application includes Image 1, the storage module can store: Image 1, a thumbnail of Image 1 (such as thumbnail 402), the capture time of Image 1, the capture date of Image 1, and corresponding capture parameters for Image 1. The capture parameters for Image 1 can be found in the description of S601 and will not be repeated here.
[0126] The application framework layer provides the application programming interface (API) and programming framework for the applications in the application layer. The application framework layer includes some predefined interfaces. The application framework layer can include one or more of the following: media middleware.
[0127] The media center can be used to forward data between the blur editing module and the camera algorithm library. For example, the media center can forward messages sent by the blur editing module to the camera algorithm library, or forward messages sent by the camera algorithm library to the blur editing module, etc.
[0128] Among them, the interaction between the media center and other modules can be achieved through the class in the electronic device, namely WideAperturePhotoUtil. It can be understood that all the methods that the media center needs to call can be in WideAperturePhotoUtil.
[0129] In a possible implementation, the application framework layer may further include one or more of the following: a display composition system, a window manager, a content provider, a resource manager, a view system, or a notification manager, etc. ( Figure 3 (not shown in the figure), which is not limited in the embodiments of the present application.
[0130] The purpose of the hardware abstraction layer is to abstract the hardware, providing a unified interface for querying hardware devices for upper-layer applications, or providing data storage services for upper-layer applications.
[0131] The hardware abstraction layer may include one or more of the following: a camera algorithm library. The camera algorithm library may be used to implement image blur processing based on focus position information, aperture information, and depth image.
[0132] The kernel layer is the layer between hardware and software. It drives the hardware to make it work. The kernel layer can include one or more of the following: camera driver, display driver, or sensor driver.
[0133] In the possible line of sight mode, the electronic device may include a hardware layer, which may include one or more of the following: a camera, a liquid crystal display (LCD), a graphics processing unit (GPU), or a central processing unit (CPU) and other hardware ( Figure 3 not shown).
[0134] In the embodiments of the present application, no specific limitation is imposed on the software layers involved in the software architecture, the modules contained in the layers, and the functions of the modules.
[0135] 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.
[0136] The following combination Figures 4A-4K The interface shown is an example of the blurring editing process in the image processing method, and the example does not constitute a limitation of the embodiments of the present application.
[0137] exist Figures 4A-4K In the description, the shooting mode is taken as an example for illustration. In this case, the image 1 can be an image shot by the electronic device based on the portrait mode. For example, the electronic device can be based on Figure 1A-1B , and capture images in portrait mode.
[0138] When the shooting mode is the large aperture mode, the image 1 may also be an image shot by the electronic device based on the large aperture mode. For example, the electronic device may be based on Figure 1C-1D The image was taken in large aperture mode according to the description in the previous section, which will not be repeated in the following.
[0139] In response to the user clicking the photograph button 104 in Figure 1A The electronic device obtains the photographing parameters corresponding to image 0 based on the camera, and obtains image 1 based on the photographing parameters corresponding to image 0.
[0140] For example, image 0 can include object 1 (such as grass), object 2 (such as a person), and object 3 (such as a building).
[0141] When image 1 also includes object 1, object 2, and object 3, the photographing parameters corresponding to image 0 can include the photographing parameters of object 1, the photographing parameters of object 2, and the photographing parameters of object 3.
[0142] The photographing parameters of object 1 can include pixel information of object 1, plane 1 corresponding to object 1, focus position range 1 corresponding to plane 1, and depth 1 corresponding to plane 1.
[0143] The photographing parameters of object 2 can include pixel information of object 2, plane 2 corresponding to object 2, focus position range 2 corresponding to plane 2, and depth 2 corresponding to plane 2.
[0144] The photographing parameters of object 3 can include pixel information of object 3, plane 3 corresponding to object 3, focus position range 3 corresponding to plane 3, and depth 3 corresponding to plane 3.
[0145] It can be understood that object 1 can correspond to plane 1, the depth information of any pixel point in plane 1 can be depth 1, and the focus position range corresponding to plane 1 can be focus position range 1. When the focus position corresponding coordinates (such as focus position information 1) are located in focus position range 1, object 1 is the focus object, and the electronic device can not perform the virtualization processing on the pixel points corresponding to object 1, but can perform the virtualization processing on the pixel points other than the pixel points corresponding to object 1.
[0146] In focus position range 1, the value range of the horizontal coordinate can be (x11, x12), and the value range of the vertical coordinate can be (y11, y12).
[0147] It can be understood that the area formed by the focus position range can be a regular shape, such as a rectangle or a circle, or the area formed by the focus position range can also be an irregular area, such as a grass area, and the present application does not limit this.
[0148] Object 2 may correspond to plane 2, the depth information of any pixel in plane 2 may be depth 2, and the focus position range corresponding to plane 2 may be focus position range 2. When the coordinates corresponding to the focus position (such as focus position information 1) are within focus position range 2, object 2 is the focus object, and the electronic device may not blur the pixels corresponding to object 2, but may blur the pixels other than the pixels corresponding to object 2.
[0149] Depth 2 is different from depth 1, for example, depth 2 may be greater than depth 1, and focus position range 2 is different from focus position range 1. In focus position range 2, the value range of the horizontal coordinate may be (x21, x22), and the value range of the vertical coordinate may be (y21, y22).
[0150] Object 3 may correspond to plane 3, the depth information of any pixel in plane 3 may be depth 3, and the focus position range corresponding to plane 3 may be focus position range 3. When the coordinates corresponding to the focus position (such as focus position information 1) are within focus position range 3, object 3 is the focus object, and the electronic device may not blur the pixels corresponding to object 3, but may blur the pixels other than the pixels corresponding to object 3.
[0151] Depth 3 is different from depth 2, for example, depth 3 may be greater than depth 2, and focus position range 3 is different from focus position range 2. In focus position range 2, the horizontal coordinate may have a value range of (x31, x32), and the vertical coordinate may have a value range of (y31, y32).
[0152] It is understandable that the photographed objects described in Image 1 are only used as an example, and the embodiment of the present application does not limit the number of photographed objects.
[0153] The shooting parameters corresponding to image 0 may also include: aperture information corresponding to image 0 (such as aperture information 1) and depth image data corresponding to image 0 (such as data included in depth image 1). The depth image data includes: depth 1, depth 2, and depth 3.
[0154] In response to the operation of opening the gallery application, the electronic device displays Figure 4A The interface shown may display: a search box 401 and a thumbnail of at least one image. For example, the thumbnail of at least one image may include: a thumbnail 402 of image 1.
[0155] The search box 401 can be used to implement image search in the gallery application. For example, the search box 401 can search for images with human features, or search for images taken at a certain location, etc.
[0156] The thumbnail 402 may be an image obtained by reducing the size of the image 1. The upper side of the thumbnail 402 may display the shooting location of the image 1 (eg, XX District, XX City), the shooting date of the image 1 (eg, today), and other contents.
[0157] Optionally, the thumbnail 402 may also display: a symbol 1 with the letter “f”, where “f” can be understood as an abbreviation of the F value. The symbol 1 may not be in the Figure 4A The mark 1 can indicate that the image 1 is a blurred image. The mark 1 can be displayed in the upper right corner of the thumbnail 402 or in other locations of the thumbnail 402. In this way, the user can determine that the image 1 is a blurred image through the mark 1 without viewing the image 1 in full size, and then click the thumbnail 401 and perform the blur editing step on the image 1.
[0158] In response to the user's click operation on thumbnail 402, the electronic device displays the following Figure 4B The interface shown. Figure 4B The following may be displayed: shooting information 406 , blur adjustment button 404 , detail view button 405 , image 1 , and option bar 407 .
[0159] The shooting information 406 may display: the shooting location of the image 1, the shooting date of the image 1 (eg, May 13, 2014), and the shooting time of the image 1 (eg, 08:00).
[0160] The blur adjustment button 404 can be used to enter the blur editing interface corresponding to the image 1 (eg Figure 4C The blur adjustment button 404 may display the letter “f”, where “f” may be understood as an abbreviation of the F value.
[0161] It is understood that after entering the blur editing interface, the electronic device can adjust the focus position of image 1 and / or the F value of image 1. The process of blurring image 1 based on blur adjustment button 404 can be referred to the description of method B below.
[0162] The detail view button 405 can be used to view parameters related to the image 1. For example, the parameters related to the image 1 may include one or more of the following: the name of the image 1, the sensitivity (or ISO value) of the image 1, the exposure value (EV) of the image 1, the F value of the image 1, the size of the image 1, the storage size of the image 1, or the shooting mode of the image 1.
[0163] The options bar 407 may display, from left to right, the following buttons: a share button, a favorite button, an edit button 408 , a delete button, and more buttons.
[0164] The Share button can be used to share Image 1 to other applications, the Favorite button can be used to favorite Image 1 in the Gallery application, the Delete button can be used to delete Image 1 in the Gallery application, and the More button can be used to implement more setting functions for Image 1.
[0165] The edit button 408 can be used to crop, adjust the image, adjust the filter, add graffiti, add blur effect, etc. The specific process of adding blur effect to the image 1 based on the edit button 408 can be seen in the description of the following method A.
[0166] In the embodiment of the present application, the electronic device can also Figure 4B The blur adjustment button 404 in the image 1 is used to adjust the blur of the image 1 (see the description of method A). Alternatively, the electronic device can Figure 4B Click the edit button 408 in the image to add a blur effect to the image 1 (see the description of method B).
[0167] Method A: Use the blur adjustment button 404 to adjust the blur of image 1 ( Figure 4C - Figure I)
[0168] In response to user Figure 4B By clicking the blur adjustment button 404, the electronic device can read the shooting parameters corresponding to image 1, and obtain the blurred image through the shooting parameters corresponding to image 0, and then Figure 4C The interface shown displays the image after blurring (such as image 2).
[0169] It is understandable that the electronic device can obtain focus position information 1 from the shooting parameters corresponding to image 1. When it is determined that focus position information 1 is within focus position range 1 and focus position range 1 corresponds to plane 1, the electronic device can blur objects in other planes in image 0 except plane 1.
[0170] For example, the electronic device uses aperture information 1 and depth image 1 to blur object 2 in plane 2 and object 3 in plane 3 to obtain a blurred image (such as image 2).
[0171] Figure 4C It can be called a virtual editing interface, which can display: an exit button 421, a save button 422, a preview window 400, prompt information 425, and a slide bar 424.
[0172] The exit button 421 can be used to exit the virtual editing interface. For example, in response to the user clicking the exit button 421, the electronic device can display the following Figure 4B The interface shown.
[0173] The preview window 400 may display: a preview image and a focus frame (or focus frame) 423 . Figure 4C The blur effect of the preview image is the same as Figure 4B The blur effect of image 1 is the same as that of the previous one. The blur effect of image 1 can be found in Figure 1A Description in .
[0174] The preview image in the preview window 400 may be: compressed image 2. The compressed image 2 may be an image obtained by blurring and compressing image 0. The method for obtaining image 0 and compressed image 2 may refer to Figure 6 The description in , will not be repeated here.
[0175] Focus frame 423 can be used to define the focus position. Focus frame 423 can be displayed by default at the focus position of the preview image. The focus position of the preview image can be the same as the focus position of Image 1, which can be determined when Image 1 was captured. It can be understood that because focus position information 1 is within focus position range 1, and focus position range 1 corresponds to plane 1, focus frame 423 is displayed at object 1 (i.e., a person) in plane 1.
[0176] Optional, Figure 4C The focus frame 423 may not be displayed in the preview window 400. In response to a user's click operation on any position in the preview window 400, the electronic device may display a focus frame at the click operation position.
[0177] Prompt message 425 can be used to prompt the user to allow an operation to be performed, such as prompting the user to select the focus position by clicking, and prompting the user to adjust the blur effect by sliding. For example, prompt message 425 can be displayed as: click to refocus, slide to adjust the blur effect. The content displayed in prompt message 425 is for reference only.
[0178] Each sliding position in the slider 424 may correspond to an F-value. The slider 424 includes a selected position, which may be represented by a thickened line or an elongated line. The selected position may overlap with any sliding position in the slider 424. The electronic device may identify the F-value corresponding to the selected position and adjust the image blur based on the F-value.
[0179] like Figure 4C In the slide bar 424, when the selected position overlaps with the slide position 426, F2.4 may be displayed on the upper side of the slide bar 424. At this time, it can be determined that the F value of the preview image in the preview window 400 is F2.4.
[0180] It is understood that the slider 424 can adjust the F value from F1.2 to F16. For example, the slider 424 can set the F value to F1.2, F1.4, F1.6, F1.8, F2, F3.5, F5.6, F10, F13, or F16, etc., which is not limited in the embodiments of the present application.
[0181] Electronic devices can be Figure 4C Functions such as adjusting the focus position and F value can be realized in it.
[0182] In one implementation, in response to a user Figure 4C The electronic device may display the following: Figure 4D The interface shown.
[0183] like Figure 4D In the case where the selected position of the slide bar 430 overlaps with the sliding position 427, F16 may be displayed on the upper side of the slide bar 430. At this time, the preview image in the preview window 400 may be an image obtained by blurring adjustment based on F16, that is, the preview image does not have a blurred portion.
[0184] It is understandable that when the F value is set to 16, the aperture is smaller, the depth of field is larger, and more parts of the entire picture will become clear. Therefore, the blur effect will be weakened or disappear, making it difficult for users to see the blur effect.
[0185] It is understandable that since the focus position does not change at this time, compared with Figure 4C , Figure 4D The position of the middle focus frame 423 remains unchanged.
[0186] In another implementation, in response to the user Figure 4C In the preview window 400, a click operation is performed on the building (such as object 3) or a drag operation is performed to move the focus frame 423 to the building (such as object 3). The electronic device can obtain the focus position information 2 and blur the image 0 according to the focus position information 2 and the shooting parameters corresponding to the image 1 to obtain the blurred image. Figure 4E The interface shown displays the image after blurring (such as image 3).
[0187] It is understandable that the electronic device can determine focus position information 2 based on the location of the click operation or drag operation, and focus position information 2 is different from focus position information 1. When the electronic device determines, based on the shooting parameters corresponding to image 1, that focus position information 2 is within focus position range 3, and focus position range 3 corresponds to plane 3, the electronic device can blur objects in planes other than plane 3 in image 0.
[0188] For example, the electronic device performs the blurring processing on the object 2 in the plane 2 and the object 1 in the plane 1 by using the aperture information 1 and the depth image 1, and obtains the image after the blurring processing (such as the image 3).
[0189] As shown in Figure 4E , the focus frame 432 can frame the building in the preview window 400. It can be understood that, since the focus position information 2 is in the focus position range 3, and the focus position range 3 corresponds to the plane 3, the focus frame 432 is displayed at the object 3 (i.e., the building) in the plane 3.
[0190] At this time, the preview image in the preview window 400 can be an image obtained by re-blurring the preview image based on the focus position in the focus frame 432. For example, in the preview image, since the focus position is at the building, the building region where the building is located is in a clear state, and the portrait region and the grass region are in a blurred state.
[0191] Optionally, the electronic device can also perform different degrees of blurring processing on different regions, that is, the blurring degree of the grass region in the preview image is greater than that of the portrait region. That is, the farther the object is from the focus position, the more blurred the object is.
[0192] It can be understood that, referring to Figure 4C , the preview image in the preview window 400 and Figure 4E , the focus frame is moved from the portrait region to the building region, so that the clear range of the image is switched from the portrait region to the building region. For example, in Figure 4C , the portrait region is in a clear state, and the building region and the grass region are in a blurred state, and the blurring degrees of the building region and the grass region can be different or the same; in Figure 4E , the building region is in a clear state, and the portrait region and the grass region are in a blurred state, and the blurring degrees of the portrait region and the grass region can be different.
[0193] It can be understood that, since the F value does not change at this time, the sliding bar 424 in Figure 4C , Figure 4E does not change.
[0194] Optionally, in response to the operation of the user clicking the exit button 421 in Figure 4D or Figure 4E , the electronic device can display an interface as shown in Figure 4F . Figure 4F In , the prompt box 428 can be displayed, and the prompt box 428 can include: prompt information for prompting whether to abandon the current modification, a cancel button, an abandon button, and the like.
[0195] For example, in response to the user clicking the cancel button in the prompt box 428, the electronic device may keep Figure 4D or Figure 4E Alternatively, in response to the user clicking the button in the prompt box 428 to give up, the electronic device may display a display such as Figure 4B The interface shown.
[0196] Optionally, in response to the user Figure 4D or Figure 4E When the save button 422 is clicked, the electronic device may display the following Figure 4G The interface shown, and Figure 4H The interface shown.
[0197] Figure 4G The prompt box 429 may be displayed, and the prompt box 429 may include a prompt message for prompting that the picture is being saved.
[0198] Figure 4H The following can be displayed: The image after blur adjustment (such as image 5). For other contents displayed in this interface, please refer to Figure 4B The description in , will not be repeated here.
[0199] Based on this, users can Figures 4A-4H The operations described in
[15] enable flexible adjustment of the focus position and F-value after shooting. Furthermore, during the focus position adjustment process, in response to a user click operation at any position, the electronic device can obtain the focus position corresponding to the click operation, determine the target plane in the image where the focus position is located, and then perform blurring processing on areas of the image other than the target plane.
[0200] Method B: Use the edit button 408 to add a blur effect to image 1 ( Figure 4I-4K )
[0201] In response to user Figure 4B By clicking the edit button 408, the electronic device can read the pixel information of the photographed object and the plane information where any photographed object is located from the photographing parameters corresponding to the image 1, and obtain the image 1 based on the pixel information of the photographed object and the plane information where any photographed object is located, so that the image 1 can be displayed on the screen. Figure 4I The pixel information of the photographed object and the plane information where any photographed object is located can be found in Figure 4A The corresponding description.
[0202] Figure 4I The image 1 and the option bar 409 may be displayed. The option bar 409 may include a crop button 410, a filter button, a picture adjustment button, and a blur button 411.
[0203] The crop button 410 can be used to crop the image 1. When the crop button 410 is in a selected state, Figure 4I A plurality of buttons may be displayed between the middle option bar 409 and the image 1 , and any button may correspond to a preset cropping ratio.
[0204] The filter button can be used to add filter effects to Image 1.
[0205] The picture adjustment button can be used to adjust the picture parameters of the image 1. For example, the picture parameters may include one or more of the following: brightness, contrast, saturation, sharpness, or color temperature.
[0206] The blur button 411 can be used to add a blur effect to the image 1 .
[0207] In response to user Figure 4I When the blur button 411 is clicked, the electronic device displays Figure 4J The interface shown in the figure is as follows. Figure 4J As shown, when the blur button 411 is in a selected state, the blur button 411 and the middle of the image 1 may display: an original image button 412 , a circular button 413 , a linear button 414 , a blur button 415 , and a slide bar 416 .
[0208] The original image button 412 can be used to view the original image. For example, when the electronic device adds a blur effect to the image 1 based on the blur button 411, the image 1 can be the "original image" at this time.
[0209] The circular button 413 can be used to set the blurring boundary to a circle. When the blurring boundary is a circle, the electronic device can add a blurring effect to the area outside the circle and retain the clarity of the area inside the circle.
[0210] The blur boundary can be understood as the boundary between the clear area and the blurred area during the blurring process. The blur boundary can be circular or rectangular.
[0211] The linear button 414 can be used to set the blur boundary to a rectangle. For example, when the blur boundary is a rectangle, the electronic device can add a blur effect to the area outside the rectangle and retain the clarity of the area inside the rectangle.
[0212] The width of the rectangle may be the same as the width of the image 1, and the height of the rectangle may be formed by the distance between two parallel lines. It is understood that the size of the rectangle may be pre-set by the electronic device.
[0213] The blur button 415 may be used to add a blur effect to the entire area of the image 1 .
[0214] The sliding bar 416 can be used to set the degree of blurring. For example, in the case that the circular button 413 is in the selected state, the user can set the degree of blurring of the area outside the circular outer part through the sliding bar 416; or in the case that the linear button 414 is in the selected state, the user can set the degree of blurring of the area outside the rectangular outer part through the sliding bar 416, and so on.
[0215] In response to the click operation of the user on the circular button 413, the electronic device can display an interface as shown in FIG. 4D. Figure 4K
[0216] In the preview window 435 in FIG. 4D, the electronic device can retain the clarity in the circular area 436 based on the image obtained by performing the blurring processing on the area outside the circular area 436 in the image 1. Figure 4K
[0217] It can be understood that the circular area 436 can include part of the object 2 and part of the object 3.
[0218] Figure 4K In the case that the circular button 413 is in the selected state, the electronic device can display the word “50” in the circular button 413. The 50 can be understood as that the electronic device sets the degree of blurring to 50%, and at this time, the selected mark in the sliding bar is in the central position.
[0219] In the process that the user adds the blurring effect to the image 1 based on the interface shown in FIG. 4D, the electronic device can add the blurring effect to the image 1 by covering the mask on the image 1 and controlling the area of the image 1 covered by the mask through the blurring boundary. The mask can be the image obtained by performing the blurring processing on the image 1.
[0220] It can be understood that in the case that the blurring boundary is circular in the manner B, in response to the click operation of the user on any position in the image 1, the electronic device can obtain the position 1 where the click operation is located, retain the clarity in the circular area centered at the position 1, and perform the blurring processing on the area outside the circular area. At this time, since the electronic device only reads the pixel information of the photographed object and the plane information where any photographed object is located from the photographing parameters corresponding to the image 1, and does not read the focal position information of the image 1. Therefore, in the case that the user selects the circular button 413, in response to the operation of the user clicking the object 2, the electronic device implements the image blurring processing based on a smaller amount of data, which can reduce the calculation amount and save the system overhead.
[0221] In order to clearly describe the specific implementation process in the image processing method, the image processing method is schematically described below in combination with the corresponding embodiments. Figures 4A-4K Figure 5-10 In order to clearly describe the specific implementation process in the image processing method, the image processing method is schematically described below in combination with the corresponding embodiments.
[0222] It is understandable that electronic devices can be based on Figure 5-Figure 6 The corresponding embodiment realizes Figure 4C Initialization of . Based on Figure 7-Figure 8 The corresponding embodiment is Figure 4C The focus position information update and / or aperture information update are realized in Figure 9-10 The corresponding embodiment realizes the preservation of the blurred edited image (such as image 5).
[0223] Figure 5 This is a flow chart of an image processing method provided in an embodiment of the present application. Figure 5 As shown, the image processing method may include the following steps:
[0224] S501 : In response to a user clicking a blur adjustment button, the gallery application reads image 1 and shooting parameters corresponding to image 1 .
[0225] Image 1 may be an image obtained by processing an original image based on an image processing process corresponding to the portrait mode.
[0226] The shooting parameters corresponding to image 1 may include: image 0, focus position information 1, and aperture information 1. Specifically, image 0 may include: the shooting parameters corresponding to image 0. That is, the shooting parameters corresponding to image 0 may also include: the shooting parameters of object 1, the shooting parameters of object 2, and the shooting parameters of object 3.
[0227] The shooting parameters of the object 1 may include: pixel information of the object 1, a plane 1 corresponding to the object 1, a focus position range 1 corresponding to the plane 1, and a depth 1 corresponding to the plane 1.
[0228] The shooting parameters of the object 2 may include: pixel information of the object 2 , a plane 2 corresponding to the object 2 , a focus position range 2 corresponding to the plane 2 , and a depth 2 corresponding to the plane 2 .
[0229] The shooting parameters of the object 3 may include: pixel information of the object 3 , a plane 3 corresponding to the object 3 , a focus position range 3 corresponding to the plane 3 , and a depth 3 corresponding to the plane 3 .
[0230] Among them, depth 1, depth 2 and depth 3 can constitute depth image 1. The content contained in any parameter can be seen in Figure 4A The description in , will not be repeated here.
[0231] The meaning of image 1 and the contents included in the shooting parameters corresponding to image 1 can be found in the description in S601.
[0232] S502 : The gallery application converts the format of image 0 from JPEG to YUV.
[0233] Image 0 can be an image obtained after format conversion of an original image.
[0234] For example, image 0 can be an image obtained after converting an original image in RAW format into a joint photographic experts group (JPEG) format.
[0235] The process in which the gallery application converts the format of image 0 from JPEG to YUV can be referred to the description in S610.
[0236] S503, the gallery application performs data verification 1.
[0237] The process in which the gallery application performs data verification 1 based on the shooting parameter corresponding to image 1 and the format of image 0 (YUV) can be referred to the description in S610.
[0238] When the gallery application determines that data verification 1 passes, the gallery application can send request 1 to the camera algorithm library, so that the camera algorithm library performs the steps shown in S504 in response to request 1; or, when the gallery application determines that data verification 1 fails, the subsequent steps can be ended. The content contained in request 1 can be referred to the description in S511.
[0239] S504, the camera algorithm library performs image blurring processing.
[0240] For example, in response to request 1, the camera algorithm library can perform blurring processing on image 0 to obtain image 2 (in YUV format), and return image 2 (in YUV format) to the gallery application.
[0241] S505, the gallery application performs data verification 2.
[0242] The process in which the gallery application performs data verification based on image 2 (in YUV format) can be referred to the description in S615.
[0243] When the gallery application determines that data verification 2 passes, the gallery application can perform S506; or, when the gallery application determines that data verification 2 fails, the gallery application can display prompt information 1 through the display. The content contained in prompt information 1 can be referred to the description in S615.
[0244] S506, the gallery application performs image compression and focal point coordinate conversion.
[0245] For example, the process in which the gallery application performs image compression on image 2 and converts focal point position information 1 into focal point position information 2 can be referred to the description in S616.
[0246] Based on the description in S615, Figure 5 Figure 6 This is a schematic diagram of module interaction of an image processing method provided in an embodiment of the present application. Figure 6 As shown, the electronic device may include: a camera application, a gallery application, a media middle platform and a camera algorithm library. The gallery application may include: a large image preview module and a blur editing module. The meaning of any module can be found in Figure 3 The description in , will not be repeated here.
[0247] Understandably, Figure 6 In the corresponding embodiment, the shooting mode is portrait mode as an example for illustration. When the shooting mode is large aperture mode, the image processing method in large aperture mode is the same as that in Figure 6 The description is similar to that in the previous section and will not be repeated here.
[0248] S601 - S604 may be an illustration of a process in which, in response to a user clicking a photo button in the portrait mode, the electronic device collects and stores an image 1 and shooting parameters corresponding to the image 1 .
[0249] like Figure 6 As shown, the image processing method may include the following steps:
[0250] S601 : In response to a user clicking a photo button in a portrait mode, a camera application obtains image 1 and shooting parameters corresponding to image 1 .
[0251] Image 1 may be an image obtained by processing an original image based on an image processing process corresponding to the portrait mode.
[0252] The image processing process corresponding to the portrait mode may include one or more of the following: skin beautification processing, hair optimization processing, spot processing, color correction processing, vignetting processing, or blur processing, etc. The color correction processing may include: color correction processing based on a 3D look-up table (3D LUT).
[0253] The original image (also called RAW image) can be an image captured by a camera and not processed or compressed. The image format of the original image can be RAW.
[0254] The shooting parameters corresponding to image 1 may be generated synchronously when image 1 is captured. For example, the shooting parameters corresponding to image 1 may include one or more of the following: focus position information 1, aperture information 1, image 0, or depth image 1.
[0255] The focus position information can be understood as two-dimensional coordinates that can indicate the focus position, that is, the focus position corresponding coordinates.
[0256] For example, in response to the user Figure 1AFor a click operation on any area in the preview window 101, the electronic device can determine the location of the click operation as the focus location; or, the electronic device can automatically detect the photographed object in the preview window 101 and determine the location of the photographed object (or the face of the photographed object) as the focus location. The embodiment of the present application does not limit the method for obtaining the focus location.
[0257] The aperture information can be understood as information that can indicate the aperture size, that is, the F value.
[0258] For example, in electronic devices based on Figure 1B When the F value is set to F4 by the slider 112, the aperture information 1 may be F4. Alternatively, when the user does not adjust the F value, the electronic device may automatically generate the aperture information 1 based on the subject. The embodiment of the present application does not limit the method for obtaining the aperture information.
[0259] The depth image 1 includes the depth information of any pixel in the image 1 .
[0260] Exemplarily, S601 may include: in response to the user clicking the photo button in portrait mode, the camera application obtains the portrait mode identifier, generates shooting parameters corresponding to image 1, and instructs the camera to obtain the original image; then the camera application can send the original image, the portrait mode identifier, and the shooting parameters corresponding to image 1 to the camera algorithm library; the camera algorithm library determines the image processing process corresponding to the portrait mode based on the portrait mode identifier, processes the original image through the image processing process corresponding to the portrait mode and the shooting parameters corresponding to image 1 to obtain image 1, and the camera algorithm library returns image 1 to the camera application.
[0261] Optionally, the shooting parameters corresponding to the image 1 may further include: high dynamic range (HDR) information and / or watermark information, etc.
[0262] S602 : The camera application displays image 1 on the display.
[0263] S603 : The camera application sends the image 1 and the shooting parameters corresponding to the image 1 to the gallery application.
[0264] Suitably, the gallery application can receive the image 1 and the shooting parameters corresponding to the image 1 .
[0265] S604 : The gallery application stores the image 1 and the shooting parameters corresponding to the image 1 .
[0266] For example, the gallery application may include a storage module, and the gallery application may store the image 1 and the shooting parameters corresponding to the image 1 in the storage module.
[0267] S605 - S609 may be an illustration of a process in which the electronic device determines whether to display a blur adjustment button in response to the user viewing a large image of Image 1 in a gallery application.
[0268] S605 : In response to the user viewing a large image of the image 1 in the gallery application, the large image preview module obtains an identifier of the image 1 , and obtains the image 1 and shooting parameters corresponding to the image 1 according to the identifier of the image 1 .
[0269] The user's operation of viewing the large image of image 1 in the gallery application may include: the user's Figure 4A A click operation on the thumbnail 402 in the image.
[0270] Optionally, after S605, the gallery application may perform a system configuration item verification and, if the system configuration item verification passes, execute the step shown in S606. For example, the gallery application may call a related method to obtain the system configuration item of the mobile phone. If the gallery application detects that the system configuration item includes information (or an identifier) indicating that the device supports blurring, the gallery application may determine that the system configuration item verification passes.
[0271] Alternatively, when the gallery application detects that the system configuration item does not contain information (or identification) indicating that the device supports blurring capability, the gallery application may determine that the system configuration item verification has failed. At this time, the gallery application may call the module that controls the display of the interface. Figure 4B Prompt message 3 is displayed, and prompt message 3 can be used to prompt that the image does not support blur editing.
[0272] In this way, the gallery application can verify whether the underlying capabilities of the device support image blur processing through system configuration items, thereby improving the security of subsequent blur editing.
[0273] S606: The large image preview module determines whether to generate a blur adjustment button.
[0274] For example, when the large image preview module detects the focus position information and aperture information in the shooting parameters corresponding to image 1, execute the step shown in S608; or, when the large image preview module does not detect the focus position information and / or aperture information, execute the step shown in S607.
[0275] It can be understood that since Image 1 is an image captured by an electronic device in portrait mode (or large aperture mode), the shooting parameters corresponding to Image 1 include focus position information 1 and aperture information 1. Therefore, the large image preview module can generate a blur adjustment button upon detecting focus position information 1 and aperture information 1. Alternatively, when the electronic device captures Image 6 in night scene mode, the shooting parameters corresponding to Image 6 may not include focus position information and / or aperture information. Therefore, the large image preview module cannot generate a blur adjustment button based on the shooting parameters corresponding to Image 6.
[0276] In S606, the large image preview module can call the init() method to Figure 4B Initialize the buttons in Figure 4B During the process of initializing the buttons in the image preview module, the large image preview module can implement the step of determining whether to generate a blur adjustment button.
[0277] S607: The large image preview module does not generate a blur adjustment button.
[0278] S608: The large image preview module generates a blur adjustment button.
[0279] The blur adjustment button can be Figure 4B Blur adjustment button 404 in.
[0280] S609 , the large image preview module displays the image 1 and the blur adjustment button on the display screen.
[0281] For example, after S608, the electronic device may Figure 4B Image 1 and blur adjustment button 404 are displayed.
[0282] S610 - S617 may be an indication that in response to the user clicking the blur adjustment button, the electronic device blurs the image 0 and then displays the compressed image 2 .
[0283] S610 : In response to the user clicking the blur adjustment button, the blur editing module reads the shooting parameters corresponding to the image 1 and converts the format of the image 0 from JPEG to YUV.
[0284] In YUV, Y represents brightness information, and U and V represent chrominance information.
[0285] For example, the blur editing module can implement the steps of reading the shooting parameters corresponding to image 1 and converting the format of image 0 from JPEG to YUV through the parseFile() method.
[0286] It can be understood based on the description in S605 that since images in YUV format occupy less storage space, the electronic device can save resources when performing subsequent image processing on Image 0 by converting the format of Image 0 from JPEG to YUV.
[0287] It should be noted that during the execution of S610, the blur editing module may convert the format of Image 0 from YUV to a bitmap to obtain the size of Image 0. It is understood that when Image 0 is in YUV format, the electronic device cannot determine the size of Image 0. Therefore, the size of Image 0 may be determined by converting the format of Image 0 to a bitmap, so that the image can be subsequently compressed based on the size of Image 0. The step of converting the format of Image 0 from YUV to a bitmap may also be implemented by calling the parseFile() method.
[0288] Optionally, after the blur editing module reads the shooting parameters corresponding to the image 1, the blur editing module can perform data verification and system configuration item verification, and display the following after the data verification and system configuration item verification are completed: Figure 4C Alternatively, when the virtual editing module determines that the data verification fails and / or the system configuration item verification fails, the virtual editing module can call the module displayed on the control interface to Figure 4C Prompt message 2 is displayed, and prompt message 2 can be used to prompt data parsing failure.
[0289] For example, during data verification, the blur editing module may determine that data verification has passed if it determines that the read data (such as the shooting parameters corresponding to image 1) is not empty and that the format conversion from JPEG to YUV of image 0 is successful. Alternatively, the blur editing module may determine that data verification has failed if it determines that the read data (such as the shooting parameters corresponding to image 1) is empty or that the format conversion from JPEG to YUV of image 0 fails.
[0290] The specific implementation of the system configuration item verification can be found in the description of S605 and will not be repeated here.
[0291] Optionally, the blur editing module can also implement the step of reading watermark information by calling loadWaterMarkInfo().
[0292] Optionally, after S610 , the blur editing module may store image 0 (in YUV format) in a storage module of the camera application for subsequent use.
[0293] S611. The blur editing module sends a request 1 (image 0 (YUV format), focus position information 1, aperture information 1, and depth image 1) to the media middle station.
[0294] It can be understood that request 1 may include: image 0 (YUV format), focus position information 1, aperture information 1 and depth image 1.
[0295] For example, the blur editing module can send request 1 to WideAperturePhotoUtil by calling sendProcessRequest(). Among them, WideAperturePhotoUtil can contain the methods that the media center needs to call, that is, WideAperturePhotoUtil can implement the steps of message receiving and message sending that the media center needs to perform.
[0296] Optionally, the request 1 may further include a message 1 indicating that the data verification has passed. In this way, the camera algorithm library does not need to perform an additional data verification process when the message 1 is detected, thus saving algorithm flow.
[0297] S612. The media middle platform sends request 1 (image 0 (YUV format), focus position information 1, aperture information 1, and depth image 1) to the camera algorithm library.
[0298] For example, WideAperturePhotoUtil can send request 1 to the camera algorithm library by calling sendProcessRequest().
[0299] S613 . In response to request 1 , the camera algorithm library performs blurring processing on image 0 based on image 0 (YUV format), focus position information 1 , aperture information 1 , and depth image 1 to obtain image 2 .
[0300] For example, upon detecting image 0 (in YUV format), focus position information 1, aperture information 1, and depth image 1 in request 1, the camera algorithm library may perform defocusing processing on image 0 based on the focus position information 1, aperture information 1, and depth image 1 to obtain image 2. Image 2 may be in YUV format. A defocusing processing algorithm may be preset in the camera algorithm library. The camera algorithm library may input the focus position information 1, aperture information 1, depth image 1, and image 0 into the defocusing processing algorithm, and the defocusing processing algorithm may output the defocused image 2.
[0301] Optionally, the camera algorithm library can also perform image processing processes on image 0, such as 3DLUT processing and vignetting processing.
[0302] Optionally, the image 0 can carry information 1 indicating to turn on the beautifying function. In the case that the image 0 carries the information 1, the camera algorithm library can continue to perform the beautifying process on the image 0 based on the information 1. In this way, when the user turns on the beautifying function in the portrait mode, the electronic device can also perform the beautifying algorithm on the image 0 in the camera algorithm library to ensure the consistency of the image effect.
[0303] S614, the camera algorithm library sends the image 2 (YUV format) to the media station.
[0304] S615, the media station sends the image 2 (YUV format) to the blur editing module.
[0305] For example, WideAperturePhotoUtil can return the image 2 (YUV format) to the blur editing module by calling the callback() method.
[0306] Optionally, after S615, the blur editing module can perform data verification on the image 2 (YUV format), and perform the steps shown in S616 when the data verification is passed.
[0307] For example, the data verification process can include: the blur editing module determines that the data verification is passed when it detects that the data (i.e. image 2) received from the media station is not empty. Alternatively, the blur editing module can determine that the data verification is not passed when it detects that the data (i.e. image 2) received from the media station is empty, at which time the blur editing module can call the module that displays the control interface to make the interface display prompt information 1, which can be used to prompt the user interface to be abnormal.
[0308] In this way, the electronic device can increase the security of the data through data verification and reduce the algorithm exception caused by empty data.
[0309] S616, the blur editing module performs compression processing on the image 2 according to the compression ratio to obtain the compressed image 2, and converts the focus position information 1 of the image 2 to the focus position information 2.
[0310] The compression ratio can be a pre-set ratio.
[0311] For example, in the case that the compression ratio is 39.5% and the size of the image 2 is 3648x2736, the blur editing module can determine that the size of the compressed image 2 is about 1440x1080 by multiplying the size of the image 2 by the compression ratio. In this way, the electronic device can save resource occupation in the subsequent algorithm processing process by compressing the image 2. For example, the blur editing module can perform compression processing on the image 2 by calling onInitSuccess().
[0312] The image position information 2 can be obtained by processing the focal point position information 1 based on the compression ratio.
[0313] For example, in the case that the compression ratio is 39.5% and the focal point position information 1 is (2400, 1200), the blurring editing module can obtain the focal point position information 2 as (948, 474) by multiplying the value of each coordinate axis in the focal point position information 1 by the compression ratio respectively.
[0314] Optionally, the compression ratio can be related to the chip type of the electronic device and / or the image ratio of the image 2, see the description of the following mode 1-mode 3.
[0315] Mode 1: The compression ratio can be related to the chip type of the electronic device.
[0316] In this scenario, the blurring editing module can pre-store the corresponding relationship between the compression ratio and the chip type, as shown in Table 1.
[0317] Table 1: Corresponding relationship between compression ratio and chip type
[0318] Chip type Compression ratio Chip Type 1 Ratio 1 (e.g. 39.5%) Chip Type 2 Ratio 2 (e.g. 35%) Chip Type N Ratio N
[0319] N is an integer greater than 1.
[0320] In this way, the electronic device can pre-configure a suitable compression ratio according to the attribute of the chip type, so as to realize the effect of improving the data processing capability by suitable compression processing.
[0321] Mode 2: The compression ratio can be related to the image ratio of the image 2 (or the image ratio of the image 0).
[0322] It can be understood that before the image 2 is compressed, the image size of the image 2 is the same as the image size of the image 0, and the image ratio of the image 2 is the same as the image ratio of the image 0, and the image ratio of the image 0 can be the information carried by the image 0 itself when the blurring processing module receives the image 0.
[0323] In this scenario, the blurring editing module can pre-store the corresponding relationship between the compression ratio and the image ratio, as shown in Table 2.
[0324] Table 2: Corresponding relationship between compression ratio and image ratio type
[0325] Image ratio Compression ratio 4:3 39.5% 1:1 39.5% 3:2 65.2% 16:9 52.6% 5:4 39.5%
[0326] For example, if the size of image 2 is 3648×2736, the blur processing module can calculate that the image ratio is approximately 4:3, and then determine the compression ratio to be 39.5% according to Table 2. The blur editing module can multiply the size of image 2 by the compression ratio to determine that the size of image 2 after compression is approximately 1440×1080.
[0327] Similarly, when the size of image 2 is 2736×2736 (the image ratio is approximately 1:1), the size of image 2 after compression can be approximately 1080×1080. When the size of image 2 is 3648×1656 (the image ratio is approximately 3:2), the size of image 2 after compression can be approximately 2384×1080. When the size of image 2 is 3648×2052 (the image ratio is approximately 16:9), the size of image 2 after compression can be approximately 1920×1080. When the size of image 2 is 3420×2736 (the image ratio is approximately 5:4), the size of image 2 after compression can be approximately 1350×1080.
[0328] In this way, the electronic device can pre-configure a suitable compression ratio according to the image ratio, so as to achieve the effect of improving data processing capability through suitable compression processing.
[0329] Method 3: The compression ratio may be related to the image ratio of the image 2 and the chip type.
[0330] In this scenario, the blur editing module may pre-store the corresponding relationship between the compression ratio, chip type, and image ratio, as shown in Table 3.
[0331] Table 3 Schematic diagram of the correspondence between compression ratio, chip type and image ratio type
[0332]
[0333] For example, if the size of Image 2 is 3648×1684 and the device's chip type is chip type 2, the blur processing module can calculate that the image ratio of Image 2 is approximately 3:2, and then determine the compression ratio to be 65.6% based on Table 3. The blur editing module can multiply the size of Image 2 by the compression ratio to determine that the size of Image 2 after compression is approximately 1920×1080.
[0334] In this way, the electronic device can pre-configure a suitable compression ratio according to the image ratio and chip type, so as to achieve the effect of improving data processing capability through suitable compression processing.
[0335] It should be noted that the chip types, image ratios, and compression ratios provided in Tables 1 to 3 are merely examples and do not constitute a limitation on the embodiments of the present application.
[0336] Optionally, the gallery application may pre-compress Image 0, and the size of Image 2 may be the same as that of Image 0. For example, before executing S616, the blur editing module may determine a maximum processing size related to the image ratio of Image 2 based on the image ratio, and if it determines that the size of Image 2 is larger than the maximum processing size, execute the steps shown in S616. Alternatively, if the blur editing module determines that the size of Image 2 is smaller than the maximum processing size, the step of compressing Image 2 in S616 may not be executed.
[0337] The corresponding relationship between the image ratio and the maximum processing size can be shown in Table 4.
[0338] Table 4 Schematic diagram of the correspondence between image ratio and maximum processing size
[0339]
[0340]
[0341] For example, if the size of Image 2 is 1540×1120 and the image ratio is approximately 4:3, the blur editing module can determine, based on Table 4, that the maximum processing size can be 1440×1080. Then, Image 2 is compressed. For example, Image 2 can be compressed using the compression ratio of 39.5% described in Table 2, resulting in a compressed size of approximately 608×427. Alternatively, Image 2 can be compressed to the maximum processing size, resulting in a compressed size of approximately 1440×1080.
[0342] For another example, when the size of image 2 is 1280×1025 and the image ratio is approximately 5:4, the electronic device can determine based on Table 4 that the maximum processing size can be 1350×1080. Since the size of image 2 is smaller than the maximum processing size, the blur editing module may not compress image 2.
[0343] In combination with the description of S616 , for example, the blur editing module can implement the compression processing of the image 2 by calling the onInitSuccess() method.
[0344] Optionally, after S616 , when the shooting parameters corresponding to the image 1 include watermark information, the blur editing module may also add watermark information to the compressed image 2 to ensure consistency of the image data.
[0345] S617: The blur editing module displays the compressed image 2 through the display.
[0346] For example, electronic devices can Figure 4C The compressed image 2 is displayed in the preview window 400 .
[0347] It is understandable that the electronic device can complete the process of Figure 4C Initialization of all contents in . Figure 4C In the example, the image displayed in the preview window 400 may be: compressed image 2, the focus position information framed by the focus frame 423 may be: focus position information 2, and the F value displayed in the slide bar 424 may be aperture information 1.
[0348] Based on this, the electronic device can verify whether the blur adjustment button can be generated when it detects that the user is viewing the large image of image 1 in the gallery application; in the case where the blur adjustment button is displayed, the operation of the blur adjustment button is completed in response to the user clicking the blur adjustment button. Figure 4C Initialization process, to achieve Figure 4C Normal display.
[0349] Based on Figure 5-Figure 6 The corresponding embodiment is completed Figure 4C In the case of initialization of the interface, the electronic device can be based on Figure 7-8 The corresponding embodiment realizes updating the focus position and / or updating the aperture information in the blur editing interface.
[0350] Figure 7 A flow chart of another image processing method provided in an embodiment of the present application. Figure 7 In the corresponding embodiment, the process of updating the focus position information in the blur editing interface is described as an example. Figure 7 The same is true in , so I will not repeat it here.
[0351] like Figure 7 As shown, the image processing method may include the following steps:
[0352] S701 : In response to a user operation of updating a focus position in a blur editing interface, the gallery application obtains focus position information 3 .
[0353] The blur editing interface can be Figure 4C The interface shown.
[0354] The user's operation of updating the focus position in the blur editing interface may include: the user clicking on any position in the preview window 400, or the user dragging the focus frame 423 to any position in the preview window 400, etc., which is not limited in the embodiments of the present application.
[0355] The meaning of the focus position information 3 can be found in the description in S801.
[0356] After S701, the gallery application may send a request 2 to the camera algorithm library, so that the camera algorithm library executes the steps shown in S702 in response to the request 2. For the content included in the request 2, please refer to the description in S802.
[0357] S702: The camera algorithm library performs image blur processing.
[0358] For example, in response to request 2, the camera algorithm library can re-blur the compressed image 2 to obtain image 3 (YUV format), and return image 3 (YUV format) to the gallery application.
[0359] S703: The gallery application performs data verification 3.
[0360] The process of performing data verification based on image 3 (YUV format) by the gallery application can be referred to the description in S806 .
[0361] When the gallery application determines that data verification 3 has passed, S704 may be executed; or, when the gallery application determines that data verification 3 has failed, prompt information 1 may be displayed on the display. The content of prompt information 1 may refer to the description in S615.
[0362] S704: The gallery application performs image format conversion.
[0363] For example, the gallery application may convert the format of the image 3 from YUV to a bitmap format. The image format conversion process may refer to the description in S807.
[0364] S705 , the gallery application performs data verification 4 .
[0365] The process of performing data verification by the gallery application based on image 3 (bitmap format) can be referred to the description in S807.
[0366] When the gallery application determines that data verification 7 has passed, S706 may be executed; or, when the gallery application determines that data verification 3 has failed, prompt information 1 may be displayed on the display.
[0367] S706 : The gallery application displays the image 3 on the display.
[0368] For example, the process of the gallery application displaying the image 3 through the display may refer to the description in S808 .
[0369] based on Figure 7 Description in Figure 8A schematic diagram of module interaction of another image processing method provided in an embodiment of the present application.
[0370] like Figure 8 As shown, the electronic device may include: a gallery application, a media middle platform and a camera algorithm library. The gallery application may include: a blur editing module. The meaning of any module can be found in Figure 3 The description in , will not be repeated here.
[0371] exist Figure 8 In the corresponding embodiment, S801-S808 may be a schematic diagram of the process when the electronic device receives a user's request to update the focus position in the blur editing interface; S809-S815 may be a schematic diagram of the process when the electronic device receives a user's request to update the aperture information in the blur editing interface.
[0372] like Figure 8 As shown, the image processing method may include the following steps:
[0373] S801: In response to a user operation of updating a focus position in a blur editing interface, the blur editing module obtains focus position information 3.
[0374] The blur editing interface can be Figure 4C The interface shown. Figure 4C The preview window 400 may display the compressed image 2 and a focus frame 423 , in which the focus position information 2 may be framed.
[0375] The user's operation of updating the focus position in the blur editing interface may include: the user clicking on any position in the preview window 400, or the user dragging the focus frame 423 to any position in the preview window 400, etc., which is not limited in the embodiments of the present application.
[0376] For example, in response to a user clicking any position in the preview window 400, the blur editing module may determine the position of the click operation as the focus position information 3. Alternatively, in response to a user dragging the focus frame 423 to any position in the preview window 400, the electronic device may determine the position where the drag operation ends as the focus position information 3. The embodiment of the present application does not limit the method for obtaining the focus position information 3.
[0377] Specifically, in response to a user click operation on any position in the preview window 400, the blur editing module can obtain the position of the click operation, i.e., position 1 (x1, y1), where position 1 can be the position of the click operation relative to the display screen. Since the size of an image is generally smaller than the size of the display screen, the blur editing module can calculate the position of the click operation relative to the image, i.e., position 2 (x1*2 / 3, y1*2 / 3), when determining that the ratio between the size of the image and the size of the display screen is 2 / 3. Furthermore, when the blur editing module detects that the compression ratio of the image is 1 / 2, position 3 (x1*1 / 3, y1*1 / 3) is calculated, where position 3 can be focus position information 3. The compression ratio of the image can be determined based on S616.
[0378] It is understandable that the blur editing module can execute the steps shown in S802 when it detects that the focus position information 3 is different from the focus position information 2; or, the blur editing module can not execute any steps when it detects that the focus position information 3 is the same as the focus position information 2.
[0379] S802. The blur editing module sends a request 2 (compressed image 2, focus position information 3, aperture information 1, and depth image 1) to the media middle station.
[0380] For example, request 2 may include focus position information 3, aperture information 1, depth image 1, and compressed image 2. For example, the blur editing module may send request 2 to WideAperturePhotoUtil by calling the refocusProcess() method.
[0381] Optionally, request 2 may also include: focus position information 3, aperture information 1, depth image 1, and image 0, so that the camera algorithm library blurs image 0 based on the focus position information 3, aperture information 1, and depth image 1 to obtain image 3.
[0382] S803. The media center sends request 2 (compressed image 2, focus position information 3, aperture information 1, and depth image 1) to the camera algorithm library.
[0383] For example, WideAperturePhotoUtil can send request 2 to the camera algorithm library by calling the sendProcessRequest() method.
[0384] S804 , in response to request 2 , the camera algorithm library re-blurs the compressed image 2 based on the focus position information 3 , the aperture information 1 , and the depth image 1 to obtain image 3 .
[0385] It is understandable that in response to request 2, the camera algorithm library can determine the layer where the focus position 3 is located in the depth image 1 through the focus position information 3 and the depth image 1. For example, when the focus information 3 is located at the target layer 1 (such as the layer where the building is located) in the depth image 1, the electronic device can blur the layers other than the target layer 1 based on the aperture information 1 to obtain image 3.
[0386] The format of the image 3 may be YUV, and the size of the image 3 is the same as the size of the compressed image 2.
[0387] After S804 , the camera algorithm library may store image 3 (YUV format) for subsequent algorithm calls. Image 3 (YUV format) may be associated with focus position information 3 , aperture information 1 , and depth image 1 .
[0388] S805. The camera algorithm library sends image 3 (YUV format) to the media center.
[0389] S806. The media center sends image 3 (YUV format) to the blur editing module.
[0390] For example, WideAperturePhotoUtil may return image 3 (in YUV format) to the blur editing module by calling the callback() method.
[0391] Optionally, after S806 , the blur editing module may perform data verification on the image 3 (YUV format), and execute the step shown in S807 if the data verification passes.
[0392] For example, the data verification process may include: when the defocused editing module detects that the data received from the media center (i.e., image 3) is not empty, it determines that the data verification has passed. Alternatively, when the defocused editing module detects that the data received from the media center (i.e., image 3) is empty, it determines that the data verification has failed. At this time, the defocused editing module can call the module that controls the display of the interface so that prompt information 1 can be displayed in the interface. The function of prompt information 1 can be described in S616. In this way, the electronic device can increase the security of the data through data verification and reduce the algorithm anomalies caused by empty data.
[0393] S807 , the blur editing module converts the format of image 3 from YUV format to bitmap format.
[0394] After S807, the blur editing module can send the image 3 (bitmap format) to the module for controlling the interface display, so that the electronic device can Figure 4E The preview window 400 of FIG3 displays the image 3 (bitmap format). It can be understood that compared to Figure 4CFocus frame 423 in Figure 4E The position of the middle focus frame 432 changes, but the F value remains unchanged.
[0395] For example, the blur editing module may convert the format of image 3 from YUV format to bitmap format by calling the nv21ToBitmap() method.
[0396] Optionally, after S807, the blur editing module can verify whether the format conversion of image 3 is successful, and send image 3 (bitmap format) to the module for controlling interface display after the data format conversion is successful, so that the electronic device can Figure 4E The image 3 (bitmap format) is displayed in the preview window 400. Alternatively, when the blurring editing module determines that the format of the image 3 is not successfully converted, the module for controlling the interface display may display the prompt information 1 in the interface.
[0397] Optionally, after S807 , when the shooting parameters corresponding to the image 1 include watermark information, the blur editing module may also add watermark information to the image 3 to ensure the consistency of the image data.
[0398] S808. The blur editing module displays the image 3 through the display screen.
[0399] For example, electronic devices can Figure 4G The preview window 400 displays the image 3 (in bitmap format). The building area in the image 3 is in a clear state, and the other areas in the image 3 except the building area are in a blurred state.
[0400] S809 : In response to the user's operation of updating the aperture information in the blur editing interface, the blur editing module obtains aperture information 2 .
[0401] The user's operation of updating the aperture information in the blur editing interface may include: Figure 4C The present invention does not limit this in the embodiment of the present invention, such as a click operation on any sliding position in the sliding bar 424, or a sliding operation to the left or right by the user in the sliding bar 424.
[0402] For example, in response to the user Figure 4C In response to a click operation at any sliding position on the slide bar 424, the electronic device may determine the F value at the click operation position as aperture information 2. Alternatively, in response to a left or right sliding operation on the slide bar 424, the electronic device may determine the F value at the end position of the sliding operation as aperture information 2.
[0403] It is understandable that the blur editing module may execute the step shown in S810 when it detects that aperture information 2 is different from aperture information 1; or, the blur editing module may not execute any step when it detects that aperture information 2 is the same as aperture information 1.
[0404] S810. The blur editing module sends a request 3 (compressed image 2, focus position information 2, aperture information 2, and depth image 1) to the media middle station.
[0405] For example, request 3 may include: aperture information 2, focus position information 2, depth image 1, and compressed image 2. For example, the blur editing module may send request 3 to WideAperturePhotoUtil by calling the refocusProcess() method.
[0406] Optionally, request 3 may also include: aperture information 2, focus position information 2, depth image 1 and image 0, so that the camera algorithm library blurs image 0 based on focus position information 2, aperture information 2 and depth image 1 to obtain image 4.
[0407] S811. The media middle platform sends request 3 (compressed image 2, focus position information 2, aperture information 2, and depth image 1) to the camera algorithm library.
[0408] For example, WideAperturePhotoUtil can send request 3 to the camera algorithm library by calling the sendProcessRequest() method.
[0409] S812 . In response to request 3 , the camera algorithm library re-blurs the compressed image 2 based on the aperture information 2 , the focus position information 2 , and the depth image 1 to obtain image 4 .
[0410] The format of the image 4 may be YUV, and the size of the image 4 is the same as the size of the compressed image 2.
[0411] After S812 , the camera algorithm library may store image 4 (YUV format) for subsequent algorithm calls. Image 4 (YUV format) may be associated with focus position information 2 , aperture information 2 , and depth image 1 .
[0412] S813. The camera algorithm library sends image 4 (YUV format) to the media center.
[0413] S814. The media center sends image 4 (YUV format) to the blur editing module.
[0414] For example, WideAperturePhotoUtil may return Image 4 (YUV format) to the blur editing module by calling the callback() method.
[0415] Optionally, after S814 , the blur editing module may perform data verification on the image 4 (YUV format), and execute the step shown in S815 when the data verification passes.
[0416] For example, the data verification process may include: when the de-emulation editing module detects that the data received from the media center (i.e., image 4) is not empty, determining that the data verification has passed. Alternatively, when the de-emulation editing module detects that the data received from the media center (i.e., image 4) is empty, determining that the data verification has failed, the de-emulation editing module may call the module that controls the interface display so that prompt information 1 is displayed in the interface. In this way, the electronic device can increase data security through data verification and reduce abnormal situations caused by empty data.
[0417] S815 , the blur editing module converts the format of image 4 from YUV format to bitmap format.
[0418] After S815, the blur editing module can send the image 4 (bitmap format) to the module for controlling the interface display, so that the electronic device can Figure 4D The preview window 400 of FIG4 displays the image 4 (bitmap format). It can be understood that compared to Figure 4C The F value in (such as F2.4), Figure 4D When the F value (such as F16) in the image processing unit changes, the position of the focus frame 423 can remain unchanged.
[0419] Optionally, after S815, the blur editing module can verify whether the format conversion of image 4 is successful, and send image 4 (bitmap format) to the module for controlling interface display after the data format conversion is successful, so that the electronic device can Figure 4D The image 4 (bitmap format) is displayed in the preview window 400. Alternatively, when the blurring editing module determines that the format of the image 4 is not successfully converted, the module for controlling the interface display may display a prompt message 1 in the interface.
[0420] Optionally, after S815 , when the shooting parameters corresponding to the image 1 include watermark information, the blur editing module may also add watermark information to the image 4 to ensure the consistency of the image data.
[0421] S817. The blur editing module displays the image 4 through the display.
[0422] For example, electronic devices can Figure 4Dbitmap format) is displayed in the preview window 400. The building region in the image 3 is in a clear state, other regions (such as the building region and the grass region) in the image 4 except the human region are in a blurred state, and the blurring degrees are different from those in the image 3. Figure 4C
[0423] It can be understood that Figure 8 When the user updates the focus position or the user updates the aperture information, the electronic device respectively performs the image processing process. Figure 8 The order relationship between the described steps is only as an example, for example, the user can update the aperture position after updating the focus position, or the user updates the focus position after updating the aperture position, and the specific implementation process is similar to that described in Figure 8 , and will not be repeated again.
[0424] Based on this, when the electronic device detects that the user updates the focus position or updates the aperture information, the electronic device can perform the blurring processing on the compressed image 2 again based on the updated focus position information 3 or the aperture information 2, thereby realizing the real-time refreshing of the image in the preview window 400, so that the user can view the blurring editing result in the preview window 400 at any time.
[0425] In the case of completing the focus position update based on Figure 7-Figure 8 the corresponding embodiment, the electronic device can perform the blurring processing on the compressed image 2 based on Figure 9-10 the corresponding embodiment, and realize the saving of the image.
[0426] Figure 9 Another flowchart of an image processing method provided by an embodiment of the present application is shown in FIG. 9. As shown in FIG. 9, the image processing method can include the following steps: Figure 9
[0427] S901, in response to the operation of the user clicking the save button in the blurring editing interface, the gallery application acquires the focus position information 3.
[0428] The save button can be the save button 421 in Figure 4E
[0429] The description of the focus position information can be referred to the description in S1001.
[0430] After S901, the gallery application can send a request 4 to the camera algorithm library, so that the camera algorithm library performs the steps shown in S902 in response to the request 4. The content contained in the request 4 can be referred to the description in S1001.
[0431] S902, the camera algorithm library acquires the image 3.
[0432] For example, in response to request 4, the camera algorithm library can obtain image 3 (YUV format) and return image 3 (YUV format) to the gallery application. The process of the camera algorithm library obtaining image 3 (YUV format) can be referred to the description in S1003.
[0433] S903: The gallery application performs data verification 5.
[0434] The process of performing data verification based on image 3 (YUV format) by the gallery application can be referred to the description in S1005 .
[0435] When the gallery application determines that the data verification 5 has passed, S904 may be executed; or, when the gallery application determines that the data verification 5 has not passed, prompt information 1 may be displayed on the display.
[0436] S904: The gallery application obtains image 3 (bitmap format).
[0437] The process of the gallery application obtaining image 3 (bitmap format) can be referred to the description in S1006.
[0438] S905 , the gallery application enlarges image 3 to obtain image 5 .
[0439] The process of the gallery application enlarging the image 3 may refer to the description in S1007 .
[0440] S906 : The gallery application updates the image 5 , the editing time of the image 5 , and the thumbnail of the image 5 .
[0441] The process of the gallery application updating the image 5, the editing time of the image 5, and the thumbnail of the image 5 can be referred to the description in S1007 to S1009.
[0442] based on Figure 9 Description in Figure 10 A schematic diagram of module interaction of another image processing method provided in an embodiment of the present application.
[0443] like Figure 10 As shown, the electronic device may include: a gallery application, a media middle platform and a camera algorithm library. The gallery application may include: a large picture preview module and a blur editing module. The meaning of any module can be found in Figure 3 The description in , will not be repeated here.
[0444] exist Figure 10 In the corresponding embodiment, the electronic device is based on Figure 8 Taking S801-S808 in FIG. 3 as an example, in which the focus position information is updated and image 3 (bitmap) is obtained based on the updated focus position information 3, the specific implementation process of saving image 3 is described.
[0445] As shown in Figure 10 The image processing method can include the following steps:
[0446] S1001, in response to the operation of the user clicking the save button in the bokeh editing interface, the bokeh editing button sends a request 4 (compressed image 2, focus position information 3, aperture information 1, and depth image 1) to the media station.
[0447] It can be understood that in the case where the electronic device completes the update of the focus position information based on S801-S808 and then saves the image, the content that can be included in the request 4 can be the same as the content included in the request 2. As can be included in the request 4: focus position information 3, aperture information 1, depth image 1, and compressed image 2.
[0448] For example, in response to the operation of the user clicking the save button in the bokeh editing interface, the bokeh editing module can obtain the focus position information 3, and then the bokeh editing module can send a request 4 to the WideAperturePhotoUtil by calling the generateNormalPhoto() method.
[0449] S1002, the media station sends a request 4 (compressed image 2, focus position information 3, aperture information 1, and depth image 1) to the camera algorithm library.
[0450] For example, the WideAperturePhotoUtil can send a request 4 to the camera algorithm library by calling the sendProcessRequest() method.
[0451] S1003, the camera algorithm library obtains image 3 (YUV format) based on focus position information 3, aperture information 1, and depth image 1.
[0452] For example, after the camera algorithm library receives the focus position information 3 in the request 4, it can obtain the image 3 (YUV format) related to the focus position information 3, aperture information 1, and depth image 1. The image 3 (YUV format) can be generated by the camera algorithm library in advance based on S804.
[0453] S1004, the camera algorithm library sends image 3 (YUV format) to the media station.
[0454] S1005, the media station sends image 3 (YUV format) to the bokeh editing module.
[0455] For example, the WideAperturePhotoUtil can return image 3 (YUV format) to the bokeh editing module by calling the callback() method.
[0456] Optionally, after S1005, the blur editing module can perform data verification on the image 3 (YUV format), and execute the step shown in S1006 if the data verification passes. The data verification process can be found in the description of S806, which will not be repeated here.
[0457] S1006 , the blur editing module converts the format of image 3 from YUV format to bitmap format.
[0458] It can be understood that the step of converting the format of the image 3 by the blur editing module can be referred to the description of S807 and will not be repeated here.
[0459] Optionally, when the blur editing module obtains the image 3 (bitmap format) in advance in S807 and stores the image 3 (bitmap format), the blur editing module can also obtain the image 3 (bitmap format) without executing the steps shown in S1006.
[0460] S1007 , the blur editing module magnifies image 3 based on the compression ratio to obtain image 5 , and updates the editing time of image 5 and the thumbnail of image 5 .
[0461] The meaning of the compression ratio and the method of obtaining the compression ratio can be found in the description of S616 and will not be repeated here.
[0462] For example, when the compression ratio is 39.5% and the size of image 3 is 1440×1080, the blur editing module can divide the size of image 3 by the compression ratio to determine that the size of image 5 is approximately 3648×2736. In this way, the electronic device can enlarge image 3 to ensure that the enlarged image 3 (i.e., image 5) can be clearly displayed on the screen. Figure 4B .
[0463] It is understandable that the blur editing module can update the editing time of the image 5 to the time when the user clicks the save button. In addition, the blur editing module can generate a thumbnail of the image 5 so that the thumbnail of the image 5 can be displayed on the Figure 4A In the interface shown.
[0464] For example, the blur editing module can implement the step of enlarging the image 3 based on the compression ratio by calling the onSaveCallBackSuccess() method.
[0465] S1008. The blurring editing module sends message 3 to the gallery application.
[0466] The message 3 may include one or more of the following: the image 5, the editing time of the image 5, or a thumbnail of the image 5, etc.
[0467] S1009 : The gallery application responds to message 3 by replacing the information related to image 1 with the content in message 3 .
[0468] The information related to image 1 may include one or more of the following: image 1, the editing time of image 1, or a thumbnail of image 1. It is understood that the electronic device can update images 1 to 5 by replacing the information related to image 1 with the content in message 3.
[0469] For example, the gallery application may implement the step of saving the message 3 to the storage module in the gallery application by calling the save() method.
[0470] S1010 . The gallery application displays image 5 on the display.
[0471] For example, electronic devices can Figure 4H Image 5 is displayed. The building area in image 5 is in a clear state, and other areas in image 5 except the building area are blurred.
[0472] S1011: In response to a user closing the gallery application, the gallery application may send a message to the media middle station to instruct the gallery application to close.
[0473] S1012. The media middle platform sends a message to the camera algorithm library to instruct the gallery application to close.
[0474] S1013. The camera algorithm library releases system resources.
[0475] System resources may include memory resources and / or CPU resources, etc., which are not limited in the embodiments of the present application. In this way, the camera algorithm library can improve system performance by releasing system resources.
[0476] In this way, when the user opens the gallery application again, the electronic device can display the thumbnail of image 5, and in response to the user's click operation on the thumbnail of image 5, the electronic device can display Figure 4H The interface shown.
[0477] Based on this, upon detecting that the user clicks the save button, the electronic device can save the updated image 5 and information related to the image 5 to the gallery application for subsequent viewing.
[0478] based on Figure 5-10 In order to more clearly illustrate the image processing method provided in the embodiment of the present application, Figure 11A flowchart of another image processing method provided in an embodiment of the present application. Figure 11 In the corresponding embodiment, the image processing method may involve: a foreground processing process of gallery editing, a background processing process of gallery editing, and a post-processing process of camera shooting, etc.
[0479] After the electronic device detects that the user clicks the blur edit button, the electronic device can obtain image 0, blur image 0 and other images to obtain image 2, and then convert image 2 from YUV to bitmap.
[0480] When the electronic device detects that the user has adjusted the focus position or aperture, it can generate new focus position information or new aperture information, re-blur image 2 based on the new focus position information or new aperture information, and perform other image processing on image 2 to obtain image 3 or image 4. Image 3 or image 4 is then sent to the display for display.
[0481] Among them, the other image processing may include one or more of the following: facial and skin beautification processing, 3DLUT processing, or vignetting processing, etc.
[0482] When the electronic conversion device detects that the user clicks the save button, new focus position information or new aperture information can be generated, and image 2 can be re-blurred based on the new focus position information or new aperture information, and other image processing can be performed on image 2 to obtain a complete effect image, and the complete effect image can be enlarged and other editing processes can be performed to obtain image 5.
[0483] It should be noted that the interface provided in the embodiment of the present application is only an example and does not constitute a limitation of the embodiment of the present application.
[0484] It should be noted that the module names involved in the embodiments of the present application can be defined as other names as long as the functions of each module can be achieved, and there is no specific restriction on the names of the modules.
[0485] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in the embodiments of the present application are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data must comply with the relevant laws, regulations and standards of the relevant regions, and provide corresponding operation entrances for users to choose to authorize or refuse.
[0486] Combined with Figure 4 Figure 11 Description in Figure 12 A flow chart of another image processing method provided in an embodiment of the present application. Figure 12As shown, the image processing method can include the following steps:
[0487] S1201, in response to a photographing operation, acquiring first image data.
[0488] The first image data includes: a first object, a second object, the first object corresponding to a first plane in the first image, the second object corresponding to a second plane in the first image and a first focus position, the depth information of any pixel point in the first plane being different from the depth information of any pixel point in the second plane, and the first focus position corresponding to the first plane in the first image.
[0489] Wherein, the first image data can be the shooting parameter corresponding to image 0 or the shooting parameter corresponding to image 1 described in the embodiments of the present application. The first object can be object 2, the first plane can be plane 2, the second object can be object 3, and the second plane can be or plane 3. The first focus position can be focus position information 1. The first image can be image 0.
[0490] S1202, based on the first image data, performing blurring processing on the second object in the first image to obtain a second image.
[0491] It can be understood that since the first focus position information is located in the first plane in the first image, the electronic device can retain the definition of the first object in the first image by performing blurring processing on the second object in the first image.
[0492] The second image can be image 1 (or image 2).
[0493] S1203, in response to an operation of opening a first interface in the gallery application, displaying the first interface of the gallery application.
[0494] The first interface includes: the second image and a first button. The first interface can be Figure 4B The interface shown, the first button can be Figure 4B The blurring adjustment button 404 in
[0495] S1204, in response to an operation on the first button, performing compression processing on the second image, and displaying the compressed image in a second interface.
[0496] Specifically, in the process of the electronic device compressing the second image, the electronic device can determine the first image ratio corresponding to the second image, and record the first size corresponding to the second image; determine the second size corresponding to the first image ratio based on the correspondence between the image ratio and the preset size, and the preset size is the maximum size allowed by the electronic device for image processing; when the first size is larger than the second size, compress the second image to the second size, or compress the second image based on the preset compression ratio and the first size to obtain the compressed second image.
[0497] Alternatively, when the first size is smaller than the second size, the electronic device may not perform compression processing on the second image.
[0498] It is understandable that other methods for compressing the second image may refer to the description in S616.
[0499] The second interface can be Figure 4C The interface shown.
[0500] After the electronic device displays the second interface, the electronic device may update the focus position information and save the image after the focus position information is updated based on the steps shown in S1205-S1208. Alternatively, the electronic device may update the aperture information based on the steps shown in S1209-S1210.
[0501] S1205: In response to an operation on a second object in a second image in a second interface, obtain a second focus position.
[0502] The operation on the second object in the second image may be clicking on a building, or moving the focus frame to the building. The second focus position is different from the first focus position, and the second focus position may be focus position information 3 .
[0503] S1206: Blurring the first object in the first image based on the second image data to obtain a third image, and displaying the third image in a third interface.
[0504] Optionally, the electronic device may convert the format of the third image from YUV to bitmap.
[0505] The second image data includes: a first object and a second object, wherein the first object corresponds to a first plane in the first image, and the second object corresponds to a second plane and a second focus position in the first image.
[0506] The third image may be image 3, and the third interface may be Figure 4E As shown in the interface. Figure 4E In FIG. 4 , the focus frame 432 may be located at a building.
[0507] S1207 : In response to an operation on the save button, enlarge the third image to the first size to obtain a fifth image.
[0508] The fifth image may be Image 5. The Save button may be Figure 4E The save button 422 in the.
[0509] S1208: In response to the operation of opening the fifth interface in the gallery application, display a fifth image in the fifth interface.
[0510] The fifth interface can be Figure 4H , the fifth image can be Figure 4H Image 5 is shown in the figure.
[0511] S1209 : In response to the operation on the slide bar, obtain a second F value.
[0512] The slider can be Figure 4C For the sliding bar 424 described in , the second F value may be aperture information 2.
[0513] S1210: Blurring the second object in the first image based on the third image data to obtain a fourth image, and displaying the fourth image in a fourth interface.
[0514] Optionally, the electronic device may convert the format of the fourth image from YUV to bitmap.
[0515] The third image data includes: a first object, a second object, the first object corresponds to a first plane in the first image, the second object corresponds to a second plane in the first image, a second F value, and a first focus position.
[0516] The fourth image may be image 4, and the fourth interface may be Figure 4D Understandable, such as Figure 4D The second F value is 16, so after blurring the second object in the first image, the blurring effect is weak.
[0517] The display method of the embodiment of the present application has been described above. The device for performing the above method provided by the embodiment of the present application is described below. Those skilled in the art will understand that the method and device can be combined and referenced with each other, and the relevant device provided by the embodiment of the present application can perform the steps in the above list sorting method.
[0518] Figure 13 A schematic diagram of the hardware structure of another electronic device provided in an embodiment of the present application.
[0519] The electronic device includes a processor 1301, a communication circuit 1304 and at least one communication interface ( Figure 13The communication interface 1303 is used for communicating with other devices or communication networks (such as Ethernet, wireless local area networks (WLAN), etc.) by using any transceiver-like mechanism.
[0520] The processor 1301 can be a general purpose CPU, a microprocessor, an application-specific integrated circuit (ASIC), or one or more integrated circuits for controlling the execution of programs of the solutions of the present application.
[0521] The communication line 1304 can include circuitry for transmitting information between the above-mentioned components.
[0522] The communication interface 1303 is used for communicating with other devices or communication networks (such as Ethernet, wireless local area networks (WLAN), etc.) by using any transceiver-like mechanism.
[0523] Possibly, the electronic device can further include a memory 1302.
[0524] The memory 1302 can be a read-only memory (ROM) or other type of static storage device that can store static information and instructions, a random access memory (RAM) or other type of dynamic storage device that can store information and instructions, an electrically erasable programmable read-only memory (EEPROM), a compact disc read-only memory (CD-ROM) or other optical disk storage, a magnetic disk storage or other magnetic storage devices, or any other medium capable of carrying or storing desired program code in the form of instructions or data structures and that can be accessed by a computer, but is not limited to this. The memory can exist independently, and be connected to the processor through the communication line 1304. The memory can also be integrated with the processor.
[0525] The memory 1302 is used for storing computer-executable instructions for executing the solutions of the present application, and the processor 1301 is used for controlling the execution. The processor 1301 is used for executing the computer-executable instructions stored in the memory 1302, thereby realizing the method provided by the embodiments of the present application.
[0526] Possibly, the computer-executable instructions in the embodiments of the present application can also be referred to as application program codes, and the embodiments of the present application do not make specific limitations on this.
[0527] In particular implementations, as one example, the processor 1301 can include one or more CPUs, such as CPU0 and CPU1 in FIG. 13B. Figure 13
[0528] In particular implementations, as one example, the electronic device can include multiple processors, such as the processor 1301 and the processor 1305 in FIG. 13C. Each of these processors can be a single-CPU processor or a multi-CPU processor. A processor here can refer to one or more devices, circuits, and / or processing cores for processing data, such as computer program instructions. Figure 13
[0529] The display method provided by the embodiments of the present application can be applied to an electronic device with a communication function. The electronic device includes a terminal device, and the specific device form of the terminal device can refer to the related description above, which will not be described here.
[0530] The embodiments of the present application provide a terminal device, which includes: a processor and a memory; the memory stores computer execution instructions; and the processor executes the computer execution instructions stored in the memory, so that the terminal device executes the above method.
[0531] The embodiments of the present application provide a chip. The chip includes a processor, and the processor is configured to call a computer program in a memory to execute the technical solutions in the above embodiments. The implementation principle and technical effects are similar to those of the above related embodiments, which will not be described here.
[0532] The embodiments of the present application also provide a computer readable storage medium. The computer readable storage medium stores a computer program. The computer program is executed by the processor to implement the above method. The method described in the above embodiments can be implemented by software, hardware, firmware, or any combination thereof, in whole or in part. If implemented in software, the functions can be stored as one or more instructions or codes on a computer readable medium or transmitted on a computer readable medium. The computer readable medium can include computer storage medium and communication medium, and can also include any medium that can transfer computer programs from one place to another. The storage medium can be any target medium that can be accessed by a computer.
[0533] In a possible implementation, the computer readable medium can include a RAM, a ROM, a compact disc read-only memory (CD-ROM) or other optical disk storage, magnetic disk storage or other magnetic storage devices, or any other medium that is suitable for storing desired program code in the form of instructions or data structures and that can be accessed by a computer. Also, any connection is properly termed a computer readable medium. For example, if the software is transmitted from a website, server, or other remote source using a coaxial cable, fiber optic cable, twisted pair, digital subscriber line (DSL), or wireless technologies such as infrared, radio, and microwave, then the coaxial cable, fiber optic cable, twisted pair, DSL, or wireless technologies such as infrared, radio, and microwave are included in the definition of medium. Disk and disc, as used herein, include compact disc (CD), laser disc, optical disc, digital versatile disc (DVD), floppy disk and Blu-ray® disc where disks usually reproduce data magnetically, while discs reproduce data optically with lasers. Combinations of the above should also be included within the scope of computer readable media.
[0534] The embodiment of the present application provides a computer program product, which comprises a computer program, and when the computer program is executed, the computer executes the above method.
[0535] The embodiment of the present application is described with reference to the flowcharts and / or block diagrams of the method, device (system), and computer program product according to the embodiment of the present application. It should be understood that each flow and / or block in the flowcharts and / or block diagrams, and the combination of the flows and / or blocks in the flowcharts and / or block diagrams can be implemented by computer program instructions. These computer program instructions can be provided to a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing devices to produce a machine, so that the instructions executed by the computer or other programmable data processing devices produce a device for implementing the functions specified in one or more flows in the flowcharts and / or one or more blocks in the block diagrams.
[0536] The above detailed description of the specific implementation is further detailed for the purpose of the present application, technical solutions, and beneficial effects, and it should be understood that the above is only a specific implementation of the present application, and is not used to limit the protection scope of the present application, and any modification, equivalent replacement, improvement, etc. made on the basis of the technical solutions of the present application should be included in the protection scope of the present application.
Claims
1. An image processing method, characterized in that: Applied to electronic equipment, the method includes: In response to a photographing operation, first image data is acquired, where the first image data includes: a first object, a second object, the first object corresponding to a first plane in the first image, the second object corresponding to a second plane in the first image, and a first focus position, depth information of any pixel in the first plane is different from depth information of any pixel in the second plane, and the first focus position corresponds to the first plane in the first image; performing blurring processing on a second object in the first image based on the first image data to obtain a second image; Displaying a first interface of the gallery application, the first interface including: the second image and a first button, the first button being used to adjust the blur of the second image; In response to an operation on the first button, a second interface is displayed, where the second interface includes: the second image; acquiring a second focus position in response to an operation on a second object in the second image, the second focus position corresponding to a second plane in the second image; A first object in the first image is blurred based on second image data to obtain a third image, and the third image is displayed. The second image data includes: the first object and the second object, the first object corresponds to a first plane in the first image, the second object corresponds to a second plane in the first image and the second focus position.
2. The method according to claim 1, characterized in that The first focus position corresponds to a first plane in the first image, including: the first plane in the first image corresponds to a first focus position range, and the first focus position is located within the first focus position range.
3. The method according to claim 1 or 2, characterized in that The second image corresponds to a first F value, After responding to the operation on the second object in the second image, the method further includes: acquiring the first F value, wherein the second image data also includes the first F value.
4. The method according to any one of claims 1 to 3, characterized in that The second interface also includes: a sliding bar for adjusting the F value of the first image, After displaying the second interface and before responding to an operation on the second object in the second image, the method further includes: In response to an operation on the slide bar, obtaining a second F value; A second object in the first image is blurred based on third image data to obtain a fourth image, and the fourth image is displayed, wherein the third image data includes: the first object, the second object, the first object corresponding to a first plane in the first image, the second object corresponding to a second plane in the first image, the second F value, and the first focal position.
5. The method according to any one of claims 1 to 4, characterized in that After responding to the operation on the first button, the method further includes: determining a first image ratio corresponding to the second image, and recording a first size corresponding to the second image; determining a second size corresponding to the first image ratio according to a correspondence between the image ratio and a preset size, wherein the preset size is a maximum size allowed by the electronic device for image processing; When the first size is larger than the second size, the second image is compressed to the second size, or the second image is compressed based on a preset compression ratio and the first size to obtain a compressed second image.
6. The method according to claim 5, characterized in that The compression ratio is related to the image ratio, and / or the compression ratio is related to a chip type of the electronic device.
7. The method according to claim 5 or 6, characterized in that The size of the third image is the second size, or the size of the third image is the ratio of the first size to the preset compression ratio, and the second interface further includes: a save button, After obtaining the third image, the method further includes: In response to an operation on the save button, the third image is enlarged to the first size to obtain a fifth image, and the fifth image is stored.
8. The method according to any one of claims 1 to 7, characterized in that After acquiring the first image, the method further includes: converting the format of the first image from JPEG to YUV; After obtaining the third image, the method further includes: converting the format of the third image from the YUV to a bitmap.
9. The method according to any one of claims 1 to 8, characterized in that The first interface further includes: a first marker, the first marker framing the first object in the second image; After the response to the operation on the second object in the second image, the first identification frames the second object in the second image.
10. The method according to any one of claims 3 to 9, characterized in that: The second image is an image captured by the electronic device based on portrait mode or large aperture mode.
11. The method according to claim 10, characterized in that Before responding to the operation on the first button, the method further includes: When the first image data includes the first focus position information and a first F value, the first button is generated.
12. The method according to any one of claims 3 to 11, characterized in that: The first image data includes depth image data, and the depth image data includes depth information of any pixel in the first plane and depth information of any pixel in the second plane. The electronic device includes the gallery application and a camera algorithm library. The gallery application includes a first module. After responding to the operation on the first button, the method further includes: The first module acquires the first image data; The first module sends a first request to the camera algorithm library, where the first request includes: the first image data; In response to the first request, the camera algorithm library determines that the first focus position corresponds to the first plane; The camera algorithm library performs blurring processing on the second object in the first image based on the first image data to obtain the second image.
13. The method according to claim 12, characterized in that The second image data includes the depth image data, After acquiring the second focus position, the method further includes: a first module sending a second request to the camera algorithm library, wherein the second request includes: the second image data; The blurring the first object in the first image based on the second focus position to obtain a third image includes: in response to the second request, the camera algorithm library determining that the second focus position corresponds to the second plane; The blurring of the first object in the first image based on the second image data to obtain the third image includes: the camera algorithm library blurring the first object in the first image based on the second image data to obtain the third image.
14. An electronic device, characterized in that: The electronic device includes: one or more processors and memory; The memory is coupled to the one or more processors, and the memory is used to store computer program code, where the computer program code includes computer instructions. The one or more processors call the computer instructions to enable the electronic device to execute the method according to any one of claims 1 to 13.
15. A chip system, characterized in that: The chip system is applied to an electronic device, and the chip system includes one or more processors, and the one or more processors are used to call computer instructions to enable the electronic device to execute the method as described in any one of claims 1 to 13.
16. A computer-readable storage medium, characterized in that The computer-readable storage medium comprises computer instructions, and when the computer instructions are executed on an electronic device, the electronic device is caused to perform the method according to any one of claims 1 to 13.
17. A computer program product, characterized in that The computer program product comprises a computer program code, and when the computer program code is run on an electronic device, the electronic device is caused to perform the method according to any one of claims 1 to 13.
Citation Information
Patent Citations
Image processing method and device, computer-readable storage medium, and electronic equipment
CN108234865A
Image processing method and device, terminal and storage medium
CN110602397A
Image processing method and device, storage medium and electronic equipment
CN115134532A
Image processing method and device, electronic equipment and storage medium
CN115278084A
Image blurring method and device, electronic equipment and storage medium
CN116668867A