Image processing method and apparatus
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- HONOR DEVICE CO LTD
- Filing Date
- 2024-05-27
- Publication Date
- 2026-08-07
AI Technical Summary
然而上述方案存在一定的局限定
[0047]应当理解的是,本申请的第二方面至第六方面与本申请的第一方面的技术方案相对应,各方面及对应的可行实施方式所取得的有益效果相似,不再赘述。
Smart Images

Figure CN120769181B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of terminal technology, and in particular to an image processing method and apparatus. Background Technology
[0002] With the popularization and development of the Internet, people's functional needs for terminal devices are becoming increasingly diversified. For example, in response to a user clicking the shutter button in a camera application, electronic devices can blur the image captured by the camera to obtain a captured image with a blurred effect.
[0003] Normally, users can adjust the aperture size to change the bokeh effect before shooting. However, this method has certain limitations. Summary of the Invention
[0004] This application provides an image processing method and apparatus that allows electronic devices to flexibly adjust the bokeh effect of an image after shooting by adjusting the focus position and aperture size.
[0005] In a first aspect, embodiments of this application provide an image processing method applied to an electronic device. The method includes: in response to a photo-taking operation, acquiring first image data, the first image data including: a first object and a second object, the first object corresponding to a first plane in the first image, the second object corresponding to a second plane and a first focal position in the first image, the depth information of any pixel in the first plane being different from the depth information of any pixel in the second plane, and the first focal 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 including: the second image and a first button, the first button being used to adjust the blurring of the second image; in response to an operation on the first button, displaying a second interface, the second interface including: the second image; in response to an operation on the second object in the second image, acquiring a second focal position, the second focal 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 including: a first object and a second object, the first object corresponding to a first plane in the first image, and the second object corresponding to a second plane and a second focal position in the first image.
[0006] The first image data can be the shooting parameters corresponding to image 0 or image 1 as described in the embodiments of this application.
[0007] 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 plane 3. The first focal position can be focal position information 1, and the second focal position can be focal position information 3.
[0008] The first interface can be Figure 4B The first button can be Figure 4B The blur adjustment button 404 in the middle. The second interface can be Figure 4C .
[0009] The first image can be image 0, the second image can be image 1 (or image 2), and the third image can 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 other than that plane, so as to improve the user experience of using the blur adjustment function.
[0011] In one possible implementation, the first focal position corresponds to a first plane in the first image, including: the first plane in the first image corresponds to a range of first focal positions, and the first focal position is located within the range of first focal positions.
[0012] The range of the first focal position can be the focal position range 2.
[0013] In this way, the electronic device can determine which plane the first focal point is in based on the relationship between the first focal point position and the range of the first focal point position, and retain the sharpness of that plane during the blurring process, thereby improving the accuracy of the blurring process.
[0014] In one possible implementation, the second image corresponds to the first F value, and after responding to an operation on a second object in the second image, the method further includes: acquiring the first F value, which is also included in the second image data.
[0015] The first F-value can be the aperture information 1.
[0016] In this way, when the F value remains unchanged, the electronic device can blur the second object in the second image based on the first F value to preserve the degree of blurring in the image.
[0017] In one possible implementation, the second interface further includes a slider for adjusting the F-value of the first image. After the second interface is displayed but before an operation on a second object in the second image is performed, the method further includes: in response to an operation on the slider, obtaining a second F-value; blurring the second object in the first image based on third image data to obtain a fourth image, and displaying the fourth image. The third 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, a second F-value, and a first focal position.
[0018] The slider used to adjust the F-value of the first image can be... Figure 4C The slider 424 in the middle.
[0019] The fourth image can be image 4. The second F-value can be aperture information 2.
[0020] In this way, when the F value changes, the electronic device can acquire third image data and perform blurring processing based on the third image data, so that the focus position of the image remains unchanged after 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 the correspondence between the image ratio and a preset size, wherein the preset size is the maximum size allowed for image processing by the electronic device; and 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 steps of algorithms through compression.
[0023] In one 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 further includes: in response to the operation of 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 can be image 5.
[0026] In this way, electronic devices can restore the image to its original size by magnifying the third image, thereby improving the user experience.
[0027] In one possible implementation, 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 YUV to bitmap.
[0028] In this way, electronic devices can be processed through format conversion, saving memory usage during algorithm processing.
[0029] In one possible implementation, the first interface further includes: a first identifier that defines a first object in the second image; and the first identifier defining the second object in the second image after an operation on the second object in the second image.
[0030] The first identifier can be Figure 4C The focus frame 423 or Figure 4E The focus frame 432 in the middle.
[0031] This allows users to determine the focus position using the first identifier, so that the focus position can be adjusted at any time.
[0032] In one possible implementation, the second image is an image captured by an electronic device in portrait mode or large aperture mode. This allows the image processing method described in the embodiments of this application to be applied to images captured in both large aperture and portrait modes.
[0033] In one possible implementation, prior to responding to an operation on the first button, the method further includes generating the first button if the first image data includes first focus position information and a first F value.
[0034] In this way, the electronic device can generate the first button based on the determination of whether to generate the first button, and if the focus position information and F value are detected, thereby improving the security of the solution.
[0035] In one possible implementation, the first image data includes depth image data, which includes depth information of any pixel in a first plane and depth information of any pixel in a 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 a first button, the method further includes: the first module acquiring the first image data; the first module sending a first request to the camera algorithm library, the first request including the first image data; in response to the first request, the camera algorithm library determining that the first focal position corresponds to the first plane; and the camera algorithm library blurring a second object in the first image based on the first image data to obtain a second image.
[0036] The first module can be the virtualization editing module. The first request can be request 1.
[0037] In this way, electronic devices can set the blurring 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 focal position, the method further includes: a first module sending a second request to a camera algorithm library, the second request including the second image data; blurring a first object in the first image based on the second focal position to obtain a third image, including: in response to the second request, the camera algorithm library determining that the second focal position corresponds to a second plane; blurring the first object in the first image based on the second image data to obtain a third image, including: the camera algorithm library blurring the first object in the first image based on the second image data to obtain the third image.
[0039] The second request can be request 2.
[0040] Secondly, embodiments of this application provide an image processing apparatus, which may be an electronic device, a chip, or a chip system within an electronic device. The image processing apparatus may include a display unit and a processing unit. When the image processing apparatus is an electronic device, the display unit may be a display screen. The display unit is used to perform display steps to enable 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. When the image processing apparatus is an electronic device, the processing unit may be a processor. The image processing apparatus may further include a storage unit, which may be a memory. The storage unit is used to store instructions, and the processing unit executes the instructions stored in the storage unit to enable 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. When the image processing apparatus is a chip or a 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 enable 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, cache, etc.) or a storage unit located outside the chip within the electronic device (e.g., a read-only memory, random access memory, etc.).
[0041] Specifically, in response to a photo-taking operation, the processing unit is used to acquire first image data, which includes a first object and a second object. The first object corresponds to a first plane in the first image, and the second object corresponds to a second plane and a first focal position in the first image. The depth information of any pixel in the first plane is different from the depth information of any pixel in the second plane, and the first focal position corresponds to the first plane in the first image. The processing unit is also used to perform blurring processing on the second object in the first image based on the first image data to obtain a second image. The display unit is used to display a first interface of the gallery application, which includes a second image and a first button. The first button is used for... The display unit is configured to perform blurring adjustment on 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 obtain a second focus position, the second focus position corresponding to a second plane in the second image; the processing unit is further configured to perform blurring processing on the first object in the first image based on the second image data to obtain a third image; the display unit is further configured to display the third image, the second image data including the first object and the second object, the first object corresponding to a first plane in the first image and the second object corresponding to a second plane and a second focus position in the first image.
[0042] Thirdly, embodiments of this application provide an electronic device, which includes: one or more processors and a memory; the memory is coupled to one or more processors, and the memory is used to store computer program code, the computer program code including computer instructions, and the one or more processors call the computer instructions to cause the electronic device to perform the methods described in the first aspect or any possible implementation of the first aspect.
[0043] Fourthly, embodiments of this application provide a computer-readable storage medium including computer instructions that, when executed on an electronic device, cause the electronic device to perform the methods described in the first aspect or any possible implementation thereof.
[0044] Fifthly, embodiments of this application provide a computer program product including a computer program. When the computer program product includes computer program code, when the computer program code is run on an electronic device, it causes the electronic device to perform the method described in the first aspect or any possible implementation of the first aspect.
[0045] Sixthly, this application provides a chip system applied to an electronic device. The chip system includes one or more processors, which are used to invoke computer instructions to cause the electronic device to perform the methods described in the first aspect or any possible implementation of the first aspect.
[0046] In one possible implementation, the chip system described above in this application further includes at least one memory storing instructions. The memory can be an internal storage unit of the chip system, such as a register or cache, or it can be a storage unit of the chip system itself (e.g., read-only memory, random access memory, etc.).
[0047] It should be understood that the second to sixth aspects of this application correspond to the technical solutions of the first aspect of this application, and the beneficial effects achieved by each aspect and the corresponding feasible implementation are similar, and will not be repeated here. Attached Figure Description
[0048] Figures 1A-1D A scenario diagram provided for an embodiment of this application;
[0049] Figure 2 A schematic diagram of the hardware structure of an electronic device provided in an embodiment of this application;
[0050] Figure 3 A schematic diagram of the software structure of an electronic device provided in an embodiment of this application;
[0051] Figures 4A-4K A schematic diagram of an interface provided for an embodiment of this application;
[0052] Figure 5 A schematic flowchart of an image processing method provided in an embodiment of this application;
[0053] Figure 6 A schematic diagram of module interaction for an image processing method provided in an embodiment of this application;
[0054] Figure 7 A flowchart illustrating another image processing method provided in an embodiment of this application;
[0055] Figure 8 A schematic diagram of module interaction for another image processing method provided in an embodiment of this application;
[0056] Figure 9 A schematic flowchart illustrating another image processing method provided in an embodiment of this application;
[0057] Figure 10 A schematic diagram of module interaction for another image processing method provided in an embodiment of this application;
[0058] Figure 11 A schematic flowchart illustrating another image processing method provided in an embodiment of this application;
[0059] Figure 12A schematic flowchart illustrating another image processing method provided in an embodiment of this application;
[0060] Figure 13 This is a schematic diagram of the hardware structure of another electronic device provided in an embodiment of this application. Detailed Implementation
[0061] To facilitate a clear description of the technical solutions in the embodiments of this application, some terms and technologies involved in the embodiments of this application will be briefly introduced below:
[0062] 1. Camera aperture and F-stop
[0063] A camera aperture is a device used to control the amount of light entering a camera. In other words, it controls the camera's exposure.
[0064] The parameter used to describe aperture size is called the F-number (or F-stop). The F-number does not directly represent the diameter of the aperture, but rather a ratio related to the aperture diameter and the lens focal length. A smaller F-number indicates a larger aperture and more light, while a larger F-number indicates a smaller aperture and less light. For example, F2.8 (F-stop = 2.8) is a larger aperture than F8.
[0065] 2. Camera Depth of Field
[0066] Depth of field can be understood as the imaging range within a camera lens or other imager that yields a sharp image, or as the range of sharpness before and after the point of focus. The point of focus can be the sharpest point obtained when light passes through the lens and focuses onto the image sensor. Foreground depth of field includes the range of sharpness before the point of focus, while background depth of field includes the range of sharpness after the point of focus.
[0067] Important factors affecting depth of field include aperture size, lens, and distance from the subject. A larger aperture (smaller F-number) results in a shallower depth of field, while a smaller aperture (larger F-number) results in a deeper depth of field. Similarly, a longer focal length results in a shallower depth of field, while a shorter focal length results in a deeper depth of field.
[0068] 3. Depth Image
[0069] A depth map can be a grayscale image that includes depth information for any pixel. This depth information represents the distance between points in the scene and the camera.
[0070] In this embodiment, the electronic device can group pixels with the same (or similar) depth information into a plane (or a layer), and the image may include multiple planes. During the blurring process, in response to the user's selection of focus position information, the electronic device can obtain plane 1 where the focus position information is located, preserve the sharpness of plane 1, and blur other planes in the image.
[0071] As is understood, depth images can reflect the geometry of visible surfaces in a scene. Methods for acquiring depth images can include one or more of the following: LiDAR depth imaging, computer stereo vision imaging, or coordinate measuring machine methods.
[0072] 4. Electronic equipment
[0073] The electronic devices in this application embodiment may include handheld devices with display functions, in-vehicle devices, etc. For example, some electronic devices include: mobile phones, tablet computers, PDAs, laptops, mobile internet devices (MIDs), wearable devices, virtual reality (VR) devices, augmented reality (AR) devices, in-vehicle devices, terminal devices in 5G networks, or terminal devices in future evolved public land mobile networks (PLMNs), etc., and this application embodiment is not limited to these. Wearable devices may include one or more of the following: smartwatches, smart glasses, smart bracelets, smart jewelry, etc.
[0074] The electronic devices in the embodiments of this 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 identical or similar items with substantially the same function and purpose. For example, "first chip" and "second chip" are used only to distinguish different chips and do not limit their order of execution. Those skilled in the art will understand that terms such as "first" and "second" do not limit the quantity or execution order, and that "first" and "second" do not necessarily imply that they are different.
[0077] It should be noted that, in the embodiments of this application, the terms "exemplary" or "for example" are used to indicate examples, illustrations, or descriptions. Any embodiment or design scheme described as "exemplary" or "for example" in this application should not be construed as being more preferred or advantageous than other embodiments or design schemes. Specifically, the use of terms such as "exemplary" or "for example" is intended to present the relevant concepts in a specific manner.
[0078] In this application embodiment, "at least one" refers to one or more, and "more than one" refers to two or more. "And / or" describes the relationship between related objects, indicating that three relationships can exist. For example, A and / or B can represent: A alone, A and B simultaneously, or B alone, where A and B can be singular or plural. The character " / " generally indicates that the preceding and following related objects are in an "or" relationship. "At least one of the following" or similar expressions refer to any combination of these items, including any combination of single or plural items. For example, at least one of a, b, or c can represent: a, b, c, ab, a--c, bc, or abc, where a, b, and c can be single or multiple.
[0079] For example, Figure 1 is a schematic diagram of a scenario provided by an embodiment of this application. In the embodiment corresponding to Figure 1, a mobile phone is used as an example for illustration, and this example does not constitute a limitation on the embodiments of this application.
[0080] This application provides multiple shooting modes, such as large aperture mode and portrait mode.
[0081] In wide aperture mode, electronic devices primarily utilize large aperture lenses to capture photos with a blurred background effect. For example, by adjusting the aperture size of the lens, the depth of field can be altered, achieving a sharp foreground and a blurred background, thus highlighting the subject in the foreground.
[0082] In portrait mode, electronic devices can focus on the shooting task, using image algorithms to separate the subject from the background, while also providing beautification and skin smoothing functions to enhance the portrait. For example, the electronic device can identify the face region through facial recognition and preserve the clarity of the face region by blurring the background areas outside the face region in the image.
[0083] Understandably, users can capture images with a bokeh effect by using either the large aperture mode or portrait mode.
[0084] In response to the user opening the camera app, the electronic device can display something like... Figure 1A The interface shown. (As shown) Figure 1A As shown, the interface can display: preview window 101, camera mode option bar 102, playback button 103, photo button 104, camera flip button 105, etc.
[0085] The preview window 101 can display the preview image and the camera settings button.
[0086] The preview image in preview window 101 can be an image captured in real time by the camera of an electronic device based on the field of view.
[0087] The preview image may include: people 10 in the portrait area, buildings 20 in the building area, and grass 30 in the grass area, etc.
[0088] During the shooting process, the distance between the grassy 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, meaning that the grassy area is closer to the electronic device, and the building area is farther from the electronic device.
[0089] It is understandable that an electronic device can capture Image 1 based on a preview image. 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 human figure area can be 5 meters. The depth information described here is only for illustration.
[0090] In portrait mode, electronic devices can determine the location of a person through facial recognition. Therefore, when blurring the preview image, the electronic device can retain the sharpness of the person while blurring other areas. At this point, the user can see a sharp person 10, as well as blurred buildings 20 and blurred grass 30 in the preview window 101.
[0091] It is understood that the bokeh effect in this application embodiment can be represented by dashed lines in the image, which will not be described in detail hereafter.
[0092] The camera settings buttons may include: a bokeh setting button 106, a shooting magnification option 107, and a beauty and skin smoothing button 108.
[0093] The bokeh setting button 106 can be used to adjust the bokeh effect of the image before shooting. The bokeh effect can be adjusted from strong to weak. See [link / reference]. Figure 1B The 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 smoothing button 108 can be used to adjust the beauty and skin smoothing effects of the screen, such as increasing the beauty and skin smoothing effect or adjusting the strength of the beauty and skin smoothing effect.
[0096] The camera mode option bar 102 can display at least one shooting mode button. For example, from left to right, the camera mode option bar can display: large aperture mode button 109, night scene mode button, portrait mode button 110, photo mode button, and video mode button, etc.
[0097] A selection indicator can be displayed above the portrait mode button 110. The selection indicator can be displayed as an upward arrow. This is indicated when the portrait mode button 110 is selected. Figure 1A This can also be referred to as the shooting interface corresponding to portrait mode.
[0098] The playback button 103 can be used to view previously captured images or videos. The playback button 103 can display a thumbnail of the previously captured image 111, or a thumbnail of the image 111 located in the first frame of a previously captured video, etc. For example, in response to a user's click on the playback button 103, the electronic device can open the gallery application and display image 111.
[0099] The camera button 104 can be used to receive a user's shooting action. In portrait mode, in response to the user's click on the camera button 104, the electronic device can acquire a portrait mode image.
[0100] The camera flip button 105 can be used to switch the currently used camera. If the currently used camera for capturing images is the front-facing camera, the electronic device can activate the rear-facing camera to capture images after detecting a user's click on the camera flip button 105. Conversely, if the currently used camera for capturing images is the rear-facing camera, the electronic device can activate the front-facing camera to capture images after detecting a user's click on the camera flip button 105.
[0101] In response to user requests Figure 1A Clicking the blur setting button 106 in the image will cause the electronic device to display something like... Figure 1B The interface shown. Figure 1B A slider 112 can be displayed to the right of the blur setting button 106. Figure 1BOther content displayed in the text can be compared with... Figure 1A Similar to the case in China, I will not repeat it here.
[0102] The slider 112 can be used to adjust the intensity of the bokeh effect. For example, in response to the user sliding the slider 112 to the right, the electronic device can enhance the bokeh effect before shooting; or, in response to the user sliding the slider 112 to the left, the electronic device can reduce the bokeh effect before shooting. Any sliding position on the slider 112 can correspond to an F-value. For example, when enhancing the bokeh effect, the F-value can be F1.2, and when reducing the bokeh effect, the F-value can be F16.
[0103] In response to user requests Figure 1A When the large aperture mode button 109 is clicked, the electronic device displays as follows: Figure 1C The interface shown. Figure 1C The camera can display a preview window 113, a camera mode option bar, a playback button, a photo button 115, a camera flip button, etc.
[0104] The preview window 113 can display: a preview image and an F-value adjustment button 114, which can be used to adjust the aperture of the camera.
[0105] In response to a click operation on the F-value adjustment button 114, the electronic device can display as follows: Figure 1D The interface shown. Figure 1D The preview window 113 may include a slider 116, and any sliding position in the slider 116 may correspond to an F value. For example, when the sliding position is F4, the slider 116 may display F4.
[0106] Understandably, users can base their decisions on... Figure 1B The slider 112 in the middle allows for adjustment of the bokeh effect before shooting, or based on... Figure 1D The slider 116 allows for adjustment of the bokeh effect before shooting. Upon user click on the shutter button 104 or shutter button 115, the electronic device generates the captured image. However, while the above method can achieve bokeh adjustment before shooting, it has certain limitations.
[0107] It is understood that the aforementioned electronic devices can also be referred to as terminals, user equipment (UE), mobile stations (MS), mobile terminals (MT), etc. Electronic devices can include mobile phones with touchscreens, smart TVs, wearable devices, tablets, computers with wireless transceiver capabilities, virtual reality (VR) electronic devices, augmented reality (AR) electronic devices, and so on. The embodiments of this application do not limit the specific technologies or device forms used in the electronic devices.
[0108] To better understand the embodiments of this application, the structure of the electronic device according to the embodiments of this application is described below. For example, Figure 2 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this application.
[0109] The electronic device may include a processor 110, 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, a headphone jack 170D, a sensor module 180, and a display screen 194, etc.
[0110] The sensor module 180 may include sensors such as a touch sensor. The touch sensor may be located on the display screen 194, and the touch sensor and the display screen 194 together form a touchscreen. The touch sensor is used to receive user trigger operations on the touchscreen.
[0111] It is understood that the structures illustrated in the embodiments of this application do not constitute a specific limitation on the electronic device. In other embodiments of this application, the electronic device may include more or fewer components than illustrated, or combine some components, or split some components, or have different component arrangements. 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. These processing units may be independent devices or integrated within one or more processors. The processor 110 may also include a memory for storing instructions and data. For example, the processor 110 may store instructions and data related to an image processing method provided in an embodiment of this application.
[0113] USB interface 130 is an interface that conforms to the USB standard specification, specifically it can be a Mini USB interface, Micro USB interface, USB Type C interface, etc. USB interface 130 can be used to enable data transfer between electronic devices and peripheral devices.
[0114] The wireless communication module 160 can provide functions such as wireless local area networks (WLAN) (such as wireless fidelity (Wi-Fi) networks) or Bluetooth (BT) for use in electronic devices.
[0115] Electronic devices utilize GPUs, displays (194), and application processors to achieve display functions. The GPU is a microprocessor for image processing, connecting the displays (194) and the application processor.
[0116] Display screen 194 is used to display images, videos, etc. Display screen 194 includes a display panel. For example, display screen 194 can display... Figures 1A-1D ,as well as Figures 4A-4K Any interface described in the document.
[0117] The software systems of electronic devices can adopt layered architecture, event-driven architecture, microkernel architecture, microservice architecture, or cloud architecture, etc., which will not be elaborated here.
[0118] For example, Figure 3 This is a schematic diagram of the software structure of an electronic device provided in an embodiment of this 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: the application (APP) layer, the application framework layer, the hardware abstraction layer (HAL), and the kernel layer, etc. This application does not impose any limitations on these layers.
[0120] The application layer can include a series of application packages. The application layer can include one or more of the following: camera application, gallery application, etc.
[0121] A camera app is an application used for taking pictures. Camera apps can implement various shooting modes, such as those listed below. Figure 1A The description in the text.
[0122] Gallery apps, also known as photo album apps, offer features such as image searching and editing. For example, a gallery app might include a large image preview (photo browser) module, a blurring / blurring editing module, and a storage module.
[0123] The large image preview module can be used to determine whether to generate a blur adjustment button based on the shooting parameters corresponding to image 1.
[0124] The bokeh editing module can be used to send requests to the camera algorithm library through the media platform, requesting the library to process the image. It can also perform image compression, magnification, and format conversion. The functionality of the bokeh editing module can be implemented using 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 a gallery application. For example, if the gallery application includes image 1, the storage module can store: image 1, image 1's thumbnail (e.g., thumbnail 402), image 1's capture time, image 1's capture date, and image 1's corresponding capture parameters. 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 application programming interfaces (APIs) and a programming framework for applications in the application layer. The application framework layer includes several predefined interfaces. It may include one or more of the following: a media middleware platform.
[0127] The media platform can be used to forward data between the bokeh editing module and the camera algorithm library. For example, the media platform can forward messages sent by the bokeh editing module to the camera algorithm library, or forward messages sent by the camera algorithm library to the bokeh editing module.
[0128] The interaction between the media platform and other modules can be achieved through the class WideAperturePhotoUtil in the electronic device. It can be understood that all methods that the media platform needs to call can be found in WideAperturePhotoUtil.
[0129] In possible implementations, the application framework layer may also 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 text), but this is not limited in the embodiments of this application.
[0130] The purpose of the hardware abstraction layer is to abstract hardware, providing a unified interface for upper-layer applications to query hardware devices, or to provide data storage services for upper-layer applications.
[0131] The hardware abstraction layer may include one or more of the following: a camera algorithm library. This library can be used to perform image blurring based on focus position information, aperture information, and depth information.
[0132] The kernel layer is the layer between hardware and software. It drives the hardware to function. The kernel layer can include one or more of the following: camera driver, display driver, or sensor driver, etc.
[0133] Among possible viewing methods, 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), etc. Figure 3 (Not shown in the image).
[0134] In this application embodiment, no specific limitations are made on the software layers involved in the software architecture, the modules contained in the layers, and the functions of the modules.
[0135] The technical solution of this application and how the technical solution of this application solves the above-mentioned technical problems are described in detail below with specific embodiments. The following specific embodiments can be implemented independently or in combination with each other. The same or similar concepts or processes may not be described again in some embodiments.
[0136] The following is combined Figures 4A-4K The interface shown illustrates the blurring editing process in image processing methods, but this example does not constitute a limitation on the embodiments of this application.
[0137] exist Figures 4A-4K The description uses portrait mode as an example for illustration. In this case, image 1 can be an image captured by an electronic device in portrait mode. For example, the electronic device can be based on... Figure 1A-Figure 1B The description in the text describes how to capture images in portrait mode.
[0138] When the shooting mode is large aperture mode, image 1 can also be an image captured by an electronic device using large aperture mode. For example, the electronic device can be based on... Figures 1C-1D The images described in the text were taken in a large aperture mode, and will not be repeated hereafter.
[0139] In response to user Figure 1A When the camera clicks the shutter button 104, the electronic device acquires the shooting parameters corresponding to image 0 based on the camera, and obtains image 1 based on the shooting parameters corresponding to image 0.
[0140] For example, image 0 may 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 shooting parameters corresponding to image 0 may include: shooting parameters of object 1, shooting parameters of object 2 and shooting parameters of object 3.
[0142] The shooting parameters of object 1 may include: pixel information of object 1, plane 1 corresponding to object 1, focal position range 1 corresponding to plane 1, and depth 1 corresponding to plane 1, etc.
[0143] The shooting parameters of object 2 may include: the pixel information of object 2, the plane 2 corresponding to object 2, the focal position range 2 corresponding to plane 2, and the depth 2 corresponding to plane 2.
[0144] The shooting parameters of object 3 may include: the pixel information of object 3, the plane 3 corresponding to object 3, the focal position range 3 corresponding to plane 3, and the 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 in plane 1 can be depth 1, and the focal position range corresponding to plane 1 can be focal position range 1. When the coordinates corresponding to the focal position (such as focal position information 1) are within the focal position range 1, object 1 is the focal object. The electronic device can choose not to blur the pixel corresponding to object 1, but can blur the pixels other than the pixel corresponding to object 1.
[0146] In the focal position range 1, the horizontal coordinate can be in the range of (x11, x12), and the vertical coordinate can be in the range of (y11, y12).
[0147] It is understood that the area formed by the focal position can be a regular shape, such as a rectangle or a circle; or, the area formed by the focal position can also be an irregular area, such as a grassy area, etc., and this application embodiment does not limit this.
[0148] Object 2 can correspond to plane 2. The depth information of any pixel in plane 2 can be depth 2, and the focal position range corresponding to plane 2 can be focal position range 2. When the coordinates corresponding to the focal position (such as focal position information 1) are within the focal position range 2, object 2 is the focal object. The electronic device can choose not to blur the pixel corresponding to object 2, but can blur the pixels other than the pixel corresponding to object 2.
[0149] In this context, depth 2 differs from depth 1, for example, depth 2 can be greater than depth 1, and the focal position range 2 differs from the focal position range 1. Within the focal position range 2, the x-coordinate can take values of (x21, x22), and the y-coordinate can take values of (y21, y22).
[0150] Object 3 can correspond to plane 3. The depth information of any pixel in plane 3 can be depth 3, and the focal position range corresponding to plane 3 can be focal position range 3. When the coordinates corresponding to the focal position (such as focal position information 1) are within the focal position range 3, object 3 is the focal object. The electronic device can choose not to blur the pixel corresponding to object 3, but can blur the pixels other than the pixel corresponding to object 3.
[0151] In this case, depth 3 differs from depth 2, for example, depth 3 can be greater than depth 2, and the focal position range 3 differs from the focal position range 2. In the focal position range 2, the horizontal coordinate can take values of (x31, x32), and the vertical coordinate can take values of (y31, y32).
[0152] It is understood that the subject depicted in Figure 1 is only an example, and the number of subjects is not limited in this embodiment.
[0153] The shooting parameters corresponding to image 0 may also include: the aperture information corresponding to image 0 (such as aperture information 1) and the depth image data corresponding to image 0 (such as the data contained in depth image 1). Among them, the depth image data includes: depth 1, depth 2, and depth 3, etc.
[0154] In response to opening the gallery app, the electronic device displays something like... Figure 4A The interface shown may display: a search box 401, and thumbnails of at least one image. For example, the thumbnail of at least one image may include: thumbnail 402 of image 1.
[0155] Search box 401 can be used to perform image searches in a gallery application. For example, search box 401 can search for images with human features or images taken at a specific location.
[0156] Thumbnail 402 can be an image obtained by reducing the size of image 1. The top of thumbnail 402 can display: the location where image 1 was taken (e.g., XX city, XX district) and the date image 1 was taken (e.g., today).
[0157] Optionally, thumbnail 402 may also display: identifier 1 with the letter "f", where "f" can be understood as an abbreviation for the F value. Identifier 1 may not be in the image. Figure 4A As shown in the diagram. The identifier 1 indicates that image 1 is a blurred image. Identifier 1 can be displayed in the upper right corner of thumbnail 402 or in other locations on thumbnail 402. In this way, the user can identify that image 1 is a blurred image by identifier 1 without having to view image 1 in its larger size, and then proceed to the steps of clicking thumbnail 401 and blurring image 1.
[0158] In response to a user's click on thumbnail 402, the electronic device displays as follows: Figure 4B The interface shown. Figure 4B The screen can display: shooting information 406, bokeh adjustment button 404, details view button 405, image 1, and options bar 407.
[0159] The shooting information 406 can display: the shooting location of image 1, the shooting date of image 1 (e.g., May 13, 2014), and the shooting time of image 1 (e.g., 08:00).
[0160] The blur adjustment button 404 can be used to enter the blur editing interface corresponding to image 1 (e.g., Figure 4C The blur adjustment button 404 may display the letter "f", which can be understood as an abbreviation for F value.
[0161] Understandably, after entering the blur editing interface, the electronic device can adjust the focus position and / or the F-value of image 1. The process of adjusting the blur of image 1 based on the blur adjustment button 404 can be found in the description of method B below.
[0162] The details button 405 can be used to view parameters related to Image 1. For example, parameters related to Image 1 may include one or more of the following: the name of Image 1, the ISO sensitivity (or ISO value) of Image 1, the exposure value (EV) of Image 1, the F-number of Image 1, the size of Image 1, the storage size of Image 1, or the shooting mode of Image 1, etc.
[0163] The options bar 407 displays the following buttons from left to right: Share button, Favorite button, Edit button 408, 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 enable more settings for image 1.
[0165] The edit button 408 can perform cropping, image adjustment, filter adjustment, adding doodles, and adding blur effects to image 1. The specific process of adding a blur effect to image 1 using the edit button 408 can be found in the description of method A below.
[0166] In this embodiment of the application, the electronic device can also be... Figure 4B The blur adjustment button 404 in the image allows for blur adjustment of image 1 (see description of method A). Alternatively, the electronic device can... Figure 4B The edit button 408 in the image adds a blur effect to image 1 (see the description of method B).
[0167] Method A: Adjust the blur of image 1 using the blur adjustment button 404. Figure 4C - Figure I)
[0168] In response to user requests Figure 4B When the blur adjustment button 404 is clicked, the electronic device can read the shooting parameters corresponding to image 1, and obtain the blurred image using the shooting parameters corresponding to image 0, thereby achieving the desired effect. Figure 4C The interface shown displays the blurred image (as in Image 2).
[0169] It is understandable that the electronic device can obtain the focus position information 1 from the shooting parameters corresponding to image 1. Given that the focus position information 1 is within the focus position range 1 and the focus position range 1 corresponds to plane 1, the electronic device can blur objects in other planes besides plane 1 in image 0.
[0170] For example, an 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 This can be called a blurred editing interface, which can display: an exit button 421, a save button 422, a preview window 400, a prompt message 425, and a slider 424.
[0172] The exit button 421 can be used to exit the blurred editing interface. For example, in response to a user clicking the exit button 421, the electronic device can display something like... Figure 4B The interface shown.
[0173] The preview window 400 can display: a preview image, and a focus frame (or focus box) 423. Figure 4C The blurring effect of the preview image and Figure 4B The blurring effect is consistent with that of Image 1. The blurring effect of Image 1 can be found in [reference needed]. Figure 1A The description in the text.
[0174] The preview image in preview window 400 can be: compressed image 2. Compressed image 2 can be the image obtained by blurring and compressing image 0. For methods of obtaining image 0 and compressed image 2, please refer to [link to relevant documentation]. Figure 6 The description in the text will not be repeated here.
[0175] The focus frame 423 can be used to define the focus position. The focus frame 423 can be displayed by default at the focus position of the preview image, and the focus position of the preview image can be the same as the focus position of image 1. The focus position of image 1 can be determined when image 1 is captured. It can be understood that since the focus position information 1 is within the focus position range 1, and the focus position range 1 corresponds to plane 1, the focus frame 423 is displayed at the object 1 (i.e., the person) in plane 1.
[0176] Optional, Figure 4C The focus frame 423 may not be displayed within the preview window 400. Upon a user's click operation at any location within the preview window 400, the electronic device may display the focus frame at the location of the click.
[0177] The prompt message 425 can be used to prompt the user for permitted actions, such as prompting the user to select the focus position by clicking, or prompting the user to adjust the blur effect by sliding. For example, prompt message 425 could be displayed as: Click to refocus, slide to adjust the blur effect. The content displayed in prompt message 425 is for illustrative purposes only.
[0178] Each sliding position in slider 424 can correspond to an F-value. Slider 424 includes a selected position, which can be a bold or elongated line, and can overlap with any sliding position in slider 424. The electronic device can identify the F-value corresponding to the selected position and adjust the blurring of the image based on that F-value.
[0179] like Figure 4C When the selected position overlaps with the sliding position 426, the upper side of the slider 424 can display F2.4, at which point 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., and this application embodiment does not limit this.
[0181] Electronic devices can Figure 4C It enables functions such as adjusting the focus position and adjusting the F value.
[0182] In one implementation, in response to the user's... Figure 4C The electronic device can display the following when the slider 424 is slid to the left or when the rightmost sliding position of the slider 424 is clicked: Figure 4D The interface shown.
[0183] like Figure 4D When the selected position of slider 430 overlaps with the sliding position 427, F16 can be displayed on the upper side of slider 430. At this time, the preview image in preview window 400 can be the image obtained after blur adjustment based on F16, that is, the preview image does not have a blurred part.
[0184] Understandably, when the F-number is set to 16, the aperture is smaller, the depth of field is greater, and more parts of the image become sharp. Therefore, the bokeh effect is weakened or disappears, making it difficult for the user to see the bokeh.
[0185] This is understandable, since the focal position has not changed at this time, therefore compared to Figure 4C , Figure 4D The position of the center focus frame 423 remains unchanged.
[0186] In another implementation, in response to the user's... Figure 4C In the preview window 400, clicking on a building (such as object 3) or dragging the focus frame 423 to the building (such as object 3) allows the electronic device to acquire focus position information 2. Using focus position information 2 and the shooting parameters corresponding to image 1, the electronic device can blur image 0 to obtain a blurred image. Figure 4E The interface shown displays the blurred image (as in Image 3).
[0187] It is understandable that the electronic device can determine the focus position information 2 based on the location of the click or drag operation. The focus position information 2 is different from the focus position information 1. When the electronic device determines that the focus position information 2 is within the focus position range 3 and the focus position range 3 corresponds to plane 3 based on the shooting parameters corresponding to image 1, the electronic device can blur objects in other planes of image 0 except for plane 3.
[0188] For example, an electronic device uses aperture information 1 and depth image 1 to blur object 2 in plane 2 and object 1 in plane 1 to obtain a blurred image (such as image 3).
[0189] like Figure 4E As shown, 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 within 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 on the building, the building area is in sharpness, while the portrait area and the grass area are blurred.
[0191] Optionally, the electronic device can also apply different degrees of blurring to different areas, meaning the grassy area in the preview image is blurred more than the human figure area. In other words, the farther the object is from the focus point, the more blurred it becomes.
[0192] Understandable, see Figure 4C The preview image in preview window 400 and Figure 4E In the preview image in preview window 400, the focus box moves from the portrait area to the building area, thus switching the area of sharpness of the image from the portrait area to the building area. For example, in Figure 4C In the preview window (400), the portrait area is in focus, while the building and grass areas are blurred. The degree of blurring in the building and grass areas can be different or the same. Figure 4E In the preview window 400, the building area is in a clear state, while the portrait area and the grass area are in a blurred state. The degree of blurring in the portrait area and the grass area can be different.
[0193] Understandably, since the F value has not changed at this time, compared to Figure 4C , Figure 4E The middle slider 424 remains unchanged.
[0194] Optional, responding to user input Figure 4D or Figure 4E When the exit button 421 is clicked, the electronic device can display the following: Figure 4F The interface shown. Figure 4F The following can be displayed: a prompt box 428, which may include: a prompt message indicating whether to abandon the current modification, a cancel button, and an abandon button, etc.
[0195] For example, in response to a user's click on the cancel button in prompt 428, the electronic device can maintain... Figure 4D or Figure 4E The interface shown; or, in response to the user clicking the cancel button in prompt box 428, the electronic device may display the following: Figure 4B The interface shown.
[0196] Optional, responding to user input Figure 4D or Figure 4E Clicking the save button 422 will cause the electronic device to display the following sequentially: Figure 4G The interface shown, and Figure 4H The interface shown.
[0197] Figure 4G The following can be displayed: Prompt box 429, which can include: a prompt message indicating that the image is being saved.
[0198] Figure 4H The interface can display the image after blurring adjustment (e.g., image 5). Other content displayed in this interface can be found in [link to relevant documentation]. Figure 4B The description in the text will not be repeated here.
[0199] Based on this, users can... Figures 4A-4H The operation described herein allows for flexible adjustment of the focus position and F-value after shooting. Furthermore, during the focus position adjustment process, in response to a user's click operation on any location, the electronic device can obtain the focus position corresponding to that click operation, determine the target plane in the image where the focus position is located, and then the electronic device blurs the areas in the image other than the target plane.
[0200] Method B: Add a blur effect to image 1 using the edit button 408. Figures 4I-4K )
[0201] In response to user requests Figure 4B Clicking the edit button 408 allows the electronic device to read the pixel information of the photographed object and the plane information of any photographed object from the shooting parameters corresponding to Image 1, and to obtain Image 1 based on the pixel information of the photographed object and the plane information of any photographed object, thereby enabling Image 1 to be displayed. Figure 4I The interface shown. The pixel information of the subject and the plane information where any subject is located can be found in [reference needed]. Figure 4A The corresponding description.
[0202] Figure 4I The display may include: Image 1, and an options bar 409. The options bar 409 may include: a crop button 410, a filter button, an image adjustment button, and a blur button 411, etc.
[0203] The crop button 410 can be used to crop the image 1. When the crop button 410 is selected... Figure 4I Multiple buttons can be displayed between the option bar 409 and image 1, and any button can correspond to a preset cropping ratio.
[0204] The filter button can be used to add filter effects to image 1.
[0205] The image adjustment buttons can be used to adjust the image parameters of image 1, such as 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 image 1.
[0207] In response to user requests Figure 4I When the blur button 411 is clicked, the electronic device displays as follows: Figure 4J The interface shown. (As shown) Figure 4J As shown, when the blur button 411 is selected, the following can be displayed in the middle of the blur button 411 and image 1: original image button 412, circular button 413, linear button 414, blur button 415, and slider 416.
[0208] The original image button 412 can be used to view the original image. For example, if the electronic device adds a blur effect to image 1 based on the blur button 411, image 1 can be the "original image" at this time.
[0209] The circular button 413 can be used to set the blur boundary to a circle. When the blur boundary is circular, the electronic device can add a blur effect to the area outside the circle while preserving the clarity of the area inside the circle.
[0210] In this context, the blur boundary can be understood as the boundary between the sharp and blurred areas during the blurring process. The blur boundary can be circular or rectangular.
[0211] Linear button 414 can be used to set the blur boundary to a rectangle. For example, when the blur boundary is rectangular, the electronic device can add a blur effect to the area outside the rectangle while preserving the clarity of the area inside the rectangle.
[0212] The width of the rectangle can be the same as the width of Image 1, and the height of the rectangle can be the distance between two parallel lines. It can be understood that the size of the rectangle can be preset by the electronic device.
[0213] The blur button 415 can be used to add a blur effect to the entire area of image 1.
[0214] The slider 416 can be used to set the degree of blur. For example, when the circular button 413 is selected, the user can use the slider 416 to set the degree of blur of the area outside the circle; or, when the linear button 414 is selected, the user can use the slider 416 to set the degree of blur of the area outside the rectangle, etc.
[0215] In response to a user's click on the circular button 413, the electronic device can display as follows: Figure 4K The interface shown.
[0216] exist Figure 4K In the preview window 435, the electronic device can blur the area outside the circular area 436 in the image 1 based on the preset circular area 436, and retain the clarity within the circular area 436.
[0217] It is understood that the circular region 436 may include a portion of the region in object 2 and a portion of the region in object 3.
[0218] Figure 4K The circular button 413 is in the selected state, and the number "50" can be displayed on the circular button 413. 50 can be understood as the electronic device setting the blur level to 50%, at which point the selection indicator in the slider is in the center position.
[0219] During the process of adding a blur effect to image 1 based on the 4D interface shown by the user, the electronic device can add a blur effect to image 1 by overlaying a mask on image 1 and controlling the area covered by the mask in image 1 by controlling the blur boundary. The mask can be the image obtained by blurring image 1.
[0220] Understandably, in method B, when the blur boundary is circular, in response to a user's click operation on any location in image 1, the electronic device can obtain the location 1 where the click operation occurred, retain the sharpness within the circular area centered on location 1, and blur 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 shooting parameters corresponding to image 1, and does not read the focus position information of image 1, when the user selects the circular button 413, in response to the user's click operation on object 2, the electronic device achieves image blurring processing based on a smaller amount of data, which can reduce the computational load and save system overhead.
[0221] To describe clearly Figures 4A-4K The specific implementation process is described below. Figures 5-10 The corresponding embodiments illustrate the image processing method.
[0222] Understandably, electronic devices can be based on Figures 5-6 Corresponding implementation examples Figure 4C Initialization. Based on Figures 7-8 The corresponding implementation is in Figure 4C This enables the updating of focus position information and / or aperture information. Based on... Figures 9-10 The corresponding implementation saves the image after blurring and editing (such as image 5).
[0223] Figure 5 This is a schematic flowchart illustrating an image processing method provided in an embodiment of this application. Figure 5 As shown, the image processing method may include the following steps:
[0224] S501, in response to the user clicking the blur adjustment button, the gallery application reads image 1 and the shooting parameters corresponding to image 1.
[0225] Image 1 can be the image obtained after processing the original image based on the image processing procedure 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. Image 0 may include the shooting parameters corresponding to Image 0. That is, the shooting parameters corresponding to Image 0 may also include: shooting parameters for Object 1, shooting parameters for Object 2, and shooting parameters for Object 3.
[0227] The shooting parameters of object 1 may include: pixel information of object 1, plane 1 corresponding to object 1, focal position range 1 corresponding to plane 1, and depth 1 corresponding to plane 1, etc.
[0228] The shooting parameters of object 2 may include: the pixel information of object 2, the plane 2 corresponding to object 2, the focal position range 2 corresponding to plane 2, and the depth 2 corresponding to plane 2.
[0229] The shooting parameters of object 3 may include: the pixel information of object 3, the plane 3 corresponding to object 3, the focal position range 3 corresponding to plane 3, and the depth 3 corresponding to plane 3.
[0230] Depth 1, Depth 2, and Depth 3 can constitute depth image 1. The contents of any parameter can be found in [reference needed]. Figure 4A The description in the text will not be repeated here.
[0231] The meaning of Image 1 and the contents of 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 the image obtained after format conversion of the original image.
[0234] For example, image 0 could be an image obtained by converting a raw image in RAW format to Joint Photographic Experts Group (JPEG) format.
[0235] The process of converting image 0 from JPEG to YUV format in the gallery application can be found in the description in S610.
[0236] S503, Gallery Application Execution Data Verification 1.
[0237] The process of data verification 1 for the image library application based on the shooting parameters corresponding to image 1 and the format of image 0 (YUV) can be found in the description in S610.
[0238] Once the gallery application determines that data verification 1 has passed, it can send request 1 to the camera algorithm library, causing the camera algorithm library to respond to request 1 and execute the steps shown in S504; alternatively, once the gallery application determines that data verification 1 has failed, it can end the subsequent steps. The content of request 1 can be found in 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 blur image 0 to obtain image 2 (YUV format) and return image 2 (YUV format) to the gallery application.
[0241] S505, Gallery application performs data verification 2.
[0242] The process of data verification based on Image2 (YUV format) for image library applications can be found in the description in S615.
[0243] If the gallery application determines that data verification 2 has passed, S506 can be executed; or, if the gallery application determines that data verification 2 has failed, prompt message 1 can be displayed on the screen. The content of prompt message 1 can be found in the description in S615.
[0244] S506, the gallery application performs image compression and focus coordinate transformation.
[0245] For example, the process of the gallery application performing image compression on image 2 and converting focus position information 1 into focus position information 2 can be found in the description in S616.
[0246] based on Figure 5 The description in the text, Figure 6This is a schematic diagram illustrating the module interaction of an image processing method provided in an embodiment of this application. For example... Figure 6 As shown, an electronic device may include: a camera application, a gallery application, a media platform, and a camera algorithm library. The gallery application may include: a large image preview module and a bokeh editing module. The meaning of any of these modules can be found in [reference needed]. Figure 3 The description in the text will not be repeated here.
[0247] Understandable, Figure 6 In the corresponding embodiment, portrait mode is used 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... Figure 6 Similar to the description in the text, it will not be repeated hereafter.
[0248] S601-S604 can be used as a schematic diagram of the process by which an electronic device acquires and stores image 1 and the corresponding shooting parameters of image 1 in response to a user clicking the shutter button in portrait mode.
[0249] like Figure 6 As shown, the image processing method may include the following steps:
[0250] S601, in response to the user clicking the shutter button in portrait mode, the camera application obtains image 1 and the shooting parameters corresponding to image 1.
[0251] Image 1 can be the image obtained after processing the original image based on the image processing procedure corresponding to the portrait mode.
[0252] The image processing steps for portrait mode may include one or more of the following: skin beautification, hair optimization, bokeh removal, color correction, vignetting, or blurring. Color correction may include color correction based on a 3D look-up table (3D LUT).
[0253] Raw images (or RAW images) can be unprocessed or uncompressed images captured by a camera. The image format of raw images can be RAW.
[0254] The shooting parameters corresponding to image 1 can be generated synchronously when image 1 is captured. For example, the shooting parameters corresponding to image 1 can include one or more of the following: focus position information 1, aperture information 1, image 0, or depth image 1, etc.
[0255] Focal position information can be understood as two-dimensional coordinates that indicate the focal position, that is, the coordinates corresponding to the focal position.
[0256] For example, in response to the user Figure 1AIn the preview window 101, for any area click operation, the electronic device can determine the location of the click operation as the focus position; or, the electronic device can automatically detect the shooting object in the preview window 101 and determine the location of the shooting object (or the face of the shooting object) as the focus position. In this embodiment, the method of obtaining the focus position is not limited.
[0257] Aperture information can be understood as information that indicates the size of the aperture, i.e., the F-number.
[0258] For example, in electronic devices based on Figure 1B When the slider 112 is set to F4, the aperture information 1 can be F4. Alternatively, the electronic device can automatically generate aperture information 1 based on the subject being photographed even if the user does not adjust the F-value. In this embodiment, the method of obtaining aperture information is not limited.
[0259] Depth image 1 contains the depth information of any pixel in image 1.
[0260] For example, S601 may include: in response to the user clicking the shutter button in portrait mode, the camera application obtains the portrait mode identifier, generates the shooting parameters corresponding to image 1, and instructs the camera to acquire 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 procedure corresponding to the portrait mode based on the portrait mode identifier, processes the original image to obtain image 1 through the image processing procedure corresponding to the portrait mode and the shooting parameters corresponding to image 1, and the camera algorithm library returns image 1 to the camera application.
[0261] Optionally, the shooting parameters corresponding to Image 1 may also include: high dynamic range (HDR) information and / or watermark information, etc.
[0262] S602, The camera application displays image 1 on the monitor.
[0263] S603, the camera app sends image 1 and the corresponding shooting parameters to the gallery app.
[0264] The gallery application can receive image 1 and the corresponding shooting parameters for image 1.
[0265] S604, the gallery application stores image 1 and the shooting parameters corresponding to image 1.
[0266] For example, a gallery application may include a storage module, which can store image 1 and the corresponding shooting parameters of image 1 into the storage module.
[0267] S605-S609 can be used as a schematic diagram of the process by which an electronic device determines whether to display the blur adjustment button after the user views a large image of image 1 in the gallery application.
[0268] S605, In response to the user's operation of viewing a large image of image 1 in the gallery application, the large image preview module obtains the identifier of image 1, and obtains image 1 and the shooting parameters corresponding to image 1 based on the identifier of image 1.
[0269] The actions a user takes to view a larger version of image 1 in the Gallery app can include: the user's actions regarding... Figure 4A Clicking on the thumbnail 402.
[0270] Optionally, after S605, the gallery app can perform system configuration item verification and execute the steps shown in S606 if the system configuration item verification passes. For example, the gallery app can call relevant methods to obtain the phone's system configuration items. If the gallery app detects that the system configuration items contain information (or identifiers) indicating that the device supports bokeh capabilities, the gallery app can determine that the system configuration item verification has passed.
[0271] Alternatively, if the gallery app detects that the system configuration items do not contain information (or identifiers) indicating that the device supports bokeh capabilities, the gallery app can determine that the system configuration item verification has failed. In this case, the gallery app can invoke the module displayed in the control interface to... Figure 4B The message displayed is message 3, which can be used to indicate that the image does not support blurring editing.
[0272] In this way, the gallery app can verify through system configuration items whether the device's underlying capabilities support image blurring, thereby improving the security of subsequent blurring editing.
[0273] S606, The large image preview module determines whether to generate a blur adjustment button.
[0274] For example, if the large image preview module detects focus position information and aperture information in the shooting parameters corresponding to image 1, the step shown in S608 is executed; or, if the large image preview module does not detect focus position information and / or aperture information, the step shown in S607 is executed.
[0275] It is understandable 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 when it detects focus position information 1 and aperture information 1. Alternatively, when the electronic device captures Image 6 in night 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 be configured by calling the init() method. Figure 4B Initialize the buttons in the middle. Figure 4B During the initialization process of the buttons, the large image preview module can determine whether to generate a blur adjustment button.
[0277] S607, the large image preview module does not generate a blur adjustment button.
[0278] S608, Large Image Preview Module generates blur adjustment button.
[0279] The blur adjustment button can be used to adjust the blur. Figure 4B The blur adjustment button 404 in the middle.
[0280] S609, the large image preview module displays image 1 and the blur adjustment button on the display screen.
[0281] For example, after S608, electronic devices can... Figure 4B Image 1 is displayed in the middle, along with the blur adjustment button 404.
[0282] S610-S617 can be interpreted as an electronic device blurring image 0 and then displaying compressed image 2 in response to a user clicking the blur adjustment button.
[0283] S610, in response to the user clicking the blur adjustment button, the blur editing module reads the shooting parameters corresponding to image 1 and converts the format of image 0 from JPEG to YUV.
[0284] In YUV, Y represents luminance information, and U and V represent chrominance information.
[0285] For example, the bokeh editing module can use the parseFile() method to read the shooting parameters corresponding to image 1 and convert the format of image 0 from JPEG to YUV.
[0286] Understandably, based on the description in S605, since images in YUV format occupy less storage space, electronic devices can save resources when performing 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 blurring editing module can perform the step of converting the format of image 0 from YUV to bitmap to obtain the size of image 0. Understandably, when image 0 is in YUV format, the electronic device cannot determine its size. Therefore, by converting image 0 to bitmap, its size can be determined so that subsequent image compression processing can be performed based on its size. The step of converting image 0 from YUV to bitmap can also be implemented by calling the parseFile() method.
[0288] Optionally, after the bokeh editing module reads the shooting parameters corresponding to image 1, the bokeh editing module can perform data verification and system configuration item verification, and display the result as shown below after the data verification and system configuration item verification are completed. Figure 4C The error message 425 appears. Alternatively, if the blurring editing module determines that data verification has failed and / or system configuration item verification has failed, the blurring editing module can invoke the module displayed on the control interface to... Figure 4C The system displays message 2, which can be used to indicate that data parsing failed.
[0289] For example, in data verification, the bokeh editing module can determine that data verification has passed if the read data (such as the shooting parameters corresponding to image 1) is not empty and the format of image 0 has been successfully converted from JPEG to YUV. Alternatively, the bokeh editing module can determine that data verification has failed if the read data (such as the shooting parameters corresponding to image 1) is empty or the format of image 0 has failed to be converted from JPEG to YUV.
[0290] The specific implementation of system configuration item verification can be found in the description in S605, and will not be repeated here.
[0291] Optionally, the blurring editing module can also read watermark information by calling loadWaterMarkInfo().
[0292] Optionally, after S610, the bokeh editing module can store image 0 (YUV format) in the camera application's storage module for later use.
[0293] S611, The blur editing module sends request 1 (image 0 (YUV format), focus position information 1, aperture information 1, and depth image 1) to the media platform.
[0294] It is 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 blurring editing module can send request 1 to WideAperturePhotoUtil by calling sendProcessRequest(). WideAperturePhotoUtil can contain methods that the media platform needs to call; that is, WideAperturePhotoUtil can implement the message receiving and sending steps that the media platform needs to perform.
[0296] Optionally, request 1 may also include message 1 indicating that data verification has passed. This allows the camera algorithm library to avoid performing an additional data verification process when message 1 is detected, thus saving algorithm steps.
[0297] S612, The media 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 a request to the camera algorithm library by calling sendProcessRequest().
[0299] S613. In response to request 1, the camera algorithm library performs a blurring process on image 0 (YUV format), focus position information 1, aperture information 1, and depth image 1 to obtain image 2.
[0300] For example, when the camera algorithm library detects image 0 (YUV format), focus position information 1, aperture information 1, and depth image 1 in request 1, it can blur image 0 based on focus position information 1, aperture information 1, and depth image 1 to obtain image 2. Image 2 can be in YUV format. The camera algorithm library can preset a blurring algorithm, and can input focus position information 1, aperture information 1, depth image 1, and image 0 into the blurring algorithm. The blurring algorithm can then output the blurred image 2.
[0301] Optionally, the camera algorithm library can also perform image processing procedures on image 0, such as 3DLUT processing and vignetting.
[0302] Optionally, image 0 may carry information 1 indicating that the beautification / skin smoothing function is enabled. If image 0 carries information 1, the camera algorithm library can continue to perform beautification / skin smoothing processing on image 0 based on this information 1. Thus, when a user enables the beautification / skin smoothing function in portrait mode, the electronic device can also perform the beautification / skin smoothing algorithm on image 0 from the camera algorithm library to ensure consistent image quality.
[0303] S614, the camera algorithm library sends image 2 (YUV format) to the media center.
[0304] S615, The media platform sends image 2 (YUV format) to the blurring editing module.
[0305] For example, WideAperturePhotoUtil can return Image2 (YUV format) to the blur editing module by calling the callback() method.
[0306] Optionally, after S615, the blurring editing module can perform data verification on image 2 (YUV format) and execute the steps shown in S616 when the data verification passes.
[0307] For example, the data verification process may include: when the blurring editing module detects that the data received from the media platform (i.e., image 2) is not empty, it determines that the data verification has passed. Alternatively, the blurring editing module may determine that the data verification has failed when it detects that the data received from the media platform (i.e., image 2) is empty. In this case, the blurring editing module may call the module that controls the display of the interface, so that prompt message 1 can be displayed on the interface. Prompt message 1 can be used to indicate that an error has occurred in the user interface.
[0308] In this way, electronic devices can increase data security through data verification and reduce algorithm anomalies caused by empty data.
[0309] S616, The blurring editing module compresses image 2 according to the compression ratio to obtain compressed image 2, and converts the focus position information 1 of image 2 into focus position information 2.
[0310] The compression ratio can be a preset value.
[0311] For example, with a compression ratio of 39.5% and image 2 having a size of 3648×2736, the blurring editing module can multiply the size of image 2 by the compression ratio to determine that the compressed image 2 will have a size of approximately 1440×1080. In this way, the electronic device can save resources in subsequent processing algorithms by compressing image 2. For instance, the blurring editing module can compress image 2 by calling onInitSuccess().
[0312] Image position information 2 can be obtained by processing focus position information 1 based on the compression ratio.
[0313] For example, with a compression ratio of 39.5% and focus position information 1 being (2400, 1200), the blurring editing module can multiply the values of each coordinate axis in focus position information 1 by the compression ratio to obtain focus position information 2, which can be (948, 474).
[0314] Optionally, the compression ratio may be related to the chip type of the electronic device and / or the image ratio of image 2, as described in the following descriptions of methods 1-3.
[0315] Method 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 correspondence between compression ratio and chip type, as shown in Table 1.
[0317] Table 1. Schematic diagram of the correspondence 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, electronic devices can pre-configure appropriate compression ratios based on the attributes of the chip type, thereby improving data processing capabilities through suitable compression.
[0321] Method 2: The compression ratio can be related to the image ratio of image 2 (or the image ratio of image 0), etc.
[0322] It is understandable that before image 2 is compressed, the image size of image 2 is the same as that of image 0, and the image ratio of image 2 is the same as that of image 0. The image ratio of image 0 can be the information carried by image 0 itself when the blurring processing module receives image 0.
[0323] In this scenario, the blurring editing module can pre-store the correspondence between compression ratio and image ratio, as shown in Table 2.
[0324] Table 2. Correspondence between compression ratio and image aspect 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, with image 2 having dimensions of 3648×2736, the blurring module can calculate that the image ratio is approximately 4:3, and then determine the compression ratio as 39.5% using Table 2. The blurring editing module can multiply the dimensions of image 2 by the compression ratio to determine that the compressed image 2 has dimensions of approximately 1440×1080.
[0327] Similarly, with image 2 having a size of 2736×2736 (approximately 1:1 aspect ratio), the compressed image 2 can be approximately 1080×1080. With image 2 having a size of 3648×1656 (approximately 3:2 aspect ratio), the compressed image 2 can be approximately 2384×1080. With image 2 having a size of 3648×2052 (approximately 16:9 aspect ratio), the compressed image 2 can be approximately 1920×1080. With image 2 having a size of 3420×2736 (approximately 5:4 aspect ratio), the compressed image 2 can be approximately 1350×1080.
[0328] In this way, electronic devices can pre-configure an appropriate compression ratio based on the image ratio, thereby improving data processing capabilities through suitable compression.
[0329] Method 3: The compression ratio can be related to the image ratio of image 2 and the chip type.
[0330] In this scenario, the bokeh editing module can pre-store the correspondence between compression ratio, chip type, and image ratio, as shown in Table 3.
[0331] Table 3. 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 blurring processing module can calculate that the image ratio of image 2 is approximately 3:2, and then determine the compression ratio as 65.6% using Table 3. The blurring 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, electronic devices can pre-configure an appropriate compression ratio based on the image ratio and chip type, thereby improving data processing capabilities through suitable compression.
[0335] It should be noted that the chip type, image ratio, and compression ratio provided in Tables 1-3 are merely examples and do not constitute a limitation on the embodiments of this application.
[0336] Optionally, the gallery application can pre-compress image 0, and image 2 can have the same size as image 0. For example, before executing S616, the blurring editing module can determine the maximum processing size related to the image ratio of image 2. If it is determined that the size of image 2 is greater than the maximum processing size, the step shown in S616 can be executed. Alternatively, if the blurring editing module determines that the size of image 2 is less than the maximum processing size, the step of compressing image 2 in S616 can be omitted.
[0337] The correspondence between image ratio and maximum processing size can be shown in Table 4.
[0338] Table 4 illustrates the relationship between image aspect ratio and maximum processing size.
[0339]
[0340]
[0341] For example, given that image 2 has a size of 1540×1120 and an aspect ratio of approximately 4:3, the blurring editing module can determine the maximum processing size to be 1440×1080 based on Table 4. Then, image 2 is compressed. For instance, by using the compression ratio of 39.5% described in Table 2, image 2 can be compressed to a size of approximately 608×427; or, by compressing image 2 to the maximum processing size, the compressed image 2 can be approximately 1440×1080.
[0342] For example, if the size of image 2 is 1280×1025 and the image ratio is approximately 5:4, the electronic device can determine the maximum processing size to be 1350×1080 based on Table 4. Since the size of image 2 is smaller than the maximum processing size, the blurring editing module does not need to compress image 2.
[0343] Based on the description in S616, for example, the blur editing module can compress image 2 by calling the onInitSuccess() method.
[0344] Optionally, after S616, if the shooting parameters corresponding to image 1 contain watermark information, the blur editing module can also add watermark information to the compressed image 2 to ensure the consistency of image data.
[0345] S617, The blurring editing module displays the compressed image 2 on the monitor.
[0346] For example, electronic devices can Figure 4C The compressed image 2 is displayed in the preview window 400.
[0347] Understandably, electronic devices can perform tasks related to S605-S617. Figure 4C Initialize all content within. For example... Figure 4C In the preview window 400, the image displayed can be: compressed image 2, the focus position information defined by the focus frame 423 can be: focus position information 2, and the F value displayed in the slider 424 can be aperture information 1.
[0348] Based on this, the electronic device can verify whether a blur adjustment button can be generated when it detects that a user is viewing a large image of image 1 in the gallery application; if the blur adjustment button is displayed, the device can complete the operation in response to the user clicking the blur adjustment button. Figure 4C The initialization process is implemented. Figure 4C The display is normal.
[0349] Based on Figures 5-6 The corresponding implementation plan is complete. Figure 4C In the case of interface initialization, the electronic device can be based on Figure 7-8 In a corresponding embodiment, the focus position and / or aperture information can be updated in the bokeh editing interface.
[0350] Figure 7 This is a schematic flowchart illustrating another image processing method provided in an embodiment of this application. Figure 7 In the corresponding embodiment, updating the focus position information in the bokeh editing interface is used as an example for illustration. The process of updating the aperture information in the bokeh editing interface is similar to... Figure 7 Similar to the case in China, 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 the user's operation of updating the focus position in the blur editing interface, the gallery application obtains the focus position information 3.
[0353] The blurred editing interface can provide Figure 4C The interface shown.
[0354] The user's operation to update 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 are not limited in this embodiment.
[0355] The meaning of focus position information 3 can be found in the description in S801.
[0356] Following S701, the gallery application can send request 2 to the camera algorithm library, causing the camera algorithm library to perform the steps shown in S702 in response to request 2. The content of request 2 can be found in the description in S802.
[0357] S702, the camera algorithm library performs image blurring 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, Gallery Application Execution Data Verification 3.
[0360] The process of data verification based on Image 3 (YUV format) for image library applications can be found in the description in S806.
[0361] If the gallery application determines that data verification 3 has passed, S704 can be executed; or, if the gallery application determines that data verification 3 has failed, prompt message 1 can be displayed on the screen. The content of prompt message 1 can be found in the description in S615.
[0362] S704, the gallery application performs image format conversion.
[0363] For example, a gallery application can convert image 3 from YUV format to bitmap format. The image format conversion process can be found in the description in S807.
[0364] S705, Gallery Application Execution Data Verification 4.
[0365] The process of data verification based on image 3 (bitmap format) for the gallery application can be found in the description in S807.
[0366] Once the gallery application determines that data verification 7 has passed, S706 can be executed; or, once the gallery application determines that data verification 3 has failed, prompt message 1 can be displayed on the screen.
[0367] S706, Gallery application displays images on the monitor 3.
[0368] For example, the process by which the gallery application displays image 3 on the monitor can be found in the description in S808.
[0369] based on Figure 7 The description in the text, Figure 8This is a schematic diagram of module interaction for another image processing method provided in an embodiment of this application.
[0370] like Figure 8 As shown, an electronic device may include: a gallery application, a media platform, and a camera algorithm library. The gallery application may include: a bokeh editing module. The meaning of any of these modules can be found in [reference needed]. Figure 3 The description in the text will not be repeated here.
[0371] exist Figure 8 In the corresponding embodiments, S801-S808 can be a schematic diagram of the process when the electronic device receives the user's update of the focus position in the bokeh editing interface; S809-S815 can be a schematic diagram of the process when the electronic device receives the user's update of the aperture information in the bokeh editing interface.
[0372] like Figure 8 As shown, the image processing method may include the following steps:
[0373] S801, In response to the user's operation of updating the focus position in the blur editing interface, the blur editing module obtains the focus position information 3.
[0374] The blurred editing interface can provide Figure 4C The interface shown. Figure 4C The preview window 400 can display the compressed image 2 and the focus frame 423, which can define the focus position information 2.
[0375] The user's operation to update 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 are not limited in this embodiment.
[0376] For example, in response to a user's click operation on any position in the preview window 400, the blur editing module can determine the position where the click operation occurred as the focus position information 3. Alternatively, in response to a user's drag operation in the preview window 400 to move the focus frame 423 to any position, the electronic device can determine the position where the drag operation ended as the focus position information 3. In this embodiment, the method of obtaining the focus position information 3 is not limited.
[0377] Specifically, in response to a user's click operation at any location in the preview window 400, the blurring editing module can obtain the location of the click operation, i.e., location 1 (x1, y1), which can be the position of the click operation relative to the display screen. Since the image size is generally smaller than the display screen size, the blurring editing module can calculate the position of the click operation relative to the image, i.e., location 2 (x1*2 / 3, y1*2 / 3), when the ratio between the image size and the display screen size is determined to be 2 / 3. Further, when the blurring editing module detects that the image compression ratio is 1 / 2, it calculates location 3 (x1*1 / 3, y1*1 / 3), which can be the focus position information 3. The image compression ratio can be determined based on S616.
[0378] It is understandable that the blurring editing module can execute the steps shown in S802 if it detects that the focus position information 3 is different from the focus position information 2; or, if the blurring editing module can detect that the focus position information 3 is the same as the focus position information 2, it can choose not to execute any steps.
[0379] S802, the blur editing module sends request 2 (compressed image 2, focus position information 3, aperture information 1, and depth image 1) to the media platform.
[0380] For example, request 2 could include: focus position information 3, aperture information 1, depth image 1, and compressed image 2. For instance, the bokeh editing module could 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 performs blurring processing on image 0 based on focus position information 3, aperture information 1, and depth image 1 to obtain image 3.
[0382] S803, the media platform 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 a request 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 focus position information 3, aperture information 1, and depth image 1 to obtain image 3.
[0385] Understandably, in response to request 2, the camera algorithm library can determine the layer in depth image 1 where focus position 3 is located using focus position information 3 and depth image 1. For example, if focus information 3 is located in target layer 1 (such as the layer where the building is located) in depth image 1, the electronic device can blur other layers besides target layer 1 based on aperture information 1 to obtain image 3.
[0386] Image 3 can be in YUV format, and its size is the same as that of the compressed image 2.
[0387] Following S804, the camera algorithm library can store Image 3 (YUV format) for subsequent algorithm calls. Image 3 (YUV format) can be associated with focus position information 3, aperture information 1, and depth image 1.
[0388] The S805 camera algorithm library sends image 3 (YUV format) to the media center.
[0389] S806, the media middle platform sends image 3 (YUV format) to the blurring editing module.
[0390] For example, WideAperturePhotoUtil can return image 3 (YUV format) to the blur editing module by calling the callback() method.
[0391] Optionally, after S806, the blurring editing module can perform data verification on image 3 (YUV format) and execute the steps shown in S807 when the data verification passes.
[0392] For example, the data verification process may include: when the blurring editing module detects that the data received from the media platform (i.e., image 3) is not empty, it determines that the data verification has passed. Alternatively, the blurring editing module may determine that the data verification has failed when it detects that the data received from the media platform (i.e., image 3) is empty. In this case, the blurring editing module can call the module controlling the interface display, so that prompt message 1 can be displayed on the interface. The function of prompt message 1 can be found in the description in S616. In this way, the electronic device can increase data security through data verification and reduce algorithm anomalies caused by empty data.
[0393] S807, the blurring editing module converts image 3 from YUV format to bitmap format.
[0394] Following S807, the blurring editing module can send image 3 (bitmap format) to the module used to control the interface display, enabling the electronic device to... Figure 4E Image 3 (bitmap format) is displayed in the preview window 400. This is understandable, compared to... Figure 4CThe focus frame 423 in the middle, Figure 4E The position of the focus frame 432 changes, but the F-value remains the same.
[0395] For example, the blurring editing module can convert the format of image 3 from YUV to bitmap format by calling the nv21ToBitmap() method.
[0396] Optionally, after S807, the blurring editing module can verify whether the format conversion of image 3 is successful, and after successful data format conversion, send image 3 (bitmap format) to the module used to control the interface display, so that the electronic device can... Figure 4E Image 3 (bitmap format) is displayed in the preview window 400. Alternatively, if the blurring editing module determines that the format of image 3 has not been successfully converted, a prompt message 1 can be displayed in the interface through the module used to control the interface display.
[0397] Optionally, after S807, if the shooting parameters corresponding to image 1 contain watermark information, the bokeh editing module can also add watermark information to image 3 to ensure the consistency of image data.
[0398] S808, the blurring editing module displays image 3 on the screen.
[0399] For example, electronic devices can Figure 4G Image 3 (bitmap format) is displayed in the preview window 400. The building areas in Image 3 are in sharp focus, while other areas in Image 3 are blurred.
[0400] S809. In response to the user's operation of updating aperture information in the bokeh editing interface, the bokeh editing module obtains aperture information 2.
[0401] The user's actions for updating aperture information in the bokeh editing interface can include: the user... Figure 4C The present application embodiment does not limit the click operation on any sliding position in the slider 424, or the user's sliding operation to the left or right in the slider 424.
[0402] For example, in response to the user Figure 4C For a click operation on any sliding position in the slider 424, the electronic device can determine the F-value at the location of the click operation as aperture information 2. Alternatively, in response to a user's left or right sliding operation in the slider 424, the electronic device can determine the F-value at the end position of the sliding operation as aperture information 2.
[0403] It is understandable that the bokeh editing module can execute the steps shown in S810 if it detects that aperture information 2 is different from aperture information 1; or, if the bokeh editing module can detect that aperture information 2 is the same as aperture information 1, it can choose not to execute any steps.
[0404] S810, the blur editing module sends request 3 (compressed image 2, focus position information 2, aperture information 2, and depth image 1) to the media platform.
[0405] For example, request 3 may include: aperture information 2, focus position information 2, depth image 1, and compressed image 2. For example, the bokeh editing module can 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 performs blurring processing on image 0 based on focus position information 2, aperture information 2, and depth image 1 to obtain image 4.
[0407] S811, the media 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 a request 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 aperture information 2, focus position information 2, and depth image 1 to obtain image 4.
[0410] Image 4 can be in YUV format, and its size is the same as that of the compressed image 2.
[0411] Following S812, the camera algorithm library can store Image 4 (YUV format) for subsequent algorithm calls. Image 4 (YUV format) can 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 middle platform sends image 4 (YUV format) to the blur editing module.
[0414] For example, WideAperturePhotoUtil can return image 4 (YUV format) to the blur editing module by calling the callback() method.
[0415] Optionally, after S814, the blur editing module can perform data verification on image 4 (YUV format) and execute the steps shown in S815 when the data verification passes.
[0416] For example, the data verification process could include: the blurring editing module determining that data verification passed when it detects that the data received from the media platform (i.e., image 4) is not empty. Alternatively, the blurring editing module could determine that data verification failed when it detects that the data received from the media platform (i.e., image 4) is empty. In this case, the blurring editing module could call the module controlling the interface display, causing the interface to display prompt message 1. In this way, electronic devices can increase data security through data verification and reduce abnormal situations caused by empty data.
[0417] S815, the blurring editing module converts image 4 from YUV format to bitmap format.
[0418] Following the S815, the blurring editing module can send image 4 (bitmap format) to the module used to control the interface display, enabling electronic devices to... Figure 4D Image 4 (bitmap format) is displayed in preview window 400. This is understandable, compared to... Figure 4C The F-value (e.g., F2.4) in the text. Figure 4D The position of the focus frame 423 can remain unchanged even if the F value (such as F16) changes.
[0419] Optionally, after S815, the blur editing module can verify whether the format conversion of image 4 was successful, and after successful data format conversion, send image 4 (bitmap format) to the module used to control the interface display, so that the electronic device can... Figure 4D Image 4 (bitmap format) is displayed in the preview window 400. Alternatively, if the blurring editing module determines that the format of image 4 has not been successfully converted, a prompt message 1 can be displayed in the interface through the module used to control the interface display.
[0420] Optionally, after S815, if the shooting parameters corresponding to image 1 contain watermark information, the bokeh editing module can also add watermark information to image 4 to ensure the consistency of image data.
[0421] S817, the blurring editing module displays image 4 on the monitor.
[0422] For example, electronic devices can Figure 4DImage 4 (bitmap format) is displayed in preview window 400. The building areas in Image 3 are in sharp focus, while other areas in Image 4 (excluding the people area) are blurred, with the degree of blurring varying from the image's perspective. Figure 4C Different from China.
[0423] Understandable Figure 8 This refers to the image processing procedures performed by the electronic device when the user updates the focus position or the aperture information. Figure 8 The described sequence of steps is merely an example; for instance, a user might update the aperture position after updating the focus position, or vice versa. The specific implementation process is different from... Figure 8 Similar to the description in the text, I will not repeat it again.
[0424] Based on this, when the electronic device detects that the user has updated the focus position or aperture information, it can re-blur the compressed image 2 based on the updated focus position information 3 or aperture information 2, thereby achieving real-time refresh of the image in the preview window 400, allowing the user to view the blurring editing results in the preview window 400 at any time.
[0425] Based on Figures 7-8 In the corresponding embodiment, when the focus position is updated, the electronic device can be based on Figures 9-10 The corresponding implementation method saves the image.
[0426] Figure 9 This is a schematic flowchart illustrating another image processing method provided in an embodiment of this application. Figure 9 As shown, the image processing method may include the following steps:
[0427] S901, In response to the user clicking the save button in the blur editing interface, the gallery application obtains focus position information 3.
[0428] The save button can be Figure 4E The save button 421.
[0429] For a description of how to obtain focus position information, please refer to the description in S1001.
[0430] Following S901, the gallery application can send request 4 to the camera algorithm library, causing the camera algorithm library to respond to request 4 and perform the steps shown in S902. The contents of request 4 can be found in the description in S1001.
[0431] S902, camera algorithm library acquires images 3.
[0432] For example, in response to request 4, the camera algorithm library can acquire image 3 (YUV format) and return image 3 (YUV format) to the image library application. The process by which the camera algorithm library acquires image 3 (YUV format) can be found in the description in S1003.
[0433] S903, Gallery Application Execution Data Verification 5.
[0434] The process of data verification based on image 3 (YUV format) for the image library application can be found in the description in S1005.
[0435] Once the gallery application determines that data verification 5 has passed, S904 can be executed; or, once the gallery application determines that data verification 5 has failed, prompt message 1 can be displayed on the screen.
[0436] S904, Image Gallery Application retrieves image 3 (bitmap format).
[0437] The process of obtaining image 3 (bitmap format) by the gallery application can be found in the description in S1006.
[0438] S905, the image library application enlarges image 3 to obtain image 5.
[0439] The process of the image library application magnifying image 3 can be found in the description in S1007.
[0440] S906, Gallery application updates image 5, the edit time of image 5, and the thumbnail of image 5.
[0441] The process of updating image 5, the editing time of image 5, and the thumbnail of image 5 can be found in the descriptions in S1007-S1009.
[0442] based on Figure 9 The description in the text, Figure 10 This can be a schematic diagram of module interaction for another image processing method provided in the embodiments of this application.
[0443] like Figure 10 As shown, an electronic device may include: a gallery application, a media platform, and a camera algorithm library. The gallery application may include: a large image preview module and a bokeh editing module. The meaning of any of these modules can be found in [reference needed]. Figure 3 The description in the text will not be repeated here.
[0444] exist Figure 10 In the corresponding embodiment, the electronic device is based on Figure 8 Taking the process of updating the focus position information by steps S801-S808 and obtaining image 3 (bitmap) based on the updated focus position information as an example, the specific implementation process of saving image 3 is described.
[0445] like Figure 10 As shown, the image processing method may include the following steps:
[0446] S1001. In response to the user clicking the save button in the bokeh editing interface, the bokeh editing button sends request 4 (compressed image 2, focus position information 3, aperture information 1, and depth image 1) to the media platform.
[0447] It is understandable that, when the electronic device updates the focus position information based on S801-S808 and then saves the image, the content that can be included in request 4 can be the same as the content that can be included in request 2. For example, request 4 can include: focus position information 3, aperture information 1, depth image 1, and compressed image 2.
[0448] For example, in response to the user clicking the save button in the blur editing interface, the blur editing module can obtain the focus position information 3, and then the blur editing module can send a request to WideAperturePhotoUtil by calling the generateNormalPhoto() method 4.
[0449] S1002, The media platform sends request 4 (compressed image 2, focus position information 3, aperture information 1, and depth image 1) to the camera algorithm library.
[0450] For example, WideAperturePhotoUtil can send a request to the camera algorithm library by calling the sendProcessRequest() method.
[0451] S1003, the camera algorithm library acquires 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 from request 4, it can acquire image 3 (YUV format) related to the focus position information 3, aperture information 1, and depth image 1. Image 3 (YUV format) can be pre-generated by the camera algorithm library based on S804.
[0453] S1004, The camera algorithm library sends image 3 (YUV format) to the media center.
[0454] S1005, The media platform sends image 3 (YUV format) to the blurring editing module.
[0455] For example, WideAperturePhotoUtil can return image 3 (YUV format) to the blur editing module by calling the callback() method.
[0456] Optionally, after S1005, the blurring editing module can perform data verification on image 3 (YUV format), and execute the steps shown in S1006 if the data verification passes. The data verification process can be found in the description of S806, and will not be repeated here.
[0457] S1006, the blurring editing module converts the format of image 3 from YUV format to bitmap format.
[0458] It is understandable that the steps for the blurring editing module to perform format conversion on image 3 can be found in the description of S807, and will not be repeated here.
[0459] Optionally, if the blurring editing module obtains and stores image 3 (bitmap format) in advance in S807, the blurring editing module can also obtain image 3 (bitmap format) without performing the steps shown in S1006.
[0460] S1007 The blurring editing module enlarges 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 compression ratio and the method of obtaining compression ratio can be found in the description in S616, and will not be repeated here.
[0462] For example, with a compression ratio of 39.5% and image 3 having a size of 1440×1080, the blurring 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. Figure 4B In the interface.
[0463] Understandably, the blurring editing module can update the editing time of image 5 to the time the user clicked the save button. Furthermore, the blurring editing module can generate a thumbnail of image 5, allowing the thumbnail to be displayed. Figure 4A The interface shown.
[0464] For example, the blurring editing module can call the onSaveCallBackSuccess() method to perform a step of enlarging image 3 based on the compression ratio.
[0465] S1008, The blurring module sends message 3 to the gallery application.
[0466] Message 3 may include one or more of the following: image 5, the editing time of image 5, or a thumbnail of 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] 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 app can save message 3 to the storage module in the gallery app by calling the save() method.
[0470] S1010, the gallery application displays image 5 on the monitor.
[0471] For example, electronic devices can Figure 4H Image 5 is shown in the image. The building areas in Image 5 are in sharp focus, while other areas in Image 5 are blurred.
[0472] S1011. In response to the user's action of closing the gallery application, the gallery application may send a message to the media platform instructing the gallery application to close.
[0473] S1012, The media platform sends a message to the camera algorithm library to instruct the gallery application to close.
[0474] S1013, Camera algorithm library releases system resources.
[0475] System resources may include memory resources and / or CPU resources, etc., but this embodiment does not limit the scope of these resources. In this way, the camera algorithm library can improve system performance by freeing up system resources.
[0476] In this way, when the user reopens the gallery app, the electronic device can display a thumbnail of image 5, and in response to the user's click on the thumbnail of image 5, the electronic device can display... Figure 4H The interface shown.
[0477] Based on this, the electronic device can save the updated image 5 and related information to the gallery application when it detects that the user has clicked the save button, so that it can be viewed later.
[0478] based on Figures 5-10 The description in the document is for the purpose of more clearly illustrating the image processing method provided in the embodiments of this application. Figure 11This is a schematic flowchart illustrating another image processing method provided in an embodiment of this application. Figure 11 In corresponding embodiments, the image processing method may involve: a gallery editing front-end processing process, a gallery editing back-end processing process, and a camera shooting post-processing process, etc.
[0479] After the electronic device detects that the user clicked the blur editing button, the electronic device can acquire image 0, and obtain image 2 by blurring image 0 and other images, and then convert image 2 from YUV to bitmap.
[0480] When the electronic device detects that the user is adjusting the focus position or aperture, it can generate new focus position information or new aperture information. Based on the new focus position information or new aperture information, image 2 is re-blurred and other image processing is performed on image 2 to obtain image 3 or image 4. Then, image 3 or image 4 is sent to the display.
[0481] The other image processing may include one or more of the following: beautification and skin smoothing, 3DLUT processing, or vignetting processing, etc.
[0482] When the electronic switching device detects that the user clicks the save button, it can generate new focus position information or new aperture information. Based on the new focus position information or new aperture information, it can re-blur image 2, perform other image processing on image 2 to obtain the complete effect image, and perform other editing processing such as magnification on the complete effect image to obtain image 5.
[0483] It should be noted that the interface provided in this application embodiment is only an example and does not constitute a limitation on the embodiments of this application.
[0484] It should be noted that the module names involved in the embodiments of this application can all be defined as other names, as long as they can achieve the function of each module, and no specific restrictions are placed on the module names.
[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, data stored, data displayed, etc.) involved in the embodiments of this application are all information and data authorized by the user or fully authorized by all parties. Furthermore, the collection, use and processing of the relevant data must comply with the relevant laws, regulations and standards of the relevant regions, and corresponding operation entry points are provided for users to choose to authorize or refuse.
[0486] Referring to Figure 4 Figure 11 The description in the text, Figure 12 This is a schematic flowchart illustrating another image processing method provided in an embodiment of this application. Figure 12As shown, the image processing method may include the following steps:
[0487] S1201, In response to the photo-taking operation, acquire the first image data.
[0488] The first image data includes: a first object and a second object. The first object corresponds to a first plane in the first image, and the second object corresponds to a second plane and a first focal position in the first image. The depth information of any pixel in the first plane is different from the depth information of any pixel in the second plane, and the first focal position corresponds to the first plane in the first image.
[0489] Wherein, the first image data can be the shooting parameters corresponding to image 0 or image 1 as described in the embodiments of this 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 plane 3. The first focal position can be focal position information 1. The first image can be image 0.
[0490] S1202. Based on the first image data, the second object in the first image is blurred to obtain the second image.
[0491] It is understandable that, since the first focal point location information is located on the first plane in the first image, the electronic device can retain the clarity of the first object in the first image by blurring the second object in the first image.
[0492] The second image can be image 1 (or image 2).
[0493] S1203. In response to the operation of opening the first interface of the gallery application, display the first interface of the gallery application.
[0494] The first interface includes: a second image and a first button. The first interface can be... Figure 4B The interface shown has a first button that can be... Figure 4B The blur adjustment button 404 in the middle.
[0495] S1204. In response to the operation of the first button, the second image is compressed and the compressed image is displayed on the second interface.
[0496] Specifically, during the compression process of the second image by the electronic device, the electronic device can determine the first image ratio corresponding to the second image and record the first size corresponding to the second image; based on the correspondence between the image ratio and the preset size, determine the second size corresponding to the first image ratio, 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, 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 compress the second image.
[0498] It is understood that other methods for compressing the second image can be found in the description in S616.
[0499] The second interface can be Figure 4C The interface shown.
[0500] After the electronic device displays the second interface, it can update the focus position information and save the image with the updated focus position information based on the steps shown in S1205-S1208. Alternatively, the electronic device can 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 can be clicking on a building or moving the focus box to the building. The second focus position is different from the first focus position; the second focus position can be focus position information 3.
[0503] S1206. Based on the second image data, the first object in the first image is blurred to obtain a third image, and the third image is displayed in the third interface.
[0504] Optionally, the electronic device can 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 focal position in the first image.
[0506] The third image can be image 3, and the third interface can be... Figure 4E The interface shown. It is understandable that, in Figure 4E In this case, the focus frame 432 can be located at the building.
[0507] S1207. In response to the operation of the save button, the third image is enlarged to the first size to obtain the fifth image.
[0508] The fifth image can be image 5. The save button can be... Figure 4E The save button 422.
[0509] S1208. In response to the operation of opening the fifth interface in the gallery application, display the 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 image.
[0511] S1209. In response to an operation on the slider, obtain the second F value.
[0512] The slider can be Figure 4C The slider 424 described in the text can have a second F value that can be aperture information 2.
[0513] S1210. Based on the third image data, the second object in the first image is blurred to obtain the fourth image, and the fourth image is displayed in the fourth interface.
[0514] Optionally, the electronic device can 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 corresponding to a first plane in the first image, the second object corresponding to a second plane in the first image, a second F value, and a first focal position.
[0516] The fourth image can be image 4, and the fourth interface can be... Figure 4D Understandable, such as Figure 4D As shown in the image. The second F value is 16, therefore the blurring effect is weak after blurring the second object in the first image.
[0517] The display method of the embodiments of this application has been described above. The apparatus for performing the above method provided in the embodiments of this application is described below. Those skilled in the art will understand that the methods and apparatus can be combined and referenced with each other, and the related apparatus provided in the embodiments of this application can perform the steps in the above list sorting method.
[0518] Figure 13 This is a schematic diagram of the hardware structure of another electronic device provided in an embodiment of this application.
[0519] The electronic device includes a processor 1301, a communication line 1304, and at least one communication interface. Figure 13(The example described uses communication interface 1303 as an example).
[0520] The processor 1301 may be a general-purpose CPU, a microprocessor, an application-specific integrated circuit (ASIC), or one or more integrated circuits used to control the execution of programs according to the present application.
[0521] Communication line 1304 may include circuitry for transmitting information between the aforementioned components.
[0522] Communication interface 1303 uses any transceiver-like device for communicating with other devices or communication networks, such as Ethernet, wireless local area networks (WLAN), etc.
[0523] Possibly, the electronic device may also include a memory 1302.
[0524] The memory 1302 may be a read-only memory (ROM) or other type of static storage device capable of storing static information and instructions, random access memory (RAM) or other type of dynamic storage device capable of storing information and instructions, or electrically erasable programmable read-only memory (EEPROM), compact disc read-only memory (CD-ROM) or other optical disc storage, optical disc storage (including compressed optical discs, laser discs, optical discs, digital universal optical discs, Blu-ray discs, etc.), magnetic disk storage media 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 accessible by a computer, but not limited thereto. The memory may exist independently and be connected to the processor via communication line 1304. The memory may also be integrated with the processor.
[0525] The memory 1302 stores computer execution instructions for implementing the scheme of this application, and the processor 1301 controls the execution. The processor 1301 executes the computer execution instructions stored in the memory 1302 to implement the method provided in the embodiments of this application.
[0526] It is possible that the computer execution instructions in the embodiments of this application may also be referred to as application code, and the embodiments of this application do not specifically limit this.
[0527] In a specific implementation, as one example, the processor 1301 may include one or more CPUs, for example... Figure 13 CPU0 and CPU1 in the CPU.
[0528] In a specific implementation, as one example, an electronic device may include multiple processors, for example... Figure 13 Processors 1301 and 1305 are mentioned. Each of these processors can be a single-core (single-CPU) processor or a multi-core (multi-CPU) processor. A processor here can refer to one or more devices, circuits, and / or processing cores used to process data (such as computer program instructions).
[0529] The display method provided in this application can be applied to electronic devices with communication functions. Electronic devices include terminal devices, and the specific device form of the terminal device can be referred to the above-described related descriptions, which will not be repeated here.
[0530] This application provides a terminal device, which includes a processor and a memory; the memory stores computer execution instructions; the processor executes the computer execution instructions stored in the memory, causing the terminal device to perform the above-described method.
[0531] This application provides a chip. The chip includes a processor, which is used to call a computer program in memory to execute the technical solutions in the above embodiments. Its implementation principle and technical effects are similar to those in the related embodiments described above, and will not be repeated here.
[0532] This application also provides a computer-readable storage medium. The computer-readable storage medium stores a computer program. When the computer program is executed by a processor, it implements the methods described above. The methods described in the above embodiments can be implemented wholly or partially by software, hardware, firmware, or any combination thereof. If implemented in software, the functionality can be stored as one or more instructions or code on or transmitted over the computer-readable medium. The computer-readable medium can include computer storage media and communication media, and can also include any medium that can transfer a computer program from one place to another. The storage medium can be any target medium accessible by a computer.
[0533] In one possible implementation, a computer-readable medium may include RAM, ROM, compact disc read-only memory (CD-ROM) or other optical disc storage, disk storage or other magnetic storage devices, or any other medium targeted to carry or to store the required program code in the form of instructions or data structures, and accessible by a computer. Furthermore, any connection is appropriately referred to as a computer-readable medium. For example, if software is transmitted from a website, server, or other remote source using coaxial cable, fiber optic cable, twisted pair, DSL, or wireless technologies such as infrared, radio, and microwave, then coaxial cable, fiber optic cable, twisted pair, DSL, or wireless technologies such as infrared, radio, and microwave are included in the definition of medium. As used herein, disks and optical discs include optical discs, laser discs, optical discs, Digital Versatile Discs (DVDs), floppy disks, and Blu-ray discs, where disks typically reproduce data magnetically, while optical discs optically reproduce data using lasers. Combinations of the above should also be included within the scope of computer-readable media.
[0534] This application provides a computer program product, which includes a computer program that, when run, causes a computer to perform the above-described method.
[0535] This application describes embodiments with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of this application. It will be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processing unit of a general-purpose computer, special-purpose computer, embedded processor, or other programmable device to produce a machine, such that the instructions, which execute via the processing unit of the computer or other programmable data processing device, create means for implementing the functions specified in one or more flowchart illustrations and / or one or more block diagrams.
[0536] The above specific embodiments further illustrate the purpose, technical solution, and beneficial effects of the present invention. It should be understood that the above are merely specific embodiments of the present invention and are not intended to limit the scope of protection of the present invention. Any modifications, equivalent substitutions, improvements, etc., made on the basis of the technical solution of the present invention should be included within the scope of protection of the present invention.
Claims
1. An image processing method, characterized in that, Applied to electronic devices, the method includes: In response to a photo-taking operation, first image data is acquired. The first image data includes: a first object and a second object. The first object corresponds to a first plane in the first image, and the second object corresponds to a second plane and a first focal position in the first image. The depth information of any pixel in the first plane is different from the depth information of any pixel in the second plane. The first focal position corresponds to the first plane in the first image. Based on the first image data, the second object in the first image is blurred to obtain the second image; The first interface of the gallery application is displayed, which includes: the second image and a first button, the first button being used to adjust the blur of the second image; In response to the operation of the first button, determine the first image ratio corresponding to the second image, and record the first size corresponding to the second image; Based on the correspondence between the image ratio and the preset size, a second size corresponding to the first image ratio is determined, wherein the preset size is the maximum size that the electronic device is allowed to perform 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; the compression ratio is related to the image ratio, and / or the compression ratio is related to the chip type of the electronic device; The second interface is displayed, which includes: the compressed second image and a save button; In response to an operation on a second object in the compressed second image, a second focal position is obtained, the second focal position corresponding to a second plane in the compressed second image; The first object in the first image is blurred based on the 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, and the second object corresponds to a second plane and the second focal position in the first image. 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 the preset compression ratio. In response to the operation of the save button, the third image is enlarged to the first size to obtain a fifth image, and the fifth image is stored.
2. The method according to claim 1, characterized in that, The first focal position corresponds to a first plane in the first image, including: the first plane in the first image corresponds to a first focal position range, and the first focal position is located within the first focal position range.
3. The method according to claim 1 or 2, characterized in that, The second image corresponds to the first F value. Following the operation in response to a second object in the second image, the method further includes: acquiring the first F value, the second image data further including the first F value.
4. The method according to any one of claims 1-2, characterized in that, The second interface also includes a slider 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 slider, a second F value is obtained; The second object in the first image is blurred based on the third image data to obtain a fourth image, and the fourth image is displayed. 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-2, 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 YUV to bitmap.
6. The method according to any one of claims 1-2, characterized in that, The first interface also includes: a first identifier, which defines a first object in the second image; Following the operation in response to the second object in the second image, the first identifier frames the second object in the second image.
7. The method according to claim 3, characterized in that, The second image is an image captured by the electronic device in portrait mode or large aperture mode.
8. The method according to claim 7, characterized in that, Prior to responding to an operation on the first button, the method further includes: The first button is generated when the first image data includes the first focus position information and the first F value.
9. The method according to claim 3, characterized in that, The first image data includes depth image data, which 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 image library application and a camera algorithm library. The image library application includes a first module that performs blurring processing on a second object in the first image based on the first image data to obtain a second image, including: The first module acquires the first image data; The first module sends a first request to the camera algorithm library, the first request including: 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 a blurring process on the second object in the first image based on the first image data to obtain the second image.
10. The method according to claim 9, characterized in that, The second image data includes the depth image data. After obtaining the second focus position, the method further includes: the first module sending a second request to the camera algorithm library, the second request including: the second image data; The step of blurring the first object in the first image based on the second focal position to obtain a third image includes: in response to the second request, the camera algorithm library determines that the second focal position corresponds to the second plane; The step of blurring 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.
11. 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, the memory being used to store computer program code, the computer program code including computer instructions, the one or more processors invoking the computer instructions to cause the electronic device to perform the method as described in any one of claims 1 to 10.
12. A chip system, characterized in that, The chip system is applied to an electronic device, the chip system including one or more processors, the one or more processors being used to invoke computer instructions to cause the electronic device to perform the method as described in any one of claims 1 to 10.
13. A computer-readable storage medium, characterized in that, The computer-readable storage medium includes computer instructions that, when executed on an electronic device, cause the electronic device to perform the method as described in any one of claims 1 to 10.
14. A computer program product, characterized in that, The computer program product includes computer program code that, when run on an electronic device, causes the electronic device to perform the method as described in any one of claims 1 to 10.
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