Camera parameter configuration method and electronic device

By implementing the camera parameter configuration method in electronic devices and performing differentiated configurations for different camera sensors, the problem of poor camera mode switching compatibility in the prior art is solved, and the effect and flexibility of camera mode switching are improved.

CN117714837BActive Publication Date: 2024-12-06HONOR DEVICE CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202311133851.9
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-08-31
Publication Date
2024-12-06
Estimated Expiration
2043-08-31

AI Technical Summary

Technical Problem

When existing electronic devices realize fast camera mode switching, they are unable to be compatible with camera sensors from different manufacturers, resulting in poor rapid switching of picture output mode.

Method used

A camera parameter configuration method is provided. By writing common camera parameters and mode-specific configuration parameters after powering on the camera sensor, it supports compatibility of different camera sensors, and realizes differentiated processing of camera parameter configuration methods of different sensors.

Benefits of technology

It achieves compatibility with different camera sensors, improves the effect and flexibility of camera mode switching, and can be compatible with multiple types of camera sensors in the same device.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN117714837B_ABST
    Figure CN117714837B_ABST
Patent Text Reader

Abstract

The embodiment of the present application provides a camera parameter configuration method and an electronic device, which relates to the field of terminal technology. The problem that electronic devices are poorly compatible with multiple types of camera sensors is solved. The specific scheme is: after the first camera sensor is powered on, the first configuration parameter and the first data packet are written to the first camera sensor; the second configuration parameter is written to the first camera sensor, indicating that the first camera sensor performs image acquisition according to the first image output mode; after the second camera sensor is powered on, the corresponding first configuration parameter is written to the second camera sensor; the corresponding second configuration parameter is written to the second camera sensor, indicating that the second camera sensor performs image acquisition according to the first image output mode; wherein the first camera sensor and the second camera sensor are different camera sensors, and the image output modes that support switching are the same.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

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

[0002] The shooting function has become a basic function of most electronic devices (such as mobile phones). With the popularity of the shooting function in electronic devices, users have higher and higher requirements for the shooting quality of electronic devices. As the shooting scene changes, being able to switch to a matching output mode has become a basic requirement of users for electronic devices.

[0003] At present, the camera sensors in the same electronic device may come from different manufacturers, and the camera sensors of different manufacturers have different requirements for realizing fast switching of image output modes. However, when realizing fast switching of image output modes, the electronic device cannot be compatible with the camera sensors provided by different manufacturers, resulting in poor effect of fast switching of actual image output modes. Summary of the invention

[0004] The embodiments of the present application provide a camera parameter configuration method and an electronic device for being compatible with multiple types of camera sensors.

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

[0006] In a first aspect, a camera parameter configuration method is provided, the method comprising: after a first camera sensor is powered on, writing a first configuration parameter to the first camera sensor, the first configuration parameter being a camera parameter shared by a plurality of image output modes, the plurality of image output modes including a first image output mode; writing a first data packet to the first camera sensor, the first data packet including a plurality of groups of configuration parameters corresponding to the plurality of image output modes, the plurality of groups of configuration parameters in the first data packet including a second configuration parameter, the second configuration parameter including parameters other than the first configuration parameter among the camera parameters for starting the first image output mode; writing a second configuration parameter to the first camera sensor, instructing the first camera sensor to perform image acquisition according to the first image output mode; after the second camera sensor is powered on, writing the corresponding first configuration parameter to the second camera sensor; writing the corresponding second configuration parameter to the second camera sensor, instructing the second camera sensor to perform image acquisition according to the first image output mode; wherein the first camera sensor and the second camera sensor are different camera sensors, and the image output modes supported for switching are the same.

[0007] In the above embodiment, when different camera sensors are enabled, different methods are used to configure camera parameters for different camera sensors, so as to meet different requirements of different camera sensors for camera parameter configuration methods during the enabling stage and achieve compatibility with different camera sensors.

[0008] In some embodiments, the first camera sensor and the second camera sensor are camera sensors corresponding to different cameras in the same electronic device.

[0009] In an exemplary scenario, the electronic device detects a first operation in which the user indicates to open a first application, and in response to the first operation, displays a first interface, where the first interface is a first type of preview interface provided by the first application. In addition, in response to the first operation, a first configuration parameter and a first data packet may be written to the first camera sensor. Afterwards, a second configuration parameter is written to the first camera sensor. In this way, the first camera sensor may output an image in a first output mode, and a first image frame may be displayed in the first interface, where the first image frame is an image obtained by the first camera sensor using the first output mode.

[0010] During image acquisition by the first camera sensor, an operation indicating the activation of the second camera sensor is detected, for example, an operation indicating the switching of the camera is detected. The electronic device can write the first configuration parameter to the second camera sensor, and then write the second configuration parameter to the second camera sensor. In this way, the electronic device displays the second image frame in the first interface, and the second image frame is an image obtained by the second camera sensor using the first output mode.

[0011] In the above embodiment, after enabling the first application (eg, camera sensor), in the scenario of camera switching, the method of configuring camera parameters in camera sensors of different cameras may be different, and it can be compatible with different types of cameras configured in the same device.

[0012] In other exemplary scenarios, the electronic device detects a first operation in which the user indicates to open a first application, and in response to the first operation, displays a first interface, where the first interface is a first type of preview interface provided by the first application. In addition, in response to the first operation, the first configuration parameter and the first data packet may be written to the first camera sensor. Afterwards, the second configuration parameter is written to the first camera sensor. In this way, the first camera sensor may output images in the first output mode, and a first image frame may be displayed in the first interface, where the first image frame is an image obtained by the first camera sensor using the first output mode.

[0013] Afterwards, after the camera sensor of the first camera is replaced by the second camera sensor, the electronic device detects the first operation of the user indicating to open the first application, and displays the first interface in response to the first operation. In addition, in response to the first operation, the first configuration parameter can be written to the second camera sensor. Afterwards, the second configuration parameter is written to the second camera sensor. In this way, the second camera sensor can output the image according to the first output mode, and the second image frame is displayed in the first interface, and the second image frame is an image obtained by the second camera sensor using the first output mode.

[0014] In the above embodiment, in the scenario where the camera sensor of the same camera of the electronic device is replaced, the electronic device can also adapt to different camera sensors and adopt different camera parameter configuration methods to achieve compatibility with different types of camera sensors.

[0015] In some embodiments, the multiple image output modes also include a second image output mode, the multiple groups of configuration parameters in the first data packet also include a third configuration parameter, and after writing the second configuration parameter to the first camera sensor, the method also includes: under a first condition, writing first information to the first camera sensor to indicate that the first camera sensor adopts the second image output mode for image acquisition; wherein the first condition indicates a scene suitable for enabling the second image output mode; the first information includes one or more of the following functional fields: a first switching control configuration field, used to carry a first configuration content indicating execution of seamless switching of the image output mode; a first switching switch field, used to carry information indicating loading of the third configuration parameter, the data size carried by the first switching switch field is smaller than the data size of the third configuration parameter; a first channel switching field, used to indicate the channel identifier corresponding to the configuration of the second image output mode; a first exposure configuration field, used to carry a first exposure parameter matching the current ambient light brightness; a second switching control configuration field, used to carry a second configuration content indicating execution of seamless switching of the image output mode, the first configuration content and the second configuration content are different.

[0016] Exemplarily, the first information may include a first switch field, a first channel switch field, and a first exposure configuration field. In addition, the first information may also include a first switch control configuration field and / or a second switch control configuration field. Of course, the first information may not include the first switch control configuration field and / or the second switch control configuration field, depending on the limitations of the first camera sensor itself.

[0017] In the above embodiment, the first camera sensor can seamlessly switch to the image output mode during image acquisition. In this process, the first information used includes one or more fields selected from the fields of preset types. Among them, the fields of preset types may include the field types required for the switching instructions recognizable by multiple types of camera sensors. In addition, when generating the first information, the electronic device can select the fields recognizable by the first camera sensor from the fields of preset types, so that the generated first information is also recognizable by the first camera sensor.

[0018] In some embodiments, after writing the first information into the first camera sensor, the method further includes: displaying an image captured by the first camera sensor using the second image output mode.

[0019] In some embodiments, after writing the second configuration parameters to the second camera sensor, the method also includes: under the first condition, writing second information to the second camera sensor to indicate that the second camera sensor adopts the second image output mode for image acquisition; the second information includes one or more of the following functional fields: a third switching control configuration field, used to carry the first configuration content indicating the execution of seamless switching of the image output mode; a second switching switch field, used to carry the third configuration parameters; a second channel switching field, used to indicate the channel identifier corresponding to the configuration of the second image output mode; a second exposure configuration field, used to carry the second exposure parameters matching the current ambient light brightness; a fourth switching control configuration field, used to carry the second configuration content indicating the execution of seamless switching of the image output mode.

[0020] In the above embodiment, the second camera sensor can also seamlessly switch to the image output mode during image acquisition. In this process, the second information used is also recognizable by the second camera sensor. In addition, the second information of the second camera sensor can have different configuration content compared with the first information of the first camera sensor. That is, the electronic device can be compatible with the seamless switching mode of different camera sensors.

[0021] In some embodiments, after displaying the first image frame in the first interface, the method further includes: displaying a second interface in response to a second operation, where the second interface is a second type of preview interface provided by the first application; writing a second data packet to the first camera sensor, where the second data packet includes multiple groups of configuration parameters corresponding to multiple image output modes, and the second data packet is different from the first data packet; the multiple groups of configuration parameters in the second data packet include fourth configuration parameters, where the fourth configuration parameters include parameters other than the first configuration parameters among the camera parameters for enabling the third image output mode; writing fifth configuration parameters corresponding to the third image output mode to the first camera sensor, where both the fifth configuration parameters and the fourth configuration parameters can instruct the first camera sensor to enable the third image output mode, the fourth configuration parameters include the fifth configuration parameters, and the data size of the fifth configuration parameters is smaller than the data size of the fourth configuration parameters; displaying the third image frame in the second interface, where the third image frame is an image obtained by the first camera sensor using the third image output mode.

[0022] It is understandable that when the first application switches to enable different camera modes, the preview interface types displayed are different, and the first interface and the second interface are preview interfaces displayed when different camera modes are enabled. The electronic device switches from displaying the first interface to displaying the second interface in response to the second operation, which is essentially switching from one camera mode to another in response to the second operation.

[0023] In the above embodiment, after the camera mode is switched, different methods may be used for different camera sensors to achieve compatibility with different camera sensors.

[0024] In some embodiments, before writing the fifth configuration parameter corresponding to the third image output mode into the first camera sensor, the method further includes: searching for the fifth configuration parameter corresponding to the third image output mode in the camera parameters corresponding to the first camera sensor.

[0025] In some embodiments, after the first image frame is displayed in the first interface, the method further includes: in response to a second operation, displaying a second interface, the second interface being a second type of preview interface provided by the first application; writing a second data packet to the first camera sensor, the second data packet including multiple groups of configuration parameters corresponding to multiple image output modes, the second data packet being different from the first data packet; the multiple groups of configuration parameters in the second data packet including a fourth configuration parameter, the fourth configuration parameter including parameters other than the first configuration parameter among the camera parameters for enabling the third image output mode; the fifth configuration parameter corresponding to the third image output mode is not found, the fifth configuration parameter and the fourth configuration parameter can both indicate that the first camera sensor enables the third image output mode, the fourth configuration parameter includes the fifth configuration parameter, and the data size of the fifth configuration parameter is smaller than the data size of the fourth configuration parameter; writing the fourth configuration parameter corresponding to the third image output mode to the first camera sensor; displaying the third image frame in the second interface, the third image frame being an image obtained by the first camera sensor using the third image output mode.

[0026] In some embodiments, the first type of preview interface includes: any one of a photo preview interface and a video recording interface; the second type of preview interface includes: any one of a photo preview interface and a video recording interface; the first type of preview interface is different from the second type of preview interface.

[0027] In some embodiments, after the second image frame is displayed in the first interface, a second interface is displayed in response to a second operation, and the second interface is a second type of preview interface provided by the first application; fourth configuration parameters corresponding to the third output mode are written to the first camera sensor, and the fourth configuration parameters include parameters of the camera parameters for enabling the third output mode except the first configuration parameters; and a fourth image frame is displayed in the second interface, and the fourth image frame is an image obtained by the second camera sensor using the third output mode.

[0028] In some embodiments, before writing the first data packet to the first camera sensor, the method further includes: finding the first data packet associated with the first camera sensor; after writing the first configuration parameter to the second camera sensor, the method further includes: not finding the first data packet associated with the second camera sensor.

[0029] In some embodiments, before writing the second configuration parameters to the first camera sensor, the method further includes: writing a third exposure parameter to the first camera sensor.

[0030] In a second aspect, an embodiment of the present application provides an electronic device, the electronic device comprising one or more processors and a memory; the memory is coupled to the processor, the memory is used to store computer program code, the computer program code comprises computer instructions, and when one or more processors execute the computer instructions, the one or more processors are used to execute the method in the first aspect and possible embodiments thereof.

[0031] In a third aspect, an embodiment of the present application provides a computer storage medium, comprising computer instructions. When the computer instructions are executed on an electronic device, the electronic device executes the method in the above-mentioned first aspect and possible embodiments thereof.

[0032] In a fourth aspect, the present application provides a computer program product. When the computer program product is run on the above-mentioned electronic device, the electronic device executes the method in the above-mentioned first aspect and possible embodiments thereof.

[0033] It can be understood that the electronic devices, computer storage media and computer program products provided in the above-mentioned aspects are all applied to the corresponding methods provided above. Therefore, the beneficial effects that can be achieved can refer to the beneficial effects in the corresponding methods provided above and will not be repeated here. BRIEF DESCRIPTION OF THE DRAWINGS

[0034] Figure 1 A flowchart for configuring camera parameters in the related art;

[0035] Figure 2A A schematic diagram of the software and hardware structure of an electronic device provided in an embodiment of the present application;

[0036] Figure 2B This is an example diagram of the structure of the sensor driver XML provided in the embodiment of the present application;

[0037] Figure 3 An example diagram of the interaction between various functional modules during the process of configuring camera parameters of the electronic device provided in an embodiment of the present application;

[0038] Figure 4 An example diagram of the interaction between various functional modules in the process of configuring image processing parameters of the electronic device provided in an embodiment of the present application;

[0039] Figure 5 An example diagram of image acquisition by an electronic device provided in an embodiment of the present application;

[0040] Figure 6 An example diagram of a display interface for enabling a camera application provided in an embodiment of the present application;

[0041] Figure 7One of the step flow charts of the camera parameter configuration method provided in an embodiment of the present application;

[0042] Figure 8 One of the signaling interaction diagrams of the camera parameter configuration method provided in an embodiment of the present application;

[0043] Fig. 9 The second step flow chart of the camera parameter configuration method provided in the embodiment of the present application;

[0044] Fig.10 An example diagram of a display interface for seamlessly switching image output modes provided in an embodiment of the present application;

[0045] Fig.11 The second signaling interaction diagram of the camera parameter configuration method provided in the embodiment of the present application;

[0046] Fig.12 The third step flow chart of the camera parameter configuration method provided in the embodiment of the present application;

[0047] Fig.13 An example diagram of a display interface for switching camera modes provided in an embodiment of the present application;

[0048] Fig.14 This is the third signaling interaction diagram of the camera parameter configuration method provided in an embodiment of the present application. DETAILED DESCRIPTION

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

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

[0051] An embodiment of the present application provides a camera parameter configuration method, which is applied to an electronic device with a shooting function.

[0052] Exemplarily, the electronic device may be a desktop, laptop, tablet computer, handheld computer, mobile phone, notebook computer, ultra-mobile personal computer (UMPC), netbook, as well as cellular phone, personal digital assistant (PDA), television, VR device, AR device and other devices with a camera.

[0053] After enabling an application with a shooting function (e.g., a camera application), the electronic device can control the target camera sensor to power on and configure camera parameters in the target camera sensor. Figure 1 As shown, the process of configuring camera parameters is as follows:

[0054] S1, in response to enabling a camera application, the electronic device configures public parameters to a target camera sensor.

[0055] In some embodiments, the electronic device detects an operation instructing a user to run a camera application in the foreground, and enables the camera application. In response to enabling the camera application, the electronic device configures the public parameters to the target camera sensor.

[0056] The target camera sensor may be a camera sensor that is actually required to output images and display them when the camera is applied in the current camera mode.

[0057] It is understandable that the camera application can provide one or more camera modes with different service forms. For example, photo mode, video mode (or high-dynamic video mode), etc. The photo mode refers to the functional mode for taking photos, and the video mode refers to the functional mode for taking videos. The current camera mode refers to the camera mode actually enabled at the current time point.

[0058] In some embodiments, a default camera mode may be configured in the camera modes provided by the camera application. When the camera application is not running, after the electronic device detects an operation indicating the activation of the camera application, the camera application may be run and the default camera mode may be activated. After the default camera mode is activated, the current camera mode may be the default camera mode.

[0059] In addition, before the camera application enters the background, the enabled camera mode may be referred to as camera mode 1. While the camera application is running in the background, in response to the user's instruction to run the camera application in the foreground, the camera application may continue to enable camera mode 1. After camera mode 1 is continued to be enabled, the current camera mode may be camera mode 1. Among them, camera mode 1 and the default camera mode may be the same camera mode or may not be the same camera mode. In addition, while the camera application is running, the current camera mode may also change with the switching of the camera mode.

[0060] The above common parameters can also be called init setting, or init initialization parameters, which are parameters used to implement the initialization of the camera sensor. For example, the above common parameters may include data transmission protocol, internal timing and interrupt frequency, etc. The above configuration common parameters may be instructions for loading common parameters for the camera sensor. The above common parameters are the common parts between the camera parameters of all image output modes supported by the electronic device. After the camera sensor is loaded with the common parameters, it has basic operating capabilities.

[0061] S2, the electronic device configures the target camera sensor with mode parameters corresponding to the image output mode N.

[0062] The image output mode N is an image output mode supported by the current camera mode, and the image output mode N is adapted to the current shooting scene.

[0063] Exemplarily, in the photo mode, the camera sensor in the electronic device supports enabling the Binning output mode, the Idcg output mode, and the Remosaic output mode. In the video recording mode, the camera sensor in the electronic device supports enabling the Binning output mode and the Idcg output mode.

[0064] It can be understood that in Binning output mode, after the camera sensor collects the original pixel array, it adds the induced charges corresponding to adjacent pixels in the original pixel array together as an actual output pixel point. The Binning output mode combines several adjacent pixels as one pixel. In this way, the original image data output by the camera sensor to the camera driver, compared with the original pixel array, maintains the field of view (FOV) unchanged while reducing the output resolution, increasing the photosensitive area, and improving the sensitivity of light sensing in the dark. Usually, Binning output mode is also the default output mode.

[0065] In addition, in the Idcg output mode, the dynamic range of the camera sensor can be improved. The dynamic range is the ability of the camera sensor to simultaneously reflect the highlights and shadows in an image. Among them, the larger the dynamic range of the camera sensor, the stronger the ability of the camera sensor to reflect the highlights and shadows. In the Idcg output mode, the camera sensor uses the same exposure time to synchronously obtain the high gain (high conversion gain, HCG) map and low gain (low conversion gain, LCG) map corresponding to the same frame of raw image data. Then, the camera sensor fuses the high gain map and the low gain map into a frame of image as the raw image data actually output to the camera driver.

[0066] The above-mentioned Idcg output mode has a larger dynamic range than the Binning output mode. Of course, the corresponding power consumption is also higher, about 1.5 times that of the binning output mode.

[0067] In the Remosaic output mode, the camera sensor uses the original pixel array collected by the 4-cell sensor as the original image data output to the camera driver, that is, in the Remosaic output mode, the original image data received by the camera driver is not synthesized by binning pixels. That is, during the activation of the Remosaic output mode, the original image data obtained by the camera driver cannot be directly recognized and processed. The original image data needs to be converted into a standard bayer format image, and this conversion process is called remosaic. Exemplarily, the original image data collected by the camera sensor can be converted into remosaic image data by (sensor front end, SFE). Compared with the original image data obtained in the binning output mode, the above remosaic image data has more pixels and higher definition, and is more suitable for shooting scenes where the user instructs to enlarge the shooting picture (that is, increase the zoom ratio).

[0068] The above-mentioned multiple image output modes each have different advantages and are also suitable for different shooting scenes. For example, the Binning image output mode is suitable for conventional shooting scenes, the Idcg image output mode is suitable for backlit or high-brightness shooting scenes, and the Remosaic image output mode is suitable for shooting scenes where the user instructs to increase the zoom ratio.

[0069] In addition, the above-mentioned mode parameters can also be called mode settings. Different plot modes may have different corresponding mode parameters. For example, the mode setting required to enable the Binning plot mode is different from the mode setting required to enable the Idcg plot mode.

[0070] The same output mode in different camera modes may have different corresponding mode parameters. For example, the mode setting required to enable the Binning output mode in the photo mode may be different from the mode setting required to enable the Binning output mode in the video mode.

[0071] Exemplarily, the above-mentioned mode parameters may include field of view angle, image size, image aspect ratio, frame rate and other parameters. Among them, the above-mentioned other parameters may include: color, data transmission rate, exposure parameters, number of data lines in a frame (FrameLength Lines), the Frame Length Lines includes field blanking, number of pixels in a line of data (Line LengthPCK), the Line Length PCK includes line blanking, cropping parameters, scaling parameters, clock frequency, data transmission rate, phase focus parameters, pixel merging mode, internal timing, effect processing related parameters and DCG related parameters (such as, LCG and HCG internal gain ratio, LCG and HCG image fusion algorithm parameters, etc.) and one or more thereof.

[0072] S3, the electronic device configures the exposure parameters corresponding to the image output mode N to the target camera sensor.

[0073] In some embodiments, the above exposure parameters are determined within the exposure range corresponding to the image output mode N to obtain exposure parameters that are adapted to the current ambient light conditions.

[0074] S4, the electronic device instructs the target camera sensor to collect image data.

[0075] In some embodiments, when the electronic device receives a user's instruction to switch the camera mode, it will also switch the image output mode, such as the so-called start-stop flow switching. During the start-stop flow switching process, it is also necessary to configure the camera parameters to the target camera sensor, and the process is as shown in S5 to S8.

[0076] like Figure 1 As shown, the above method also includes:

[0077] S5, the electronic device instructs the target camera sensor to stop collecting image data in response to the camera application switching the camera mode.

[0078] In some embodiments, the electronic device detects the user's instruction to switch the camera mode, instructs the target camera sensor to stop collecting image data, and switches the camera mode. For example, when the camera application enables camera mode a, the electronic device responds to the user's instruction to enable camera mode b by instructing the target camera sensor to stop collecting image data and switch the camera mode. Among them, camera mode a and camera mode b can be different camera modes.

[0079] S6, the electronic device configures mode parameters corresponding to the image output mode M to the target camera sensor.

[0080] The image output mode M may be an image output mode supported by the switched camera mode, and the image output mode M is adapted to the current shooting scene. Continuing with the above example, in response to the user indicating to enable camera mode b, an image output mode adapted to the current shooting scene may be selected from the image output modes supported by camera mode b.

[0081] S7, the electronic device configures the exposure parameters corresponding to the image output mode M to the target camera sensor.

[0082] S8, the electronic device instructs the target camera sensor to collect image data.

[0083] In other embodiments, the electronic device can also switch the image output mode in the same camera mode according to the change of zoom ratio and the change of ambient light conditions, such as seamless switching. During the seamless switching process, it is also necessary to configure the camera parameters to the target camera sensor, and the process is as shown in S9-S10.

[0084] like Figure 1 As shown, after S4, the above method may further include:

[0085] S9, in response to determining that seamless switching to the image output mode P is required, configuring mode parameters corresponding to the image output mode P to the target camera sensor.

[0086] S10, configuring exposure parameters corresponding to the image output mode P to the target camera sensor.

[0087] However, when camera sensors provided by different manufacturers use the same image output mode, the camera parameters required to be configured in different configuration stages may be different. The different configuration stages include:

[0088] Phase 1: When the camera mode (photo mode, video mode, etc.) is enabled, the initial parameters are configured, which can also be called the initialization configuration phase. For example, Figure 1 Step S1 in .

[0089] Phase 2: When the camera mode (photo mode, video mode, etc.) is enabled, the mode parameters are configured. For example, Figure 1 Step S2 in .

[0090] Phase 3: When performing seamless switching, for example, in the scenario of switching between different image output modes within the same camera mode, the phase of configuring mode parameters is also called seamless configuration phase. Seamless switching means that the camera sensor switches the image output mode without stopping the flow. For example, corresponding to Figure 1 Step S9 in .

[0091] Phase 4: When performing non-seamless switching, for example, when switching camera modes, the phase of configuring mode parameters is also called the non-seamless configuration phase. For example, corresponding to Figure 1 Step S6 in .

[0092] There is no necessary order among the above four configuration stages. During the operation of the electronic device, the process of configuring the camera parameters is executed in different configuration stages according to the actual application scenarios.

[0093] For example, in stage 1 and stage 2, camera parameters corresponding to a graphics output mode are configured to enable the graphics output mode.

[0094] For another example, after enabling one output mode (e.g., after completing camera parameter configuration in stages 1 and 2), in stage 3, configure the camera parameters corresponding to another output mode to achieve seamless switching between output modes.

[0095] For another example, after enabling one output mode (eg, after completing camera parameter configuration in stages 1 and 2), in stage 4, camera parameters corresponding to another output mode are configured to achieve non-seamless switching between output modes.

[0096] It can be understood that the above “enabling camera mode” may refer to enabling the default camera mode or enabling camera mode 1 when an application with shooting capability is switched to the foreground. The above “switching camera mode” may refer to switching from one camera mode to another camera mode while an application with shooting capability is running in the foreground.

[0097] Exemplarily, some camera sensors only need to configure common parameters in stage 1. Other camera sensors need to configure not only common parameters but also mode parameters of all image output modes that can be switched under the current camera mode (enabled camera mode) in stage 1.

[0098] As another example, some camera sensors only need to configure the simplified version of the mode parameters in stage 4. Another part of the camera sensors need to configure the full version of the mode parameters in stage 4. The full version of the mode parameters include the simplified version of the mode parameters, but the simplified version of the mode parameters contains less data than the full version of the mode parameters.

[0099] In addition, before stage 4, some camera sensors also need to determine the mode parameters of all image output modes that are configured in the camera sensor under the current camera mode (camera mode after switching) and support switching.

[0100] As another example, different camera sensors need to send switching instructions with different contents in stage 3.

[0101] In addition, the data volume of the switching instructions corresponding to some camera sensors is much smaller than the mode parameters corresponding to the specified output mode. This type of switching instruction changes the value of a specific register 1 in the camera sensor, so that the camera sensor loads the mode parameters corresponding to the specified output mode from the pre-configured mode parameters. The switching instructions corresponding to another part of the camera sensors carry the mode parameters corresponding to the specified output mode.

[0102] It can be seen that camera sensors from different manufacturers have different requirements at different configuration stages. Figure 1 The camera parameter configuration method shown is difficult to simultaneously meet the requirements of multiple types of camera sensors, resulting in a limitation in the camera sensor models that can be configured for the same electronic device.

[0103] In order to solve the above problems, the embodiment of the present application further provides a camera parameter configuration method, which can be applied to electronic devices. The above electronic devices can take into account the different requirements of multiple types of camera sensors in the camera parameter configuration process, and increase the number of camera sensor types that can be configured in the electronic device.

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

[0105] Understandably, Figure 2A This is just an example, that is, the layers divided in the electronic device are not limited to Figure 2A The layers shown, for example, between the application framework layer and the HAL layer, may also include an Android runtime and system libraries layer, etc.

[0106] Exemplarily, the application layer may include a series of application packages. Figure 2A As shown, the application layer may include a camera application. Of course, in addition to the camera application, the application layer may also include other application packages, such as a gallery application, a video application, and the like.

[0107] Generally speaking, the application is developed using the Java language and is completed by calling the application programming interface (API) and programming framework provided by the application framework layer. Exemplarily, the application framework layer includes some predefined functions.

[0108] like Figure 2A As 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, a resource manager, a notification manager, a window manager, a view system, a phone manager, etc. Similarly, the camera application may also call the content provider, the resource manager, the notification manager, the window manager, the view system, etc. according to actual business needs, and the embodiments of the present application do not impose any restrictions on this.

[0109] The kernel layer mentioned above is the layer between hardware and software. Figure 2A As shown, the kernel layer at least includes a linux video device driver (Video for linux2, V4L2), a camera request manager (camera request manager, CRM), a camera driver, and an ISP driver.

[0110] The V4L2 can be called by the HAL layer. The CRM is used to manage the drivers corresponding to the camera-related devices in the kernel layer, such as the camera driver and the ISP driver. In some examples, the HAL can instruct the CRM to manage the drivers corresponding to the camera-related devices through V4L2.

[0111] The camera driver can be used to drive a hardware module with a shooting function, such as a camera sensor. The ISP driver is used to drive the SFE in the ISP chip. In other words, the camera driver is responsible for data interaction with the camera sensor. Of course, the kernel layer can also include driver software such as an audio driver and a sensor driver, and the present application embodiment does not impose any restrictions on this.

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

[0113] like Figure 2A As shown, the above HAL layer may include an image processing module, a decision module, a CAMX architecture, a user-mode driver, a sensor driver XML, and a sensor fast switching interface component.

[0114] Exemplarily, the image processing module may include multiple types of image processing algorithms. The image processing module may perform one or more image processing operations on the image data sent back by the camera sensor, such as filtering, denoising, adding pre-configured filters, and performing image detail restoration on the image data.

[0115] As another example, the above-mentioned decision module may be a multi-camera decision module, which may determine the camera sensor that actually performs image acquisition based on the scene information, such as a target camera sensor, and the target camera sensor may be a front camera sensor, a rear camera sensor, etc. in an electronic device. In addition, the decision module may also determine the target image output mode that the target camera sensor needs to enable. Among them, the image output modes that can be enabled by the camera sensor may include Binning image output mode, Idcg image output mode, and Remosaic image output mode, etc. The above-mentioned target image output mode may be one of the image output modes that can be enabled by the target camera sensor in the current camera mode. In addition, the method of selecting the target image output mode may be selected in combination with the shooting scene, shooting parameters (zoom ratio), etc. The implementation details may refer to the description in the subsequent embodiments, which will not be repeated here.

[0116] As another example, the CAMX architecture is a logical architecture layer in the HAL layer, and the CAMX architecture includes a sensor node and an image front end (IFE) node. Among them, the sensor nodes in the CAMX architecture correspond one-to-one to the camera sensors in the electronic device, and the sensor nodes can configure the camera sensor to enable the specified image output mode. For example, the sensor node can pass the camera parameters required to enable the target image output mode to the target camera sensor, so that the target camera sensor uses the target image output mode to output the image. The above-mentioned IFE node is used to configure the preprocessing parameters required for the SFE operation, so that the SFE can preprocess the preview stream collected by the target camera sensor according to the target image output mode. For example, the preview stream and the image frames of the video stream are subjected to color correction, downsampling, de-mosaicing and other processing.

[0117] In addition, the CAMX architecture also includes a CAMX conversion interface (camera serial interface decoder, CSL). The CAMX CSL can receive camera parameters from the sensor node and convert them into I / O control instructions recognizable by the kernel layer. In addition, the CAMX CSL can also instruct the CRM to pass the I / O control instructions corresponding to the camera parameters to the corresponding camera driver through V4L2 in the kernel layer, and the camera driver writes the I / O control instructions corresponding to the camera parameters into the camera sensor, so that the camera sensor outputs images according to the specified output mode.

[0118] The CAMX CSL receives the preprocessing parameters from the IFE node and converts them into I / O control instructions that can be recognized by the kernel layer. Then, through V4L2, it instructs the CRM to pass the I / O control instructions corresponding to the preprocessing parameters to the corresponding ISP driver, and the ISP driver writes the I / O control instructions corresponding to the preprocessing parameters into the SFE, so that the SFE has the ability to preprocess the image frames collected according to the target output mode.

[0119] In another exemplary embodiment, the user-mode driver is a driver program running in the user space of the electronic device, and the user-mode driver includes an XML query interface for querying various XML files stored in the user space. For example, Figure 2A The sensor XML interface shown. For example, Figure 2A Product, module, eeprom, etc. are not shown in the figure, where Product can be used to query product information of electronic equipment. Module is used to query relevant information of different camera modules (including camera sensor chips, lenses, motors, eeprom storage modules, etc.). Eeprom is used to query the configuration information of the eeprom external storage module. For details, please refer to the relevant technology, which will not be repeated here.

[0120] The sensor XML interface is used to query the private information of different camera sensor chips and pre-configured sensor driver XML. A camera sensor can correspond to multiple sensor driver XMLs, and each sensor driver XML of the camera sensor corresponds to a camera mode.

[0121] Taking the sensor driver XML of the target camera sensor as an example, the sensor driver XML corresponding to the target camera mode includes: the target camera sensor sets the camera parameters required for each image output mode in the target camera mode. Setting the image output mode may include: setting the image output mode when the target camera mode is enabled (that is, setting the image output mode of the target camera sensor through stages 1 and 2), setting the image output mode when switching from other image output modes to the target camera mode (that is, setting the image output mode of the target camera sensor through stage 4); setting the image output mode when the target camera sensor is not streaming (that is, setting the image output mode of the target camera sensor through stage 3).

[0122] like Figure 2B As shown, the sensor driver XML corresponding to the target camera mode includes common parameters corresponding to the target camera sensor and mode parameters corresponding to each image output mode supported by the target camera mode.

[0123] like Figure 2BAs shown, the sensor driver XML corresponding to the target camera mode also includes a CommonModeSwitchInfo file, a ModeSwitchInfo file corresponding to the target image output mode, and a ModeSwitchInfo file corresponding to other image output modes. The above CommonModeSwitchInfo file is a camera parameter configuration file applicable to all image output modes supported in the target camera mode. The ModeSwitchInfo file of the target image output mode is a camera parameter configuration file applicable to configuring the target image output mode, and the ModeSwitchInfo file of other image output modes is a camera parameter configuration file applicable to configuring other image output modes.

[0124] It can be understood that the target camera sensor can support multiple image output modes in the target camera mode. Figure 2B The other output modes in the target camera mode refer to other types of output modes that can be enabled in the target camera mode in addition to the target output mode. Figure 2B Only one other image output mode is shown, but it is not limited thereto. The sensor driver XML only includes a mode parameter of one other image output mode and a ModeSwitchInfo file of one other image output mode.

[0125] In some embodiments, when setting the target graphics output mode, the CommonModeSwitchInfo file, the ModeSwitchInfo file corresponding to the target graphics output mode, the common parameters and the mode parameters corresponding to the target graphics output mode, etc. can be used.

[0126] In addition, when setting other plotting modes, you can also use CommonModeSwitchInfo files, ModeSwitchInfo files corresponding to other plotting modes, common parameters, and mode parameters corresponding to other plotting modes.

[0127] The CommonModeSwitchInfo file may include the camera parameters required for each output mode corresponding to the target camera mode in phase 1 (initialization configuration phase), and the camera parameters required for each output mode corresponding to the target camera mode in phase 3 (seamless configuration phase).

[0128] Exemplarily, if the target camera sensor needs to pre-store mode parameters of all image output modes supported by the target camera mode (such as camera parameter package a or camera parameter package in the init stage) before enabling any image output mode in the target camera mode, the CommonModeSwitchInfo file may include camera parameter package a.

[0129] It can be understood that pre-storing the camera parameter package a is a step that needs to be performed in stage 1. The above-mentioned camera parameter package a can also be called the camera parameters required in the initialization configuration stage.

[0130] If the target camera sensor does not need to pre-store the camera parameter package a of the target camera mode before enabling the image output mode of the target camera mode, the camera parameter package a is not included in the CommonModeSwitchInfo file.

[0131] In addition, when the CommonModeSwitchInfo file of the target camera mode includes the camera parameter package a, it can also be said that all image output modes in the target camera mode correspond to the camera parameter package a.

[0132] As another example, the CommonModeSwitchInfo file may also include camera parameters required for the seamless configuration phase (e.g., camera parameter b). The camera parameter b may be used to configure a switching instruction, which is used to instruct the target camera sensor to switch to any image output mode supported by the target camera mode through seamless.

[0133] If the target camera sensor is in the target camera mode, the switching instruction used to switch any image output mode must carry the switching control configuration field 1, and the camera parameter b includes the configuration content of the switching control configuration field 1. The content and function of the switching control configuration field 1 are introduced in subsequent embodiments and will not be repeated here.

[0134] If the target camera sensor is in the target camera mode, the switching instruction for switching the image output mode is not restricted to carry the switching control configuration field 1, and the camera parameter b does not contain the configuration content of the switching control configuration field 1.

[0135] If the target camera sensor is in the target camera mode, the customized configuration content is restricted to indicate the switching of the output channel. The camera parameter b includes configuration content related to the channel switching field (a field indicating the switching of the output channel), such as the so-called customized configuration content. The content and function of the channel switching field are introduced in subsequent embodiments and will not be repeated here.

[0136] If the target camera sensor is in the target camera mode, there is no restriction on using customized configuration content, indicating switching of the output channel, and the camera parameter b does not contain configuration content related to the channel switching field (a field indicating switching of the output channel).

[0137] If the target camera sensor is in the target camera mode, the switching instruction used to switch any image output mode must carry the switching control configuration field 2, and the camera parameter b includes the configuration content of the switching control configuration field 2. The content and function carried by the switching control configuration field 2 will be introduced in subsequent embodiments and will not be repeated here.

[0138] If the target camera sensor is in the target camera mode, the switching instruction for switching the image output mode is not restricted to carry the switching control configuration field 2, and the camera parameter b does not contain the configuration content of the switching control configuration field 2.

[0139] The ModeSwitchInfo file may include camera parameters (eg, camera parameters c) required for the target output mode in phase 4 (non-seamless configuration phase), and camera parameters (eg, camera parameters d) required for the target output mode in phase 3 (seamless configuration phase).

[0140] like Figure 2B As shown, in the scenario where the camera application switches from other camera modes to the target camera mode and the target image output mode needs to be enabled, if the target camera sensor supports starting the target image output mode by loading the simplified version of the mode parameters, the ModeSwitchInfo file corresponding to the target image output mode may include the simplified version of the mode parameters. If the target camera sensor does not support starting the target image output mode by loading the simplified version of the mode parameters, the ModeSwitchInfo file corresponding to the target image output mode may not include the simplified version of the mode parameters.

[0141] In the scenario where you need to switch from other seamless output modes to the target output mode, if the target camera sensor limits the switching instruction used, the switching control configuration field 1 must be carried, and the camera parameter d contains the switching control configuration field 1. If the target camera sensor does not limit the switching instruction used, the switching control configuration field 1 must be carried, and the camera parameter d does not contain the switching control configuration field 1.

[0142] In the scenario where you need to switch from other seamless output modes to the target output mode, if the target camera sensor limits the switching instruction used, the switching control configuration field 2 must be carried, and the camera parameter d contains the switching control configuration field 2. If the target camera sensor does not limit the switching instruction used, the switching control configuration field 2 must be carried, and the camera parameter d does not contain the switching control configuration field 2.

[0143] It can be understood that in the sensor driver XML of some camera sensors, the configuration content of the switching control configuration field 1 may be included only in the camera parameter d (such as configuration content 201), and in the sensor driver XML of some camera sensors, the configuration content of the switching control configuration field 1 may be included only in the camera parameter b (such as configuration content 202). The sensor driver XML of some camera sensors may also include both the configuration content 201 and the configuration content 202. The sensor driver XML of some camera sensors may also exclude both the configuration content 201 and the configuration content 202.

[0144] The above configuration content 201 and configuration content 202 have the same function, but the configuration content may be different. In addition, the priority of configuration content 201 is higher than that of configuration content 202. The following are several examples to illustrate that the priority of configuration content 201 is higher than that of configuration content 202:

[0145] For example, in the sensor driver XML, the camera parameter d includes configuration content 201, and the camera parameter b corresponding to the target camera mode also includes configuration content 202. The switching instruction indicating seamless switching to the target image output mode carries the configuration content 201 in the camera parameter d.

[0146] For example, the camera parameter d corresponding to the target image output mode does not include configuration content 201, the camera parameter b corresponding to the target camera mode includes configuration content 202, and the switching instruction indicating seamless switching to the target image output mode carries the configuration content 202 in the camera parameter b.

[0147] For example, the camera parameter d corresponding to the target image output mode includes configuration content 201, and the camera parameter b corresponding to the target camera mode does not include configuration content 202. The switching instruction indicating seamless switching to the target image output mode carries the configuration content 201 in the camera parameter d.

[0148] For another example, the camera parameter d corresponding to the target image output mode does not include the configuration content 201, and the camera parameter b corresponding to the target camera mode does not include the configuration content 202. The switching instruction indicating seamless switching to the target image output mode does not include the switching control configuration field 1.

[0149] Similarly, in the sensor driver XML of some camera sensors, the configuration content of the switching control configuration field 2 may be included only in the camera parameter d (such as configuration content 203), and in the sensor driver XML of some camera sensors, the configuration content of the switching control configuration field 2 may be included only in the camera parameter b (such as configuration content 204). The sensor driver XML of some camera sensors may also include both the configuration content 204 and the configuration content 203. The sensor driver XML of some camera sensors may also exclude both the configuration content 204 and the configuration content 203.

[0150] In addition, if the target camera sensor supports seamless switching to the target image output mode by configuring the value of a specific register 1, the camera parameter d may also include the configuration content of the switch field.

[0151] If the target camera sensor does not support seamless switching to the target image output mode by configuring the value of specific register 1, the camera parameter d does not include the configuration content of the switch field.

[0152] The sensor driver XML of the target camera mode can also include ModeSwitchInfo files for other output modes. The ModeSwitchInfo files for other output modes are similar to the ModeSwitchInfo files for the target output mode, and the configuration content is only related to the restrictions that exist when the target camera sensor enables other output modes.

[0153] Exemplarily, the sensor fast switching interface component is used to determine the current configuration stage, and according to the configuration stage, the target camera mode and the target image output mode, query the adapted camera parameters from the corresponding sensor driver XML through the sensor XML interface, and then directly feed back the adapted camera parameters to the sensor node, and write the camera parameters to the target camera sensor through the sensor node. Of course, in the case of seamless switching, the sensor fast switching interface component can also generate a switching instruction based on the found camera parameters, and send the switching instruction to the target camera sensor through the sensor node, instructing the target camera sensor to switch the image output mode without stopping the flow.

[0154] in addition, Figure 2A The hardware modules that can be driven in the hardware layer are also shown in the example, such as the target camera sensor, SFE, etc. Of course, the hardware layer can also include Figure 2A Hardware modules not shown include, for example, a camera, a processor, a memory, etc., and, for example, other camera sensors except the target camera sensor.

[0155] In some embodiments, the software and hardware structures of the electronic device are as follows: Figure 2A In the case shown, after the electronic device enables an application with a shooting function (such as a camera application), it can dynamically adjust the image output method of the target camera sensor according to information such as the camera mode and zoom ratio of the camera application.

[0156] like Figure 3 As shown, the camera application can send information such as camera mode and zoom ratio to the camera service. For example, when the camera application responds to user operations and switches from a non-running state or a background running state to a foreground running state, the camera mode and zoom ratio can be sent to the camera service. For another example, when the camera application is running in the foreground, in response to user operations, the camera mode is switched, or the zoom ratio is adjusted, the switched camera mode and / or the adjusted zoom ratio can also be sent to the camera service.

[0157] like Figure 3 As shown, after receiving information such as camera mode and zoom ratio, the camera service passes it to the decision module.

[0158] In this way, after the decision module obtains information such as camera mode and zoom ratio, it can select the target output mode suitable for the current shooting scene and determine the target camera sensor in the output modes supported by the camera mode in combination with the zoom ratio.

[0159] Afterwards, if Figure 3 As shown, the decision module notifies the sensor node corresponding to the target camera sensor, instructing the target camera sensor to enable the target image output mode. The sensor node can respond to the notification and control the process of writing camera parameters to the target camera sensor. For example, according to the configuration stage and the target image output mode, the sensor fast switching interface component is instructed to call the sensor interface in the user state driver, and obtain the camera parameters adapted to the current configuration stage from the sensor driver XML corresponding to the target camera sensor. The specific process can refer to the description in the subsequent embodiments and will not be repeated here. After the sensor fast switching interface component obtains the camera parameters adapted to the current configuration stage, if the current configuration stage is stage 1, stage 2 or stage 4, the camera parameters can be directly passed to the sensor node. If the current configuration stage is stage 3, the corresponding switching instruction can be generated based on the camera parameters (the specific implementation process can refer to the subsequent embodiments, which will not be repeated here), and passed to the sensor node.

[0160] like Figure 3As shown, the sensor node passes the above camera parameters (or switching instructions) to CSL, which converts the camera parameters (or switching instructions) into I / O control instructions recognizable by the kernel layer and passes them to CRM through V4L2. CRM then passes the I / O control instructions indicating the above camera parameters (or switching instructions) to the target camera sensor through the camera driver.

[0161] In other embodiments, the software and hardware structures of the electronic device are as follows: Figure 2A In the case shown, in addition to dynamically adjusting the image output mode of the target camera sensor, it is also necessary to dynamically adjust the preprocessing parameters of the SFE (such as image processing parameters) so that the SFE can process the image data collected by the target camera sensor according to the target image output mode.

[0162] like Figure 4 As shown, after the decision module determines the target image output mode according to information such as the camera mode and zoom ratio, the decision module can also notify the IFE node to determine the image processing parameters corresponding to the target image output mode, such as image size, processing method, etc. For example, for the Remosaic image output mode, the corresponding processing method can be to convert the original image data into an image in the standard bayer format.

[0163] Then, the IFE node passes the image processing parameters to the CSL, which converts the image processing parameters into I / O control instructions recognizable by the kernel layer and passes them to the CRM through V4L2. The CRM then passes the I / O control instructions indicating the above image processing parameters (or switching instructions) to the SFE through the ISP driver.

[0164] After configuring the target image output mode and adjusting the image processing parameters corresponding to SFE, the target camera sensor can start streaming. Figure 5 As shown, the target camera sensor performs image acquisition according to the target output mode and sends the acquired raw image data to SFE. After the raw image data is pre-processed by SFE, it is passed to CSL via ISP driver, CRM, and V4L2. Afterwards, CSL passes the pre-processed image data to the image processing module through the sensor node and IFE node. In this way, the image processing module can perform one or more image processing on the image data. Then, the image processing module passes the processed image data to the camera application through the camera service, so that the target camera sensor sends the acquired image data for display according to the target output.

[0165] The following describes the implementation details of the camera parameter configuration method provided by the embodiments of the present application in different scenarios in conjunction with the accompanying drawings.

[0166] In some embodiments, the electronic device may configure camera parameters after enabling an application with a shooting function (eg, a camera application).

[0167] like Figure 6 As shown, after the electronic device is unlocked, a main interface 601 can be displayed. The main interface 601 includes an application icon 602 of a camera application. In a scenario where the camera application is not included in the background applications of the electronic device, that is, when the camera application is not running, the electronic device can enable the camera application after detecting a user click operation on the application icon 602. For example, in response to a user operation on the application icon 602, the electronic device can display a waiting interface provided by the camera application, such as interface 603. When the default camera mode is the photo mode, the interface 603 can be an application interface corresponding to the photo mode. When the interface 603 is displayed, the camera sensor has not yet sent back the original image data, that is, there is no image frame to be displayed in the above interface 603.

[0168] In other embodiments, in a scenario where the background applications of an electronic device include a camera application, if the recording mode is enabled before the camera application enters the background, that is, camera mode 1 is the recording mode, the electronic device may receive a user click operation on the application icon 602 and may also display a waiting interface, which is the application interface corresponding to the recording mode.

[0169] In other possible embodiments, the electronic device may receive a long press operation of the user on the application icon 602 during the display of the main interface 601. In this way, the electronic device may display a mode selection window relative to the application icon 602, and the mode selection window includes a mode control indicating each camera mode. In this scenario, the electronic device may receive the user's operation on any mode control and determine the camera mode selected by the user. For example, the electronic device receives the user's operation on the mode control indicating the video recording mode, and may display the waiting interface corresponding to the video recording mode. In addition, in addition to clicking the application icon 602, in the scenario where the background application of the electronic device includes a camera application, the electronic device may be instructed to display the above-mentioned waiting interface by operating the multitasking interface. Of course, when the background application of the electronic device does not include the camera application, the electronic device may be instructed to display the waiting interface corresponding to the default camera mode by operating the camera shortcut key. In addition, it is also possible to analyze whether the camera application needs to be opened by recognizing the voice instructions spoken by the user, or by detecting the gestures made by the user. For example, if the user speaks the keywords "camera", "shooting", etc., it can be determined that the camera application needs to be opened and the corresponding waiting interface is displayed. For another example, if it is recognized that the user makes a gesture action associated with the camera application, it can also be determined that the camera application needs to be opened, and the corresponding waiting interface is displayed. In addition, the gesture action associated with the camera application can be pre-set.

[0170] In some embodiments, the electronic device may configure the camera parameters after the camera application is run to instruct the camera sensor to start collecting raw image data. Figure 7 As shown, the above camera parameter configuration method may include:

[0171] S101, the electronic device detects an operation instructing to start a camera application.

[0172] In some embodiments, the above operation may be a click operation of the user on the camera icon.

[0173] In other embodiments, the above operation may also be a long press operation of the camera icon by the user. Of course, when the electronic device receives the long press operation of the camera icon by the user, it may also display a mode selection window. The mode selection window includes mode controls indicating various camera modes. After the camera application determines that the user has selected a mode control of any camera mode, the process may also enter S102.

[0174] It is understandable that the above S101 is only an example. During actual use, the electronic device can also instruct the process to enter S102 based on other operations of the user. For example, the user operates window 1 in the multitasking interface, wherein the window 1 displays a thumbnail of the application interface of the camera application. For another example, the user clicks on the shortcut entry of the camera application (for example, the camera shortcut entry displayed in the negative one screen of the electronic device). For another example, the electronic device detects that the user says keywords related to the camera application, or detects that the user makes gestures related to the camera application, etc., and can also indicate that the process can enter S102.

[0175] S102, the electronic device determines a target camera mode 1, a target camera sensor, and a target image output mode 1 to be enabled.

[0176] In some embodiments, the target camera mode 1 refers to the camera mode to be enabled when the camera application is enabled, and may also be referred to as the current camera mode. In different scenarios, the camera mode to be enabled when the camera application is enabled may be different. The target camera sensor may be the camera sensor enabled under the target camera mode 1.

[0177] For example, when the electronic device does not run a camera application, after the electronic device starts the camera application, the camera application may determine that a default camera mode needs to be enabled (for example, the default camera mode may be preconfigured as a photo mode), so that the current camera mode is the default camera mode. The target camera sensor may be a camera sensor that can be enabled in the default camera mode.

[0178] As another example, a camera application is running in the background of the electronic device, and the camera application determines that the most recently used camera mode needs to be enabled, that is, the camera mode 1 mentioned in the above embodiment. The above-mentioned target camera sensor may be a camera sensor that can be enabled in camera mode 1. For example, the target camera sensor may be a camera sensor that is enabled by default when camera mode 1 is enabled. For another example, the target camera sensor may be a camera sensor that is enabled in response to a user instruction during the operation of camera mode 1.

[0179] In the scenario where the electronic device starts the camera application in response to the operation of the camera mode selected by the user, the camera application can determine that the selected camera mode needs to be enabled. In this scenario, the current camera mode is the camera mode selected by the user. The target camera sensor can be a camera sensor that can be enabled in the camera mode selected by the user.

[0180] It is understandable that when an electronic device is equipped with multiple cameras, the camera application uses different camera modes and the available cameras are different. For example, the electronic device includes front camera 1, front camera 2, rear camera 1, rear camera 2, and rear camera 3. In the photo mode, the available cameras are the front camera 1, rear camera 1, rear camera 2, and rear camera 3 of the electronic device. In the video recording mode, the available cameras are the front camera 1 and rear camera 1 of the electronic device.

[0181] In this way, when the current camera mode is the photo mode, the target camera sensor may be one of the camera sensors corresponding to the front camera 1 , the rear camera 1 , the rear camera 2 , and the rear camera 3 .

[0182] For example, when the photo mode is enabled or when the photo mode is switched from another camera mode, the target camera sensor may be the camera sensor of the camera enabled by default in the photo mode, such as the camera sensor of the rear camera 1. For another example, during the photo mode, in response to the user's instruction to enable the front camera 1, it is determined that the target camera sensor is changed to the camera sensor of the front camera 1.

[0183] When the current camera mode is the video recording mode, the target camera sensor may be one of the camera sensors corresponding to the front camera 1 and the rear camera 1 .

[0184] In addition, the above-mentioned target image output mode 1 is one of the image output modes supported by the target camera sensor. In some embodiments, the electronic device can select an image output mode suitable for the current shooting scene from the image output modes supported by the target camera mode 1 in combination with the current zoom ratio, ambient light brightness value, etc., as the target image output mode 1.

[0185] S103, after controlling the target camera sensor to be powered on, the electronic device configures common parameters to the target camera sensor.

[0186] In some embodiments, the electronic device may only control the target camera sensor to power on and configure common parameters in the target camera sensor.

[0187] In other embodiments, when the electronic device is configured with multiple camera sensors, the electronic device may also initiate the operation of the camera application in response to the above instructions, control all camera sensors of the electronic device to power on, and configure common parameters for all camera sensors, which is not specifically limited in the embodiments of the present application.

[0188] S104, the electronic device determines whether the target camera mode 1 corresponds to a camera parameter package a, wherein the camera parameter package a includes mode parameters corresponding to multiple image output modes.

[0189] It can be understood that the electronic device can be configured with sensor driver XMLs for all types of camera sensors supported by the electronic device.

[0190] In some embodiments, the electronic device can find the sensor driver XML corresponding to the target camera mode 1 from the sensor driver XML corresponding to the target camera sensor, such as target sensor driver XML1. Then, in the target sensor driver XML1, find whether there is a camera parameter package a. For example, search for camera parameter package a in the CommonModeSwitchInfo file of the target sensor driver XML1.

[0191] If the CommonModeSwitchInfo file of the target sensor driver XML1 contains camera parameter package a, it is determined that the target camera mode 1 corresponds to camera parameter package a, and the process proceeds to S105. If the CommonModeSwitchInfo file of the target sensor driver XML1 contains camera parameter package a, it is determined that the target camera mode 1 does not have a corresponding camera parameter package a, and the process skips S105 and directly proceeds to S106.

[0192] It can be understood that if the camera sensor has a restriction of pre-storing the camera parameter package a corresponding to the target camera mode 1 before enabling any image output mode supported by the target camera mode 1, the target sensor driver XML1 may include the camera parameter package a. If the camera sensor does not have a restriction of pre-storing the mode parameters of the image output mode before enabling the image output mode supported by the target camera mode 1, the target sensor driver XML1 may not include the camera parameter package a.

[0193] In some embodiments, the camera parameter package a includes the mode parameters of the image output mode supported by the target camera mode 1. In this way, the camera parameter packages a corresponding to different camera modes may be different. In other embodiments, the camera parameter package a may include the mode parameters of the image output mode supported by all camera modes. In this way, the camera parameter packages a corresponding to all camera modes are the same.

[0194] S105 , the electronic device configures a camera parameter package a corresponding to the target camera mode 1 to the target camera sensor.

[0195] In some embodiments, the camera parameter package a can be written into the target camera sensor, for example, written into the sensor memory of the target camera sensor, and the mode parameters of all enabled image output modes are pre-stored. After the mode parameters of multiple image output modes (e.g., all image output modes supported by the target camera sensor) are pre-stored in the sensor memory, when the electronic device instructs the target camera sensor to perform seamless switching, the switching instruction with a data size smaller than the mode parameter can be written into the target camera sensor to achieve seamless switching, thereby reducing the time consumption of writing the switching instruction into the target camera sensor.

[0196] S106, the electronic device configures mode parameters corresponding to target image output mode 1 in the target camera sensor.

[0197] In the above embodiment, by determining whether the camera parameter package a exists in the target sensor driver XML1, it is possible to be compatible with camera sensors with different restrictions in the initialization configuration phase when the target camera mode 1 is enabled.

[0198] As an implementation method, the implementation details of the above S101 to S106 are as follows: Figure 8 As shown:

[0199] S201 , in response to an operation instructing to start a camera application, running the camera application and determining a target camera mode 1 to be enabled.

[0200] Exemplarily, the camera application can determine the camera mode to be enabled according to the running state before enabling (background running or not running), that is, the target camera mode 1. For specific details, please refer to the description of the aforementioned embodiment and will not be repeated here.

[0201] S202 , the camera application sends a mode identifier 1 and a zoom factor 1 corresponding to a target camera mode 1 to the camera service.

[0202] The mode identifier 1 is an identifier indicating the target camera mode 1, and the zoom ratio 1 may be a default zoom ratio corresponding to the target camera mode 1, that is, a zoom ratio configured by default when the target camera mode 1 is enabled. Of course, after the target camera mode 1 is enabled, the zoom ratio may also be changed in response to a user operation.

[0203] S203, the camera service sends a mode identifier 1 and a zoom factor 1 to the decision module.

[0204] S204, the decision module determines the target camera sensor and the target image output mode 1.

[0205] In some embodiments, the decision module may determine the target camera sensor according to the camera mode indicated by the mode identifier 1 (i.e., the target camera mode 1). When no instruction to switch the camera is received, the target camera sensor is the camera sensor of the camera enabled by default in the target camera mode 1. In addition, the above S201 to S204 correspond to Figure 7 S101 and S102 in.

[0206] S205 , the decision module instructs the sensor node to control the target camera sensor to power on.

[0207] S206 , the sensor node instructs the target camera driver to control the target camera sensor to power on.

[0208] In some embodiments, the sensor node can convert the power-on instruction into an I / O control instruction recognizable by the kernel layer through CSL, and pass it to CRM through V4L2, and then pass it to the target camera driver by CRM.

[0209] It is understandable that if multiple camera sensors are configured in an electronic device, multiple camera drivers will also be configured in the electronic device. One camera driver controls one camera sensor. The camera driver corresponding to the target camera sensor may also be referred to as the target camera driver.

[0210] S207, the target camera driver controls the target camera sensor to power on.

[0211] S208, the target camera sensor is powered on.

[0212] In some other embodiments, all camera sensors that can be enabled in the target camera mode 1 may be powered on synchronously.

[0213] S209, the decision module may also send a mode identifier 1 and an output image identifier 1 to the sensor node.

[0214] The above-mentioned mode identification 1 is an identification indicating the target image output mode 1. The above-mentioned image output identification 1 is an identification indicating the target image output mode 1.

[0215] In some embodiments, after instructing the sensor node to control the target camera sensor to power on, the decision module sends the above-mentioned mode identification 1 and image output identification 1 to the sensor node. By sending the above-mentioned mode identification 1 and image output identification 1, the sensor node is instructed to configure the corresponding camera parameters in the target camera sensor. In this way, the target camera sensor can perform image acquisition according to the target image output mode 1 determined by the decision module.

[0216] It can be understood that each camera sensor corresponds to a sensor node, and the sensor nodes mentioned in the above S209 and subsequent embodiments are all sensor nodes corresponding to the target camera sensor.

[0217] S210, the sensor node sends a mode identifier 1 to the sensor fast switching interface component.

[0218] Similarly, each camera sensor corresponds to a sensor fast switching interface component. The sensor fast switching interface component can determine the current configuration stage to be entered, and query the camera parameters required in the configuration stage. The sensor fast switching interface component mentioned in the subsequent embodiments may refer to the component corresponding to the target camera sensor.

[0219] In some embodiments, the sensor node transmits the mode identifier 1 to the sensor fast switching interface component, which can instruct the sensor fast switching interface component to find the camera parameters required in the initialization configuration phase when enabling the target camera mode 1. For example, through the sensor XML interface, access the target sensor driver XML1 to obtain the corresponding camera parameters.

[0220] S211 , in response to mode identification 1 , the sensor fast switching interface component may obtain common parameters and a camera parameter package a corresponding to target camera mode 1 from the sensor driver XML.

[0221] It is understandable that when the sensor fast switching interface component receives a mode identifier indicating a camera mode, it can be determined that the camera mode of the camera application has changed. For example, a camera mode may be enabled, or one camera mode may be switched to another camera mode. In the scenario where the camera mode changes, the initialization configuration phase (phase 1) may be entered, or the non-seamless configuration phase may be entered.

[0222] Exemplarily, after the target camera sensor is powered on and before it is powered off, if the sensor fast switching interface component receives a mode identifier from the sensor node for the first time, it can determine that the current configuration phase to be entered is the initialization configuration phase (phase 1).

[0223] In some embodiments, when mode identification 1 is received and it is determined that the current stage 1 needs to be entered, the sensor fast switching interface component needs to query whether the target camera mode 1 corresponds to camera parameter package a. For example, the sensor fast switching interface component accesses the target sensor driver XML1 through the sensor XML interface. Whether the accessed target sensor driver XML1 contains camera parameter package a is used to determine whether the target camera mode 1 corresponds to camera parameter package a.

[0224] In addition, the electronic device may be pre-configured with the sensor driver XML of all camera sensors supported by the electronic device. In this way, whether the same electronic device uses camera sensors provided by different manufacturers, or the same electronic device is configured with camera sensors provided by multiple manufacturers at the same time, or the same electronic device replaces camera sensors provided by different manufacturers, the method provided in the embodiment of the present application can be applied.

[0225] In some embodiments, when the target camera mode 1 corresponds to the camera parameter package a, the sensor fast switching interface component obtains the common parameters and the camera parameter package a from the sensor driver XML corresponding to the target camera mode 1 through the sensor XML interface, and the process enters S212.

[0226] In other embodiments, when the target camera mode 1 does not correspond to the camera parameter package a, the sensor fast switching interface component can obtain the common parameters from the sensor driver XML. After that, the common parameters are passed to the sensor node, and the sensor node writes the common parameters to the target camera sensor. The process can refer to S212 to S215.

[0227] S212 , the sensor fast switching interface component sends common parameters and a camera parameter package a corresponding to the target camera mode 1 to the sensor node.

[0228] S213, the sensor node sends common parameters and a camera parameter package a of target camera mode 1 to the target camera driver.

[0229] In some embodiments, the sensor node can pass the public parameters and camera parameter package a to CSL, which is converted by CSL into I / O control instructions recognizable by the kernel layer, and then passed to V4L2 of the kernel layer. V4L2 sends the public parameters and camera parameter package a in the form of I / O control instructions to the target camera driver through CRM.

[0230] S214 , the target camera driver sends common parameters and a camera parameter package a of the target camera mode 1 to the target camera sensor.

[0231] S215, the target camera sensor loads common parameters and pre-stores camera parameter package a.

[0232] In some embodiments, the above S211 to S215 can realize writing the common parameters and the camera parameter package a into the target camera sensor.

[0233] In other embodiments, the common parameters may be written into the target camera sensor first, and then the camera parameter package a may be written.

[0234] For example, the above S211 to S215 may also be replaced by the following steps:

[0235] (1) The sensor fast switching interface component sends the common parameters to the sensor node. Then, the sensor node writes the common parameters into the target camera sensor through the target camera driver, instructing the target camera sensor to load the common parameters. The method of loading the common parameters to the target camera sensor can refer to the process of loading camera parameters to the camera sensor in the related art, which will not be described here.

[0236] (2) The sensor fast switching interface component queries whether the target camera mode 1 corresponds to the camera parameter package a. If it is determined that the target camera mode 1 corresponds to the camera parameter package a, the camera parameter package a is obtained, and then the camera parameter package a is sent to the sensor node. The sensor node writes the camera parameter package a into the target camera sensor through the target camera driver, instructing the target camera sensor to pre-store the camera parameter package a into the reserved sensor memory.

[0237] In addition, the above S205 to S215 correspond to Figure 7 S103~S105 in .

[0238] S216, the target camera sensor sends a completion notification 1 to the target camera driver.

[0239] S217, the target camera driver sends a completion notification 1 to the sensor node.

[0240] The completion notification 1 indicates that the target camera sensor has completed configuration of common parameters, and may also indicate that the target camera sensor has completed storage of camera parameter package a.

[0241] In some embodiments, after loading the common parameters, the target camera sensor may feed back a completion notification 1 to the sensor node through the target camera driver. After the target camera sensor stores the camera parameter package a, the target camera driver feeds back a completion notification 1 to the sensor node again.

[0242] When it is found that the target camera mode 1 corresponds to the camera parameter package a, after the sensor node receives the completion notification 1 indicating that the camera parameter package a has been stored, the process enters S218.

[0243] When it is found that the target camera mode 1 does not correspond to the camera parameter package a, after the sensor node receives the completion notification 1 indicating that the common parameters have been loaded, the process enters S218.

[0244] S218 , the sensor node sends an output image identifier 1 to the sensor fast switching interface component in response to the completion notification 1 .

[0245] S219, the sensor fast switching interface component obtains mode parameter 1 of target image output mode 1 from the corresponding sensor driver XML.

[0246] In some embodiments, the sensor fast switching interface component can obtain mode parameter 1 of target image output mode 1 from target sensor driver XML 1 through the sensor XML interface.

[0247] In other embodiments, before S219, the sensor fast switching interface component may also determine whether it is necessary to feed back the complete mode parameters of the target image output mode 1 to the sensor node. If the sensor fast switching interface component receives the image output identifier for the first time after the sensor node transmits the public parameters, the sensor fast switching interface component may determine that the complete mode parameters of the image output mode need to be obtained, and the process enters S219.

[0248] S220, the sensor fast switching interface component sends mode parameter 1 to the sensor node.

[0249] S221, the sensor node drives and sends mode parameter 1 to the target camera.

[0250] S222, the target camera driver sends mode parameter 1 to the target camera sensor.

[0251] S223, target camera sensor load mode parameter 1.

[0252] In some embodiments, through the above S220 to S223, the configuration of the exclusive camera parameters corresponding to the target image output mode 1 can be completed, so that the target camera sensor has the ability to enable the target image output mode 1.

[0253] In addition, the above S210 to S223 correspond to Figure 7 S106 in.

[0254] S224, the target camera sensor sends a completion notification 2 to the target camera driver.

[0255] S225, the target camera driver sends a completion notification 2 to the sensor node.

[0256] The completion notification 2 indicates that the target camera sensor has completed the configuration of the mode parameters and has the ability to output images using the target output mode 1.

[0257] S226, the sensor node sends a streaming instruction to the target camera driver.

[0258] S227, the target camera driver sends a flow start instruction to the target camera sensor.

[0259] S228, the target camera sensor outputs an image according to target image output mode 1.

[0260] In some embodiments, the target camera sensor responds to the streaming instruction and acquires raw image data. The target camera sensor passes the raw image data to the SFE, which pre-processes the raw image data. Then, the processed image data is passed to the image processing module. After the image processing module performs a pre-specified image processing operation on the image data, the processed image data is passed to the camera application, instructing the camera application to display the processed image data. The above process can be referred to Figure 5 , I will not go into details here.

[0261] In addition, in some embodiments, after receiving the image data, the camera application may instruct to display the image frame in the application interface of the camera mode, such as Figure 6 As shown, the electronic device may display interface 604. For example, after receiving the image data, the camera application may schedule the view system in the application framework layer to display the image data through the view system.

[0262] In some embodiments, when the target camera mode 1 supports multiple image output modes, the camera application can also dynamically switch between different image output modes according to changes in the shooting scene while the target camera mode 1 is enabled.

[0263] The change in the shooting scene may refer to a change in the ambient light brightness and / or the zoom ratio of the shooting scene.

[0264] As an implementation method, multiple scene conditions may be preconfigured in the electronic device. Exemplarily, each image output mode supported by the camera mode corresponds to a scene condition.

[0265] During the activation of the target camera mode 1, the detected ambient light brightness and / or the zoom ratio configured by the camera application meet a scene condition of the target camera mode 1, and it is determined to activate the image output mode corresponding to the scene condition.

[0266] Taking the photo mode as an example, the corresponding relationship between the scene conditions corresponding to the photo mode and the image output mode is shown in Table 1:

[0267] Table 1

[0268]

[0269] Among them, the above-mentioned bright environment and dark environment can be distinguished according to the detected ambient light brightness value and the detected HDR flag.

[0270] For example, if the ambient light brightness value is greater than the preset value 1, and the HDR flag indicates that the electronic device has entered an HDR scene, it can be determined that the current lighting environment is a bright environment. The preset value 1 may be an empirical value, and the embodiment of the present application does not limit the specific value of the preset value 1. In addition, the HDR scene refers to a shooting scene that requires the HDR technology to be enabled, for example, the shooting field of view includes both high-brightness areas and low-brightness areas.

[0271] For example, if the ambient light brightness value is not greater than a preset value of 1, or the HDR flag indicates that the electronic device has not entered an HDR scene, it can be determined that the current lighting environment is a dark environment.

[0272] Thus, when the zoom ratio is between 1X and 1.9X, if the current lighting environment is determined to be a bright environment, it is determined that the Idcg output mode needs to be enabled. If the current lighting environment is determined to be a dark environment, it is determined that the binning output mode needs to be enabled.

[0273] When the zoom ratio is between 2X and 2.5X, if the current lighting environment is determined to be bright, the Remosaic output mode must be enabled. If the current lighting environment is determined to be dark, the binning output mode must be enabled.

[0274] Understandably, in a dark environment, the image brightness gradient difference is small. In this scenario, the binning output mode with better sensitivity and lower power consumption can be used to obtain an imaging effect with better sensitivity. That is, no matter what the zoom ratio of the electronic device is, when the lighting environment is determined to be a dark environment, the binning output mode is preferred.

[0275] In bright environments, when the zoom ratio is between 1X and 1.9X, the camera has a wide field of view and the brightness gradient of the captured images varies greatly. In this scenario, enabling the Idcg output mode can achieve the best output effect.

[0276] In bright environments, when the zoom ratio is between 2X and 2.5X, the Remosaic output mode has sufficient sensitivity and the image has more pixels and higher clarity.

[0277] As shown in Table 1 above, the scene conditions corresponding to the photo mode include:

[0278] Scene condition 1: The ambient light brightness value and the HDR flag indicate a bright environment, and the zoom ratio is 1X to 1.9X. This scene condition 1 corresponds to the Idcg output mode.

[0279] Scene condition 2: The ambient light brightness value and the HDR flag indicate a bright environment, and the zoom ratio is between 2X and 2.5X. This scene condition 2 corresponds to the Remosaic output mode.

[0280] Scene condition 3: The ambient light brightness value and the HDR flag indicate a dark environment. This scene condition 3 corresponds to the binning output mode.

[0281] It is understandable that the above are only examples, and other scene conditions and adapted image output modes may also be preset.

[0282] Taking the video recording mode as an example, the corresponding relationship between the scene conditions corresponding to the video recording mode and the image output mode is shown in Table 2:

[0283] Table 2

[0284] Dark Environment Bright environment Binning output mode Idcg output mode

[0285] Understandably, in video recording mode, in dark environments, the brightness gradient of the image is small, so the binning output mode with good sensitivity and low power consumption is more profitable. In video recording mode, in bright environments, the brightness gradient of the image is large, so the Idcg output mode with better dynamic range is more profitable.

[0286] As shown in Table 2 above, the scene conditions corresponding to the video recording mode include:

[0287] Scene condition 4: The ambient light brightness value and the HDR flag indicate a bright environment. This scene condition 4 corresponds to the Idcg output mode.

[0288] Scene condition 5: The ambient light brightness value and the HDR flag indicate a dark environment. This scene condition 5 corresponds to the binning output mode.

[0289] like Fig. 9 As shown, after the target camera sensor of the electronic device enables the target image output mode 1, the above method may further include:

[0290] S301: When no operation indicating switching the camera mode is detected, the electronic device determines a target image output mode 2 adapted to the current shooting scene.

[0291] In some embodiments, when no operation indicating the switching of the camera mode is detected, the camera application still runs in the target camera mode 1. During this period, the image output mode adapted to the current shooting scene can be periodically determined, for example, according to the detected ambient light brightness information, HDR flag, zoom ratio, etc., the currently satisfied scene conditions are determined, and then according to the satisfied scene conditions, the matching target image output mode 2 is determined. In the case where the target image output mode 2 is different from the target image output mode 1, the process enters S302.

[0292] S302: When the target image output mode 1 is different from the target image output mode 2, the electronic device generates a target switching instruction according to a preset rule.

[0293] In some embodiments, a structure template of a switching instruction is preconfigured in an electronic device, and the structure template includes multiple function fields representing different functions. For example, the structure template of the switching instruction may include: switching control configuration field 1, switching switch field, channel switching field, exposure configuration field, and switching control configuration field 2.

[0294] Among them, the switching control configuration field 1 is used to indicate the field that needs to be seamlessly switched. For example, the switching control configuration field 1 needs to carry the register address of register 1 in the target camera sensor, and the value that register 1 needs to be configured, which can be collectively referred to as the configuration parameters of register 1. The switching control configuration field 2 is used to indicate another field that needs to be seamlessly switched. For example, the switching control configuration field 2 needs to carry the register address of register 2 in the target camera sensor, and the value that register 2 needs to be configured, which can be collectively referred to as the configuration parameters of register 2.

[0295] In some embodiments, some camera sensors may determine that seamless switching needs to be performed after identifying the switching control configuration field 1 from the switching instruction. For these camera sensors, the generated switching instruction includes the switching control configuration field 1 but does not include the switching control configuration field 2.

[0296] Some camera sensors can determine that seamless switching needs to be performed when they simultaneously identify the switching control configuration field 1 and the switching control configuration field 2 from the switching instruction. For these camera sensors, the generated switching instruction needs to contain both the switching control configuration field 1 and the switching control configuration field 2.

[0297] Some camera sensors may identify the switching control configuration field 2 from the switching instruction and determine that seamless switching needs to be performed. For these camera sensors, the generated switching instruction includes the switching control configuration field 2 but does not include the switching control configuration field 1.

[0298] The switch field is used to carry the mode parameters of the image output mode to be enabled or the value to be configured for the specific register 1, and can instruct the target camera sensor to switch the image output mode. Wherein, in the case where the target camera sensor pre-stores the camera parameter package a, the switch field can carry the parameter value of the specific register 1, so that the switch field can instruct the target camera sensor to configure the value of the specific register 1, triggering the target camera sensor to load the mode parameters of the image output mode to be enabled in the pre-stored camera parameter package a.

[0299] The exposure configuration field is used to carry the exposure parameter value, which can indicate the exposure parameter enabled by the target camera sensor configuration. The above exposure parameter value can be a parameter value evaluated by the auto exposure (AE) module according to the ambient light brightness information.

[0300] The channel switching field is used to indicate the output channel corresponding to the configuration target output mode 2. When different output modes are enabled, different output channels are enabled accordingly. Each output channel corresponds to a channel identifier. When different output modes are used for image acquisition, the channel identifier of the corresponding output channel is encapsulated in the acquired image data. Exemplarily, the above-mentioned channel switching field can carry the channel identifier of the output channel after switching.

[0301] The above-mentioned register 1, register 2, register 3 and specific register 1 are all different registers in the target camera sensor, and different registers can indicate different attribute configurations of the target camera sensor.

[0302] In some embodiments, the process of generating a target switching instruction by an electronic device according to a preset rule may be: according to the structural template of the switching instruction, in the target sensor driving XML1 corresponding to the target camera mode 1, that is, in the target sensor driving XML, query whether the configuration content required by the switching control configuration field 1, the switching switch field, the channel switching field, and the switching control configuration field 2 are included. Then, the fields of the queried configuration content and the exposure parameters obtained from the AE module are combined in a set order to generate the target switching instruction. Among them, the above-mentioned set order may be that the switching control configuration field 1 is located before the switching switch field, the switching switch field is located before the channel switching field, the channel switching field is located before the exposure configuration field, and the exposure configuration field is located before the switching control configuration field 2.

[0303] As an implementation method, in the target sensor driver XML1 corresponding to the target camera mode 1, the method of querying whether the configuration content required by the switching control configuration field 1, the switching switch field, the channel switching field, and the switching control configuration field 2 is included can be:

[0304] (1) Check whether the ModeSwitchInfo file corresponding to the target image output mode 2 of the target sensor driver XML1 contains the configuration parameters of register 1, that is, the configuration content 201. If it does, the configuration parameters corresponding to the register 1 (such as the configuration content 201 corresponding to the target image output mode 2) can be obtained as the configuration content of the switch control configuration field 1.

[0305] If the ModeSwitchInfo file corresponding to the target image output mode 2 of the target sensor driver XML1 does not contain the configuration parameters corresponding to register 1 (configuration content 201 corresponding to the target image output mode 2), then query whether the configuration parameters of register 1 (configuration content 202) are included in the CommonModeSwitchInfo file of the target sensor driver XML1. If included, the configuration parameters (configuration content 202) corresponding to the register 1 can be obtained as the configuration content of the switch control configuration field 1. If CommonModeSwitchInfo also does not contain the configuration parameters (configuration content 202) corresponding to register 1, it is determined that the configuration content of the control configuration field 1 has not been obtained. In this scenario, the generated target switching instruction does not contain the switch control configuration field 1.

[0306] (2) Check whether the ModeSwitchInfo file corresponding to the target image output mode 2 of the target sensor driver XML1 contains the configuration parameters corresponding to register 2 (configuration content 203 corresponding to the target image output mode 2). If it contains, the configuration parameters corresponding to register 2 (configuration content 203 corresponding to the target image output mode 2) can be obtained as the configuration content of the switch control configuration field 2.

[0307] If the ModeSwitchInfo file corresponding to the target image output mode 2 of the target sensor driver XML1 does not contain the configuration parameters corresponding to register 2 (configuration content 203 corresponding to the target image output mode 2), then query whether the configuration parameters corresponding to register 2 (configuration content 204) are included from the CommonModeSwitchInfo of the target sensor driver XML1. If included, the configuration parameters (configuration content 204) corresponding to the register 2 can be obtained as the configuration content of the switch control configuration field 2. If CommonModeSwitchInfo does not contain the configuration parameters (configuration content 204) corresponding to register 2, it is determined that the configuration content of the control configuration field 2 has not been obtained. In this scenario, the generated target switching instruction does not contain the switch control configuration field 2.

[0308] (3) In the target sensor driver XML1, query whether the ModeSwitchInfo corresponding to the target image output mode 2 contains the configuration parameters corresponding to the specific register 1 ( Figure 2B, the configuration content of the switch field corresponding to the target output mode 2), such as the register address of the specific register 1 and the value to be configured for the specific register 1. If included, obtain the configuration parameters corresponding to the specific register 1 as the configuration content of the switch field. In this scenario, the generated target switching instruction includes the switch field, and the switch field carries the configuration parameters for the specific register 1.

[0309] If ModeSwitchInfo does not contain the configuration parameters corresponding to the specific register 1, the mode parameters corresponding to the target output mode 2 are obtained as the configuration content of the switch field. In this scenario, the generated target switch instruction contains the switch field, and the switch field carries the mode parameters corresponding to the target output mode 2.

[0310] (4) Check whether the CommonModeSwitchInfo of the target sensor driver XML1 contains the configuration parameters corresponding to register 3 (e.g., Figure 2B The configuration parameters of the channel switching field in the chip are also called customized configuration content), such as the register address of register 3 and the value to be configured. If customized configuration content is included, the configuration content required for the channel switching field is obtained based on the general configuration content indicating channel switching provided by the chip platform and combined with the queried customized configuration content.

[0311] For example, the general configuration content does not contain the configuration parameters of register 3, and the customized configuration content contains the configuration parameters of register 3. Correspondingly, in the obtained configuration content, compared with the general configuration content, the configuration parameters of register 3 are newly added. For another example, the general configuration content contains configuration parameter 1 for register 3, and the customized configuration content also includes configuration parameter 2 for register 3. When configuration parameter 1 and configuration parameter 2 are different, in the obtained configuration content, the configuration parameter for register 3 is configuration parameter 2.

[0312] If customized configuration content is not included, the channel switching configuration content provided by the chip platform is used as the configuration content required by the channel switching field.

[0313] Exemplarily, when the configuration contents of the switching switch field, the channel switching field, and the exposure configuration field are acquired, the generated switching control instruction is composed of the switching switch field, the channel switching field, and the exposure configuration field.

[0314] As another example, when the configuration contents of the switching switch field, the channel switching field, the exposure configuration field, and the switching control configuration field 2 are obtained, the generated switching control instruction is composed of the switching switch field, the channel switching field, the exposure configuration field, and the switching control configuration field 2.

[0315] As another example, when the configuration contents of switching control configuration field 1, switching switch field, channel switching field, exposure configuration field, and switching control configuration field 2 are obtained, the generated switching control instruction is composed of switching control configuration field 1, switching switch field, channel switching field, exposure configuration field, and switching control configuration field 2.

[0316] In short, in the switching instructions generated for different camera sensors, the switching switch field, channel switching field, and exposure configuration field are fixed included fields. For different camera sensors, in the corresponding XML, when the relevant configuration content is queried and when the relevant configuration content is not queried, the source of the configuration content of the above-mentioned switching switch field may be different (for example, from the ModeSwitchInfo file, or from the mode parameters corresponding to the output mode), and the source of the configuration content of the above-mentioned channel switching field may be different (for example, only from the chip platform, or partly from XML and partly from the chip platform). The value of the exposure configuration field is related to the ambient light brightness. In the switching instructions generated for different camera sensors, the inclusion of the switching control configuration field 1 and the switching control configuration field 2 may be different.

[0317] In this way, by pre-configuring the sensor driver XML, it is possible to be compatible with different types of camera sensors and the special requirements of the switching instructions for indicating the execution of seamless switching.

[0318] S303, the electronic device writes a target switching instruction to the target camera sensor, instructing the target camera sensor to seamlessly switch to target image output mode 2.

[0319] For example, Fig.10 As shown, during the period when the camera application enables the photographing mode, the electronic device can display the photographing preview interface 901 provided by the photographing mode. In the photographing preview interface 901, an image frame 902 from the target camera sensor is displayed. In addition, the photographing preview interface 901 also displays the current zoom ratio as 1X.

[0320] When the current lighting environment is identified as a bright environment and the shooting preview interface 901 is displayed, the target camera sensor adopts the Idcg image output mode (ie, the target image output mode 1) to output images.

[0321] In addition, the shooting preview interface 901 also includes a zoom bar 902. A sliding window 903 is displayed on the zoom bar 902. It can be understood that different positions in the zoom bar 902 correspond to different zoom magnifications. The zoom magnification indicated by the position point where the sliding window 903 overlaps with the zoom bar 902 is the currently selected zoom magnification. In addition, the sliding window 903 can also display the value of the currently selected zoom magnification.

[0322] In some embodiments, when a user slides on the zoom bar 902, it can be determined that a zoom operation has been received. The sliding operation can instruct the sliding window 903 to adjust the position point overlapping with the zoom bar 902, thereby instructing to modify the selected zoom ratio. After the user's sliding operation ends, the changed zoom ratio can be obtained. For example, Fig.10 As shown in , the user indicates to change the selected zoom ratio from 1X to 2X. After determining that the zoom ratio enabled by the user's instruction is changed to 2X, a shooting preview interface 904 can be displayed. The shooting preview interface 904 shows that the current zoom ratio is 2X, and the shooting preview interface 904 still displays the image frame from the target camera sensor.

[0323] The difference is that, when the current lighting environment is identified as a bright environment and the shooting preview interface 904 is displayed, the target camera sensor seamlessly switches to the Idcg output mode (target output mode 2) for outputting images.

[0324] In addition, the image output mode of the target camera sensor changes when switching from the shooting preview interface 901 to the shooting preview interface 904. Of course, during the change of the image output mode, the target camera sensor continues to work, that is, it does not stop working. In this way, during the transition from displaying the shooting preview interface 901 to displaying the shooting preview interface 904, no black screen appears. After determining that the zoom ratio is 2X, only a lightweight switching instruction needs to be written to the target camera sensor to quickly complete the mode switch.

[0325] In the above embodiment, different sensor driver XMLs are configured for different camera sensors, and then the sensor fast switching interface component identifies the data to be read from the sensor driver XML in each configuration stage, thereby realizing differentiated parameter configuration of the camera sensor and achieving compatibility with camera sensors with different requirements.

[0326] The following takes the example of switching from target image output mode 1 to target image output mode 2 according to the change of shooting scene in target image output mode 1 to introduce the implementation details of switching image output mode under the same camera mode. Fig.11 As shown, the above method includes:

[0327] S401, the decision module determines that the target image output mode 2 is compatible with the current shooting scene.

[0328] In some embodiments, if the camera application changes the zoom ratio in response to the user's operation, the changed zoom ratio will be sent to the decision module through the camera service. In this way, the decision module can obtain the zoom ratio enabled by the camera application in a timely manner. In addition, the decision module can also obtain the ambient light brightness information in the environment where the device is located, as well as the status of the HDR flag in real time, so that the decision module can also timely identify whether the current lighting environment belongs to a bright environment or a dark environment.

[0329] When the camera application does not notify the decision module to switch the camera mode, the decision module can determine the image output mode adapted to the current shooting scene according to the current lighting environment and / or the currently enabled zoom ratio, that is, the target image output mode 2. The above S401 can be an implementation of S301.

[0330] In some embodiments, when no notification indicating switching camera modes is received, the decision module may periodically determine the image output mode to be enabled, such as target image output mode 2, based on the lighting environment and / or the most recently received zoom ratio.

[0331] In other embodiments, when no notification instructing to switch the camera mode is received, the decision module may determine the image output mode to be enabled, such as target image output mode 2, based on the lighting environment and the most recently received zoom ratio when a new zoom ratio is received or when a change in the lighting environment is determined.

[0332] S402, the decision module sends the image output identifier 2 corresponding to the target image output mode 2 to the sensor node.

[0333] S403, the sensor node sends an output image identifier 2 to the sensor fast switching interface component.

[0334] S404, the sensor fast switching interface component determines that the current target camera sensor can seamlessly switch to target image output mode 2.

[0335] In some embodiments, the sensor fast switching interface component can determine whether the camera application has switched the camera mode in response to the image output mark 2. If the camera mode is not switched, it is determined that the current target camera sensor can seamlessly switch the target image output mode 2. If the camera mode is switched, it is determined that the current target camera sensor cannot seamlessly switch the target image output mode 2.

[0336] Exemplarily, the sensor fast switching interface component can determine whether the target image output mode 1 indicated by the image output identifier 1 and the target image output mode 2 indicated by the image output identifier 2 belong to the same camera mode based on the image output identifier obtained last time (that is, the image output identifier 1) and the image output identifier 2 obtained this time. If it is determined that they belong to the same camera mode, it can be determined that the current target camera sensor can seamlessly switch to the target image output mode 2.

[0337] As another example, the sensor fast switching interface component can determine whether the camera mode of the camera application has changed through the decision module. If not, it can be determined that the current target camera sensor can seamlessly switch to the target image output mode 2.

[0338] S405, the sensor fast switching interface component queries the configuration content for configuring the target switching instruction from the sensor driver XML, and the target switching instruction is used to trigger the seamless switching of the target output mode 2.

[0339] The sensor driver XML includes the camera parameters required for the target camera sensor to enable target image output mode 2.

[0340] S406: The sensor fast switching interface component generates a target switching instruction based on the function field of the queried configuration content.

[0341] In some embodiments, the implementation details of S405 and S406 can refer to S302 in the above-mentioned embodiment. In this way, the target switching instructions generated by camera sensors with special requirements may be different.

[0342] S407, the sensor fast switching interface component sends a target switching instruction to the sensor node.

[0343] S408, the sensor node sends a target switching instruction to the target camera driver.

[0344] S409: The target camera driver sends a target switching instruction to the target camera sensor.

[0345] In some embodiments, the process of transmitting the target switching instruction from the sensor node to the target camera sensor can refer to Figure 3 , I will not go into details here.

[0346] S410, the target camera sensor seamlessly switches to target image output mode 2 in response to the target switching instruction.

[0347] In this way, the target camera sensor can perform image acquisition according to the target image output mode 2. Through the above steps, the target camera sensor switches from the target image output mode 1 to the target image output mode 2, and the switching implementation process can be called seamless switching. In the embodiment of the present application, the electronic device can be compatible with camera sensors with different requirements for seamless switching.

[0348] In some embodiments, during the operation of the camera application, the camera application may also respond to user operations to switch to different camera modes, such as switching from a photo mode to a video mode, or from a video mode to a photo mode.

[0349] The following takes switching from target camera mode 1 to target camera mode 2 as an example to introduce the implementation details of switching different camera modes of the camera application.

[0350] like Fig.12 As shown, the above camera parameter configuration method may further include the following steps:

[0351] S501 , in response to an operation indicating switching to target camera mode 2 , controlling a target camera sensor to stop image acquisition.

[0352] S502, determining the target image output mode 3 corresponding to the target camera mode 2.

[0353] The target image output mode 3 may be an image output mode that can be enabled by the target camera sensor in the target camera mode 2. In addition, the target image output mode 3 may also be an image output mode that is enabled by default when the target camera mode 2 is enabled.

[0354] S503, query whether the target camera mode 2 corresponds to the camera parameter package a.

[0355] In some embodiments, the implementation details of the above S503 can refer to S104, which will not be repeated here. If the target camera mode 2 corresponds to the camera parameter package a, the process can enter S504. If the target camera mode 2 does not have a corresponding camera parameter package a, the process can enter S505.

[0356] In addition, in other possible embodiments, when enabling the target image output mode 2, if the camera parameter package a of the target camera mode 1 has been written into the target camera sensor, if the target camera mode 2 corresponds to the camera parameter package a, after S503, the step of determining whether the camera parameter package a configured in the target camera sensor is the same as the camera parameter package a of the target camera mode 2 may be further included.

[0357] As an implementation method, it is possible to query whether the camera parameter package a of the target camera mode 1 includes the mode parameters of all image output modes. If the camera parameter package a of the target camera mode 1 includes the mode parameters of all image output modes supported by the target camera sensor, it is determined that the camera parameter package a configured in the target camera sensor is the same as the camera parameter package a of the target camera mode 2. If the camera parameter package a of the target camera mode 1 only includes the mode parameters of the image output modes supported by the target camera mode 1, it is determined that the camera parameter package a configured in the target camera sensor is different from the camera parameter package a of the target camera mode 2.

[0358] In the above embodiment, if the configured camera parameter package a is the same as the camera parameter package a of the target camera mode 2, the process directly enters S505. If the configured camera parameter package a is different from the camera parameter package a of the target camera mode 2, the process directly enters S504.

[0359] S504, writing a camera parameter package a corresponding to target image output mode 3 into the target camera sensor.

[0360] S505, query whether the target output mode 3 corresponds to the simplified version of the mode parameters.

[0361] In some embodiments, it is possible to find out whether the simplified mode parameters of the target image output mode 3 are preconfigured in the target sensor driver XML1 of the target camera sensor. Compared with the complete mode parameters, the simplified mode parameters carry fewer camera parameters, and under the same transmission conditions, the simplified mode parameters take less time to transmit.

[0362] If the mode parameters of the simplified version of the target output mode 3 are found, the process proceeds to S506. If the mode parameters of the simplified version of the target output mode 3 are not found, the process proceeds to S507.

[0363] S506, configuring the simplified version of mode parameters corresponding to the target image output mode 3 in the target camera sensor.

[0364] S507, configuring complete mode parameters corresponding to target image output mode 3 in the target camera sensor.

[0365] like Fig.13As shown, the electronic device displays a shooting preview interface 901 provided by the photo mode. The shooting preview interface 901 includes controls indicating other camera modes, such as a control 1101 indicating a video recording mode. When the electronic device detects that the user has selected the control 1101, the electronic device can switch to display the video recording preview interface 1102, that is, enable the video recording mode. In the above process, the video recording mode is the target camera mode 2, and the user's operation of selecting the control 1101 can be called an operation indicating switching the video recording mode.

[0366] For another example, the electronic device detects a voice command issued by the user indicating switching to target camera mode 2, and can also determine that an operation indicating switching to target camera mode 2 is detected. For another example, the electronic device detects a gesture indicating switching to target camera mode 2, and can also determine that an operation indicating switching to target camera mode 2 is detected.

[0367] Taking the target image output mode 3 corresponding to the camera parameter package a and the simplified version of the mode parameters as an example, when the camera parameter package a of the target camera mode 2 is different from the camera parameter package a of the target camera mode 1, in the process of implementing the above S501 to S507, the signaling interaction of each functional module in the electronic device is as follows: Fig.14 As shown:

[0368] S601 , the camera application detects an operation indicating switching to target camera mode 2 .

[0369] S602: The camera application sends a mode identifier 2 corresponding to the target camera mode 2 to the camera service.

[0370] S603, the camera service sends mode identification 2 to the decision module.

[0371] S604: The decision module determines to enable the target image output mode 3 in response to the mode identifier 2.

[0372] The target image output mode 3 is an image output mode supported by the target camera mode 2. Meanwhile, the target image output mode 3 may also be an image output mode enabled by default when switching to the target camera mode 2.

[0373] S605, the decision module sends the mode identifier 2 and the image output identifier 3 to the sensor node, and instructs the control target camera sensor to stop working.

[0374] Among them, the image output mark 3 can be an mark used to indicate the target image output mode 3.

[0375] In some embodiments, the sensor node is a node corresponding to the target camera sensor, which can be used to manage the target camera sensor, for example, to configure camera parameters for the target camera sensor, or to control the working state of the target camera sensor (stop working or start working).

[0376] S606: The sensor node sends information to the target camera driver to instruct the target camera sensor to stop working.

[0377] S607: The target camera driver instructs the target camera sensor to stop working.

[0378] S608, the target camera sensor stops image acquisition.

[0379] In some embodiments, the above S601 to S608 are an implementation of S501 in the above embodiment. In addition, the process of the sensor node transmitting data to the target camera sensor can refer to the above embodiment. Figure 3 , I will not go into details here.

[0380] S609: The sensor node sends a mode identifier 2 to the sensor fast switching interface component.

[0381] S610, the sensor fast switching interface component obtains a camera parameter package a corresponding to the target camera mode 2 from the target sensor driver XML2.

[0382] In some embodiments, before S610, the sensor fast switching interface component can determine whether the camera application switches from one camera mode to another camera mode. For example, it can be determined whether the camera application switches from one camera mode to another camera mode based on whether the image output mode indicated by the image output identifier 3 is the same as the image output mode configured last time. For another example, it can be determined whether the camera application switches from one camera mode to another camera mode based on the record of the mode identifier received by the query sensor node. For example, it is queried whether the two mode identifiers recently received by the sensor node are the same. If they are the same, it is determined that the camera application has not switched from one camera mode to another camera mode. If they are different, it is determined that the camera application switches from one camera mode to another camera mode.

[0383] When the camera application switches from one camera mode to another camera mode, it can be determined that the non-seamless configuration phase (phase 4) needs to be entered. After determining that the non-seamless configuration phase needs to be entered, the sensor fast switching interface component also needs to query whether the target camera mode 2 corresponds to the camera parameter package a.

[0384] Exemplarily, the electronic device may find the sensor drive XML corresponding to the target camera mode 2 from the sensor drive XML corresponding to the target camera sensor, such as target sensor drive XML2. Then, it is searched from the target sensor drive XML2 whether there is a camera parameter package a. If so, it is determined that the target camera mode 2 corresponds to the camera parameter package a, and the process enters S611. If not, it is determined that the target camera mode 2 does not have a camera parameter package a, and S610 to S614 may not be executed.

[0385] S611, the sensor fast switching interface component sends a camera parameter package a corresponding to the target camera mode 2 to the sensor node.

[0386] S612: The sensor node sends a camera parameter package a of target camera mode 2 to the target camera driver.

[0387] S613: The target camera driver sends a camera parameter package a of target camera mode 2 to the target camera sensor.

[0388] S614 , the target camera sensor pre-stores a camera parameter package a of the target camera mode 2 .

[0389] In some embodiments, the above S611-S614 is an implementation of S502-S504 in the above embodiments. The implementation details of the above S611-S614 can refer to the process of searching and writing the camera parameter package a of the target camera mode 1 into the target camera sensor in the above embodiments, which will not be repeated here.

[0390] S615, the target camera sensor sends a completion notification 3 to the target camera driver.

[0391] S616, the target camera driver sends a completion notification 3 to the sensor node.

[0392] Among them, the completion notification 3 is used to indicate that the target camera sensor has pre-stored the camera parameter package a corresponding to the target camera mode 2.

[0393] S617 , the sensor node sends a map output identifier 3 to the sensor fast switching interface component in response to the completion notification 3 .

[0394] It can be understood that after the sensor quick switching interface component receives the image output identifier, if it is determined that it needs to enter the non-seamless configuration stage, such as detecting that the camera application switches from one camera mode to another camera mode, it can determine whether the simplified version of the mode parameters can be used to instruct the target camera sensor to enable the image output mode indicated by the image output identifier.

[0395] In this way, after receiving the output identification 3 and determining that it is necessary to enter the non-seamless configuration stage, the process can enter S618.

[0396] S618, the sensor fast switching interface component drives XML2 from the target sensor to obtain the simplified version mode parameters corresponding to the target output mode 3.

[0397] In the above embodiment, the simplified mode parameters corresponding to target image output mode 3 are used as an example. When the target image output mode 3 does not correspond to the simplified mode parameters, the sensor fast switching interface component can obtain the complete mode parameters corresponding to the target image output mode 3 from the target sensor driver XML2.

[0398] In this way, before S618, the sensor fast switching interface component can also determine whether the target sensor driver XML2 contains simplified version mode parameters corresponding to the target image output mode 3.

[0399] S619, the sensor fast switching interface component sends a simplified version of mode parameters of target output mode 3 to the sensor node.

[0400] S620: The sensor node sends simplified mode parameters of target image output mode 3 to the target camera driver.

[0401] S621, the target camera driver sends a simplified version of mode parameters of target image output mode 3 to the target camera sensor.

[0402] S622, the target camera sensor loads simplified mode parameters of target image output mode 3.

[0403] In some embodiments, the above S617 to S622 are an implementation method of S505 to S506 in the aforementioned embodiments.

[0404] S623, the target camera sensor sends a completion notification 4 to the target camera driver.

[0405] S624, the target camera driver sends a completion notification 4 to the sensor node.

[0406] Among them, completion notification 4 is used to indicate that the target camera sensor has loaded the simplified version mode parameters corresponding to the target image output mode 3.

[0407] S625, the sensor node sends a streaming instruction to the target camera driver.

[0408] S626, the target camera driver sends a flow start instruction to the target camera sensor.

[0409] S627, the target camera sensor outputs an image according to target image output mode 3.

[0410] In some embodiments, the above S623 to S627 may instruct the target camera sensor to restart the flow, and then collect image data according to the target image output mode 3.

[0411] The embodiment of the present application also provides an electronic device, which may include: a camera, a display screen, a memory, and one or more processors. The memory is coupled to the processor. The memory is used to store computer program code, and the computer program code includes computer instructions. When the processor executes the computer instructions, the electronic device can execute the various steps performed by the electronic device in the above embodiment. Of course, the electronic device includes but is not limited to the above memory and one or more processors.

[0412] In some embodiments, when the electronic device determines that the target camera sensor is the first camera sensor, after the first camera sensor is powered on, the electronic device writes first configuration parameters to the first camera sensor, where the first configuration parameters are camera parameters shared by multiple image output modes, that is, the common parameters mentioned in the aforementioned embodiments.

[0413] Exemplarily, the above-mentioned multiple image output modes refer to image output modes supported and enabled by the first camera sensor. Also exemplarily, the above-mentioned multiple image output modes may also be image output modes supported and enabled by the first camera sensor under target camera mode 1. The above-mentioned multiple image output modes include the first image output mode. The above-mentioned first image output mode may be the target image output mode 1 corresponding to the first camera sensor.

[0414] In some embodiments, the first camera sensor is a camera sensor that needs to pre-store a camera parameter package a (eg, a first data package) corresponding to a camera mode.

[0415] After writing the first configuration parameters to the first camera sensor, the electronic device may also write a first data packet to the first camera sensor, the first data packet including multiple groups of configuration parameters corresponding to the above-mentioned multiple image output modes. The multiple groups of configuration parameters of the first data packet include second configuration parameters, and the second configuration parameters include parameters other than the first configuration parameters among the camera parameters used to start the first image output mode. The above-mentioned second configuration parameters may also be referred to as mode parameters corresponding to the first image output mode.

[0416] After the first data packet is written into the first camera sensor, a second configuration parameter is written into the first camera sensor to instruct the first camera sensor to perform image acquisition according to the first image output mode. Figure 8 .

[0417] In some embodiments, when the electronic device determines that the target camera sensor is the second camera sensor, after the second camera sensor is powered on, the first configuration parameter is written to the second camera sensor. The second configuration parameter is written to the second camera sensor to instruct the second camera sensor to perform image acquisition according to the first image output mode.

[0418] The first camera sensor and the second camera sensor are different camera sensors, and the second camera sensor is a camera sensor that does not need to pre-store a camera parameter package a corresponding to the camera mode.

[0419] In addition, the first camera sensor and the second camera sensor support the same switching output mode. The first configuration parameter refers to a common parameter, and the content of the first configuration parameter corresponding to the first camera sensor and the second camera sensor may be different. The first configuration parameter of the first camera sensor may be stored in the sensor driver XML of the first camera sensor. The first configuration parameter of the second camera sensor may be stored in the sensor driver XML of the second camera sensor.

[0420] The second configuration parameters refer to the camera parameters that need to be loaded when the first output mode is enabled, in addition to the common parameters, which can be called the second configuration parameters, or the mode parameters corresponding to the first output mode. Similarly, the contents contained in the second configuration parameters corresponding to the first camera sensor and the second camera sensor may also be different. The second configuration parameters of the first camera sensor may be stored in the sensor driver XML of the first camera sensor. The second configuration parameters of the second camera sensor may also be stored in the sensor driver XML of the second camera sensor.

[0421] Of course, in a possible embodiment, the content of the first configuration parameter corresponding to the first camera sensor and the second camera sensor may be the same. The content of the second configuration parameter corresponding to the first camera sensor and the second camera sensor may also be the same.

[0422] In one scenario, the first camera sensor and the second camera sensor are camera sensors corresponding to different cameras. The electronic device detects a first operation instructing a user to open a first application. Wherein, when the first application is a camera application, the first operation may be an operation instructing to enable the camera application. In response to the first operation, a first interface is displayed, and a first configuration parameter and a first data packet are written to the first camera sensor. The first interface is a first type of preview interface provided by the first application. Exemplarily, the first interface may be a preview interface corresponding to the target camera mode 1. When the target camera mode 1 is a photo mode, the first interface may be a photo preview interface, such as, Figure 6 Interface 603 is shown.

[0423] After writing the second configuration parameter to the first camera sensor, the first camera sensor starts streaming, so that the electronic device displays the first image frame in the first interface. The first image frame is an image obtained by the first camera sensor using the first image output mode, such as, Figure 6 604 in the display interface. Afterwards, in response to detecting an operation indicating the activation of the second camera sensor, such as the operation of switching the camera, the electronic device can control the second camera sensor to power on and write the first configuration parameter. After writing the second configuration parameter to the second camera sensor, the second camera sensor starts streaming. In this way, the electronic device can display the second image frame in the first interface, and the second image frame is an image obtained by the second camera sensor using the first output mode.

[0424] In another scenario, the first camera sensor is a camera sensor of a first camera, and the electronic device detects a first operation of a user indicating to open a first application. In response to the first operation, the first interface is displayed, and the first configuration parameter and the first data packet are written into the first camera sensor. Afterwards, the second configuration parameter is written into the first camera sensor, and then the first camera sensor is instructed to start streaming, and the electronic device may also display the first image frame in the first interface.

[0425] After the camera sensor of the first camera is replaced by the second camera sensor, a first operation of the user indicating to open the first application is detected, and in response to the first operation, the first interface can be displayed, and the first configuration parameter can be written to the second camera sensor. After the second configuration parameter is written to the second camera sensor, the second camera sensor starts streaming. The electronic device displays a second image frame in the first interface, and the second image frame is an image obtained by the second camera sensor using the first output mode.

[0426] In some embodiments, the plurality of image output modes further include a second image output mode (e.g., target image output mode 2), and the plurality of configuration parameters in the first data packet further include a third configuration parameter (a mode parameter corresponding to target image output mode 2). During the period when the first camera sensor acquires images according to the first image output mode, under the first condition, first information (target switching instruction) is written to the first camera sensor to instruct the first camera sensor to acquire images using the second image output mode.

[0427] Exemplarily, the first condition indicates a scene suitable for enabling the second image output mode, which may be the scene condition corresponding to the second image output mode mentioned in the aforementioned embodiment.

[0428] Exemplarily, the first information includes one or more of the following function fields:

[0429] The first switching control configuration field (switching control configuration field 1) is used to carry the first configuration content indicating the execution of seamless switching of the image output mode. For example, the configuration content for register 1 mentioned in the above embodiment. The first switching switch field is used to carry information indicating the loading of the third configuration parameter, and the data size carried by the first switching switch field is smaller than the data size of the third configuration parameter.

[0430] The first channel switching field is used to indicate the channel identifier corresponding to the second image output mode.

[0431] The first exposure configuration field is used to carry the first exposure parameter that matches the current ambient light brightness.

[0432] The second switching control configuration field (switching control configuration field 2) is used to carry the second configuration content for executing the seamless switching of the image output mode, for example, the configuration content for register 2 mentioned in the above embodiment.

[0433] In some embodiments, after the first information is written into the first camera sensor, the first camera sensor can implement seamless switching, and the electronic device can display an image captured by the first camera sensor using the second image output mode.

[0434] In some embodiments, during the period when the second camera sensor acquires images in the first image output mode, under the first condition, second information (switching instruction) is written to the second camera sensor to instruct the second camera sensor to acquire images in the second image output mode, and the second information includes one or more of the following functional fields:

[0435] The third switching control configuration field (switching control configuration field 1) is used to indicate the third configuration content for executing the seamless switching of the image output mode, for example, the configuration content for register 1 mentioned in the above embodiment. The second switching switch field is used to carry the complete third configuration parameters.

[0436] The second channel switching field is used to indicate the channel identifier corresponding to the second image output mode.

[0437] The second exposure configuration field is used to carry the second exposure parameter that matches the current ambient light brightness.

[0438] The fourth switching control configuration field (switching control configuration field 2) is used to carry the second configuration content indicating the execution of seamless switching of the image output mode. For example, the configuration content for register 2 mentioned in the above embodiment. In some embodiments, after the first image frame is displayed in the first interface, in response to a second operation (such as an operation indicating switching to target camera mode 2), a second interface is displayed, and the second interface is a second type of preview interface provided by the first application, for example, a preview interface corresponding to target camera mode 2. It can be understood that the above-mentioned first interface and second interface can be preview interfaces corresponding to different camera modes provided by the first application, and usually when the camera mode is switched, the preview interface will be switched synchronously. For example, the first interface is Fig.13 The interface 901 shown in FIG. 901, correspondingly, the second interface may be Fig.13 Interface 1102 in.

[0439] In some embodiments, during the process of image acquisition by the first camera sensor, in response to the second operation, the electronic device can also write a second data packet to the first camera sensor, wherein the second data packet includes multiple groups of configuration parameters corresponding to multiple image output modes. The multiple image output modes corresponding to the second data packet are image output modes that the camera mode corresponding to the second interface (for example, target camera mode 2) supports switching. The multiple image output modes corresponding to the first data packet are image output modes that the camera mode corresponding to the first interface (target camera mode 1) supports switching. Usually, the image output modes supported by target camera mode 2 and target camera mode 1 are different, and the above-mentioned second data packet is also different from the first data packet.

[0440] Exemplarily, the plurality of configuration parameters in the second data packet include fourth configuration parameters, and the fourth configuration parameters include parameters other than the first configuration parameters among the camera parameters for enabling the third image output mode (target image output mode 3). When the third image output mode corresponds to the target image output mode 3, the fourth configuration parameters may be the mode parameters of the target image output mode 3 mentioned in the aforementioned embodiment.

[0441] After writing the second data packet to the first camera sensor, the electronic device may also write the fifth configuration parameter corresponding to the third image output mode to the first camera sensor. Both the fifth configuration parameter and the fourth configuration parameter may instruct the first camera sensor to enable the third image output mode. The fourth configuration parameter includes the fifth configuration parameter. The data size of the fifth configuration parameter is smaller than the data size of the fourth configuration parameter. The fifth configuration parameter may also be referred to as a simplified mode parameter of the fourth configuration parameter.

[0442] Afterwards, the first camera sensor may output an image in the third output mode. The electronic device may display a third image frame in the second interface, that is, the third image frame is an image obtained by the first camera sensor using the third output mode.

[0443] In some embodiments, before writing the fifth configuration parameter corresponding to the third image output mode into the first camera sensor, the electronic device

[0444] In the camera parameters corresponding to the first camera sensor (the sensor drive XML of the first camera sensor, such as the target sensor drive XML1), the fifth configuration parameter corresponding to the third image output mode is found.

[0445] In some other embodiments, after the first image frame is displayed in the first interface, the second interface is displayed in response to the second operation. The second data packet is written to the first camera sensor. If the fifth configuration parameter corresponding to the third image output mode is not found, the fourth configuration parameter corresponding to the third image output mode is written to the first camera sensor. Afterwards, the first camera sensor can perform image acquisition according to the third image output mode, and display the third image frame in the second interface, that is, the image obtained by the first camera sensor using the third image output mode.

[0446] In some embodiments, the first type of preview interface includes: any one of a photo preview interface and a video recording interface; the second type of preview interface includes: any one of the photo preview interface and the video recording interface; the first type of preview interface is different from the second type of preview interface.

[0447] In some embodiments, before writing the first data packet to the first camera sensor, the electronic device finds the first data packet associated with the first camera sensor; after writing the first configuration parameters to the second camera sensor, the electronic device does not find the first data packet associated with the second camera sensor, that is, there is no corresponding camera parameter package a.

[0448] The embodiment of the present application also provides a chip system, which can be applied to the electronic device in the aforementioned embodiment. The chip system includes at least one processor and at least one interface circuit. The processor can be the processor in the above-mentioned electronic device. The processor and the interface circuit can be interconnected by lines. The processor can receive and execute computer instructions from the memory of the above-mentioned electronic device through the interface circuit. When the computer instructions are executed by the processor, the electronic device can execute the various steps executed by the electronic device in the above-mentioned embodiment. Of course, the chip system can also include other discrete devices, which are not specifically limited in the embodiment of the present application.

[0449] In some embodiments, through the description of the above implementation methods, technicians in the relevant field can clearly understand that for the convenience and simplicity of description, only the division of the above functional modules is used as an example. In actual applications, the above functions can be assigned to different functional modules as needed, that is, the internal structure of the device is 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 refer to the corresponding process in the aforementioned method embodiment, and will not be repeated here.

[0450] Each functional unit in each embodiment of the present application can be integrated into a processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The above integrated unit can be implemented in the form of hardware or in the form of software functional units.

[0451] If the integrated unit is implemented in the form of 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 solution of the embodiment of the present application is essentially or the part that contributes to the prior art or all or part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including a number of instructions to enable a computer device (which can be a personal computer, a server, or a network device, etc.) or a processor to perform all or part of the steps of the method described in each embodiment of the present application. The aforementioned storage medium includes: various media that can store program codes, such as flash memory, mobile hard disk, read-only memory, random access memory, disk or optical disk.

[0452] The above is only a specific implementation of the embodiment of the present application, but the protection scope of the embodiment of the present application is not limited thereto, and any changes or replacements within the technical scope disclosed in the embodiment of the present application should be included in the protection scope of the embodiment of the present application. Therefore, the protection scope of the embodiment of the present application should be based on the protection scope of the claims.

Claims

1. A camera parameter configuration method, characterized in that: The method comprises: After the first camera sensor is powered on, writing a first configuration parameter into the first camera sensor, wherein the first configuration parameter is a camera parameter shared by a plurality of image output modes, wherein the plurality of image output modes include the first image output mode; Writing a first data packet to the first camera sensor, the first data packet including multiple groups of configuration parameters corresponding to the multiple image output modes, the multiple groups of configuration parameters in the first data packet including second configuration parameters, the second configuration parameters including parameters other than the first configuration parameters among the camera parameters for starting the first image output mode; Writing the second configuration parameter into the first camera sensor to instruct the first camera sensor to acquire an image according to the first image output mode; In response to the second operation, displaying a second interface, where the second interface is a second type of preview interface provided by the first application; Writing a second data packet to the first camera sensor, the second data packet including multiple groups of configuration parameters corresponding to multiple image output modes, the second data packet being different from the first data packet; the multiple groups of configuration parameters in the second data packet including fourth configuration parameters, the fourth configuration parameters including parameters of the camera for enabling the third image output mode, except for the first configuration parameters; If the first camera sensor corresponds to a fifth configuration parameter, write the fifth configuration parameter corresponding to the third image output mode into the first camera sensor to instruct the first camera sensor to enable the third image output mode for image acquisition, the fourth configuration parameter includes the fifth configuration parameter, and the data size of the fifth configuration parameter is smaller than the data size of the fourth configuration parameter; If the first camera sensor does not correspond to the fifth configuration parameter, write the fourth configuration parameter corresponding to the third image output mode into the first camera sensor to instruct the first camera sensor to enable the third image output mode to perform image acquisition; After the second camera sensor is powered on, writing the corresponding first configuration parameter into the second camera sensor; Writing corresponding second configuration parameters into the second camera sensor to instruct the second camera sensor to perform image acquisition according to the first image output mode; wherein the first camera sensor and the second camera sensor are different camera sensors and support the same switching image output mode.

2. The method according to claim 1, characterized in that The first camera sensor and the second camera sensor are camera sensors corresponding to different cameras; Before writing the first configuration parameter to the first camera sensor, the method includes: detecting a first operation of a user indicating to open a first application; in response to the first operation, displaying a first interface, the first interface being a first type of preview interface provided by the first application; After writing the second configuration parameter into the first camera sensor, the method further includes: displaying a first image frame in the first interface, the first image frame being an image obtained by the first camera sensor using the first image output mode; Before writing the first configuration parameter to the second camera sensor, the method further includes: detecting an operation indicating enabling the second camera sensor; After writing the second configuration parameters into the second camera sensor, the method further includes: displaying a second image frame in the first interface, where the second image frame is an image obtained by the second camera sensor using the first image output mode.

3. The method according to claim 1, characterized in that The first camera sensor is a camera sensor of a first camera. Before writing the first configuration parameter to the first camera sensor, the method includes: detecting a first operation of a user indicating to open a first application; in response to the first operation, displaying a first interface, the first interface being a first type of preview interface provided by the first application; After writing the second configuration parameter to the first camera sensor, the method further includes: in response to loading the second configuration parameter, displaying a first image frame in the first interface, the first image frame being an image obtained by the first camera sensor using the first image output mode; Before writing the first configuration parameter to the second camera sensor, the method further includes: after the camera sensor of the first camera is replaced from the first camera sensor to the second camera sensor, detecting again the first operation of the user instructing to open the first application; in response to the first operation, displaying the first interface; After writing the second configuration parameters into the second camera sensor, the method further includes: displaying a second image frame in the first interface, where the second image frame is an image obtained by the second camera sensor using the first image output mode.

4. The method according to any one of claims 1 to 3, characterized in that: The multiple image output modes further include a second image output mode, the multiple groups of configuration parameters in the first data packet further include a third configuration parameter, and after writing the second configuration parameter to the first camera sensor, the method further includes: Under a first condition, writing first information into the first camera sensor to instruct the first camera sensor to use the second image output mode to perform image acquisition; The first condition indicates a scenario suitable for enabling the second image output mode; and the first information includes one or more of the following function fields: The first switching control configuration field is used to carry the first configuration content indicating execution of seamless switching of the image output mode; A first switch field is used to carry information indicating loading the third configuration parameter, and the data size carried by the first switch field is smaller than the data size of the third configuration parameter; A first channel switching field is used to indicate a channel identifier corresponding to configuring the second image output mode; A first exposure configuration field, used to carry a first exposure parameter matching the current ambient light brightness; The second switching control configuration field is used to carry second configuration content indicating execution of seamless switching of the image output mode, and the first configuration content and the second configuration content are different.

5. The method according to claim 4, characterized in that After writing the first information into the first camera sensor, the method further includes: An image captured by the first camera sensor using the second image output mode is displayed.

6. The method according to claim 4, characterized in that After writing the second configuration parameters to the second camera sensor, the method further includes: Under the first condition, second information is written to the second camera sensor to instruct the second camera sensor to use the second image output mode to acquire an image; the second information includes one or more of the following function fields: The third switching control configuration field is used to carry the first configuration content indicating execution of seamless switching of the image output mode; A second switch field, used to carry the third configuration parameter; The second channel switching field is used to indicate the channel identifier corresponding to the second image output mode; The second exposure configuration field is used to carry a second exposure parameter that matches the current ambient light brightness; The fourth switching control configuration field is used to carry the second configuration content indicating execution of seamless switching of the image output mode.

7. The method according to claim 2, characterized in that: Before writing the fifth configuration parameter corresponding to the third image output mode into the first camera sensor, the method further includes: The fifth configuration parameter corresponding to the third image output mode is found in the camera parameters corresponding to the first camera sensor.

8. The method according to claim 7, characterized in that The first type of preview interface includes: any one of a photo preview interface and a video recording interface; the second type of preview interface includes: any one of the photo preview interface and the video recording interface; the first type of preview interface is different from the second type of preview interface.

9. The method according to any one of claims 1 to 3, characterized in that: Before writing the first data packet to the first camera sensor, the method further includes: finding the first data packet associated with the first camera sensor; After writing the first configuration parameters to the second camera sensor, the method further includes: failing to find the first data packet associated with the second camera sensor.

10. An electronic device, characterized in that: The electronic device includes one or more processors, a camera, a display screen and a memory; the memory is coupled to the processor, and the memory is used to store computer program code, the computer program code includes computer instructions, and when one or more processors execute the computer instructions, the one or more processors are used to execute the method as described in any one of claims 1-9.

11. A computer storage medium, characterized in that: The method comprises computer instructions, which, when executed on an electronic device, cause the electronic device to execute the method as claimed in any one of claims 1 to 9.