Camera parameter configuration method and electronic device

By using configuration files to carry the filtering conditions for shooting scenes on electronic devices, parsing and loading the configuration files to determine the appropriate output mode, the problem of electronic devices selecting the wrong output mode under multiple shooting functions is solved, and accurate matching of shooting effects is achieved.

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

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
HONOR DEVICE CO LTD
Filing Date
2024-11-28
Publication Date
2026-05-29

AI Technical Summary

Technical Problem

When electronic devices enable multiple shooting functions, it is easy to select the wrong output mode, resulting in shooting results that do not meet expectations.

Method used

The configuration file contains the filtering conditions corresponding to the shooting scene. The configuration file is parsed and loaded to determine the appropriate output mode. The output mode is selected using the filtering conditions to ensure that it matches the needs of different shooting scenes.

Benefits of technology

It enables precise matching and adaptation of output modes to various shooting scenarios after the electronic device is powered on, improving the accuracy and flexibility of shooting effects and adapting to changes in shooting scenarios.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122120593A_ABST
    Figure CN122120593A_ABST
Patent Text Reader

Abstract

The application provides a camera parameter configuration method and an electronic device, relates to the terminal technical field, and improves the accuracy of enabling an out-picture mode. The specific scheme is that a first configuration file is stored in the electronic device, the first configuration file includes a corresponding relationship between first scene information and a first screening condition, and the first screening condition is a condition for screening the out-picture mode. When the electronic device is started, the first configuration file is parsed and loaded. In response to an operation of indicating opening of a first application, a first interface is displayed, the first interface is a shooting preview interface of a first camera mode. When the first scene information matches a shooting scene of enabling the first camera mode, the first screening condition is acquired. Configuration parameters corresponding to a first out-picture mode matched with the first screening condition are sent to a camera sensor, so that the camera sensor collects a first image frame in the first out-picture mode. In the first interface, the first image frame is displayed.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of terminal technology, and in particular to a camera parameter configuration method and an electronic device. Background Technology

[0002] Photography functionality has become a basic feature of most electronic devices (such as mobile phones). As photography becomes more widespread in electronic devices, users' demands for image quality are also increasing. Correspondingly, electronic devices are offering a wider range of photography functions. When an electronic device activates its photography function, it needs to control the camera sensor to acquire images according to the output mode adapted to that function in order to achieve the desired shooting effect.

[0003] However, with the continuous addition of shooting functions, electronic devices are prone to selecting the wrong image output mode during actual operation. Summary of the Invention

[0004] This application provides a camera parameter configuration method and electronic device. The configuration file carries the filtering conditions corresponding to the shooting scenes that enable various shooting functions. The image output mode is selected by using the filtering conditions to ensure that the image output mode that is suitable for different shooting scenes can be accurately matched.

[0005] To achieve the above objectives, the embodiments of this application adopt the following technical solutions:

[0006] Firstly, embodiments of this application provide a camera parameter configuration method applied to an electronic device. The electronic device includes a camera sensor. Additionally, the electronic device stores a first configuration file. The first configuration file includes a correspondence between first scene information and first filtering conditions. The first filtering conditions are used to filter out image display modes. The first scene information is information used to enable a first camera mode. The first camera mode is one of the camera modes provided by a shooting application. The shooting application can provide one or more camera modes; for example, multiple camera modes may include portrait mode, photo mode, video mode, night scene mode, multi-camera mode, etc. Different camera modes correspond to different shooting functions.

[0007] During the power-on process of an electronic device, the first configuration file can be parsed and loaded, enabling the electronic device to determine the corresponding filtering conditions based on the actual shooting scene. In turn, it can determine the output mode that is suitable for the shooting scene based on the filtering conditions.

[0008] For example, after an electronic device is powered on, in response to an instruction to open a first application, a first interface corresponding to the first camera mode can be displayed, that is, the shooting preview interface of the first camera mode. Before displaying the image frames returned by the camera sensor on the first interface, if it is determined that the first scene information matches the shooting scene in which the first camera mode is enabled, a first filtering condition can be obtained. Then, configuration parameters corresponding to the first output mode that match the first filtering condition are sent to the camera sensor. In this way, the camera sensor can perform image acquisition according to the first output mode and obtain the corresponding first image frame. Afterwards, the first image frame is displayed on the first interface.

[0009] In the above embodiments, the first configuration file, which carries the first scene information and the first filtering conditions, is decoupled from other program code. This configuration file can be loaded when the electronic device is running. The first configuration file is easy to maintain, convenient to modify, and unaffected by the program code of other functions. Thus, even if more shooting scenes are continuously added or refined, only the first configuration file needs to be modified. Subsequently, after the electronic device is powered on, it can still obtain the filtering conditions corresponding to each shooting scene, and thus accurately match the output mode suitable for various shooting scenes.

[0010] In some embodiments, the first filtering criteria include one or more criteria for output specification parameters. For example, output specification parameters include output aspect ratio, output frame rate, field of view, bit width, output width, output height, high dynamic range (HDR) type, and Remosaic implementation type.

[0011] In practical applications, after determining the first filtering condition, the electronic device can determine the first priority condition corresponding to the current shooting scene from the first filtering condition. For example, different shooting scenes have different first priority conditions. For instance, in a slow-motion recording scene, the selection factor for frame rate is the first priority selection factor. In a shooting scene with HDR enabled, the selection factor for the HDR implementation method is the first priority selection factor. In a zoomed-in shooting scene, the selection factor for the field of view is the first priority selection factor.

[0012] After determining the first priority condition, the electronic device selects a first candidate image output mode that meets the first priority condition from among multiple image output modes supported by the camera sensor. Specifically, when the number of first candidate image output modes is 1, the first candidate image output mode is the first image output mode.

[0013] Understandably, the output image specifications are the requirements of the shooting scene for the camera sensor's output image, and are also key to achieving the relevant functions. The first priority condition is the most critical of the first selection conditions; different shooting scenes correspond to different first priority conditions, adapting to the requirements of different shooting scenes. In the above embodiment, the first priority condition is used to select the first candidate output modes, so that the first output mode determined from the first candidate output modes can meet the output requirements corresponding to the first priority condition, ensuring that the selected first output mode is an output mode that can achieve the expected effect.

[0014] In some embodiments, when the number of the first candidate image output modes is greater than 1, a second priority condition corresponding to the current shooting scene is determined in the first filtering condition, and a second candidate image output mode that meets the second priority condition is further filtered in the first candidate image output modes, so that the first image output mode determined from the second candidate image output mode can meet the image output requirements corresponding to the first priority condition and the second priority condition.

[0015] In the above embodiments, the image output mode that best suits the current shooting scene is gradually determined through multiple screenings to meet the image output requirements of the shooting scene.

[0016] In some embodiments, the first filtering condition further includes the copy number for the output mode. Where different output modes have the same configuration parameters, but the post-output processing logic differs, the camera configuration files for different output modes are distinguished by different copy numbers. In the above embodiments, by using the output specification parameters as a filtering condition and also including the copy number as a filtering condition for the output mode, the accuracy of the matched output modes can be improved.

[0017] In some embodiments, the first filtering condition includes a condition indicating the selection of a first output mode. It is understood that the condition indicating the selection of the first output mode is also the condition triggering the direct selection of a specified output mode, in order to meet the output mode selection requirements of a specific shooting scenario and improve the diversity of output mode selection methods.

[0018] In some embodiments, the first configuration file also includes a correspondence between second scene information and second filtering conditions. The electronic device detects a user-instructed zoom operation. When the second scene information matches the zoomed-out shooting scene, the second filtering conditions are obtained. Thus, the electronic device can filter out a second image output mode suitable for the current shooting scene based on the second filtering conditions, and send the configuration parameters corresponding to the second image output mode to the camera sensor, so that the camera sensor can acquire images according to the second image output mode. For example, after the camera sensor acquires a second image frame according to the second image output mode, the electronic device can display the second image frame on a first interface.

[0019] In other embodiments, the first configuration file also includes a correspondence between third scene information and third filtering conditions, whereby the electronic device detects that it has entered an HDR shooting scene. When the third scene information matches the HDR shooting scene, the third filtering conditions are obtained. Thus, the electronic device can filter out a third image output mode suitable for the current shooting scene based on the third filtering conditions, and send the configuration parameters corresponding to the third image output mode to the camera sensor, enabling the camera sensor to acquire images according to the third image output mode. For example, after the camera sensor acquires a third image frame according to the third image output mode, the electronic device can display the third image frame on a first interface.

[0020] In the above embodiments, during the operation of the first application in the foreground of the electronic device, the output mode of the camera sensor will be dynamically switched as the shooting scene changes, so that the output mode after switching is still adapted to the changed shooting scene.

[0021] In some embodiments, the scene information includes scene identification information and scene feature information, and the scene information in the first configuration file is the scene identification information. During the power-on process of the electronic device, a first parsing class can be called to parse the first configuration file. After parsing out the first filtering condition corresponding to the first scene identification information, the first filtering condition is stored in the first data structure.

[0022] In addition, the electronic device also includes a second configuration file, which contains the correspondence between the first scene identifier information and the first scene feature information. After parsing and loading the first configuration file, the electronic device can also call a second parsing class to parse the second configuration file. After parsing out the first scene feature information corresponding to the first scene identifier information, the first scene feature information and the first filtering condition in the first data structure are stored in the target data structure.

[0023] Understandably, in the process of parsing the first filtering condition, by storing the parsed first filtering condition into the first data structure, it is possible to avoid traversing the first configuration file when using the first filtering condition later (e.g., storing the first filtering condition and the first scene feature information into the target data structure), thereby improving the efficiency of searching for and using the first filtering condition later.

[0024] In some embodiments, after the electronic device opens the first application, it acquires real-time scene feature information characterizing the current shooting scene. This real-time scene feature information includes the application identifier of the first application, the identifier of the enabled camera mode, the zoom level, and the required output image specifications.

[0025] In the above embodiments, when the real-time scene feature information matches the first scene feature information, the first filtering condition is found from the target data structure.

[0026] In some embodiments, after parsing and loading the first configuration file, the electronic device configures the target flag bit to a first value. Accordingly, before sending the configuration parameters corresponding to the first output mode that matches the first filtering condition to the camera sensor, the electronic device determines the target flag bit to the first value to ensure that the filtering condition used for each output mode is valid.

[0027] In addition, when the filtering conditions are not effective, the real-time scene feature information can be passed to the native decision framework, which will then determine the output mode required for the current shooting scene. This achieves compatibility with the native output mode matching strategy and improves the fault tolerance rate.

[0028] In some embodiments, the electronic device displays a second interface in response to an instruction to open a second application. The second application is a third-party application, and the second interface is a shooting preview interface of the second application. A pre-configured fourth filtering condition is obtained. Similarly, the electronic device can filter out a fourth image output mode suitable for the current shooting scene based on the fourth filtering condition, and send configuration parameters corresponding to the fourth image output mode to the camera sensor so that the camera sensor can acquire images according to the fourth image output mode. For example, after the camera sensor can acquire a fourth image frame according to the fourth image output mode, the electronic device can display the fourth image frame on the second interface.

[0029] In the above embodiments, compatibility with third-party shooting applications can be achieved, improving universality.

[0030] In some embodiments, the electronic device includes a selection control framework. After acquiring real-time scene feature information characterizing the current shooting scene, the electronic device can transmit the acquired real-time scene feature information to the selection control framework. The selection control framework searches for the first filtering condition in a target data structure based on the real-time scene feature information. Based on the first filtering condition, the selection control framework determines a first image output mode from among multiple image output modes supported by the camera sensor. The implementation details of determining the first image output mode based on the first filtering condition can be found in the foregoing embodiments.

[0031] In this embodiment, the selection of the output mode for the shooting scene is completed independently through a selection control framework. This selection control framework is dedicated to selecting the output mode and is isolated from other functions to avoid affecting the accuracy of the output mode selection.

[0032] In some embodiments, the electronic device includes a selection control framework and a native decision framework. After acquiring real-time scene feature information representing the current shooting scene, the electronic device transmits the acquired real-time scene feature information to the selection control framework. The selection control framework searches for a first filtering condition from a target data structure based on the real-time scene feature information. The selection control framework transmits the first filtering condition to the native decision framework. The native decision framework determines a first image output mode from multiple image output modes supported by the camera sensor based on the first filtering condition.

[0033] In the above embodiments, while maintaining compatibility with the native decision-making framework, the problem of inaccurate selection of graph output mode by the native decision-making framework in some scenarios is solved.

[0034] In a second aspect, an electronic device is provided in the embodiments of this application. The electronic device includes one or more processors and a memory; the memory is coupled to the processor and is used to store computer program code, which includes computer instructions. When one or more processors execute the computer instructions, the one or more processors are used to perform the method in the first aspect and its possible embodiments.

[0035] Thirdly, embodiments of this application provide a computer storage medium including computer instructions that, when executed on an electronic device, cause the electronic device to perform the methods described in the first aspect and its possible embodiments.

[0036] Fourthly, this application provides a computer program product that, when run on the aforementioned electronic device, causes the electronic device to perform the methods described in the first aspect and its possible embodiments.

[0037] Understandably, the electronic devices, computer-readable storage media, and computer program products provided in the above aspects are all applied to the corresponding methods provided above. Therefore, the beneficial effects they can achieve can be referred to the beneficial effects in the corresponding methods provided above, and will not be repeated here. Attached Figure Description

[0038] Figure 1 This is an example diagram of the software architecture of an electronic device provided in some embodiments;

[0039] Figure 2 One of the schematic diagrams of the software and hardware architecture of the electronic device provided in the embodiments of this application;

[0040] Figure 3 A second schematic diagram of the software and hardware architecture of the electronic device provided in the embodiments of this application;

[0041] Figure 4 One of the signaling interaction diagrams for the method provided in the embodiments of this application;

[0042] Figure 5 One of the scenario example diagrams for the method provided in the embodiments of this application;

[0043] Figure 6 Signaling interaction diagram two for the method provided in the embodiments of this application;

[0044] Figure 7 A second example diagram illustrating a scenario for the method provided in this application embodiment;

[0045] Figure 8 Signaling interaction diagram three for the method provided in the embodiments of this application;

[0046] Figure 9 Example diagram of the mode selection module provided in the embodiments of this application;

[0047] Figure 10 The fourth signaling interaction diagram for the method provided in the embodiments of this application. Detailed Implementation

[0048] Hereinafter, the terms "first" and "second" are used for descriptive purposes only and should not be construed as indicating or implying relative importance or implicitly specifying the number of technical features indicated. Thus, a feature defined as "first" or "second" may explicitly or implicitly include one or more of that feature. In the description of this embodiment, unless otherwise stated, "a plurality of" means two or more.

[0049] The implementation of this embodiment will now be described in detail with reference to the accompanying drawings.

[0050] With technological advancements, camera sensors in electronic devices support an increasing variety of image output modes. Examples include Binning, Idcg, and Remosaic image output modes.

[0051] In Binning output mode, after the camera sensor acquires the raw pixel array, it adds the induced charges of adjacent pixels in the raw pixel array together as a single output pixel. By combining several adjacent pixels into one pixel, the raw image data output by the camera sensor to the camera driver, compared to the raw pixel array, maintains the same field of view (FOV) while reducing output resolution, increasing photosensitive area, and improving sensitivity to light in dark areas. Binning output mode is typically the default output mode.

[0052] Furthermore, in Idcg output mode, the dynamic range of the camera sensor can be improved. Dynamic range refers to the ability of a camera sensor to simultaneously render both highlights and shadows within an image. A larger dynamic range indicates a stronger ability to render both highlights and shadows. In Idcg output mode, the camera sensor uses the same exposure time to simultaneously acquire both the high-gain (HCG) and low-gain (LCG) images corresponding to the same frame of raw image data. The camera sensor then fuses the HCG and LCG images into a single frame, which serves as the raw image data actually output to the camera driver.

[0053] Compared to the Binning plotting mode, the Idcg plotting mode has a larger dynamic range, but its power consumption is also higher, approximately 1.5 times that of the Binning plotting mode.

[0054] In Remosaic output mode, the camera sensor uses the raw pixel array acquired by the 4-cell sensor as the raw image data output to the camera driver. In other words, the raw image data received by the camera driver in Remosaic output mode is not processed by Binning pixel synthesis. Specifically, the raw image data received by the camera driver during Remosaic output mode cannot be directly recognized and processed. This raw image data needs to be converted into a standard Bayer format image; this conversion process is called Remosaic. For example, the image processing module in the Camera HAL can convert the raw image data received by the camera driver into Remosaic image data. Compared to the raw image data obtained in Binning output mode, the Remosaic image data has more pixels and higher clarity, making it more suitable for shooting scenarios where the user instructs the user to zoom in on the image (i.e., increase the zoom level).

[0055] Each of the above-mentioned output modes has its own advantages and is suitable for different shooting scenarios.

[0056] For example, the Binning output mode is suitable for most shooting scenarios, such as when photo, video, and portrait functions are enabled. As another example, the Idcg output mode is suitable for backlit or bright shooting scenarios, such as when high-dynamic range (HDR) photo functions are enabled.

[0057] As one implementation, electronic devices can determine whether they are in an HDR scene by collecting ambient lighting parameters. An HDR scene is determined to exist when the ambient lighting parameters indicate that both bright areas (e.g., the sky) and dim areas (e.g., the ground) exist simultaneously within the camera's field of view.

[0058] For another example, the Remosaic output mode is suitable for shooting scenarios where the user requests an increased zoom level, such as when the telephoto shooting function is enabled.

[0059] Furthermore, the same type of plotting mode can be further subdivided into several subcategories. For example, Binning plotting modes can correspond to different field of view angles, different plotting aspect ratios, different bit widths, and different copy numbers.

[0060] The copy number is used to distinguish camera profiles containing the same camera parameters. Understandably, even if the camera parameters are the same in the camera profile, the image output control logic and subsequent image processing logic implemented by the camera sensor based on camera profiles with different copy numbers will differ, thus resulting in different image output effects. For example, the Binning output mode suitable for night scene recording and the Binning output mode suitable for non-night scene recording have different copy numbers for their camera profiles. Similarly, the Binning output mode suitable for high-resolution preview functions and the Binning output mode suitable for non-high-resolution preview functions also have different copy numbers for their camera profiles.

[0061] For example, Remosaic rendering modes can correspond to different crop widths, crop heights, aspect ratios, Remosaic implementation methods, frame rates, and field of view. The different Remosaic implementation methods can include software-based Remosaic and hardware-based Remosaic.

[0062] For example, Idcg output modes can also correspond to Idcg output modes that employ different HDR implementation methods. These different HDR implementation methods include: HDR based on gain control and HDR based on exposure control.

[0063] In subsequent embodiments, the different output modes mentioned can refer to output modes of different types, or to different subclasses of the same type of output mode. Different output modes correspond to different camera configuration files, which include all camera parameters required to enable that output mode. Different output modes can be adapted to different shooting functions.

[0064] In some embodiments, such as Figure 1 As shown, the electronic device includes an application with shooting capabilities, a Hardware Abstraction Layer (HAL) layer, and a camera driver. For example, the application with shooting capabilities may be a camera application. And for another example, the HAL layer described above includes a camera HAL.

[0065] In some embodiments, the camera HAL includes an application instance (Usecase) created for the camera application. Understandably, after the camera application is opened, it can trigger the camera HAL to perform a camera data stream configuration (Configure_stream). During the Configure_stream configuration phase, the camera HAL can select an appropriate UsecaseId. Different UsecaseIds correspond to different camera modes. The camera HAL can determine the required UsecaseId based on the camera mode enabled by the camera application. For example, the camera modes provided by the camera application may include portrait mode, photo mode, video mode, night mode, multi-camera mode, etc. If the camera application defaults to photo mode when opened, the camera HAL can select the UsecaseId corresponding to the photo mode during the Configure_stream phase.

[0066] Next, the camera HAL obtains the configuration information of the Usecase corresponding to UsecaseId, and creates a Usecase that matches the current shooting mode based on the Usecase configuration information.

[0067] After creating a Usecase, the camera HAL can also create corresponding Feature components based on the features that can be enabled (or, the features that need to be enabled) in the current camera mode.

[0068] For example, after creating a use case for the photo mode, the camera application needs to enable the preview image display function. Accordingly, the camera HAL can create a Feature component, such as FeatureHDR, under the use case for the photo mode to implement the preview image display function.

[0069] In addition, different Feature components can be created to meet different image preview requirements, and this application does not impose any special limitations on this.

[0070] For example, after creating a use case for the photo-taking mode, the camera application needs to enable the photo-taking function. Accordingly, the camera HAL can create a Feature component under the use case for the photo-taking mode to implement the photo-taking function. For example, Feature (multi-frame super resolution, MFSR).

[0071] Understandably, Usecase can manage and enable one or more Feature components. A Feature component can correspond to one or more Pipelines, and one or more Pipelines can support the implementation of the functionality corresponding to the Feature component.

[0072] In some embodiments, under different shooting scenarios, such as when the camera application enables different shooting functions, the Usecase in the camera HAL and / or the Feature components enabled in the Usecase are different. That is, the Usecase in the camera HAL can characterize the current shooting scenario. Furthermore, the output image specifications (also known as output image specification parameters) corresponding to the current shooting scenario can be obtained from the Usecase, such as the output aspect ratio, output image size, field of view, output frame rate, bit width, the required camera sensor, output resolution, exposure time, and the method of processing the raw image data acquired by the camera sensor, such as Binning, Remosaic, Idcg, etc. These output image specifications can also be referred to as scene features. From the Usecase, information such as the application name (e.g., the package name of the camera application), camera mode information, and the currently configured zoom ratio can also be obtained. This information can also be referred to as scene features.

[0073] When the shooting scene changes, such as after a change in the enabled camera mode and / or the enabled shooting function, the scene features obtained from the camera HAL's Usecase may also differ. For example, after the camera app opens the shooting mode, it can obtain scene feature information 1 from the camera HAL's Usecase. After the camera app enables the telephoto shooting function in shooting mode, it can obtain scene feature information 2 from the camera HAL's Usecase. Both scene feature information 1 and scene feature information 2 can include one or more scene features. Scene feature information 1 and scene feature information 2 may differ; for example, at least one corresponding scene feature may be different.

[0074] In addition, camera HAL can also include native decision frameworks and XML.

[0075] The XML described above can be used to transmit and store data. For example, the XML can retrieve various configuration parameters from the memory of an electronic device, such as camera parameters corresponding to different image output modes and configuration information for creating various use cases. Simultaneously, the XML can also support various nodes in the pipeline (e.g., sensor nodes) in querying stored configuration parameters.

[0076] like Figure 1As shown, the native decision-making framework can include an image output decision module. This module determines the appropriate image output mode for the current shooting scene based on a matching strategy for the output mode. This matching strategy for the output mode can be integrated into the native decision-making framework's program code.

[0077] In some embodiments, such as Figure 1 As shown, when the camera application is running in the foreground, it can send streaming requests to the interface module of the camera HAL. These streaming requests can be configuration requests, used to trigger the execution of camera data stream configuration. They can also be preview streaming requests, photo streaming requests, or video streaming requests, used to trigger the acquisition of corresponding image data; this embodiment does not specifically limit the types of requests. After receiving the streaming request, the Usecase function in the camera HAL sends scene feature information representing the current shooting scene to the native decision framework.

[0078] Based on the scene features of the current shooting scene, the native decision-making framework can determine the output mode matching the current shooting scene, such as output mode 1. Then, the native decision-making framework can send the mode identifier of output mode 1 to Usecase. Usecase can then determine the camera configuration file corresponding to output mode 1 from the XML, obtain the camera configuration file for output mode 1, and configure it to the corresponding camera sensor through the camera driver. The camera configuration file for output mode 1 includes the camera parameters required to implement output mode 1.

[0079] In addition, the native decision-making framework includes other decision-making modules, which can be responsible for making decisions related to other functions of the camera sensor. For example, other decision-making modules may include an optical image stabilization (OIS) decision-making module, which is responsible for making decisions regarding the OIS function of the camera sensor. The control code for these other decision-making modules is also integrated into the program code of the native decision-making framework. That is, there is a coupling problem between the program code of different functions.

[0080] After adding a shooting function, the matching strategy for the output mode in the native decision-making framework needs to be updated. This is typically done through "scene-specific" or "stubbing" modifications. "Scene-specific" modifications specify the strategy for enabling a particular output mode in a specific shooting scene. However, due to code coupling issues, modifications to common code are unavoidable. Similarly, updates to other functions may also modify common code, potentially leading to the code corresponding to the updated output mode matching strategy being tampered with, resulting in incorrect output mode selection.

[0081] In another scenario, the electronic device has already added a camera configuration file 2 corresponding to the output mode 2, and the camera sensor also supports enabling output mode 2. However, since the native decision framework is an architecture provided by the chip platform, the matching strategy in the native decision framework cannot be modified in time without authorization from the chip platform. This results in the native decision framework being unable to identify the shooting scene that requires enabling output mode 2, and also being unable to control the camera sensor to enable output mode 2.

[0082] To address the aforementioned issues, this application provides a camera parameter configuration method applied to an electronic device with shooting capabilities. The electronic device includes a configuration file 1, which contains selection factors for different shooting scenarios. Configuration file 1 is decoupled from the program code of other functions, making updates easier.

[0083] When the electronic device is running, it can load configuration file 1 (the first configuration file), thereby enabling it to determine the corresponding selection factor based on the scene characteristics of the current shooting scene. After determining the selection factor (also known as the target selection factor) corresponding to the current shooting scene, the target image output mode is selected from multiple image output modes supported by the camera sensor using the target selection factor, and the camera sensor is controlled to enable the target image output mode.

[0084] The selection factor is a constraint used to filter out the image patterns. The selection factor includes conditions determined based on the scene characteristics of the shooting scene, as well as conditions configured specifically for the shooting scene. Different shooting scenes may correspond to different selection factors.

[0085] For example, selection factors may include conditions for output aspect ratio, output frame rate, field of view, bit width, copy number, output width, output height, HDR type, and Remosaic implementation type. For another example, selection factors may also include specific conditions set for the shooting scene, such as conditions that trigger a forced selection output mode.

[0086] For example, selection factors for aspect ratio settings in output drawings can include: <ratio> 1.33< / ratio> This indicates that the desired aspect ratio for the output drawing is 4:3. The selection factors for the output aspect ratio can also include: <ratio> 1.78< / ratio> This indicates that the desired aspect ratio of the output drawing is 16:9.

[0087] For example, the selector for setting the Remosaic implementation type can include: <remosaic> -1< / remosaic> This indicates that Remosaic-related plotting modes are not enabled, while Binning plotting mode can be enabled. The selection factors for Remosaic implementation type settings can also include: <remosaic> 0< / remosaic>This indicates a software-based Remosaic plotting mode. Selection factors for the Remosaic implementation type can also include: <remosaic> 1< / remosaic> This indicates a hardware-based Remosaic plotting mode. The selection factors for the Remosaic implementation type can also include: <remosaic> 2< / remosaic> This indicates that Remosaic is not enabled, and the graph will be generated in quad bayer mode.

[0088] For example, selection factors for the output frame rate setting can include: <fps> 30< / fps> This indicates that the frame rate for the output image needs to reach 30fps.

[0089] For example, selection factors for setting the field of view can include: <iszfov> 1< / iszfov> This indicates that the field of view is full-size. In essence, the field of view map is generated by cropping an image region from the image data captured by the camera sensor, based on the field of view cropping box. This cropped image region is then enlarged to obtain the field of view map. When the field of view is full-size, the size of the field of view cropping box is the same as the size of the image data captured by the camera sensor. That is, no cropping is required to obtain the corresponding field of view map.

[0090] Selection factors for field of view settings can include: <iszfov> 2< / iszfov> This indicates that the size of the field-of-view cropping box is smaller than the size of the image data acquired by the camera sensor; that is, cropping is required to obtain the corresponding field-of-view map. <iszfov> 2< / iszfov> The corresponding attribute is assigned a value of 2, and other attribute values ​​can also be configured. The larger the attribute value, the smaller the corresponding field-of-view clipping box, which means a larger clipping range during the generation of the field-of-view map.

[0091] For example, the selection factor for setting the bit width can include: <bpp> 10< / bpp> Here, 10 is the corresponding attribute value, indicating a bit width of 10 bits. The selection factor for bit width settings can also include other attribute values. For example, <bpp> 12< / bpp> This indicates that the bit width is 12 bits.

[0092] For example, selection factors for replica numbers can include: <duplicate> 1< / duplicate>Here, 1 represents the corresponding attribute assignment, indicating that the copy number is 1. That is, the camera profile of the selected output mode has a copy number, and the copy number is 1. The selection factor for the copy number can also include other attribute assignments, which are not specifically limited in this embodiment. For example, the camera parameters that need to be configured in the camera sensor are the same for night scene recording and normal recording, but the processing methods after output are different. The camera profile of the output mode selected for night scene recording and the camera profile of the output mode selected for normal recording have the same camera parameters, but their copy numbers are different. For example, the selection factor for night scene recording includes <duplicate> 1< / duplicate> The selection factors for regular video recording include <duplicate> 2< / duplicate> .

[0093] For example, selection factors for plot width include: <width> 3648< / width> The selection factors for plot height include: <height> 2736< / height> .

[0094] For example, selection factors for HDR types include:

[0095] <hdr> 0< / hdr> This indicates that HDR is not enabled.

[0096] <hdr> 1< / hdr> This indicates that the standard Idcg output mode is enabled.

[0097] <hdr> 2< / hdr> and <hdr> 3< / hdr> Both indicate that HDR is achieved based on gain control. <hdr> 2< / hdr> and <hdr> 3< / hdr> Different attribute values ​​represent different gain values.

[0098] <hdr> 4< / hdr> , <hdr> 5< / hdr> , <hdr> 6< / hdr> , <hdr> 7< / hdr> and <hdr> 8< / hdr> All of these indicate that HDR is achieved through exposure time control. The above... <hdr> 4< / hdr> , <hdr> 5< / hdr> , <hdr> 6< / hdr> , <hdr> 7< / hdr> and <hdr> 8< / hdr> Different attribute values ​​indicate different exposure durations.

[0099] For example, the conditions that trigger the forced selection of the image include: <!-- <mode> 1< / mode> --> indicates that the plotting mode corresponding to the forced selection attribute assignment of "1" is triggered. Additionally, the attribute assignment in the condition for triggering the forced selection plotting mode can also have other values, with different attribute assignments corresponding to different plotting modes. The conditions for triggering the forced selection plotting mode mentioned above can also be called forced selection factors.

[0100] For example, electronic devices can be desktops, laptops, tablets, handheld computers, mobile phones, laptops, ultra-mobile personal computers (UMPCs), netbooks, as well as cellular phones, personal digital assistants (PDAs), televisions, VR devices, AR devices, and other devices with camera sensors.

[0101] like Figure 2 As shown, electronic devices can be divided into several layers from top to bottom: the application layer, the application framework layer, the hardware abstraction layer (HAL), the kernel layer (also known as the driver layer), and the hardware layer. Each layer has a clear role and division of labor. Layers communicate with each other through software interfaces.

[0102] Understandable. Figure 2 This is just an example; that is, the layers in an electronic device are not limited to... Figure 2 The layers shown, for example, between the application framework layer and the HAL layer, may also include the Android runtime and system library layers.

[0103] For example, the application layer may include a series of application packages. Figure 2 As shown, the application layer can include a camera application. Of course, in addition to the camera application, the application layer can also include other application packages, such as a gallery application, a video application, and other application packages.

[0104] The application layer can include system-level applications that come pre-installed in electronic devices, or third-party applications that are installed in response to user actions.

[0105] Generally, applications are developed using the Java language and are completed by calling the application programming interface (API) and programming framework provided by the application framework layer. For example, the application framework layer includes some predefined functions.

[0106] like Figure 2As shown, the application framework layer may include a camera service, which can be called by the camera application to implement shooting-related functions. Of course, the application framework layer may also include a content provider, resource manager, notification manager, window manager, view system, phone manager, etc. Similarly, the camera application may also call the content provider, resource manager, notification manager, window manager, view system, etc., according to actual business needs. This embodiment of the application does not impose any restrictions on this.

[0107] The kernel layer described above is the layer between hardware and software. For example... Figure 2 As shown, the kernel layer includes at least a camera driver. This camera driver can be used to drive hardware modules with shooting capabilities, such as camera sensors. In other words, the aforementioned camera driver is responsible for data interaction with the camera sensor. Of course, the kernel layer may also include audio drivers, sensor drivers, and other driver software; this embodiment of the application does not impose any limitations on this.

[0108] In addition, the HAL layer can encapsulate drivers in the kernel layer and provide an interface for calling the application framework layer, shielding the implementation details of the low-level hardware.

[0109] The HAL layer mentioned above can include the camera HAL. In addition to the native decision framework, the created use cases, and XML, the camera HAL includes, for example... Figure 2 As shown, the camera HAL also includes: a selection control frame.

[0110] like Figure 2 As shown, the above selection control framework includes a sensor mode module (SensorMode) and a mode selection module (SelectSensorMode). The sensor mode module can determine the corresponding selection factors based on the shooting scene. The mode selection module can then filter the camera configuration file in XML to find the output mode that best suits the current shooting scene based on the selection factors.

[0111] in addition, Figure 2 The document also exemplifies driveable hardware modules in the hardware layer, such as camera sensors. Of course, the hardware layer may also include... Figure 2 Hardware modules not shown, such as processors, memory, etc.

[0112] In some embodiments, such as Figure 2As shown, after the electronic device opens the camera application, the camera application can send a streaming request to the camera HAL through the camera service. In response to the streaming request, the Usecase in the camera HAL sends scene feature information corresponding to the current shooting scene to the sensor mode module. The sensor mode module determines the corresponding target selection factor based on the scene feature information of the current shooting scene. The process of determining the target selection factor can be referred to the description in subsequent embodiments, and will not be repeated here. The sensor mode module can then send the target selection factor to the native decision framework.

[0113] As one implementation, the Usecase function in the camera's HAL can also send scene feature information of the current shooting scene to the native decision-making module. If the native decision-making module selects multiple output modes based on the scene feature information of the current shooting scene, then the native decision-making module can combine the target selection factor to select a target output mode from the multiple output modes. As another implementation, the native decision-making module can determine a target output mode based on the target selection factor.

[0114] After determining the target image rendering mode, the native decision framework can send the mode identifier of the target image rendering mode to the Usecase. The Usecase can then determine the camera configuration file corresponding to the target image rendering mode from the XML, obtain the camera configuration file corresponding to the target image rendering mode, and configure it to the corresponding camera sensor through the camera driver.

[0115] In other embodiments, such as Figure 3 As shown, after an electronic device opens the camera application, the camera application can send a streaming request to the camera HAL through the camera service. In response to this streaming request, the Usecase in the camera HAL sends scene feature information corresponding to the current shooting scene to the sensor mode module. The sensor mode module determines the corresponding target selection factor based on the scene feature information of the current shooting scene. The sensor mode module can then send the target selection factor to the mode selection module. The mode selection module, combining the target selection factor, determines the target output mode from the output modes supported by the camera sensor. The mode selection module can then send the mode identifier of the target camera mode to the Usecase. The Usecase can determine the camera configuration file corresponding to the target output mode from the XML, and obtain the camera configuration file corresponding to the target output mode, and configure it to the corresponding camera sensor through the camera driver.

[0116] Understandably, when the target selection factors include a strong selection factor, other selection factors can be disregarded, and the plotting mode indicated by the "strong selection factor" can be directly used as the target plotting mode, thus achieving a static selection strategy. When the target selection factors do not include a strong selection factor, multiple target selection factors are dynamically combined to filter out the target plotting mode, thus achieving a dynamic selection strategy.

[0117] The implementation details of the method provided in the embodiments of this application are described below with reference to the accompanying drawings and practical application scenarios:

[0118] In some embodiments, when the electronic device is powered on, the selection control framework in the camera HAL can be initialized. For example, the sensor mode module (SensorMode) in the selection control framework can be configured. Figure 4 As shown, the process of configuring the SensorMode module in the control framework is as follows:

[0119] S101, during the power-on process, initializes the camera context object (CameraContext).

[0120] In some embodiments, CameraContext includes all the data that supports the implementation of camera functionality. For example, CameraContext includes classes, functions, and configuration files that need to be invoked when handling camera-related tasks.

[0121] During the initialization of the CameraContext, one or more initialization tasks can be executed sequentially, such as S102 and S106. Other initialization tasks can also be executed; please refer to relevant technical documentation for details, which will not be elaborated upon here.

[0122] S102, Obtain the camera data structure (CameraIdMap) from the camera context object.

[0123] CameraIdMap is a data structure used to store and manage key-value pairs. CameraIdMap can include various types of Maps, such as the camera scene data structure (CameraStageMap). The camera scene data structure (CameraStageMap) includes a configuration file (e.g., stageMapConfig.xml) and a corresponding camera scene parser class (CameraStageMapParser) for parsing stageMapConfig.xml.

[0124] In some embodiments, after obtaining the camera scene data structure (CameraStageMap), the process proceeds to S103.

[0125] S103, the camera data structure (CameraIdMap) calls the camera scene parsing class (CameraStageMapParser) to parse configuration file 1.

[0126] In some embodiments, the camera scene data structure (CameraStageMap) within the camera data structure (CameraIdMap) may call the camera scene parsing class (CameraStageMapParser) to parse configuration file 1. The aforementioned camera scene parsing class (CameraStageMapParser) may also be referred to as the first parsing class.

[0127] Configuration file 1 (e.g., stageMapConfig.xml) includes multiple sets of selection factors. These sets of selection factors differ in various ways, such as the number of factors or their content. Furthermore, different sets of selection factors correspond to different shooting scenarios. For example, in configuration file 1, different sets of selection factors correspond to scene identification information for different shooting scenarios. This scene identification information may include an identifier indicating the camera sensor required for that shooting scenario, the name of the shooting scenario, and its index.

[0128] For example, the configuration file 1 parsed from the camera scene data structure (CameraStageMap) is as follows:

[0129]

[0130] Here, camera name="wide" indicates that the enabled camera sensor is the main camera sensor; stage="Binn ing" indicates that the shooting scene is named Binning; stage="insensorzoom" indicates that the shooting scene is named insensorzoom; stage="idag" indicates that the shooting scene is named in idag; index="0" indicates that the index value is 0, index="1" indicates that the index value is 1, and index="21" indicates that the index value is 21.

[0131] The above-mentioned camera name="wide", stage="Binn ing", and index="0" constitute scene identification information 1. The above-mentioned camera name="wide", stage="insensorzoom", and index="1" constitute scene identification information 2. The above-mentioned camera name="wide", stage="idag", and index="21" constitute scene identification information 3.

[0132] 1.08 and <!-- <mode> 2< / mode> -->A set of selection factors corresponding to the shooting scene indicated by scene identifier information 1.

[0133] <rat io> 1.33< / rat io> , <remosaic> 1< / remosaic> , <fps> 30< / fps> and 2 represents a set of selection factors corresponding to the shooting scene indicated by scene identifier information 2.

[0134] <rat io> 1.78< / rat io> , <bpp> 12< / bpp> , <hdr> 1< / hdr> and<dup l icate> 1< / dupl icate> A set of selection factors corresponding to the shooting scene indicated by scene identifier information 3.

[0135] S104, the CameraStageMapParser class parses multiple sets of selection factors from configuration file 1, with each set of selection factors corresponding to a shooting scene.

[0136] In some embodiments, after parsing out a set of selection factors corresponding to a shooting scene, the set of selection factors and the corresponding scene identification information are stored in m_idMap.

[0137] S105, the CameraStageMapParser class stores the parsed selection factors into the sceneParams structure.

[0138] In some embodiments, the camera scene parsing class (CameraStageMapParser) can store the scene identifier information and corresponding selection factor stored in each m_idMap into a sceneParams structure (also known as the first data structure). Then, the isValid flag (also known as the target flag) is set to the first value (e.g., true), indicating that the selection factor has taken effect.

[0139] S106, Camera Context object is created and the camera default configuration object (CameraDefaultConfig) is initialized.

[0140] S107, the camera default configuration object (CameraDefaultConfig) calls the camera scene default configuration parser class (CameraDefaultConfigParser) to parse configuration file 2.

[0141] Configuration file 2 (e.g., DefaultStateConfig.xml) includes the correspondence between scene identifier information and scene feature information. Configuration file 2 can also be referred to as the second configuration file. In configuration file 2, the corresponding scene identifier information and scene feature information all indicate the same shooting scene. For example, first scene identifier information and first scene feature information can indicate the shooting scene where the first camera mode is enabled; both the first scene identifier information and the first scene feature information can be referred to as first scene information.

[0142] In configuration file 2, different groups of scene information can indicate different shooting scenes. For example, the second scene identifier information and the second scene feature information can indicate the shooting scene after zooming in the first camera mode. Both the second scene identifier information and the second scene feature information can be referred to as second scene information. As another example, the third scene identifier information and the third scene feature information can indicate the shooting scene when entering HDR in the first camera mode. Both the third scene identifier information and the third scene feature information can be referred to as third scene information. Furthermore, the aforementioned scene feature information can consist of one or more scene features. The scene identifier information includes one or more name information, such as the name of the shooting scene, the name of the activated camera, and its index number.

[0143] S108, the camera scene default configuration parsing class (CameraDefaultConfigParser) parses scene feature information corresponding to multiple shooting scenes from configuration file 2.

[0144] In this system, each shooting scene corresponds to a scene feature information, and each scene feature information corresponds to a scene identifier information. The aforementioned camera scene default configuration parsing class (CameraDefaultConfigParser) can also be referred to as the second parsing class.

[0145] S109, the camera scene default configuration parsing class (CameraDefaultConfigParser) obtains the target data structure (m_sceneParamsMap) based on the parsed scene feature information and sceneParams structure.

[0146] In some embodiments, the correspondence between scene feature information and each set of selection factors in the sceneParams structure can be determined based on scene identification information. Then, the scene feature information, the corresponding set of selection factors, and the corresponding scene identification information are inserted into the target data structure (m_sceneParamsMap).

[0147] As one implementation method, the camera scene default configuration parsing class can call the ParseConfig method to traverse all scene feature information in configuration file 2. For each scene feature information traversed, the AddSceneParams method can be called to insert the scene feature information, the corresponding set of selection factors, and the corresponding scene identifier information into the target data structure (m_sceneParamsMap).

[0148] S110, the camera scene default configuration parser class (CameraDefaultConfigParser) notifies the camera context object that the configuration is complete.

[0149] Subsequently, the SensorMode module in the control framework can determine the target selection factor corresponding to the actual shooting scene based on the target data structure (m_sceneParamsMap).

[0150] In some embodiments, such as Figure 5 As shown, after the electronic device is unlocked, the main interface 501 can be displayed. This main interface 501 includes an application icon 502 for the camera application. The aforementioned camera application is an example of a system-level application, and can also be referred to as the first application.

[0151] In scenarios where the camera application is not included in the background applications of an electronic device, when the electronic device receives a user's click on the application icon 502, the electronic device can first display a waiting interface, such as interface 503. This interface 503 can be the application interface corresponding to the photo-taking mode. When this interface 503 is displayed, the camera sensor has not yet returned the original image data; that is, there are currently no image frames to display in the aforementioned interface 503.

[0152] In other embodiments, in scenarios where the background applications of an electronic device include a camera application, if the camera application has enabled recording mode before running in the background, the electronic device can also display a waiting interface when it receives a user's click on the application icon 502. This waiting interface is the application interface corresponding to the recording mode.

[0153] In other possible embodiments, while the electronic device displays the main interface 501, it can receive a long-press operation from the user on the application icon 502. In this way, the electronic device can display a mode selection window relative to the application icon 502, which includes mode controls indicating various camera modes. In this scenario, the electronic device can receive the user's operation on any mode control and determine the camera mode selected by the user. For example, if the electronic device receives the user's operation on the mode control indicating the recording mode, it can display a waiting interface corresponding to the recording mode.

[0154] In addition to clicking the application icon 502, when the camera application is among the background applications on the electronic device, the waiting screen can also be displayed by operating the multitasking interface. Of course, when the camera application is not among the background applications, the waiting screen corresponding to the default camera mode can be displayed by operating the camera shortcut key. Furthermore, the need to open the camera application can be analyzed by recognizing the user's spoken commands or detecting the user's hand gestures. For example, recognizing the user saying keywords such as "camera" or "take a picture" can determine that the camera application needs to be opened and display the corresponding waiting screen. Similarly, recognizing the user's hand gestures associated with the camera application can also determine that the camera application needs to be opened and display the corresponding waiting screen. Moreover, the hand gestures associated with the camera application can be preset.

[0155] Continuing with the example of the displayed waiting screen (interface 503), during the display of interface 503, the electronic device can configure camera parameters to instruct the camera sensor to start acquiring raw image data.

[0156] In some embodiments, opening the camera application can trigger the Configure_stream phase. In the Configure_stream phase, camera parameters can be configured into the camera sensor. For example... Figure 6 As shown, the signaling interactions between the various hardware and software modules in the electronic device are as follows:

[0157] S201, received an order to open the camera application.

[0158] S202, the camera application sends a streaming request to the camera service.

[0159] Understandably, Figure 6 This example uses a scenario where the camera app is opened and a photo mode is enabled. Accordingly, the streaming request includes a photo mode identifier. In other embodiments, if another camera mode is enabled when the camera app is opened, the streaming request may include an identifier for that other camera mode. The camera mode enabled when the camera app is opened may also be referred to as the first camera mode.

[0160] Optionally, the distribution request may also include information such as the name of the camera application and the currently configured zoom level.

[0161] In some embodiments, the camera application sends a streaming request to the camera service, triggering the Configure_stream phase, so that the process can proceed to S203.

[0162] In other embodiments, when a user-instructed switching of the enabled camera mode is detected, the camera application also sends a streaming request to the camera service, which includes an identifier of the switched camera mode.

[0163] S203, The camera service instructs the camera HAL to create a corresponding application instance (Usecase).

[0164] In some embodiments, the camera service can send a streaming request to the camera HAL. The camera HAL can respond to the streaming request and enter the Configure_stream phase. In the Configure_stream phase, the camera HAL can create a Usecase that matches the configuration request. For example, based on the shooting mode identifier in the streaming request, a Usecase corresponding to the shooting mode is created. Afterward, the process proceeds to S204.

[0165] S204, The application case sends the real-time scene feature information 1 corresponding to the current shooting scene to the sensor mode module.

[0166] For example, the aforementioned real-time scene feature information 1 includes the output image specification requirements of the current shooting scene. The aforementioned real-time scene feature information 1 may also include the name of the application from the streaming request (e.g., the package name of the camera application), the camera mode identifier, and the currently configured zoom level, etc.

[0167] S205, the sensor mode module (SensorMode) obtains the target selection factor 1 corresponding to the real-time scene feature information 1 from the target data structure (m_sceneParamsMap).

[0168] In some embodiments, the SensorMode module can send real-time scene feature information 1 to the CameraStageMap. The CameraStageMap can query the target selection factor 1, which corresponds to the real-time scene feature information 1 and has been parsed, from the target data structure (m_sceneParamsMap). Then, the CameraStageMap can pass the determined target selection factor 1 to the SensorMode module. Here, the target selection factor 1 can also be referred to as the first filtering condition.

[0169] For example, the above query process is as follows: First, a match is determined between real-time scene feature information 1 and scene feature information 1 (first scene feature information) from configuration file 2. Then, a correspondence is determined between scene feature information 1 and scene identifier information 1. Finally, the corresponding target selection factor 1 is obtained based on scene identifier information 1 (first scene identifier information). For example, scene identifier information 1 corresponding to scene feature information 1 includes: camera name = "wide", stage = "Binning", index = "0", and the determined target selection factor 1 includes: 1.08 and <!-- <mode> 2< / mode> -->. Understandably, 1.08 and <!-- <mode> 2< / mode> -->This is just an example for convenience. The actual target selection factor 1 obtained may be information parsed into other data forms. This application does not specifically limit this.

[0170] In a possible embodiment, S204 can be replaced by: the application instance (Usecase) sending real-time scene feature information 1 corresponding to the current shooting scene to the camera scene data structure (CameraStageMap). S205 can be replaced by: the camera scene data structure (CameraStageMap) querying the target selection factor 1 from the target data structure (m_sceneParamsMap) and passing it to the sensor mode module (SensorMode).

[0171] S206, the SensorMode module sends the target selection factor 1 to the SelectSensorMode module.

[0172] S207, The mode selection module (SelectSensorMode) determines that the camera application is not a third-party application.

[0173] In some embodiments, when executing S206, the SensorMode module, in addition to sending the target selection factor 1 to the SelectSensorMode module, can also send real-time scene feature information 1 to the SelectSensorMode module. In this way, the SelectSensorMode module can obtain the name of the camera application from the real-time scene feature information 1, and determine whether the camera application is a third-party application based on the name of the camera application (e.g., package name). For example, the electronic device includes a list 1, which includes the names of system-level applications. If the name of the camera application belongs to list 1, it is determined that the camera application is not a third-party application, and the process proceeds to S208. If the name of the camera application does not belong to list 1, it is determined that the camera application is a third-party application, and the process can proceed to S408.

[0174] In other embodiments, after receiving the target selection factor 1, the mode selection module (SelectSensorMode) can obtain the name of the camera application from the allocation request from the Usecase, and determine whether the camera application is a third-party application based on the name of the camera application (e.g., package name).

[0175] S208, the mode selection module (SelectSensorMode) determines the multiple output modes supported by the camera sensor that need to be enabled.

[0176] In some embodiments, the camera name in the scene identification information 1 can be used to query multiple output modes supported by the camera sensor to be enabled.

[0177] S209, the mode selection module (SelectSensorMode) determines the isValid flag to be the first value.

[0178] In some embodiments, the assignment of the isValid flag can indicate whether the selection factor in the current target data structure (m_sceneParamsMap) has taken effect. For example, after executing S101 to S110, the isValid flag can be set to the first value. When the isValid flag is the first value, it indicates that the selection factor in the target data structure (m_sceneParamsMap) has taken effect, and the process proceeds to S210.

[0179] For example, if the electronic device is powered on but S101-S110 has not been executed, or if parsing configuration file 1 fails during the execution of S101-S110, the isValid flag is assigned a second value. When the isValid flag is at its second value, it indicates that the selection factor in the target data structure (m_sceneParamsMap) is not effective. In this scenario, the mode selection module (SelectSensorMode) can trigger the application instance (Usecase) to send real-time scene feature information 1 to the native decision framework. The native decision framework then determines the target image output mode 1 suitable for the current shooting scene based on the real-time scene feature information 1.

[0180] In some embodiments, S207, S208, and S209 are all optional steps, and there is no necessary order among them.

[0181] S210, if the target selection factor 1 includes a strong selection factor, the mode selection module (SelectSensorMode) determines the target output mode 1 corresponding to the strong selection factor.

[0182] Among them, the aforementioned strong selection factor refers to the selection factor that triggers the selection of a certain output mode. For example, the <!-- in target selection factor 1 <mode> 2< / mode> --> This can be a strong selection factor used to trigger the plotting mode corresponding to the selected attribute assignment "2". It is understood that the correspondence between the attribute assignments of each strong selection factor and the plotting mode can be pre-configured. Furthermore, the same camera sensor can correspond to one or more strong selection factors, and the plotting mode indicated by one or more strong selection factors can be one of multiple plotting modes supported by the camera sensor; this application does not specifically limit this.

[0183] When the target selection factor 1 includes a strong selection factor, other selection factors in target selection factor 1 do not need to be considered; the plotting mode indicated by the strong selection factor is taken as target plotting mode 1. For example, if target selection factor 1 includes <!-- <mode> 2< / mode> When -->, there is no need to consider Version 1.08 directly replaces <!-- <mode> 2< / mode> -->The corresponding output mode is used as the target output mode 1.

[0184] If the target selection factor 1 does not include a strong selection factor, the target image output mode 1 is determined from among the multiple image output modes supported by the camera sensor based on all target image output modes 1. Specific implementation details can be found in S311 to S313 of the subsequent embodiments, and will not be elaborated here. Furthermore, the aforementioned target image output mode 1 can also be referred to as the first image output mode.

[0185] As one implementation, if the target selection factor 1 includes a strong selection factor, the ForceSelectMode method can be called based on that strong selection factor to obtain the target output mode 1. If the target selection factor 1 does not include a strong selection factor, the ForceSelectMode method does not need to be called.

[0186] S211, the mode selection module (SelectSensorMode) sends the mode identifier of the target output mode 1 to Usecase.

[0187] S212, Usecase retrieves the camera configuration file 1 corresponding to target output mode 1 from the XML.

[0188] In some embodiments, camera configuration file 1 includes camera parameters that enable target image output mode 1, including initsetting and mode setting, which can also be referred to as configuration parameters. The pipeline in the use case includes control nodes for the camera sensor, such as sensor nodes. Optionally, the mode selection module (SelectSensorMode) can send the mode identifier of target image output mode 1 to the sensor node. The sensor node obtains camera configuration file 1 from XML.

[0189] S213, Usecase sends camera profile 1 to the camera sensor.

[0190] In some embodiments, the sensor node in Usecase can send camera profile 1 to the camera sensor via the camera driver.

[0191] S214, the camera sensor is configured according to camera configuration file 1.

[0192] In some embodiments, after the camera sensor receives and stores camera configuration file 1, it can be configured according to the camera parameters in camera configuration file 1. Then, the camera sensor can acquire raw image data according to target output mode 1, and send the acquired raw image data back to Usecase via camera driver. Usecase includes a pipeline for processing image data. Optionally, the pipeline can employ one or more image processing algorithms to process the raw image data acquired by the camera sensor to obtain a corresponding image frame (also referred to as a first image frame). Then, Usecase can send the image frame back to the camera application via camera service. After receiving the image frame, the camera application can trigger the electronic device to display interface 504 containing the image frame. Interface 504 can also be referred to as the first interface.

[0193] In some embodiments, while the camera application is running in the foreground, the camera application can also send various streaming requests to the camera HAL through the camera service, such as preview streaming requests, photo streaming requests, or video streaming requests.

[0194] like Figure 5 As shown, interface 504 is the shooting preview interface corresponding to the shooting mode. During the display of interface 504, the camera application can send a preview stream request to the camera HAL through the camera service to request image frames for preview.

[0195] Understandably, after the camera HAL completes `configure_stream`, it enters the `process request` stage. In the `process request` stage, the camera HAL receives a streaming request (e.g., a preview streaming request) and can determine whether the camera mode identifier, zoom level, or enabled shooting function carried in the streaming request has changed. Then, the camera HAL can update the `Usecase` in the camera HAL based on the streaming request. For example, if the camera mode identifier in the streaming request is different from the camera mode identifier in the previously received streaming request, the original `Usecase` can be destroyed and a `Usecase` corresponding to the current camera mode can be created. Similarly, if the zoom level in the streaming request is different from the zoom level in the previously received streaming request, the output image specifications of the `Usecase` can be updated to adapt to the zoomed-in shooting scene. Correspondingly, the real-time scene feature information from the `Usecase` will change. In other embodiments, if it is detected that the shooting environment changes from an environment unsuitable for enabling HDR to an environment suitable for enabling HDR, the camera HAL can also update the output image specifications of the `Usecase` in response to the streaming request to adapt to the HDR-enabled shooting scene. Accordingly, the real-time scene feature information from Usecase will change.

[0196] Additionally, during the process request phase, upon receiving a streaming request, if the real-time scene feature information corresponding to the Usecase changes, it triggers a re-determination of the output mode adapted to the current shooting scene. If the determined output mode differs from the output mode already enabled by the camera sensor, the camera sensor is reconfigured. If the determined output mode is the same as the output mode already enabled by the camera sensor, the process ends.

[0197] Take, for example, a scenario where a camera app receives a user's instruction to zoom. Figure 7 As shown, the electronic device displays interface 504, where the zoom level is 1x. The electronic device can receive zoom operations indicated by the user, such as touching the zoom icon 1002 and then sliding it relative to the zoom operation bar 1001. In response to this zoom operation, the electronic device can display interface 1003, where the zoom level is 3x, and switch the camera sensor's output mode to adapt to the zoomed-in shooting scene.

[0198] like Figure 8 As shown, the signaling interactions between the various hardware and software modules in the electronic device are as follows:

[0199] S301, the camera application received a zoom operation.

[0200] S302, the camera application sends a preview stream request to the camera service. The preview stream request includes the shooting mode identifier and zoom level.

[0201] S303, the camera service sends a preview stream request to the Usecase in the camera HAL.

[0202] S304, Usecase can update the corresponding drawing specification requirements.

[0203] For example, in Figure 7 In the scenario shown, after detecting the user's zoom operation, the preview stream request carries a zoom ratio of 3x. In response to this 3x zoom ratio, output image specifications such as field of view and aspect ratio can be updated. Furthermore, when the zoom ratio is 3x, the corresponding focal length exceeds the focal length of the currently enabled camera sensor, allowing for a change in the required camera sensor.

[0204] In other embodiments, after detecting that the shooting environment has changed from an environment unsuitable for enabling HDR to an environment suitable for enabling HDR, Usecase may also update the corresponding output specification requirements in response to the preview stream request, such as updating the output specification requirements for the HDR implementation.

[0205] After updating the output drawing specifications, real-time scene feature information 2 can be obtained from Usecase. This real-time scene feature information 2 differs from real-time scene feature information 1, indicating that compared to... Figure 6 , Figure 8 The shooting scene changes as shown, and the process proceeds to S305.

[0206] S305, Usecase sends real-time scene feature information 2 corresponding to the current shooting scene to the SensorMode module.

[0207] S306, the sensor mode module (SensorMode) obtains the target selection factor 2 corresponding to the real-time scene feature information 2 from the target data structure (m_sceneParamsMap).

[0208] In some embodiments, a match is determined between real-time scene feature information 2 and scene feature information 2 from configuration file 2 (also referred to as second scene feature information). Based on the correspondence between scene feature information 2 and scene identifier information 2, the corresponding target selection factor 2 (second filtering condition) is obtained based on scene identifier information 2. For example, the scene identifier information 2 corresponding to scene feature information 2 includes: camera name = "wide", stage = "insensorzoom", index = "1", and the determined target selection factor 2 includes:<rat io> 1.33< / rat io> , <remosaic> 1< / remosaic> , <fps> 30< / fps> and 2.

[0209] In other embodiments, other real-time details of S305 and S306 can be found in S204 and S205 of the foregoing embodiments, and will not be repeated here.

[0210] S307, the SensorMode module sends the target selection factor 2 to the SelectSensorMode module.

[0211] S308, the mode selection module (SelectSensorMode) determines that the camera application is not a third-party application.

[0212] S309, the mode selection module (SelectSensorMode) determines the multiple output modes supported by the camera sensor that need to be enabled.

[0213] S310, the mode selection module (SelectSensorMode) determines the isValid flag to the first value.

[0214] S311, the mode selection module (SelectSensorMode) determines the first priority selection factor in target selection factor 2.

[0215] In some embodiments, the first priority selection factor differs depending on the shooting scenario. For example, in slow-motion recording scenarios, the selection factor for frame rate is the first priority selection factor. In HDR-enabled shooting scenarios, the selection factor for the HDR implementation method is the first priority selection factor. In zoomed shooting scenarios, the selection factor for the field of view is the first priority selection factor. The first priority selection factor can also be referred to as the first priority condition.

[0216] As one implementation, the electronic device is configured with a matching file 3, which includes the correspondence between different scene identification information and the first priority selection factor. After receiving the target selection factor 2, the first priority selection factor can be determined from the matching file 3 based on the scene identification information 2 corresponding to the real-time scene feature information 2.

[0217] As another implementation, in each group of selection factors in configuration file 1, one selection factor is marked as the first priority. Thus, after receiving the target selection factor 2, the first priority selection factor corresponding to the current shooting scene can be determined based on the first priority marking.

[0218] In other embodiments, if a set of selection factors includes a strong selection factor, the strong selection factor is the selection factor with the highest priority.

[0219] S312, the mode selection module (SelectSensorMode) selects the candidate image output mode 1 from multiple image output modes supported by the camera sensor according to the first priority selection factor.

[0220] In some embodiments, the candidate image output mode 1 that matches the first priority selection factor can be selected from multiple image output modes supported by the camera sensor; it can also be referred to as the first candidate image output mode.

[0221] like Figure 9 As shown, the mode selection module (SelectSensorMode) includes matching methods for various selection factors. For example, the ForceSelectMode method matches the output mode corresponding to a strong selection factor. Another example is the OverrideDesiredMode method, a matching method for third-party applications. Yet another example is the IsMatchingFrameRate method, which matches the output mode corresponding to a selection factor related to frame rate. Similarly, the IsMatchingFrameRate method matches the output mode corresponding to a selection factor related to output height. The IsMatchingFrameWidth method matches the output mode corresponding to a selection factor related to output width. The IsMatchingAspectRatio method matches the output mode corresponding to a selection factor related to output aspect ratio. The IsMatchingHDRFrameType method matches the output mode corresponding to a selection factor related to HDR type. Finally, the IsMatchingRemosaicType method matches the output mode corresponding to a selection factor related to Remosaic type. For example, the IsMatchingBitWidth method is used to match the plotting pattern corresponding to the selection factor related to bit width. Another example is the IsMatchingISZFov method, used to match the plotting pattern corresponding to the selection factor related to the field of view. Yet another example is the IsMatchingDuplicateNum method, used to match the plotting pattern corresponding to the selection factor related to the duplicate number.

[0222] For example, when the first priority selection factor is a constraint set for the aspect ratio of the output image, the IsMatchingAspectRatio method can be called first to filter out the output modes that match the first priority selection factor from the multiple output modes supported by the camera sensor, and use them as the candidate output mode 1.

[0223] For example, the first priority selection factor is <ratio> 1.33< / ratio> This indicates that the desired aspect ratio for the output image is 4:3. The SelectSensorMode module can... <ratio> 1.33< / ratio> The `IsMatchingAspectRatio` method is passed in to obtain one or more candidate output mode 1s. Understandably, if the camera sensor supports multiple output modes, including one with a 4:3 aspect ratio, that output mode can be matched as a candidate output mode 1. If the camera sensor does not support multiple output modes with a 4:3 aspect ratio, the output mode with the closest aspect ratio to 4:3 can be matched as a candidate output mode 1.

[0224] For example, when the first priority selection factor is a constraint set for the field of view, the IsMatchingISZFov method can be called first to filter out the image output mode that matches the first priority selection factor from the multiple image output modes supported by the camera sensor, and use it as the candidate image output mode 1.

[0225] For example, the first priority selection factor is <iszfov> 1< / iszfov> This indicates that the field of view is full-size. The mode selection module (SelectSensorMode) can... <iszfov> 1< / iszfov> Pass the IsMatchingISZFov method. If the camera sensor supports multiple output modes, including one with a full-size field of view, that output mode can be matched as candidate output mode 1. If the camera sensor supports multiple output modes, but does not include one with a full-size field of view, the output mode with the smallest cropping range corresponding to the field of view can be matched as candidate output mode 1.

[0226] For example, when the first priority selection factor is a constraint set for the copy number, the IsMatchingDuplicateNum method can be called first to filter out the image output mode that matches the first priority selection factor from the multiple image output modes supported by the camera sensor, and use it as the candidate image output mode 1.

[0227] For example, the first priority selection factor is <duplicate> 2< / duplicate> This indicates that the replica number is 2. The mode selection module (SelectSensorMode) can... <duplicate> 2< / duplicate> Pass the IsMatchingDuplicateNum method. If the camera sensor supports multiple output modes, including one with copy number 2, that output mode can be matched as candidate output mode 1. If the camera sensor supports multiple output modes, but does not include one with copy number 2, all output modes supported by the camera sensor can be matched as candidate output mode 1.

[0228] For example, when the first priority selection factor is a constraint set for the HDR type, the IsMatchingHDRFrameType method can be called first to filter out the image output mode that matches the first priority selection factor from the multiple image output modes supported by the camera sensor, and use it as the candidate image output mode 1.

[0229] For example, the first priority selection factor is <hdr> 2< / hdr> This indicates that HDR needs to be implemented based on gain control. The mode selection module (SelectSensorMode) can... <hdr> 2< / hdr> Pass the IsMatchingHDRFrameType method.

[0230] If the camera sensor supports multiple output modes, including one that implements HDR based on gain control, that output mode can be matched as candidate output mode 1.

[0231] As one implementation method, the enumeration object corresponding to the IsMatchingHDRFrameType method is as follows:

[0232] enum ModeHDRFrameType{

[0233] HN_NORMAL = 0 / / Indicates the selection factor <hdr> Attribute assignment< / hdr> In the middle, when the attribute is assigned a value of 0, the HDR output mode is not enabled;

[0234] HN_IDCG = 1, / / Represents the selection factor <hdr> Attribute assignment< / hdr> In the middle, when the attribute is assigned a value of 1, the Idcg output mode is enabled;

[0235] HN_DCG_HCG_LCG = 2, / / indicates the selection factor <hdr> Attribute assignment< / hdr> When the attribute is assigned a value of 2, one of the output modes for HDR based on gain control is enabled;

[0236] HN_DCG_HCG_HCG = 3, / / indicates the selection factor <hdr> Attribute assignment< / hdr> When the attribute is assigned a value of 3, the second HDR output mode based on gain control is enabled.

[0237] HN_SHDR_HCG_HCG = 4, / / Represents the selection factor <hdr> Attribute assignment< / hdr> When the attribute value is set to 4, one of the HDR output modes based on exposure duration control is enabled;

[0238] HN_SHDR_IDCG_VS = 5, / / Represents the selection factor <hdr> Attribute assignment< / hdr> When the attribute value is set to 4, the second HDR output mode based on exposure duration control is enabled.

[0239] HN_SHDR_QCFA_QCFA = 6, / / Represents the selection factor <hdr> Attribute assignment< / hdr> When the attribute value is set to 4, the third HDR output mode based on exposure duration control is enabled;

[0240] HN_SHDR_IDCG_HS = 7, / / Represents the selection factor <hdr> Attribute assignment< / hdr> When the attribute value is 4, the fourth HDR output mode based on exposure duration control is enabled.

[0241] HN_SHDR_HCG_HCG_SHORTPD = 8, / / Represents the selection factor <hdr> Attribute assignment< / hdr> When the attribute value is 4, the fifth HDR output mode based on exposure duration control is enabled.

[0242] };

[0243] For example, when the first priority selection factor is a constraint set for the remo implementation type, the IsMatchingRemosaicType method can be called first to filter out the image output mode that matches the first priority selection factor from the multiple image output modes supported by the camera sensor, as the candidate image output mode 1.

[0244] For example, the first priority selection factor is <remosaic> 1< / remosaic> This indicates that a hardware-based Remosaic implementation is required. The mode selection module (SelectSensorMode) can... <remosaic> 1< / remosaic> Pass the IsMatchingRemosaicType method.

[0245] If the camera sensor supports multiple output modes, including the hardware-based Remosaic output mode, that output mode can be matched as candidate output mode 1.

[0246] As one implementation method, the enumeration object corresponding to the IsMatchingRemosaicType method is as follows:

[0247] enum HnRemosaicType{

[0248] HN_REMOSAIC_INVALID = -1, / / Represents the selection factor <remosaic>Attribute assignment <remosaic>In the diagram, when the attribute is set to -1, it indicates that the Binning output mode is enabled;

[0249] HN_SWREMOSAIC = 0, / / indicates the selection factor <remosaic>Attribute assignment <remosaic>In the middle, when the attribute is assigned a value of 0, it indicates that the software-implemented Remosaic plotting mode is enabled;

[0250] HN_HWREMOSAIC = 1, / / Represents the selection factor <remosaic>Attribute assignment <remosaic>In the middle, when the attribute is assigned a value of 1, it indicates that the hardware-implemented Remosaic plotting mode is enabled;

[0251] HN_NOREMOSAIC = 2, / / Represents the selection factor <remosaic>Attribute assignment <remosaic>In the middle, when the attribute is assigned a value of 2, it means that Remosaic is not enabled and the graph is generated according to the quad bayer mode.

[0252] S313, when the number of candidate output modes 1 is greater than 1, the mode selection module (SelectSensorMode) selects the target output mode 2 from the candidate output modes 1 according to the second priority selection factor.

[0253] In some embodiments, if the number of candidate plotting modes 1 is 1, then candidate plotting mode 1 is selected as target plotting mode 2. If the number of candidate plotting modes 1 is greater than 1, other selection factors are combined to select target plotting mode 2 from candidate plotting modes 1. For example, target plotting mode 2 can be selected from candidate plotting modes 1 by combining a second priority selection factor. The aforementioned second priority selection factor can also be referred to as a second priority condition.

[0254] As one implementation, within the same set of selection factors, all selection factors except those with the first priority are second priority selection factors. In this scenario, after selecting candidate graph pattern 1 using the first priority selection factor in target selection factor 2, a selection factor is selected from the second priority selection factors in target selection factor 2. Based on this selection factor, candidate graph pattern 2 (referred to as the second candidate graph pattern) is selected from candidate graph pattern 1. If the number of candidate graph pattern 2 is also greater than 1, an unused selection factor is selected from the second priority selection factors in target selection factor 2, and the selection is repeated until the number of selected candidate graph patterns is 1, or all target selection factors 2 have been used.

[0255] As another implementation, within the same set of selection factors, each selection factor corresponds to a different priority. For example, a set of selection factors might include three factors: one with the first priority, another with the second priority, and the last with the third priority. The different priorities are ranked from highest to lowest according to their serial numbers. For instance, the first priority has the highest priority, the second priority has the next highest priority, the third priority has the lowest priority, and so on. In this scenario, after selecting candidate graph pattern 1 based on the first priority selection factor in target selection factor 2, if the number of candidate graph pattern 1 is greater than 1, then based on the second priority selection factor in target selection factor 2, candidate graph pattern 2 is selected from among the candidate graph patterns 1. If the number of candidate plotting patterns 2 is greater than 1, then based on the third priority selection factor of the target selection factor 2, the candidate plotting pattern is selected from the candidate plotting patterns 2, and so on, until the number of selected candidate plotting patterns is 1, or all target selection factors 2 have been used, and the obtained candidate plotting patterns are taken as the target plotting pattern 2.

[0256] In a possible embodiment, if all target selection factors 2 have been used and the number of candidate output modes is still greater than 1, target selection factors 2 and real-time scene feature information 2 can be input into the native decision framework, and the native decision framework can select a target output mode 2 (such as the second output mode) from multiple candidate output modes.

[0257] S314, the mode selection module (SelectSensorMode) sends the mode identifier of the target output mode 2 to Usecase.

[0258] S315, Usecase retrieves the camera configuration file 2 corresponding to target output mode 2 from the XML.

[0259] S316, Usecase sends camera profile 2 to the camera sensor.

[0260] S317, the camera sensor is configured according to camera profile 2.

[0261] Subsequently, the camera sensor can acquire raw image data according to target output mode 2, and send the acquired raw image data back to Usecase via the camera driver to generate a corresponding image frame (also known as a second image frame). Usecase can send the image frame back to the camera application via the camera service. After receiving the image frame, the camera application can trigger the electronic device to display the interface 504 containing the image frame.

[0262] In other embodiments, the electronic device is detected to have transitioned from a non-HDR shooting scene to an HDR shooting scene. When determining that the third scene information matches the HDR shooting scene, the corresponding target selection factor 4 (also known as the third filtering condition) can be obtained from the target data structure. Then, referring to the implementation details of S308-S317 in the aforementioned embodiments, configuration parameters corresponding to the third output mode matching the third filtering condition are sent to the camera sensor. Afterward, the camera sensor can acquire raw image data according to the third output mode, and send the acquired raw image data back to the Usecase via the camera driver to generate a corresponding image frame (also known as the third image frame). The Usecase can send the image frame back to the camera application via the camera service. After receiving the image frame, the camera application can trigger the electronic device to display an interface 504 containing the image frame.

[0263] In some embodiments, when an electronic device enables a third-party shooting application, the above method can also be used to configure the camera sensor's output mode. For example... Figure 10 As shown, the signaling interactions between the various software and hardware modules in the electronic device are as follows:

[0264] S401 received an order to open a third-party camera app.

[0265] Among them, the aforementioned third-party shooting applications can be third-party applications, that is, applications with shooting functions downloaded from the application market in response to user operations, such as second applications.

[0266] S402, a third-party shooting application sends a streaming request to the camera service. The streaming request includes the shooting mode identifier and the name of the shooting application.

[0267] S403, the camera service instructs the camera HAL to create a corresponding application instance (Usecase).

[0268] S404, Usecase sends real-time scene feature information corresponding to the current shooting scene to SensorMode module.

[0269] For example, the aforementioned real-time scene feature information 3 includes the output image specification requirements of the current shooting scene. The aforementioned real-time scene feature information 3 may also include the name of the application from the streaming request (e.g., the package name of the shooting application), the camera mode identifier, and the currently configured zoom level, etc.

[0270] S405, the SensorMode module obtains the target selection factor 3 corresponding to the real-time scene feature information 3 from the target data structure (m_sceneParamsMap).

[0271] S406, the SensorMode module sends the target selection factor 3 and scene feature information 3 to the SelectSensorMode module.

[0272] In other embodiments, other real-time details of S405 and S406 can be found in S204 and S205 of the foregoing embodiments, and will not be repeated here.

[0273] S407, the mode selection module (SelectSensorMode) determines whether the shooting application is a third-party application.

[0274] S408, the mode selection module (SelectSensorMode) determines the target output mode 3 according to the preset constraints.

[0275] For example, uniform restrictions can be set for third-party applications, such as a bit width of 10 bits, a frame rate of 30 fps, and an image processing method of Binning. These restrictions can also be called the fourth filtering condition. Based on these restrictions, among the multiple image output modes supported by the camera sensor, the image output mode with a bit width of 10 bits, a frame rate of 30 fps, and an image processing method of Binning is determined as the target image output mode 3 (also known as the fourth image output mode).

[0276] As one implementation method, the OverrideDesiredMode method can be called, along with preset constraints, to obtain the target output mode 3 within the output modes supported by the camera sensor.

[0277] S409, the mode selection module (SelectSensorMode) sends the mode identifier of the target output mode 3 to Usecase.

[0278] S410, Usecase retrieves the camera configuration file 3 corresponding to target output mode 3 from XML.

[0279] S411, Usecase sends camera profile 3 to the camera sensor.

[0280] S412, the camera sensor is configured according to camera profile 3.

[0281] In some embodiments, after opening the second application, a second interface corresponding to the second application can be displayed, which is also a shooting preview interface. After S412, the camera sensor can acquire raw image data according to the target output mode 3, and send the acquired raw image data back to the Usecase via the camera driver. The Usecase can generate a corresponding fourth image frame, and send the fourth image frame back to the camera application via the camera service. After receiving the image frame, the camera application can trigger the electronic device to display the second interface containing the fourth image frame.

[0282] This application also provides an electronic device that may include a memory and one or more processors. The memory and processors are coupled. The memory stores computer program code, which includes computer instructions. When the processor executes the computer instructions, it causes the electronic device to perform the steps described in the above embodiments. Of course, the electronic device includes, but is not limited to, the memory and one or more processors described above.

[0283] This application also provides a chip system that can be applied to the electronic devices described in the foregoing embodiments. The chip system includes at least one processor and at least one interface circuit. The processor may be the processor in the aforementioned electronic device. The processor and the interface circuit are interconnected via wiring. The processor can receive and execute computer instructions from the memory of the aforementioned electronic device through the interface circuit. When the computer instructions are executed by the processor, the electronic device can perform the various steps in the foregoing embodiments. Of course, the chip system may also include other discrete devices, and this application does not specifically limit this.

[0284] In some embodiments, as described above, those skilled in the art will clearly understand that, for the sake of convenience and brevity, the division of the functional modules described above is merely an example. In practical applications, the functions described above can be assigned to different functional modules as needed, that is, the internal structure of the device can be divided into different functional modules to complete all or part of the functions described above. The specific working process of the system, device, and unit described above can be referred to the corresponding process in the foregoing method embodiments, and will not be repeated here.

[0285] In the embodiments of this application, the functional units can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit.

[0286] If the integrated unit is implemented as a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solutions of the embodiments of this application, essentially, or the parts that contribute to the prior art, or all or part of the technical solutions, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) or processor to execute all or part of the steps of the methods described in the various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as flash memory, portable hard disk, read-only memory, random access memory, magnetic disk, or optical disk.

[0287] The above description is merely a specific implementation of the embodiments of this application, but the protection scope of the embodiments of this application is not limited thereto. Any changes or substitutions within the technical scope disclosed in the embodiments of this application should be covered within the protection scope of the embodiments of this application. Therefore, the protection scope of the embodiments of this application should be determined by the protection scope of the claims.< / remosaic> < / remosaic> < / remosaic> < / remosaic> < / remosaic> < / remosaic> < / remosaic> < / remosaic>

Claims

1. A method for configuring camera parameters, characterized in that, The method is applied to an electronic device, the electronic device including a camera sensor, the electronic device storing a first configuration file, the first configuration file including a correspondence between first scene information and first filtering conditions, the first filtering conditions being conditions used to filter image output modes; the method includes: When the electronic device is powered on, the first configuration file is parsed and loaded; In response to an instruction to open the first application, a first interface is displayed, which is a shooting preview interface for the first camera mode; When the first scene information matches a shooting scene in which the first camera mode is enabled, the first filtering condition is obtained; Send configuration parameters corresponding to the first image output mode to the camera sensor, wherein the first image output mode is an image output mode that matches the first filtering condition; The first interface displays a first image frame, which is an image obtained by the camera sensor using the first output mode.

2. The method according to claim 1, characterized in that, The first filtering condition includes one or more conditions for output image specification parameters, which include output image aspect ratio, output image frame rate, field of view, bit width, output image width, output image height, high dynamic range (HDR) type, and Remosaic implementation type. Before sending the configuration parameters corresponding to the first image output mode to the camera sensor, the method includes: In the first filtering criteria, the first priority criterion corresponding to the current shooting scene is determined; Among the multiple image output modes supported by the camera sensor, a first candidate image output mode that meets the first priority condition is determined; wherein, when the number of the first candidate image output modes is 1, the first candidate image output mode is the first image output mode.

3. The method according to claim 2, characterized in that, When the number of the first candidate image patterns is greater than 1, the method further includes: In the first filtering condition, determine the second priority condition corresponding to the current shooting scene; In the first candidate output mode, a second candidate output mode that meets the second priority condition is determined; wherein, when the number of the second candidate output modes is 1, the second candidate output mode is the first output mode.

4. The method according to claim 2 or 3, characterized in that, The first filtering condition also includes the copy number for the output mode, wherein when the configuration parameters corresponding to different output modes are the same, the different output modes correspond to different copy numbers.

5. The method according to claim 1, characterized in that, The first filtering criteria include a condition indicating the selection of the first output mode.

6. The method according to any one of claims 1-5, characterized in that, The first configuration file also includes the correspondence between the second scene information and the second filtering conditions, and the method further includes: The user-instructed zoom operation was detected; When the second scene information is matched with the zoomed shooting scene, the second filtering condition is obtained; Send configuration parameters corresponding to the second image output mode to the camera sensor, wherein the second image output mode is an image output mode that matches the second filtering condition; In the first interface, a second image frame is displayed, which is an image obtained by the camera sensor using the second output mode.

7. The method according to any one of claims 1-6, characterized in that, The first configuration file also includes the correspondence between third scene information and third filtering conditions, and the method further includes: The electronic device was detected to have entered an HDR shooting scene; When the third scene information matches the HDR shooting scene, the third filtering condition is obtained; Send configuration parameters corresponding to the third image output mode to the camera sensor, wherein the third image output mode is an image output mode that matches the third filtering condition; In the first interface, a third image frame is displayed, which is an image obtained by the camera sensor using the third output mode.

8. The method according to claim 1, characterized in that, The scene information includes scene identification information and scene feature information, wherein the scene information in the first configuration file is scene identification information; the parsing and loading of the first configuration file includes: The first parsing class is invoked to parse the first configuration file; After parsing out the first filtering condition corresponding to the first scene identifier information, the first filtering condition is stored in the first data structure; The electronic device further includes a second configuration file, which includes the correspondence between the first scene identification information and the first scene feature information. After parsing and loading the first configuration file, the method further includes: The second parsing class is invoked to parse the second configuration file; After parsing out the first scene feature information corresponding to the first scene identifier information, the first scene feature information and the first filtering condition in the first data structure are stored in the target data structure. Before obtaining the first filtering condition, the method further includes: Obtain real-time scene feature information that characterizes the current shooting scene. The real-time scene feature information includes the application identifier of the first application, the identifier of the enabled camera mode, the zoom ratio, and the output image specification parameters to be achieved. The step of obtaining the first filtering condition includes: when the real-time scene feature information matches the first scene feature information, finding the first filtering condition from the target data structure.

9. The method according to claim 8, characterized in that, After parsing and loading the first configuration file, the method further includes: Configure the target flag to the first value; Before sending the configuration parameters corresponding to the first image output mode to the camera sensor, the method further includes: determining that the target flag bit is the first value.

10. The method according to claim 1, characterized in that, The method further includes: In response to an instruction to open a second application, a second interface is displayed; the second application is a third-party application, and the second interface is the shooting preview interface of the second application; Retrieve the pre-configured fourth filter criteria; Send configuration parameters corresponding to the fourth image output mode to the camera sensor, wherein the fourth image output mode is an image output mode that matches the fourth filtering condition; In the second interface, a fourth image frame is displayed, which is an image obtained by the camera sensor using the fourth output mode.

11. The method according to claim 8, characterized in that, The electronic device includes a selection control framework, and after acquiring real-time scene feature information characterizing the current shooting scene, the method further includes: The acquired real-time scene feature information is transmitted to the selection control framework; The step of finding the first filtering condition from the target data structure includes: the selection control framework finding the first filtering condition from the target data structure based on the real-time scene feature information; The method further includes: the selection control framework determining the first image output mode from among multiple image output modes supported by the camera sensor based on the first filtering condition.

12. The method according to claim 8, characterized in that, The electronic device includes a selection control framework and a native decision framework. After acquiring real-time scene feature information characterizing the current shooting scene, the method further includes: The acquired real-time scene feature information is transmitted to the selection control framework; The step of finding the first filtering condition from the target data structure includes: the selection control framework finding the first filtering condition from the target data structure based on the real-time scene feature information; The method further includes: the selection control framework passing the first screening condition to the native decision framework; The native decision-making framework determines the first image output mode from among the multiple image output modes supported by the camera sensor based on the first filtering condition.

13. An electronic device, characterized in that, An electronic device includes one or more processors and a memory; the memory is coupled to the processor and is used to store computer program code, the computer program code including computer instructions, wherein when the one or more processors execute the computer instructions, the one or more processors are used to perform the method as described in any one of claims 1-12.

14. A computer storage medium, characterized in that, Includes computer instructions that, when executed on an electronic device, cause the electronic device to perform the method as described in any one of claims 1-12.

15. A computer program product, characterized in that, The computer program product includes a computer program that, when run on a computer, causes the computer to perform the method as described in any one of claims 1-12.