Image processing method, electronic equipment and computer readable storage medium
Calculating the crop area data and offset by non-center cropping method solves the problem of excessive edges of the crop area during zooming, improves the resolution and clarity of the ROI and preview images, and reduces system power consumption.
Patent Information
- Application Number
- CN202410043819.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-01-10
- Publication Date
- 2025-01-03
- Estimated Expiration
- 2044-01-10
AI Technical Summary
During the zoom process, the prior art leads to poor image production results in camera application and large system power consumption, mainly due to the large image edges of the cropped area, which leads to low ROI image resolution and poor preview image sharpness.
The crop area data and offset are calculated using non-center cropping method, and the image processing flow is adjusted to reduce the image edge of the crop area, thereby improving the resolution of the ROI image and the clarity of the preview image, and reducing system power consumption.
Through non-center cropping technology, the resolution of ROI images and the clarity of the preview image are improved, the calculation amount and difficulty of subsequent algorithm processing are reduced, and the system power consumption is reduced.
Smart Images

Figure CN119255090A_ABST
Abstract
Description
Technical Field
[0001] The embodiments of the present application relate to the field of intelligent terminal technology, and specifically to an image processing method, an electronic device, and a computer-readable storage medium. Background Art
[0002] During the zoom process, in order to reduce the incongruity of the picture when the camera switches, it is necessary to crop out the area covering the region of interest (ROI) and with a larger image edge. However, since the camera application is based on ROI output, the resolution of the ROI image obtained from the area with a larger image edge is low, resulting in poor clarity of the preview image. Summary of the invention
[0003] The embodiments of the present application provide an image processing method, an electronic device, and a computer-readable storage medium, which are intended to solve the problem of poor image output effects in camera applications.
[0004] The first aspect of the embodiment of the present application provides an image processing method, which is applied to an electronic device, and the method includes: starting a shooting function based on a camera application, and displaying a first preview image on a preview interface of the camera application. The first preview image includes a target area, the target area is located in a non-central area of the first preview image, and the resolution of the first preview image is a first resolution. In response to a zoom operation and / or a selection operation of the target area, a second preview image is displayed on the preview interface. The second preview image includes a target area, the target area is located in a central area of the second preview image, and the resolution of the second preview image is a second resolution, which is greater than the first resolution.
[0005] In this embodiment, based on the center cropping method, the target area is located in the non-center area of the first preview image. Based on the non-center cropping method, the target area is located in the center area of the second preview image. Since the image edge of the non-center cropped cropping area is smaller than the image edge of the center cropped cropping area, the number of pixels of the target area in the non-center cropped cropping area accounts for a larger proportion than the number of pixels of the target area in the center cropped cropping area. Since the output size of the camera application remains unchanged, the size of the first preview image is the same as that of the second preview image, so that the number of pixels of the target area in the second preview image is greater than the number of pixels of the target area in the first preview image, and thus the resolution of the second preview image is greater than the resolution of the first preview image.
[0006] In one embodiment, the first preview image is associated with a first cropping area based on an original image, and the original image is an image captured by a camera of an electronic device. The first cropping area is located in a central area of the original image, and the first cropping area includes a target area, and the target area is located in a non-central area of the first cropping area. The second preview image is associated with a second cropping area based on the original image. The second cropping area is located in a non-central area of the original image, and the second cropping area includes a target area, and the target area is located in a central area of the second cropping area.
[0007] In another embodiment, in response to a zoom operation and / or a target area selection operation, displaying a second preview image on a preview interface includes: in response to a zoom operation and / or a target area selection operation, calculating non-center cropped cropped area data and an offset between the non-center cropped cropped area data and the center cropped cropped area data. Performing preliminary cropping processing on an original image from a camera of an electronic device according to the non-center cropped cropped area data to obtain a cropped area image. Processing the cropped area image to obtain an image of an area of interest. Processing the image of the area of interest to obtain a second preview image. Displaying the second preview image on the preview interface.
[0008] In another embodiment, the cropped area image is processed to obtain the image of the region of interest, including: performing grayscale transformation on the cropped area image to obtain a grayscale image; detecting a face in the grayscale image according to a face detection algorithm; and processing the cropped area image according to the face detection result to obtain the image of the region of interest.
[0009] In another embodiment, the cropped region image is processed according to the face detection result to obtain the region of interest image, including: based on the face detection result, a face is detected, and a face frame is drawn according to the position and size of the detected face region to obtain a face frame grayscale image. Grayscale inverse transformation is performed on the face frame grayscale image according to the cropped region image and the offset to obtain the face frame image. The face frame image is cropped to obtain the region of interest image.
[0010] In another embodiment, the cropped area image is processed according to the face detection result to obtain the image of the region of interest, including: based on the face detection result that no face is detected, the cropped area image is cropped to obtain the image of the region of interest.
[0011] In another embodiment, processing the cropped region image to obtain the region of interest image includes: spatially aligning the cropped region image according to the offset, zoom ratio and SAT algorithm to obtain a transformed image. Processing the transformed image to obtain the region of interest image.
[0012] In another embodiment, processing the transformed image to obtain the region of interest image includes: performing grayscale transformation on the cropped region image to obtain a grayscale image, detecting a face in the grayscale image according to a face detection algorithm, and processing the transformed image according to the face detection result to obtain the region of interest image.
[0013] In another embodiment, the transformed image is processed according to the face detection result to obtain the region of interest image, including: based on the face detection result, a face is detected, and a face frame is drawn according to the position and size of the detected face region to obtain a face frame grayscale image. Grayscale inverse transformation is performed on the face frame grayscale image according to the transformed image and the offset to obtain the face frame image. The face frame image is cropped to obtain the region of interest image.
[0014] In another embodiment, the transformed image is processed according to the face detection result to obtain the region of interest image, including: based on the face detection result that no face is detected, the transformed image is cropped to obtain the region of interest image.
[0015] In another embodiment, processing the cropped region image to obtain the region of interest image includes: performing cropping processing on the cropped region image to obtain the region of interest image.
[0016] A second aspect of an embodiment of the present application provides an electronic device, which includes a memory, a processor, a camera and a display screen, wherein the display screen is used to display images or videos taken by the camera, the memory is used to store instructions, and the processor is used to run the instructions stored in the memory, so that the electronic device executes the image processing method of the embodiment of the present application.
[0017] A third aspect of an embodiment of the present application provides a computer-readable storage medium, which stores instructions. When the instructions are executed on a computer, the computer executes the image processing method of the embodiment of the present application.
[0018] The technical effects brought about by the second and third aspects of the embodiments of the present application can be found in the relevant description of the image processing method of the first aspect above, and will not be repeated here. BRIEF DESCRIPTION OF THE DRAWINGS
[0019] Figure 1 The software structure diagram of an electronic device provided as an example.
[0020] Figure 2 A schematic diagram of image cropping based on a zoom operation is provided as an example.
[0021] Figure 3A A schematic diagram of selecting a target area is provided as an example.
[0022] Figure 3B yes Figure 3A Schematic diagram of the corresponding image cropping.
[0023] Figure 4 It is a schematic diagram of the software structure of an electronic device provided in one embodiment of the present application.
[0024] Figure 5 It is a schematic diagram of image cropping based on zoom operation provided by an embodiment of the present application.
[0025] Fig. 6A It is a schematic diagram of selecting a target area provided by an embodiment of the present application.
[0026] Figure 6B yes Fig. 6A Schematic diagram of the corresponding image cropping.
[0027] Figure 7 It is a schematic diagram of the interaction of software modules provided in one embodiment of the present application.
[0028] Figure 8 It is a flowchart of an image processing method provided by an embodiment of the present application.
[0029] Fig. 9 yes Figure 8 Flowchart of the sub-steps of step S202.
[0030] Fig.10 It is a schematic diagram of the hardware structure of an electronic device provided in one embodiment of the present application. DETAILED DESCRIPTION
[0031] It should be noted that in the embodiments of the present application, "at least one" refers to one or more, and "more than one" refers to two or more than two. "And / or" describes the association relationship of associated objects, indicating that three relationships may exist. For example, A and / or B can represent: A exists alone, A and B exist at the same time, and B exists alone, where A and B can be singular or plural. The terms "first", "second", etc. in the specification, claims and drawings of this application are used to distinguish similar objects, rather than to describe a specific order or sequence.
[0032] It should also be noted that the method disclosed in the embodiments of the present application or the method shown in the flowchart includes one or more steps for implementing the method. Without departing from the scope of the claims, the execution order of multiple steps can be interchangeable with each other, and some of the steps can also be deleted.
[0033] The electronic devices of the embodiments of the present application may include smart phones with shooting functions, tablet computers, PDAs, laptop computers, mobile Internet devices (MID), virtual reality (VR) devices, augmented reality (AR) devices, wireless terminals in industrial control (Industrial Control), wireless terminals in self-driving (Self Driving), wireless terminals in remote medical surgery (Remote Medical Surgery), wireless terminals in smart grids (Smart Grid), wireless terminals in transportation safety (Transportation Safety), wireless terminals in smart cities (Smart City), wireless terminals in smart homes (Smart Home), cellular phones, cordless phones, Session Initiation Protocol (Session Initiation Protocol, SIP) phones, Wireless Local Loop (Wireless Local Loop, WLL) stations, Personal Digital Assistants (Personal Digital Assistant, PDA), handheld devices with wireless communication functions, computing devices or other processing devices connected to wireless modems, vehicle-mounted devices, wearable devices, terminal devices in 5G networks or public land mobile communication networks (Public Land Mobile Terminal equipment in Network, PLMN, etc.
[0034] The software structure of the electronic device is described in detail below.
[0035] Figure 1 The software structure diagram of an electronic device provided as an example.
[0036] The software system of electronic equipment can adopt a layered architecture, which divides the software into several layers. Each layer has a clear role and division of labor, and the layers communicate with each other through software interfaces. Figure 1 As shown, the software system of the electronic device is divided into four layers, from top to bottom, namely, the application (Application, APP) layer, the framework (Framework, FWK) layer, the hardware abstraction layer (Hardware Abstract Layer, HAL) and the hardware (Hardware) layer.
[0037] The application layer includes a series of application packages. The application package may include a camera application. The camera application may include a system camera application or a third-party camera application.
[0038] The framework layer provides application programming interfaces (API) and programming frameworks for various apps in the application layer. The framework layer includes the camera framework (CameraFWK), which provides the camera API (CameraAPI) for camera applications.
[0039] The hardware abstraction layer is used to execute the functional applications and data processing of various APPs. The hardware abstraction layer includes the camera hardware abstraction layer (CameraHAL), which includes sensor nodes, image front-end processing modules, multi-camera decision modules, image back-end processing modules, and camera algorithm libraries.
[0040] The sensor node may be a control node for a sensor, which is used to control the sensor through a sensor driver, such as controlling a camera to collect images. After acquiring the original image collected by the sensor, the sensor node sends the original image to the image front-end processing module.
[0041] The image front-end processing module is used to perform preliminary cropping processing on the original image, reserve the image edge (margin), thereby obtaining the cropped area image, and send the cropped area image to the multi-camera decision module.
[0042] The multi-camera decision module is used to spatially align the cropped area images according to the zoom ratio and the spatial alignment transform (SAT) algorithm to obtain a transformed image, and send the transformed image to the image backend processing module.
[0043] The image backend processing module is used to crop the transformed image, and to process the transformed image by calling the image processing algorithm in the camera algorithm library, thereby obtaining a preview image, and sending the preview image to the camera framework. After receiving the preview image, the camera framework sends the preview image to the camera application. After receiving the preview image, the camera application displays the preview image on the preview interface.
[0044] The camera algorithm library is used to store a series of image processing algorithms, such as automatic exposure (AE) algorithm, automatic focus (AF) algorithm, electric image stabilization (EIS) algorithm, picture quality (PQ) algorithm, etc.
[0045] The hardware layer includes image front-end processing hardware, image back-end processing hardware and sensors. Among them, the image front-end processing hardware provides hardware support for the image front-end processing module, and the image back-end processing hardware provides hardware support for the image back-end processing module. Sensors include various cameras, such as wide-angle (Wide) cameras, ultra-wide-angle (Ultrawide) cameras and telephoto (Tele) cameras. Each camera has a corresponding field of view (Field of View, FOV) and focal length. Exemplarily, when using an electronic device to shoot a distant object, the zoom ratio can be enlarged to shorten the distance between the electronic device and the object. Based on different zoom ratios and different object distances, using cameras with different focal lengths to take pictures / records can obtain a higher definition picture. During the zoom process, when a certain zoom ratio is reached, the electronic device will switch to different cameras. For example, in the process of the zoom ratio increasing from the minimum value, the electronic device will use an ultra-wide-angle camera, a wide-angle camera and a telephoto camera in turn.
[0046] At present, the image front-end processing module and the image back-end processing module usually use the center cropping method to crop the image. In the zoom process, in order to reduce the sense of disharmony when the camera is switched, it is necessary to crop out the area covering the region of interest (ROI) and with a larger image edge. For example, taking the wide-angle camera switching to the ultra-wide-angle camera as an example, Figure 2 As shown, based on the smaller zoom ratio, in the process of camera application output, area A0 is the original image area, area A1 is the cropped area (CropRegion) after processing by the image front-end processing module, and area A2 and area A3 are the ROI corresponding to the wide-angle camera and the ROI corresponding to the ultra-wide-angle camera after processing by the image back-end processing module. Before switching the camera, area A1 needs to cover area A2. After switching the camera, area A1 needs to cover area A3. In order to reduce the sense of disharmony of the picture when the camera is switched, the image front-end processing module needs to crop out a larger area that can cover area A2 and area A3. Obviously, the image edge of area A1 is larger. Since the subsequent output is based on area A3, the larger image edge of area A1 will reduce the resolution of area A3, resulting in poor clarity of the preview image.
[0047] Furthermore, in the case of directional zoom, in order to display the target area, it is necessary to crop the area that covers the target area and has a larger image edge. Figure 3A and Figure 3B As shown, on the preview interface of the camera application, in response to the user clicking Figure 3AThe operation of selecting the target area B1 on the initial preview image B0 shown in the figure, during the image output process of the camera application, the image front-end processing module cuts out the target area B1. Figure 3B The cropped area B2 shown. Obviously, since the image front-end processing module uses the center cropping method to crop the original image collected by the camera, the image edge of the cropped area B2 is larger. Since the subsequent image output is based on the target area B1, the larger image edge of the cropped area B2 will increase the calculation amount and difficulty of the subsequent algorithm processing, thereby increasing the system power consumption.
[0048] Based on this, the embodiments of the present application provide an image processing method, an electronic device, and a computer-readable storage medium, which aim to solve the problems of poor image output effect of camera applications and high system power consumption.
[0049] The image processing method of the embodiment of the present application is described in detail below in conjunction with the software structure of the electronic device.
[0050] Figure 4 It is a schematic diagram of the software structure of an electronic device provided in one embodiment of the present application.
[0051] Compared to Figure 1 The software structure shown in FIG. 1 is as follows. In this embodiment, the structure of the camera hardware abstraction layer is similar to Figure 1 The structure of the camera hardware abstraction layer is different. Figure 4 As shown in Figure 1, the camera hardware abstraction layer includes third-party platforms and self-developed platforms. The third-party platforms are provided by chip manufacturers, and the self-developed platforms are provided by electronic equipment manufacturers.
[0052] The three-party platform includes customized modules, functional modules and camera algorithm libraries. Among them, the customized module includes the camera framework interface, which is used to realize the interaction between the camera hardware abstraction layer and the camera framework. The functional module is a functional application integration module defined by the chip manufacturer. The functional module includes sensor nodes, image front-end processing modules, face frame conversion modules and image back-end processing modules.
[0053] The self-developed platform includes ROI calculation module, multi-camera decision module, face frame algorithm module, customized module adaptation layer, decoupling layer and feature layer. The feature layer includes multi-camera switching adaptation layer and face frame conversion adaptation layer. Among them, the ROI calculation module interacts with the customized module through the customized module adaptation layer. The multi-camera decision module interacts with the customized module through the decoupling layer and the multi-camera switching adaptation layer, and interacts with the image front-end processing module and the image back-end processing module through the multi-camera switching adaptation layer. The face frame algorithm module interacts with the face frame conversion module through the face frame conversion adaptation layer.
[0054] Specifically, the customized module is used to obtain sensing data from various sensors and send the sensing data to the customized module adaptation layer. The sensing data may include camera-related parameters and image-related parameters. After receiving the sensing data, the customized module adaptation layer sends the sensing data to the ROI calculation module.
[0055] The ROI calculation module is used to calculate the cropping area data using a non-center cropping method based on the sensing data and the ROI algorithm, and calculate the offset of the cropping area data of the non-center cropping and the cropping area data of the center cropping, and send the cropping area data and offset of the non-center cropping to the customized module adaptation layer. The cropping area data includes the position and size of the cropping area. For example, the cropping area data is CropRegion (left, top, w, h), where left represents the distance between the cropping area and the left edge of the image, top represents the distance between the cropping area and the upper edge of the image, w represents the width of the cropping area, and h represents the height of the cropping area.
[0056] After receiving the cropping area data and the offset, the customized module adaptation layer sends the cropping area data and the offset to the customized module. After receiving the cropping area data and the offset, the customized module sends the cropping area data and the offset to the image front-end processing module, and sends the offset to the decoupling layer. After receiving the offset, the decoupling layer sends the offset to the multi-camera switching adaptation layer.
[0057] After acquiring the original image collected by the sensor, the sensor node sends the original image to the image front-end processing module. After receiving the cropping area data and the original image, the image front-end processing module performs preliminary cropping processing on the original image according to the cropping area data, reserves the image edge, thereby obtaining the cropping area image, and sends the cropping area image to the multi-camera switching adaptation layer and the face frame conversion module.
[0058] After receiving the offset from the decoupling layer and the cropped area image from the image front-end processing module, the multi-camera switching adaptation layer sends the offset and the cropped area image to the multi-camera decision module.
[0059] The multi-camera decision module is used to spatially align the cropped area image according to the offset, zoom ratio and SAT algorithm to obtain a transformed image, and send the transformed image to the multi-camera switching adaptation layer. After receiving the transformed image, the multi-camera switching adaptation layer sends the transformed image and the offset to the image backend processing module.
[0060] The face frame conversion module is used to perform grayscale conversion on the cropped area image to obtain a grayscale image, and send the grayscale image to the face frame conversion adaptation layer. After receiving the grayscale image, the face frame conversion adaptation layer sends the grayscale image to the face frame algorithm module.
[0061] The face frame algorithm module is used to detect the face in the grayscale image according to the face detection algorithm, and draw the face frame according to the position and size of the detected face area, so as to obtain the face frame grayscale image, and send the face frame grayscale image to the face frame conversion adaptation layer. After receiving the face frame grayscale image, the face frame conversion adaptation layer sends the face frame grayscale image to the image backend processing module.
[0062] The image backend processing module is used to perform grayscale inverse transformation on the face frame grayscale image according to the transformation image and the offset to obtain the face frame image, and then perform cropping processing on the face frame image to obtain the ROI image, and then perform algorithm processing on the ROI image by calling the image processing algorithm in the camera algorithm library to obtain the preview image, and send the preview image to the customization module. After receiving the preview image, the customization module sends the preview image to the camera framework through the camera framework interface. After receiving the preview image, the camera framework sends the preview image to the camera application. After receiving the preview image, the camera application displays the preview image on the preview interface.
[0063] In this embodiment, the preview image corresponds to the face region in the original image. In other embodiments, based on the fact that the face frame algorithm module does not detect a face, the image backend processing module performs cropping processing on the transformed image to obtain an ROI image, and then performs algorithm processing on the ROI image by calling the image processing algorithm in the camera algorithm library to obtain a preview image. At this time, there is no face frame in the preview image.
[0064] Understandably, Figure 4 The layers in the software structure shown and the components contained in each layer do not constitute a specific limitation on the electronic device. In other embodiments, the electronic device may include more or fewer layers than shown, and each layer may include more or fewer components, which is not limited in the embodiments of the present application.
[0065] In the above embodiment, the ROI calculation module calculates the cropping area data by non-center cropping, calculates the offset of the cropping area data of the non-center cropping and the cropping area data of the center cropping, and transmits the offset to the image front-end processing module and the image back-end processing module. The image front-end processing module and the image back-end processing module respectively adjust the image processing flow corresponding to the default center cropping based on the offset, thereby reducing the image edge of the cropping area, thereby improving the resolution of the ROI image, and further improving the clarity of the preview image. Furthermore, since the image edge of the cropping area is reduced, the calculation amount and difficulty of the subsequent algorithm processing are reduced, thereby reducing the system power consumption.
[0066] For example, taking the wide-angle camera switching to the ultra-wide-angle camera as an example, Figure 5As shown in the figure, based on the decrease in zoom ratio, in the process of camera application output, area C0 is the original image area, area C1 is the cropped area after processing by the image front-end processing module, and area C2 and area C3 are the ROI corresponding to the wide-angle camera and the ROI corresponding to the ultra-wide-angle camera after processing by the image back-end processing module. Figure 2 Compared with the above, the image edge of area C1 is significantly reduced. Since the image front-end processing module performs preliminary cropping processing based on the cropping area data and offset of the non-center cropping from the ROI calculation module, area C1 only needs to cover area C3, thereby reducing the image edge of area C1, thereby improving the resolution of the ROI image when the zoom ratio changes, and thus improving the clarity of the preview image.
[0067] For example, in the directional zoom scenario, Fig. 6A and Figure 6B As shown, in response to the user Fig. 6A The operation of selecting the target area D1 on the initial preview image D0 shown in the figure, during the image output process of the camera application, the image front-end processing module cuts out the target area D1. Figure 6B The cropped area D2 is shown. Obviously, Figure 3B Compared with the cropped area B2 shown, Figure 6B The image edge of the cropped area D2 shown is significantly reduced. Since the image front-end processing module performs preliminary cropping processing based on the cropped area data and offset of the non-center cropping from the ROI calculation module, the cropped area D2 can be centered on the target area D1, thereby reducing the calculation amount and difficulty of subsequent algorithm processing, thereby reducing system power consumption.
[0068] Figure 7 It is a schematic diagram of the interaction of software modules provided in one embodiment of the present application.
[0069] Compared to Figure 4 The software structure shown in FIG. 1 is simplified in this embodiment. Specifically, Figure 7 The software modules involved include sensor nodes, image front-end processing module, ROI calculation module, image back-end processing module, face frame conversion module, face frame algorithm module and camera algorithm library.
[0070] like Figure 7 As shown, in a scenario where the zoom ratio remains unchanged, in response to the camera application triggering the sensor to collect the original image, the sensor node obtains the original image collected by the sensor, and sends the original image to the image front-end processing module.
[0071] The ROI calculation module receives the sensing data from the sensor, calculates the cropping area data by non-center cropping according to the sensing data and the ROI algorithm, calculates the offset of the cropping area data of the non-center cropping and the cropping area data of the center cropping, and sends the cropping area data and the offset of the non-center cropping to the image front-end processing module.
[0072] After receiving the cropping area data and the offset, the image front-end processing module performs preliminary cropping processing on the original image according to the cropping area data, reserves the image edge, thereby obtaining a cropping area image, and sends the cropping area image and the offset to the image back-end processing module and the face frame conversion module.
[0073] After receiving the cropped area image and the offset, the face frame conversion module performs grayscale transformation on the cropped area image to obtain a grayscale image, and sends the grayscale image and the offset to the face frame algorithm module.
[0074] After receiving the grayscale image and the offset, the face frame algorithm module detects the face in the grayscale image according to the face detection algorithm, draws the face frame according to the position and size of the detected face area, thereby obtaining the face frame grayscale image, and sends the face frame grayscale image to the image backend processing module.
[0075] After receiving the cropped area image, offset and face frame grayscale image, the image backend processing module performs grayscale inverse transformation on the face frame grayscale image according to the cropped area image and offset to obtain the face frame image, and then crops the face frame image to obtain the ROI image, and then performs algorithmic processing on the ROI image by calling the image processing algorithm in the camera algorithm library to obtain a preview image.
[0076] It can be understood that in this embodiment, the ROI calculation module calculates the cropping area data using a non-center cropping method, calculates the offset of the cropping area data of the non-center cropping and the cropping area data of the center cropping, and transmits the offset to the image front-end processing module, which then transmits the offset to the image back-end processing module. The image front-end processing module and the image back-end processing module respectively adjust the image processing flow corresponding to the default center cropping based on the offset, thereby reducing the image edge of the cropping area, thereby improving the resolution of the ROI image, and further improving the clarity of the preview image. Furthermore, since the image edge of the cropping area is reduced, the calculation amount and difficulty of the subsequent algorithm processing are reduced, thereby reducing the system power consumption.
[0077] Figure 8 It is a flowchart of an image processing method provided by an embodiment of the present application.
[0078] Image processing methods are applied to electronic devices, such as Figure 8As shown, the image processing method comprises the following steps:
[0079] S101, starting a shooting function based on a camera application, and displaying a first preview image on a preview interface of the camera application.
[0080] The first preview image includes a target area, and the target area is located in a non-central area of the first preview image. The resolution of the first preview image is a first resolution.
[0081] In this embodiment, the first preview image is associated with a first cropping area based on an original image, where the original image is an image captured by a camera. Based on the center cropping method, the first cropping area is located in the center area of the original image. The first cropping area includes a target area, which is located in a non-center area of the first cropping area.
[0082] S102: In response to a zoom operation and / or a target area selection operation, display a second preview image on a preview interface of a camera application.
[0083] The second preview image includes a target area, and the target area is located in a central area of the second preview image. The resolution of the second preview image is a second resolution, which is greater than the first resolution.
[0084] It can be understood that the zoom operation may include the operation of clicking the zoom control, the operation of sliding the zoom control, and the operation of the two-finger sliding interface. The operation of the two-finger sliding interface may include the operation of sliding two fingers together and the operation of sliding two fingers apart. The operation of selecting the target area may include the operation of clicking or touching the target area.
[0085] In this embodiment, the second preview image is associated with a second cropping area based on the original image. Based on the non-center cropping method, the second cropping area is located in a non-center area of the original image. The second cropping area includes a target area, and the target area is located in a center area of the second cropping area.
[0086] Since the image edge of the second cropped area is smaller than the image edge of the first cropped area, the proportion of the number of pixels of the target area in the second cropped area is greater than the proportion of the number of pixels of the target area in the first cropped area. Since the output size of the camera application remains unchanged, the size of the first preview image is the same as the second preview image. Therefore, the number of pixels contained in the target area in the second preview image is greater than the number of pixels contained in the target area in the first preview image, and thus the resolution of the second preview image is greater than the resolution of the first preview image.
[0087] In one embodiment, if Fig. 9 As shown, the above step S102 includes the following sub-steps:
[0088] S201 : Acquire sensing data from a sensor in response to a zoom operation and / or a target area selection operation.
[0089] S202: Calculate the non-center cropped cropped area data and the offset between the non-center cropped area data and the center cropped area data according to the sensing data and the ROI algorithm.
[0090] S203, performing preliminary cropping processing on the original image from the camera according to the cropping area data of the non-center cropping to obtain a cropping area image.
[0091] In this embodiment, after the electronic device executes step S203, it executes steps S204 and S205 in parallel.
[0092] S204, spatially aligning the cropped area image according to the offset, zoom ratio and SAT algorithm to obtain a transformed image.
[0093] In this embodiment, after the electronic device executes step S204, it executes step S209 or S211.
[0094] S205, performing grayscale transformation on the cropped area image to obtain a grayscale image.
[0095] S206: Detect faces in the grayscale image according to a face detection algorithm.
[0096] S207, determining whether a face is detected.
[0097] If it is determined that a face is detected, steps S208 to S210 are executed. If it is determined that no face is detected, step S211 is executed.
[0098] S208, drawing a face frame according to the position and size of the detected face area to obtain a grayscale image of the face frame.
[0099] S209, performing grayscale inverse transformation on the face frame grayscale image according to the transformed image and the offset to obtain the face frame image.
[0100] S210, cropping the face frame image to obtain a ROI image.
[0101] S211, performing cropping processing on the transformed image to obtain a ROI image.
[0102] In this embodiment, after the electronic device completes step S210 or S211, it executes step S212.
[0103] S212, calling the image processing algorithm in the camera algorithm library to perform algorithm processing on the ROI image to obtain a second preview image.
[0104] S213: Display the second preview image on the preview interface of the camera application.
[0105] In the above embodiment, the cropping area data of the non-center cropping and the offset of the cropping area data of the non-center cropping and the cropping area data of the center cropping are calculated, and the image processing flow corresponding to the default center cropping is adjusted based on the offset, thereby reducing the image edge of the cropping area, thereby improving the resolution of the ROI image, and further improving the clarity of the preview image. Furthermore, since the image edge of the cropping area is reduced, the calculation amount and difficulty of the subsequent algorithm processing are reduced, thereby reducing the system power consumption.
[0106] It is understood that in some embodiments, the electronic device may not perform step S204, and accordingly, the transformed image in step S209 or S211 is replaced with the cropped region image. In other embodiments, the electronic device may perform cropping processing on the cropped region image after performing step S203 to obtain the ROI image, and then perform steps S212 to S213.
[0107] Fig.10 It is a schematic diagram of the hardware structure of an electronic device provided in one embodiment of the present application.
[0108] like Fig.10 As shown, the electronic device 100 includes a processor 110, an external memory interface 120, an internal memory 121, a Universal Serial Bus (USB) interface 130, a charging management module 140, a power management module 141, a battery 142, an antenna 1, an antenna 2, a mobile communication module 150, a wireless communication module 160, an audio module 170, a speaker 170A, a receiver 170B, a microphone 170C, an earphone interface 170D, a sensor module 180, a button 190, a motor 191, an indicator 192, a camera 193, a display screen 194, and a Subscriber Identification Module (SIM) card interface 195, etc. Among them, the sensor module 180 may include a pressure sensor 180A, a gyroscope sensor 180B, an air pressure sensor 180C, a magnetic sensor 180D, an acceleration sensor 180E, a distance sensor 180F, a proximity light sensor 180G, a fingerprint sensor 180H, a temperature sensor 180J, a touch sensor 180K and an ambient light sensor 180L, etc.
[0109] The processor 110 may execute instructions stored in the internal memory 121 , so that the electronic device 100 executes the image processing method provided in the above embodiment.
[0110] The processor 110 may include one or more processing units, for example, the processor 110 may include an application processor (AP), a modem processor, a graphics processor (GPU), an image signal processor (ISP), a controller, a video codec, a digital signal processor (DSP), a baseband processor and / or a neural network processor (NPU), etc. Different processing units may be independent devices or integrated into one or more processors.
[0111] The controller can generate operation control signals according to the instruction operation code and timing signal to complete the control of instruction fetching and execution.
[0112] The processor 110 may also be provided with a memory for storing instructions and data. In some embodiments, the memory in the processor 110 is a cache memory. The memory may store instructions or data that the processor 110 has just used or cyclically used. If the processor 110 needs to use the instruction or data again, it may be directly called from the memory. This avoids repeated access, reduces the waiting time of the processor 110, and thus improves the efficiency of the system.
[0113] In some embodiments, the processor 110 may include one or more interfaces. The interface may include an Inter-Integrated Circuit (I2C) interface, an Inter-Integrated Circuit Sound (I2S) interface, a Pulse Code Modulation (PCM) interface, a Universal Asynchronous Receiver / Transmitter (UART) interface, a Mobile Industry Processor Interface (MIPI), a General-Purpose Input / Output (GPIO) interface, a Subscriber Identity Module (SIM) interface, and / or a Universal Serial Bus (USB) interface, etc.
[0114] The I2C interface is a bidirectional synchronous serial bus, including a serial data line (SDA) and a serial clock line (SCL). In some embodiments, the processor 110 may include multiple groups of I2C buses. The processor 110 may be coupled to the touch sensor 180K, the charger, the flash, the camera 193, etc. through different I2C bus interfaces. For example: the processor 110 may be coupled to the touch sensor 180K through the I2C interface, so that the processor 110 communicates with the touch sensor 180K through the I2C bus interface to realize the touch function of the electronic device 100.
[0115] The I2S interface can be used for audio communication. In some embodiments, the processor 110 can include multiple I2S buses. The processor 110 can be coupled to the audio module 170 via the I2S bus to achieve communication between the processor 110 and the audio module 170. In some embodiments, the audio module 170 can transmit an audio signal to the wireless communication module 160 via the I2S interface to achieve the function of answering a call through a Bluetooth headset.
[0116] The PCM interface can also be used for audio communication, sampling, quantizing and encoding analog signals. In some embodiments, the audio module 170 and the wireless communication module 160 can be coupled via a PCM bus interface. In some embodiments, the audio module 170 can also transmit audio signals to the wireless communication module 160 via the PCM interface to implement the function of answering calls via a Bluetooth headset. Both the I2S interface and the PCM interface can be used for audio communication.
[0117] The UART interface is a universal serial data bus for asynchronous communication. The bus can be a bidirectional communication bus. It converts the data to be transmitted between serial communication and parallel communication. In some embodiments, the UART interface is generally used to connect the processor 110 and the wireless communication module 160. For example, the processor 110 communicates with the Bluetooth module in the wireless communication module 160 through the UART interface to implement the Bluetooth function. In some embodiments, the audio module 170 can transmit an audio signal to the wireless communication module 160 through the UART interface to implement the function of playing music through a Bluetooth headset.
[0118] The MIPI interface can be used to connect the processor 110 with peripheral devices such as the display screen 194 and the camera 193. The MIPI interface includes a camera serial interface (CSI), a display serial interface (DSI), etc. In some embodiments, the processor 110 and the camera 193 communicate via the CSI interface to realize the shooting function of the electronic device 100. The processor 110 and the display screen 194 communicate via the DSI interface to realize the display function of the electronic device 100.
[0119] The GPIO interface can be configured by software. The GPIO interface can be configured as a control signal or as a data signal. In some embodiments, the GPIO interface can be used to connect the processor 110 with the camera 193, the display screen 194, the wireless communication module 160, the audio module 170, the sensor module 180, etc. The GPIO interface can also be configured as an I2C interface, an I2S interface, a UART interface, a MIPI interface, etc.
[0120] The USB interface 130 is an interface that complies with the USB standard specification, and specifically can be a Mini USB interface, a Micro USB interface, a USB Type C interface, etc. The USB interface 130 can be used to connect a charger to charge the electronic device 100, and can also be used to transfer data between the electronic device 100 and a peripheral device. It can also be used to connect headphones to play audio through the headphones. The interface can also be used to connect other electronic devices, such as AR devices, etc.
[0121] It is understandable that the interface connection relationship between the modules illustrated in the embodiments of the present application is only a schematic illustration and does not constitute a structural limitation on the electronic device. In other embodiments of the present application, the electronic device may also adopt different interface connection methods in the above embodiments, or a combination of multiple interface connection methods.
[0122] The charging management module 140 is used to receive charging input from a charger. The charger may be a wireless charger or a wired charger. In some wired charging embodiments, the charging management module 140 may receive charging input from a wired charger through the USB interface 130. In some wireless charging embodiments, the charging management module 140 may receive wireless charging input through a wireless charging coil of the electronic device 100. While the charging management module 140 is charging the battery 142, it may also power the electronic device through the power management module 141.
[0123] The power management module 141 is used to connect the battery 142, the charging management module 140 and the processor 110. The power management module 141 receives input from the battery 142 and / or the charging management module 140, and supplies power to the processor 110, the internal memory 121, the display screen 194, the camera 193 and the wireless communication module 160. The power management module 141 can also be used to monitor parameters such as battery capacity, battery cycle number, battery health status (leakage, impedance), etc. In some other embodiments, the power management module 141 can also be set in the processor 110. In other embodiments, the power management module 141 and the charging management module 140 can also be set in the same device.
[0124] The wireless communication function of the electronic device 100 can be implemented through the antenna 1, the antenna 2, the mobile communication module 150, the wireless communication module 160, the modem processor, the baseband processor, and the like.
[0125] Antenna 1 and antenna 2 are used to transmit and receive electromagnetic wave signals. Each antenna in electronic device 100 can be used to cover a single or multiple communication frequency bands. Different antennas can also be reused to improve the utilization of antennas. For example, antenna 1 can be reused as a diversity antenna for a wireless local area network. In some other embodiments, the antenna can be used in combination with a tuning switch.
[0126] The mobile communication module 150 can provide solutions for wireless communications including 2G / 3G / 4G / 5G applied to the electronic device 100. The mobile communication module 150 may include at least one filter, a switch, a power amplifier, a low noise amplifier (Low Noise Amplifier, LNA), etc. The mobile communication module 150 can receive electromagnetic waves from the antenna 1, and filter, amplify, and process the received electromagnetic waves, and transmit them to the modulation and demodulation processor for demodulation. The mobile communication module 150 can also amplify the signal modulated by the modulation and demodulation processor, and convert it into electromagnetic waves for radiation through the antenna 1. In some embodiments, at least some of the functional modules of the mobile communication module 150 can be set in the processor 110. In some embodiments, at least some of the functional modules of the mobile communication module 150 can be set in the same device as at least some of the modules of the processor 110.
[0127] The modem processor may include a modulator and a demodulator. Among them, the modulator is used to modulate the low-frequency baseband signal to be sent into a medium-high frequency signal. The demodulator is used to demodulate the received electromagnetic wave signal into a low-frequency baseband signal. The demodulator then transmits the demodulated low-frequency baseband signal to the baseband processor for processing. After the low-frequency baseband signal is processed by the baseband processor, it is passed to the application processor. The application processor outputs a sound signal through an audio device (not limited to a speaker 170A, a receiver 170B, etc.), or displays an image or video through a display screen 194. In some embodiments, the modem processor may be an independent device. In other embodiments, the modem processor may be independent of the processor 110 and be set in the same device as the mobile communication module 150 or other functional modules.
[0128] The wireless communication module 160 can provide wireless communication solutions including wireless local area network (WLAN) (such as wireless fidelity (Wi-Fi) network), Bluetooth (BT), global navigation satellite system (GNSS), frequency modulation (FM), near field communication (NFC), infrared (IR), etc., which are applied to the electronic device 100. The wireless communication module 160 can be one or more devices integrating at least one communication processing module. The wireless communication module 160 receives electromagnetic waves via the antenna 2, modulates the frequency of the electromagnetic wave signal and filters it, and sends the processed signal to the processor 110. The wireless communication module 160 can also receive the signal to be sent from the processor 110, modulate the frequency of it, amplify it, and convert it into electromagnetic waves for radiation through the antenna 2.
[0129] In some embodiments, the antenna 1 of the electronic device 100 is coupled to the mobile communication module 150, and the antenna 2 is coupled to the wireless communication module 160, so that the electronic device 100 can communicate with the network and other devices through wireless communication technology. The wireless communication technology may include Global System For Mobile Communication (GSM), General Packet Radio Service (GPRS), Code Division Multiple Access (CDMA), Wideband Code Division Multiple Access (WCDMA), Time-Division Code Division Multiple Access (TD-SCDMA), Long Term Evolution (LTE), BT, GNSS, WLAN, NFC, FM and / or IR technology, etc. GNSS may include the Global Positioning System (GPS), the Global Navigation Satellite System (GLONASS), the Beidou Navigation Satellite System (BDS), the Quasi-Zenith Satellite System (QZSS) and / or the Satellite Based Augmentation System (SBAS).
[0130] The electronic device 100 implements the display function through a GPU, a display screen 194, and an application processor. The GPU is a microprocessor for image processing, which connects the display screen 194 and the application processor. The GPU is used to perform mathematical and geometric calculations for graphics rendering. The processor 110 may include one or more GPUs that execute program instructions to generate or change display information.
[0131] The display screen 194 is used to display images, videos, etc. The display screen 194 includes a display panel. The display panel can be a liquid crystal display (LCD), an organic light-emitting diode (OLED), an active-matrix organic light-emitting diode or an active-matrix organic light-emitting diode (AMOLED), a flexible light-emitting diode (FLED), a Miniled, a MicroLed, a Micro-oLed, a quantum dot light-emitting diode (QLED), etc. In some embodiments, the electronic device 100 may include 1 or N display screens 194, where N is a positive integer greater than 1.
[0132] The electronic device 100 can realize the shooting function through the ISP, the camera 193, the video codec, the GPU, the display screen 194 and the application processor.
[0133] The ISP is used to process the data fed back by the camera 193. For example, when taking a photo, the shutter is opened, and the light is transmitted to the camera photosensitive element through the lens. The light signal is converted into an electrical signal, and the camera photosensitive element transmits the electrical signal to the ISP for processing and converts it into an image visible to the naked eye. The ISP can also perform algorithm optimization on the noise, brightness, and skin color of the image. The ISP can also optimize the exposure, color temperature and other parameters of the shooting scene. In some embodiments, the ISP can be set in the camera 193.
[0134] The camera 193 is used to capture still images or videos. The scene generates an optical image through the lens and projects it onto the photosensitive element. The photosensitive element may be a charge coupled device (CCD) or a complementary metal oxide semiconductor (CMOS) phototransistor. The photosensitive element converts the optical signal into an electrical signal, which is then passed to the ISP for conversion into a digital image signal. The ISP outputs the digital image signal to the DSP for processing. The DSP converts the digital image signal into an image signal in a standard RGB, YUV or other format. In some embodiments, the electronic device 100 may include 1 or N cameras 193, where N is a positive integer greater than 1.
[0135] The digital signal processor is used to process digital signals, and can process not only digital image signals but also other digital signals. For example, when the electronic device 100 is selecting a frequency point, the digital signal processor is used to perform Fourier transform on the frequency point energy.
[0136] Video codecs are used to compress or decompress digital videos. The electronic device 100 may support one or more video codecs. Thus, the electronic device 100 may play or record videos in various coding formats, such as Moving Picture Experts Group (MPEG) 1, MPEG2, MPEG3, MPEG4, etc.
[0137] NPU is a neural network (NN) computing processor. By drawing on the structure of biological neural networks, such as the transmission mode between neurons in the human brain, it can quickly process input information and can also continuously self-learn. NPU can realize applications such as intelligent cognition of electronic device 100, such as image recognition, face recognition, voice recognition, text understanding, etc.
[0138] The external memory interface 120 can be used to connect an external memory card, such as a Micro SD card, to expand the storage capacity of the electronic device 100. The external memory card communicates with the processor 110 through the external memory interface 120 to implement a data storage function, such as storing files such as music and videos in the external memory card.
[0139] The internal memory 121 can be used to store computer executable program codes, and the executable program codes include instructions. The internal memory 121 may include a program storage area and a data storage area. Among them, the program storage area may store an operating system, an application required for at least one function (such as a sound playback function, an image playback function, etc.), etc. The data storage area may store data created during the use of the electronic device 100 (such as audio data, a phone book, etc.), etc. In addition, the internal memory 121 may include a high-speed random access memory, and may also include a non-volatile memory, such as at least one disk storage device, a flash memory device, a universal flash memory (Universal Flash Storage, UFS), etc. The processor 110 executes various functional applications and data processing of the electronic device 100 by running instructions stored in the internal memory 121, and / or instructions stored in a memory provided in the processor.
[0140] The electronic device 100 can implement audio functions such as music playing and recording through the audio module 170, the speaker 170A, the receiver 170B, the microphone 170C, the headphone jack 170D, and the application processor.
[0141] The audio module 170 is used to convert digital audio information into analog audio signal output, and is also used to convert analog audio input into digital audio signals. The audio module 170 can also be used to encode and decode audio signals. In some embodiments, the audio module 170 can be arranged in the processor 110, or some functional modules of the audio module 170 can be arranged in the processor 110.
[0142] The speaker 170A, also called a "speaker", is used to convert an audio electrical signal into a sound signal. The electronic device 100 can listen to music or listen to a hands-free call through the speaker 170A.
[0143] The receiver 170B, also called a "earpiece", is used to convert audio electrical signals into sound signals. When the electronic device 100 receives a call or voice message, the voice can be received by placing the receiver 170B close to the human ear.
[0144] Microphone 170C, also called "microphone" or "microphone", is used to convert sound signals into electrical signals. When making a call or sending a voice message, the user can speak by putting his mouth close to microphone 170C to input the sound signal into microphone 170C. The electronic device 100 can be provided with at least one microphone 170C. In other embodiments, the electronic device 100 can be provided with two microphones 170C, which can not only collect sound signals but also realize noise reduction function. In other embodiments, the electronic device 100 can also be provided with three, four or more microphones 170C to collect sound signals, reduce noise, identify the source of sound, realize directional recording function, etc.
[0145] The earphone interface 170D is used to connect a wired earphone and can be a USB interface 130 or a 3.5 mm Open Mobile Terminal Platform (OMTP) standard interface or a Cellular Telecommunications Industry Association of the USA (CTIA) standard interface.
[0146] The pressure sensor 180A is used to sense the pressure signal and can convert the pressure signal into an electrical signal. In some embodiments, the pressure sensor 180A can be set on the display screen 194. There are many types of pressure sensors 180A, such as resistive pressure sensors, inductive pressure sensors, capacitive pressure sensors, etc. The capacitive pressure sensor can be a parallel plate including at least two conductive materials. When a force acts on the pressure sensor 180A, the capacitance between the electrodes changes. The electronic device 100 determines the intensity of the pressure according to the change in capacitance. When a touch operation acts on the display screen 194, the electronic device 100 detects the touch operation intensity according to the pressure sensor 180A. The electronic device 100 can also calculate the touch position according to the detection signal of the pressure sensor 180A. In some embodiments, touch operations acting on the same touch position but with different touch operation intensities can correspond to different operation instructions. For example: when a touch operation with a touch operation intensity less than the first pressure threshold acts on the short message application icon, an instruction to view the short message is executed. When a touch operation with a touch operation intensity greater than or equal to the first pressure threshold acts on the short message application icon, an instruction to create a new short message is executed.
[0147] The gyro sensor 180B can be used to determine the motion posture of the electronic device 100. In some embodiments, the angular velocity of the electronic device 100 around three axes (i.e., x, y, and z axes) can be determined by the gyro sensor 180B. The gyro sensor 180B can be used for anti-shake shooting. For example, when the shutter is pressed, the gyro sensor 180B detects the angle of the electronic device 100 shaking, calculates the distance that the lens module needs to compensate based on the angle, and allows the lens to offset the shaking of the electronic device 100 through reverse movement to achieve anti-shake. The gyro sensor 180B can also be used in scenes such as navigation and somatosensory games.
[0148] The air pressure sensor 180C is used to measure air pressure. In some embodiments, the electronic device 100 calculates the altitude through the air pressure value measured by the air pressure sensor 180C to assist positioning and navigation.
[0149] The magnetic sensor 180D includes a Hall sensor. The electronic device 100 can use the magnetic sensor 180D to detect the opening and closing of the flip leather case. In some embodiments, when the electronic device 100 is a flip phone, the electronic device 100 can detect the opening and closing of the flip cover according to the magnetic sensor 180D. Then, according to the detected opening and closing state of the leather case or the opening and closing state of the flip cover, the flip cover can be automatically unlocked.
[0150] The acceleration sensor 180E can detect the magnitude of the acceleration of the electronic device 100 in all directions (generally three axes). When the electronic device 100 is stationary, the magnitude and direction of gravity can be detected. It can also be used to identify the posture of the electronic device and is applied to applications such as horizontal and vertical screen switching and pedometers.
[0151] The distance sensor 180F is used to measure the distance. The electronic device 100 can measure the distance by infrared or laser. In some embodiments, when shooting a scene, the electronic device 100 can use the distance sensor 180F to measure the distance to achieve fast focusing.
[0152] The proximity light sensor 180G may include, for example, a light emitting diode (LED) and a light detector, such as a photodiode. The light emitting diode may be an infrared light emitting diode. The electronic device 100 emits infrared light outward through the light emitting diode. The electronic device 100 uses a photodiode to detect infrared reflected light from nearby scenes. When sufficient reflected light is detected, it can be determined that there is a scene near the electronic device 100. When insufficient reflected light is detected, the electronic device 100 can determine that there is no scene near the electronic device 100. The electronic device 100 can use the proximity light sensor 180G to detect that the user holds the electronic device 100 close to the ear to talk, so as to automatically turn off the screen to save power. The proximity light sensor 180G can also be used in leather case mode and pocket mode to automatically unlock and lock the screen.
[0153] The ambient light sensor 180L is used to sense the ambient light brightness. The electronic device 100 can adaptively adjust the brightness of the display screen 194 according to the perceived ambient light brightness. The ambient light sensor 180L can also be used to automatically adjust the white balance when taking pictures. The ambient light sensor 180L can also cooperate with the proximity light sensor 180G to detect whether the electronic device 100 is in a pocket to prevent accidental touches.
[0154] The fingerprint sensor 180H is used to collect fingerprints. The electronic device 100 can use the collected fingerprint characteristics to implement fingerprint unlocking, access application locks, fingerprint photography, fingerprint call answering, etc.
[0155] The temperature sensor 180J is used to detect temperature. In some embodiments, the electronic device 100 uses the temperature detected by the temperature sensor 180J to execute a temperature processing strategy. For example, when the temperature reported by the temperature sensor 180J exceeds a threshold, the electronic device 100 reduces the performance of a processor located near the temperature sensor 180J to reduce power consumption and implement thermal protection. In other embodiments, when the temperature is lower than another threshold, the electronic device 100 heats the battery 142 to avoid abnormal shutdown of the electronic device 100 due to low temperature. In other embodiments, when the temperature is lower than another threshold, the electronic device 100 performs a boost on the output voltage of the battery 142 to avoid abnormal shutdown caused by low temperature.
[0156] The touch sensor 180K is also called a "touch control device". The touch sensor 180K can be set on the display screen 194. The touch sensor 180K and the display screen 194 form a touch screen, also called a "touch control screen". The touch sensor 180K is used to detect touch operations acting on or near it. The touch sensor can pass the detected touch operation to the application processor to determine the type of touch event. Visual output related to the touch operation can be provided through the display screen 194. In other embodiments, the touch sensor 180K can also be set on the surface of the electronic device 100, which is different from the position of the display screen 194.
[0157] The key 190 includes a power key, a volume key, etc. The key 190 may be a mechanical key or a touch key. The electronic device 100 may receive key input and generate key signal input related to user settings and function control of the electronic device 100.
[0158] Motor 191 can generate vibration prompts. Motor 191 can be used for incoming call vibration prompts, and can also be used for touch vibration feedback. For example, touch operations acting on different applications (such as taking pictures, audio playback, etc.) can correspond to different vibration feedback effects. For touch operations acting on different areas of the display screen 194, motor 191 can also correspond to different vibration feedback effects. Different application scenarios (for example: time reminders, receiving messages, alarm clocks, games, etc.) can also correspond to different vibration feedback effects. The touch vibration feedback effect can also support customization.
[0159] The indicator 192 may be an indicator light, which may be used to indicate the charging status, power changes, messages, missed calls, notifications, etc.
[0160] The SIM card interface 195 is used to connect a SIM card. The SIM card can be connected to and separated from the electronic device 100 by inserting it into the SIM card interface 195 or pulling it out from the SIM card interface 195. The electronic device 100 can support 1 or N SIM card interfaces, where N is a positive integer greater than 1. The SIM card interface 195 can support Nano SIM cards, Micro SIM cards, SIM cards, and the like. Multiple cards can be inserted into the same SIM card interface 195 at the same time. The types of the multiple cards can be the same or different. The SIM card interface 195 can also be compatible with different types of SIM cards. The SIM card interface 195 can also be compatible with external memory cards. The electronic device 100 interacts with the network through the SIM card to implement functions such as calls and data communications. In some embodiments, the electronic device 100 uses an eSIM, i.e., an embedded SIM card. The eSIM card can be embedded in the electronic device 100 and cannot be separated from the electronic device 100.
[0161] It is to be understood that the structures illustrated in the embodiments of the present application do not constitute specific limitations on the electronic device. In other embodiments, the electronic device may include more or fewer components than shown in the figure, or combine certain components, or split certain components, or arrange the components differently. The illustrated components may be implemented in hardware, software, or a combination of software and hardware.
[0162] The embodiment of the present application also provides a computer-readable storage medium, which stores instructions. When the instructions are executed on a computer, the computer executes the image processing method of the embodiment of the present application.
[0163] Computer-readable storage media include volatile and nonvolatile, removable and non-removable media implemented in any method or technology for storing information (such as computer-readable instructions, data structures, program modules or other data). Computer-readable storage media include, but are not limited to, random access memory (Random Access Memory, RAM), read-only memory (Read-Only Memory, ROM), electrically erasable programmable read-only memory (Electrically Erasable Programmable Read-Only Memory, EEPROM), flash memory or other memory, compact disc read-only memory (Compact Disc Read-Only Memory, CD-ROM), digital versatile disc (Digital Versatile Disc, DVD) or other optical disk storage, magnetic cassettes, magnetic tapes, magnetic disk storage or other magnetic storage devices, or any other medium that can be used to store the desired information and can be accessed by a computer.
[0164] The embodiments of the present application are described in detail above in conjunction with the accompanying drawings, but the present application is not limited to the above embodiments, and various changes can be made within the knowledge scope of ordinary technicians in the relevant technical field without departing from the purpose of the present application.
Claims
1. An image processing method, applied to an electronic device, characterized in that: The method comprises: Based on the camera application starting the shooting function, a first preview image is displayed on the preview interface of the camera application; the first preview image includes a target area, the target area is located in a non-central area of the first preview image, and the resolution of the first preview image is a first resolution; In response to a zoom operation and / or a selection operation of the target area, a second preview image is displayed on the preview interface; the second preview image includes the target area, the target area is located in a central area of the second preview image, and a resolution of the second preview image is a second resolution, which is greater than the first resolution.
2. The image processing method according to claim 1, characterized in that: The first preview image is associated with a first cropping area based on an original image, the original image being an image captured by a camera of the electronic device; the first cropping area is located in a central area of the original image, the first cropping area includes the target area, and the target area is located in a non-central area of the first cropping area; The second preview image is associated with a second cropping area based on the original image; the second cropping area is located in a non-central area of the original image, the second cropping area includes the target area, and the target area is located in a central area of the second cropping area.
3. The image processing method according to claim 1 or 2, characterized in that: The step of displaying a second preview image on the preview interface in response to the zoom operation and / or the target area selection operation includes: In response to the zoom operation and / or the target area selection operation, calculating non-center cropped cropped area data and an offset between the non-center cropped cropped area data and center cropped cropped area data; Performing preliminary cropping processing on the original image from the camera of the electronic device according to the non-center cropped cropping area data to obtain a cropping area image; Processing the cropped area image to obtain an image of a region of interest; Processing the region of interest image to obtain the second preview image; The second preview image is displayed on the preview interface.
4. The image processing method according to claim 3, characterized in that: The step of processing the cropped region image to obtain an image of the region of interest includes: Performing grayscale transformation on the cropped area image to obtain a grayscale image; Detecting a face in the grayscale image according to a face detection algorithm; The cropped area image is processed according to the face detection result to obtain the area of interest image.
5. The image processing method according to claim 4, characterized in that: The step of processing the cropped region image according to the face detection result to obtain the region of interest image includes: Based on the face detection result, a face is detected, and a face frame is drawn according to the position and size of the detected face area to obtain a grayscale image of the face frame; Performing grayscale inverse transformation on the face frame grayscale image according to the cropped area image and the offset to obtain a face frame image; The face frame image is cropped to obtain the region of interest image.
6. The image processing method according to claim 4, characterized in that: The step of processing the cropped region image according to the face detection result to obtain the region of interest image includes: Based on the face detection result that no face is detected, the cropping area image is cropped to obtain the area of interest image.
7. The image processing method according to claim 3, characterized in that: The step of processing the cropped region image to obtain an image of the region of interest includes: Performing spatial alignment on the cropped area image according to the offset, zoom ratio and SAT algorithm to obtain a transformed image; The transformed image is processed to obtain the region of interest image.
8. The image processing method according to claim 7, characterized in that: The step of processing the transformed image to obtain the region of interest image includes: Performing grayscale transformation on the cropped area image to obtain a grayscale image; Detecting a face in the grayscale image according to a face detection algorithm; The transformed image is processed according to the face detection result to obtain the region of interest image.
9. The image processing method according to claim 8, characterized in that: The step of processing the transformed image according to the face detection result to obtain the region of interest image includes: Based on the face detection result, a face is detected, and a face frame is drawn according to the position and size of the detected face area to obtain a grayscale image of the face frame; Performing grayscale inverse transformation on the face frame grayscale image according to the transformation image and the offset to obtain a face frame image; The face frame image is cropped to obtain the region of interest image.
10. The image processing method according to claim 8, characterized in that: The step of processing the transformed image according to the face detection result to obtain the region of interest image includes: Based on the face detection result that no face is detected, the transformed image is cropped to obtain the region of interest image.
11. The image processing method according to claim 3, characterized in that: The step of processing the cropped region image to obtain an image of the region of interest includes: The cropping region image is cropped to obtain the region of interest image.
12. An electronic device, characterized in that: The electronic device includes a memory, a processor, a camera and a display screen, the display screen is used to display the image or video taken by the camera, the memory is used to store instructions, and the processor is used to run the instructions stored in the memory, so that the electronic device executes the image processing method as described in any one of claims 1 to 11.
13. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores instructions, and when the instructions are executed on a computer, the computer is enabled to execute the image processing method according to any one of claims 1 to 11.
Citation Information
Patent Citations
Embedded face recognition system
CN104732198A
Image preview method and terminal
CN107155059A
Thumbnail cutting method and device, electronic device and readable storage medium
CN109447072A
Photographing method and terminal equipment
CN112019738A
Video recording method and device and electronic equipment
CN114598819A
