Image processing method, electronic device, and computer-readable storage medium

By employing a non-center cropping method to calculate the cropping area data and offset in camera applications, the issues of preview image sharpness and system power consumption during zooming are resolved, resulting in higher image resolution and lower system power consumption.

CN119255090BActive Publication Date: 2026-05-05HONOR DEVICE CO LTD
View PDF 4 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
HONOR DEVICE CO LTD
Filing Date
2024-01-10
Publication Date
2026-05-05

AI Technical Summary

Technical Problem

During zooming, existing technologies use ROI-based image output, which results in large image edges, leading to poor preview image clarity and increased system power consumption.

Method used

The cropping region data is calculated using a non-center cropping method, and the offset between the non-center cropping region data and the center cropping region data is calculated through the ROI calculation module. This adjusts the image front-end and image back-end processing flow, reduces the image edges of the cropping region, improves the resolution of the ROI image, and reduces system power consumption.

Benefits of technology

This improved the clarity of the preview image and reduced the system's power consumption, thereby reducing the computational load and difficulty of subsequent algorithm processing.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119255090B_ABST
    Figure CN119255090B_ABST
Patent Text Reader

Abstract

This application provides an image processing method, an electronic device, and a computer-readable storage medium, relating to the field of smart terminal technology, and aims to solve the problem of poor image output quality in camera applications. The image processing method includes: activating the shooting function of a camera application and displaying a first preview image on the preview interface of the camera application. The first preview image includes a target area 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 target area selection operation, a second preview image is displayed on the preview interface. The second preview image includes the target area located in the 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.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of smart terminal technology, specifically to an image processing method, an electronic device, and a computer-readable storage medium. Background Technology

[0002] During zooming, to reduce the visual abruptness when switching cameras, it's necessary to crop out areas that cover the Region of Interest (ROI) and have relatively large image edges. However, since camera applications output images based on the ROI, the ROI image obtained from areas with large image edges has a lower resolution, resulting in poor clarity in the preview image. Summary of the Invention

[0003] This application provides an image processing method, an electronic device, and a computer-readable storage medium, aiming to solve the problem of poor image output quality in camera applications.

[0004] A first aspect of this application provides an image processing method applied to an electronic device. The method includes: activating 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 region located in a non-central region 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 target region selection operation, a second preview image is displayed on the preview interface. The second preview image includes the target region located in the central region 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 center cropping, the target region is located in the non-center region of the first preview image. Based on non-center cropping, the target region is located in the center region of the second preview image. Since the image edges of the non-center cropped region are smaller than those of the center cropped region, the percentage of pixels in the non-center cropped region is greater than the percentage of pixels in the center cropped region. Furthermore, since the output image size of the camera application remains constant, the first and second preview images have the same size. Consequently, the number of pixels in the second preview image is greater than the number of pixels in the first preview image, and therefore, the resolution of the second preview image is greater than the resolution of the first preview image.

[0006] In one implementation, a first preview image is associated with a first cropped region based on an original image, which is an image captured by a camera of an electronic device. The first cropped region is located in the central region of the original image and includes a target region located in a non-central region of the first cropped region. A second preview image is associated with a second cropped region based on the original image. The second cropped region is located in a non-central region of the original image and includes a target region located in the central region of the second cropped region.

[0007] In another implementation, in response to a zoom operation and / or a target region selection operation, displaying a second preview image on a preview interface includes: calculating off-center cropped region data and the offset between the off-center cropped region data and the center cropped region data in response to the zoom operation and / or the target region selection operation; performing preliminary cropping processing on the original image from the camera of the electronic device based on the off-center cropped region data to obtain a cropped region image; processing the cropped region image to obtain a region of interest image; processing the region of interest image to obtain a second preview image; and displaying the second preview image on the preview interface.

[0008] In another implementation, the cropped region image is processed to obtain a region of interest image, including: performing a grayscale transformation on the cropped region image to obtain a grayscale image; detecting faces in the grayscale image using a face detection algorithm; and processing the cropped region image based on the face detection results to obtain the region of interest image.

[0009] In another implementation, the cropped region image is processed based on the face detection result to obtain a region of interest image, including: based on the face detection result indicating a face has been detected, drawing a face bounding box according to the position and size of the detected face region to obtain a grayscale image of the face bounding box; performing an inverse grayscale transformation on the grayscale image of the face bounding box based on the cropped region image and an offset to obtain a face bounding box image; and cropping the face bounding box image to obtain the region of interest image.

[0010] In another implementation, the cropped region image is processed according to the face detection result to obtain the region of interest image, including: cropping the cropped region image based on the face detection result that no face was detected to obtain the region of interest image.

[0011] In another implementation, the cropped region image is processed to obtain a region of interest image, including: spatially aligning the cropped region image according to an offset, zoom ratio, and the SAT algorithm to obtain a transformed image; and processing the transformed image to obtain the region of interest image.

[0012] In another implementation, the transformed image is processed to obtain a region of interest image, including: performing a grayscale transformation on the cropped region image to obtain a grayscale image; detecting faces in the grayscale image using a face detection algorithm; and processing the transformed image based on the face detection results to obtain the region of interest image.

[0013] In another implementation, the transformed image is processed based on the face detection result to obtain a region of interest image, including: based on the face detection result indicating that a face has been detected, drawing a face bounding box according to the position and size of the detected face region to obtain a grayscale image of the face bounding box; performing an inverse grayscale transformation on the grayscale image of the face bounding box according to the transformed image and an offset to obtain a face bounding box image; and cropping the face bounding box image to obtain the region of interest image.

[0014] In another implementation, the transformed image is processed based on the face detection result to obtain a region of interest image, including: cropping the transformed image based on the face detection result that no face was detected to obtain a region of interest image.

[0015] In another embodiment, processing the cropped region image to obtain a region of interest image includes: cropping the cropped region image to obtain a region of interest image.

[0016] A second aspect of this application provides an electronic device, which includes a memory, a processor, a camera, and a display screen. The display screen is used to display images or videos captured by the camera, the memory is used to store instructions, and the processor is used to execute the instructions stored in the memory, causing the electronic device to perform the image processing method of this application.

[0017] A third aspect of this application provides a computer-readable storage medium storing instructions that, when executed on a computer, cause the computer to perform the image processing method of this application.

[0018] The technical effects brought about by the second and third aspects of the embodiments of this application can be found in the relevant description of the image processing method of the first aspect above, and will not be repeated here. Attached Figure Description

[0019] Figure 1 This is a schematic diagram of the software structure of an electronic device provided as an example.

[0020] Figure 2 This is a schematic diagram of image cropping based on zoom operation, provided as an example.

[0021] Figure 3A This is a schematic diagram illustrating the selection of a target area, provided as an example.

[0022] Figure 3B yes Figure 3A A diagram illustrating the corresponding image cropping process.

[0023] Figure 4 This is a schematic diagram of the software structure of an electronic device provided in one embodiment of this application.

[0024] Figure 5 This is a schematic diagram of image cropping based on zoom operation provided in one embodiment of this application.

[0025] Figure 6A This is a schematic diagram of selecting a target area according to one embodiment of this application.

[0026] Figure 6B yes Figure 6A A diagram illustrating the corresponding image cropping process.

[0027] Figure 7 This is an interactive schematic diagram of a software module provided in one embodiment of this application.

[0028] Figure 8 This is a flowchart of an image processing method provided in one embodiment of this application.

[0029] Figure 9 yes Figure 8 A flowchart of the sub-steps of step S202.

[0030] Figure 10 This is a schematic diagram of the hardware structure of an electronic device provided in one embodiment of this application. Detailed Implementation

[0031] It should be noted that in the embodiments of this application, "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 existing alone, A and B existing simultaneously, or B existing 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, not to describe a specific order or sequence.

[0032] It should also be noted that the methods disclosed in the embodiments of this application or the methods shown in the flowcharts include one or more steps for implementing the method. Without departing from the scope of the claims, the execution order of multiple steps can be interchanged, and some steps can also be deleted.

[0033] The electronic devices in this application embodiment may include smartphones with camera functions, tablets, handheld computers, laptops, mobile internet devices (MIDs), virtual reality (VR) devices, augmented reality (AR) devices, wireless terminals in industrial control, wireless terminals in self-driving, wireless terminals in remote medical surgery, wireless terminals in smart grids, wireless terminals in transportation safety, wireless terminals in smart cities, wireless terminals in smart homes, cellular phones, cordless phones, Session Initiation Protocol (SIP) phones, Wireless Local Loop (WLL) stations, personal digital assistants (PDAs), handheld devices with wireless communication capabilities, computing devices or other processing devices connected to a wireless modem, in-vehicle devices, wearable devices, terminal devices in 5G networks, or public terrestrial mobile communication networks. Terminal devices in a network (PLMN), etc.

[0034] The software structure of electronic devices will be explained in detail below.

[0035] Figure 1 This is a schematic diagram of the software structure of an electronic device provided as an example.

[0036] The software system of electronic devices can adopt a layered architecture, which divides the software into several layers, each with a clear role and division of labor, and the layers communicate with each other through software interfaces. For example... Figure 1 As shown, the software system of an electronic device is divided into four layers, from top to bottom: Application (APP) layer, Framework (FWK) layer, Hardware Abstraction Layer (HAL) and Hardware layer.

[0037] The application layer comprises a series of application packages. These application packages may include camera applications. Camera applications may include the system camera application or third-party camera applications.

[0038] The framework layer provides application programming interfaces (APIs) 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 various APP functions and data processing. 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] Sensor nodes can be sensor-oriented control nodes used to drive and control sensors, such as controlling a camera to acquire images. After acquiring the raw image from the sensor, the sensor node sends the raw 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, leaving image margins to obtain the cropped area image, and to 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 image according to the zoom ratio and the Spatial Alignment Transform (SAT) algorithm to obtain the transformed image, and to send the transformed image to the image back-end processing module.

[0043] The image backend processing module is used to crop the transformed image and process it using image processing algorithms from the camera algorithm library to obtain a preview image, which is then sent to the camera frame. After receiving the preview image, the camera frame sends it to the camera application. Upon receiving the preview image, the camera application displays it on the preview interface.

[0044] The camera algorithm library stores a series of image processing algorithms, such as Automatic Exposure (AE) algorithm, Automatic Focus (AF) algorithm, Electronic Image Stabilization (EIS) algorithm, and Picture Quality (PQ) algorithm.

[0045] The hardware layer includes image front-end processing hardware, image back-end processing hardware, and sensors. 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 cameras, ultra-wide-angle cameras, and telephoto cameras. Each camera has a corresponding field of view (FOV) and focal length. For example, when using an electronic device to photograph a distant object, the zoom level can be increased to bring the electronic device closer to the object. Based on different zoom levels and different object distances, using cameras with different focal lengths for taking photos / videos can yield images with higher clarity. During the zoom process, when a certain zoom level is reached, the electronic device switches between different cameras. For example, as the zoom level increases from its minimum value, the electronic device will sequentially use an ultra-wide-angle camera, a wide-angle camera, and a telephoto camera.

[0046] Currently, image front-end processing modules and image back-end processing modules typically use center-cropping to crop images. During zooming, to reduce the visual abruptness of camera switching, it's necessary to crop an area that covers the Region of Interest (ROI) and has relatively large image edges. For example, when switching from a wide-angle camera to an ultra-wide-angle camera... Figure 2 As shown, due to the reduced zoom ratio, during the camera application's image output process, region A0 is the original image region, region A1 is the cropped region after processing by the image front-end processing module, and regions A2 and A3 are the ROIs for the wide-angle and ultra-wide-angle cameras, respectively, processed by the image back-end processing module. Before switching cameras, region A1 needs to cover region A2. After switching cameras, region A1 needs to cover region A3. To reduce the visual disharmony during camera switching, the image front-end processing module needs to crop a larger area that can cover regions A2 and A3. Obviously, the image edges of region A1 are relatively large. Since subsequent image output is based on region A3, the large image edges of region A1 will reduce the resolution of region A3, resulting in poor clarity of the preview image.

[0047] Furthermore, in scenarios involving directional zoom, to display the target area, it is necessary to crop out an area that covers the target area and has large image edges. For example, such as... Figure 3A and Figure 3B As shown, on the camera app's preview screen, in response to the user's... Figure 3AThe operation of selecting the target area B1 on the initial preview image B0, as shown, involves the image front-end processing module cropping the image during the camera application rendering process. Figure 3B The cropped area B2 is shown. Clearly, because the image front-end processing module uses a center-cropping method to crop the original image captured by the camera, the image edges in cropped area B2 are relatively large. Since subsequent image output is based on the target area B1, the large image edges in cropped area B2 will increase the computational load and difficulty of subsequent algorithm processing, thereby increasing system power consumption.

[0048] Based on this, embodiments of this application provide an image processing method, an electronic device, and a computer-readable storage medium, aiming to solve the problems of poor image output and high system power consumption in camera applications.

[0049] The image processing method of this application embodiment is described in detail below with reference to the software structure of the electronic device.

[0050] Figure 4 This is a schematic diagram of the software structure of an electronic device provided in one embodiment of this application.

[0051] Compared to Figure 1 The software structure shown, in this embodiment, is similar to the structure of the camera hardware abstraction layer. Figure 1 The structures of the camera hardware abstraction layers shown are different. For example... Figure 4 As shown, the camera hardware abstraction layer includes third-party platforms and self-developed platforms. The third-party platforms are provided by chip manufacturers, while the self-developed platforms are provided by electronic device manufacturers.

[0052] The third-party platform includes a customization module, functional modules, and a camera algorithm library. The customization module includes a camera framework interface for interaction between the camera hardware abstraction layer and the camera framework. The functional modules are application integration modules defined by the chip manufacturer. These modules include sensor nodes, image front-end processing modules, face bounding box conversion modules, and image back-end processing modules.

[0053] The self-developed platform includes an ROI calculation module, a multi-camera decision-making module, a face bounding box algorithm module, and a customization module adaptation layer, a decoupling layer, and a feature layer. The feature layer includes a multi-camera switching adaptation layer and a face bounding box transformation adaptation layer. The ROI calculation module interacts with the customization module through the customization module adaptation layer. The multi-camera decision-making module interacts with the customization module through the decoupling layer and the multi-camera switching adaptation layer, and also interacts with the image front-end processing module and the image back-end processing module through the multi-camera switching adaptation layer. The face bounding box algorithm module interacts with the face bounding box transformation module through the face bounding box transformation adaptation layer.

[0054] Specifically, the customization module is used to acquire sensing data from various sensors and send the sensing data to the customization module adaptation layer. This sensing data may include camera-related parameters and image-related parameters. After receiving the sensing data, the customization module adaptation layer sends the sensing data to the ROI calculation module.

[0055] The ROI calculation module is used to calculate the cropping region data using a non-center cropping method based on the sensed data and the ROI algorithm. It also calculates the offsets between the non-center and center cropping region data, and sends the non-center cropping region data and offsets to the customization module's adaptation layer. The cropping region data includes the position and size of the cropping region. For example, the cropping region data is CropRegion(left,top,w,h), where left represents the distance between the cropping region and the left edge of the image, top represents the distance between the cropping region and the top edge of the image, w represents the width of the cropping region, and h represents the height of the cropping region.

[0056] After receiving the cropping region data and offset, the customization module adaptation layer sends the cropping region data and offset to the customization module. The customization module, after receiving the cropping region data and offset, sends the cropping region data and offset to the image front-end processing module, and also sends the offset to the decoupling layer. The decoupling layer, after receiving the offset, sends the offset to the multi-camera switching adaptation layer.

[0057] After acquiring the raw image from the sensor, the sensor node sends the raw image to the image front-end processing module. Upon receiving the cropping region data and the raw image, the image front-end processing module performs preliminary cropping on the raw image based on the cropping region data, reserving image edges to obtain the cropped region image. This cropped region image is then sent to the multi-camera switching adaptation layer and the face bounding box 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 cropped area image to the multi-camera decision module.

[0059] The multi-camera decision module spatially aligns the cropped region image based on the offset, zoom level, and SAT algorithm to obtain a transformed image, and then sends 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 back-end processing module.

[0060] The face bounding box conversion module performs grayscale transformation on the cropped region image to obtain a grayscale image, and sends the grayscale image to the face bounding box conversion adaptation layer. After receiving the grayscale image, the face bounding box conversion adaptation layer sends the grayscale image to the face bounding box algorithm module.

[0061] The face bounding box algorithm module is used to detect faces in a grayscale image based on a face detection algorithm, and draw face bounding boxes based on the position and size of the detected face regions, thereby obtaining a grayscale image of the face bounding boxes. This grayscale image is then sent to the face bounding box conversion and adaptation layer. After receiving the grayscale image of the face bounding boxes, the face bounding box conversion and adaptation layer sends it to the image backend processing module.

[0062] The image backend processing module performs an inverse grayscale transformation on the grayscale image of the face bounding box based on the transformed image and offset, thus obtaining the face bounding box image. This face bounding box image is then cropped to obtain the Region of Interest (ROI) image. The ROI image is then processed using image processing algorithms from the camera algorithm library to obtain a preview image, which is then sent to the customization module. After receiving the preview image, the customization module sends it to the camera frame via the camera frame interface. The camera frame, after receiving the preview image, sends it to the camera application. The camera application, after receiving the preview image, displays it on the preview interface.

[0063] In this embodiment, the preview image corresponds to the face region in the original image. In other embodiments, since the face bounding box algorithm module does not detect a face, the image back-end processing module crops the transformed image to obtain a ROI image. Then, it processes the ROI image using image processing algorithms from the camera algorithm library to obtain the preview image. In this case, the preview image does not contain a face bounding box.

[0064] Understandable. Figure 4 The layers in the illustrated software structure 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 illustrated, and each layer may include more or fewer components; this application embodiment does not impose any limitations.

[0065] In the above embodiments, the ROI calculation module calculates the cropping region data using a non-center cropping method, and calculates the offset between the non-center cropping region data and the center cropping region data. The offset is then transmitted to the image front-end processing module and the image back-end processing module. Based on the offset, the image front-end and back-end processing modules adjust the image processing flow corresponding to the previously default center cropping, thereby reducing the image edges in the cropped region, improving the resolution of the ROI image, and consequently improving the clarity of the preview image. Furthermore, because the image edges in the cropped region are reduced, the computational load and difficulty of subsequent algorithm processing are reduced, thus lowering system power consumption.

[0066] For example, switching from a wide-angle camera to an ultra-wide-angle camera, such as... Figure 5As shown, based on the reduced zoom ratio, during the image output process in camera applications, region C0 is the original image region, region C1 is the cropped region after processing by the image front-end processing module, and regions C2 and C3 are the ROIs corresponding to the wide-angle camera and ultra-wide-angle camera, respectively, after processing by the image back-end processing module. Clearly, compared to... Figure 2 In comparison, the image edges in region C1 are significantly reduced. Since the image front-end processing module performs preliminary cropping based on the cropping region data and offset from the non-center cropping module of the ROI calculation module, region C1 only needs to cover region C3. This reduces the image edges in region C1, thereby improving the resolution of the ROI image when the zoom level changes, and thus improving the clarity of the preview image.

[0067] For example, in scenarios involving directional zoom, such as Figure 6A and Figure 6B As shown, in response to the user's Figure 6A The operation of selecting the target area D1 on the initial preview image D0, as shown, involves the image front-end processing module cropping the image during the camera application rendering process. Figure 6B The cropping region D2 is shown. Clearly, it is related to... Figure 3B Compared to the cropping area B2 shown, Figure 6B The image edges of the cropped region D2 shown are significantly reduced. Since the image front-end processing module performs preliminary cropping based on the cropped region data and offset from the non-centered cropping module of the ROI calculation module, the cropped region D2 can be centered on the target region D1, thereby reducing the computational load and difficulty of subsequent algorithm processing, and thus reducing system power consumption.

[0068] Figure 7 This is an interactive schematic diagram of a software module provided in one embodiment of this application.

[0069] Compared to Figure 4 The software structure shown is simplified in this embodiment. Specifically, Figure 7 The software modules involved include sensor nodes, image front-end processing modules, ROI calculation modules, image back-end processing modules, face bounding box conversion modules, face bounding box algorithm modules, and camera algorithm libraries.

[0070] like Figure 7 As shown, in a scenario where the zoom level remains constant, in response to the camera application triggering the sensor to acquire the original image, the sensor node obtains the original image acquired by the sensor and sends the original image to the image front-end processing module.

[0071] The ROI calculation module receives sensing data from the sensor, calculates the cropping region data using a non-center cropping method based on the sensing data and the ROI algorithm, calculates the offset between the non-center cropping region data and the center cropping region data, and sends the non-center cropping region data and offset to the image front-end processing module.

[0072] After receiving the cropping region data and offset, the image front-end processing module performs preliminary cropping processing on the original image based on the cropping region data, reserving the image edges to obtain the cropping region image, and sends the cropping region image and offset to the image back-end processing module and the face frame conversion module.

[0073] After receiving the cropped area image and offset, the face bounding box conversion module performs grayscale transformation on the cropped area image to obtain a grayscale image, and then sends the grayscale image and offset to the face bounding box algorithm module.

[0074] After receiving the grayscale image and offset, the face bounding box algorithm module detects faces in the grayscale image according to the face detection algorithm, and draws face bounding boxes based on the position and size of the detected face regions, thereby obtaining a grayscale image of the face bounding box, and sending the grayscale image of the face bounding box to the image backend processing module.

[0075] After receiving the cropped area image, offset, and grayscale image of the face bounding box, the image backend processing module performs an inverse grayscale transformation on the grayscale image of the face bounding box based on the cropped area image and offset to obtain the face bounding box image. Then, it performs cropping processing on the face bounding box image to obtain the ROI image. Finally, it uses image processing algorithms from the camera algorithm library to process the ROI image to obtain the preview image.

[0076] In this embodiment, the ROI calculation module calculates the cropping region data using a non-center cropping method, calculates the offset between the non-center cropping region data and the center cropping region data, and transmits the offset to the image front-end processing module. The image front-end processing module then transmits the offset to the image back-end processing module. Both modules adjust the image processing flow corresponding to the previously default center cropping based on the offset, thereby reducing the image edges in the cropped region, improving the resolution of the ROI image, and consequently enhancing the clarity of the preview image. Furthermore, because the image edges in the cropped region are reduced, the computational load and difficulty of subsequent algorithm processing are reduced, thus lowering system power consumption.

[0077] Figure 8 This is a flowchart of an image processing method provided in one embodiment of this application.

[0078] Image processing methods are applied to electronic devices, such as Figure 8As shown, the image processing method includes the following steps:

[0079] S101, based on the camera application's shooting function, displays the first preview image on the camera application's preview interface.

[0080] The first preview image includes the target region, which 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 cropped region based on the original image, which is an image captured by a camera. Based on a center-cropping method, the first cropped region is located in the center of the original image. The first cropped region includes a target region, which is located in a non-center region of the first cropped region.

[0082] S102, in response to zoom operation and / or target area selection operation, displays a second preview image on the preview interface of the camera application.

[0083] The second preview image includes the target region, which is located in the center of the second preview image. The second preview image has a resolution that is greater than the first resolution.

[0084] It can be understood that zoom operations can include clicking the zoom control, swiping the zoom control, and swiping the interface with two fingers. Two-finger swiping can include swiping with two fingers close together and swiping with two fingers spread apart. Selecting a target area can include clicking or touching the target area.

[0085] In this embodiment, the second preview image is associated with a second cropping region based on the original image. Based on a non-center cropping method, the second cropping region is located in a non-center region of the original image. The second cropping region includes a target region, which is located in the center of the second cropping region.

[0086] Since the image edge of the second cropping region is smaller than that of the first cropping region, the percentage of pixels in the target region in the second cropping region is greater than that in the first cropping region. Also, since the output image size of the camera application remains unchanged, the first preview image and the second preview image have the same size. Therefore, the number of pixels in the target region in the second preview image is greater than that in the first preview image, and consequently, the resolution of the second preview image is greater than that of the first preview image.

[0087] In one embodiment, such as Figure 9 As shown, step S102 above includes the following sub-steps:

[0088] S201, in response to zoom operation and / or target area selection operation, acquires sensing data from the sensor.

[0089] S202, based on the sensing data and the ROI algorithm, calculate the cropping region data of non-center cropping and the offset between the cropping region data of non-center cropping and the cropping region data of center cropping.

[0090] S203, perform preliminary cropping processing on the original image from the camera based on the cropping region data of the non-center cropping region to obtain the cropping region image.

[0091] In this embodiment, after the electronic device completes step S203, steps S204 and S205 are executed in parallel.

[0092] S204: Spatial alignment of the cropped region image is performed based on the offset, zoom ratio, and SAT algorithm to obtain the transformed image.

[0093] In this embodiment, after the electronic device completes step S204, it executes step S209 or S211.

[0094] S205, perform grayscale transformation on the cropped area image to obtain a grayscale image.

[0095] S206, Detect faces in grayscale images using face detection algorithms.

[0096] S207, Determine if a face has been detected.

[0097] If a face is detected, proceed to steps S208 to S210. If no face is detected, proceed to step S211.

[0098] S208: Draw a face bounding box based on the position and size of the detected face region to obtain a grayscale image of the face bounding box.

[0099] S209, Perform inverse grayscale transformation on the grayscale image of the face bounding box according to the transformed image and the offset to obtain the face bounding box image.

[0100] S210, crop the face bounding box image to obtain the ROI image.

[0101] S211, crop the transformed image to obtain the ROI image.

[0102] In this embodiment, after the electronic device completes step S210 or S211, it executes step S212.

[0103] S212, call the image processing algorithm in the camera algorithm library to process the ROI image and obtain the second preview image.

[0104] S213 displays a second preview image on the camera application's preview interface.

[0105] In the above embodiments, the offsets between the non-center-cropped cropping region data and the center-cropped cropping region data are calculated. Based on these offsets, the image processing flow corresponding to the previous default center cropping is adjusted. This reduces the image edges in the cropped region, thereby improving the resolution of the ROI image and ultimately enhancing the clarity of the preview image. Furthermore, because the image edges in the cropped region are reduced, the computational load and difficulty of subsequent algorithm processing are decreased, resulting in lower system power consumption.

[0106] It is understood that in some embodiments, the electronic device may omit step S204, and correspondingly, the transformed image in step S209 or S211 is replaced with the cropped region image. In other embodiments, the electronic device may crop the cropped region image after performing step S203 to obtain the ROI image, and then perform steps S212 to S213.

[0107] Figure 10 This is a schematic diagram of the hardware structure of an electronic device provided in one embodiment of this application.

[0108] like Figure 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, a headphone jack 170D, a sensor module 180, buttons 190, a motor 191, an indicator 192, a camera 193, a display screen 194, and a Subscriber Identification Module (SIM) card interface 195, etc. The sensor module 180 may include a pressure sensor 180A, a gyroscope sensor 180B, a barometric pressure sensor 180C, a magnetic sensor 180D, an accelerometer 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.

[0109] The processor 110 can execute instructions stored in the internal memory 121, causing the electronic device 100 to perform the image processing method provided in the above embodiments.

[0110] Processor 110 may include one or more processing units, such as an application processor (AP), a modem processor, a graphics processing unit (GPU), an image signal processor (ISP), a controller, a video codec, a digital signal processor (DSP), a baseband processor, and / or a neural network processing unit (NPU). These different processing units may be independent devices or integrated into one or more processors.

[0111] The controller can generate operation control signals based on the instruction opcode and timing signals to complete the control of instruction fetching and execution.

[0112] The processor 110 may also include a memory for storing instructions and data. In some embodiments, the memory in the processor 110 is a cache memory. This memory can store instructions or data that the processor 110 has just used or that are used repeatedly. If the processor 110 needs to use the instruction or data again, it can retrieve it directly from the memory. This avoids repeated accesses, 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. Interfaces may include an Inter-Integrated Circuit (I2C) interface, an Inter-Integrated Circuit Sound (I2S) interface, a Pulse Code Modulation (PCM) interface, a Universal Asynchronous Receiver / Transmitter (UART) interface, a Mobile Industry Processor Interface (MIPI) interface, 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 I2C buses. The processor 110 can couple to the touch sensor 180K, charger, flash, camera 193, etc., through different I2C bus interfaces. For example, the processor 110 can couple to the touch sensor 180K through the I2C interface, enabling the processor 110 and the touch sensor 180K to communicate through the I2C bus interface, thereby realizing the touch function of the electronic device 100.

[0115] The I2S interface can be used for audio communication. In some embodiments, the processor 110 may include multiple I2S buses. The processor 110 can be coupled to the audio module 170 via the I2S bus to enable communication between the processor 110 and the audio module 170. In some embodiments, the audio module 170 can transmit audio signals to the wireless communication module 160 via the I2S interface to enable the function of answering phone calls 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 the 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, enabling the function of answering phone calls through 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 used for asynchronous communication. This bus can be a bidirectional communication bus. It converts the data to be transmitted between serial and parallel communication. In some embodiments, the UART interface is typically 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 via the UART interface to implement Bluetooth functionality. In some embodiments, the audio module 170 can transmit audio signals to the wireless communication module 160 via the UART interface to enable music playback through Bluetooth headphones.

[0118] The MIPI interface can be used to connect the processor 110 to peripheral devices such as the display screen 194 and the camera 193. The MIPI interface includes a Camera Serial Interface (CSI) and a Display Serial Interface (DSI). In some embodiments, the processor 110 and the camera 193 communicate via the CSI interface to enable the electronic device 100 to capture images. The processor 110 and the display screen 194 communicate via the DSI interface to enable the electronic device 100 to display images.

[0119] The GPIO interface can be configured via software. It can be configured as a control signal or a data signal. In some embodiments, the GPIO interface can be used to connect the processor 110 to a camera 193, a display screen 194, a wireless communication module 160, an audio module 170, a 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] USB port 130 is a USB standard compliant interface, specifically a Mini USB port, Micro USB port, USB Type-C port, etc. USB port 130 can be used to connect a charger to charge electronic device 100, and can also be used for data transfer between electronic device 100 and peripheral devices. It can also be used to connect headphones for audio playback. This interface can also be used to connect other electronic devices, such as AR devices.

[0121] It is understood that the interface connection relationships between the modules illustrated in the embodiments of this application are merely illustrative and do not constitute a limitation on the structure of the electronic device. In other embodiments of this application, the electronic device may also employ different interface connection methods or combinations of multiple interface connection methods as described in the above embodiments.

[0122] The charging management module 140 receives charging input from a charger. The charger can be a wireless charger or a wired charger. In some wired charging embodiments, the charging management module 140 receives charging input from the wired charger via the USB interface 130. In some wireless charging embodiments, the charging management module 140 receives wireless charging input via the wireless charging coil of the electronic device 100. While charging the battery 142, the charging management module 140 can also supply power to the electronic device via the power management module 141.

[0123] The power management module 141 connects 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, internal memory 121, display screen 194, camera 193, and wireless communication module 160. The power management module 141 can also monitor parameters such as battery capacity, battery cycle count, and battery health status (leakage current, impedance). In some other embodiments, the power management module 141 may also be located within the processor 110. In other embodiments, the power management module 141 and the charging management module 140 may be located in the same device.

[0124] The wireless communication function of electronic device 100 can be implemented through antenna 1, antenna 2, mobile communication module 150, wireless communication module 160, modem processor, and baseband processor.

[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 one or more communication frequency bands. Different antennas can also be multiplexed to improve antenna utilization. For example, antenna 1 can be multiplexed as a diversity antenna for a wireless local area network. In some other embodiments, the antennas can be used in conjunction with tuning switches.

[0126] The mobile communication module 150 can provide solutions for wireless communication, including 2G / 3G / 4G / 5G, applied to the electronic device 100. The mobile communication module 150 may include at least one filter, switch, power amplifier, low-noise amplifier (LNA), etc. The mobile communication module 150 can receive electromagnetic waves via antenna 1, and perform filtering, amplification, and other processing on the received electromagnetic waves before transmitting them to a modem processor for demodulation. The mobile communication module 150 can also amplify the signal modulated by the modem processor and convert it into electromagnetic waves for radiation via antenna 1. In some embodiments, at least some functional modules of the mobile communication module 150 may be housed in the processor 110. In some embodiments, at least some functional modules of the mobile communication module 150 and at least some modules of the processor 110 may be housed in the same device.

[0127] The modem processor may include a modulator and a demodulator. The modulator modulates the low-frequency baseband signal to be transmitted into a mid-to-high frequency signal. The demodulator demodulates 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 processing by the baseband processor, the low-frequency baseband signal is transmitted to the application processor. The application processor outputs sound signals through audio devices (not limited to speaker 170A, receiver 170B, etc.) or displays images or videos through the display screen 194. In some embodiments, the modem processor may be a separate device. In other embodiments, the modem processor may be independent of the processor 110 and may be housed in the same device as the mobile communication module 150 or other functional modules.

[0128] The wireless communication module 160 can provide solutions for wireless communication applications on the electronic device 100, including Wireless Local Area Network (WLAN) (such as Wireless Fidelity (Wi-Fi) networks), Bluetooth (BT), Global Navigation Satellite System (GNSS), Frequency Modulation (FM), Near Field Communication (NFC), and Infrared (IR). 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 antenna 2, performs frequency modulation and filtering of the electromagnetic wave signals, and sends the processed signal to processor 110. The wireless communication module 160 can also receive signals to be transmitted from processor 110, perform frequency modulation and amplification, and convert them into electromagnetic waves for radiation via antenna 2.

[0129] In some embodiments, antenna 1 of electronic device 100 is coupled to mobile communication module 150, and antenna 2 is coupled to wireless communication module 160, enabling electronic device 100 to communicate with networks and other devices via wireless communication technology. 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 technologies, etc. GNSS can 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] Electronic device 100 implements display functions through a GPU, a display screen 194, and an application processor. The GPU is a microprocessor for image processing, connected to the display screen 194 and the application processor. The GPU performs mathematical and geometric calculations and is used for graphics rendering. Processor 110 may include one or more GPUs, which execute program instructions to generate or modify 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 (AMOLED), a flexible light-emitting diode (FLED), a miniature LED, a microLED, a quantum dot light-emitting diode (QLED), etc. In some embodiments, the electronic device 100 may include one or N display screens 194, where N is a positive integer greater than 1.

[0132] Electronic device 100 can perform shooting functions through ISP, camera 193, video codec, GPU, display screen 194 and application processor.

[0133] The ISP (Image Signal Processor) is used to process data fed back from the camera 193. For example, when taking a picture, the shutter is opened, and light is transmitted through the lens to the camera's photosensitive element. The light signal is converted into an electrical signal, and the camera's photosensitive element transmits the electrical signal to the ISP for processing, transforming it into an image visible to the naked eye. The ISP can also perform algorithmic optimization of image noise, brightness, and skin tone. The ISP can also optimize parameters such as exposure and color temperature of the shooting scene. In some embodiments, the ISP can be set in the camera 193.

[0134] Camera 193 is used to capture still images or videos. An optical image of the scene is generated through a lens and projected onto a photosensitive element. The photosensitive element can be a charge-coupled device (CCD) or a complementary metal-oxide-semiconductor (CMOS) phototransistor. The photosensitive element converts the light signal into an electrical signal, which is then transmitted to an ISP (Internet Service Provider) for conversion into a digital image signal. The ISP outputs the digital image signal to a DSP (Digital Signal Processor) for processing. The DSP converts the digital image signal into image signals in standard formats such as RGB and YUV. In some embodiments, the electronic device 100 may include one or N cameras 193, where N is a positive integer greater than 1.

[0135] Digital signal processors (DSPs) are used to process digital signals. Besides digital image signals, they can also process other digital signals. For example, when electronic device 100 selects a frequency, the DSP can perform Fourier transforms on the frequency energy.

[0136] Video codecs are used to compress or decompress digital video. Electronic device 100 may support one or more video codecs. Thus, electronic device 100 can play or record videos in various encoding formats, such as Moving Picture Experts Group (MPEG) 1, MPEG2, MPEG3, MPEG4, etc.

[0137] NPU stands for Neural Network (NN) computing processor. By borrowing the structure of biological neural networks, such as the transmission patterns between neurons in the human brain, it can rapidly process input information and continuously learn on its own. NPUs enable intelligent cognitive applications in electronic devices, such as image recognition, facial recognition, speech recognition, and text understanding.

[0138] The external storage 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 storage interface 120 to perform data storage functions. For example, music, video, and other files can be saved on the external memory card.

[0139] Internal memory 121 can be used to store executable program code, including instructions. Internal memory 121 may include a program storage area and a data storage area. The program storage area may store the operating system, at least one application program required for a function (such as sound playback, image playback, etc.). The data storage area may store data created during the use of electronic device 100 (such as audio data, phonebook, etc.). Furthermore, internal memory 121 may include high-speed random access memory and may also include non-volatile memory, such as at least one disk storage device, flash memory device, Universal Flash Storage (UFS), etc. Processor 110 executes various functional applications and data processing of electronic device 100 by running instructions stored in internal memory 121 and / or instructions stored in memory located within the processor.

[0140] Electronic device 100 can implement audio functions such as music playback and recording through audio module 170, speaker 170A, receiver 170B, microphone 170C, headphone jack 170D, and application processor.

[0141] The audio module 170 is used to convert digital audio information into analog audio signals for output, and also to convert analog audio input into digital audio signals. The audio module 170 can also be used for encoding and decoding audio signals. In some embodiments, the audio module 170 may be located in the processor 110, or some functional modules of the audio module 170 may be located in the processor 110.

[0142] The speaker 170A, also known as a "loudspeaker," is used to convert audio electrical signals into sound signals. The electronic device 100 can listen to music or make hands-free calls through the speaker 170A.

[0143] The receiver 170B, also known as the "earpiece," is used to convert audio electrical signals into sound signals. When the electronic device 100 answers a telephone call or voice message, the receiver 170B can be brought close to the ear to listen to the voice.

[0144] Microphone 170C, also known as a "microphone" or "voice transducer," is used to convert sound signals into electrical signals. When making a phone call or sending a voice message, the user can speak by bringing their mouth close to microphone 170C, inputting the sound signal into microphone 170C. Electronic device 100 may have at least one microphone 170C. In some embodiments, electronic device 100 may have two microphones 170C, which, in addition to collecting sound signals, can also perform noise reduction. In other embodiments, electronic device 100 may also have three, four, or more microphones 170C, which can collect sound signals, reduce noise, identify the sound source, and perform directional recording, etc.

[0145] The 170D headphone jack is used to connect wired headphones. The 170D headphone jack can be a USB 130 interface, or a 3.5mm Open Mobile Terminal Platform (OMTP) standard interface, or a Cellular Telecommunications Industry Association of the USA (CTIA) standard interface.

[0146] Pressure sensor 180A is used to sense pressure signals and convert them into electrical signals. In some embodiments, pressure sensor 180A can be disposed on display screen 194. There are many types of pressure sensors 180A, such as resistive pressure sensors, inductive pressure sensors, and capacitive pressure sensors. A capacitive pressure sensor may include at least two parallel plates with conductive material. When force is applied to pressure sensor 180A, the capacitance between the electrodes changes. Electronic device 100 determines the pressure intensity based on the change in capacitance. When a touch operation is applied to display screen 194, electronic device 100 detects the touch operation intensity based on pressure sensor 180A. Electronic device 100 can also calculate the touch position based on the detection signal from pressure sensor 180A. In some embodiments, touch operations applied to the same touch position but with different touch operation intensities can correspond to different operation commands. For example: when a touch operation with an intensity less than a first pressure threshold is applied to the SMS application icon, a command to view an SMS is executed. When a touch operation with an intensity greater than or equal to the first pressure threshold is applied to the SMS application icon, a command to create a new SMS is executed.

[0147] The gyroscope sensor 180B can be used to determine the motion attitude of the electronic device 100. In some embodiments, the gyroscope sensor 180B can determine the angular velocity of the electronic device 100 about three axes (i.e., the x, y, and z axes). The gyroscope sensor 180B can be used for image stabilization. For example, when the shutter is pressed, the gyroscope sensor 180B detects the angle of the shake of the electronic device 100, calculates the distance that the lens module needs to compensate based on the angle, and allows the lens to counteract the shake of the electronic device 100 by moving in the opposite direction, thus achieving image stabilization. The gyroscope sensor 180B can also be used in navigation, motion-sensing games, and other scenarios.

[0148] The barometric pressure sensor 180C is used to measure air pressure. In some embodiments, the electronic device 100 calculates altitude using the air pressure value measured by the barometric pressure sensor 180C to assist in 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 cover. 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 using the magnetic sensor 180D. Then, based on the detected opening and closing state of the cover or the flip cover, features such as automatic flip unlocking can be set.

[0150] The 180E accelerometer can detect the magnitude of acceleration of electronic device 100 in various directions (typically three axes). When electronic device 100 is stationary, it can detect the magnitude and direction of gravity. It can also be used to identify the posture of electronic devices and applied to applications such as screen orientation switching and pedometers.

[0151] A distance sensor 180F is used to measure distance. Electronic device 100 can measure distance via infrared or laser. In some embodiments, during a shooting scene, electronic device 100 can utilize the distance sensor 180F to measure distance for rapid focusing.

[0152] The proximity sensor 180G may include, for example, a light-emitting diode (LED) and a light detector, such as a photodiode. The LED may be an infrared LED. The electronic device 100 emits infrared light outward through the LED. The electronic device 100 uses the photodiode to detect infrared reflected light from nearby objects. When sufficient reflected light is detected, it can be determined that there is an object nearby. When insufficient reflected light is detected, the electronic device 100 can determine that there is no object nearby. The electronic device 100 may use the proximity sensor 180G to detect when a user holds the electronic device 100 close to their ear for a call, so as to automatically turn off the screen to save power. The proximity sensor 180G can also be used in holster mode and pocket mode for automatic unlocking and locking of the screen.

[0153] The ambient light sensor 180L is used to sense the brightness of ambient light. The electronic device 100 can adaptively adjust the brightness of the display screen 194 based on the sensed 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 work with the proximity 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 utilize the characteristics of the collected fingerprints to achieve fingerprint unlocking, accessing application locks, taking photos with fingerprints, answering calls with fingerprints, etc.

[0155] Temperature sensor 180J is used to detect temperature. In some embodiments, electronic device 100 uses the temperature detected by temperature sensor 180J to execute a temperature handling strategy. For example, when the temperature reported by temperature sensor 180J exceeds a threshold, electronic device 100 performs thermal protection by reducing the performance of a processor located near temperature sensor 180J to reduce power consumption. In other embodiments, when the temperature is below another threshold, electronic device 100 heats battery 142 to prevent abnormal shutdown of electronic device 100 due to low temperature. In still other embodiments, when the temperature is below yet another threshold, electronic device 100 boosts the output voltage of battery 142 to prevent abnormal shutdown due to low temperature.

[0156] Touch sensor 180K, also known as a "touch device," can be located on display screen 194. The touch sensor 180K and display screen 194 together form a touchscreen, also known as a "touchscreen." Touch sensor 180K detects touch operations applied to or near it. The touch sensor can transmit 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 display screen 194. In other embodiments, touch sensor 180K may also be located on the surface of electronic device 100, in a different position than display screen 194.

[0157] Buttons 190 include a power button, volume buttons, etc. Buttons 190 can be mechanical buttons or touch buttons. Electronic device 100 can receive button input and generate key signal inputs related to user settings and function control of electronic device 100.

[0158] Motor 191 can generate vibration alerts. Motor 191 can be used for incoming call vibration alerts or for touch vibration feedback. For example, different vibration feedback effects can correspond to different touch operations applied to different applications (such as taking photos, playing audio, etc.). Motor 191 can also correspond to different vibration feedback effects for touch operations applied to different areas of the display screen 194. Different application scenarios (such as time reminders, receiving messages, alarm clocks, games, etc.) can also correspond to different vibration feedback effects. The touch vibration feedback effect can also be customized.

[0159] Indicator 192 can be an indicator light, which can be used to indicate 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 inserted into or removed from the SIM card interface 195 to make contact with and separate from the electronic device 100. The electronic device 100 can support one 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, etc. Multiple cards can be inserted into the same SIM card interface 195 simultaneously. The multiple cards can be of the same or different types. The SIM card interface 195 is also compatible with different types of SIM cards. The SIM card interface 195 is also compatible with external memory cards. The electronic device 100 interacts with the network through the SIM card to realize functions such as calls and data communication. 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 understood that the structures illustrated in the embodiments of this application do not constitute a specific limitation on the electronic device. In other embodiments, 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.

[0162] This application also provides a computer-readable storage medium storing instructions that, when executed on a computer, cause the computer to perform the image processing method of this application.

[0163] Computer-readable storage media include volatile and non-volatile, 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 (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory, compact disc read-only memory (CD-ROM), digital versatile disc (DVD) or other optical disc storage, magnetic cartridges, magnetic tapes, disk storage or other magnetic storage devices, or any other medium that can be used to store desired information and is accessible to a computer.

[0164] The embodiments of this application have been described in detail above with reference to the accompanying drawings. However, this application is not limited to the above embodiments. Within the scope of knowledge possessed by those skilled in the art, various changes can be made without departing from the spirit of this application.

Claims

1. An image processing method applied to electronic devices, characterized in that, The method includes: The camera application initiates the shooting function, and a first preview image is displayed on the preview interface of the camera application; based on the center cropping method, the first cropping area corresponding to the first preview image is located in the center area of ​​the original image captured by the camera; based on the fact that the first cropping area includes a target area, and the target area is located in the non-center area of ​​the first cropping area, the first preview image includes the target area, the target area is located in the non-center area of ​​the first preview image, and the resolution of the first preview image is a first resolution; In response to the zoom operation and / or the target region selection operation, the non-center cropped region data and the offset between the non-center cropped region data and the center cropped region data are calculated based on the sensor's sensing data and the region of interest (ROI) algorithm. The original image from the camera is initially cropped based on the non-center cropped cropping region data to obtain the cropped region image; The cropped region image is processed according to the offset to obtain the ROI image; The ROI image is processed according to an image processing algorithm to obtain a second preview image; The second preview image is displayed on the preview interface; based on the non-center cropping method, the second cropping area corresponding to the second preview image is located in the non-center area of ​​the original image; based on the second cropping area including the target area, and the target area being located in the center area of ​​the second cropping area, the second preview image includes the target area, the target area being located in the center area of ​​the second preview image, the resolution of the second preview image is a second resolution, based on the image edge of the second cropping area being smaller than the image edge of the first cropping area, and the second resolution being greater than the first resolution.

2. The image processing method as described in claim 1, characterized in that, The step of processing the cropped region image according to the offset to obtain the ROI image includes: Perform grayscale transformation on the cropped area image to obtain a grayscale image; The face in the grayscale image is detected using a face detection algorithm; The cropped region image is processed based on the face detection results and the offset to obtain the ROI image.

3. The image processing method as described in claim 2, characterized in that, The step of processing the cropped region image based on the face detection result and the offset to obtain the ROI image includes: Based on the face detection result that a face has been detected, a face bounding box is drawn according to the position and size of the detected face region, and a grayscale image of the face bounding box is obtained. The face frame image is obtained by performing an inverse grayscale transformation on the grayscale image of the face frame based on the cropped area image and the offset. The face bounding box image is cropped to obtain the ROI image.

4. The image processing method as described in claim 2, characterized in that, The step of processing the cropped region image based on the face detection result and the offset to obtain the ROI image includes: Based on the face detection result that no face was detected, the cropped region image is cropped to obtain the ROI image.

5. The image processing method as described in claim 1, characterized in that, The step of processing the cropped region image according to the offset to obtain the ROI image includes: The cropped region image is spatially aligned using the offset, zoom ratio, and spatial alignment transformation SAT algorithm to obtain the transformed image. The transformed image is processed to obtain the ROI image.

6. The image processing method as described in claim 5, characterized in that, The process of processing the transformed image to obtain the ROI image includes: Perform grayscale transformation on the cropped area image to obtain a grayscale image; The face in the grayscale image is detected using a face detection algorithm; The transformed image is processed based on the face detection results to obtain the ROI image.

7. The image processing method as described in claim 6, characterized in that, The step of processing the transformed image based on the face detection results to obtain the ROI image includes: Based on the face detection result that a face has been detected, a face bounding box is drawn according to the position and size of the detected face region, and a grayscale image of the face bounding box is obtained. The face bounding box grayscale image is inversely transformed based on the transformed image and the offset to obtain the face bounding box image. The face bounding box image is cropped to obtain the ROI image.

8. The image processing method as described in claim 6, characterized in that, The step of processing the transformed image based on the face detection results to obtain the ROI image includes: Based on the face detection result that no face was detected, the transformed image is cropped to obtain the ROI image.

9. The image processing method as described in claim 1, characterized in that, The step of processing the cropped region image according to the offset to obtain the ROI image includes: The cropped region image is cropped to obtain the ROI image.

10. 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 images or videos captured by the camera. The memory is used to store instructions. The processor is used to execute the instructions stored in the memory, causing the electronic device to perform the image processing method as described in any one of claims 1 to 9.

11. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores instructions that, when executed on a computer, cause the computer to perform the image processing method as described in any one of claims 1 to 9.

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