Image processing method and electronic device
By performing target underexposure processing based on scene detection and exposure detection in stage scenes, the problem of image overexposure in stage scenes is solved, improving image quality and processing efficiency while saving power consumption of electronic devices.
Patent Information
- Authority / Receiving Office
- WO · WO
- Patent Type
- Applications
- Current Assignee / Owner
- Filing Date
- 2025-08-21
- Publication Date
- 2026-04-02
AI Technical Summary
In stage scenes, images captured by electronic devices are prone to overexposure, resulting in loss of image details and poor image quality.
By using target de-exposure processing determined based on scene detection and exposure detection results, the image de-exposure strategy is adjusted in real time, improving the accuracy of exposure processing parameters, reducing the need to switch camera shooting modes, and saving power consumption of electronic devices.
It improves image quality, preserves more image detail, and enhances image processing efficiency and device energy efficiency.
Smart Images

Figure CN2025116217_02042026_PF_FP_ABST
Abstract
Description
Image processing method and electronic device
[0001] This application claims priority from the Chinese patent application No. 2024113968565, filed with the State Intellectual Property Office of China on September 30, 2024 and entitled “Image processing method and electronic device”, the whole content of which is incorporated herein by reference. TECHNICAL FIELD
[0002] The present application relates to the field of image processing, in particular, to an image processing method and an electronic device. BACKGROUND
[0003] With the rapid development of terminal technology, in order to provide better shooting function and shooting experience for users, various shooting scenes are proposed by electronic devices; for example, night scene, portrait scene, stage scene, etc. Due to the complexity of the light in the stage scene. For example, in the stage scene, the stage environment usually includes multiple high-intensity light sources, which poses a serious challenge to the image capture capability of the electronic device. The image captured by the electronic device may have the problem of overexposure; and further causes the loss of image details, so that the image quality captured by the electronic device in the stage scene is poor.
[0004] Therefore, how to perform exposure reduction processing on the image to improve the image quality becomes a problem to be solved. SUMMARY
[0005] The present application provides an image processing method and an electronic device. In the scheme of the present application, the target exposure reduction processing is determined based on the scene detection result and the exposure detection result; through the target exposure reduction processing, the image quality can be improved.
[0006] In a first aspect, an image processing method is provided, comprising:
[0007] running a camera application to obtain a first image; wherein the first image is an image obtained by performing first processing on a first original image; the first original image is an image captured by a camera at a first time;
[0008] performing scene detection on the first image to obtain a scene detection result;
[0009] performing exposure detection on the first image to obtain an exposure detection result;
[0010] displaying a first interface; wherein the first interface includes a second image; the second image is an image obtained by performing second processing on a second original image; the second original image is an image captured by the camera at a second time; the second processing includes target exposure reduction processing determined based on the scene detection result and the exposure detection result.
[0011] It should be understood that the first time and the second time are different times; the first original image and the second original image are Raw images collected by the camera.
[0012] In the above scheme, at the first time, the camera collects a first original image; the first original image is processed by the electronic device to obtain a first image; scene detection and exposure detection are performed on the first image to obtain a scene detection result and an exposure detection result; the target exposure reduction processing can be determined in real time according to the scene detection result and the exposure detection result; at a second time after the first time, the second original image can be processed based on the target exposure reduction processing to obtain a second image. In the above scheme, since the target exposure reduction processing is determined according to the scene detection result and the exposure processing result of the image before the current time; therefore, the accuracy of the parameters of the exposure processing can be improved; in the case of improving the accuracy of the parameters of the exposure processing, the image detail information in the image is improved; thereby improving the image quality.
[0013] In combination with the first aspect, in some implementations of the first aspect, after the camera application is run, the method further includes:
[0014] The first image is processed to obtain a third image; wherein the image processing includes color space conversion processing;
[0015] The second interface is displayed; wherein the third image is displayed in the second interface; the second interface and the first interface are the shooting interface of the camera application in the first shooting mode.
[0016] In one implementation, the camera application is run, the camera collects a first original image (for example, a Raw image) at a first time; the first original image is processed to obtain a first image (for example, a YUV image); the first image is processed to obtain a third image (for example, an RGB image); a second interface of the first shooting mode is displayed, and the second interface includes the third image; based on the scene detection result and the exposure detection result of the first image, the target exposure reduction processing is determined; the camera collects a second original image at a second time; the second original image is processed including the target exposure reduction processing to obtain a second image; a first interface of the first shooting mode is displayed; the first interface includes the second image.
[0017] It should be understood that the image quality of the second image is higher than that of the third image.
[0018] In the foregoing solution, the camera application is operated without switching the shooting mode of the camera application, and the target exposure reduction processing is determined based on the scene detection result and the exposure detection result of the real-time collected image. The target exposure reduction processing can be used to adjust the exposure reduction processing strategy of the image in real time, thereby improving the image quality. Since the foregoing solution does not need to switch the shooting mode of the camera application when performing the target exposure reduction processing, compared with switching the shooting mode of the camera application, the image processing efficiency of the electronic device can be improved under the premise of improving the image quality. In addition, since only the exposure reduction algorithm needs to be adjusted without adjusting other image processing algorithms under the current shooting mode, compared with switching the shooting mode, the data transmission in the electronic device can be reduced, thereby saving the power consumption of the electronic device to a certain extent.
[0019] With reference to the first aspect, in some implementations of the first aspect, the method further includes:
[0020] The first control is displayed in the first interface based on the scene detection result and the exposure detection result, and the first control is used to indicate the target scene.
[0021] In the foregoing solution, the first control is displayed in the first interface, and the first control is used to indicate the target scene. By displaying the first control, the user is prompted about the shooting scene in which the electronic device is currently located, so that the user can perceive the shooting scene in which the electronic device is currently located.
[0022] With reference to the first aspect, in some implementations of the first aspect, the first control is displayed in the first interface based on the scene detection result and the exposure detection result, and the first control is used to indicate the target scene.
[0023] The shooting scene is determined to be the target scene based on the scene detection result and the exposure detection result.
[0024] The first control is displayed in the first interface in a case where the shooting scene is the target scene.
[0025] In one implementation, the target scene includes a stage scene, a performance scene, a concert scene, a high-contrast scene, or a backlight scene.
[0026] It should be understood that the target scene is used to indicate a shooting scene in which the background is dark light and the foreground is bright light. Since the brightness difference between the background and the foreground in the target scene is large, the image collected in the target scene is prone to overexposure.
[0027] In the above scheme, the target scene can be automatically detected based on the scene detection result and the exposure detection result. Since the light source of the target scene is relatively complex, the second original image can be processed by the target exposure reduction processing, so as to reduce the overexposed area in the image and improve the detail information in the image. Thus, the image quality of the captured image in the target scene is improved. In addition, the first control is displayed in the target scene, prompting the user that the current electronic device is in the shooting scene. Thus, the user can perceive the current shooting scene of the electronic device.
[0028] In combination with the first aspect, in some implementations of the first aspect, the first interface includes a second control, and the second control is configured to indicate that the target exposure reduction processing is performed.
[0029] In one implementation, the first control and the second control are the same control, i.e., indicating the target scene and the target exposure reduction processing. After the target scene is identified, the target exposure reduction processing is automatically performed.
[0030] In another implementation, the first control and the second control are different controls. The first control is configured to indicate the target scene, and the second control is configured to indicate that the target exposure reduction processing is performed.
[0031] In the above scheme, the second control is displayed in the first interface, and the second control is configured to indicate that the target exposure reduction processing is performed. By displaying the second control, the user is prompted that the target exposure reduction processing is currently performed. Thus, the user can perceive that the image processing algorithm performed by the electronic device can be dynamically adjusted according to the shooting scene in real time.
[0032] In combination with the first aspect, in some implementations of the first aspect, based on the scene detection result and the exposure detection result, it is determined whether the shooting scene is the target scene, including:
[0033] If the scene detection result indicates that the shooting scene is the target scene, and the exposure detection result indicates that the first image is an overexposed image, it is determined that the shooting scene is the target scene.
[0034] It should be understood that the overexposed image is used to represent an image in which some areas or the whole image appear too bright and lack of details due to too much light received by the camera during shooting.
[0035] In one implementation, the overexposed image is used to represent that the proportion of pixel points with a luminance higher than a preset luminance threshold in the entire image is greater than a preset proportion threshold.
[0036] In another implementation, the overexposed image is used to represent that the proportion of pixel points with a luminance higher than a preset luminance threshold in the exposure detection area of the entire image is greater than a preset proportion threshold.
[0037] In the foregoing solution, when detecting whether the shooting scene where the electronic device is located is a target scene, the scene detection result and the exposure detection result of the first image can be used to jointly determine whether the electronic device is in the target scene; when it is detected that the scene detection result indicates the target scene and the exposure detection result indicates an overexposed image, it is determined that the current shooting scene is the target scene. The target scene can be detected by using the scene detection result and the exposure detection result together, which can improve the accuracy of target scene detection.
[0038] With reference to the first aspect, in some implementations of the first aspect, the exposure detection is performed on the first image to obtain an exposure detection result, including:
[0039] performing face detection and body detection on the first image to obtain a detection result;
[0040] determining a target detection region in the first image based on the detection result;
[0041] obtaining the exposure detection result based on a pixel point in the target detection region.
[0042] In the foregoing solution, when performing exposure detection on the first image, face detection and body detection can be performed on the first image first to obtain a detection result. Based on different detection results, different regions in the first image can be determined as target detection regions (i.e., exposure detection regions), which improves the accuracy of the exposure detection region, and thus improves the accuracy of the exposure detection result.
[0043] With reference to the first aspect, in some implementations of the first aspect, the target detection region in the first image is determined based on the detection result, including:
[0044] if the detection result indicates that there is a face region in the first image, the face region is determined as the target detection region;
[0045] if the detection result indicates that there is no face region but there is a body region in the first image, a first image region in the first image is determined as the target detection region;
[0046] The first image region is used to represent an image region where a neck key point to a head top key point in the body region is located.
[0047] It should be understood that the neck key point and the head top key point are feature points in human pose estimation and action recognition; the neck key point is used to describe the connection position between the head and the body. The head top key point is used to describe the position and orientation of the head.
[0048] In the foregoing scheme, based on the detection results of the face detection and the human body detection, the exposure detection of the first image can be performed in a hierarchical manner; for example, the detection priority of the face region in the first image is higher than the detection priority of the human body region; through the multi-layer detection in a hierarchical manner, the exposure region in the first image can be more accurately identified, thereby improving the accuracy of the exposure detection of the first image.
[0049] With reference to the first aspect, in some implementations of the first aspect, when the human body region exists in the first image, the method further includes:
[0050] determining the target height, the target width, and the target center point coordinate based on the coordinate of the neck key point and the coordinate of the head top key point;
[0051] obtaining the first vertex coordinate based on the difference between the target center point coordinate and the target highlight and the target width;
[0052] obtaining the second vertex coordinate based on the sum of the target center point coordinate, the target height, and the target width;
[0053] obtaining the first image region based on the first vertex coordinate and the second vertex coordinate.
[0054] With reference to the first aspect, in some implementations of the first aspect, the target height, the target width, and the target center point coordinate are determined based on the coordinate of the neck key point and the coordinate of the head top key point, and the method includes:
[0055] determining a first coordinate difference value and a second coordinate difference value of the neck key point and the head top key point; wherein the first coordinate difference value is a horizontal coordinate difference value of the neck key point and the head top key point; and the second coordinate difference value is a vertical coordinate difference value of the neck key point and the head top key point;
[0056] if the first coordinate difference value is greater than the second coordinate difference value, determining half of the first coordinate difference value as the target height and determining half of the second coordinate difference value as the target width;
[0057] if the second coordinate difference value is greater than the first coordinate difference value, determining half of the second coordinate difference value as the target height and determining half of the first coordinate difference value as the target width;
[0058] determining the coordinate of the midpoint of the neck key point and the head top key point as the target center point coordinate.
[0059] With reference to the first aspect, in some implementations of the first aspect, the method further includes:
[0060] obtaining a scene detection result;
[0061] if the detection result indicates that the face region does not exist and the human body region does not exist in the first image, determining whether the scene detection result indicates a target scene;
[0062] If the scene detection result indicates a target scene, a second image region in the first image is determined as a target detection region;
[0063] The second image region is a central region of the first image.
[0064] In the above scheme, when exposure detection is performed, face detection and body detection are preferentially performed on the first image; if a face region or a body region exists in the first image, an exposure detection region is determined according to the face region or the body region. If no face region exists and no body region exists in the first image, it is further determined whether the shooting scene of the first image is a target scene. Since the target scene usually includes multiple high-intensity light sources, when no face region exists, no body region exists, and the image is collected in the target scene, the central region of the first image is determined as the exposure detection region. Through multi-level detection, the exposure region in the first image can be more accurately identified, thereby improving the accuracy of exposure detection.
[0065] With reference to the first aspect, in some implementations of the first aspect, the exposure detection result is obtained based on the pixel points in the target detection region, including:
[0066] determining a target pixel point quantity of the target pixel points whose luminance values are greater than a first preset luminance threshold in the target detection region;
[0067] determining a target proportion based on the target pixel point quantity and a total pixel point quantity of the target detection region;
[0068] obtaining the exposure detection result based on the target proportion and a preset proportion threshold.
[0069] In the above scheme, when exposure detection is performed, the exposure detection result can be determined based on the proportion of the over-bright pixel points in the target detection region. If the proportion of the over-bright pixel points in the target detection region is greater than a preset proportion threshold, it indicates that the quantity of the over-bright pixel points in the target detection region is relatively large, which indicates that the target detection region is an overexposure region, and the first image is an overexposure image. If the proportion of the over-bright pixel points in the target detection region is less than or equal to the preset proportion threshold, it indicates that the quantity of the over-bright pixel points in the target detection region is relatively small, which indicates that the target detection region is not an overexposure region, and the first image is not an overexposure image.
[0070] With reference to the first aspect, in some implementations of the first aspect, the exposure detection result is obtained based on the pixel points in the target detection region, including:
[0071] obtaining target metadata of the target sensor; wherein the target metadata is used to indicate the metadata of the target sensor when the first original image is collected;
[0072] obtain the exposure detection result based on the target metadata.
[0073] In an implementation manner, the target sensor is an ambient light sensor.
[0074] In the foregoing solution, the metadata of the target sensor in the electronic device when the first original image is captured is obtained when exposure detection is performed on the first image; and the exposure detection result is obtained based on the target metadata. Since the target metadata is the metadata of the target sensor when the first original image is captured, introducing the metadata of the target sensor when determining the exposure detection result of the image can improve the accuracy of the exposure detection result to a certain extent.
[0075] With reference to the first aspect, in some implementation manners of the first aspect, the exposure detection result is obtained based on the target metadata, including:
[0076] determining a scene brightness of the shooting scene based on the target metadata;
[0077] if the scene brightness is greater than a second preset brightness threshold, obtaining the exposure detection result based on the brightness value of the pixel point in the first image.
[0078] In the foregoing solution, the scene brightness of the shooting scene when the first original image is captured can be determined based on the target metadata; since overexposure is more likely to occur in a high-brightness scene; therefore, in the case that the scene brightness of the shooting scene is greater than a second preset scene brightness, the exposure detection result is determined based on the brightness value of the pixel point in the first image; compared with determining the exposure detection result of the first image based on the brightness value of the pixel point in the first image in real time, the power consumption of the electronic device can be saved to a certain extent.
[0079] In an implementation manner, if the scene brightness is greater than the second preset brightness threshold, the exposure detection result is obtained based on the pixel point in the target detection region in the first image.
[0080] With reference to the first aspect, in some implementation manners of the first aspect, the scene detection is performed on the first image to obtain a scene detection result, including:
[0081] obtaining a sample description text of the target scene;
[0082] obtaining the scene detection result based on the similarity between the sample description text and the first image.
[0083] In the foregoing solution, when the scene detection is performed on the first image, the image is detected based on the multi-dimensional data of the image information and the semantic information by introducing the description text, compared with the scene detection based on the single-dimensional data of the image information; the recognition error of the scene detection can be reduced to a certain extent, and the accuracy and robustness of the scene detection can be improved.
[0084] In some implementations of the first aspect, the scene detection result is obtained based on a similarity between the sample description text and the first image, including:
[0085] The sample description text is encoded to obtain a first text vector and a second text vector;
[0086] The first image is encoded to obtain a first image vector and a second image vector;
[0087] A target similarity between the first text vector and the first image vector is determined;
[0088] If the target similarity is greater than a preset similarity threshold, a confidence degree that the second text vector and the second image vector match is determined;
[0089] The scene detection result is obtained based on the confidence degree and a preset confidence threshold.
[0090] In the above scheme, by encoding the sample description text and the first image, two kinds of encoding outputs are generated: feature vectors (for example, text feature vectors and image feature vectors) and embedding vectors (for example, text embedding vectors and image embedding vectors); by the two kinds of encoding outputs, the current scene and the target scene (for example, a stage scene) can be matched twice during scene detection, thereby improving the accuracy of the scene detection result.
[0091] In some implementations of the first aspect, the vector types of the first text vector and the text vector are different, and the vector types of the first image vector and the second image vector are different.
[0092] In addition, the vector type of the first text vector is the same as the vector type of the first image vector, and the vector type of the second text vector is the same as the vector type of the second image vector.
[0093] In one implementation, the first text vector and the first image vector are feature vectors, and the second text vector and the second image vector are embedding vectors.
[0094] In another implementation, the first text vector and the first image vector are embedding vectors, and the second text vector and the second image vector are feature vectors.
[0095] In some implementations of the first aspect, the method further includes:
[0096] If the scene detection result indicates the first scene, or the exposure detection result indicates that the first image is not an overexposed image, it is determined that the target exposure reduction processing is not run; wherein the first scene is different from the target scene.
[0097] In the scheme, if the scene detection result of the first image indicates the first scene, i.e., indicates that it is not the target scene, or the exposure detection result indicates that the first image is not an overexposed image, it is determined that the target exposure reduction processing is not run; at this time, the default exposure reduction processing included in the first processing can be run; in this scheme, different exposure processing modes can be determined based on the scene detection result and the exposure detection result; the exposure effect of the image is improved, thereby improving the image quality.
[0098] With reference to the first aspect, in some implementations of the first aspect, the method further includes:
[0099] If the scene detection result indicates the target scene and the exposure detection result indicates that the first image is not an overexposed image, a second shooting mode is determined; the second shooting mode is a shooting mode corresponding to the target scene.
[0100] A third interface is displayed; the third interface displays a third control, and the third control is used to indicate that the second shooting mode is run.
[0101] In response to a first operation on the third control, a fourth interface is displayed; the fourth interface is a shooting interface of the second shooting mode.
[0102] In a possible implementation, the second shooting mode includes a stage shooting mode, a performance shooting mode, a concert shooting mode, a high-contrast shooting mode, or a backlight shooting mode.
[0103] It should be understood that the second shooting mode is a shooting mode corresponding to the target scene; the target scene is used to indicate a shooting scene in which the background is dark light and the foreground is bright light; because the brightness difference between the background and the foreground in the target scene is large, the image collected in the target scene is prone to overexposure.
[0104] In an implementation, the exposure reduction processing run in the second shooting mode can be the same as or different from the target exposure reduction processing; the second shooting mode can include more image processing algorithms corresponding to the target scene.
[0105] In the scheme, if the scene detection result indicates the target scene and the exposure detection result indicates that the first image is not an overexposed image, it means that the shooting scene in which the electronic device is located is not a scene in which overexposure occurs; however, because the scene detection result indicates the target scene, the second shooting mode can be recommended to the user; if the user has a mode switching requirement, the current mode is switched to the second shooting mode; because the second shooting is a shooting mode corresponding to the target scene, the image processing algorithm in the shooting mode is a more comprehensive image processing algorithm for the target scene, and thus the image quality in the target scene can be improved.
[0106] With reference to the first aspect, in some implementations of the first aspect, the method further includes:
[0107] The prompt information of the second shooting mode is displayed in the fourth interface.
[0108] In the above scheme, the prompt information of the second shooting mode is displayed in the fourth interface, and the user can easily pay attention to the related information of the second shooting mode through the prompt information. The user can be prompted and guided to open the second shooting mode through the prompt information. After the second shooting mode is opened, the image quality of the photographed image is improved.
[0109] In combination with the first aspect, in some implementations of the first aspect, the method further includes:
[0110] If the first operation is not detected, the third interface is displayed.
[0111] In the above scheme, the third control of the second shooting mode is displayed in the third interface, and the user can easily pay attention to the related information of the second shooting mode through the third control. If the first operation on the third control is not detected, it indicates that the user currently does not have the user demand to switch to the second shooting mode. If the user does not have the demand to open the second shooting mode, the electronic device will not switch to the second shooting mode, and the current shooting mode will still be used for shooting. The demand of the user is ensured to be met.
[0112] In combination with the first aspect, in some implementations of the first aspect, the first interface is a photograph preview interface, or the first interface is a video recording preview interface.
[0113] In one implementation, the first interface is a photograph preview interface, and the second interface, the third interface, and the fourth interface are photograph preview interfaces.
[0114] In another implementation, the first interface is a video recording preview interface, and the second interface, the third interface, and the fourth interface are video recording preview interfaces.
[0115] In the above scheme, the image processing method is applicable to a photographing scene or a video recording scene. In the photographing scene, the above scheme can ensure that the collected image is processed by using the exposure reduction algorithm for the target scene, and the image quality of the photographed image is improved. In the video recording scene, the above scheme can ensure that the collected video is processed by using the exposure reduction algorithm for the target scene, and the video quality of the recorded video is improved.
[0116] In combination with the first aspect, in some implementations of the first aspect, the method further includes:
[0117] In a case where the shooting scene is the target scene, the light metering brightness of the first image is determined; wherein the light metering brightness is used to represent the overall light metering brightness of the first image.
[0118] Based on the light metering brightness, the exposure parameter is determined as the first exposure parameter.
[0119] obtaining a fourth image based on the first exposure parameter;
[0120] in a case where at least one face is recognized in the fourth image, determining an area of a target face in the at least one face and a weighted face brightness;
[0121] in a case where the area of the target face is less than or equal to a preset threshold and at least one body is recognized in the fourth image, determining a weighted body brightness;
[0122] determining a target metering brightness based on the weighted face brightness and the weighted body brightness;
[0123] adjusting the exposure parameter based on the target metering brightness to obtain a parameter of target underexposure processing.
[0124] In the above scheme, since the light of the target scene is usually strong, the preview image and the photographed image collected are prone to overexposure, that is, the highlight area in the image is too bright, resulting in loss of details. In order to solve the overexposure problem of the target scene, the above scheme can be used to perform metering mainly on the highlight area in the image, so that the brightness value detected by the image sensor is relatively large. Then, based on the principle of an automatic exposure (AE) algorithm, the AE module will automatically adjust the exposure parameter according to this larger brightness value to reduce the exposure amount, so as to reduce the phenomenon of overexposure of the main body during preview and photographing, thereby improving the image quality and retaining more image details; and improving the image quality.
[0125] In a second aspect, an electronic device is provided, which includes one or more processors, a memory, and a display screen; the memory, the display screen, and the one or more processors are coupled, the memory is configured to store computer program code including computer instructions, and the display screen is configured to display a preview interface; the one or more processors invoke the computer instructions to cause the electronic device to perform:
[0126] running a camera application to obtain a first image; the first image is an image obtained by performing first processing on a first original image; the first original image is an image collected by a camera at a first time;
[0127] performing scene detection on the first image to obtain a scene detection result;
[0128] performing exposure detection on the first image to obtain an exposure detection result;
[0129] displaying a first interface; the first interface includes a second image; the second image is an image obtained by performing second processing on a second original image; the second original image is an image collected by the camera at a second time; and the second processing includes target underexposure processing determined based on the scene detection result and the exposure detection result.
[0130] With reference to the second aspect, in some implementations of the second aspect, the processor invokes computer instructions to cause the electronic device to perform the image processing method of the first aspect or any of the implementations of the first aspect.
[0131] It should be understood that the extensions, limitations, explanations and descriptions of the related content in the above first aspect also apply to the same content in the second aspect.
[0132] In a third aspect, an electronic device is provided, which includes a module / unit for performing the image processing method of the first aspect or any of the implementations of the first aspect.
[0133] In a fourth aspect, a chip system is provided, which is applied to an electronic device, and the chip system includes one or more processors configured to invoke computer instructions to cause the electronic device to perform the image processing method of the first aspect or any of the implementations of the first aspect.
[0134] In a fifth aspect, a computer readable storage medium is provided, which stores computer program codes, and when the computer program codes are run by an electronic device, the electronic device is caused to perform the image processing method of the first aspect or any of the implementations of the first aspect.
[0135] In a sixth aspect, a computer program product is provided, which includes computer program codes, and when the computer program codes are run by an electronic device, the electronic device is caused to perform the image processing method of the first aspect or any of the implementations of the first aspect.
[0136] In the embodiments of the present application, at a first time, a first original image is captured by a camera; a first processing is performed on the first original image by an electronic device to obtain a first image; scene detection and exposure detection are performed on the first image to obtain a scene detection result and an exposure detection result; a target exposure reduction processing can be determined in real time according to the scene detection result and the exposure detection result; at a second time after the first time, a second processing can be performed on a second original image based on the target exposure reduction processing to obtain a second image. In the above scheme, since the target exposure reduction processing is determined according to the scene detection result and the exposure processing result of the image before the current time; therefore, the accuracy of the parameters of the exposure processing can be improved; in the case of improving the accuracy of the parameters of the exposure processing, the image detail information in the image is improved; thereby the image quality is improved. BRIEF DESCRIPTION OF DRAWINGS
[0137] FIG. 1 is a schematic diagram of an electronic device in a stage scene according to an embodiment of the present application;
[0138] FIG. 2 is a schematic diagram of a user interface for opening a stage scene according to an embodiment of the present application;
[0139] FIG. 3 is a schematic diagram of another user interface for opening a stage scene according to an embodiment of the present application;
[0140] FIG. 4 is a schematic diagram of a user interface for a stage mode according to an embodiment of the present application;
[0141] FIG. 5 is a schematic flowchart of an image processing method according to an embodiment of the present application;
[0142] FIG. 6 is a schematic flowchart of another image processing method according to an embodiment of the present application;
[0143] FIG. 7 is a schematic diagram of a preview stream and a photographing stream according to an embodiment of the present application;
[0144] FIG. 8 is a schematic flowchart of a scene detection method according to an embodiment of the present application;
[0145] FIG. 9 is a schematic flowchart of an exposure detection method according to an embodiment of the present application;
[0146] FIG. 10 is a schematic diagram of determining a head region according to an embodiment of the present application;
[0147] FIG. 11 is a schematic diagram of a system structure of an electronic device 100 according to an embodiment of the present application;
[0148] FIG. 12 is a schematic diagram of a hardware structure of an electronic device 100 according to an embodiment of the present application. DETAILED DESCRIPTION
[0149] In the embodiments of the present application, the terms "first", "second", and the like are only used for descriptive purposes, and cannot be understood as indicating or implying relative importance or implicitly indicating the number of the technical features indicated. Therefore, the features defined as "first", "second" can explicitly or implicitly include one or more of the features. In the description of the embodiments, unless otherwise specified, the meaning of "a plurality of" is two or more.
[0150] When running a camera application, a stage scene is a commonly used shooting scene by a user. Due to the complexity of the light in the stage scene. For example, the stage environment in the stage scene usually includes a plurality of high-intensity light sources; for example, a spotlight and the like; the existence of these light sources poses a severe challenge to the image capturing capability of the electronic device. So that the image captured by the electronic device can have the problem of overexposure. For example, the strong stage light is easy to cause serious overexposure phenomenon in some areas of the image, and then cause the loss of image details, so that the image quality in the stage scene is poor.
[0151] Therefore, the embodiment of the present application provides an image processing method and an electronic device, which can determine a target exposure reduction processing based on a scene detection result and an exposure detection result, and improve image quality through the target exposure reduction processing.
[0152] The technical solutions in the embodiments of the present application will be described below with reference to the drawings.
[0153] FIG. 1 is a schematic diagram of an electronic device in a stage scene according to an embodiment of the present application.
[0154] As shown in FIG. 1, the shooting scene includes a stage environment and a shooting object on the stage. When the electronic device 100 detects that the shooting scene is a stage scene, a photograph preview interface 106 is displayed. The control 24 of the stage scene is displayed in the photograph preview interface 106. The collected image is subjected to exposure reduction processing through the algorithm of the stage scene in the photograph mode, and the preview image subjected to the exposure reduction processing corresponding to the stage scene is displayed in the electronic device 100.
[0155] It should be understood that the photograph preview interface 106 described above refers to the preview interface displayed by the electronic device 100 after the stage scene is started in the photograph mode.
[0156] In an implementation manner, the stage scene is a preconfigured scene of a camera application. When it is detected that the current shooting scene of the electronic device is the stage scene, the electronic device automatically executes the image processing algorithm corresponding to the stage scene. For example, when it is detected that the current shooting scene is the stage scene, the electronic device automatically triggers the execution of the automatic exposure reduction algorithm corresponding to the stage scene. Optionally, refer to the schematic diagram shown in FIG. 2.
[0157] For example, a plurality of scenes are preconfigured in the camera application. When it is detected that the current shooting scene matches a certain scene in the plurality of scenes, the execution of the image processing algorithm corresponding to the scene is triggered.
[0158] For example, when a user shoots through any application with a shooting function, the application can call the camera application of the electronic device after being authorized by the user, and then process the image through the image processing algorithm corresponding to the stage scene when the stage scene is recognized. The image processing algorithm includes an exposure reduction algorithm and other processing algorithms.
[0159] In another implementation manner, in the camera application with a shooting function, the identification function of the stage scene can be configured to support the manual start or stop of the user. Optionally, refer to the schematic diagram shown in FIG. 3.
[0160] Optionally, when the user needs to use the detection function of the stage scene, the embodiment of the present application also supports the user manually starting the detection function of the stage scene through the "more controls" in the camera application; or manually starting the detection function of the stage scene through the "setting control" of the camera application; or manually starting the detection function of the stage scene through the related menu of the system-level setting application.
[0161] Optionally, the detection function of the stage scene can be configured to be in a state of being started by default in the camera application. When the user does not need to use the detection function of the stage scene, the detection function of the stage scene can be closed through the setting control of the camera application; or the detection function of the stage scene can be closed through the related menu of the system-level setting application, which is not limited by the embodiment of the present application.
[0162] Next, taking a mobile phone as an electronic device and a camera application installed on the mobile phone as an example, the user interface of the camera application starting the stage scene is described in combination with FIG. 2 and FIG. 3.
[0163] For example, (a) in FIG. 2 shows the main interface 101 of the electronic device 100. The main interface 101 can include a status bar, a page indicator, a frequently used application tray and a general application tray.
[0164] The status bar can include one or more signal strength indicators of a mobile communication signal (also referred to as a cellular signal), a wireless fidelity (Wi-Fi) signal strength indicator, a battery status indicator, a time indicator, etc.
[0165] The frequently used application tray and the general application tray are both used to carry application icons. The user can start the application corresponding to the icon by clicking the application icon.
[0166] For example, the frequently used application tray can include an icon 11 of the camera application, an icon of the address book application, an icon of the phone application and an icon of the information application. The general application tray can include an icon of the setting application, an icon of the application market application, an icon of the gallery application and an icon of the browser application, etc.
[0167] It should be understood that the main interface can also include icons of other applications, which are not exemplified one by one here. The icon of any one application can be placed in the frequently used application tray or the general application tray.
[0168] The icons of the plurality of application programs can be distributed in a plurality of pages. A page indicator can be used to indicate the location relationship of the currently displayed page and other pages. The user can use a left swipe / right swipe touch operation to browse other pages. The icons of the application programs carried in the frequently used application program tray do not change with the pages, i.e., fixed; and the icons of the application programs carried in the general application program tray change with the pages.
[0169] It can be understood that the user interface in (a) of FIG. 2 and the subsequent introduction is only an example of a possible user interface style of the electronic device 100 taking a mobile phone as an example, and should not be construed as a limitation of the embodiments of the present application.
[0170] As shown in (a) of FIG. 2, the electronic device 100 can detect a user operation acting on the icon 11 of the camera application; for example, the user operation is a click operation, a voice operation or other operation indicating running the camera application. In response to the above-mentioned user operation, the electronic device 100 can run the camera application; at the same time, the electronic device 100 can display the preview interface 102 of the camera application as shown in (b) of FIG. 2 in the screen.
[0171] It should be noted that the camera application is an application installed on the electronic device 100 which can call the camera to provide a shooting service. Without being limited to the camera application, other application programs installed on the electronic device 100 which can call the camera to provide a shooting service can also implement the image processing method provided by the present application; the embodiments of the present application do not limit this.
[0172] (b) of FIG. 2 exemplarily shows the preview interface 102 of the electronic device 100 opening the camera. The preview interface 102 includes a setting bar. A plurality of shooting parameter setting controls (function controls) can be displayed in the setting bar. One function control is used to set a type of parameter of the camera, so as to change the image collected by the camera. For example, the setting bar can display the intelligent recognition control 12, the flash control 13, the intelligent control 14, the HDR control 15, the filter control 16 and the setting control 17.
[0173] Among them, the intelligent recognition control 12 can be used to intelligently recognize the shooting object in the shooting scene. The flash control 13 can be used to turn on or turn off the flash. The intelligent control 14 can be used to turn on the intelligent image processing algorithm. The HDR control 15 can be used to capture more details in a shooting scene with a large dynamic range. The filter control 16 can be used to select a filter style, and then adjust the image color. The setting control 17 can be used to provide more controls for adjusting the camera shooting parameters or image optimization parameters.
[0174] In addition, the zoom control 18 is also included in the preview interface 102 as shown in (b) of FIG. 2. The zoom control 18 can be used to adjust the zoom ratio to adjust the field of view of the camera. When the field of view of the camera changes, the image displayed in the preview window will change accordingly.
[0175] For example, the preview interface 102 further includes a preview window, a menu bar 19, a review control 20, a shooting control 21, and a conversion control 22.
[0176] The preview window can be used to display a sequence of image frames captured by the camera in real time. The image displayed in the preview window can be referred to as an original image. In the embodiments of the present application, the window used to display the image is also referred to as a preview window after the shooting control 21 is clicked to start taking a photo.
[0177] For example, the menu bar 19 can display options of multiple shooting modes; for example, night scene, video recording, photo, portrait, professional, more, and the like. The night scene mode can be used to take photos in a relatively dark scene, such as taking photos at night. The video recording mode can be used to record videos. The photo mode can be used to take photos in a daylight scene. The portrait mode can be used to take close-up photos of a person. The review control 20 can be used to view the photo or video taken last time. Generally, the review control 20 can display a thumbnail of the photo taken last time or a thumbnail of the first frame of the video taken last time. The shooting control 21 can be used to receive a shooting operation of the user. In the photo mode (including the photo mode, the portrait mode, the night scene mode, the stage mode, the HDR mode, and the motion mode), the above-mentioned shooting operation is an operation of taking a photo acting on the shooting control 21. In the video recording scene (the video recording mode), the above-mentioned shooting operation includes an operation of starting recording and an operation of ending recording acting on the shooting control 21. The conversion control 22 can be used to switch the currently used view camera. If the camera currently used to capture images is the front camera, when a user operation acting on the conversion control 22 is detected, the electronic device 100 can enable the rear camera to capture images in response to the operation. Conversely, if the camera currently used to capture images is the rear camera, when a user operation acting on the conversion control 22 is detected, the electronic device 100 can enable the front camera to capture images in response to the operation.
[0178] For example, as shown in (b) of FIG. 2, the image captured by the camera at a certain moment includes a shooting object on the stage; since the light source in the stage scene is complex, there is an exposure area 2 in the preview image displayed in the preview interface 102. As shown in the preview interface 103 in (c) of FIG. 2, the electronic device 100 can detect a user operation acting on the smart control 14; in response to the user operation, a preview interface 104 as shown in (d) of FIG. 2 is displayed, in which prompt information 23 is displayed; wherein the prompt information 23 is: “AI photography” is turned on.
[0179] Optionally, the prompt information 23 displayed in the preview interface 104 shown in (d) of FIG. 2 can disappear in the preview window after a preset time length.
[0180] Optionally, in an implementation manner, in response to the user operation of the icon 11 of the camera application by the user as shown in (a) of FIG. 2, the preview interface 104 as shown in (d) of FIG. 2 can be directly displayed; in other words, when the camera application is running, the smart photography function can also be automatically turned on; the present application does not make any limitation on this.
[0181] Optionally, in another implementation manner, scene detection can also be performed when “AI photography” is not turned on; that is, in response to the user operation of the icon 11 of the camera application by the user as shown in (a) of FIG. 2, the preview interface 105 as shown in (e) of FIG. 2 can be directly displayed.
[0182] In an implementation manner, after the electronic device 100 turns on the smart control 14, the electronic device 100 triggers to execute the image processing method provided by the present application. Optionally, the detection function of the stage scene provided by the present application can be a function that is turned on by default by the camera application. After the AI photography of the camera application is turned on, the electronic device 100 turns on the detection function of the stage scene by default, and runs the exposure algorithm corresponding to the stage scene after detecting the stage scene.
[0183] Further, as shown in (e) of FIG. 2, if it is recognized that the current shooting scene of the electronic device 100 is a stage scene, the preview interface 105 is displayed; the control 24 of the stage scene is displayed in the preview interface 105, and the control 24 of the stage scene can be displayed in an open state with a deepened outline.
[0184] It should be understood that the preview image displayed in the preview interface 105 is an image obtained by performing exposure reduction processing on the image captured by the camera through the exposure algorithm corresponding to the stage scene after the stage scene is turned on; compared with the preview image displayed in the preview interface 102 before the stage scene is turned on, the preview image obtained through the exposure algorithm corresponding to the stage scene can solve the exposure area in the image to a certain extent, improve the detail information in the image, and improve the image quality of the preview image.
[0185] Optionally, the stage scene control 24 can have different display states if the stage scene control 24 is always displayed on the preview interface 105. For example, the stage scene control 24 can present a non-working state of gray transparent, a working state of black solid; or the stage scene control 24 can present a non-working state of gray and superimposed arrow mark, a working state of black and no arrow mark, etc.
[0186] It should be understood that the display mode of the stage scene control 24 can switch between different display states by referring to the opening and closing states of other controls, which is not limited in the embodiments of the present application.
[0187] In another possible implementation, the control option of the stage scene detection function provided by the present application can be configured in the "more" option of the camera preview interface, and the user can manually turn on or turn off the function.
[0188] FIG. 3 is another example of a user interface for starting a stage scene provided by the embodiments of the present application.
[0189] For example, after the user clicks the camera application icon 11 of the electronic device 100 main interface 201 shown in (a) of FIG. 3, enters the preview interface 202 shown in (b) of FIG. 3, and clicks the "more" option, the electronic device 100 displays the preview interface 203 shown in (c) of FIG. 3 in response to the user's operation. The preview interface 203 can display one or more options such as slow motion, time-lapse photography, watermark, super macro, multi-lens recording, high pixel, document scanning, micro film, and stage function, each of which corresponds to a different shooting mode or shooting parameter, which is not limited in the embodiments of the present application.
[0190] For example, the user performs the operation shown in (c) of FIG. 3, clicks the stage scene control 24, and the electronic device 100 displays the preview interface 204 shown in (d) of FIG. 3 in response to the user's operation; the preview interface 204 displays the stage scene control 24. In addition, in the case of detecting the stage scene, the preview interface 204 can display the prompt information "detecting the stage scene".
[0191] Optionally, the stage scene control 24 in the embodiments of the present application can always be displayed on the preview interface, or can be automatically displayed on the preview interface after the stage scene detection function is started based on the user's operation; when the user turns off the stage scene detection function, the preview interface does not display the stage scene control 24.
[0192] For example, as shown in (d) of FIG. 3, after the user opens the stage scene, the preview interface 204 displays the control 24 of the stage scene, and the control 24 of the stage scene is in a working state of black. If the exit of the stage scene is detected, the preview interface can display the preview interface 205 as shown in (e) of FIG. 3, the control 24 of the stage scene is displayed on the preview interface 205, and the control 24 of the stage scene is in a non-working state of gray transparency. In addition, in the preview interface 205, a prompt information "no stage scene detected" can be displayed.
[0193] It should be understood that the above opening of the stage scene can refer to the opening of the stage scene in any shooting mode; the shooting mode of the camera application before and after the opening of the stage scene can be the same; it can be understood that the detection of the stage scene does not switch the shooting mode of the camera application. For example, as shown in FIG. 2 and FIG. 3, before and after the detection of the stage scene, the current shooting mode of the camera application is the shooting mode.
[0194] It should be noted that the same control shown in FIG. 3 and FIG. 2 can refer to the related description in FIG. 2, which will not be repeated here.
[0195] In another implementation, the electronic device 100 detects that the scene detection result indicates the stage scene, and the exposure detection result indicates that there is no exposure area in the image, indicating that the current shooting scene of the electronic device 100 is not the stage scene. The electronic device 100 can display a prompt information of "stage mode"; if the user operation of the prompt information of "stage mode" is detected, the preview interface of the stage mode is displayed.
[0196] Optionally, in an implementation, the control 24 of the stage scene can be added to the preview interface of the camera application through the operation schematic diagram shown in FIG. 3; the control 24 of the stage scene indicates whether the stage scene is currently detected through different display states; the specific operation schematic diagram of the identification of the stage scene can refer to the interface schematic diagram shown in (a) of FIG. 2 to (e) of FIG. 2, which will not be repeated here.
[0197] FIG. 4 is a schematic diagram of a user interface of a stage mode according to an embodiment of the present application.
[0198] For example, after the user clicks the camera application icon 11 of the home interface 301 of the electronic device 100 shown in (a) of FIG. 4, the user enters the preview interface 302 shown in (b) of FIG. 4; there is no exposure area in the preview image displayed in the preview interface 302; the electronic device 100 can detect the user operation on the smart control 14 as shown in the preview interface 303 of (c) of FIG. 4; in response to the user operation, the preview interface 304 shown in (d) of FIG. 4 is displayed, and the prompt information 23 is displayed in the preview interface 304; wherein the prompt information 23 is: "AI photography" is turned on. Since the scene detection result indicates a stage scene, and the exposure detection result indicates that there is no exposure area in the image, the electronic device 100 recommends the stage mode to the user; enter the preview interface 305 shown in (e) of FIG. 4; wherein the preview window of the preview interface 305 displays the prompt control 25 of the stage mode; wherein the prompt control 25 displays prompt information related to the function corresponding to the prompt control, such as "try the stage mode".
[0199] Further, the user performs the operation shown in (e) of FIG. 4, clicks the prompt control 25, and in response to the user's operation, the electronic device 100 displays the stage preview interface 306 shown in (f) of FIG. 4; the stage preview interface 306 is the preview interface of the camera application in the stage mode, and the icon 26 of the stage mode is displayed in the stage preview interface.
[0200] Optionally, in the preview interface 305 shown in (e) of FIG. 4, after a preset time period, if no user operation on the prompt control 25 is detected, the prompt control 25 can not be displayed in the preview interface 305; it can be understood that the prompt control 25 disappears in the user interface if no user operation is detected after being displayed for a preset time period. If the user clicks the "X" in the icon 26 of the stage mode, the camera application of the electronic device 100 exits the stage mode.
[0201] Optionally, in an implementation manner, the prompt control 25 of the stage mode is displayed in an animation effect. For example, the prompt information related to the function corresponding to the prompt control 25, such as "try the stage mode", is displayed in an animation effect; the prompt information disappears after being displayed in the preview window for a preset time period, and only the prompt control 25 is displayed in the preview window. If the electronic device 100 detects the user operation on the prompt control 25, the electronic device 100 enters the stage shooting mode, processes the collected image through the related image processing algorithm corresponding to the stage shooting mode, and displays the preview interface of the stage shooting mode, as shown in (f) of FIG. 4; the preview interface of the stage shooting mode includes the control of the stage shooting mode; if the electronic device 100 detects the user operation of closing the stage mode, the electronic device 100 enters the default shooting mode, that is, the preview interface shown in (b) of FIG. 2 is displayed.
[0202] Optionally, in an implementation, in response to the user operation of the icon 11 of the camera application by the user as shown in (a) of FIG. 4, the preview interface 305 as shown in (e) of FIG. 4 can be directly displayed; in other words, the smart photography function can also be automatically started when the camera application is running; the present application does not make any limitation in this regard.
[0203] Optionally, in another implementation, the recommendation of the stage mode can also be performed when the AI camera is not started; for example, in response to the user operation of the icon 11 of the camera application by the user as shown in (a) of FIG. 4, the prompt control 25 can be displayed in the case where it is determined to recommend the stage mode; or, the stage preview interface 306 as shown in (f) of FIG. 4 can be directly displayed in the case where it is determined to recommend the stage mode.
[0204] It should be understood that the user interfaces shown in FIGS. 1 to 4 are exemplarily illustrated with the preview interface of the shooting mode in the camera application; the image processing method provided by the embodiments of the present application is also applicable to the recording mode of the camera application; the present application does not make any limitation in this regard.
[0205] The algorithm flow when the electronic device 100 implements the image processing will be described in detail below in combination with FIGS. 5 to 10.
[0206] FIG. 5 is a schematic flowchart of an example of the image processing method provided by the embodiments of the present application. The method 400 includes S410 to S440; S410 to S440 will be described in detail respectively below.
[0207] S410. Running the camera application, obtaining a first image.
[0208] The first image is an image obtained by performing first processing on a first original image; the first original image is an image captured by the camera at a first time.
[0209] Exemplarily, the camera application is run, and the camera captures a first original image (for example, a first Raw image) at a first time; the first original image is processed to obtain a first image. The first processing includes image processing in a current shooting mode; the current shooting mode can refer to the shooting mode of the camera application when the camera application is running.
[0210] Optionally, in an implementation, after the camera application is run, the following steps are further included:
[0211] performing image processing on the first image to obtain a third image; the image processing includes color space conversion processing; displaying a second interface; the third image is displayed in the second interface; the second interface is a shooting interface of the camera application in the first shooting mode.
[0212] Exemplarily, the first shooting mode is taken as a shooting mode for example; the camera application is run, and the first raw image is captured by the camera at the first time; the first raw image is processed by an image processing algorithm corresponding to the shooting mode, i.e., a first processing corresponding algorithm, to obtain a first image (for example, YUV processing); the first image is processed by an image processing algorithm (for example, an image processing algorithm in the YUV domain and a color space conversion process), to obtain a third image (for example, an RGB image); and the third image is displayed in a second interface. For example, the second interface is a preview interface 102 as shown in (b) of FIG. 2.
[0213] S420. Scene detection is performed on the first image to obtain a scene detection result.
[0214] The scene detection result is used to indicate a shooting scene in which the electronic device is currently located. For example, the shooting scene includes but is not limited to a sunset scene, a moon scene, a snow scene, a fireworks scene, a stage scene, and the like. Optionally, the trigger conditions of various scenes are described in S502 of FIG. 6 below, which will not be described here again.
[0215] Optionally, the scene detection performed on the first image to obtain the scene detection result includes:
[0216] A sample description text of a target scene is obtained; and the scene detection result is obtained based on a similarity between the sample description text and the first image.
[0217] Exemplarily, when the scene detection is performed on the image, the description text of the preset scene can be introduced, and the scene detection result is obtained based on a similarity between the first image and the description text of the preset scene. In the embodiments of the present application, when the scene detection is performed on the image, the description text of the preset scene is introduced, the scene detection can be performed on the image based on multi-dimensional data of image information and semantic information, compared with the scene detection performed based on single-dimensional data of image information, the recognition error of the scene detection can be reduced to a certain extent, and the accuracy and robustness of the scene detection can be ensured.
[0218] Optionally, the target scene includes a stage scene, a performance scene, a concert scene, a high-contrast scene, or a backlight scene.
[0219] It should be understood that the target scene is used to indicate a shooting scene in which the background is dark light and the foreground is bright light; because the brightness difference between the background and the foreground in the target scene is large, the image captured in the target scene is prone to overexposure.
[0220] In an implementation manner, taking a stage scene as an example of a target scene, a scene detection result is obtained based on a similarity between a sample description text of the stage scene and the first image. The scene detection result can be used to indicate whether a shooting scene corresponding to the first image is the target scene. Optionally, the scene detection result is obtained based on the similarity between the sample description text and the first image, including:
[0221] The sample description text is encoded to obtain a first text vector and a second text vector, and the first image is encoded to obtain a first image vector and a second image vector. A target similarity between the first text vector and the first image vector is determined. If the target similarity is greater than a preset similarity threshold, a confidence degree of matching between the second text vector and the second image vector is determined. The scene detection result is obtained based on the confidence degree and a preset confidence threshold.
[0222] In an implementation manner, a similarity between a text feature vector and an image feature vector is determined first. In a case where the similarity between the text feature vector and the image feature vector is greater than a preset similarity threshold, a confidence degree of matching between a text embedding vector and an image embedding vector is determined, so as to determine whether a scene corresponding to the image and the sample description text matches.
[0223] In another implementation manner, a similarity between a text embedding vector and an image embedding vector is determined first. In a case where the similarity between the text embedding vector and the image embedding vector is greater than a preset similarity threshold, a confidence degree of matching between a text feature vector and an image feature vector is determined, so as to determine whether a scene corresponding to the image and the sample description text matches.
[0224] In the embodiments of the present application, by encoding the sample description text and the image, two kinds of encoding outputs are generated: a feature vector (for example, a text feature vector and an image feature vector) and an embedding vector (for example, a text embedding vector and an image embedding vector). Through the two kinds of encoding outputs, the current scene and the target scene (for example, a stage scene) can be matched twice during scene detection, so as to improve the accuracy of the scene detection result.
[0225] Optionally, the vector types of the first text vector and the text vector are different, the types of the first image vector and the second image vector are different, the vector type of the first text vector is the same as the vector type of the first image vector, and the vector type of the second text vector is the same as the vector type of the second image vector.
[0226] Optionally, the specific implementation manners of the scene detection can be referred to the related description of FIG. 8; and details are not described herein.
[0227] S430. Exposure detection is performed on the first image to obtain an exposure detection result.
[0228] The exposure detection result is used to indicate whether the first image is an overexposed image.
[0229] Implementation one
[0230] Optionally, the first image is subjected to exposure detection to obtain an exposure detection result, including:
[0231] The first image is subjected to face detection and body detection to obtain a detection result; based on the detection result, a target detection region in the first image is determined; and based on pixel points in the target detection region, the exposure detection result is obtained.
[0232] For example, when the first image is subjected to exposure detection, the first image can be subjected to face detection and body detection to obtain a detection result. Based on different detection results, different regions in the first image can be determined as exposure detection regions, and based on pixel points in the exposure detection regions, the exposure detection result of the first image is determined.
[0233] Optionally, based on the detection result, the target detection region in the first image is determined, including:
[0234] If the detection result indicates that there is a face region in the first image, the face region is determined as the target detection region; if the detection result indicates that there is no face region and there is a body region in the first image, a first image region in the first image is determined as the target detection region.
[0235] The first image region is used to represent an image region where a neck key point to a head top key point in the body region is located.
[0236] For example, as shown in (a) of FIG. 10, the head top key point is point A, and the neck key point is point B. The first image region is a head region, that is, region 1 shown in (c) of FIG. 10. The implementation of determining the first image region can be described in the subsequent description of S706 in FIG. 9, and will not be described here.
[0237] In the embodiments of the present application, based on the detection result of face detection and body detection, the image can be subjected to exposure detection in a hierarchical manner. For example, the detection priority of the face region in the collected image is higher than the detection priority of the body region. Through multi-layer detection in a hierarchical manner, the exposure region in the image can be more accurately identified, thereby improving the accuracy of exposure detection.
[0238] Optionally, the image processing method further includes:
[0239] obtaining a scene detection result; if the scene detection result indicates that there is no face region and no human body region in the first image, determining whether the scene detection result indicates a target scene; if the scene detection result indicates the target scene, determining a second image region in the first image as a target detection region; wherein the second image region is a central region in the first image.
[0240] In an implementation manner, if no user is detected in the first image, i.e., the image captured by the electronic device does not include the user; obtaining a scene detection result of the image, if the scene detection result indicates that the shooting scene is a target scene, determining a central region in the first image as an exposure detection region; and performing exposure detection on the exposure detection region.
[0241] Optionally, when the human body region exists in the first image, the method further includes:
[0242] determining a target height, a target width and a target center point coordinate based on the coordinate of the neck key point and the coordinate of the head top key point; obtaining a first vertex coordinate based on a difference between the target center point coordinate and the target height and the target width; obtaining a second vertex coordinate based on a sum of the target center point coordinate and the target height and the target width; and obtaining the first image region based on the first vertex coordinate and the second vertex coordinate.
[0243] For example, as shown in (a) of FIG. 10, the neck key point is point B, the head top key point is point A, and the coordinate of the target center point coordinate is point C; as shown in (b) of FIG. 10, the first vertex coordinate is the coordinate of point D; and the second vertex coordinate is the coordinate of point E. The implementation manners of determining the target height, the target width, the target center point coordinate, the first vertex coordinate and the second vertex coordinate can be described in the related description of S706 in parameter diagram 9, which will not be described here again.
[0244] Optionally, determining the target height, the target width and the target center point coordinate based on the coordinate of the neck key point and the coordinate of the head top key point includes:
[0245] determining a first coordinate difference value and a second coordinate difference value of the neck key point and the head top key point; wherein the first coordinate difference value is a horizontal coordinate difference value of the neck key point and the head top key point; the second coordinate difference value is a vertical coordinate difference value of the neck key point and the head top key point; if the first coordinate difference value is greater than the second coordinate difference value, determining half of the first coordinate difference value as the target height and half of the second coordinate difference value as the target width; if the second coordinate difference value is greater than the first coordinate difference value, determining half of the second coordinate difference value as the target height and half of the first coordinate difference value as the target width; and determining the coordinate of the midpoint of the neck key point and the head top key point as the target center point coordinate.
[0246] It should be understood that, when performing exposure detection, face detection and body detection are performed on the acquired image first; if there is a face region or a body region in the image, the exposure detection region is determined according to the face region or the body region. If there is no face region and no body region in the image, it is further determined whether the shooting scene of the image is a stage scene. Since the stage scene usually includes a plurality of high-intensity light sources, when there is no face region and no body region in the image and the image is collected in the stage scene, exposure detection is further performed on the central region of the stage scene.
[0247] Optionally, the exposure detection result is obtained based on the pixel points in the target detection region, including:
[0248] The number of target pixel points with a luminance value greater than a first preset luminance threshold in the target detection region is determined; a target proportion is determined based on the number of target pixel points and the total number of pixel points in the target detection region; and the exposure detection result is obtained based on the target proportion and a preset proportion threshold.
[0249] For example, the number of target pixel points can be the number of pixel points with overexposed luminance values in the exposure detection region; and the total number of pixel points can be the total number of pixel points in the exposure detection region. Optionally, the above implementation manner can refer to the related description of S710 in FIG. 9, which will not be described here again.
[0250] Optionally, the specific implementation manner of the exposure detection can refer to the related description of FIG. 9, which will not be described here again.
[0251] Implementation manner two
[0252] Optionally, in an implementation manner, the exposure detection is performed on the first image to obtain an exposure detection result, including:
[0253] Target metadata of the target sensor is acquired; wherein the target metadata is used to represent the metadata of the target sensor when the first original image is collected;
[0254] The exposure detection result is obtained based on the target metadata.
[0255] In the embodiments of the present application, the metadata of the target sensor in the electronic device when the first image is collected can be acquired when the exposure detection is performed on the first image; and the exposure detection result is obtained through the metadata of the target sensor. Since the target metadata is the metadata of the target sensor when the first original image is collected, the introduction of the metadata of the target sensor can improve the accuracy of the exposure detection result to a certain extent when the exposure detection result of the image is determined.
[0256] Optionally, in an implementation manner, the exposure detection result is obtained based on the target metadata, including:
[0257] determine a scene brightness of the shooting scene based on the target metadata;
[0258] If the scene brightness is greater than a second preset brightness threshold, an exposure detection result is obtained based on the brightness values of the pixel points in the first image.
[0259] In the embodiments of the present application, the scene brightness of the shooting scene when the first original image is collected can be determined through the target metadata. Since overexposure problems are more likely to occur in high-brightness scenes, in the case that the scene brightness of the shooting scene is greater than a preset scene brightness, the exposure detection result is determined based on the brightness values of the pixel points in the first image. Compared with determining the exposure detection result of the first image based on the brightness values of the pixel points in the first image in real time, the power consumption of the electronic device can be saved to a certain extent.
[0260] Implementation manner three
[0261] In an implementation manner, target metadata of a target sensor is obtained; the target metadata is used to represent the metadata of the target sensor when the first original image is collected; a scene brightness of a shooting scene is determined based on the target metadata; and if the scene brightness is greater than a second preset brightness threshold, an exposure detection result is obtained based on the pixel points in the target detection region.
[0262] The implementation manner of determining the target detection region is described in the related description of the implementation manner one, which will not be described here again.
[0263] Optionally, S420 and S430 can be executed simultaneously.
[0264] S440. Displaying a first interface.
[0265] The first interface includes a second image; the second image is obtained by performing a second processing on a second original image; the second original image is collected by the camera at a second time; and the second processing includes a target exposure reduction processing determined based on the scene detection result and the exposure detection result.
[0266] In an implementation manner, the first interface is a shooting preview interface; and the preview interface 105 as shown in (e) of FIG. 2.
[0267] In another implementation manner, the first interface is a video recording preview interface; and the second image displayed in the video recording preview interface is an image obtained by performing a target exposure reduction processing determined based on the scene detection result and the exposure detection result.
[0268] Optionally, in an implementation manner, the method further includes:
[0269] A first control is displayed in the first interface based on the scene detection result and the exposure detection result; and the first control is used to indicate the target scene.
[0270] In the embodiments of the present application, the first control is displayed in the first interface, and the first control is used to indicate the target scene; by displaying the first control, the user is prompted about the current shooting scene of the electronic device; so that the user perceives the current shooting scene of the electronic device.
[0271] For example, the first interface is the preview interface 105 shown in (e) of FIG. 2; and the first control is the control 24 of the stage scene.
[0272] It should be understood that the target scene is used to indicate a shooting scene in which the background is dark light and the foreground is bright light; because the brightness difference between the background and the foreground in the target scene is large, the image collected in the target scene is prone to overexposure.
[0273] Optionally, the target scene is exemplarily taken as the stage scene, and the target scene can also be a performance scene, a concert scene, a high-contrast scene, or a backlight scene, etc.
[0274] Optionally, in an implementation manner, based on the scene detection result and the exposure detection result, the first control is displayed in the first interface, including:
[0275] Based on the scene detection result and the exposure detection result, it is determined whether the shooting scene is the target scene;
[0276] In a case where the shooting scene is the target scene, the first control is displayed in the first interface.
[0277] In the embodiments of the present application, the target scene can be automatically detected based on the scene detection result and the exposure detection result; because the light source of the target scene is relatively complex, the second original image can be processed by the target exposure processing, the overexposed area in the image is reduced, and the detail information in the image is improved; so as to improve the image quality of the shooting image in the target scene. In addition, the first control is displayed in the target scene, the user is prompted about the current shooting scene of the electronic device; so that the user perceives the current shooting scene of the electronic device.
[0278] Optionally, in an implementation manner, based on the scene detection result and the exposure detection result, it is determined whether the shooting scene is the target scene, including:
[0279] If the scene detection result indicates that the shooting scene is the target scene, and the exposure detection result indicates that the first image is an overexposed image, it is determined that the shooting scene is the target scene.
[0280] It should be understood that the overexposed image is used to represent an image in which some areas or the whole image appear too bright and lack of details due to too much light received by the camera during the shooting process.
[0281] In an implementation manner, the overexposed image is used to indicate that the proportion of the pixel points with the luminance higher than the preset luminance threshold in the entire image is greater than a preset proportion threshold.
[0282] In another implementation manner, the overexposed image is used to indicate that the proportion of the pixel points with the luminance higher than the preset luminance threshold in the exposure detection region of the entire image is greater than a preset proportion threshold.
[0283] In the embodiments of the present application, when detecting whether the shooting scene where the electronic device is located is a target scene, the scene detection result and the exposure detection result of the first image are used to jointly determine whether the electronic device is in the target scene; when it is detected that the scene detection result indicates the target scene and the exposure detection result indicates the overexposed image, it is determined that the current shooting scene is the target scene. The scene detection result and the exposure detection result are used to jointly detect the target scene, which can improve the accuracy of target scene detection.
[0284] In another implementation manner, if the scene detection result indicates the first scene, or the exposure detection result indicates that the first image is not an overexposed image, it is determined that it is not the target scene; at this time, the target exposure reduction processing is not run; wherein the first scene is different from the target scene.
[0285] In the embodiments of the present application, if the scene detection result of the first image indicates the first scene, i.e., indicates that it is not the target scene; or the exposure detection result indicates that the first image is not an overexposed image, it is determined that the target exposure reduction processing is not run; at this time, the default exposure reduction processing included in the first processing can be run; in the present solution, different exposure processing modes can be determined based on the scene detection result and the exposure detection result; the exposure effect of the image is improved, thereby improving the image quality.
[0286] Optionally, in an implementation manner, the first interface includes a second control, and the second control is used to indicate that the target exposure reduction processing is run.
[0287] In the embodiments of the present application, the second control is displayed in the first interface, and the second control is used to indicate that the target exposure reduction processing is run; by displaying the second control, the user is prompted that the current target exposure reduction processing is run; so that the user perceives that the image processing algorithm run by the electronic device can be dynamically adjusted in real time according to the shooting scene.
[0288] In an implementation manner, the first control and the second control are the same control, i.e., indicating the target scene and the target exposure reduction processing; after the target scene is recognized, the target exposure reduction processing is automatically run.
[0289] In another implementation manner, the first control and the second control are different controls; wherein the first control is used to indicate the target scene; and the second control is used to indicate that the target exposure reduction processing is run.
[0290] Optionally, in an implementation, the image processing method further includes:
[0291] if the scene detection result indicates the target scene and the exposure detection result indicates that the first image is not an overexposed image, determining a second shooting mode; wherein the second shooting mode is a shooting mode corresponding to the target scene;
[0292] displaying a third interface; wherein the third interface displays a third control, and the third control is used to indicate running the second shooting mode;
[0293] in response to a first operation on the third control, displaying a fourth interface; wherein the fourth interface is a shooting interface of the second shooting mode.
[0294] For example, the third interface is the preview interface 305 as shown in (e) of FIG. 4, the third control is the prompt control 25, if a click operation on the prompt control 25 is detected, the fourth interface is displayed, and the fourth interface is the stage preview interface 306 as shown in (f) of FIG. 4.
[0295] It should be understood that the second shooting mode is exemplarily taken as the stage shooting mode; the second shooting mode further includes a performance shooting mode, a concert shooting mode, a high-contrast shooting mode, or a backlight shooting mode, etc.
[0296] In the embodiment of the present application, if the scene detection result indicates the target scene and the exposure detection result indicates that the first image is not an overexposed image, it means that the shooting scene where the electronic device is located is a scene where there is no overexposure; however, since the scene detection result indicates the target scene, the second shooting mode can be provided to the user; if the user has the demand to switch the mode, the current mode is switched to the second shooting mode; since the second shooting is the shooting mode corresponding to the target scene, the image processing algorithm in the shooting mode is a more comprehensive image processing algorithm for the target scene, and thus the image quality in the target scene can be improved.
[0297] Optionally, in an implementation, the image processing method further includes:
[0298] displaying prompt information of the second shooting mode in the fourth interface.
[0299] For example, the third preview interface of the first shooting mode is the preview interface 305 as shown in (e) of FIG. 4, the second control is the prompt control 25, and the prompt information of the recommended shooting mode displayed in the prompt control 25 is “try stage mode”.
[0300] Optionally, in an implementation, the image processing method further includes:
[0301] if the first operation is not detected, displaying the third interface.
[0302] For example, if no click operation of the user is detected in the preview interface 305 as shown in (e) of FIG. 4, the preview interface 102 as shown in (b) of FIG. 2 is displayed; or the preview interface 104 as shown in (d) of FIG. 2 is displayed.
[0303] Optionally, in an implementation, the image processing method further includes:
[0304] In a case where the shooting scene is the target scene, a light metering brightness of the first image is determined, wherein the light metering brightness is used to represent an integral light metering brightness of the first image; based on the light metering brightness, the exposure parameter is determined as a first exposure parameter; a fourth image is acquired based on the first exposure parameter; in a case where at least one face is recognized in the fourth image, an area of the target face and a weighted face brightness in the at least one face are determined; in a case where the area of the target face is less than or equal to a preset threshold and at least one human body is recognized in the fourth image, a weighted human body brightness is determined; based on the weighted face brightness and the weighted human body brightness, a target light metering brightness is determined; based on the target light metering brightness, the exposure parameter is adjusted to obtain a parameter of target underexposure processing.
[0305] Optionally, in another implementation, based on the scene detection result and the exposure detection result, it is determined that the current is the stage scene, the light metering brightness of the face region or the human body region in the image collected in the stage scene is used to adjust the underexposure, the brightness of the image collected in the stage scene is suppressed until the face or the human body is recognized in the image collected in the stage scene, the light metering brightness is determined; the determined light metering brightness is used to determine the underexposure parameter, and the brightness is adjusted by delivering the underexposure parameter to the image sensor.
[0306] In an implementation, in a case where the stage scene is determined based on the scene detection result and the exposure detection result, the overall image metering brightness of the first image collected is determined; the exposure parameter is determined as the first exposure parameter according to the overall image metering brightness of the first image; the second image is collected according to the first exposure parameter, and in a case where at least one face is recognized in the second image, the area of the target face in the at least one face and the weighted face brightness are determined; in a case where the area of the target face is less than or equal to a preset threshold and at least one human body is recognized in the second image, the weighted human body brightness is determined; the first metering brightness is determined according to the weighted face brightness and the weighted human body brightness; and the exposure parameter is adjusted according to the first metering brightness. For example, in a case where the stage scene is determined based on the scene detection result and the exposure detection result, the overall image high light is suppressed by using low-brightness small-weight metering in the image until the face or the human body can be recognized in the image; in a case where the human body is recognized but the face is not recognized, the human body information (for example, the metering of the human body area) is used to further assist in reducing exposure to suppress the subject overexposure until the face is recognized in the image; at this time, the weighted human body brightness and the low-brightness small-weight metering brightness (for example, the face brightness) are combined to make the exposure reduction stable and smooth; in a case where the face is recognized, the face area is determined; in a case where the face area is small, the subject brightness is stable and appropriate by fusing the human body brightness and the face brightness. In a case where the face area is large, the exposure is reduced by using the face area / low-brightness small-weight metering brightness; and after the metering brightness is determined, the exposure parameter is issued to the image signal processor to adjust the brightness to be appropriate.
[0307] In another implementation, in a case where the stage scene is determined based on the scene detection result and the exposure detection result, if the face is detected in the image, the adjusted exposure adjustment parameter is obtained according to the metering brightness of the face area; and the image of the stage scene is subjected to the exposure reduction processing by using the adjusted exposure parameter.
[0308] In another implementation, in a case where the stage scene is determined based on the scene detection result and the exposure detection result, if the face is not detected in the image and the human body is detected, the adjusted exposure adjustment parameter is obtained according to the metering brightness of the human body area; and the image of the stage scene is subjected to the exposure reduction processing by using the adjusted exposure parameter.
[0309] In the above implementation, since the light of the stage scene is usually strong, the preview image and the photographed image collected are prone to overexposure, that is, the highlight area in the image is too bright, resulting in loss of details. In order to solve the overexposure problem of the stage scene, the above scheme can be used to perform light measurement mainly on the highlight area in the image, so that the luminance value detected by the image sensor is relatively large. Then, based on the principle of an automatic exposure (AE) algorithm, the AE module will automatically adjust the exposure parameter according to this large luminance value to reduce the exposure amount, so as to reduce the phenomenon of overexposure of the main body during preview and photography, thereby improving the image quality and retaining more image details; and improving the image quality.
[0310] In the embodiment of the present application, at a first time, a camera collects a first original image; a first processing is performed on the first original image by an electronic device to obtain a first image; scene detection and exposure detection are performed on the first image to obtain a scene detection result and an exposure detection result; a target exposure reduction processing can be determined in real time according to the scene detection result and the exposure detection result; at a second time after the first time, a second processing can be performed on a second original image based on the target exposure reduction processing to obtain a second image. In the above scheme, since the target exposure reduction processing is determined according to the scene detection result and the exposure processing result of the image before the current time; therefore, the accuracy of the parameters of the exposure processing can be improved; in the case of improving the accuracy of the parameters of the exposure processing, the image detail information in the image is improved; thereby improving the image quality.
[0311] The image processing method provided by the embodiment of the present application will be described below by taking a stage scene as an example in combination with FIGS. 6 to 10.
[0312] FIG. 6 is a schematic flowchart of another example of the image processing method provided by the embodiment of the present application. The method 500 includes S501 to S513; S501 to S513 will be described in detail below.
[0313] S501. Obtain an image collected.
[0314] Illustratively, the collected image refers to a YUV image obtained by performing image processing (including exposure reduction processing) on a Raw image collected by a camera of an electronic device after the electronic device runs a camera application. For example, the image can refer to an image frame in a preview stream in the camera application.
[0315] In an implementation, the image displayed in the preview interface of the camera application refers to an image (for example, an RGB image) obtained by performing color space conversion on the image (for example, a YUV image) collected in S501; for example, the YUV image is converted to an RGB color space to obtain an RGB image; that is, the preview image displayed in the camera application is an RGB image.
[0316] In one implementation, the user can click the icon of the camera application to instruct the electronic device to open the camera application; or when the electronic device is in a locked state, the user can slide rightward on the display screen of the electronic device to instruct the electronic device to open the camera application. In another implementation, when the electronic device is in a locked state, the icon of the camera application is included in the lock screen interface, and the user can click the icon of the camera application to instruct the electronic device to open the camera application. In yet another implementation, when the electronic device is running another application, the application has the permission to call the camera application; the user can click a corresponding control to instruct the electronic device to open the camera application. For example, when the electronic device is running an instant messaging application, the user can select a control of a camera function to instruct the electronic device to open the camera application.
[0317] It should be understood that the above is an example of the operation of opening the camera application; the electronic device can also be instructed to open the camera application by voice or other operations; the present application does not limit the operation.
[0318] S502. Perform scene detection on the collected image to obtain a scene detection result.
[0319] The scene detection result is used to indicate the shooting scene in which the electronic device is currently located. For example, the shooting scene includes, but is not limited to, a sunset scene, a moon scene, a snow scene, a fireworks scene, a stage scene, and the like. In one implementation, the trigger condition of the sunset scene is if (Scene_Tag_Info == Scene_Tag_Fireworks && Lux_Index < Stage_Scene_Th). In the formula, Scene_Tag_Info represents the scene identification obtained by scene recognition, and Lux_Index represents the scene illumination information. It can be understood that the trigger condition of the sunset scene is that if the scene label obtained by scene detection is a sunset scene and a bright light scene is detected, the current scene is determined to be a sunset scene.
[0320] It should be understood that the Lux_Index is inversely proportional to the illumination of the shooting scene; the larger the Lux_Index, the lower the illumination of the scene. That is, Lux_Index > Stage_Scene_Th indicates that the shooting scene is a dark light scene, and Lux_Index < Stage_Scene_Th indicates that the shooting scene is a bright light scene.
[0321] In another implementation, the trigger condition of the moon scene is if (Scene_Tag_Info==Scene_Tag_Moon && Lux_Index>Stage_Scene_Th && Zoomin_Info>Zoomin_Ratio_Th); wherein Scene_Tag_Info represents the scene identification obtained by the scene recognition; Lux_Index represents the scene illumination information; and Zoomin_Info represents the zoom ratio. It can be understood that the trigger condition of the moon scene is that if the scene identification indicates the moon, the dark light scene, and the zoom ratio is greater than the preset zoom ratio, the current scene is determined to be the moon scene.
[0322] In another implementation, the trigger condition of the snow scene is if (Scene_Tag_Info==Scene_Tag_Snow); wherein Scene_Tag_Info represents the scene identification obtained by the scene recognition. It can be understood that if the scene detection label is the snow scene, the current scene is determined to be the snow scene.
[0323] In another implementation, the trigger condition of the fireworks scene is if (Scene_Tag_Info==Scene_Tag_Fireworks && Lux_Index>Stage_Scene_Th); wherein Scene_Tag_Info represents the scene identification obtained by the scene recognition; and Lux_Index represents the scene illumination information. It can be understood that the trigger condition of the fireworks scene is that if the scene detection scene label is fireworks, and the dark light scene is detected, the current scene is determined to be the fireworks scene.
[0324] It should be noted that in the embodiments of the present application, the stage scene is added on the basis of the existing scene; the stage scene is triggered based on the scene detection result and the exposure detection result; for example, if the scene detection scene identification is a stage, and the exposure detection indicates an exposure image, the current scene is determined to be a stage scene.
[0325] In the embodiments of the present application, the stage scene is added on the basis of the existing scene, so that the types of scenes that can be recognized are more sufficient, that is, more types of scenes can be recognized. Because the types of scenes are increased; therefore, it can be ensured that the camera application can more accurately recognize the current shooting scene, and the original image collected by the camera is processed by using the image processing algorithm (for example, the exposure reduction algorithm) corresponding to the current shooting scene, thereby improving the image quality.
[0326] In one implementation, the shooting scene in which the electronic device is located is detected according to the image information in the collected image, and a scene detection result is obtained.
[0327] Exemplarily, the scene detection described above can adopt any existing related algorithm of scene detection.
[0328] In another implementation, the image is subjected to scene detection according to image information in the collected image and preset scene description text information, to obtain a scene detection result.
[0329] In the embodiments of the present application, when the collected image is subjected to scene detection, the image can be subjected to scene detection based on image information and text information of a preset scene. Through image information and semantic information, that is, through multi-dimensional data, the image can be subjected to scene detection, compared with scene detection through single-dimensional data of image information. The related algorithm of scene detection in the embodiments of the present application can reduce recognition error to a certain extent, and ensure to improve the accuracy and robustness of scene detection.
[0330] Optionally, the specific implementation of scene detection can refer to the related description of subsequent FIG. 8.
[0331] S503. The collected image is subjected to exposure detection, to obtain an exposure detection result.
[0332] The exposure detection result is used to indicate whether the collected image is an overexposed image. That is, whether there is an overexposed area in the image. The overexposed area usually refers to an image area in which some areas become very bright due to overexposure, so that the pixel value approaches or reaches the maximum value (for example, 255 in an 8-bit image, and 255 in each channel of an RGB image).
[0333] In one implementation, the image is subjected to exposure detection through the brightness value of a pixel point in the collected image, to obtain an exposure detection result.
[0334] Exemplarily, the exposure detection described above can adopt any existing related algorithm of exposure detection.
[0335] In another implementation, when the collected image is subjected to exposure detection, it is first determined whether a user is detected in the image. If a user is detected in the image, a face area or a head area of the user is determined as an exposure detection area. If no user is detected in the image, and the scene detection result of the image indicates that the shooting scene is a stage scene, a preset central area of the stage scene in the image is determined as an exposure detection area. According to the detection of pixel points in the exposure detection area, an exposure detection result is obtained.
[0336] In the embodiments of the present application, when performing exposure detection on the collected image, the image can be detected in a hierarchical manner; for example, the detection priority of the face region in the image is higher than that of the human body region, and the detection priority of the human body region is higher than that of the center region of the image; through the above hierarchical multi-layer detection, the exposure region in the image can be more accurately identified, thereby improving the accuracy of exposure detection.
[0337] Optionally, in an implementation manner, the specific implementation manner of exposure detection can refer to the related description of FIG. 9.
[0338] Optionally, in another implementation manner, the brightness value of the shooting scene is determined according to the parameter of the ambient light sensor in the electronic device; and the exposure detection result is determined based on the brightness value of the shooting scene.
[0339] For example, the ambient light sensor can detect the current light intensity in real time, and convert this information into an electrical signal, and then inform the processing chip. The processing chip can determine the brightness condition of the current scene according to the parameter of the ambient sensor, whether it is a dark scene or a bright scene.
[0340] S504. Determine the scene detection result and the exposure detection result.
[0341] For example, it is determined whether the scene detection result indicates that the shooting scene corresponding to the collected image is a stage scene, and whether the exposure detection result indicates that the collected image is an overexposed image.
[0342] Through the execution of S504, the following four cases can be obtained:
[0343] Case 1: the scene detection indicates a stage scene, and the exposure detection indicates an overexposed image;
[0344] Case 2: the scene detection indicates a stage scene, and the exposure detection indicates that it is not an overexposed image;
[0345] Case 3: the scene detection indicates that it is not a stage scene, and the exposure detection indicates an overexposed image;
[0346] Case 4: the scene detection indicates that it is not a stage scene, and the exposure detection indicates that it is not an overexposed image.
[0347] In an implementation manner, for case 1, the scene detection indicates a stage scene, and the exposure detection indicates that the collected image is an overexposed image; it indicates that the shooting scene in which the electronic device is located is a stage scene, and there is an overexposure problem in the image collected in the current stage scene; therefore, S505 to S507 are executed. Through S505 to S507, the overexposure region in the stage scene can be processed to reduce the exposure, thereby improving the image quality of the collected image in the stage scene.
[0348] In another implementation, for case 2, the scene detection indicates a stage scene, and the exposure detection indicates that the captured image is not an overexposed image; it indicates that the shooting scene where the electronic device is located is a stage scene, and there is no overexposure problem in the captured image in the current stage scene; at this time, S508 to S511 are executed. S508 to S511 can determine whether the user has the demand to switch the shooting mode, if it is detected that the user has the demand to switch to the stage shooting mode, the shooting mode of the camera application is switched from the current shooting mode to the stage shooting mode; if it is detected that the user does not have the demand to switch to the stage shooting mode, the camera application is controlled to continue running the current shooting mode.
[0349] In another implementation, for case 3, the scene detection indicates that it is not a stage scene, and the exposure detection indicates that the captured image is an overexposed image; it indicates that the shooting scene where the electronic device is located is not a stage scene, and there is an overexposure problem in the captured image in the shooting scene; at this time, S512 is executed. By executing S512, the current shooting mode is run through the image processing algorithm of the current shooting mode; that is, the default overexposure reduction algorithm of the current shooting mode is used to perform overexposure reduction processing on the image.
[0350] In another implementation, for case 4, the scene detection indicates that it is not a stage scene, and the exposure detection indicates that the captured image is not an overexposed image; it indicates that the shooting scene where the electronic device is located is not a stage scene, and there is no overexposure problem in the captured image in the shooting scene; at this time, S513 is executed. By executing S513, the image processing algorithm of the current shooting mode is run.
[0351] In an implementation, after S502 and S503 are executed, any one of S505, S508, S512 and S513 can be executed according to the scene detection result and the exposure detection result.
[0352] S505. If the scene detection result indicates a stage scene, and the exposure detection result indicates an overexposed image, the exposure adjustment strategy of the stage scene is run.
[0353] Optionally, in an implementation, in the case of determining a stage scene based on the scene detection result and the exposure detection result, the exposure adjustment strategy includes: reducing the sensitivity, and / or reducing the exposure compensation, to achieve overexposure reduction processing on the image.
[0354] Optionally, in another implementation, based on the scene detection result and the exposure detection result, when it is determined that the current is a stage scene, the exposure adjustment parameter is obtained according to the light measurement brightness of the face region or the human body region in the image collected in the stage scene, the brightness of the image collected in the stage scene is suppressed, until a face or a human body is recognized in the image collected in the stage scene, the light measurement brightness is determined; the exposure adjustment parameter is determined according to the determined light measurement brightness, and the brightness is adjusted by delivering the exposure adjustment parameter to the image sensor.
[0355] In an implementation, in a case where it is determined that the current is a stage scene based on the scene detection result and the exposure detection result, the whole-image light measurement brightness of the collected first image is determined; the exposure parameter is determined as a first exposure parameter according to the whole-image light measurement brightness of the first image; the second image is collected according to the first exposure parameter, in a case where at least one face is recognized in the second image, the area of the target face and the weighted face brightness in the at least one face are determined; in a case where the area of the target face is less than or equal to a preset threshold and at least one human body is recognized in the second image, the weighted human body brightness is determined; the first light measurement brightness is determined according to the weighted face brightness and the weighted human body brightness; and the exposure parameter is adjusted according to the first light measurement brightness. For example, in a case where it is determined that the current is a stage scene based on the scene detection result and the exposure detection result, the low-brightness small-weight light measurement is used to suppress the overall picture highlight in the image first, until a face or a human body can be recognized in the image; in a case where a human body is recognized but a face is not recognized, the human body information (for example, the light measurement of the human body region) is used to further assist the exposure reduction to suppress the subject overexposure, until a face is recognized in the image; at this time, the weighted human body brightness and the low-brightness small-weight light measurement brightness (for example, the face brightness) are combined, so that the exposure reduction is stable and smooth; in a case where a face is recognized, the face area is determined; in a case where the face area is small, the human body brightness and the face brightness are fused, so that the subject brightness is stable and appropriate. In a case where the face area is large, the face area / low-brightness small-weight light measurement brightness is used for exposure reduction; after the light measurement brightness is determined, the exposure parameter is delivered to the image signal processor to adjust the brightness to be appropriate.
[0356] In another implementation, in a case where it is determined that the current is a stage scene based on the scene detection result and the exposure detection result, if a face is detected in the image, an adjusted exposure adjustment parameter is obtained according to the light measurement brightness of the face region; the image of the stage scene is subjected to exposure reduction processing through the adjusted exposure adjustment parameter.
[0357] In another implementation, in a case where it is determined that the current is a stage scene based on the scene detection result and the exposure detection result, if a face is not detected in the image and a human body is detected, an adjusted exposure adjustment parameter is obtained according to the light measurement brightness of the human body region; the image of the stage scene is subjected to exposure reduction processing through the adjusted exposure adjustment parameter.
[0358] In the above implementation, since the light of the stage scene is usually strong, the preview image and the photographed image collected are prone to overexposure, that is, the highlight area in the image is too bright, resulting in loss of details. In order to solve the overexposure problem of the stage scene, the above scheme can be used to perform light measurement mainly on the highlight area in the image, so that the brightness value detected by the image sensor is relatively large. Then, based on the principle of an automatic exposure (AE) algorithm, the AE module will automatically adjust the exposure parameter according to this larger brightness value to reduce the exposure amount, so as to reduce the phenomenon of overexposure of the main body during preview and photography, thereby improving the image quality and retaining more image details; and improving the image quality.
[0359] It should be understood that when the exposure adjustment strategy of the stage scene is run, the shooting mode of the camera application program remains unchanged; wherein the shooting mode includes but is not limited to: night scene, video recording, photographing, portrait, professional, more shooting modes, etc.
[0360] In an implementation, the camera application program runs a photographing mode, and an image 1 is collected in the photographing shooting mode; the image 1 is subjected to exposure detection and scene detection; if the scene detection result of the image 1 indicates a stage scene, and the exposure detection result indicates that the image 1 is an overexposed image, then the stage scene in the photographing mode is started. In the photographing mode, the corresponding exposure reduction algorithm of the stage scene is run.
[0361] It should be noted that the image 1 refers to a YUV image obtained by image processing of a Raw image collected by a camera in the photographing shooting mode of the camera application. For example, the image can refer to an image frame in a Tiny stream in the camera application.
[0362] In another implementation, the camera application program runs a video recording mode, and an image 2 is collected in the video recording shooting mode; the image 2 is subjected to exposure detection and scene detection; if the scene detection result of the image 2 indicates a stage scene, and the exposure detection result indicates that the image 2 is an overexposed image, then the stage scene in the video recording mode is started. In the video recording mode, the corresponding exposure reduction algorithm of the stage scene is run.
[0363] It should be noted that the image 2 refers to a YUV image obtained by image processing of a Raw image collected by a camera in the video recording shooting mode of the camera application. For example, the image can refer to an image frame in a Tiny stream in the camera application.
[0364] In the foregoing solution, in a case where the scene detection result indicates a stage scene and the exposure detection result indicates an overexposed image, an exposure adjustment strategy of the stage scene is executed; the exposure adjustment strategy of the stage scene refers to adjusting a default underexposure algorithm corresponding to a current shooting mode to an underexposure algorithm corresponding to the stage scene without switching a shooting mode applied to the camera. Since the underexposure algorithm of the stage scene is executed without switching the shooting mode applied to the camera, compared with switching the shooting mode applied to the camera, the image processing efficiency of the electronic device can be improved under the premise of improving the image quality; in addition, since only the underexposure algorithm needs to be adjusted without adjusting other image processing algorithms in the current shooting mode, compared with switching the shooting mode, data transmission in the electronic device can be reduced, and the power consumption of the electronic device is saved to a certain extent.
[0365] S506. determining whether an operation of exiting the stage scene is detected; if yes, performing S507; if no, performing S505.
[0366] For example, the operation of exiting the stage scene includes an operation of switching a shooting mode of the camera application, or an operation of moving the electronic device.
[0367] For example, assuming that the current mode of the camera application is a photographing mode; the operation of switching the shooting mode of the camera application can refer to detecting a click operation on a portrait mode, or detecting a click operation on a night scene mode, or detecting a click operation on a video recording mode, and the like.
[0368] In the embodiments of the present application, in order to avoid frequent switching of the exposure strategy of the camera application, the stability of the exposure algorithm is maintained after the camera application enters the stage scene, that is, the stability of the shooting mode is maintained; only when the operation of exiting the stage scene is detected, the exposure algorithm of the camera application is switched. Therefore, before the operation of exiting the stage scene is detected, the exposure algorithm corresponding to the stage scene is used.
[0369] Optionally, in an implementation manner, after S505 is performed, in a case where the operation of exiting the stage scene is detected, S507 can be performed. It can be understood that, after S505 is performed, S506 can not be performed; in a case where the operation of exiting the stage scene is detected, S507 is performed; in a case where the operation of exiting the stage scene is not detected, S505 is continuously performed.
[0370] S507. exiting the exposure adjustment strategy of the stage scene.
[0371] In the embodiments of the present application, if the operation of exiting the stage scene is detected, the exposure adjustment strategy of the stage scene is exited; that is, it can be understood that the parameter of automatic underexposure corresponding to the stage scene is closed; the image is underexposed by using the default underexposure parameter of the current shooting mode.
[0372] S508. If the scene detection result indicates a stage scene and the exposure detection result indicates that the image is not overexposed, display a prompt control of the stage shooting mode.
[0373] The prompt control of the stage shooting mode is used to prompt the user whether to start the stage shooting mode.
[0374] It should be noted that the stage shooting mode refers to a shooting mode of the camera application; that is, it can be understood that the stage shooting mode is a parallel shooting mode with the shooting mode, the portrait mode, the night scene mode, etc. When the stage shooting mode is running, the electronic device can process the image captured by the camera through the image processing algorithm corresponding to the stage shooting mode; the present application does not make any limitation on the image processing algorithm corresponding to the stage shooting mode.
[0375] For example, the prompt control of the stage shooting mode is the prompt control 25 of the stage mode in the preview interface 305 shown in (e) of FIG. 4; wherein the prompt control 25 displays and prompts the prompt information related to the function of the prompt control, such as “try the stage mode”.
[0376] In an implementation manner, when recommending the stage mode, a friendly recommendation mechanism can be adopted; if the exposure detection indicates that the image is not overexposed and the confidence of the scene detection result indicating the stage scene is high, the stage mode can be automatically entered; if the exposure detection indicates that the image is not overexposed and the confidence of the scene detection result indicating the stage scene is low, the prompt control of the stage mode is displayed, and whether to enter the stage mode is determined based on the needs of the user; to avoid the misjudgment and bad shooting experience that may be caused by automatically entering the stage mode.
[0377] S509. Whether the operation on the prompt control is detected; if yes, perform S510; if no, perform S511.
[0378] For example, the operation on the prompt control: the click operation on the prompt control, the voice operation on the prompt control, and other operations indicating the running of the stage shooting mode.
[0379] Optionally, in an implementation manner, S509 can not be performed after S508. It can be understood that after S508 is performed, in the case that the operation on the prompt control is detected, S510 is performed; in the case that the operation on the prompt control is not detected, S511 is performed.
[0380] S510. Display a preview interface of the stage shooting mode.
[0381] Exemplarily, after detecting the user operation on the prompt control, the shooting mode of the camera application can be switched from the current mode to the stage shooting mode; the image collected is processed by the image processing algorithm corresponding to the stage shooting mode, and the preview interface of the stage shooting mode is displayed, as shown in the stage preview interface 306 in (f) of FIG. 4.
[0382] It should be noted that different modes can correspond to different image processing algorithms; different image processing algorithms can be used to process images collected in different shooting scenes, thereby improving image quality.
[0383] S511. Display the preview interface of the current shooting mode.
[0384] It should be understood that the current shooting mode can refer to the shooting mode of the camera application when the camera of the electronic device collects an image.
[0385] Exemplarily, the camera application displays the preview interface of the shooting mode, as shown in the preview interface 302 in (b) of FIG. 4; the preview image 1 is displayed in the preview interface 302, and the preview image 1 is a preview image obtained by processing the image collected by the camera of the electronic device by the image processing algorithm corresponding to the shooting shooting mode; the scene detection and exposure detection are performed on the image collected by the camera, the scene detection result indicates a stage scene, and the exposure detection result indicates that there is no exposure area; the prompt control of the stage shooting mode is displayed in the preview interface of the shooting shooting mode; if no user operation on the prompt control is detected, it indicates that the user has no demand to switch the camera application to the stage shooting mode, and at this time the camera application continues to display the preview interface 302.
[0386] It should be noted that the above example takes the current shooting mode as the shooting shooting mode, and the current shooting mode can be any shooting mode other than the stage shooting mode, which is not limited in the present application.
[0387] S512. If the scene detection result indicates that it is not a stage scene, and the exposure detection result indicates that the image is overexposed, run the image processing algorithm of the current shooting mode.
[0388] For example, the image processing algorithm of the current shooting mode includes an automatic exposure algorithm corresponding to the current shooting mode, and other image processing related algorithms.
[0389] Exemplarily, when the scene detection result indicates that it is not a stage scene, and the exposure detection result indicates that the image is overexposed, the image can be processed by the automatic exposure algorithm corresponding to the current shooting mode.
[0390] S513. If the scene detection result indicates that it is not a stage scene, and the exposure detection result indicates that it is not an overexposed image, run the image processing algorithm of the current shooting mode.
[0391] For example, when the scene detection result indicates that it is not a stage scene, and the exposure detection result indicates that the image is not an overexposed image, the image captured by the camera can be processed by the image processing algorithm corresponding to the current shooting mode to generate a preview image.
[0392] In the embodiments of the present application, scene detection and exposure detection are performed on the image captured by the camera in the electronic device, and whether the shooting scene of the electronic device is a stage scene is determined according to the scene detection result and the exposure detection result. In the case of a stage scene, the image captured by the camera is processed by a stage scene corresponding exposure reduction algorithm to generate a preview image. In the above scheme, automatic detection of the stage scene can be realized based on the scene detection result and the exposure detection result. In addition, because the light source of the stage scene is relatively complex, the image captured by the camera in the stage scene can be processed by the stage scene corresponding exposure reduction algorithm, the overexposed area in the image is reduced, and the detail information in the image is improved. Thus, the image quality of the image captured in the stage scene is improved.
[0393] For example, as shown in FIG. 7, the camera application involves a preview stream and an image stream when taking a photo. The processing process of the preview stream includes: the camera captures multiple raw images; after the raw image is processed by the ISP module, YUV or RGB image 1 is obtained; YUV or RGB image 1 is used for display, that is, the preview image displayed in the preview interface; in addition, the judgment module is used to judge the scene detection result and the exposure detection result of the image processed by the ISP module; wherein the judgment module executes part or all of the steps in S502 to S513 in FIG. 6, please refer to the related description in FIG. 6, which will not be repeated here. In the case that the judgment module determines that the current scene is a stage scene based on the scene detection result and the exposure detection result, the judgment module outputs the identification of the stage scene to the AE algorithm module; after the AE algorithm module receives the identification of the stage scene, the exposure adjustment strategy corresponding to the stage scene is executed; it can be understood that the AE algorithm module issues the exposure parameter corresponding to the stage scene to the camera, and the camera captures the image based on the exposure parameter of the stage scene after receiving the exposure parameter of the stage scene. The implementation of the exposure reduction adjustment strategy of the stage scene executed by the AE algorithm module is described in the related description of S505 in FIG. 6, which will not be repeated here. It should be noted that the AE algorithm module can instruct to adjust the exposure parameter, and the adjusted exposure parameter can be applied to the camera, and the camera can perform exposure using the adjusted exposure parameter and obtain the next raw image.
[0394] It can be understood that the electronic device can poll the processing flow of the preview stream image once for each original image obtained. When the judgment module determines that the scene detection result and the exposure detection result of the image are the stage scene, that is, when the AE algorithm module receives the identification of the stage scene, the exposure amount can be correspondingly reduced; in the preview scene, the electronic device can solve the problem of overexposure in the image collected in the stage scene according to the adjusted exposure parameter.
[0395] As shown in FIG. 7, the processing flow for the photographing stream includes: caching the original image collected by the camera in the cache module; in an implementation manner, the original image cached in the cache module is processed by the ISP module to obtain a processed original image; the processed original image is processed by the post-processing algorithm module to obtain a YUV or RGB image 2; in another implementation manner, the original image cached in the cache module is processed by the ISP module to obtain a YUV or RGB image 2; the YUV or RGB image 2 is saved in the electronic device. When saving, the image with better image quality in multiple images is saved, for example, the third frame of processed image is saved.
[0396] The implementation manner of the scene detection provided by the embodiment of the present application will be described in detail below in combination with FIG. 8.
[0397] FIG. 8 is a schematic flowchart of an example of a scene detection method provided by the embodiment of the present application. The method 600 includes S610 to S690; S610 to S690 will be described in detail respectively.
[0398] The first stage: obtaining text information of the stage scene and processing the text information; including S610 to S613.
[0399] S610. Obtain a sample stage description text.
[0400] The description text refers to text information that describes a scene, object, event or character in detail through words. The sample stage description text is used to represent the text information of the stage scene.
[0401] S611. Text encoder processing.
[0402] For example, the sample stage description text is processed by the text encoder. For example, the process of text encoding processing includes: text preprocessing, vocabulary mapping, word embedding, sentence and document encoding, and sequence padding.
[0403] The text preprocessing is used to remove the text without semantic information in the text. The vocabulary mapping is used to construct the index corresponding to each word in the text. The word embedding is used to capture the semantic and grammatical relationship between words. The sequence padding is used to unify different lengths of sequences to the same length, facilitating network model learning.
[0404] It should be noted that text encoding is the process of converting natural language text into numerical vectors, which is an important step in natural language processing. Through text encoding, text data can be converted into a form that machine learning models can handle. Text encoding usually includes text preprocessing, vocabulary mapping, word embedding, and sequence padding, etc. Through appropriate encoding methods, the semantic information in the text can be captured, thereby improving the performance of the model.
[0405] Optionally, the implementation of S611 can adopt any text encoding processing algorithm in the prior art.
[0406] S612. Obtain text embedding vectors.
[0407] It should be noted that embedding vectors are a special type of feature vectors in the field of natural language processing (NLP); they are mainly used to convert text data into numerical vectors. Embedding vectors not only represent the meaning of words, but also capture the semantic and grammatical relationships between words.
[0408] S613. Obtain text feature vectors.
[0409] It should be noted that embedding vectors (Embedding Vector) and feature vectors (Feature Vector) are both methods of converting non-numerical data (such as text, images, etc.) into numerical representations, but they differ in purpose, application scenarios, and generation methods. Feature vectors are usually extracted from raw data and reflect the key attributes of the data.
[0410] Second stage: obtaining image information and processing image information; including S620 to S623. Optionally, the second stage can be executed simultaneously with the first stage.
[0411] S620. Obtain a preview image.
[0412] Optionally, the implementation of obtaining the collected image refers to the related description of S501 in FIG. 6; and will not be repeated here.
[0413] S621. Image encoder processing.
[0414] For example, the image encoding process includes image preprocessing, feature extraction, transform domain processing, quantization, compression encoding, and post-processing, etc.
[0415] The preprocessing is used for processing the color space, size, grayscale, etc. of the image. The feature extraction is used for extracting feature points in the image. The transform domain processing is used for transforming the image signal from the spatial domain to the frequency domain, and then encoding the transformed coefficients. The quantization is used for realizing the compression of data by reducing the redundancy and fineness of data, and the selection of quantization level and word length directly affects the quality of the final image and the file size. The compression encoding is used for reducing the data transmission rate and the amount of data as much as possible on the premise of maintaining the image quality. The post-processing is used for improving the image quality and readability, and for ensuring the accuracy of image information.
[0416] Optionally, the implementation of S621 can adopt any image encoding processing algorithm in the prior art.
[0417] S622. Obtain an image embedding vector.
[0418] The image embedding vector refers to converting an image into a fixed-length vector representation, which can capture the key features of the image in a multi-dimensional space.
[0419] S623. Obtain an image feature vector.
[0420] The image feature vector is a method of converting image data into a set of numerical feature representations. The image feature vector is usually composed of a series of numerical values, which reflect different attributes or features of the image.
[0421] In the embodiments of the present application, by encoding the sample description text and the image, two kinds of encoding outputs are generated: feature vectors (such as text feature vectors and image feature vectors) and embedding vectors (such as text embedding vectors and image embedding vectors); through the two kinds of encoding outputs, the current scene and the target scene (such as the stage scene) can be matched twice when detecting the scene, thereby improving the accuracy of the scene detection result.
[0422] The third stage: judging the similarity of the text vector and the image vector; including S630 and S640.
[0423] S630. Determine the similarity.
[0424] In one implementation, according to the text feature vector and the image feature vector, the similarity of the sample description text and the image is determined.
[0425] In another implementation, according to the text embedding vector and the image embedding vector, the similarity of the sample description text and the image is determined.
[0426] It should be understood that the similarity calculation between the image feature vector and the pre-defined stage scene text feature vector in the text encoder is exemplified in FIG. 8.
[0427] S640. determining whether the similarity is greater than a preset threshold; if yes, performing S650; if no, performing S670.
[0428] In the embodiments of the present application, the similarity between the text vector and the image vector can preliminarily determine whether the current shooting scene is a stage scene; for example, if the similarity is greater than a preset threshold, it indicates that the current shooting scene is preliminarily determined to be a stage scene; and subsequently, the image and the description text are further matched to further determine whether the current shooting scene is a stage scene. If the similarity is less than or equal to the preset similarity threshold, it indicates that the current shooting scene does not pass the preliminary determination, i.e., the current shooting scene is not a stage scene.
[0429] S650. image and text matching processing.
[0430] In one implementation, the image and text matching processing is performed according to the text embedding vector and the image embedding vector.
[0431] For example, the image embedding vector and the text embedding vector are input into the classification network, the classification network calculates the matching confidence between the image embedding vector and the text embedding vector, and outputs a confidence score; wherein the confidence score is used to represent the matching degree of the image and the text.
[0432] For example, the above-mentioned classification network can be a binary classification network model; the binary classification network model can use any existing classification network model.
[0433] In another implementation, the image and text matching processing is performed according to the text feature vector and the image feature vector.
[0434] It should be understood that the matching processing between the image embedding vector and the text embedding vector is exemplified in FIG. 8.
[0435] S660. determining whether the matching degree meets a preset condition; if yes, performing S680; if no, performing S690.
[0436] For example, it is determined whether the matching confidence of the image and the text is greater than a preset confidence threshold; if the matching confidence is greater than the preset confidence threshold, it indicates that the matching degree meets the preset condition; i.e., the image and the text match, and S680 is performed. If the matching confidence is less than or equal to the preset confidence threshold, it indicates that the matching degree does not meet the preset condition; i.e., the image and the text do not match, and S690 is performed.
[0437] S680. outputting a stage scene.
[0438] Exemplarily, the stage scene is outputted in a case that the similarity between the text feature vector and the image feature vector is greater than a preset similarity threshold, and the matching confidence of the text embedding vector and the image embedding vector is greater than a preset confidence threshold. That is, the scene detection result indicates that the current shooting scene is a stage scene.
[0439] S690. Outputting that the stage scene does not match.
[0440] Exemplarily, the stage scene is outputted in a case that the similarity between the text feature vector and the image feature vector is greater than a preset similarity threshold, and the matching confidence of the text embedding vector and the image embedding vector is greater than a preset confidence threshold. That is, the scene detection result indicates that the current shooting scene is a stage scene.
[0441] In the embodiment of the present application, the description text of the stage scene can be obtained when the image is subjected to scene detection, and the scene detection result is obtained based on the similarity between the image captured by the camera and the description text of the stage scene. In the embodiment of the present application, by introducing the description text of the stage scene, the image is subjected to scene detection based on multi-dimensional data of image information and semantic information, compared with scene detection based on single-dimensional data of image information, which can reduce the recognition error of scene detection to a certain extent, and ensure to improve the accuracy and robustness of scene detection.
[0442] The implementation of the exposure detection provided by the embodiment of the present application will be described in detail below in conjunction with FIG. 9.
[0443] FIG. 9 is a schematic flowchart of an example of the exposure detection method provided by the embodiment of the present application. The method 700 includes S701 to S711; S701 to S711 will be described in detail below.
[0444] S701. Obtain the captured image.
[0445] Exemplarily, the captured image can be a YUV image obtained by image processing a Raw image captured by the camera of the electronic device after the electronic device runs the camera application. For example, the image can be an image frame in the preview stream in the camera application.
[0446] Optionally, the implementation of S701 can refer to the related description of S501 in FIG. 6; which will not be described here.
[0447] S702. Face detection and human body detection.
[0448] Face detection (Face Detection) refers to a technology of recognizing and locating a face in an image or a video. Human body detection (Human Detection) refers to a technology of recognizing and locating a human body in an image or a video.
[0449] For example, the image collected is taken as the input of the face detection model, and the face detection model is used to identify and locate the face in the image, and output the corresponding face detection frame. The face detection model includes a sample and computation redistribution for efficient face detection (SRCFD) model based on sample redistribution and computation redistribution, or other face detection models.
[0450] It should be noted that the face detection in the electronic device 100 by the SRCFD model can ensure the detection efficiency and detection accuracy of the face detection.
[0451] For example, the preview image is taken as the input of the human body key point model, and the human body key point model is used to identify the key points of the human body, and output the human body key points. The human body key point model includes a YOLO human body key point model, or other human body key point models.
[0452] S703. Determine whether a face is detected; if yes, perform S704; if no, perform S705.
[0453] In the embodiments of the present application, the image can be detected by hierarchical detection when the image is exposed. For example, the detection priority of the face region in the image is higher than that of the human body region, and the detection priority of the human body region is higher than that of the center region of the image. Through the above multi-layer hierarchical detection, the exposure region in the image can be more accurately identified, thereby improving the accuracy of exposure detection.
[0454] S704. Determine the face region as the exposure detection region.
[0455] For example, when the face region is detected in the image, the face region is taken as the exposure detection region. That is, the face region is taken as the analysis region of the exposure detection, and whether the image is an overexposed image is determined by the pixel points of the pixels in the face region.
[0456] S705. Determine whether a human body is detected; if yes, perform S706; if no, perform S707.
[0457] For example, in the case where the face is not detected in the image, it is determined whether a human body is detected in the image. If the human body is detected, S706 is performed. If the human body is not detected in the image, S707 is performed.
[0458] S706. Based on key points of the human body, determine the head region; define the head region as the exposure detection area.
[0459] For example, based on the key points on the top of the head (x) in the human body detection results top y top ) and neck key points (x neck y neck ), determine the head region. Among them, the key point on the top of the head (x top y top Point A is shown in Figure 10(a); the key neck point (x) neck y neck Point B is shown in Figure 10(a); the head region is used to indicate the image area between the neck key point and the top of the head key point, as shown in Figure 10(c), region 1. The head region is used as the exposure detection area. That is, the head region is used as the area to be analyzed for exposure detection, and the image is determined to be overexposed by the pixels in the head region.
[0460] For example, based on the key points on the top of the head (x) in the human body detection results top y top ) and neck key points (x neck y neck The process of determining the head region is as follows:
[0461] Where h represents the height of the user's head; (x center ,y center ) represents the coordinates of the center point.
[0462] It should be understood that for a vertical image, the height of the head is its vertical length; that is, the key point at the top of the head (x). top y top ) and neck key points (x neck y neck The length difference along the y-axis is half; for a horizontal image, the height of the head is the horizontal length; this is the key point at the top of the head (x). top y top ) and neck key points (x neck y neck The length difference along the x-axis is half of the length difference.
[0463] For example, (x center ,y center () represents the center point between the key point on the top of the head and the key point on the neck, as shown by point C in Figure 10(a). After determining point C, the coordinates of points D and E as shown by point h in Figure 10(b) are determined based on the center point C and h.
[0464] For example, taking the top left corner of the image as the origin, the coordinates of the point D are (x center -w half ,y center -h half ); the coordinates of the point E are (x center +w half ,y center +h half ); wherein, w=0.8×h; h half represents half of the height of the head; w half represents half of the width of the head; and w represents the width of the head. After obtaining the coordinates of the points D and E, taking the point C as the center point, the point D as the top left point of the head frame, and the point E as the bottom right point of the head frame, the area of the head frame is determined, as shown in the area 1 in (c) of FIG. 10.
[0465] S707. Obtain a scene detection result of the image.
[0466] For example, no face and no human body are detected in the collected image, and thus a scene detection result of the collected image is obtained, and the exposure detection area is determined according to the scene detection result.
[0467] Optionally, the implementation of the scene detection result can refer to the related description of S502 in FIG. 6, or the related description of FIG. 8, which will not be described herein again.
[0468] S708. Determine whether the scene detection result indicates a stage scene; if yes, perform S709; if no, perform S701.
[0469] For example, when the scene detection result indicates a stage scene, the central area of the stage scene is determined as the exposure detection area; when the scene detection result does not indicate a stage scene, the collected image is repeatedly obtained in S701.
[0470] It should be understood that, when performing exposure detection, the image is preferentially subjected to face detection and human body detection; if the image contains a face area or a human body area, the exposure detection area is determined according to the face area or the human body area. If the image does not contain a face area and a human body area, it is further determined whether the shooting scene of the image is a stage scene, since the stage scene usually includes multiple high-intensity light sources. Therefore, when the image does not contain a face area and a human body area, and the collected image is in a stage scene, the central area of the stage scene is further subjected to exposure detection.
[0471] S709. Determine the central area of the stage scene as the exposure detection area.
[0472] Exemplarily, a preset region where the center point of the stage scene is located is taken as the center region of the stage scene, and the center region of the stage scene is taken as the exposure detection region. That is, the center region of the stage scene is taken as the region to be analyzed for exposure detection, and whether the image is an overexposed image is determined through the pixel points of the pixels in the center region of the stage scene.
[0473] It should be noted that when no person is detected in the image, the center region of the acquired image can be determined as the exposure detection region, and the overexposure proportion of the stage center region is calculated. If overexposure exists in the center region, it is considered that the current is a stage scene at this time, and the exposure adjustment strategy of the stage scene is started.
[0474] In the above scheme, the face and the human body in the image are detected in multiple levels, the face region is determined as the exposure detection region when the face region exists, that is, when the image is a large main body (that is, the face region accounts for a large proportion in the image), it is focused on whether the face region is overexposed; when the image is a small main body (that is, the face region accounts for a small proportion in the image or no face region is detected), it is focused on whether the whole human body is overexposed, and the overexposure of the center of the stage scene is detected when there is no image. This multi-level detection method can more accurately identify the exposure region in the image, thereby improving the accuracy of exposure detection.
[0475] S710. Determine the exposure proportion of the exposure detection region.
[0476] Exemplarily, it is assumed that the exposure detection region is R, the pixel in the exposure detection region is p(x, y), and the preset exposure threshold is E overexposed ; the indicator function I(p) is defined as follows:
[0477] Wherein, L(p) represents the brightness value of the pixel p(x, y).
[0478] Wherein, N overexposed represents the number of overexposed pixels in the exposure detection region R; P overexposed represents the proportion of overexposed pixels in the exposure detection region R in the entire exposure detection region; N total represents the total number of pixel points in the exposure detection region R.
[0479] For example, it is assumed that the overexposure determination threshold is T, and P overexposed >T, which indicates that the exposure detection region R exists overexposure, that is, the exposure detection region R is an overexposed region. P overexposed ≤T, which indicates that the exposure detection region R does not exist overexposure, that is, the exposure detection region R is not an overexposed region.
[0480] S711. Output the exposure detection result.
[0481] For example, if the proportion of the number of overexposed pixels in the exposure detection region to the total number of pixels in the exposure detection region is greater than a preset proportion threshold, the exposure detection result indicates that there is an overexposed region in the image, that is, the detection result indicates that the image is an overexposed image.
[0482] For example, if the proportion of the number of overexposed pixels in the exposure detection region to the total number of pixels in the exposure detection region is less than or equal to a preset proportion threshold, the exposure detection result indicates that there is no overexposed region in the image, that is, the detection result indicates that the collected image is not an overexposed image.
[0483] In the embodiments of the present application, the image can be detected by hierarchical detection when the image is subjected to exposure detection. For example, the detection priority of the face region in the image is higher than the detection priority of the human body region, and the detection priority of the human body region is higher than the detection priority of the center region of the image. That is, if a face region is detected in the image, the face region is determined as the exposure detection region. If a face region is not detected in the image and a human body region is detected, the head region of the human body is determined as the exposure detection region. If neither a face region nor a human body region is detected in the image, and the scene detection result indicates a stage scene, the center region of the stage scene is determined as the exposure detection region. Through the above hierarchical multi-layer detection, the exposure region in the image can be more accurately identified, thereby improving the accuracy of exposure detection.
[0484] FIG. 11 is a schematic diagram of the system structure of an example electronic device 100 according to an embodiment of the present application.
[0485] The layered architecture divides the system into several layers, each of which has a clear role and division of labor. The layers communicate with each other through software interfaces. In some embodiments, the system is divided into five layers, from top to bottom, the application program layer, the application program framework layer, the hardware abstraction layer, the driver layer, and the hardware layer.
[0486] The application program layer can include a series of application program packages. In the embodiments of the present application, the application program package can include a camera application program.
[0487] The application program framework layer provides the application program of the application program layer with application programming interfaces (APIs) and programming frameworks. The application program framework layer includes some pre-defined functions. In the embodiments of the present application, the application program framework layer can include a camera access interface and a window manager; wherein the camera access interface can include camera management and camera devices. The camera access interface is used to provide the camera application with application programming interfaces and programming frameworks.
[0488] The hardware abstraction layer is an interface layer between the application framework layer and the driver layer, and provides a virtual hardware platform for the operating system. In the embodiment of the present application, the hardware abstraction layer includes a camera algorithm library; the camera algorithm library includes a target scene recognition algorithm (for example, a stage scene recognition algorithm) and an AE algorithm; the target scene recognition algorithm is used to identify whether the current shooting scene of the electronic device is a target scene; the AE algorithm is used to execute the AE algorithm corresponding to the target scene; in the case that the current shooting scene is a target scene, the camera application in the electronic device is triggered to execute the AE algorithm corresponding to the target scene. In the target scene recognition algorithm, a scene detection algorithm, an exposure detection algorithm, and an algorithm for determining whether the shooting scene is a target scene based on the scene detection result and the exposure detection result are included. For example, the scene detection algorithm is as shown in FIG. 8; the exposure detection algorithm is as shown in FIG. 9; the algorithm for determining whether the shooting scene is a target scene based on the scene detection result and the exposure detection result is as shown in FIG. 6 and FIG. 5; and details are not described herein.
[0489] Optionally, in the embodiment of the present application, the target scene recognition algorithm can accurately identify whether the current shooting scene is a target scene; and the accuracy and robustness of scene recognition are improved. The AE algorithm can effectively reduce the exposure of the collected image in the case of identifying a target scene, and improve the image quality.
[0490] The driver layer is a layer between hardware and software. The driver layer includes drivers of various hardware. The driver layer can include a camera device driver and an image signal processor driver. The camera device driver is used to drive the camera device to collect images. The image signal processor driver is used to drive the image signal processor to process images.
[0491] The hardware layer includes various hardware devices in the electronic device; for example, the hardware layer includes a camera device and an image signal processor; the camera device includes an AE control module; the AE control module is used to perform exposure reduction processing on the collected image.
[0492] In an implementation manner, the AE control module acts on the camera in the camera device according to the received related parameters of the AE algorithm in the HAL layer, the camera can perform exposure with the adjusted exposure parameter, and the next frame of original image is obtained; the AE control module can be a software module or a hardware component in the camera device, and the present application does not make any limitation thereto.
[0493] The image processing method in the embodiment of the present application is specifically described as follows in combination with the above hardware structure and system structure:
[0494] Step one: the electronic device 100 opens the camera, and displays a first preview interface of a first shooting mode.
[0495] In response to a user operation (e.g., a click operation) on the camera application icon, the camera application calls a camera access interface of the application framework layer, starts the camera application, and then sends a start camera application instruction to a camera device 1 (e.g., a default, general, and main camera lens) in the camera hardware abstraction layer by calling the camera device 1. The camera hardware abstraction layer sends the instruction to a camera device driver of the driver layer, which can start a sensor (e.g., a sensor 1) corresponding to the camera device 1 to collect an image light signal through the sensor 1. The image light signal is transmitted to an image signal processor for preprocessing to obtain an image, and then the image is transmitted to the camera hardware abstraction layer through the camera device driver. The continuously generated images constitute an image stream; a first preview interface of the camera is displayed, and the image collected by the image sensor is displayed in the interface.
[0496] Step two: The electronic device 100 performs scene detection and exposure detection on the collected image to obtain a scene detection result and an exposure detection result.
[0497] For example, on the one hand, the camera hardware abstraction layer can directly transmit the image back to the camera application for display. On the other hand, the camera hardware abstraction layer can transmit the image to the camera algorithm library. The scene detection and exposure detection are performed on the image by a scene detection algorithm and an exposure detection algorithm in the target scene recognition algorithm in the camera algorithm library.
[0498] Step three: The electronic device 100 determines whether the shooting scene is the target scene based on the scene detection result and the exposure detection result.
[0499] For example, the scene detection result obtained by the scene detection and the exposure detection result obtained by the exposure detection are used to determine whether the shooting scene of the image is the target scene.
[0500] Step four: When it is identified that the shooting scene of the image is the target scene, the electronic device 100 displays a second preview interface.
[0501] For example, when the shooting scene of the image is the target scene, the AE algorithm is triggered to perform a target scene corresponding AE algorithm to perform a low exposure processing on the image, that is, when it is identified that the scene of the image is the target scene, the exposure strategy of the image is adjusted, the target scene corresponding AE algorithm is executed, and an image processed by the target scene corresponding AE algorithm is obtained. The processed image is uploaded to the camera application for display, that is, a second preview interface is displayed in the camera application.
[0502] Optionally, the connection relationship of each layer shown in FIG. 11 is only illustrative and does not constitute a limitation on the connection relationship of each software architecture layer of the electronic device 100.
[0503] FIG. 12 is a schematic diagram of a hardware structure of an electronic device 100 according to an embodiment of the present application.
[0504] The electronic device 100 can include a processor 110, an external memory interface 120, an internal memory 121, an audio module 170, a speaker 170A, a microphone 170C, a sensor module 180, a camera 193, a display screen 194. The sensor module 180 includes a pressure sensor 180A, a gyroscope sensor 180B, an acceleration sensor 180E, a proximity light sensor 180G, a touch sensor 180K, an ambient light sensor 180L, and the like.
[0505] It can be understood that the structure illustrated in the embodiments of the present application does not constitute a specific limitation on the electronic device 100. In other embodiments of the present application, the electronic device 100 can include more or fewer components than illustrated, or combine certain components, or split certain components, or different component arrangements. The illustrated components can be implemented in hardware, software, or a combination of software and hardware.
[0506] The processor 110 can include one or more processing units, for example: the processor 110 can include an application processor (AP), a modem processor, a graphics processing unit (GPU), an image signal processor (ISP), a controller, a video codec, a digital signal processor (DSP), a baseband processor, and / or a neural-network processing unit (NPU), etc. Different processing units can be independent devices or can be integrated into one or more processors.
[0507] For example, the processor 110 can execute the image processing method provided by the embodiments of the present application described above. For example, the processor 110 is configured to: run a camera application and acquire a first image; the first image is an image obtained by performing first processing on a first original image; the first original image is an image captured by the camera at a first time; perform scene detection on the first image to obtain a scene detection result; perform exposure detection on the first image to obtain an exposure detection result; display a first interface; the first interface includes a second image; the second image is an image obtained by performing second processing on a second original image; the second original image is an image captured by the camera at a second time; the second processing includes target exposure reduction processing determined based on the scene detection result and the exposure detection result.
[0508] The controller can generate operation control signals according to the instruction operation code and the timing signal, complete the control of fetching and executing instructions.
[0509] The processor 110 can 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 can hold instructions or data that the processor 110 has just used or recycled. If the processor 110 needs to use the instructions or data again, it can be directly called from the memory. This avoids repeated access and reduces the waiting time of the processor 110, thereby improving the efficiency of the system.
[0510] In some embodiments, the processor 110 can include one or more interfaces. The interface can include an Inter-integrated circuit (I2C) interface, an Inter-integrated circuit Sound (I2S) interface, a Plse 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.
[0511] It can be understood that the interface connection relationship between the modules shown in the embodiments of the present application is only illustrative and does not constitute a structural limitation of the electronic device 100. In other embodiments of the present application, the electronic device 100 can also use different interface connection methods or combinations of multiple interface connection methods in the above embodiments.
[0512] The electronic device 100 realizes the display function through the GPU, the display screen 194, and the application processor, etc. The GPU is a microprocessor for image processing, connected to the display screen 194 and the application processor. The GPU is used to perform mathematical and geometric calculations for graphics rendering. The processor 110 can include one or more GPUs that execute program instructions to generate or change display information.
[0513] The display screen 194 is configured to display images, videos, and the like. The display screen 194 includes a display panel. The display panel can be a liquid crystal display (LCD). The display panel can also be manufactured by using an organic light-emitting diode (OLED), an active-matrix organic light-emitting diode (AMOLED), a flexible light-emitting diode (FLED), a miniled, a microled, a micro-oled, a quantum dot light emitting diode (QLED), and the like. In some embodiments, the electronic device can include one or N display screens 194, where N is a positive integer greater than 1.
[0514] In the embodiments of the present application, the display screen 194 displays the image captured by the camera and the preview image processed by using the target shooting mode. For example, the user interface shown in FIGS. 1 to 4 is displayed by relying on the GPU, the display screen 194, and the display function provided by the application processor. In addition, the display screen 194 also receives the user operation of the user, such as the selection instruction of the user on the display screen 194.
[0515] The electronic device 100 can implement the shooting function by using the ISP, the camera 193, the video codec, the GPU, the display screen 194, and the application processor.
[0516] For example, the ISP can be an image signal processor in the hardware layer as shown in FIG. 11.
[0517] The ISP is configured to process the data fed back by the camera 193. For example, when taking a photo, the shutter is opened, the light is transmitted to the camera photosensitive element through the lens, the light signal is converted into an electric signal, and the camera photosensitive element transmits the electric signal to the ISP for processing, and converts it into an image visible to the naked eye. The ISP can also optimize the algorithm of 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 arranged in the camera 193.
[0518] The camera 193 is configured to capture still images or videos. An object projects an optical image through a lens to 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 optical signal into an electrical signal, which is then transmitted to an ISP for conversion into a digital image signal. The ISP outputs the digital image signal to a DSP for processing. The DSP converts the digital image signal into an image signal in a standard format, such as RGB, YUV, or the like. In some embodiments, the electronic device 100 can include one or N cameras 193, where N is a positive integer greater than 1.
[0519] The NPU is a neural-network (NN) computing processor that is configured to quickly process input information by referring to a biological neural network structure, for example, by referring to a transmission mode between neurons in a human brain, and is further configured to continuously self-learn. Through the NPU, the electronic device 100 can implement intelligent cognitive applications, such as image recognition, face recognition, voice recognition, text understanding, and the like.
[0520] In the embodiments of the present application, the electronic device 100 implements the image processing method provided in the embodiments of the present application. First, the electronic device 100 relies on the ISP to process the image captured by the camera 193, and second, the electronic device 100 relies on the video codec and the GPU to provide image calculation and processing capabilities. The electronic device 100 can implement neural network algorithms, such as face recognition, human body recognition, and re-identification (ReID), by using the computing and processing capabilities provided by the NPU.
[0521] The internal memory 121 can include one or more random access memories (RAMs) and one or more non-volatile memories (NVMs).
[0522] In the embodiments of the present application, the code implementing the image processing method shown in the embodiments of the present application can be stored on the non-volatile memory. When the camera application is running, the electronic device 100 can load the executable code stored in the non-volatile memory to the random access memory.
[0523] The external memory interface 120 can be configured to connect to an external non-volatile memory, thereby expanding the storage capacity of the electronic device 100. The external non-volatile memory communicates with the processor 110 through the external memory interface 120, thereby realizing a data storage function.
[0524] The electronic device 100 can implement audio functions through the audio module 170, the speaker 170A, the microphone 170C, and the application processor, etc. For example, music playing, recording, etc.
[0525] The audio module 170 is configured to convert digital audio information into an analog audio signal output, and to convert an analog audio input into a digital audio signal. The speaker 170A, also referred to as a "loudspeaker", is configured 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.
[0526] In the embodiments of the present application, the electronic device 100 can enable the microphone 170C to collect sound signals at the same time when enabling the camera to collect images, and convert the sound signals into electrical signals and store them. In this way, the user can obtain a video with sound.
[0527] The pressure sensor 180A is configured to sense a pressure signal and convert the pressure signal into an electrical signal. In some embodiments, the pressure sensor 180A can be disposed on the display screen 194.
[0528] The gyroscope sensor 180B can be configured 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 through the gyroscope sensor 180B. The gyroscope sensor 180B can be used for anti-shake shooting. For example, when the shutter is pressed, the gyroscope sensor 180B detects the angle of shaking of the electronic device 100, calculates the distance that the lens module needs to compensate according to the angle, and lets the lens offset the shaking of the electronic device 100 through reverse motion to achieve anti-shake.
[0529] The acceleration sensor 180E can detect the acceleration of the electronic device 100 in various directions (generally three axes). When the electronic device 100 is stationary, the acceleration sensor 180E can detect the magnitude and direction of gravity. The proximity light sensor 180G can include, for example, a light-emitting diode (LED) and a light detector, such as a photodiode. The light-emitting diode can be an infrared light-emitting diode. The electronic device 100 emits infrared light outwardly through the light-emitting diode. The electronic device 100 detects infrared reflected light from nearby objects using the photodiode. When sufficient reflected light is detected, it can be determined that there is an object near the electronic device 100. When insufficient reflected light is detected, the electronic device 100 can determine that there is no object near the electronic device 100. The ambient light sensor 180L is configured to sense ambient light brightness. The electronic device 100 can adaptively adjust the brightness of the display screen 194 according to the sensed ambient light brightness. The ambient light sensor 180L can also be used to automatically adjust the white balance when taking a photo.
[0530] In an implementation manner, in the embodiments of the present application, the gyro sensor 180B and the acceleration sensor 180E can be used to detect whether the electronic device 100 moves; and detect the moving amount of the electronic device 100.
[0531] The touch sensor 180K, also referred to as a "touch device". The touch sensor 180K can be disposed on the display screen 194, and the touch sensor 180K and the display screen 194 form a touch screen, also referred to as a "touch screen". The touch sensor 180K is used to detect a touch operation acting on or near it. The touch sensor can pass the detected touch operation to the application processor to determine the touch event type. The 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 disposed on the surface of the electronic device 100, which is different from the position where the display screen 194 is located.
[0532] In the embodiments of the present application, the electronic device 100 can detect the click operation of the user acting on the display screen 194 and other operations by using the touch sensor 180K, so as to realize the image processing method shown in FIGS. 1 to 10.
[0533] Exemplarily, the connection relationship between the various hardware shown in FIG. 12 is only illustrative and does not constitute a limitation on the connection relationship between the various hardware of the electronic device 100. Alternatively, the various hardware of the electronic device 100 can also use other connection manners other than the above-described embodiments.
[0534] It should be noted that, in the description of the embodiments of the present application, unless otherwise specified, " / " represents the meaning of or, for example, A / B can represent A or B; "and / or" in this paper only describes the association relationship of the associated objects, which means that there can be three kinds of relationships, for example, A and / or B, which can represent: A exists alone, A and B exist together, and B exists alone. In addition, in the description of the embodiments of the present application, "multiple" means two or more than two.
[0535] It should be understood that the ways, cases, categories and division of embodiments in the embodiments of the present application are only for the convenience of description, and should not constitute a special limitation. The features in various ways, categories, cases and embodiments can be combined with each other without contradiction.
[0536] It should also be understood that, in the description of the embodiments, unless otherwise specified, the meaning of "multiple" is two or more than two. In various embodiments of the present application, the size of the serial number of each process does not mean the order of execution, and the execution order of each process should be determined according to its function and inherent logic, and should not constitute any limitation on the implementation process of the embodiments of the present application.
[0537] It should be noted that in the embodiments of the present application, "preset", "fixed value" and the like can be implemented by pre-storing corresponding codes, tables or other means for indicating related information in the electronic device, and the specific implementation manner is not limited in the present application.
[0538] It can be understood that, in order to implement the above functions, the electronic device comprises hardware and / or software modules corresponding to the functions. The algorithm steps of each example described in combination with the embodiments disclosed herein can be implemented in the form of hardware or a combination of hardware and computer software. Whether a certain function is implemented in hardware or computer software driven hardware depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application in combination with the embodiments, but such implementation should not be considered beyond the scope of the present application.
[0539] The embodiments can divide the functional modules of the electronic device according to the above method examples. For example, each functional module can be divided according to each function, or two or more functions can be integrated into one processing module. The integrated module can be implemented in the form of hardware. It should be noted that the division of modules in the embodiments is illustrative, and is only a logical functional division. In actual implementation, there can be another division manner.
[0540] In the case of dividing each functional module according to each function, a possible composition schematic diagram of the electronic device involved in the above embodiments can include a display unit, a detection unit, a processing unit and the like. The display unit, the detection unit and the processing unit can cooperate with each other to support the electronic device to perform the above steps and the like, and / or other processes of the technology described herein.
[0541] It should be noted that all related contents of each step involved in the above method embodiments can be cited to the functional description of the corresponding functional module, which will not be repeated here.
[0542] The electronic device provided by the embodiments can be used to execute the above image processing method, and therefore can achieve the same effect as the above implementation method.
[0543] In the case of using integrated units, the electronic device can include a processing module, a storage module and a communication module. The processing module can be used to control and manage the actions of the electronic device, for example, it can be used to support the electronic device to perform the steps performed by the display unit, the detection unit and the processing unit. The storage module can be used to support the electronic device to execute the storage of program codes and data and the like. The communication module can be used to support the communication between the electronic device and other devices.
[0544] The processing module can be a processor or a controller. It can implement or execute various exemplary logical blocks, modules, and circuits described in combination with the disclosure of the present application. The processor can also be a combination of computing functions, such as a combination of one or more microprocessors, a combination of a digital signal processing (DSP) and a microprocessor, and the like. The storage module can be a memory. The communication module can be a device for interacting with other electronic devices, such as a radio frequency circuit, a Bluetooth chip, a Wi-Fi chip, and the like.
[0545] In one embodiment, when the processing module is a processor and the storage module is a memory, the electronic device involved in the embodiment can be an electronic device with the structure shown in FIG. 12.
[0546] The embodiment also provides a computer readable storage medium, which stores computer instructions. When the computer instructions are run on an electronic device, the electronic device executes the related method steps to implement the image processing method in the above embodiment.
[0547] The embodiment also provides a computer program product, which, when run on a computer, causes the computer to execute the related steps to implement the image processing method in the above embodiment.
[0548] In addition, the embodiment of the present application also provides an apparatus, which can be a chip, a component or a module. The apparatus can include a processor and a memory connected to each other. The memory is used to store computer execution instructions. When the apparatus is running, the processor can execute the computer execution instructions stored in the memory to enable the chip to execute the image processing method in the above method embodiments.
[0549] The electronic device, the computer readable storage medium, the computer program product or the chip provided by the embodiment are used to execute the corresponding method provided above, and thus the beneficial effects achieved thereby can refer to the beneficial effects of the corresponding method provided above, which will not be described herein again.
[0550] Through the description of the above embodiments, those skilled in the art can understand that, for the convenience and brevity of description, only the division of the above functional modules is taken as an example for illustration. In actual application, the above functions can be completed by different functional modules according to needs, that is, the internal structure of the apparatus is divided into different functional modules to complete all or part of the functions described above.
[0551] In several embodiments provided in the present application, it should be understood that the disclosed apparatus and method can be implemented in other manners. For example, the division of the apparatus embodiments is merely an example, and for example, the division of the modules or units can be different, and for example, multiple modules or units can be combined or integrated into another apparatus, or some features can be ignored or not executed. In addition, the displayed or discussed mutual couplings or direct couplings or communication connections can be indirect couplings or communication connections through some interfaces, apparatuses or units, and can be in electrical, mechanical or other forms.
[0552] The units described as separate components may or may not be physically separate, and the components shown as units may be one physical unit or multiple physical units, i.e., may be located in one place, or may be distributed in multiple different places. Some or all of the units can be selected according to actual needs to achieve the purpose of the embodiments.
[0553] In addition, each functional unit in the various embodiments of the present application can be integrated into one processing unit, or each unit can be physically present separately, or two or more units can be integrated into one unit. The integrated unit can be realized in the form of hardware or in the form of a software functional unit.
[0554] If the integrated unit is realized in the form of a software functional unit and sold or used as an independent product, it can be stored in a readable storage medium. Based on this understanding, the technical solutions of the embodiments of the present application essentially or the parts that make contributions to the prior art or the whole or part of the technical solutions can be embodied in the form of a software product, which is stored in a storage medium, includes several instructions to make an apparatus (which can be a single chip, a chip, etc.) or a processor execute all or part of the steps of the methods of the various embodiments of the present application. The aforementioned storage medium includes: a U disk, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk, and various media that can store program codes.
[0555] The above is merely specific embodiments of the present application, but the specific embodiments of the present application are not limited to this. The protection scope of the present application should be subject to the protection scope of the claims, and any person skilled in the art can easily think of changes or replacements within the technical scope disclosed by the claims of the present application, which should be covered within the protection scope of the present application.
Claims
1. An image processing method, characterized by, include: Run the camera application to acquire a first image; wherein the first image is an image obtained by performing a first processing on a first original image; the first original image is an image captured by the camera at a first moment. Scene detection is performed on the first image to obtain scene detection results; Exposure detection is performed on the first image to obtain the exposure detection result; The first interface is displayed; wherein the first interface includes a second image; the second image is an image obtained by performing a second processing on a second original image; the second original image is an image captured by the camera at a second moment; the second processing includes target de-exposure processing determined based on the scene detection result and the exposure detection result.
2. The image processing method of claim 1, wherein, After running the camera application, the following are also included: The first image is processed to obtain a third image; wherein the image processing includes color space conversion processing; The second interface is displayed; wherein the third image is displayed in the second interface; the second interface and the first interface are the shooting interfaces of the camera application in the first shooting mode.
3. The image processing method of claim 1, wherein, Also includes: Based on the scene detection results and the exposure detection results, a first control is displayed on the first interface; wherein the first control is used to indicate the target scene.
4. The image processing method of claim 3, wherein, The step of displaying a first control on the first interface based on the scene detection result and the exposure detection result includes: Based on the scene detection results and the exposure detection results, determine whether the shooting scene is the target scene; When the shooting scene is the target scene, the first control is displayed on the first interface.
5. The image processing method of any one of claims 1 to 4, characterized in that, The first interface includes a second control, which is used to instruct the target to reduce exposure.
6. The image processing method of claim 4, wherein, Determining whether the shooting scene is the target scene based on the scene detection result and the exposure detection result includes: If the scene detection result indicates that the shooting scene is the target scene, and the exposure detection result indicates that the first image is an overexposed image, then the shooting scene is determined to be the target scene.
7. The image processing method of any one of claims 1 to 6, characterized in that, The exposure detection of the first image to obtain the exposure detection result includes: Perform face detection and human body detection on the first image to obtain the detection results; Based on the detection results, the target detection region in the first image is determined; The exposure detection result is obtained based on the pixels in the target detection area.
8. The image processing method of claim 7, wherein, The step of determining the target detection region in the first image based on the detection results includes: If the detection result indicates that a face region exists in the first image, the face region is determined as the target detection region; If the detection result indicates that there is no face region but there is a human body region in the first image, the first image region in the first image is determined as the target detection region; The first image region is used to represent the image region where the key points from the neck to the top of the head are located in the human body region.
9. The image processing method of claim 8, wherein, When the human body region is present in the first image, the method further includes: determine a target height, a target width, and a target center point coordinate based on the coordinate of the neck key point and the coordinate of the head top key point; determine a first vertex coordinate based on the target center point coordinate and a difference between the target height and the target width; determine a second vertex coordinate based on the target center point coordinate and a sum of the target height and the target width; obtain the first image region based on the first vertex coordinate and the second vertex coordinate.
10. The image processing method of claim 9, wherein, The determination of the target height, the target width, and the target center point coordinate based on the coordinate of the neck key point and the coordinate of the head top key point comprises: determine a first coordinate difference and a second coordinate difference between the neck key point and the head top key point; the first coordinate difference is a horizontal coordinate difference between the neck key point and the head top key point; the second coordinate difference is a vertical coordinate difference between the neck key point and the head top key point; if the first coordinate difference is greater than the second coordinate difference, determine half of the first coordinate difference as the target height and half of the second coordinate difference as the target width; if the second coordinate difference is greater than the first coordinate difference, determine half of the second coordinate difference as the target height and half of the first coordinate difference as the target width; determine the coordinate of the midpoint between the neck key point and the head top key point as the target center point coordinate.
11. The image processing method of claim 8, wherein, Further comprising: obtain the scene detection result; if the detection result indicates that the first image does not contain the face region and does not contain the human body region, determine whether the scene detection result indicates a target scene; if the scene detection result indicates the target scene, determine a second image region in the first image as the target detection region; wherein the second image region is a central region of the first image.
12. The image processing method of any one of claims 7-11, wherein, The obtaining of the exposure detection result based on the pixel points in the target detection region comprises: determine a target pixel point number whose brightness value is greater than a first preset brightness threshold in the target detection region; determine a target proportion based on the target pixel point number and a total pixel point number of the target detection region; obtain the exposure detection result based on the target proportion and a preset proportion threshold.
13. The image processing method of any of claims 1-6, wherein, The exposure detection of the first image to obtain an exposure detection result comprises: obtain target metadata of a target sensor; wherein the target metadata is used to represent metadata of the target sensor when the first original image is collected; obtain the exposure detection result based on the target metadata.
14. The image processing method of claim 13, wherein, The obtaining of the exposure detection result based on the target metadata comprises: determine a scene brightness of a shooting scene based on the target metadata; if the scene brightness is greater than a second preset brightness threshold, obtain the exposure detection result based on the brightness value of the pixel points in the first image.
15. The image processing method of claim 1, wherein, The scene detection of the first image to obtain a scene detection result comprises: obtain a sample description text of a target scene; obtain the scene detection result based on the similarity between the sample description text and the first image.
16. The image processing method of claim 15, wherein, The scene detection result is obtained based on the similarity between the sample description text and the first image, and the scene detection result comprises: The sample description text is encoded to obtain a first text vector and a second text vector; The first image is encoded to obtain a first image vector and a second image vector; A target similarity between the first text vector and the first image vector is determined; If the target similarity is greater than a preset similarity threshold, a confidence degree that the second text vector matches the second image vector is determined; The scene detection result is obtained based on the confidence degree and a preset confidence threshold.
17. The image processing method of claim 16, wherein, The vector types of the first text vector and the text vector are different, and the types of the first image vector and the second image vector are different; The vector type of the first text vector is the same as the vector type of the first image vector, and the vector type of the second text vector is the same as the vector type of the second image vector.
18. The image processing method of claim 1, wherein, Further comprising: If the scene detection result indicates a first scene, or the exposure detection result indicates that the first image is not an overexposed image, it is determined that the target exposure reduction processing is not run; wherein the first scene is different from a target scene.
19. The image processing method of claim 3, wherein, Further comprising: If the scene detection result indicates the target scene, and the exposure detection result indicates that the first image is not an overexposed image, a second shooting mode is determined; wherein the second shooting mode is a shooting mode corresponding to the target scene; A third interface is displayed; wherein a third control is displayed in the third interface, and the third control is used to indicate that the second shooting mode is run; In response to a first operation on the third control, a fourth interface is displayed; wherein the fourth interface is a shooting interface of the second shooting mode.
20. The image processing method of claim 19, wherein, Further comprising: In the fourth interface, prompt information of the second shooting mode is displayed.
21. The image processing method of claim 19 or 20, characterized by, Further comprising: If the first operation is not detected, the third interface is displayed.
22. The image processing method of any of claims 1-21, wherein, The first interface is a photograph preview interface, or the first interface is a video recording preview interface.
23. The image processing method of claim 3, wherein, Further comprising: In a case where the shooting scene is the target scene, a light metering brightness of the first image is determined; wherein the light metering brightness is used to represent an overall light metering brightness of the first image; Based on the light metering brightness, an exposure parameter is determined as a first exposure parameter; Based on the first exposure parameter, a fourth image is obtained; In a case where at least one face is recognized in the fourth image, an area of a target face and a weighted face brightness in the at least one face are determined; In a case where the area of the target face is less than or equal to a preset threshold, and at least one human body is recognized in the fourth image, a weighted human body brightness is determined; Based on the weighted face brightness and the weighted human body brightness, a target light metering brightness is determined; Based on the target light metering brightness, the exposure parameter is adjusted to obtain a parameter of the target exposure reduction processing.
24. The image processing method of claim 3, wherein, The target scene comprises: a stage scene, a performance scene, a concert scene, a high-contrast scene, or a backlight scene.
25. The image processing method of claim 19, wherein, The second shooting mode comprises: a stage shooting mode, a performance shooting mode, a concert shooting mode, a high-contrast shooting mode, or a backlight shooting mode.
26. An electronic device, comprising: one or more display screens configured to display images; one or more processors; one or more memories; the display screens, the memories, and the processors are coupled, the memories are configured to store computer program codes, the computer program codes comprise computer instructions, and the processors are configured to invoke the computer instructions to cause the electronic device to perform the image processing method according to any one of claims 1-25.
27. A chip system, characterized by The chip system is applied to an electronic device, and the chip system comprises one or more processors configured to invoke computer instructions to cause the electronic device to perform the image processing method according to any one of claims 1-25.
28. A computer-readable storage medium, characterized in that, The computer readable storage medium stores a computer program, and when the computer program is executed by an electronic device, the electronic device is caused to perform the image processing method according to any one of claims 1-25.
Citation Information
Patent Citations
Exposure testing method, control terminal, terminal to be tested, and exposure testing system
CN106657994A
Image processing method and electronic equipment
CN111405205A
Image shooting method, image shooting device, mobile terminal and storage medium
CN111654594A
Shooting method and device for delayed photography
CN112532857A
Image processing method and electronic equipment
CN116709003A