Image processing method for camera application and related equipment
By adjusting the working mode of the CFA device according to the ambient brightness in the camera application, the problem of low preview image resolution when the ambient brightness is strong is solved, and dynamically adjusting the preview image resolution and clarity when the ambient brightness changes. Effects improve the output effect of camera application.
Patent Information
- Application Number
- CN202310854155.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-07-12
- Publication Date
- 2025-01-14
- Estimated Expiration
- 2043-07-12
AI Technical Summary
When the ambient light is brighter, the preview image resolution of the camera application is lower, resulting in lower clarity and affecting the user experience.
By dynamically adjusting the operating mode of the color filter array CFA device according to the ambient brightness in the camera application, the resolution of the preview image is adjusted, ensuring that the resolution and clarity of the preview image are improved when the ambient brightness is strong. Specific methods include determining the initial operating mode of the CFA device based on the initial resolution and sensitivity values when starting the camera application, and switching the operating mode when the ambient light brightness changes, switching from boxing mode to full-size mode or vice versa to adapt Brightness changes.
When the ambient light is brighter, improve the resolution and clarity of the preview image, improve the output effect of the camera application, and meet users' needs for image resolution and brightness.
Smart Images

Figure CN119316704A_ABST
Abstract
Description
Technical Field
[0001] The embodiments of the present application relate to the field of electronic information technology, and specifically to an image processing method and related equipment for camera applications. Background Art
[0002] When the electronic device starts the camera application, it can convert the original image captured by the camera into a preview image and display the preview image on the camera application interface. However, in some cases, such as when the ambient light is strong, the resolution of the preview image is low, resulting in low clarity of the preview image. Summary of the invention
[0003] The embodiments of the present application provide an image processing method and related equipment for camera applications, aiming to solve the problem of low clarity of preview images when the ambient light brightness is strong.
[0004] A first aspect of an embodiment of the present application provides an image processing method for a camera application, which is applied to an electronic device, and the method includes: starting a first camera application and displaying a first interface. A first preview image is displayed in a first time period, and the first preview image is displayed in the first interface. In the first time period, the ambient light brightness is a first brightness, and the resolution sent by the first camera application to the camera of the electronic device is a first resolution, and the resolution of the first preview image is a second resolution. A second preview image is displayed in a second time period, and the second preview image is displayed in the first interface. In the second time period, the ambient light brightness is a second brightness, and the resolution of the second preview image is a third resolution. Based on the fact that the first resolution is greater than the third resolution, and the second brightness is less than the first brightness, the second resolution is greater than the third resolution.
[0005] In this embodiment, based on the ambient light brightness changing from the first brightness to the second brightness, and the first resolution being greater than the third resolution, the resolution of the preview image displayed by the first camera application changes from the second resolution to the third resolution accordingly. That is, as the ambient light brightness changes, the resolution of the preview image changes accordingly. Based on the increase in ambient light brightness, the resolution of the preview image increases accordingly. Thus, when the ambient light brightness is strong, the resolution of the preview image is high, and thus the clarity of the preview image is also high.
[0006] In one embodiment, the method further includes: closing the first camera application, starting the second camera application, and displaying the second interface. Displaying a third preview image in a third time period, the third preview image is displayed in the second interface, in the third time period, the ambient light brightness is the first brightness or the second brightness, the resolution sent by the second camera application to the camera of the electronic device is a fourth resolution, and based on the fourth resolution being less than the first resolution, the resolution of the third preview image is the third resolution.
[0007] In this embodiment, based on the ambient light brightness being the first brightness or the second brightness, and the fourth resolution being less than the first resolution, the resolution of the preview image displayed by the second camera application is correspondingly less than the resolution of the preview image displayed by the first camera application. That is, when the ambient light brightness is the same, as the resolution sent by the camera application to the camera head changes, the resolution of the preview image will change accordingly. Based on the resolution sent by the camera application to the camera head becoming larger, the resolution of the preview image will increase accordingly. Thus, when the resolution sent by the camera application to the camera head is higher, the resolution of the preview image is higher, and thus the clarity of the preview image is also higher.
[0008] In another embodiment, based on the fact that the first resolution is greater than the third resolution and the ISO value is less than a preset sensitivity threshold, the resolution of the first preview image is the second resolution.
[0009] In another embodiment, based on the fact that the first resolution is greater than the third resolution and the ISO value is greater than or equal to a preset sensitivity threshold, the resolution of the second preview image is the third resolution.
[0010] In another implementation, based on the fourth resolution being smaller than the third resolution and the ISO value being smaller than a preset sensitivity threshold, the resolution of the third preview image is the third resolution.
[0011] In another implementation, based on the fourth resolution being smaller than the third resolution and the ISO value being greater than or equal to a preset sensitivity threshold, the resolution of the third preview image is the third resolution.
[0012] In another embodiment, before displaying the first preview image in the first time period, the method further includes: the camera application sends a stream allocation request to the camera driver through the camera API of the electronic device, and the stream allocation request includes the first resolution. Based on the stream allocation request, the camera driver configures the preview stream and creates a channel, and determines the initial working mode of the color filter array CFA device, and the initial working mode includes a binning mode or a non-binning mode; the first resolution is the resolution of the original image, and the CFA device is used to convert the original image into a preview image; based on the working mode of the CFA device being the binning mode, the resolution of the preview image displayed by the first camera application is the third resolution; based on the working mode of the CFA device being the non-binning mode, the resolution of the preview image displayed by the first camera application is the second resolution.
[0013] In another embodiment, determining the initial operating mode of the CFA device includes: determining that the initial operating mode of the CFA device is a non-binning mode based on the first resolution being greater than the third resolution and the ISO value being less than a preset sensitivity threshold. Determining that the initial operating mode of the CFA device is a binning mode based on the first resolution being less than or equal to the third resolution or the ISO value being greater than or equal to the preset sensitivity threshold.
[0014] In another embodiment, the method further includes: based on the successful streaming, the camera application sends a frame processing request to the camera driver through the camera API, the frame processing request includes the first resolution and the original image. The camera driver converts the original image into a preview image based on the frame processing request.
[0015] In another embodiment, converting an original image into a preview image includes: determining a preset operating mode of a CFA device, the preset operating mode including a binning mode or a non-binning mode. Determining an operating mode of the CFA device based on the preset operating mode and a reference operating mode. The reference operating mode is an operating mode of the CFA device when processing a previous frame processing request, or an initial operating mode. Setting the operating mode of the CFA device. Driving the CFA device to convert the original image into a preview image.
[0016] In another embodiment, determining the working mode of the CFA device based on the preset working mode and the reference working mode includes: determining the working mode of the CFA device as the reference working mode based on the preset working mode and the reference working mode being the same; and determining the working mode of the CFA device as the preset working mode based on the preset working mode and the reference working mode being different.
[0017] In another embodiment, setting the operating mode of the CFA device includes: based on the operating mode of the CFA device being determined as a preset operating mode, performing seamless switching through a preconfigured register or register group to switch the reference operating mode to the preset operating mode.
[0018] A second aspect of an embodiment of the present application provides an electronic device, which includes a memory, a processor, a camera, a sensor module and a display screen. The camera is used to capture static images or videos. The sensor module includes a color filter array CFA device and an ambient light sensor. The working modes of the CFA device include a binning mode or a non-binning mode. The ambient light sensor is used to sense the brightness of ambient light. The display screen is used to display an interface. The memory is used to store instructions. The processor is used to run the instructions stored in the memory, so that the electronic device executes the image processing method of the camera application of the embodiment of the present application.
[0019] A third aspect of an embodiment of the present application provides a computer-readable storage medium, which stores instructions. When the instructions are executed on a computer, the computer executes the image processing method of the camera application of an embodiment of the present application.
[0020] The technical effects brought about by the second and third aspects of the embodiments of the present application can be found in the relevant description of the image processing method of the camera application of the first aspect above, and will not be repeated here. BRIEF DESCRIPTION OF THE DRAWINGS
[0021] Figure 1 The software structure diagram of an electronic device provided as an example.
[0022] Figure 2 The following is a schematic diagram of converting an original image into a bin-sized image, provided by an example.
[0023] Figure 3 An example is provided to show how to convert an original image into a non-binning size image.
[0024] Figure 4 It is a schematic diagram of the software structure of an electronic device provided in one embodiment of the present application.
[0025] Figure 5 This is a timing diagram of an image processing method for a camera application provided by an embodiment of the present application.
[0026] Figure 6 yes Figure 5 Flow chart of sub-steps of step S508.
[0027] Figure 7 yes Figure 5 Flow chart of sub-steps of step S514.
[0028] Figure 8 yes Figure 7 Flowchart of sub-steps of step S702.
[0029] Fig. 9 It is a schematic diagram of the hardware structure of an electronic device provided in one embodiment of the present application. DETAILED DESCRIPTION
[0030] It should be noted that in the embodiments of the present application, "at least one" refers to one or more, and "more than one" refers to two or more than two. "And / or" describes the association relationship of associated objects, indicating that three relationships may exist. For example, A and / or B can represent: the existence of A alone, the existence of A and B at the same time, and the existence of B alone, where A and B can be singular or plural. The terms "first", "second", "third", "fourth", etc. (if any) in the specification, claims and drawings of this application are used to distinguish similar objects, rather than to describe a specific order or sequence.
[0031] It should also be noted that the method disclosed in the embodiments of the present application or the method shown in the flowchart includes one or more steps for implementing the method. Without departing from the scope of the claims, the execution order of multiple steps can be interchangeable with each other, and some of the steps can also be deleted.
[0032] Figure 1 The software structure diagram of an electronic device provided as an example.
[0033] like Figure 1 As shown, the software system of the electronic device is divided into three layers, which are the application (Application, APP) layer, the framework (Framework) layer and the hardware abstraction layer (HAL) from top to bottom.
[0034] The APP layer includes a camera application, and the camera application may include a system camera application or a third-party camera application.
[0035] The Framework layer provides application programming interfaces (APIs) for each application in the APP layer, such as the Camera API. The Framework layer includes a Camera Service module, which is used to implement the call of the Camera API.
[0036] The HAL includes a camera driver, which is used to drive various components (such as sensors) of a camera (also called a camera) of an electronic device to perform various functional applications and data processing of the camera, such as previewing, taking pictures or recording videos.
[0037] The following takes the preview scene of the camera application as an example. Figure 1 The implementation process of the preview function is described.
[0038] When the camera application is started, the camera application sends a resolution request to the camera driver through the Camera API. The resolution request is used to request the resolution. After receiving the resolution request, the camera driver sends the initial resolution to the camera application through the Camera API based on at least one initial resolution reported by the sensor. The camera application determines the target resolution based on the at least one initial resolution. The target resolution is the maximum resolution that is the same as or close to the output size of the camera application.
[0039] In some cases, when at least one of the initial resolutions does not have a resolution that is the same as or close to the image output size of the camera application, a problem may occur in which the target resolution cannot be determined, resulting in the camera application being unable to output a preview image.
[0040] After determining the target resolution, the camera application sends a stream allocation request to the camera driver through the Camera API. The stream allocation request is used to request the configuration of the preview stream. After receiving the stream allocation request, the camera driver configures the preview stream and creates a channel (e.g., Pipeline). The preview stream includes at least two frames of preview images, and the channel is used to stream-encapsulate the processing process of at least two frames of preview images to obtain a preview stream processing process. After the stream allocation is completed, the camera driver sends the stream allocation result to the camera application through the CameraAPI. The stream allocation result includes a successful or failed stream allocation.
[0041] When the stream allocation result is successful, the camera application sends multiple frame processing requests to the camera driver through the Camera API. Each frame processing request includes a frame of original image. The resolution of the original image is the target resolution. The frame processing request is used to request that the original image be converted into a corresponding preview image. For each frame processing request, after receiving the frame processing request, the camera driver converts the original image into a preview image and sends the preview image to the camera application through the Camera API. After receiving the preview image, the camera application displays the preview image on the preview interface.
[0042] The camera driving the original image to be converted into the preview image includes: converting the original image into the preview image by driving the sensor. The sensor includes a color filter array (CFA) device, such as a quadra CFA device.
[0043] The following uses the Quadra CFA device as an example to explain the working principle of the camera driver converting the original image into the preview image.
[0044] The working mode of the Quadra CFA device is usually Binning mode or non-binning mode (also called full-size mode). In a scene with low ambient light brightness (also called dark scene), the camera driver sets the working mode of the Quadra CFA device to Binning mode. In Binning mode, the Quadra CFA device can convert the original image into a Binning size image, that is, four adjacent pixels in the original image are merged into one pixel to obtain a Binning size image. As a result, the photosensitive area of each pixel in the Binning size image is four times the photosensitive area of each pixel in the original image, so that a preview image with higher brightness than the original image is displayed on the preview interface of the camera application. Binning mode improves the brightness of the image output by the camera application by merging pixels. Since the more pixels in the image, the higher the image resolution, the resolution of the Binning size image (also called binning resolution) is less than the target resolution of the original image.
[0045] In a scene with normal ambient light brightness (also called a normal scene), the camera driver sets the Quadra CFA device's operating mode to Fullsize mode. Since the camera's Image Signal Processor (ISP) channel only allows the transmission of images with a Bayer pattern pixel arrangement, and the original image's pixel arrangement is a non-Bayer pattern, in Fullsize mode, the Quadra CFA device converts the original image's pixel arrangement into a Bayer pattern pixel arrangement, thereby providing a non-binning size (also called full-size, Fullsize) image that can be transmitted on the ISP channel. The number of pixels in the Fullsize image is equal to the number of pixels in the original image, so the resolution of the Fullsize image (also called non-binning resolution, or full-size resolution) is equal to the target resolution of the original image. For example, a 16MP (or M, megapixel) Quadra CFA device starts Binning mode in a dark scene, converting a 16M original image into a 4M Binning size image. Since the photosensitive area of each pixel in the Binning size image is four times the photosensitive area of each pixel in the original image, the Binning size image has a higher brightness than the original image. In a normal scene, the 16MP Quadra CFA device starts Fullsize mode, converting the pixel arrangement of the 16M original image into a Bayer pattern pixel arrangement, thereby providing a 16M Fullsize image with a Bayer pattern pixel arrangement.
[0046] Quadra CFA devices can include 4cell 1 devices, 9cell 1 devices, or 16cell 1 devices. Taking 4cell 1 devices as an example, Figure 2 and Figure 3 As shown, in a dark scene, the camera driver sets the working mode of the 4cell 1 device to Binning mode, and the 4cell 1 device performs internal synthesis processing through a complementary metal oxide semiconductor (CMOS) device to convert the original image into a Binning size image. In a normal scene, the camera driver sets the working mode of the 4cell 1 device to Fullsize mode, and the 4cell 1 device is processed through Remosaic technology to convert the original image into a Fullsize image with pixels arranged in a Bayer pattern. Among them, Remosaic technology includes software and hardware methods. The software method uses the Remosaic algorithm, and the hardware method is internal processing of the device.
[0047] It can be understood that when the ambient light brightness is low, the user's perception of the image sensitivity is more obvious, while the perception of the image resolution is less obvious. At this time, the Binning size image provided by the Quadra CFA device has a higher brightness, which can meet the user's demand for image brightness. When the ambient light brightness is normal or strong, the user's perception of the image resolution is more obvious, while the perception of the image sensitivity is less obvious. At this time, if the working mode of the Quadra CFA device is still Binning mode, the user's demand for image resolution cannot be met due to the low resolution of the Binning size image provided by the Quadra CFA device, which will affect the user experience. Therefore, when the ambient light brightness is normal or strong, the camera driver sets the working mode of the Quadra CFA device to Fullsize mode. At this time, the Fullsize image provided by the Quadra CFA device has a higher resolution, which can meet the user's demand for image resolution.
[0048] However, in some cases, such as when the camera application is a third-party camera application, the chip platform allows the initial resolution reported by the QuadraCFA device to be less than or equal to the binning resolution, so that the target resolution of the original image is less than or equal to the binning resolution, resulting in the maximum output size of the image displayed by the camera application being the Binning size. When the ambient light brightness is normal or strong, the resolution of the image displayed by the camera application is low, resulting in low image clarity, which affects the output effect of the camera application.
[0049] For example, a 9MP Quadra CFA device can support images with a resolution of 9M, but due to the limitations of the chip platform, the camera application can only display images with a maximum resolution of 2M, resulting in lower image clarity.
[0050] Based on this, the embodiments of the present application provide an image processing method and related equipment for camera applications, aiming to enable the Quadra CFA device to adapt the working mode with changes in ambient light brightness even when it is restricted by the chip platform, output Fullsize images in normal scenes, and output Binning size images in dark scenes, thereby improving the image output effect of the camera application.
[0051] Combine the following Figure 4 and Figure 5 The image processing method for the camera application provided in the embodiment of the present application is described in detail.
[0052] Figure 4 It is a schematic diagram of the software structure of an electronic device provided in one embodiment of the present application.
[0053] Compared to Figure 1 ,exist Figure 4 In the software system of the electronic device shown, the Camera API includes a resolution customization interface. The resolution customization interface is used to obtain at least one initial resolution reported by the camera driver and at least one customized resolution from a resolution configuration file. The initial resolution is less than or equal to the binning resolution, and the customized resolution is greater than the binning resolution.
[0054] The resolution profile is a file pre-configured in the system or pushed by the cloud, such as a resolution customization template (e.g., an XML template) for a third-party camera application and a third-party camera application page. The resolution profile can store the camera application version number, product name, camera application package name, camera application page, camera logo, and stream configuration information. The stream configuration information can include shooting mode and customized resolution. The shooting mode can be photo, video, or preview mode.
[0055] For example, the resolution profile is:
[0056] <CustomCameraSetting version="7.10.22.00"product="XXX">
[0057] <CustomCameraSetting pkg="com.xxxxxx.mm"
[0058] activity="com.xxxxxx.mm.plugin.scanner.ui.BaseScanUI">
[0059] <StreamConfigurations id="0">
[0060] <StreamConfiguration content="34 3840 2400OUTPUT" / >
[0061] <StreamConfiguration content="35 3840 2400OUTPUT" / >
[0062] <StreamConfiguration content="33 3840 2400OUTPUT" / >
[0063]
[0064]
[0065] Among them, version indicates the version number of the camera application, product indicates the product name, pkg indicates the package name of the camera application, activity indicates the camera application page, id indicates the camera ID, content indicates the stream configuration information, 33 / 34 / 35 indicates the shooting mode, and 3840 2400 indicates the customized resolution corresponding to the shooting mode.
[0066] The camera application parses the resolution configuration file by calling the resolution customization API. For example:
[0067] EXPORT_API void*xxCameraServiceEx::setStreamConfigs(void*param)
[0068] {
[0069] …
[0070] tinyxml2::XMLElement*pkgNameListElement=rootElement->FirstChildElement
[0071] ("CustomCameraSetting");
[0072] …
[0073] }
[0074] Among them, tinyxml2 is the Xml parser used to parse Xml files, and CustomCameraSetting is the resolution configuration file.
[0075] After obtaining the initial resolution and the custom resolution, the camera application determines the target resolution based on the initial resolution and the custom resolution. When the initial resolution reported by the Quadra CFA device is less than or equal to the binning resolution due to the chip platform, the camera application can still obtain a custom resolution greater than the binning resolution, thereby determining the target resolution as a resolution greater than the binning resolution.
[0076] In addition, Figure 4 In the software system of the electronic device shown, the distribution request sent by the camera application includes the target resolution. The camera driver includes a first mode adaptation module and a frame processing module. The first mode adaptation module is used to determine the initial working mode of the Quadra CFA device according to the sensitivity value and the target resolution during the distribution process.
[0077] The frame processing module includes a mode selection module, and the mode selection module includes a second mode adaptation module. The second mode adaptation module is used to determine the preset working mode of the Quadra CFA device according to the sensitivity value and the target resolution during the processing of the frame processing request.
[0078] The mode selection module is used to determine the working mode of the Quadra CFA device when processing the current frame processing request based on the preset working mode and the working mode of the Quadra CFA device when processing the previous frame processing request, or based on the preset working mode and the initial working mode after obtaining the preset working mode determined by the second mode adaptation module.
[0079] The frame processing module is used to set the working mode of the Quadra CFA device after acquiring the working mode determined by the mode selection module, and then drive the Quadra CFA device to convert the original image into a preview image.
[0080] For example, in the process of streaming, the camera driver calls the FindbestSensorMode function to execute the functions of the first mode adaptation module. In the process of processing frame processing requests, the camera driver calls the OnExecuteProcessRequest function to execute the functions of the frame processing module. The OnExecuteProcessRequest function is nested with the OnselectSensorMode function, and the camera driver calls the OnselectSensorMode function to execute the functions of the mode selection module. The OnselectSensorMode function is nested with the FindbestSensorMode function, and the camera driver calls the FindbestSensorMode function to execute the functions of the second mode adaptation module.
[0081] Specifically, during the streaming process, the camera driver calls the FindbestSensorMode function to perform the following operations:
[0082] Query the camera application custom field (for example, ThirdAppCustomSupport). When the camera application custom field indicates that the camera application supports mode selection, if the target resolution is greater than the binning resolution and the current sensitivity value is less than the preset sensitivity threshold, the initial working mode is determined to be Fullsize mode. If the target resolution is less than or equal to the binning resolution, or the current sensitivity value is greater than or equal to the preset sensitivity threshold, the initial working mode is determined to be Binning mode.
[0083] After determining the initial operating mode, the initial operating mode indicator (e.g., SensorMode value) is returned. The initial operating mode indicator is used to indicate whether the initial operating mode is Fullsize mode or Binning mode. For example, the initial operating mode indicator can be set to 1 or 0. When the initial operating mode indicator is set to 1, it indicates that the initial operating mode is Fullsize mode. When the initial operating mode indicator is set to 0, it indicates that the initial operating mode is Binning mode.
[0084] Among them, the camera application custom field can be stored in the sensor driver file (for example, the Sensor Xml driver file). When the camera driver calls the FindbestSensorMode function, it obtains the camera application custom field from the sensor driver file. The camera application custom field is used to indicate whether the camera application supports mode selection. For example, the camera application custom field can be set to True or False. When the camera application custom field is set to True, it indicates that the camera application supports mode selection, indicating that the operating mode of the Quadra CFA device can be set to Fullsize mode or Binning mode. When the camera application custom field is set to False, it indicates that the camera application does not support mode selection, indicating that the operating mode of the Quadra CFA device is a single mode (Fullsize mode or Binning mode).
[0085] The sensitivity (ISO) value is used to measure the sensitivity of the camera's photosensitive element to ambient light. When the current sensitivity value is greater than or equal to the preset sensitivity threshold, the camera's photosensitive element is more sensitive to ambient light, indicating that the current ambient light brightness is weak. When the current sensitivity value is less than the preset sensitivity threshold, the camera's photosensitive element is less sensitive to ambient light, indicating that the current ambient light brightness is normal or strong. The preset sensitivity threshold can be set as needed, for example, the preset sensitivity threshold is 700.
[0086] When the stream allocation result is successful, the camera application sends the first frame processing request (also called the first frame processing request) to the camera driver through the Camera API. The first frame processing request includes the target resolution and the original image. After receiving the first frame processing request, the camera driver calls the OnExecuteProcessRequest function to execute the function of the frame processing module, thereby converting the original image into a preview image. Specifically, the camera driver calls the OnExecuteProcessRequest function to perform the following operations:
[0087] (1) Call the FindbestSensorMode function.
[0088] Query the camera application custom field. When the camera application custom field indicates that the camera application supports mode selection, if the target resolution is greater than the binning resolution and the current sensitivity value is less than the preset sensitivity threshold, the preset working mode is determined to be Fullsize mode. If the target resolution is less than or equal to the binning resolution, or the current sensitivity value is greater than or equal to the preset sensitivity threshold, the preset working mode is determined to be Binning mode.
[0089] After determining the preset working mode, the FindbestSensorMode function returns the preset working mode indicator. The preset working mode indicator is used to indicate whether the preset working mode is Fullsize mode or Binning mode. For example, the preset working mode indicator can be set to 1 or 0. When the preset working mode indicator is set to 1, it indicates that the preset working mode is Fullsize mode. When the preset working mode indicator is set to 0, it indicates that the preset working mode is Binning mode.
[0090] (2) Call the OnselectSensorMode function.
[0091] After obtaining the preset working mode indicator, determine whether the preset working mode indicator is the same as the initial working mode indicator. The initial working mode indicator may be stored in the sensor driver file. When the camera driver calls the OnselectSensorMode function, it obtains the initial working mode indicator from the sensor driver file. If the preset working mode indicator is the same as the initial working mode indicator, it is determined that the working mode of the Quadra CFA device is the initial working mode. If the preset working mode indicator is different from the initial working mode indicator, it is determined that the working mode of the Quadra CFA device is the preset working mode.
[0092] After determining the working mode, the OnselectSensorMode function returns the working mode indicator. The working mode indicator is used to indicate whether the working mode is Fullsize mode or Binning mode. For example, the working mode indicator can be set to 1 or 0. When the working mode indicator is set to 1, it indicates that the working mode is Fullsize mode. When the working mode indicator is set to 0, it indicates that the working mode is Binning mode.
[0093] (3) Execute the function of OnExecuteProcessRequest.
[0094] After obtaining the working mode indicator, the working mode of the Quadra CFA device is set to Fullsize mode or Binning mode according to the working mode indicator. When the working mode indicator indicates that the working mode of the Quadra CFA device is the initial working mode, the initial working mode of the Quadra CFA device is maintained. When the working mode indicator indicates that the working mode of the Quadra CFA device is the preset working mode, the initial working mode of the Quadra CFA device is switched to the preset working mode.
[0095] When the initial working mode of the Quadra CFA device is switched to the preset working mode, a seamless switch can be performed through the pre-configured registers or register groups, thereby reducing the switching delay and helping to avoid the situation where the output delay is long due to the jamming when switching the working mode. The pre-configured registers or register groups can be stored in the sensor driver file. For example, the sensor driver file is:
[0096] <customsettingsinfo>
[0097] <customsettings>
[0098] <sensormodefrom> 1< / sensormodefrom>
[0099] <ressettings>
[0100] reg1,reg2,reg3
[0101] < / ressettings>
[0102] < / customsettings>
[0103] < / customsettingsinfo>
[0104] Among them, sensorModeFrom is the initial working mode indicator, and reg1, reg2, and reg3 are pre-configured registers or register groups.
[0105] When the Quadra CFA device operates in Fullsize mode, the Quadra CFA device is driven to convert the pixel arrangement of the original image into a Bayer pattern pixel arrangement to obtain a Fullsize image. When the Quadra CFA device operates in Binning mode, the Quadra CFA device is driven to merge four adjacent pixels of the original image into one pixel to obtain a Binning size image.
[0106] After obtaining the full-size image or the binning-size image, the camera driver sends the full-size image or the binning-size image to the camera application through the Camera API. After receiving the full-size image or the binning-size image, the camera application displays the full-size image or the binning-size image on the preview interface.
[0107] After displaying the preview image corresponding to the first frame processing request on the preview interface, the camera application sends a second frame processing request (also called a non-first frame processing request) to the camera driver through the CameraAPI. The second frame processing request includes the target resolution and the original image. After receiving the second frame processing request, the camera driver calls the OnExecuteProcessRequest function to execute the functions of the frame processing module, thereby converting the original image into a preview image.
[0108] Compared with the process of processing the first frame processing request, when the camera driver calls the OnExecuteProcessRequest function to process the second frame processing request, the function of the OnselectSensorMode function is different, as follows:
[0109] After obtaining the preset working mode indicator, determine whether the preset working mode indicator is the same as the working mode indicator when processing the previous frame processing request. The working mode indicator when processing the previous frame processing request can be stored in the sensor driver file. When the camera driver calls the OnselectSensorMode function, it obtains the working mode indicator when processing the previous frame processing request from the sensor driver file. If the preset working mode indicator is the same as the working mode indicator when processing the previous frame processing request, it is determined that the working mode of the Quadra CFA device is the working mode when processing the previous frame processing request. If the preset working mode indicator is different from the working mode indicator when processing the previous frame processing request, it is determined that the working mode of the Quadra CFA device is the preset working mode.
[0110] It can be understood that after displaying a preview image corresponding to a second frame processing request on the preview interface, the camera application sends the next second frame processing request to the camera driver through the Camera API. The camera driver processes the first frame processing request and at least one second frame processing request in sequence, and then the camera application displays the preview image corresponding to the first frame processing request and at least one frame preview image corresponding to at least one second frame processing request in sequence on the preview interface accordingly.
[0111] Figure 5 This is a timing diagram of an image processing method for a camera application provided by an embodiment of the present application.
[0112] See also Figure 4 and Figure 5 , the image processing method of the camera application includes the following steps:
[0113] S501, the camera application is started.
[0114] S502: The camera application sends a resolution request to the Camera Service module.
[0115] S503: The Camera Service module obtains the initial resolution reported by the camera driver and the customized resolution from the resolution configuration file by calling the resolution customization interface based on the resolution request, and generates a resolution list.
[0116] The resolution list includes at least one initial resolution and at least one customized resolution. The initial resolution is less than or equal to the boxed resolution, and the customized resolution is greater than the boxed resolution.
[0117] Take the 9MP Quadra CFA device as an example, assuming that the binning resolution is 2M. Limited by the chip platform, the initial resolution reported by the camera driver is 1M and 2M. When the Camera Service module receives the initial resolution reported by the camera driver, it parses the custom resolutions of 3M, 5M, 7M, and 9M from the resolution configuration file. Therefore, the Camera Service module generates a resolution list based on the initial resolution and the custom resolution, and the resolution list is {1M, 2M, 3M, 5M, 7M, 9M}.
[0118] S504: The Camera Service module sends a resolution list to the camera application.
[0119] S505: The camera application determines a target resolution based on the resolution list.
[0120] Continuing with the 9MP Quadra CFA device as an example, assume that the resolution list is {1M, 2M, 3M, 5M, 7M, 9M}. When the image size of the camera application is 9M, the target resolution determined by the camera application based on the resolution list is 9M. When the image size of the camera application is 6M, the target resolution determined by the camera application based on the resolution list is 5M.
[0121] S506: The camera application sends a stream allocation request to the Camera Service module.
[0122] The streaming request includes a target resolution.
[0123] S507: The Camera Service module sends a stream allocation request to the camera driver.
[0124] S508, the camera driver configures the preview stream and creates a channel based on the stream allocation request, and calls the FindbestSensorMode function to determine the initial working mode of the Quadra CFA device.
[0125] S509: The camera driver sets the initial working mode of the Quadra CFA device based on the initial working mode indicator returned by the FindbestSensorMode function.
[0126] S510: The camera driver sends the stream allocation result to the Camera Service module.
[0127] The flow allocation result includes flow allocation success or flow allocation failure.
[0128] S511, the Camera Service module sends the stream allocation result to the camera application.
[0129] S512: When the stream allocation result is successful, the camera application sends a first frame processing request to the Camera Service module.
[0130] The first frame processing request (first frame processing request) includes a target resolution and an original image, and the resolution of the original image is the target resolution.
[0131] S513, the Camera Service module sends a first frame processing request to the camera driver.
[0132] S514: The camera driver calls the OnExecuteProcessRequest function based on the first frame processing request to convert the original image in the first frame processing request into a preview image.
[0133] S515: The camera driver sends a preview image to the Camera Service module.
[0134] S516, the Camera Service module sends the preview image to the camera application.
[0135] S517: The camera application displays a preview image corresponding to the first frame processing request on a preview interface of the camera application.
[0136] S518, the camera application sends a second frame processing request to the Camera Service module.
[0137] The second frame processing request (not the first frame processing request) includes the target resolution and the original image, and the resolution of the original image is the target resolution.
[0138] S519, the Camera Service module sends a second frame processing request to the camera driver.
[0139] S520: The camera driver calls the OnExecuteProcessRequest function based on the second frame processing request to convert the original image in the second frame processing request into a preview image.
[0140] S521, the camera driver sends a preview image to the Camera Service module.
[0141] S522, the Camera Service module sends a preview image to the camera application.
[0142] S523: The camera application displays a preview image corresponding to the second frame processing request on a preview interface of the camera application.
[0143] In the above step S508, please refer to Figure 6, call the FindbestSensorMode function to determine the initial operating mode of the Quadra CFA device, including the following sub-steps:
[0144] S601, query camera application customized fields.
[0145] S602, based on the camera application customization field indicating that the camera application supports mode selection, obtain the target resolution from the stream allocation request, and obtain the current sensitivity value by driving the camera's photosensitive element.
[0146] S603: Based on the target resolution being greater than the binning resolution and the current sensitivity value being less than a preset sensitivity threshold, determining that the initial working mode is the Fullsize mode.
[0147] S604: Based on the target resolution being less than or equal to the binning resolution, or the current sensitivity value being greater than or equal to a preset sensitivity threshold, determining that the initial working mode is a Binning mode.
[0148] S605, returning to the initial working mode indicator.
[0149] It is understandable that the camera application customization field is usually set to indicate that the camera application supports mode selection. That is, in some cases, the above step S601 may not be performed.
[0150] In the above step S514, please refer to Figure 7 , calling the OnExecuteProcessRequest function to convert the original image in the first frame processing request into a preview image, including the following sub-steps:
[0151] S701, calling FindbestSensorMode function to determine the preset working mode of the Quadra CFA device.
[0152] It can be understood that the specific implementation of step S701 is the same as Figure 6 The processes shown are roughly the same and will not be repeated here.
[0153] S702, calling the OnselectSensorMode function to determine the operating mode of the Quadra CFA device.
[0154] S703, setting the operating mode of the Quadra CFA device based on the operating mode indicator returned by the OnselectSensorMode function.
[0155] S704 , based on the working mode of the Quadra CFA device, drive the Quadra CFA device to convert the original image in the first frame processing request into a preview image.
[0156] In the above step S702, please refer to Figure 8 , call the OnselectSensorMode function to determine the operating mode of the Quadra CFA device, including the following sub-steps:
[0157] S801, obtaining a preset working mode indicator returned by the FindbestSensorMode function and an initial working mode indicator from a sensor driver file.
[0158] S802: Determine whether the preset working mode indicator is the same as the initial working mode indicator.
[0159] S803: Determine that the operating mode of the Quadra CFA device is the initial operating mode based on the preset operating mode indicator being the same as the initial operating mode indicator.
[0160] S804: Determine that the operating mode of the Quadra CFA device is the preset operating mode based on that the preset operating mode indicator is different from the initial operating mode indicator.
[0161] S805, return the working mode indicator.
[0162] The specific implementation of the above step S520 is Figure 7 The processes shown in FIG. 1 are substantially the same, and the difference between the two is that in the specific implementation of the above step S702 (such as Figure 8 In the process shown in FIG. 1 , the “initial operating mode indicator” is replaced by the “operating mode indicator when processing the previous frame processing request”.
[0163] In the above embodiment, when the resolution reported by the camera driver is less than or equal to the binning resolution due to the limitation of the chip platform, the Camera Service module obtains a customized resolution greater than the binning resolution by calling the resolution customization interface, so that the camera application can determine the target resolution based on the initial resolution and the customized resolution. Thus, the camera driver can set the working mode of the Quadra CFA device based on the target resolution and the sensitivity value. For example, when the target resolution is greater than the binning resolution and the ambient light brightness is normal or strong, the working mode of the Quadra CFA device is set to Fullsizemode to meet the user's requirements for image resolution. When the target resolution is less than or equal to the binning resolution, or the ambient light brightness is weak, the working mode of the Quadra CFA device is set to Binning mode to meet the user's requirements for image brightness.
[0164] It can be understood that the preview image output by the camera application may be stretched, or the preview image may not be displayed because the target resolution that matches the output size of the camera application is not selected. The image processing method for the camera application provided in the embodiment of the present application can solve the above problems and enable the image provided by the camera application to meet user needs.
[0165] In addition, the above embodiment only takes the preview scene of the camera application as an example, but the image processing method of the camera application is not limited to the preview scene, and the image processing method of the camera application is also applicable in the photo taking scene or the video recording scene.
[0166] The image processing method for the camera application provided in the embodiment of the present application is described below in combination with different scenarios.
[0167] The first scenario: The ambient light brightness is normal or strong, and the target resolution determined by the camera application is greater than the binning resolution.
[0168] The image processing method of the camera application includes: starting a first camera application, displaying a first interface, displaying a first preview image in a first time period, the first preview image is displayed in the first interface, in the first time period, the ambient light brightness is a first brightness, the target resolution determined by the first camera application is a first resolution, the resolution of the first preview image is a second resolution, and the second resolution is equal to the first resolution.
[0169] In the first scene, the first brightness indicates that the ambient light brightness is normal or strong, and the first resolution is greater than the binning resolution. Based on the ambient light brightness being the first brightness and the target resolution being the first resolution, even if the chip platform allows the resolution reported by the camera driver to be less than or equal to the binning resolution, the camera driver can set the working mode of the CFA device to Fullsize mode, so that the first camera application outputs a Fullsize image. The first preview image is a Fullsize image.
[0170] Second scenario: The ambient light brightness is low and the target resolution determined by the camera application is greater than the binning resolution.
[0171] The image processing method of the camera application includes: starting a first camera application, displaying a first interface, displaying a second preview image in a second time period, the second preview image is displayed in the first interface, in the second time period, the ambient light brightness is a second brightness, the second brightness is less than the first brightness, the target resolution determined by the first camera application is the first resolution, and the resolution of the second preview image is a third resolution, which is less than the first resolution.
[0172] In the second scene, the first brightness indicates that the ambient light brightness is normal or strong, the second brightness indicates that the ambient light brightness is weak, and the first resolution is greater than the binning resolution. Based on the ambient light brightness being the second brightness and the target resolution being the first resolution, the camera driver sets the working mode of the CFA device to Binning mode, so that the first camera application outputs a Binning size image. The second preview image is a Binning size image.
[0173] Scenario 3: The ambient light brightness is normal or strong, and the target resolution determined by the camera application is less than or equal to the binning resolution.
[0174] The image processing method of the camera application includes: starting a second camera application, displaying a second interface, displaying a third preview image in a third time period, the third preview image is displayed in the second interface, in the third time period, the ambient light brightness is a first brightness, the target resolution determined by the second camera application is a fourth resolution, the fourth resolution is less than the first resolution, and the resolution of the third preview image is the third resolution.
[0175] In the third scene, the first brightness indicates that the ambient light brightness is normal or strong, and the fourth resolution is less than or equal to the binning resolution. Based on the ambient light brightness being the first brightness and the target resolution being the fourth resolution, the camera driver sets the working mode of the CFA device to Binning mode, so that the second camera application outputs a Binning size image. The third preview image is a Binning size image.
[0176] Scenario 4: The ambient light brightness is low and the target resolution determined by the camera application is less than or equal to the binning resolution.
[0177] The image processing method of the camera application includes: starting a second camera application, displaying a second interface, displaying a third preview image in a third time period, the third preview image is displayed in the second interface, in the third time period, the ambient light brightness is a second brightness, the target resolution determined by the second camera application is a fourth resolution, the fourth resolution is less than the first resolution, and the resolution of the third preview image is the third resolution.
[0178] In the fourth scenario, the first brightness indicates that the ambient light brightness is normal or strong, the second brightness indicates that the ambient light brightness is weak, and the fourth resolution is less than or equal to the binning resolution. Based on the ambient light brightness being the second brightness and the target resolution being the fourth resolution, the camera driver sets the working mode of the CFA device to Binning mode, so that the second camera application outputs a Binning size image. The third preview image is a Binning size image.
[0179] The electronic device provided in the embodiments of the present application is described below.
[0180] Fig. 9 It is a schematic diagram of the hardware structure of an electronic device provided in one embodiment of the present application.
[0181] See also Fig. 9 The electronic device 100 includes a processor 110, an external memory interface 120, an internal memory 121, a Universal Serial Bus (USB) interface 130, a charging management module 140, a power management module 141, a battery 142, an antenna 1, an antenna 2, a mobile communication module 150, a wireless communication module 160, an audio module 170, a speaker 170A, a receiver 170B, a microphone 170C, an earphone interface 170D, a sensor module 180, a button 190, a motor 191, an indicator 192, a camera 193, a display screen 194, and a Subscriber Identification Module (SIM) card interface 195, etc. The sensor module 180 may include a pressure sensor 180A, a gyroscope sensor 180B, an air pressure sensor 180C, a magnetic sensor 180D, an acceleration sensor 180E, a distance sensor 180F, a proximity light sensor 180G, a fingerprint sensor 180H, a temperature sensor 180J, a touch sensor 180K, an ambient light sensor 180L, a CFA device 180M, etc.
[0182] The processor 110 may execute instructions stored in the internal memory 121 , so that the electronic device 100 executes the image processing method for the camera application provided in the embodiment of the present application.
[0183] The processor 110 may include one or more processing units, for example, the processor 110 may include an application processor (AP), a modem processor, a graphics processor (GPU), an image signal processor (ISP), a controller, a video codec, a digital signal processor (DSP), a baseband processor, and / or a neural network processor (NPU), etc. Different processing units may be independent devices or integrated into one or more processors.
[0184] The controller can generate operation control signals according to the instruction operation code and timing signal to complete the control of instruction fetching and execution.
[0185] The processor 110 may also be provided with a memory for storing instructions and data. In some embodiments, the memory in the processor 110 is a cache memory. The memory may store instructions or data that the processor 110 has just used or cyclically used. If the processor 110 needs to use the instruction or data again, it may be directly called from the memory. This avoids repeated access, reduces the waiting time of the processor 110, and thus improves the efficiency of the system.
[0186] In some embodiments, the processor 110 may include one or more interfaces. The interface may include an Inter-Integrated Circuit (I2C) interface, an Inter-Integrated Circuit Sound (I2S) interface, a Pulse Code Modulation (PCM) interface, a Universal Asynchronous Receiver / Transmitter (UART) interface, a Mobile Industry Processor Interface (MIPI), a General-Purpose Input / Output (GPIO) interface, a Subscriber Identity Module (SIM) interface, and / or a Universal Serial Bus (USB) interface, etc.
[0187] The I2C interface is a bidirectional synchronous serial bus, including a serial data line (SDA) and a serial clock line (SCL). In some embodiments, the processor 110 may include multiple groups of I2C buses. The processor 110 may be coupled to the touch sensor 180K, the charger, the flash, the camera 193, etc. through different I2C bus interfaces. For example: the processor 110 may be coupled to the touch sensor 180K through the I2C interface, so that the processor 110 communicates with the touch sensor 180K through the I2C bus interface to realize the touch function of the electronic device 100.
[0188] The I2S interface can be used for audio communication. In some embodiments, the processor 110 can include multiple I2S buses. The processor 110 can be coupled to the audio module 170 via the I2S bus to achieve communication between the processor 110 and the audio module 170. In some embodiments, the audio module 170 can transmit an audio signal to the wireless communication module 160 via the I2S interface to achieve the function of answering a call through a Bluetooth headset.
[0189] The PCM interface can also be used for audio communication, sampling, quantizing and encoding analog signals. In some embodiments, the audio module 170 and the wireless communication module 160 can be coupled via a PCM bus interface. In some embodiments, the audio module 170 can also transmit audio signals to the wireless communication module 160 via the PCM interface to implement the function of answering calls via a Bluetooth headset. Both the I2S interface and the PCM interface can be used for audio communication.
[0190] The UART interface is a universal serial data bus for asynchronous communication. The bus can be a bidirectional communication bus. It converts the data to be transmitted between serial communication and parallel communication. In some embodiments, the UART interface is generally used to connect the processor 110 and the wireless communication module 160. For example, the processor 110 communicates with the Bluetooth module in the wireless communication module 160 through the UART interface to implement the Bluetooth function. In some embodiments, the audio module 170 can transmit an audio signal to the wireless communication module 160 through the UART interface to implement the function of playing music through a Bluetooth headset.
[0191] The MIPI interface can be used to connect the processor 110 with peripheral devices such as the display screen 194 and the camera 193. The MIPI interface includes a camera serial interface (CSI), a display serial interface (DSI), etc. In some embodiments, the processor 110 and the camera 193 communicate via the CSI interface to realize the shooting function of the electronic device 100. The processor 110 and the display screen 194 communicate via the DSI interface to realize the display function of the electronic device 100.
[0192] The GPIO interface can be configured by software. The GPIO interface can be configured as a control signal or as a data signal. In some embodiments, the GPIO interface can be used to connect the processor 110 with the camera 193, the display 194, the wireless communication module 160, the audio module 170, the sensor module 180, etc. The GPIO interface can also be configured as an I2C interface, an I2S interface, a UART interface, a MIPI interface, etc.
[0193] The USB interface 130 is an interface that complies with the USB standard specification, and specifically can be a Mini USB interface, a Micro USB interface, a USB Type C interface, etc. The USB interface 130 can be used to connect a charger to charge the electronic device 100, and can also be used to transfer data between the electronic device 100 and a peripheral device. It can also be used to connect headphones to play audio through the headphones. The interface can also be used to connect other electronic devices, such as AR devices, etc.
[0194] It is understandable that the interface connection relationship between the modules illustrated in the embodiment of the present invention is only a schematic illustration and does not constitute a structural limitation on the electronic device 100. In other embodiments of the present application, the electronic device 100 may also adopt different interface connection methods in the above embodiments, or a combination of multiple interface connection methods.
[0195] The charging management module 140 is used to receive charging input from a charger. The charger may be a wireless charger or a wired charger. In some wired charging embodiments, the charging management module 140 may receive charging input from a wired charger through the USB interface 130. In some wireless charging embodiments, the charging management module 140 may receive wireless charging input through a wireless charging coil of the electronic device 100. While the charging management module 140 is charging the battery 142, it may also power the electronic device through the power management module 141.
[0196] The power management module 141 is used to connect the battery 142, the charging management module 140 and the processor 110. The power management module 141 receives input from the battery 142 and / or the charging management module 140, and supplies power to the processor 110, the internal memory 121, the display screen 194, the camera 193, and the wireless communication module 160. The power management module 141 can also be used to monitor parameters such as battery capacity, battery cycle number, battery health status (leakage, impedance), etc. In some other embodiments, the power management module 141 can also be set in the processor 110. In other embodiments, the power management module 141 and the charging management module 140 can also be set in the same device.
[0197] The wireless communication function of the electronic device 100 can be implemented through the antenna 1, the antenna 2, the mobile communication module 150, the wireless communication module 160, the modem processor and the baseband processor.
[0198] Antenna 1 and antenna 2 are used to transmit and receive electromagnetic wave signals. Each antenna in electronic device 100 can be used to cover a single or multiple communication frequency bands. Different antennas can also be reused to improve the utilization of antennas. For example, antenna 1 can be reused as a diversity antenna for a wireless local area network. In some other embodiments, the antenna can be used in combination with a tuning switch.
[0199] The mobile communication module 150 can provide solutions for wireless communications including 2G / 3G / 4G / 5G applied to the electronic device 100. The mobile communication module 150 may include at least one filter, a switch, a power amplifier, a low noise amplifier (LNA), etc. The mobile communication module 150 can receive electromagnetic waves from the antenna 1, and filter, amplify, and process the received electromagnetic waves, and transmit them to the modulation and demodulation processor for demodulation. The mobile communication module 150 can also amplify the signal modulated by the modulation and demodulation processor, and convert it into electromagnetic waves for radiation through the antenna 1. In some embodiments, at least some of the functional modules of the mobile communication module 150 can be set in the processor 110. In some embodiments, at least some of the functional modules of the mobile communication module 150 can be set in the same device as at least some of the modules of the processor 110.
[0200] The modem processor may include a modulator and a demodulator. Among them, the modulator is used to modulate the low-frequency baseband signal to be sent into a medium-high frequency signal. The demodulator is used to demodulate the received electromagnetic wave signal into a low-frequency baseband signal. The demodulator then transmits the demodulated low-frequency baseband signal to the baseband processor for processing. After the low-frequency baseband signal is processed by the baseband processor, it is passed to the application processor. The application processor outputs a sound signal through an audio device (not limited to a speaker 170A, a receiver 170B, etc.), or displays an image or video through a display screen 194. In some embodiments, the modem processor may be an independent device. In other embodiments, the modem processor may be independent of the processor 110 and be set in the same device as the mobile communication module 150 or other functional modules.
[0201] The wireless communication module 160 can provide wireless communication solutions including wireless local area network (WLAN) (such as wireless fidelity (Wi-Fi) network), Bluetooth (BT), global navigation satellite system (GNSS), frequency modulation (FM), near field communication (NFC), infrared (IR), etc., which are applied to the electronic device 100. The wireless communication module 160 can be one or more devices integrating at least one communication processing module. The wireless communication module 160 receives electromagnetic waves via the antenna 2, modulates the frequency of the electromagnetic wave signal and performs filtering, and sends the processed signal to the processor 110. The wireless communication module 160 can also receive the signal to be sent from the processor 110, modulate the frequency of it, amplify it, and convert it into electromagnetic waves for radiation through the antenna 2.
[0202] In some embodiments, the antenna 1 of the electronic device 100 is coupled to the mobile communication module 150, and the antenna 2 is coupled to the wireless communication module 160, so that the electronic device 100 can communicate with the network and other devices through wireless communication technology. The wireless communication technology may include Global System For Mobile Communication (GSM), General Packet Radio Service (GPRS), Code Division Multiple Access (CDMA), Wideband Code Division Multiple Access (WCDMA), Time-Division Code Division Multiple Access (TD-SCDMA), Long Term Evolution (LTE), BT, GNSS, WLAN, NFC, FM, and / or IR technology. GNSS may include the Global Positioning System (GPS), the Global Navigation Satellite System (GLONASS), the Beidou Navigation Satellite System (BDS), the Quasi-Zenith Satellite System (QZSS) and / or the Satellite Based Augmentation System (SBAS).
[0203] The electronic device 100 implements the display function through a GPU, a display screen 194, and an application processor. The GPU is a microprocessor for image processing, which connects the display screen 194 and the application processor. The GPU is used to perform mathematical and geometric calculations for graphics rendering. The processor 110 may include one or more GPUs that execute program instructions to generate or change display information.
[0204] The display screen 194 is used to display images, videos, etc. The display screen 194 includes a display panel. The display panel can be a liquid crystal display (LCD), an organic light-emitting diode (OLED), an active-matrix organic light-emitting diode or an active-matrix organic light-emitting diode (AMOLED), a flexible light-emitting diode (FLED), Miniled, MicroLed, Micro-oLed, a quantum dot light-emitting diode (QLED), etc. In some embodiments, the electronic device 100 may include 1 or N display screens 194, where N is a positive integer greater than 1.
[0205] The electronic device 100 can realize the shooting function through ISP, camera 193, video codec, GPU, display screen 194 and application processor.
[0206] ISP is used to process the data fed back by camera 193. For example, when taking a photo, the shutter is opened, and the light is transmitted to the camera photosensitive element through the lens. The light signal is converted into an electrical signal, and the camera photosensitive element transmits the electrical signal to ISP for processing and converts it into an image visible to the naked eye. ISP can also perform algorithm optimization on the noise, brightness, and skin color of the image. ISP can also optimize the exposure, color temperature and other parameters of the shooting scene. In some embodiments, ISP can be set in camera 193.
[0207] The camera 193 is used to capture still images or videos. The object generates an optical image through the lens and projects it onto the photosensitive element. The photosensitive element can be a charge coupled device (CCD) or a complementary metal oxide semiconductor (CMOS) phototransistor. The photosensitive element converts the optical signal into an electrical signal, and then transmits the electrical signal to the ISP for conversion into a digital image signal. The ISP outputs the digital image signal to the DSP for processing. The DSP converts the digital image signal into an image signal in a standard RGB, YUV or other format. In some embodiments, the electronic device 100 may include 1 or N cameras 193, where N is a positive integer greater than 1.
[0208] The digital signal processor is used to process digital signals, and can process not only digital image signals but also other digital signals. For example, when the electronic device 100 is selecting a frequency point, the digital signal processor is used to perform Fourier transform on the frequency point energy.
[0209] The video codec is used to compress or decompress digital video. The electronic device 100 may support one or more video codecs. In this way, the electronic device 100 can play or record videos in multiple coding formats, such as Moving Picture Experts Group (MPEG) 1, MPEG2, MPEG3, MPEG4, etc.
[0210] NPU is a neural network (NN) computing processor. By drawing on the structure of biological neural networks, such as the transmission mode between neurons in the human brain, it can quickly process input information and can also continuously self-learn. Through NPU, applications such as intelligent cognition of the electronic device 100 can be realized, such as image recognition, face recognition, voice recognition, text understanding, etc.
[0211] The external memory interface 120 can be used to connect an external memory card, such as a Micro SD card, to expand the storage capacity of the electronic device 100. The external memory card communicates with the processor 110 through the external memory interface 120 to implement a data storage function, such as storing music, video and other files in the external memory card.
[0212] The internal memory 121 can be used to store computer executable program codes, and the executable program codes include instructions. The internal memory 121 may include a program storage area and a data storage area. Among them, the program storage area may store an operating system, an application required for at least one function (such as a sound playback function, an image playback function, etc.), etc. The data storage area may store data created during the use of the electronic device 100 (such as audio data, a phone book, etc.), etc. In addition, the internal memory 121 may include a high-speed random access memory, and may also include a non-volatile memory, such as at least one disk storage device, a flash memory device, a universal flash memory (Universal Flash Storage, UFS), etc. The processor 110 executes various functional applications and data processing of the electronic device 100 by running instructions stored in the internal memory 121, and / or instructions stored in a memory provided in the processor.
[0213] The electronic device 100 can implement audio functions such as music playing and recording through the audio module 170, the speaker 170A, the receiver 170B, the microphone 170C, the headphone jack 170D, and the application processor.
[0214] The audio module 170 is used to convert digital audio information into analog audio signal output, and is also used to convert analog audio input into digital audio signals. The audio module 170 can also be used to encode and decode audio signals. In some embodiments, the audio module 170 can be arranged in the processor 110, or some functional modules of the audio module 170 can be arranged in the processor 110.
[0215] The speaker 170A, also called a "speaker", is used to convert an audio electrical signal into a sound signal. The electronic device 100 can listen to music or listen to a hands-free call through the speaker 170A.
[0216] The receiver 170B, also called a "earpiece", is used to convert audio electrical signals into sound signals. When the electronic device 100 receives a call or voice message, the voice can be received by placing the receiver 170B close to the human ear.
[0217] Microphone 170C, also called "microphone" or "microphone", is used to convert sound signals into electrical signals. When making a call or sending a voice message, the user can speak by putting their mouth close to microphone 170C to input the sound signal into microphone 170C. The electronic device 100 can be provided with at least one microphone 170C. In other embodiments, the electronic device 100 can be provided with two microphones 170C, which can not only collect sound signals but also realize noise reduction function. In other embodiments, the electronic device 100 can also be provided with three, four or more microphones 170C to collect sound signals, reduce noise, identify the sound source, realize directional recording function, etc.
[0218] The earphone interface 170D is used to connect a wired earphone and can be a USB interface 130 or a 3.5 mm Open Mobile Terminal Platform (OMTP) standard interface or a Cellular Telecommunications Industry Association of the USA (CTIA) standard interface.
[0219] The pressure sensor 180A is used to sense the pressure signal and can convert the pressure signal into an electrical signal. In some embodiments, the pressure sensor 180A can be set on the display screen 194. There are many types of pressure sensors 180A, such as resistive pressure sensors, inductive pressure sensors, capacitive pressure sensors, etc. The capacitive pressure sensor can be a parallel plate including at least two conductive materials. When a force acts on the pressure sensor 180A, the capacitance between the electrodes changes. The electronic device 100 determines the intensity of the pressure according to the change in capacitance. When a touch operation acts on the display screen 194, the electronic device 100 detects the touch operation intensity according to the pressure sensor 180A. The electronic device 100 can also calculate the touch position according to the detection signal of the pressure sensor 180A. In some embodiments, touch operations acting on the same touch position but with different touch operation intensities can correspond to different operation instructions. For example: when a touch operation with a touch operation intensity less than the first pressure threshold acts on the short message application icon, an instruction to view the short message is executed. When a touch operation with a touch operation intensity greater than or equal to the first pressure threshold acts on the short message application icon, an instruction to create a new short message is executed.
[0220] The gyro sensor 180B can be used to determine the motion posture of the electronic device 100. In some embodiments, the angular velocity of the electronic device 100 around three axes (i.e., x, y, and z axes) can be determined by the gyro sensor 180B. The gyro sensor 180B can be used for anti-shake shooting. For example, when the shutter is pressed, the gyro sensor 180B detects the angle of the electronic device 100 shaking, calculates the distance that the lens module needs to compensate based on the angle, and allows the lens to offset the shaking of the electronic device 100 through reverse movement to achieve anti-shake. The gyro sensor 180B can also be used for navigation and somatosensory game scenes.
[0221] The air pressure sensor 180C is used to measure air pressure. In some embodiments, the electronic device 100 calculates the altitude through the air pressure value measured by the air pressure sensor 180C to assist positioning and navigation.
[0222] The magnetic sensor 180D includes a Hall sensor. The electronic device 100 can use the magnetic sensor 180D to detect the opening and closing of the flip leather case. In some embodiments, when the electronic device 100 is a flip phone, the electronic device 100 can detect the opening and closing of the flip cover according to the magnetic sensor 180D. Then, according to the detected opening and closing state of the leather case or the opening and closing state of the flip cover, the flip cover can be automatically unlocked.
[0223] The acceleration sensor 180E can detect the magnitude of the acceleration of the electronic device 100 in all directions (generally three axes). When the electronic device 100 is stationary, the magnitude and direction of gravity can be detected. It can also be used to identify the posture of the electronic device and is applied to applications such as horizontal and vertical screen switching and pedometers.
[0224] The distance sensor 180F is used to measure the distance. The electronic device 100 can measure the distance by infrared or laser. In some embodiments, when shooting a scene, the electronic device 100 can use the distance sensor 180F to measure the distance to achieve fast focusing.
[0225] The proximity light sensor 180G may include, for example, a light emitting diode (LED) and a light detector, such as a photodiode. The light emitting diode may be an infrared light emitting diode. The electronic device 100 emits infrared light outward through the light emitting diode. The electronic device 100 uses a photodiode to detect infrared reflected light from nearby objects. When sufficient reflected light is detected, it can be determined that there is an object near the electronic device 100. When insufficient reflected light is detected, the electronic device 100 can determine that there is no object near the electronic device 100. The electronic device 100 can use the proximity light sensor 180G to detect that the user holds the electronic device 100 close to the ear to talk, so as to automatically turn off the screen to save power. The proximity light sensor 180G can also be used in leather case mode and pocket mode to automatically unlock and lock the screen.
[0226] The ambient light sensor 180L is used to sense the ambient light brightness. The electronic device 100 can adaptively adjust the brightness of the display screen 194 according to the perceived ambient light brightness. The ambient light sensor 180L can also be used to automatically adjust the white balance when taking pictures. The ambient light sensor 180L can also cooperate with the proximity light sensor 180G to detect whether the electronic device 100 is in a pocket to prevent accidental touches.
[0227] The fingerprint sensor 180H is used to collect fingerprints. The electronic device 100 can use the collected fingerprint characteristics to implement fingerprint unlocking, access application locks, fingerprint photography, fingerprint call answering, etc.
[0228] The temperature sensor 180J is used to detect temperature. In some embodiments, the electronic device 100 uses the temperature detected by the temperature sensor 180J to execute a temperature processing strategy. For example, when the temperature reported by the temperature sensor 180J exceeds a threshold, the electronic device 100 reduces the performance of a processor located near the temperature sensor 180J to reduce power consumption and implement thermal protection. In other embodiments, when the temperature is lower than another threshold, the electronic device 100 heats the battery 142 to avoid abnormal shutdown of the electronic device 100 due to low temperature. In other embodiments, when the temperature is lower than another threshold, the electronic device 100 performs a boost on the output voltage of the battery 142 to avoid abnormal shutdown caused by low temperature.
[0229] The touch sensor 180K is also called a "touch control device". The touch sensor 180K can be set on the display screen 194. The touch sensor 180K and the display screen 194 form a touch screen, also called a "touch control screen". The touch sensor 180K is used to detect touch operations acting on or near it. The touch sensor can pass the detected touch operation to the application processor to determine the type of touch event. Visual output related to the touch operation can be provided through the display screen 194. In other embodiments, the touch sensor 180K can also be set on the surface of the electronic device 100, which is different from the position of the display screen 194.
[0230] The working principle of the CFA device 180M can be found in the relevant description of the Quadra CFA device, which will not be repeated here.
[0231] The key 190 includes a power key, a volume key, etc. The key 190 may be a mechanical key or a touch key. The electronic device 100 may receive key input and generate key signal input related to user settings and function control of the electronic device 100.
[0232] Motor 191 can generate vibration prompts. Motor 191 can be used for incoming call vibration prompts, and can also be used for touch vibration feedback. For example, touch operations acting on different applications (such as taking pictures, audio playback, etc.) can correspond to different vibration feedback effects. For touch operations acting on different areas of the display screen 194, motor 191 can also correspond to different vibration feedback effects. Different application scenarios (for example: time reminders, receiving messages, alarm clocks, games, etc.) can also correspond to different vibration feedback effects. The touch vibration feedback effect can also support customization.
[0233] Indicator 192 may be an indicator light, which may be used to indicate charging status, power changes, messages, missed calls, notifications, etc.
[0234] The SIM card interface 195 is used to connect a SIM card. The SIM card can be connected to and separated from the electronic device 100 by inserting it into the SIM card interface 195 or pulling it out from the SIM card interface 195. The electronic device 100 can support 1 or N SIM card interfaces, where N is a positive integer greater than 1. The SIM card interface 195 can support Nano SIM cards, Micro SIM cards, SIM cards, and the like. Multiple cards can be inserted into the same SIM card interface 195 at the same time. The types of the multiple cards can be the same or different. The SIM card interface 195 can also be compatible with different types of SIM cards. The SIM card interface 195 can also be compatible with external memory cards. The electronic device 100 interacts with the network through the SIM card to implement functions such as calls and data communications. In some embodiments, the electronic device 100 uses an eSIM, i.e., an embedded SIM card. The eSIM card can be embedded in the electronic device 100 and cannot be separated from the electronic device 100.
[0235] It is to be understood that the structure illustrated in the embodiments of the present invention does not constitute a specific limitation on the electronic device. In other embodiments, the electronic device may include more or fewer components than shown in the figure, or combine some components, or split some components, or arrange the components differently. The components shown in the figure may be implemented in hardware, software, or a combination of software and hardware.
[0236] The embodiment of the present application also provides a computer-readable storage medium, which stores instructions. When the instructions are executed on a computer, the computer executes the image processing method for the camera application of the embodiment of the present application.
[0237] Computer-readable storage media include volatile and nonvolatile, removable and non-removable media implemented in any method or technology for storing information (such as computer-readable instructions, data structures, program modules or other data). Computer-readable storage media include, but are not limited to, random access memory (Random Access Memory, RAM), read-only memory (Read-Only Memory, ROM), electrically erasable programmable read-only memory (Electrically Erasable Programmable Read-Only Memory, EEPROM), flash memory or other memory, compact disc read-only memory (Compact Disc Read-Only Memory, CD-ROM), digital versatile disc (Digital Versatile Disc, DVD) or other optical disk storage, magnetic cassettes, magnetic tapes, magnetic disk storage or other magnetic storage devices, or any other medium that can be used to store the desired information and can be accessed by a computer.
[0238] The embodiments of the present application have been described in detail above in conjunction with the accompanying drawings, but the present application is not limited to the above embodiments, and various changes can be made within the knowledge scope of ordinary technicians in the relevant technical field without departing from the purpose of the present application.
Claims
1. An image processing method for camera application, applied to electronic equipment, characterized in that: The method comprises: Starting a first camera application and displaying a first interface; Displaying a first preview image in a first time period, the first preview image is displayed in the first interface, in the first time period, the ambient light brightness is a first brightness, the resolution sent by the first camera application to the camera of the electronic device is a first resolution, and the resolution of the first preview image is a second resolution; Displaying a second preview image in a second time period, the second preview image is displayed in the first interface, the ambient light brightness is a second brightness, and the resolution of the second preview image is a third resolution in the second time period; Based on the fact that the first resolution is greater than the third resolution and the second brightness is less than the first brightness, the second resolution is greater than the third resolution.
2. The image processing method for camera application according to claim 1, characterized in that: The method further comprises: Close the first camera application, start the second camera application, and display the second interface; A third preview image is displayed in a third time period, and the third preview image is displayed in the second interface. In the third time period, the ambient light brightness is the first brightness or the second brightness, and the resolution sent by the second camera application to the camera of the electronic device is a fourth resolution. Based on the fourth resolution being smaller than the first resolution, the resolution of the third preview image is the third resolution.
3. The image processing method for camera application according to claim 1, characterized in that: Based on the fact that the first resolution is greater than the third resolution and the ISO value is less than a preset sensitivity threshold, the resolution of the first preview image is the second resolution.
4. The image processing method for camera application according to claim 1, characterized in that: Based on the fact that the first resolution is greater than the third resolution and the ISO value is greater than or equal to a preset sensitivity threshold, the resolution of the second preview image is the third resolution.
5. The image processing method for camera application according to claim 2, characterized in that: Based on the fact that the fourth resolution is smaller than the third resolution and the ISO value is smaller than a preset sensitivity threshold, the resolution of the third preview image is the third resolution.
6. The image processing method for camera application according to claim 2, characterized in that: Based on the fact that the fourth resolution is smaller than the third resolution and the ISO value is greater than or equal to a preset sensitivity threshold, the resolution of the third preview image is the third resolution.
7. The image processing method for camera application according to any one of claims 1 to 6, characterized in that: Before displaying the first preview image in the first time period, the method further includes: The first camera application sends a stream allocation request to a camera driver through a camera API of the electronic device, wherein the stream allocation request includes the first resolution; The camera driver configures the preview stream and creates a channel based on the stream allocation request, and determines an initial working mode of the color filter array (CFA) device, wherein the initial working mode includes a binning mode or a non-binning mode; The first resolution is the resolution of the original image, and the CFA device is used to convert the original image into a preview image; based on the working mode of the CFA device being the binning mode, the resolution of the preview image displayed by the first camera application is the third resolution; based on the working mode of the CFA device being the non-binning mode, the resolution of the preview image displayed by the first camera application is the second resolution.
8. The image processing method for camera application according to claim 7, characterized in that: The determining the initial operating mode of the CFA device includes: Based on the first resolution being greater than the third resolution and the ISO value being less than a preset sensitivity threshold, determining that the initial operating mode of the CFA device is the non-binning mode; Based on the first resolution being less than or equal to the third resolution, or the ISO value being greater than or equal to the preset sensitivity threshold, determining that the initial operating mode of the CFA device is the binning mode.
9. The image processing method for camera application according to claim 7 or 8, characterized in that: The method further comprises: Based on the successful stream allocation, the first camera application sends a frame processing request to the camera driver through the camera API, where the frame processing request includes the first resolution and the original image; The camera driver converts the original image into the preview image based on the frame processing request.
10. The image processing method for camera application according to claim 9, characterized in that: The converting the original image into the preview image comprises: Determining a preset operating mode of the CFA device, the preset operating mode comprising the binning mode or the non-binning mode; Determining the operating mode of the CFA device based on the preset operating mode and a reference operating mode, the reference operating mode being the operating mode of the CFA device when processing the last frame processing request, or the initial operating mode; Setting the operating mode of the CFA device; The CFA device is driven to convert the original image into the preview image.
11. The image processing method for camera application according to claim 10, characterized in that: The determining the operating mode of the CFA device based on the preset operating mode and the reference operating mode includes: Based on the fact that the preset working mode is the same as the reference working mode, determining that the working mode of the CFA device is the reference working mode; Based on the difference between the preset working mode and the reference working mode, the working mode of the CFA device is determined to be the preset working mode.
12. The image processing method for camera application according to claim 10 or 11, characterized in that: The step of setting the working mode of the CFA device includes: Based on the operation mode of the CFA device being determined as the preset operation mode, seamless switching is performed through a preconfigured register or register group to switch the reference operation mode to the preset operation mode.
13. An electronic device, characterized in that: The electronic device includes a memory, a processor, a camera, a sensor module and a display screen, the camera is used to capture static images or videos, the sensor module includes a color filter array CFA device and an ambient light sensor, the working mode of the CFA device includes a binning mode or a non-binning mode, the ambient light sensor is used to sense the ambient light brightness, the display screen is used to display an interface, the memory is used to store instructions, and the processor is used to run the instructions stored in the memory, so that the electronic device executes the image processing method for camera application described in any one of claims 1 to 12.
14. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores instructions, and when the instructions are executed on a computer, the computer is enabled to execute the image processing method for camera application according to any one of claims 1 to 12.
Citation Information
Patent Citations
Image data display method, electronic equipment and storage medium
CN112153293A
Shooting method and device
CN112437237A
Shooting preview method and device, terminal and computer readable storage medium
CN112822413A
Preview resolution adaptation method and device and electronic equipment
CN114422694A
Image shooting method and device, storage medium and program product
CN115706850A