[go: up one dir, main page]

WO2025011069A1 - Image processing method for camera application and related device - Google Patents

Image processing method for camera application and related device Download PDF

Info

Publication number
WO2025011069A1
WO2025011069A1 PCT/CN2024/081180 CN2024081180W WO2025011069A1 WO 2025011069 A1 WO2025011069 A1 WO 2025011069A1 CN 2024081180 W CN2024081180 W CN 2024081180W WO 2025011069 A1 WO2025011069 A1 WO 2025011069A1
Authority
WO
WIPO (PCT)
Prior art keywords
resolution
camera
camera application
mode
image
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
PCT/CN2024/081180
Other languages
French (fr)
Chinese (zh)
Inventor
周铂凯
袁燊
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Honor Device Co Ltd
Original Assignee
Honor Device Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Honor Device Co Ltd filed Critical Honor Device Co Ltd
Publication of WO2025011069A1 publication Critical patent/WO2025011069A1/en
Anticipated expiration legal-status Critical
Pending legal-status Critical Current

Links

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N23/00Cameras or camera modules comprising electronic image sensors; Control thereof
    • H04N23/60Control of cameras or camera modules
    • H04N23/63Control of cameras or camera modules by using electronic viewfinders
    • H04N23/631Graphical user interfaces [GUI] specially adapted for controlling image capture or setting capture parameters
    • H04N23/632Graphical user interfaces [GUI] specially adapted for controlling image capture or setting capture parameters for displaying or modifying preview images prior to image capturing, e.g. variety of image resolutions or capturing parameters
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N23/00Cameras or camera modules comprising electronic image sensors; Control thereof
    • H04N23/60Control of cameras or camera modules
    • H04N23/63Control of cameras or camera modules by using electronic viewfinders
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N23/00Cameras or camera modules comprising electronic image sensors; Control thereof
    • H04N23/60Control of cameras or camera modules
    • H04N23/667Camera operation mode switching, e.g. between still and video, sport and normal or high- and low-resolution modes
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N23/00Cameras or camera modules comprising electronic image sensors; Control thereof
    • H04N23/70Circuitry for compensating brightness variation in the scene
    • H04N23/71Circuitry for evaluating the brightness variation
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N25/00Circuitry of solid-state image sensors [SSIS]; Control thereof
    • H04N25/10Circuitry of solid-state image sensors [SSIS]; Control thereof for transforming different wavelengths into image signals
    • H04N25/11Arrangement of colour filter arrays [CFA]; Filter mosaics
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N25/00Circuitry of solid-state image sensors [SSIS]; Control thereof
    • H04N25/70SSIS architectures; Circuits associated therewith
    • H04N25/76Addressed sensors, e.g. MOS or CMOS sensors
    • H04N25/77Pixel circuitry, e.g. memories, A/D converters, pixel amplifiers, shared circuits or shared components

Definitions

  • 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.
  • the electronic device 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.
  • 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.
  • 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.
  • 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
  • the resolution of the first preview image is a second resolution.
  • a second preview image is displayed in a second time period
  • the second preview image is displayed in the first interface.
  • the ambient light brightness is a second brightness
  • 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.
  • 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.
  • 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.
  • the resolution of the preview image displayed by the second camera application is correspondingly smaller 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 changes, the resolution of the preview image will change accordingly. As the resolution sent by the camera application to the camera increases, the resolution of the preview image will increase accordingly. Therefore, when the resolution sent by the camera application to the camera is high, the resolution of the preview image is high, and thus the clarity of the preview image is also high.
  • the resolution of the first preview image is the second resolution.
  • the resolution of the second preview image is the third resolution.
  • the resolution of the third preview image is the third resolution.
  • the resolution of the third preview image is the third resolution.
  • the method 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.
  • 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;
  • 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;
  • 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.
  • 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.
  • 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.
  • 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.
  • 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.
  • 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.
  • the second aspect of the embodiment of the present application provides an electronic device, the electronic device includes a memory, a processor, a camera, a sensor module and a display screen, the camera is used to shoot a static image or a video, the sensor module includes a color filter array CFA device and 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 is used to display the 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 of the camera application of the embodiment of the present application.
  • the electronic device includes a memory, a processor, a camera, a sensor module and a display screen
  • the camera is used to shoot a static image or a video
  • the sensor module includes a color filter array CFA device and ambient light sensor
  • the working mode of the CFA device includes a binning mode or a non-binning mode
  • a third aspect of an embodiment of the present application provides a computer-readable storage medium, which stores instructions.
  • the 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.
  • FIG. 1 is a schematic diagram of a software structure of an electronic device provided by way of example.
  • FIG. 2 is a schematic diagram of converting an original image into a box-sized image, provided by an example.
  • FIG. 3 is a schematic diagram of converting an original image into a non-binning size image, provided by an example.
  • FIG. 4 is a schematic diagram of the software structure of an electronic device provided in an embodiment of the present application.
  • FIG. 5 is a timing diagram of an image processing method for a camera application provided in an embodiment of the present application.
  • FIG. 6 is a flowchart of sub-steps of step S508 in FIG. 5 .
  • FIG. 7 is a flowchart of sub-steps of step S514 in FIG. 5 .
  • FIG. 8 is a flowchart of sub-steps of step S702 in FIG. 7 .
  • FIG. 9 is a schematic diagram of the hardware structure of an electronic device provided in an embodiment of the present application.
  • FIG. 1 is a schematic diagram of a software structure of an electronic device provided by way of example.
  • the software system of an electronic device is divided into three layers, from top to bottom: application (APP) layer, framework (Framework) layer and hardware abstract layer (Hardware Abstract Layer, HAL).
  • APP application
  • framework Framework
  • HAL hardware abstract layer
  • the APP layer includes a camera application, and the camera application may include a system camera application or a third-party camera application.
  • the Framework layer provides application programming interfaces (APIs) for the applications in the APP layer, such as the Camera API.
  • the Framework layer includes the Camera Service module, which is used to implement the Camera API call.
  • 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.
  • 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.
  • the following takes the preview scene of the camera application as an example and describes the implementation process of the preview function in conjunction with FIG1 .
  • the camera application When the camera application is started, the camera application sends a resolution request to the camera driver through the Camera API. The request is used to request a 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.
  • a problem may occur in which the target resolution cannot be determined, resulting in the camera application being unable to output a preview image.
  • the camera application 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.
  • 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.
  • the camera driver sends the stream allocation result to the camera application through the Camera API.
  • the stream allocation result includes a successful stream allocation or a failed stream allocation.
  • 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 to convert the original image into a corresponding preview image.
  • the camera driver converts the original image into a preview image and sends the preview image to the camera application through the Camera API.
  • the camera application displays the preview image on the preview interface.
  • the camera driver converting the original image into the preview image includes: converting the original image into the preview image by driving a sensor.
  • the sensor includes a color filter array (CFA) device, such as a quadra CFA device.
  • CFA color filter array
  • the following uses the Quadra CFA device as an example to explain how the camera driver converts the original image into a preview image.
  • the working mode of the Quadra CFA device is usually Binning mode or non-binning mode (also called full-size mode).
  • 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.
  • 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 the 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 smaller than the target resolution of the original image.
  • 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.
  • ISP Image Signal Processor
  • 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 the same as the target resolution of the original image.
  • a 16MP (or M, megapixel) Quadra CFA device starts Binning mode in a dark scene and converts 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 that of the original image, the Binning size image has a higher brightness than the original image.
  • the 16MP Quadra CFA device starts the Fullsize mode and converts the pixel arrangement of the 16M original image into the Bayer pattern pixel arrangement, thereby providing a 16M Fullsize image with the Bayer pattern pixel arrangement.
  • Quadra CFA devices may include 4cell 1 devices, 9cell 1 devices, or 16cell 1 devices.
  • 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.
  • CMOS complementary metal oxide semiconductor
  • the camera driver sets the working mode of the 4cell 1 device to Fullsize mode, and the 4cell 1 device performs processing through Remosaic technology to convert the original image into a Fullsize image with pixels arranged in a Bayer pattern.
  • Remosaic technology includes software and hardware methods. The software method uses the Remosaic algorithm, and the hardware method is internal processing of the device.
  • the Binning size image provided by the Quadra CFA device has a higher brightness, which can meet the user's demand for image brightness.
  • the ambient light is normal or strong, the user's perception of image resolution is more obvious, but the perception of image sensitivity is less obvious.
  • the working mode of the Quadra CFA device is still Binning mode, the resolution of the Binning size image provided by the Quadra CFA device is low, which cannot meet the user's demand for image resolution and will affect the user experience.
  • the camera driver sets the working mode of the Quadra CFA device to Fullsize mode.
  • the Fullsize image provided by the Quadra CFA device has a higher resolution, which can meet the user's demand for image resolution.
  • the chip platform allows the initial resolution reported by the Quadra CFA 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.
  • 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.
  • the 9MP Quadra CFA device itself can support providing 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.
  • 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.
  • FIG. 4 is a schematic diagram of the software structure of an electronic device provided in an embodiment of the present application.
  • 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 the 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.
  • a resolution configuration file is a file pre-configured in the system or pushed to the cloud, such as a resolution customization template (such as an XML template) for a third-party camera application and a third-party camera application page.
  • the resolution configuration file can store the camera application version number, product name, camera application package name, camera application page, camera ID, and stream configuration information.
  • the configuration information may include a shooting mode and a customized resolution.
  • the shooting mode may be a photo, video or preview mode.
  • the resolution profile is:
  • 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
  • 3840 2400 indicates the customized resolution corresponding to the shooting mode.
  • the camera application parses the resolution configuration file by calling the resolution customization API. For example:
  • tinyxml2 is the Xml parser used to parse Xml files
  • CustomCameraSetting is the resolution configuration file.
  • the camera application determines the target resolution based on the initial resolution and the custom resolution.
  • 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.
  • the distribution request sent by the camera application includes a 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.
  • 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 a preset working mode of the Quadra CFA device according to a sensitivity value and a target resolution during processing of a frame processing request.
  • 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.
  • 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.
  • the camera driver calls the FindbestSensorMode function to perform the first mode adaptation. Module functions.
  • the camera driver calls the OnExecuteProcessRequest function to execute the functions of the frame processing module.
  • the OnSelectSensorMode function is nested in the OnExecuteProcessRequest function, and the camera driver calls the OnSelectSensorMode function to execute the functions of the mode selection module.
  • the FindBestSensorMode function is nested in the OnSelectSensorMode function, and the camera driver calls the FindBestSensorMode function to execute the functions of the second mode adaptation module.
  • the camera driver calls the FindbestSensorMode function to perform the following operations:
  • the camera application custom field for example, ThirdAppCustomSupport.
  • 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.
  • an 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.
  • 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.
  • the camera application custom field can be stored in the sensor driver file (for example, the Sensor Xml driver file).
  • 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.
  • the camera application custom field is set to True, it indicates that the camera application supports mode selection, indicating that the working mode of the Quadra CFA device can be set to Fullsize mode or Binning mode.
  • the camera application custom field is set to False, it indicates that the camera application does not support mode selection, indicating that the working mode of the Quadra CFA device is a single mode (Fullsize mode or Binning mode).
  • the sensitivity (ISO) value is used to measure the sensitivity of the camera's photosensitive element to ambient light.
  • the camera's photosensitive element is more sensitive to ambient light, indicating that the current ambient light brightness is weak.
  • 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.
  • 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.
  • 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.
  • the camera driver calls the OnExecuteProcessRequest function to perform the following operations:
  • 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.
  • the FindbestSensorMode function After determining the preset working mode, the FindbestSensorMode function returns the preset working mode indicator.
  • the preset working mode indicator is used to indicate that the preset working mode is Fullsize mode or Binning mode.
  • 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 or Binning mode. When the preset working mode indicator is set to 0, it indicates that the preset working mode is Binning mode.
  • the initial working mode indicator may be stored in the sensor driver file.
  • 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.
  • the OnselectSensorMode function 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.
  • the working mode of the Quadra CFA device is set to Fullsize mode or Binning mode according to the working mode indicator.
  • 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.
  • 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.
  • the pre-configured registers or register groups can be stored in the sensor driver file.
  • the sensor driver file is:
  • sensorModeFrom is the initial working mode indicator
  • reg1, reg2, and reg3 are pre-configured registers or register groups.
  • the Quadra CFA device When the Quadra CFA device is 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 is 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.
  • the camera driver 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.
  • the camera application 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 Camera API.
  • the second frame processing request includes the target resolution and the original image.
  • the camera driver 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.
  • the OnselectSensorMode function is different, as follows:
  • the working mode indicator when processing the previous frame processing request can be stored in the sensor driver file.
  • 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.
  • 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.
  • FIG. 5 is a timing diagram of an image processing method for a camera application provided in an embodiment of the present application.
  • the image processing method of the camera application includes the following steps:
  • the camera application sends a resolution request to the Camera Service module.
  • 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, and generates a resolution list.
  • 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
  • the customized resolution is greater than the boxed resolution
  • the initial resolution reported by the camera driver is 1M and 2M.
  • 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 ⁇ .
  • the Camera Service module sends a resolution list to the camera application.
  • the resolution list is ⁇ 1M, 2M, 3M, 5M, 7M, 9M ⁇ .
  • the target resolution determined by the camera application based on the resolution list is 9M.
  • the target resolution determined by the camera application based on the resolution list is 5M.
  • the camera application sends a streaming request to the Camera Service module.
  • the streaming request includes a target resolution.
  • the Camera Service module sends a stream distribution request to the camera driver.
  • the camera driver configures the preview stream and creates a channel based on the stream allocation request, and calls FindbestSensorMode function to determine the initial operating mode of the Quadra CFA device.
  • the camera driver sends the stream allocation result to the Camera Service module.
  • the flow allocation result includes flow allocation success or flow allocation failure.
  • the Camera Service module sends the stream allocation result to the camera application.
  • 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.
  • the Camera Service module sends the first frame processing request to the camera driver.
  • 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.
  • the camera driver sends a preview image to the Camera Service module.
  • the Camera Service module sends a preview image to the camera application.
  • the camera application displays a preview image corresponding to the first frame processing request on a preview interface of the camera application.
  • the camera application sends a second frame processing request to the Camera Service module.
  • 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.
  • the Camera Service module sends a second frame processing request to the camera driver.
  • 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.
  • the camera driver sends a preview image to the Camera Service module.
  • the Camera Service module sends a preview image to the camera application.
  • the camera application displays a preview image corresponding to the second frame processing request on a preview interface of the camera application.
  • the FindbestSensorMode function is called to determine the initial working mode of the Quadra CFA device, including the following sub-steps:
  • 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.
  • step S701 is substantially the same as the process shown in FIG6 , and will not be described in detail here.
  • S702 call the OnselectSensorMode function to determine the operating mode of the Quadra CFA device.
  • the OnselectSensorMode function is called to determine the working mode of the Quadra CFA device, including the following sub-steps:
  • S802 Determine whether the preset working mode indicator is the same as the initial working mode indicator.
  • step S520 The specific implementation of the above step S520 is roughly the same as the process shown in Figure 7. The difference between the two is that in the specific implementation of the above step S702 (the process shown in Figure 8), the "initial working mode indicator" is replaced by the "working mode indicator when processing the previous frame processing request".
  • 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.
  • 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 Fullsize mode to meet the user's demand 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 demand for image brightness.
  • 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.
  • 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.
  • 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.
  • 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.
  • the first brightness indicates that the ambient light brightness is normal or relatively 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.
  • Second scenario The ambient light brightness is low and the target resolution determined by the camera application is greater than the binning resolution.
  • 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.
  • the first brightness indicates that the ambient light brightness is normal or strong
  • the second brightness indicates that the ambient light brightness is weak
  • the first resolution is greater than the binning 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.
  • 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.
  • 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.
  • the first brightness indicates that the ambient light brightness is normal or strong
  • the fourth resolution is less than or equal to the binning 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.
  • 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.
  • 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.
  • the first brightness indicates that the ambient light brightness is normal or strong
  • the second brightness indicates that the ambient light brightness is weak
  • the fourth resolution is less than or equal to the binning 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.
  • FIG. 9 is a schematic diagram of the hardware structure of an electronic device provided in an embodiment of the present application.
  • 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.
  • SIM Subscriber Identification Module
  • the sensor module 180 may include Pressure sensor 180A, gyroscope sensor 180B, air pressure sensor 180C, magnetic sensor 180D, acceleration sensor 180E, distance sensor 180F, proximity light sensor 180G, fingerprint sensor 180H, temperature sensor 180J, touch sensor 180K, ambient light sensor 180L, CFA device 180M, etc.
  • 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.
  • 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.
  • AP application processor
  • GPU graphics processor
  • ISP image signal processor
  • DSP digital signal processor
  • NPU neural network processor
  • 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.
  • the processor 110 may also be provided with a memory for storing instructions and data.
  • 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.
  • 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.
  • I2C Inter-Integrated Circuit
  • I2S Inter-Integrated Circuit Sound
  • PCM Pulse Code Modulation
  • UART Universal Asynchronous Receiver/Transmitter
  • MIPI Mobile Industry Processor Interface
  • GPIO General-Purpose Input/Output
  • SIM Subscriber Identity Module
  • USB Universal Serial Bus
  • the I2C interface is a bidirectional synchronous serial bus, including a serial data line (SDA) and a serial clock line (SCL).
  • 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.
  • 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, thereby realizing the touch function of the electronic device 100.
  • the I2S interface can be used for audio communication.
  • 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.
  • 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.
  • the PCM interface can also be used for audio communication, sampling, quantizing and encoding analog signals.
  • the audio module 170 and the wireless communication module 160 can be coupled via a PCM bus interface.
  • 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.
  • 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.
  • the UART interface is usually Used to connect the processor 110 and the wireless communication module 160.
  • the processor 110 communicates with the Bluetooth module in the wireless communication module 160 through the UART interface to implement the Bluetooth function.
  • the audio module 170 can transmit audio signals to the wireless communication module 160 through the UART interface to implement the function of playing music through a Bluetooth headset.
  • 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.
  • the processor 110 and the camera 193 communicate through the CSI interface to realize the shooting function of the electronic device 100.
  • the processor 110 and the display screen 194 communicate through the DSI interface to realize the display function of the electronic device 100.
  • the GPIO interface can be configured by software.
  • the GPIO interface can be configured as a control signal or as a data signal.
  • 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.
  • the USB interface 130 is an interface that complies with the USB standard specification, and 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 transmit 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.
  • 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.
  • the electronic device 100 may also adopt different interface connection methods in the above embodiments, or a combination of multiple interface connection methods.
  • 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.
  • the charging management module 140 may receive charging input from a wired charger through the USB interface 130.
  • 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.
  • 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.
  • the power management module 141 can also be set in the processor 110.
  • the power management module 141 and the charging management module 140 can also be set in the same device.
  • 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.
  • 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.
  • antenna 1 can be reused as a diversity antenna for a wireless local area network.
  • the antenna can be used in combination with a tuning switch.
  • the mobile communication module 150 can provide solutions for wireless communications including 2G/3G/4G/5G, etc., 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 (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 modem processor for demodulation.
  • the mobile communication module 150 can also amplify the signal modulated by the modem processor, and convert it into electromagnetic waves for radiation through the antenna 1.
  • at least some functional modules of the mobile communication module 150 may be disposed in the processor 110.
  • at least some functional modules of the mobile communication module 150 may be disposed in the same device as at least some modules of the processor 110.
  • the modem processor may include a modulator and a demodulator.
  • 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.
  • 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.
  • the modem processor may be an independent device.
  • 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.
  • 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) and the like 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 processing, 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 the signal, amplify the signal, and convert it into electromagnetic waves for radiation through the antenna 2.
  • 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 can include the Global Positioning System (GPS), the Global Navigation Satellite System (GLONASS), the Beidou Navigation Satellite System (BDS), the Quasi-Zenith Satellite System (QZSS) and/or the Satellite Based Augmentation System (SBAS).
  • GPS Global Positioning System
  • GLONASS Global Navigation Satellite System
  • BDS Beidou Navigation Satellite System
  • QZSS Quasi-Zenith Satellite System
  • SBAS Satellite Based Augmentation System
  • 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.
  • 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 (Quantum Dot
  • the electronic device 100 may include 1 or N display screens 194, where N is a positive integer greater than 1.
  • the electronic device 100 can realize the shooting function through ISP, camera 193, video codec, GPU, display screen 194 and application processor.
  • 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.
  • 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.
  • CMOS complementary metal oxide semiconductor
  • the photosensitive element converts the optical signal into an electrical signal, and then transmits the electrical signal to the ISP to be converted 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.
  • the electronic device 100 may include 1 or N cameras 193, where N is a positive integer greater than 1.
  • 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.
  • Video codecs are used to compress or decompress digital videos.
  • the electronic device 100 may support one or more video codecs. In this way, the electronic device 100 may play or record videos in a variety of coding formats, such as Moving Picture Experts Group (MPEG) 1, MPEG2, MPEG3, MPEG4, etc.
  • MPEG Moving Picture Experts Group
  • MPEG2 MPEG2, MPEG3, MPEG4, etc.
  • NPU is a neural network (NN) computing processor.
  • NN neural network
  • applications such as intelligent cognition of the electronic device 100 can be realized, such as image recognition, face recognition, voice recognition, text understanding, etc.
  • 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. For example, files such as music and videos can be stored in the external memory card.
  • 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.
  • 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.
  • 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 storage (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.
  • 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.
  • 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.
  • the audio module 170 may be disposed in the processor 110 , or some functional modules of the audio module 170 may be disposed in the processor 110 .
  • 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.
  • the receiver 170B also called a "earpiece" is used to convert audio electrical signals into sound signals.
  • the voice can be received by placing the receiver 170B close to the human ear.
  • 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.
  • the earphone interface 170D is used to connect a wired earphone.
  • the earphone interface 170D may be the USB interface 130, or may be a 3.5 mm Open Mobile Terminal Platform (OMTP) standard interface or a Cellular Telecommunications Industry Association of the USA (CTIA) standard interface.
  • OMTP Open Mobile Terminal Platform
  • CTIA Cellular Telecommunications Industry Association of the USA
  • the pressure sensor 180A is used to sense the pressure signal and can convert the pressure signal into an electrical signal.
  • the pressure sensor 180A can be set on the display screen 194.
  • the capacitive pressure sensor can be a parallel plate including at least two conductive materials.
  • the electronic device 100 determines the intensity of the pressure according to the change in capacitance.
  • 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.
  • 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.
  • the gyro sensor 180B can be used to determine the motion posture of the electronic device 100.
  • the angular velocity of the electronic device 100 around three axes i.e., x, y, and z axes
  • 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.
  • the air pressure sensor 180C is used to measure air pressure.
  • the electronic device 100 calculates the altitude through the air pressure value measured by the air pressure sensor 180C to assist positioning and navigation.
  • 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.
  • the electronic device 100 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.
  • the acceleration sensor 180E can detect the magnitude of the acceleration of the electronic device 100 in various 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. Applicable to applications such as horizontal and vertical screen switching, pedometer, etc.
  • 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.
  • 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.
  • 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.
  • 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.
  • the temperature sensor 180J is used to detect temperature.
  • 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.
  • 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.
  • 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.
  • CFA device 180M The working principle of CFA device 180M can be found in the relevant description of Quadra CFA device, which will not be repeated here.
  • 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.
  • 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.
  • touch operations acting on different applications can correspond to different vibration feedback effects.
  • touch operations acting on different areas of the display screen 194 can also correspond to different vibration feedback effects.
  • Different application scenarios for example: time reminders, receiving messages, alarm clocks, games, etc.
  • the touch vibration feedback effect can also support customization.
  • Indicator 192 may be an indicator light, which may be used to indicate charging status, power changes, messages, missed calls, notifications, etc.
  • 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.
  • 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.
  • the structure illustrated in the embodiments of the present invention does not constitute a specific limitation on the electronic device.
  • 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.
  • the embodiment of the present application also provides a computer-readable storage medium, which stores instructions.
  • the 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.
  • Computer-readable storage media include volatile and nonvolatile, removable and non-removable media implemented in any method or technology for storage of information such as computer-readable instructions, data structures, program modules or other data.
  • Computer-readable storage media include, but are not limited to, random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory, compact disc read-only memory (CD-ROM), digital versatile disc (DVD) or other optical disk storage, magnetic cassettes, magnetic tapes, 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.

Landscapes

  • Engineering & Computer Science (AREA)
  • Multimedia (AREA)
  • Signal Processing (AREA)
  • Human Computer Interaction (AREA)
  • Studio Devices (AREA)

Abstract

The present application relates to the technical field of electronic information. Provided in the embodiments of the present application are an image processing method for a camera application and a related device. The image processing method for a camera application is applied to an electronic device, and 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 being displayed in a first interface, wherein, in the first time period, the ambient light brightness is a first brightness, and a resolution issued by the first camera application to a camera of the electronic device is a first resolution; and displaying a second preview image in a second time period, the second preview image being displayed in the first interface, wherein, 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. The third resolution is less than the first resolution, the second brightness is less than the first brightness, and a second resolution is greater than the third resolution. Thus, on the basis of the first brightness being greater than the second brightness, the preview image having a greater resolution is displayed.

Description

相机应用的图像处理方法及相关设备Image processing method and related equipment for camera application

相关申请的交叉引用CROSS-REFERENCE TO RELATED APPLICATIONS

本申请要求在2023-07-12提交中国专利局、申请号为202310854155.0、申请名称为“相机应用的图像处理方法及相关设备”的中国专利的优先权,其全部内容通过引用结合在本申请中。This application claims priority to a Chinese patent filed with the Chinese Patent Office on July 12, 2023, with application number 202310854155.0 and application name “Image processing method and related equipment for camera applications”, the entire contents of which are incorporated by reference in this application.

技术领域Technical Field

本申请实施例涉及电子信息技术领域,具体涉及一种相机应用的图像处理方法及相关设备。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

电子设备在启动相机应用时,可以将摄像头拍摄的原始图像转换成预览图像,在相机应用的界面上显示预览图像。然而,在某些情况下,例如在环境光亮度较强时,预览图像的分辨率较低,导致预览图像的清晰度较低。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

本申请实施例提供一种相机应用的图像处理方法及相关设备,旨在解决在环境光亮度较强时预览图像的清晰度较低的问题。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.

本申请实施例第一方面提供一种相机应用的图像处理方法,应用于电子设备,方法包括:启动第一相机应用,显示第一界面。在第一时间段显示第一预览图像,第一预览图像被显示在第一界面中,在第一时间段,环境光亮度为第一亮度,第一相机应用向电子设备的摄像头下发的分辨率为第一分辨率,第一预览图像的分辨率为第二分辨率。在第二时间段显示第二预览图像,第二预览图像被显示在第一界面中,在第二时间段,环境光亮度为第二亮度,第二预览图像的分辨率为第三分辨率。基于第一分辨率大于第三分辨率,且第二亮度小于第一亮度,第二分辨率大于第三分辨率。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.

在本实施例中,基于环境光亮度从第一亮度变为第二亮度,且第一分辨率大于第三分辨率,第一相机应用显示的预览图像的分辨率相应地从第二分辨率变为第三分辨率。即,随环境光亮度发生变化,预览图像的分辨率会相应地发生变化。基于环境光亮度变强,预览图像的分辨率会相应地提高。由此,在环境光亮度较强时,预览图像的分辨率较高,从而预览图像的清晰度也较高。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.

在一种实施方式中,方法还包括:关闭第一相机应用,启动第二相机应用,显示第二界面。在第三时间段显示第三预览图像,第三预览图像被显示在第二界面中,在第三时间段,环境光亮度为第一亮度或第二亮度,第二相机应用向电子设备的摄像头下发的分辨率为第四分辨率,基于第四分辨率小于第一分辨率,第三预览图像的分辨率为第三分辨率。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.

在本实施例中,基于环境光亮度为第一亮度或第二亮度,且第四分辨率小于第一分辨率,第二相机应用显示的预览图像的分辨率相应地小于第一相机应用显示的预览图像的分 辨率。即,在环境光亮度相同时,随相机应用向摄像头下发的分辨率发生变化,预览图像的分辨率会相应地发生变化。基于相机应用向摄像头下发的分辨率变大,预览图像的分辨率会相应地提高。由此,在相机应用向摄像头下发的分辨率较高时,预览图像的分辨率较高,从而预览图像的清晰度也较高。In this embodiment, based on the ambient light brightness being the first brightness or the second brightness, and the fourth resolution being smaller than the first resolution, the resolution of the preview image displayed by the second camera application is correspondingly smaller 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 changes, the resolution of the preview image will change accordingly. As the resolution sent by the camera application to the camera increases, the resolution of the preview image will increase accordingly. Therefore, when the resolution sent by the camera application to the camera is high, the resolution of the preview image is high, and thus the clarity of the preview image is also high.

在另一种实施方式中,基于第一分辨率大于第三分辨率,且感光度ISO值小于预设感光度阈值,第一预览图像的分辨率为第二分辨率。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.

在另一种实施方式中,基于第一分辨率大于第三分辨率,且ISO值大于或等于预设感光度阈值,第二预览图像的分辨率为第三分辨率。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.

在另一种实施方式中,基于第四分辨率小于第三分辨率,且ISO值小于预设感光度阈值,第三预览图像的分辨率为第三分辨率。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.

在另一种实施方式中,基于第四分辨率小于第三分辨率,且ISO值大于或等于预设感光度阈值,第三预览图像的分辨率为第三分辨率。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.

在另一种实施方式中,在第一时间段显示第一预览图像之前,方法还包括:相机应用通过电子设备的相机API向相机驱动发送配流请求,配流请求包括第一分辨率。相机驱动基于配流请求,配置预览流并创建通道,以及确定色彩滤波阵列CFA器件的初始工作模式,初始工作模式包括装箱模式或非装箱模式;第一分辨率为原始图像的分辨率,CFA器件用于将原始图像转换成预览图像;基于CFA器件的工作模式为装箱模式,第一相机应用显示的预览图像的分辨率为第三分辨率;基于CFA器件的工作模式为非装箱模式,第一相机应用显示的预览图像的分辨率为第二分辨率。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.

在另一种实施方式中,确定CFA器件的初始工作模式,包括:基于第一分辨率大于第三分辨率,且ISO值小于预设感光度阈值,确定CFA器件的初始工作模式为非装箱模式。基于第一分辨率小于或等于第三分辨率,或ISO值大于或等于预设感光度阈值,确定CFA器件的初始工作模式为装箱模式。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.

在另一种实施方式中,方法还包括:基于配流成功,相机应用通过相机API向相机驱动发送帧处理请求,帧处理请求包括第一分辨率和原始图像。相机驱动基于帧处理请求,将原始图像转换成预览图像。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.

在另一种实施方式中,将原始图像转换成预览图像,包括:确定CFA器件的预设工作模式,预设工作模式包括装箱模式或非装箱模式。基于预设工作模式和参考工作模式确定CFA器件的工作模式。参考工作模式为CFA器件在处理上一个帧处理请求时的工作模式,或初始工作模式。设置CFA器件的工作模式。驱动CFA器件来将原始图像转换成预览图像。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.

在另一种实施方式中,基于预设工作模式和参考工作模式确定CFA器件的工作模式,包括:基于预设工作模式和参考工作模式相同,确定CFA器件的工作模式为参考工作模式。基于预设工作模式和参考工作模式不同,确定CFA器件的工作模式为预设工作模式。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.

在另一种实施方式中,设置CFA器件的工作模式,包括:基于CFA器件的工作模式被确定为预设工作模式,通过预配置的寄存器或寄存器组执行无缝切换,以将参考工作模式切换为预设工作模式。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.

本申请实施例第二方面提供一种电子设备,电子设备包括存储器、处理器、摄像头、传感器模块和显示屏,摄像头用于拍摄静态图像或视频,传感器模块包括色彩滤波阵列 CFA器件和环境光传感器,CFA器件的工作模式包括装箱模式或非装箱模式,环境光传感器用于感测环境光亮度,显示屏用于显示界面,存储器用于存储指令,处理器用于运行存储于存储器中的指令,使得电子设备执行本申请实施例的相机应用的图像处理方法。The second aspect of the embodiment of the present application provides an electronic device, the electronic device includes a memory, a processor, a camera, a sensor module and a display screen, the camera is used to shoot a static image or a video, the sensor module includes a color filter array CFA device and 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 is used to display the 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 of the camera application of the embodiment of the present application.

本申请实施例第三方面提供一种计算机可读存储介质,计算机可读存储介质存储有指令,当指令在计算机上运行时,使得计算机执行本申请实施例的相机应用的图像处理方法。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.

本申请实施例第二方面和第三方面所带来的技术效果可参见上述第一方面的相机应用的图像处理方法的相关描述,此处不再赘述。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

图1是一种示例提供的电子设备的软件结构示意图。FIG. 1 is a schematic diagram of a software structure of an electronic device provided by way of example.

图2是一种示例提供的将原始图像转换成装箱尺寸图像的示意图。FIG. 2 is a schematic diagram of converting an original image into a box-sized image, provided by an example.

图3是一种示例提供的将原始图像转换成非装箱尺寸图像的示意图。FIG. 3 is a schematic diagram of converting an original image into a non-binning size image, provided by an example.

图4是本申请一种实施例提供的电子设备的软件结构示意图。FIG. 4 is a schematic diagram of the software structure of an electronic device provided in an embodiment of the present application.

图5是本申请一种实施例提供的相机应用的图像处理方法的时序图。FIG. 5 is a timing diagram of an image processing method for a camera application provided in an embodiment of the present application.

图6是图5中步骤S508的子步骤流程图。FIG. 6 is a flowchart of sub-steps of step S508 in FIG. 5 .

图7是图5中步骤S514的子步骤流程图。FIG. 7 is a flowchart of sub-steps of step S514 in FIG. 5 .

图8是图7中步骤S702的子步骤流程图。FIG. 8 is a flowchart of sub-steps of step S702 in FIG. 7 .

图9是本申请一种实施例提供的电子设备的硬件结构示意图。FIG. 9 is a schematic diagram of the hardware structure of an electronic device provided in an embodiment of the present application.

具体实施方式DETAILED DESCRIPTION

需要说明的是,本申请实施例中“至少一个”是指一个或者多个,“多个”是指两个或多于两个。“和/或”,描述关联对象的关联关系,表示可以存在三种关系,例如,A和/或B可以表示:单独存在A,同时存在A和B,单独存在B的情况,其中A,B可以是单数或者复数。本申请的说明书和权利要求书及附图中的术语“第一”、“第二”、“第三”、“第四”等(如果存在)是用于区别类似的对象,而不是用于描述特定的顺序或先后次序。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.

另外需要说明的是,本申请实施例中公开的方法或流程图所示出的方法,包括用于实现方法的一个或多个步骤,在不脱离权利要求的范围的情况下,多个步骤的执行顺序可以彼此互换,其中某些步骤也可以被删除。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.

图1是一种示例提供的电子设备的软件结构示意图。FIG. 1 is a schematic diagram of a software structure of an electronic device provided by way of example.

如图1所示,电子设备的软件系统分为三层,从上至下分别为应用(Application,APP)层、框架(Framework)层和硬件抽象层(Hardware Abstract Layer,HAL)。As shown in Figure 1, the software system of an electronic device is divided into three layers, from top to bottom: application (APP) layer, framework (Framework) layer and hardware abstract layer (Hardware Abstract Layer, HAL).

APP层包括相机应用,相机应用可以包括系统相机应用或第三方相机应用。The APP layer includes a camera application, and the camera application may include a system camera application or a third-party camera application.

Framework层为APP层的各应用程序提供应用程序编程接口(Application Programming Interface,API),例如相机API(Camera API)。Framework层包括相机服务(Camera Service)模块,Camera Service模块用于实现Camera API的调用。The Framework layer provides application programming interfaces (APIs) for the applications in the APP layer, such as the Camera API. The Framework layer includes the Camera Service module, which is used to implement the Camera API call.

HAL包括相机驱动,相机驱动用于驱动电子设备的相机(也称摄像头)的各个部件(例如传感器)来执行相机的各种功能应用以及数据处理,例如预览、拍照或录像。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.

下面以相机应用的预览场景为例,结合图1对预览功能的实现过程进行说明。The following takes the preview scene of the camera application as an example and describes the implementation process of the preview function in conjunction with FIG1 .

当相机应用启动时,相机应用通过Camera API向相机驱动发送分辨率请求,分辨率 请求用于请求分辨率。相机驱动在接收分辨率请求之后,通过传感器(Sensor)上报的至少一个初始分辨率,通过Camera API向相机应用发送初始分辨率。相机应用基于至少一个初始分辨率确定目标分辨率,目标分辨率是与相机应用的出图尺寸相同或接近的最大分辨率。When the camera application is started, the camera application sends a resolution request to the camera driver through the Camera API. The request is used to request a 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.

在某些情况下,当至少一个初始分辨率中没有与相机应用的出图尺寸相同或接近的分辨率时,可能出现目标分辨率无法被确定的问题,导致相机应用无法输出预览图像。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.

在确定目标分辨率之后,相机应用通过Camera API向相机驱动发送配流请求,配流请求用于请求配置预览流。相机驱动在接收配流请求之后,配置预览流,并创建通道(例如,Pipeline)。其中,预览流包括至少两帧预览图像,通道用于对至少两帧预览图像的处理过程进行流式化封装,得到一个预览流的处理过程。相机驱动在配流完成之后,通过Camera API向相机应用发送配流结果,配流结果包括配流成功或配流失败。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 Camera API. The stream allocation result includes a successful stream allocation or a failed stream allocation.

当配流结果为配流成功时,相机应用通过Camera API向相机驱动发送多个帧处理请求,每个帧处理请求包括一帧原始图像,原始图像的分辨率为目标分辨率,帧处理请求用于请求将原始图像转换成对应的预览图像。对于每个帧处理请求,相机驱动在接收帧处理请求之后,将原始图像转换为预览图像,并通过Camera API向相机应用发送预览图像。相机应用在接收预览图像之后,在预览界面上展示预览图像。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 to convert the original image 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.

其中,相机驱动将原始图像转换为预览图像包括:通过驱动传感器来将原始图像转换成预览图像。传感器包括色彩滤波阵列(Color Filter Array,CFA)器件,例如四合一色彩滤波阵列(Quadra CFA)器件。The camera driver converting the original image into the preview image includes: converting the original image into the preview image by driving a sensor. The sensor includes a color filter array (CFA) device, such as a quadra CFA device.

下面以Quadra CFA器件为例,对相机驱动将原始图像转换为预览图像的工作原理进行说明。The following uses the Quadra CFA device as an example to explain how the camera driver converts the original image into a preview image.

Quadra CFA器件的工作模式通常为装箱模式(Binning mode)或非装箱模式(也称全尺寸模式,Fullsize mode)。在环境光亮度较弱的场景(也称暗态场景)下,相机驱动设置Quadra CFA器件的工作模式为Binning mode。Binning mode下,Quadra CFA器件可以将原始图像转换成装箱尺寸(Binning size)图像,即,将原始图像中的四个相邻像素合并成一个像素,得到Binning size图像。由此,Binning size图像中每个像素的感光面积是原始图像中每个像素的感光面积的四倍,从而在相机应用的预览界面上展示出比原始图像亮度更高的预览图像。Binning mode通过合并像素的方式来改善相机应用输出的图像亮度,由于图像中像素数目越多,图像分辨率越高,因此Binning size图像的分辨率(也称装箱分辨率)小于原始图像的目标分辨率。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 the 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 smaller than the target resolution of the original image.

在环境光亮度正常的场景(也称常态场景)下,相机驱动设置Quadra CFA器件的工作模式为Fullsize mode。由于相机的图像信号处理器(Image Signal Processor,ISP)通道仅允许传输像素排布为拜耳(Bayer)模式的图像,而原始图像的像素排布为非Bayer模式,因此Fullsize mode下,Quadra CFA器件将原始图像的像素排布转换成Bayer模式的像素排布,从而提供能够在ISP通道上传输的非装箱尺寸(也称全尺寸,Fullsize)图像。Fullsize图像的像素数目与原始图像的像素数目相等,由此Fullsize图像的分辨率(也称非装箱分辨率,或全尺寸分辨率)与原始图像的目标分辨率相同。举例而言,16MP(或M,百万像素)Quadra CFA器件在暗态场景下启动Binning mode,将16M原始图像转换成4M Binning size图像,由于Binning size图像中每个像素的感光面积是原始图像中每个像素的感光面积的四倍,因此Binning size图像相对于原始图像具有更高的亮 度。在常态场景下,16MP Quadra CFA器件启动Fullsize mode,将16M原始图像的像素排布转换成Bayer模式的像素排布,从而提供像素排布为Bayer模式的16M Fullsize图像。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 the same as the target resolution of the original image. For example, a 16MP (or M, megapixel) Quadra CFA device starts Binning mode in a dark scene and converts 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 that of the original image, the Binning size image has a higher brightness than the original image. In normal scenarios, the 16MP Quadra CFA device starts the Fullsize mode and converts the pixel arrangement of the 16M original image into the Bayer pattern pixel arrangement, thereby providing a 16M Fullsize image with the Bayer pattern pixel arrangement.

Quadra CFA器件可以包括4cell 1器件、9cell 1器件或16cell 1器件。以4cell 1器件为例,如图2和图3所示,在暗态场景下,相机驱动将4cell 1器件的工作模式设置为Binning mode,4cell 1器件通过互补金属氧化物半导体(Complementary Metal Oxide Semiconductor,CMOS)器件进行内部合成处理,将原始图像转换成Binning size图像。在常态场景下,相机驱动将4cell 1器件的工作模式设置为Fullsize mode,4cell 1器件通过Remosaic技术进行处理,将原始图像转换成像素排布为Bayer模式的Fullsize图像。其中,Remosaic技术包括软件方式和硬件方式,软件方式是采用Remosaic算法,硬件方式是器件内部处理。Quadra CFA devices may include 4cell 1 devices, 9cell 1 devices, or 16cell 1 devices. Taking the 4cell 1 device as an example, as shown in FIG2 and FIG3, 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 performs processing 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.

可以理解,在环境光亮度较弱时,用户对图像感光度的感知较明显,而对图像分辨率的感知较不明显。此时,Quadra CFA器件提供的Binning size图像具有较高的亮度,能够满足用户对图像亮度的需求。在环境光亮度正常或较强时,用户对图像分辨率的感知较明显,而对图像感光度的感知较不明显。此时,若Quadra CFA器件的工作模式仍为Binning mode,则由于Quadra CFA器件提供的Binning size图像的分辨率较低,不能满足用户对图像分辨率的需求,会影响用户体验。由此,在环境光亮度正常或较强时,相机驱动将Quadra CFA器件的工作模式设置为Fullsize mode。此时,Quadra CFA器件提供的Fullsize图像具有较高的分辨率,能够满足用户对图像分辨率的需求。It can be understood that when the ambient light is low, the user's perception of image sensitivity is more obvious, but the perception of 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 is normal or strong, the user's perception of image resolution is more obvious, but the perception of image sensitivity is less obvious. At this time, if the working mode of the Quadra CFA device is still Binning mode, the resolution of the Binning size image provided by the Quadra CFA device is low, which cannot meet the user's demand for image resolution and will affect the user experience. Therefore, when the ambient light 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.

然而,在某些情况下,例如相机应用为第三方相机应用时,芯片平台允许Quadra CFA器件上报的初始分辨率小于或等于装箱分辨率,使得原始图像的目标分辨率小于或等于装箱分辨率,导致相机应用显示的图像的最大出图尺寸为Binning size。在环境光亮度正常或较强时,相机应用显示的图像的分辨率较低,导致图像清晰度较低,影响相机应用的出图效果。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 Quadra CFA 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.

例如,9MP Quadra CFA器件本身能够支持提供分辨率为9M的图像,但受限于芯片平台,相机应用仅能够显示最大分辨率为2M的图像,导致图像清晰度较低。For example, the 9MP Quadra CFA device itself can support providing 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.

基于此,本申请实施例提供一种相机应用的图像处理方法及相关设备,旨在使Quadra CFA器件即使在受限于芯片平台的情况下,仍然能够随环境光亮度的变化适配工作模式,在常态场景下输出Fullsize图像,在暗态场景下输出Binning size图像,从而提高相机应用的出图效果。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.

下面结合图4和图5对本申请实施例提供的相机应用的图像处理方法进行具体说明。The image processing method for the camera application provided in the embodiment of the present application is described in detail below in conjunction with FIG. 4 and FIG. 5 .

图4是本申请一种实施例提供的电子设备的软件结构示意图。FIG. 4 is a schematic diagram of the software structure of an electronic device provided in an embodiment of the present application.

相较于图1,在图4所示的电子设备的软件系统中,Camera API包括分辨率定制接口。分辨率定制接口用于获取相机驱动上报的至少一个初始分辨率和来自分辨率配置文件的至少一个定制分辨率。其中,初始分辨率小于或等于装箱分辨率,定制分辨率大于装箱分辨率。Compared with FIG1 , in the software system of the electronic device shown in FIG4 , 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 the 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.

分辨率配置文件是系统中预配置或云推送的文件,例如针对第三方相机应用和第三方相机应用页面的分辨率定制模板(例如Xml模板)。分辨率配置文件可以存储相机应用的版本号、产品名称、相机应用的包名、相机应用页面、相机标识以及流配置信息。流配 置信息可以包括拍摄模式和定制分辨率。拍摄模式可以为拍照、录像或预览模式。A resolution configuration file is a file pre-configured in the system or pushed to the cloud, such as a resolution customization template (such as an XML template) for a third-party camera application and a third-party camera application page. The resolution configuration file can store the camera application version number, product name, camera application package name, camera application page, camera ID, and stream configuration information. The configuration information may include a shooting mode and a customized resolution. The shooting mode may be a photo, video or preview mode.

例如,分辨率配置文件为:
For example, the resolution profile is:

其中,version表示相机应用的版本号,product表示产品名称,pkg表示相机应用的包名,activity表示相机应用页面,id表示相机标识,content表示流配置信息,33/34/35表示拍摄模式,3840 2400为对应于拍摄模式的定制分辨率。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.

相机应用通过调用分辨率定制接口来解析分辨率配置文件。例如:
The camera application parses the resolution configuration file by calling the resolution customization API. For example:

其中,tinyxml2为用于解析Xml文件的Xml解析器,CustomCameraSetting为分辨率配置文件。Among them, tinyxml2 is the Xml parser used to parse Xml files, and CustomCameraSetting is the resolution configuration file.

在获取初始分辨率和定制分辨率之后,相机应用基于初始分辨率和定制分辨率确定目标分辨率。在受限于芯片平台,Quadra CFA器件上报的初始分辨率小于或等于装箱分辨率时,相机应用仍然能够获取大于装箱分辨率的定制分辨率,由此能够将目标分辨率确定为大于装箱分辨率的一个分辨率。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.

此外,在图4所示的电子设备的软件系统中,相机应用下发的配流请求包括目标分辨率。相机驱动包括第一模式适配模块和帧处理模块。其中,第一模式适配模块用于在配流过程中根据感光度值和目标分辨率确定Quadra CFA器件的初始工作模式。In addition, in the software system of the electronic device shown in FIG4 , the distribution request sent by the camera application includes a 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.

帧处理模块包括模式选择模块,模式选择模块包括第二模式适配模块。其中,第二模式适配模块用于在处理帧处理请求过程中根据感光度值和目标分辨率确定Quadra CFA器件的预设工作模式。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 a preset working mode of the Quadra CFA device according to a sensitivity value and a target resolution during processing of a frame processing request.

模式选择模块用于在获取第二模式适配模块所确定的预设工作模式之后,基于预设工作模式和Quadra CFA器件在处理上一个帧处理请求时的工作模式,或者,基于预设工作模式和初始工作模式,确定Quadra CFA器件在处理当前帧处理请求时的工作模式。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.

帧处理模块用于在获取模式选择模块所确定的工作模式之后,设置Quadra CFA器件的工作模式,再驱动Quadra CFA器件来将原始图像转换成预览图像。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.

例如,在配流过程中,相机驱动调用FindbestSensorMode函数来执行第一模式适配 模块的功能。在处理帧处理请求过程中,相机驱动调用OnExecuteProcessRequest函数来执行帧处理模块的功能。OnExecuteProcessRequest函数中嵌套OnselectSensorMode函数,相机驱动调用OnselectSensorMode函数来执行模式选择模块的功能。OnselectSensorMode函数中嵌套FindbestSensorMode函数,相机驱动调用FindbestSensorMode函数来执行第二模式适配模块的功能。For example, during the streaming process, the camera driver calls the FindbestSensorMode function to perform the first mode adaptation. Module functions. 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 OnSelectSensorMode function is nested in the OnExecuteProcessRequest function, and the camera driver calls the OnSelectSensorMode function to execute the functions of the mode selection module. The FindBestSensorMode function is nested in the OnSelectSensorMode function, and the camera driver calls the FindBestSensorMode function to execute the functions of the second mode adaptation module.

具体地,在配流过程中,相机驱动调用FindbestSensorMode函数来执行如下操作:Specifically, during the streaming process, the camera driver calls the FindbestSensorMode function to perform the following operations:

查询相机应用定制字段(例如,ThirdAppCustomSupport)。当相机应用定制字段指示相机应用支持模式选择时,若目标分辨率大于装箱分辨率,且当前感光度值小于预设感光度阈值,则确定初始工作模式为Fullsize mode。若目标分辨率小于或等于装箱分辨率,或者当前感光度值大于或等于预设感光度阈值,则确定初始工作模式为Binning mode。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.

在确定初始工作模式之后,返回初始工作模式指示符(例如,SensorMode值)。初始工作模式指示符用于指示初始工作模式为Fullsize mode或Binning mode。例如,初始工作模式指示符可被设置为1或0。当初始工作模式指示符被设置为1时,表示初始工作模式为Fullsize mode。当初始工作模式指示符被设置为0时,表示初始工作模式为Binning mode。After determining the initial operating mode, an 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.

其中,相机应用定制字段可被存储于传感器驱动文件(例如,Sensor Xml驱动文件)中。相机驱动在调用FindbestSensorMode函数时,从传感器驱动文件中获取相机应用定制字段。相机应用定制字段用于指示相机应用是否支持模式选择。例如,相机应用定制字段可被设置为True或False。当相机应用定制字段被设置为True时,表示相机应用支持模式选择,说明Quadra CFA器件的工作模式可被设置为Fullsize mode或Binning mode。当相机应用定制字段被设置为False时,表示相机应用不支持模式选择,说明Quadra CFA器件的工作模式为单一模式(Fullsize mode或Binning mode)。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 working 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 working mode of the Quadra CFA device is a single mode (Fullsize mode or Binning mode).

感光度(ISO)值用于衡量相机的感光元件对于环境光的敏感程度。在当前感光度值大于或等于预设感光度阈值时,相机的感光元件对于环境光较敏感,说明当前环境光亮度较弱。在当前感光度值小于预设感光度阈值时,相机的感光元件对于环境光较不敏感,说明当前环境光亮度正常或较强。预设感光度阈值可依需而设,例如预设感光度阈值为700。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.

当配流结果为配流成功时,相机应用通过Camera API向相机驱动发送第一帧处理请求(也称首个帧处理请求),第一帧处理请求包括目标分辨率和原始图像。相机驱动在接收第一帧处理请求之后,调用OnExecuteProcessRequest函数来执行帧处理模块的功能,从而将原始图像转换成预览图像。具体地,相机驱动调用OnExecuteProcessRequest函数来执行如下操作: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 functions 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:

(1)调用FindbestSensorMode函数。(1) Call the FindbestSensorMode function.

查询相机应用定制字段。当相机应用定制字段指示相机应用支持模式选择时,若目标分辨率大于装箱分辨率,且当前感光度值小于预设感光度阈值,则确定预设工作模式为Fullsize mode。若目标分辨率小于或等于装箱分辨率,或者当前感光度值大于或等于预设感光度阈值,则确定预设工作模式为Binning mode。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.

在确定预设工作模式之后,FindbestSensorMode函数返回预设工作模式指示符。预设工作模式指示符用于指示预设工作模式为Fullsize mode或Binning mode。例如,预设工作模式指示符可被设置为1或0。当预设工作模式指示符被设置为1时,表示预设工作模 式为Fullsize mode。当预设工作模式指示符被设置为0时,表示预设工作模式为Binning mode。After determining the preset working mode, the FindbestSensorMode function returns the preset working mode indicator. The preset working mode indicator is used to indicate that 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 or Binning mode. When the preset working mode indicator is set to 0, it indicates that the preset working mode is Binning mode.

(2)调用OnselectSensorMode函数。(2) Call the OnselectSensorMode function.

在获取预设工作模式指示符之后,确定预设工作模式指示符与初始工作模式指示符是否相同。初始工作模式指示符可被存储于传感器驱动文件中。相机驱动在调用OnselectSensorMode函数时,从传感器驱动文件中获取初始工作模式指示符。若预设工作模式指示符与初始工作模式指示符相同,则确定Quadra CFA器件的工作模式为初始工作模式。若预设工作模式指示符与初始工作模式指示符不同,则确定Quadra CFA器件的工作模式为预设工作模式。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.

在确定工作模式之后,OnselectSensorMode函数返回工作模式指示符。工作模式指示符用于指示工作模式为Fullsize mode或Binning mode。例如,工作模式指示符可被设置为1或0。当工作模式指示符被设置为1时,表示工作模式为Fullsize mode。当工作模式指示符被设置为0时,表示工作模式为Binning mode。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.

(3)执行OnExecuteProcessRequest函数的功能。(3) Execute the function of OnExecuteProcessRequest.

在获取工作模式指示符之后,根据工作模式指示符设置Quadra CFA器件的工作模式为Fullsize mode或Binning mode。当工作模式指示符指示Quadra CFA器件的工作模式为初始工作模式时,维持Quadra CFA器件的初始工作模式。当工作模式指示符指示Quadra CFA器件的工作模式为预设工作模式时,将Quadra CFA器件的初始工作模式切换为预设工作模式。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.

在将Quadra CFA器件的初始工作模式切换为预设工作模式时,可通过预配置的寄存器或寄存器组执行无缝(seamless)切换,由此能够减小切换时延,有利于避免因切换工作模式时发生卡顿导致出图时延较长的情况。预配置的寄存器或寄存器组可被存储于传感器驱动文件中。例如,传感器驱动文件为:
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:

其中,sensorModeFrom为初始工作模式指示符,reg1,reg2,reg3为预配置的寄存器或寄存器组。Among them, sensorModeFrom is the initial working mode indicator, and reg1, reg2, and reg3 are pre-configured registers or register groups.

当Quadra CFA器件的工作模式为Fullsize mode时,驱动Quadra CFA器件来将原始图像的像素排布转换成Bayer模式的像素排布,得到Fullsize图像。当Quadra CFA器件的工作模式为Binning mode时,驱动Quadra CFA器件来将原始图像的四个相邻像素合并成一个像素,得到Binning size图像。When the Quadra CFA device is 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 is 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.

相机驱动在获取Fullsize图像或Binning size图像之后,通过Camera API向相机应用发送Fullsize图像或Binning size图像。相机应用在接收Fullsize图像或Binning size图像之后,在预览界面上展示Fullsize图像或Binning size图像。 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.

在预览界面上展示第一帧处理请求对应的预览图像之后,相机应用通过Camera API向相机驱动发送第二帧处理请求(也称非首个帧处理请求),第二帧处理请求包括目标分辨率和原始图像。相机驱动在接收第二帧处理请求之后,调用OnExecuteProcessRequest函数来执行帧处理模块的功能,从而将原始图像转换成预览图像。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 Camera API. 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.

相较于处理第一帧处理请求的过程,在相机驱动调用OnExecuteProcessRequest函数来处理第二帧处理请求时,OnselectSensorMode函数的功能有所不同,具体如下: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:

在获取预设工作模式指示符之后,确定预设工作模式指示符与处理上一个帧处理请求时的工作模式指示符是否相同。处理上一个帧处理请求时的工作模式指示符可被存储于传感器驱动文件中。相机驱动在调用OnselectSensorMode函数时,从传感器驱动文件中获取处理上一个帧处理请求时的工作模式指示符。若预设工作模式指示符与处理上一个帧处理请求时的工作模式指示符相同,则确定Quadra CFA器件的工作模式为处理上一个帧处理请求时的工作模式。若预设工作模式指示符与处理上一个帧处理请求时的工作模式指示符不同,则确定Quadra CFA器件的工作模式为预设工作模式。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.

可以理解,在预览界面上展示一个第二帧处理请求对应的预览图像之后,相机应用通过Camera API向相机驱动发送下一个第二帧处理请求。相机驱动依次对第一帧处理请求和至少一个第二帧处理请求进行处理,然后相机应用相应地在预览界面上依次展示第一帧处理请求对应的预览图像,以及至少一个第二帧处理请求对应的至少一帧预览图像。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.

图5是本申请一种实施例提供的相机应用的图像处理方法的时序图。FIG. 5 is a timing diagram of an image processing method for a camera application provided in an embodiment of the present application.

可一并参阅图4和图5,相机应用的图像处理方法包括如下步骤:Referring to FIG. 4 and FIG. 5 together, the image processing method of the camera application includes the following steps:

S501,相机应用启动。S501, the camera application is started.

S502,相机应用向Camera Service模块发送分辨率请求。S502, the camera application sends a resolution request to the Camera Service module.

S503,Camera Service模块基于分辨率请求,通过调用分辨率定制接口获取相机驱动上报的初始分辨率和来自分辨率配置文件的定制分辨率,并生成分辨率列表。S503, based on the resolution request, 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, and generates a resolution list.

其中,分辨率列表包括至少一个初始分辨率和至少一个定制分辨率。初始分辨率小于或等于装箱分辨率,定制分辨率大于装箱分辨率。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.

以9MP Quadra CFA器件为例,假设装箱分辨率为2M。受限于芯片平台,相机驱动上报的初始分辨率为1M和2M。Camera Service模块在接收相机驱动上报的初始分辨率时,从分辨率配置文件中解析出的定制分辨率为3M、5M、7M和9M。于是,Camera Service模块基于初始分辨率和定制分辨率生成分辨率列表,分辨率列表为{1M,2M,3M,5M,7M,9M}。Take the 9MP Quadra CFA device as an example, assuming 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}.

S504,Camera Service模块向相机应用发送分辨率列表。S504, the Camera Service module sends a resolution list to the camera application.

S505,相机应用基于分辨率列表确定目标分辨率。S505: The camera application determines a target resolution based on the resolution list.

继续以9MP Quadra CFA器件为例,假设分辨率列表为{1M,2M,3M,5M,7M,9M}。当相机应用的出图尺寸为9M时,相机应用基于分辨率列表确定的目标分辨率为9M。当相机应用的出图尺寸为6M时,相机应用基于分辨率列表确定的目标分辨率为5M。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.

S506,相机应用向Camera Service模块发送配流请求。S506, the camera application sends a streaming request to the Camera Service module.

其中,配流请求包括目标分辨率。The streaming request includes a target resolution.

S507,Camera Service模块向相机驱动发送配流请求。S507, the Camera Service module sends a stream distribution request to the camera driver.

S508,相机驱动基于配流请求,配置预览流并创建通道,以及调用 FindbestSensorMode函数来确定Quadra CFA器件的初始工作模式。S508: The camera driver configures the preview stream and creates a channel based on the stream allocation request, and calls FindbestSensorMode function to determine the initial operating mode of the Quadra CFA device.

S509,相机驱动基于FindbestSensorMode函数返回的初始工作模式指示符设置Quadra CFA器件的初始工作模式。S509, the camera driver sets the initial operating mode of the Quadra CFA device based on the initial operating mode indicator returned by the FindbestSensorMode function.

S510,相机驱动向Camera Service模块发送配流结果。S510, the camera driver sends the stream allocation result to the Camera Service module.

其中,配流结果包括配流成功或配流失败。The flow allocation result includes flow allocation success or flow allocation failure.

S511,Camera Service模块向相机应用发送配流结果。S511, the Camera Service module sends the stream allocation result to the camera application.

S512,当配流结果为配流成功时,相机应用向Camera Service模块发送第一帧处理请求。S512: When the stream allocation result is successful, the camera application sends the first frame processing request to the Camera Service module.

其中,第一帧处理请求(首个帧处理请求)包括目标分辨率和原始图像,原始图像的分辨率为目标分辨率。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.

S513,Camera Service模块向相机驱动发送第一帧处理请求。S513, the Camera Service module sends the first frame processing request to the camera driver.

S514,相机驱动基于第一帧处理请求,调用OnExecuteProcessRequest函数来将第一帧处理请求中的原始图像转换成预览图像。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.

S515,相机驱动向Camera Service模块发送预览图像。S515, the camera driver sends a preview image to the Camera Service module.

S516,Camera Service模块向相机应用发送预览图像。S516, the Camera Service module sends a preview image to the camera application.

S517,相机应用在相机应用的预览界面上展示第一帧处理请求对应的预览图像。S517: The camera application displays a preview image corresponding to the first frame processing request on a preview interface of the camera application.

S518,相机应用向Camera Service模块发送第二帧处理请求。S518, the camera application sends a second frame processing request to the Camera Service module.

其中,第二帧处理请求(非首个帧处理请求)包括目标分辨率和原始图像,原始图像的分辨率为目标分辨率。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.

S519,Camera Service模块向相机驱动发送第二帧处理请求。S519, the Camera Service module sends a second frame processing request to the camera driver.

S520,相机驱动基于第二帧处理请求,调用OnExecuteProcessRequest函数来将第二帧处理请求中的原始图像转换成预览图像。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.

S521,相机驱动向Camera Service模块发送预览图像。S521, the camera driver sends a preview image to the Camera Service module.

S522,Camera Service模块向相机应用发送预览图像。S522, the Camera Service module sends a preview image to the camera application.

S523,相机应用在相机应用的预览界面上展示第二帧处理请求对应的预览图像。S523: The camera application displays a preview image corresponding to the second frame processing request on a preview interface of the camera application.

在上述步骤S508中,可参阅图6,调用FindbestSensorMode函数来确定Quadra CFA器件的初始工作模式,包括如下子步骤:In the above step S508, referring to FIG. 6 , the FindbestSensorMode function is called to determine the initial working mode of the Quadra CFA device, including the following sub-steps:

S601,查询相机应用定制字段。S601, query camera application customized fields.

S602,基于相机应用定制字段指示相机应用支持模式选择,从配流请求获取目标分辨率,并通过驱动相机的感光元件来获取当前感光度值。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.

S603,基于目标分辨率大于装箱分辨率,且当前感光度值小于预设感光度阈值,确定初始工作模式为Fullsize mode。S603, based on the target resolution being greater than the binning resolution and the current sensitivity value being less than the preset sensitivity threshold, determines that the initial working mode is Fullsize mode.

S604,基于目标分辨率小于或等于装箱分辨率,或者当前感光度值大于或等于预设感光度阈值,确定初始工作模式为Binning mode。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 the preset sensitivity threshold, determines that the initial working mode is Binning mode.

S605,返回初始工作模式指示符。S605, returning to the initial working mode indicator.

可以理解,相机应用定制字段通常被设置为指示相机应用支持模式选择。也就是说,在某些情况下,可以不执行上述步骤S601。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.

在上述步骤S514中,可参阅图7,调用OnExecuteProcessRequest函数来将第一帧处理请求中的原始图像转换成预览图像,包括如下子步骤:In the above step S514, referring to FIG. 7 , the OnExecuteProcessRequest function is called to convert the original image in the first frame processing request into a preview image, including the following sub-steps:

S701,调用FindbestSensorMode函数来确定Quadra CFA器件的预设工作模式。 S701, calling FindbestSensorMode function to determine the preset working mode of the Quadra CFA device.

可以理解,步骤S701的具体实施方式与图6所示的流程大致相同,此处不再赘述。It can be understood that the specific implementation of step S701 is substantially the same as the process shown in FIG6 , and will not be described in detail here.

S702,调用OnselectSensorMode函数来确定Quadra CFA器件的工作模式。S702, call the OnselectSensorMode function to determine the operating mode of the Quadra CFA device.

S703,基于OnselectSensorMode函数返回的工作模式指示符设置Quadra CFA器件的工作模式。S703, set the operating mode of the Quadra CFA device based on the operating mode indicator returned by the OnselectSensorMode function.

S704,基于Quadra CFA器件的工作模式,驱动Quadra CFA器件来将第一帧处理请求中的原始图像转换成预览图像。S704, based on the working mode of the Quadra CFA device, drives the Quadra CFA device to convert the original image in the first frame processing request into a preview image.

在上述步骤S702中,可参阅图8,调用OnselectSensorMode函数来确定Quadra CFA器件的工作模式,包括如下子步骤:In the above step S702, referring to FIG. 8 , the OnselectSensorMode function is called to determine the working mode of the Quadra CFA device, including the following sub-steps:

S801,获取FindbestSensorMode函数返回的预设工作模式指示符和来自传感器驱动文件的初始工作模式指示符。S801, obtaining a preset working mode indicator returned by the FindbestSensorMode function and an initial working mode indicator from a sensor driver file.

S802,确定预设工作模式指示符与初始工作模式指示符是否相同。S802: Determine whether the preset working mode indicator is the same as the initial working mode indicator.

S803,基于预设工作模式指示符与初始工作模式指示符相同,确定Quadra CFA器件的工作模式为初始工作模式。S803, based on the fact that the preset working mode indicator is the same as the initial working mode indicator, determine that the working mode of the Quadra CFA device is the initial working mode.

S804,基于预设工作模式指示符与初始工作模式指示符不同,确定Quadra CFA器件的工作模式为预设工作模式。S804, based on the fact that the preset working mode indicator is different from the initial working mode indicator, determine that the working mode of the Quadra CFA device is the preset working mode.

S805,返回工作模式指示符。S805, return the working mode indicator.

上述步骤S520的具体实施方式与图7所示的流程大致相同,两者的区别在于,在上述步骤S702的具体实施方式(如图8所示的流程)中,“初始工作模式指示符”被替换成“处理上一个帧处理请求时的工作模式指示符”。The specific implementation of the above step S520 is roughly the same as the process shown in Figure 7. The difference between the two is that in the specific implementation of the above step S702 (the process shown in Figure 8), the "initial working mode indicator" is replaced by the "working mode indicator when processing the previous frame processing request".

在上述实施例中,在受限于芯片平台,相机驱动上报的分辨率小于或等于装箱分辨率时,Camera Service模块通过调用分辨率定制接口获取大于装箱分辨率的定制分辨率,使得相机应用能够基于初始分辨率和定制分辨率确定目标分辨率。由此,相机驱动能够基于目标分辨率和感光度值设置Quadra CFA器件的工作模式。例如,在目标分辨率大于装箱分辨率,且环境光亮度正常或较强时,设置Quadra CFA器件的工作模式为Fullsize mode,满足用户对图像分辨率的需求。在目标分辨率小于或等于装箱分辨率,或者环境光亮度较弱时,设置Quadra CFA器件的工作模式为Binning mode,满足用户对图像亮度的需求。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. As a result, 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 Fullsize mode to meet the user's demand 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 demand for image brightness.

可以理解,对于相机应用输出的预览图像出现拉伸,或因未选到与相机应用的出图尺寸适配的目标分辨率导致预览图像不显示等问题,采用本申请实施例提供的相机应用的图像处理方法,能够解决上述问题,使相机应用提供的图像能够满足用户需求。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.

此外,上述实施例仅以相机应用的预览场景为例,但相机应用的图像处理方法并不限定于预览场景,在拍照场景或录像场景下,相机应用的图像处理方法同样适用。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.

下面结合不同场景对本申请实施例提供的相机应用的图像处理方法进行说明。The image processing method for the camera application provided in the embodiment of the present application is described below in combination with different scenarios.

第一场景:环境光亮度正常或较强,相机应用确定的目标分辨率大于装箱分辨率。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.

相机应用的图像处理方法包括:启动第一相机应用,显示第一界面。在第一时间段显示第一预览图像,第一预览图像被显示在第一界面中,在第一时间段,环境光亮度为第一亮度,第一相机应用确定的目标分辨率为第一分辨率,第一预览图像的分辨率为第二分辨率,第二分辨率等于第一分辨率。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.

在第一场景中,第一亮度表示环境光亮度正常或较强,第一分辨率大于装箱分辨率。 基于环境光亮度为第一亮度,且目标分辨率为第一分辨率,即使芯片平台允许相机驱动上报的分辨率小于或等于装箱分辨率,相机驱动也能够设置CFA器件的工作模式为Fullsize mode,由此第一相机应用输出Fullsize图像。第一预览图像为Fullsize图像。In the first scene, the first brightness indicates that the ambient light brightness is normal or relatively 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.

第二场景:环境光亮度较弱,相机应用确定的目标分辨率大于装箱分辨率。Second scenario: The ambient light brightness is low and the target resolution determined by the camera application is greater than the binning resolution.

相机应用的图像处理方法包括:启动第一相机应用,显示第一界面。在第二时间段显示第二预览图像,第二预览图像被显示在第一界面中,在第二时间段,环境光亮度为第二亮度,第二亮度小于第一亮度,第一相机应用确定的目标分辨率为第一分辨率,第二预览图像的分辨率为第三分辨率,第三分辨率小于第一分辨率。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.

在第二场景中,第一亮度表示环境光亮度正常或较强,第二亮度表示环境光亮度较弱,第一分辨率大于装箱分辨率。基于环境光亮度为第二亮度,且目标分辨率为第一分辨率,相机驱动设置CFA器件的工作模式为Binning mode,由此第一相机应用输出Binning size图像。第二预览图像为Binning size图像。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.

第三场景:环境光亮度正常或较强,相机应用确定的目标分辨率小于或等于装箱分辨率。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.

相机应用的图像处理方法包括:启动第二相机应用,显示第二界面。在第三时间段显示第三预览图像,第三预览图像被显示在第二界面中,在第三时间段,环境光亮度为第一亮度,第二相机应用确定的目标分辨率为第四分辨率,第四分辨率小于第一分辨率,第三预览图像的分辨率为第三分辨率。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.

在第三场景中,第一亮度表示环境光亮度正常或较强,第四分辨率小于或等于装箱分辨率。基于环境光亮度为第一亮度,且目标分辨率为第四分辨率,相机驱动设置CFA器件的工作模式为Binning mode,由此第二相机应用输出Binning size图像。第三预览图像为Binning size图像。In the third scenario, 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.

第四场景:环境光亮度较弱,相机应用确定的目标分辨率小于或等于装箱分辨率。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.

相机应用的图像处理方法包括:启动第二相机应用,显示第二界面。在第三时间段显示第三预览图像,第三预览图像被显示在第二界面中,在第三时间段,环境光亮度为第二亮度,第二相机应用确定的目标分辨率为第四分辨率,第四分辨率小于第一分辨率,第三预览图像的分辨率为第三分辨率。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.

在第四场景中,第一亮度表示环境光亮度正常或较强,第二亮度表示环境光亮度较弱,第四分辨率小于或等于装箱分辨率。基于环境光亮度为第二亮度,且目标分辨率为第四分辨率,相机驱动设置CFA器件的工作模式为Binning mode,由此第二相机应用输出Binning size图像。第三预览图像为Binning size图像。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.

下面对本申请实施例提供的电子设备进行说明。The electronic device provided in the embodiments of the present application is described below.

图9是本申请一种实施例提供的电子设备的硬件结构示意图。FIG. 9 is a schematic diagram of the hardware structure of an electronic device provided in an embodiment of the present application.

可参阅图9,电子设备100包括处理器110,外部存储器接口120,内部存储器121,通用串行总线(Universal Serial Bus,USB)接口130,充电管理模块140,电源管理模块141,电池142,天线1,天线2,移动通信模块150,无线通信模块160,音频模块170,扬声器170A,受话器170B,麦克风170C,耳机接口170D,传感器模块180,按键190,马达191,指示器192,摄像头193,显示屏194,以及用户标识模块(Subscriber Identification Module,SIM)卡接口195等。其中传感器模块180可以包括 压力传感器180A,陀螺仪传感器180B,气压传感器180C,磁传感器180D,加速度传感器180E,距离传感器180F,接近光传感器180G,指纹传感器180H,温度传感器180J,触摸传感器180K,环境光传感器180L,CFA器件180M等。Referring to 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. The sensor module 180 may include Pressure sensor 180A, gyroscope sensor 180B, air pressure sensor 180C, magnetic sensor 180D, acceleration sensor 180E, distance sensor 180F, proximity light sensor 180G, fingerprint sensor 180H, temperature sensor 180J, touch sensor 180K, ambient light sensor 180L, CFA device 180M, etc.

其中,处理器110可以运行存储于内部存储器121中的指令,使得电子设备100执行本申请实施例提供的相机应用的图像处理方法。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.

处理器110可以包括一个或多个处理单元,例如:处理器110可以包括应用处理器(Application Processor,AP),调制解调处理器,图形处理器(Graphics Processing Unit,GPU),图像信号处理器(ISP),控制器,视频编解码器,数字信号处理器(Digital Signal Processor,DSP),基带处理器,和/或神经网络处理器(Neural-Network Processing Unit,NPU)等。其中,不同的处理单元可以是独立的器件,也可以集成在一个或多个处理器中。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 in one or more processors.

控制器可以根据指令操作码和时序信号,产生操作控制信号,完成取指令和执行指令的控制。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.

处理器110中还可以设置存储器,用于存储指令和数据。在一些实施例中,处理器110中的存储器为高速缓冲存储器。该存储器可以保存处理器110刚用过或循环使用的指令或数据。如果处理器110需要再次使用该指令或数据,可从存储器中直接调用。避免重复存取,减少处理器110的等待时间,因而提高系统的效率。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.

在一些实施例中,处理器110可以包括一个或多个接口。接口可以包括集成电路(Inter-Integrated Circuit,I2C)接口,集成电路内置音频(Inter-Integrated Circuit Sound,I2S)接口,脉冲编码调制(Pulse Code Modulation,PCM)接口,通用异步收发传输器(Universal Asynchronous Receiver/Transmitter,UART)接口,移动产业处理器接口(Mobile Industry Processor Interface,MIPI),通用输入输出(General-Purpose Input/Output,GPIO)接口,用户标识模块(SIM)接口,和/或通用串行总线(USB)接口等。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.

I2C接口是一种双向同步串行总线,包括一根串行数据线(Serial Data Line,SDA)和一根串行时钟线(Derail Clock Line,SCL)。在一些实施例中,处理器110可以包含多组I2C总线。处理器110可以通过不同的I2C总线接口分别耦合触摸传感器180K,充电器,闪光灯,摄像头193等。例如:处理器110可以通过I2C接口耦合触摸传感器180K,使处理器110与触摸传感器180K通过I2C总线接口通信,实现电子设备100的触摸功能。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, thereby realizing the touch function of the electronic device 100.

I2S接口可以用于音频通信。在一些实施例中,处理器110可以包含多组I2S总线。处理器110可以通过I2S总线与音频模块170耦合,实现处理器110与音频模块170之间的通信。在一些实施例中,音频模块170可以通过I2S接口向无线通信模块160传递音频信号,实现通过蓝牙耳机接听电话的功能。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.

PCM接口也可以用于音频通信,将模拟信号抽样,量化和编码。在一些实施例中,音频模块170与无线通信模块160可以通过PCM总线接口耦合。在一些实施例中,音频模块170也可以通过PCM接口向无线通信模块160传递音频信号,实现通过蓝牙耳机接听电话的功能。I2S接口和PCM接口都可以用于音频通信。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.

UART接口是一种通用串行数据总线,用于异步通信。该总线可以为双向通信总线。它将要传输的数据在串行通信与并行通信之间转换。在一些实施例中,UART接口通常被 用于连接处理器110与无线通信模块160。例如:处理器110通过UART接口与无线通信模块160中的蓝牙模块通信,实现蓝牙功能。在一些实施例中,音频模块170可以通过UART接口向无线通信模块160传递音频信号,实现通过蓝牙耳机播放音乐的功能。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 usually 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 audio signals to the wireless communication module 160 through the UART interface to implement the function of playing music through a Bluetooth headset.

MIPI接口可以被用于连接处理器110与显示屏194,摄像头193等外围器件。MIPI接口包括摄像头串行接口(Camera Serial Interface,CSI),显示屏串行接口(Display Serial Interface,DSI)等。在一些实施例中,处理器110和摄像头193通过CSI接口通信,实现电子设备100的拍摄功能。处理器110和显示屏194通过DSI接口通信,实现电子设备100的显示功能。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 through the CSI interface to realize the shooting function of the electronic device 100. The processor 110 and the display screen 194 communicate through the DSI interface to realize the display function of the electronic device 100.

GPIO接口可以通过软件配置。GPIO接口可以被配置为控制信号,也可被配置为数据信号。在一些实施例中,GPIO接口可以用于连接处理器110与摄像头193,显示屏194,无线通信模块160,音频模块170,传感器模块180等。GPIO接口还可以被配置为I2C接口,I2S接口,UART接口,MIPI接口等。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.

USB接口130是符合USB标准规范的接口,具体可以是Mini USB接口,Micro USB接口,USB Type C接口等。USB接口130可以用于连接充电器为电子设备100充电,也可以用于电子设备100与外围设备之间传输数据。也可以用于连接耳机,通过耳机播放音频。该接口还可以用于连接其他电子设备,例如AR设备等。The USB interface 130 is an interface that complies with the USB standard specification, and 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 transmit 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.

可以理解的是,本发明实施例示意的各模块间的接口连接关系,只是示意性说明,并不构成对电子设备100的结构限定。在本申请另一些实施例中,电子设备100也可以采用上述实施例中不同的接口连接方式,或多种接口连接方式的组合。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.

充电管理模块140用于从充电器接收充电输入。其中,充电器可以是无线充电器,也可以是有线充电器。在一些有线充电的实施例中,充电管理模块140可以通过USB接口130接收有线充电器的充电输入。在一些无线充电的实施例中,充电管理模块140可以通过电子设备100的无线充电线圈接收无线充电输入。充电管理模块140为电池142充电的同时,还可以通过电源管理模块141为电子设备供电。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.

电源管理模块141用于连接电池142,充电管理模块140与处理器110。电源管理模块141接收电池142和/或充电管理模块140的输入,为处理器110,内部存储器121,显示屏194,摄像头193,和无线通信模块160等供电。电源管理模块141还可以用于监测电池容量,电池循环次数,电池健康状态(漏电,阻抗)等参数。在其他一些实施例中,电源管理模块141也可以设置于处理器110中。在另一些实施例中,电源管理模块141和充电管理模块140也可以设置于同一个器件中。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.

电子设备100的无线通信功能可以通过天线1,天线2,移动通信模块150,无线通信模块160,调制解调处理器以及基带处理器等实现。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.

天线1和天线2用于发射和接收电磁波信号。电子设备100中的每个天线可用于覆盖单个或多个通信频带。不同的天线还可以复用,以提高天线的利用率。例如:可以将天线1复用为无线局域网的分集天线。在另外一些实施例中,天线可以和调谐开关结合使用。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.

移动通信模块150可以提供应用在电子设备100上的包括2G/3G/4G/5G等无线通信的解决方案。移动通信模块150可以包括至少一个滤波器,开关,功率放大器,低噪声放大器(Low Noise Amplifier,LNA)等。移动通信模块150可以由天线1接收电磁波,并对接收的电磁波进行滤波,放大等处理,传送至调制解调处理器进行解调。移动通信模块150还可以对经调制解调处理器调制后的信号放大,经天线1转为电磁波辐射出去。在一 些实施例中,移动通信模块150的至少部分功能模块可以被设置于处理器110中。在一些实施例中,移动通信模块150的至少部分功能模块可以与处理器110的至少部分模块被设置在同一个器件中。The mobile communication module 150 can provide solutions for wireless communications including 2G/3G/4G/5G, etc., 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 (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 modem processor for demodulation. The mobile communication module 150 can also amplify the signal modulated by the modem processor, and convert it into electromagnetic waves for radiation through the antenna 1. In some embodiments, at least some functional modules of the mobile communication module 150 may be disposed in the processor 110. In some embodiments, at least some functional modules of the mobile communication module 150 may be disposed in the same device as at least some modules of the processor 110.

调制解调处理器可以包括调制器和解调器。其中,调制器用于将待发送的低频基带信号调制成中高频信号。解调器用于将接收的电磁波信号解调为低频基带信号。随后解调器将解调得到的低频基带信号传送至基带处理器处理。低频基带信号经基带处理器处理后,被传递给应用处理器。应用处理器通过音频设备(不限于扬声器170A,受话器170B等)输出声音信号,或通过显示屏194显示图像或视频。在一些实施例中,调制解调处理器可以是独立的器件。在另一些实施例中,调制解调处理器可以独立于处理器110,与移动通信模块150或其他功能模块设置在同一个器件中。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.

无线通信模块160可以提供应用在电子设备100上的包括无线局域网(Wireless Local Area Network,WLAN)(如无线保真(Wireless Fidelity,Wi-Fi)网络),蓝牙(BlueTooth,BT),全球导航卫星系统(Global Navigation Satellite System,GNSS),调频(Frequency Modulation,FM),近距离无线通信(Near Field Communication,NFC),红外(Infrared,IR)等无线通信的解决方案。无线通信模块160可以是集成至少一个通信处理模块的一个或多个器件。无线通信模块160经由天线2接收电磁波,将电磁波信号调频以及滤波处理,将处理后的信号发送到处理器110。无线通信模块160还可以从处理器110接收待发送的信号,对其进行调频,放大,经天线2转为电磁波辐射出去。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) and the like 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 processing, 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 the signal, amplify the signal, and convert it into electromagnetic waves for radiation through the antenna 2.

在一些实施例中,电子设备100的天线1和移动通信模块150耦合,天线2和无线通信模块160耦合,使得电子设备100可以通过无线通信技术与网络以及其他设备通信。无线通信技术可以包括全球移动通讯系统(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,和/或IR技术等。GNSS可以包括全球卫星定位系统(Global Positioning System,GPS),全球导航卫星系统(Global Navigation Satellite System,GLONASS),北斗卫星导航系统(Beidou Navigation Satellite System,BDS),准天顶卫星系统(Quasi-Zenith Satellite System,QZSS)和/或星基增强系统(Satellite Based Augmentation System,SBAS)。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 can include the Global Positioning System (GPS), the Global Navigation Satellite System (GLONASS), the Beidou Navigation Satellite System (BDS), the Quasi-Zenith Satellite System (QZSS) and/or the Satellite Based Augmentation System (SBAS).

电子设备100通过GPU,显示屏194,以及应用处理器等实现显示功能。GPU为图像处理的微处理器,连接显示屏194和应用处理器。GPU用于执行数学和几何计算,用于图形渲染。处理器110可包括一个或多个GPU,其执行程序指令以生成或改变显示信息。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.

显示屏194用于显示图像,视频等。显示屏194包括显示面板。显示面板可以采用液晶显示屏(Liquid Crystal Display,LCD),有机发光二极管(Organic Light-Emitting Diode,OLED),有源矩阵有机发光二极体或主动矩阵有机发光二极体(Active-Matrix Organic Light Emitting Diode,AMOLED),柔性发光二极管(Flex Light-Emitting Diode,FLED),Miniled,MicroLed,Micro-oLed,量子点发光二极管(Quantum Dot  Light Emitting Diode,QLED)等。在一些实施例中,电子设备100可以包括1个或N个显示屏194,N为大于1的正整数。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 (Quantum Dot In some embodiments, the electronic device 100 may include 1 or N display screens 194, where N is a positive integer greater than 1.

电子设备100可以通过ISP,摄像头193,视频编解码器,GPU,显示屏194以及应用处理器等实现拍摄功能。The electronic device 100 can realize the shooting function through ISP, camera 193, video codec, GPU, display screen 194 and application processor.

ISP用于处理摄像头193反馈的数据。例如,拍照时,打开快门,光线通过镜头被传递到摄像头感光元件上,光信号转换为电信号,摄像头感光元件将电信号传递给ISP处理,转化为肉眼可见的图像。ISP还可以对图像的噪点,亮度,肤色进行算法优化。ISP还可以对拍摄场景的曝光,色温等参数优化。在一些实施例中,ISP可以设置在摄像头193中。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.

摄像头193用于拍摄静态图像或视频。物体通过镜头生成光学图像投射到感光元件。感光元件可以是电荷耦合器件(Charge Coupled Device,CCD)或互补金属氧化物半导体(Complementary Metal-Oxide-Semiconductor,CMOS)光电晶体管。感光元件把光信号转换成电信号,之后将电信号传递给ISP转换成数字图像信号。ISP将数字图像信号输出到DSP加工处理。DSP将数字图像信号转换成标准的RGB,YUV等格式的图像信号。在一些实施例中,电子设备100可以包括1个或N个摄像头193,N为大于1的正整数。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 to be converted 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.

数字信号处理器用于处理数字信号,除了可以处理数字图像信号,还可以处理其他数字信号。例如,当电子设备100在频点选择时,数字信号处理器用于对频点能量进行傅里叶变换等。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.

视频编解码器用于对数字视频压缩或解压缩。电子设备100可以支持一种或多种视频编解码器。这样,电子设备100可以播放或录制多种编码格式的视频,例如:动态图像专家组(Moving Picture Experts Group,MPEG)1,MPEG2,MPEG3,MPEG4等。Video codecs are used to compress or decompress digital videos. The electronic device 100 may support one or more video codecs. In this way, the electronic device 100 may play or record videos in a variety of coding formats, such as Moving Picture Experts Group (MPEG) 1, MPEG2, MPEG3, MPEG4, etc.

NPU为神经网络(Neural-Network,NN)计算处理器,通过借鉴生物神经网络结构,例如借鉴人脑神经元之间传递模式,对输入信息快速处理,还可以不断的自学习。通过NPU可以实现电子设备100的智能认知等应用,例如:图像识别,人脸识别,语音识别,文本理解等。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.

外部存储器接口120可以用于连接外部存储卡,例如Micro SD卡,实现扩展电子设备100的存储能力。外部存储卡通过外部存储器接口120与处理器110通信,实现数据存储功能。例如将音乐,视频等文件保存在外部存储卡中。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. For example, files such as music and videos can be stored in the external memory card.

内部存储器121可以用于存储计算机可执行程序代码,可执行程序代码包括指令。内部存储器121可以包括存储程序区和存储数据区。其中,存储程序区可存储操作系统,至少一个功能所需的应用程序(比如声音播放功能,图像播放功能等)等。存储数据区可存储电子设备100使用过程中所创建的数据(比如音频数据,电话本等)等。此外,内部存储器121可以包括高速随机存取存储器,还可以包括非易失性存储器,例如至少一个磁盘存储器件,闪存器件,通用闪存存储器(Universal Flash Storage,UFS)等。处理器110通过运行存储在内部存储器121的指令,和/或存储在设置于处理器中的存储器的指令,执行电子设备100的各种功能应用以及数据处理。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 storage (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.

电子设备100可以通过音频模块170,扬声器170A,受话器170B,麦克风170C,耳机接口170D,以及应用处理器等实现音频功能。例如音乐播放,录音等。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.

音频模块170用于将数字音频信息转换成模拟音频信号输出,也用于将模拟音频输入转换为数字音频信号。音频模块170还可以用于对音频信号编码和解码。在一些实施例 中,音频模块170可以设置于处理器110中,或将音频模块170的部分功能模块设置于处理器110中。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, In the embodiment, the audio module 170 may be disposed in the processor 110 , or some functional modules of the audio module 170 may be disposed in the processor 110 .

扬声器170A,也称“喇叭”,用于将音频电信号转换为声音信号。电子设备100可以通过扬声器170A收听音乐,或收听免提通话。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.

受话器170B,也称“听筒”,用于将音频电信号转换成声音信号。当电子设备100接听电话或语音信息时,可以通过将受话器170B靠近人耳接听语音。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.

麦克风170C,也称“话筒”,“传声器”,用于将声音信号转换为电信号。当拨打电话或发送语音信息时,用户可以通过人嘴靠近麦克风170C发声,将声音信号输入到麦克风170C。电子设备100可以设置至少一个麦克风170C。在另一些实施例中,电子设备100可以设置两个麦克风170C,除了采集声音信号,还可以实现降噪功能。在另一些实施例中,电子设备100还可以设置三个,四个或更多麦克风170C,实现采集声音信号,降噪,还可以识别声音来源,实现定向录音功能等。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.

耳机接口170D用于连接有线耳机。耳机接口170D可以是USB接口130,也可以是3.5mm的开放移动电子设备平台(Open Mobile Terminal Platform,OMTP)标准接口,美国蜂窝电信工业协会(Cellular Telecommunications Industry Association of the USA,CTIA)标准接口。The earphone interface 170D is used to connect a wired earphone. The earphone interface 170D may be the USB interface 130, or may be a 3.5 mm Open Mobile Terminal Platform (OMTP) standard interface or a Cellular Telecommunications Industry Association of the USA (CTIA) standard interface.

压力传感器180A用于感受压力信号,可以将压力信号转换成电信号。在一些实施例中,压力传感器180A可以设置于显示屏194。压力传感器180A的种类很多,如电阻式压力传感器,电感式压力传感器,电容式压力传感器等。电容式压力传感器可以是包括至少两个具有导电材料的平行板。当有力作用于压力传感器180A,电极之间的电容改变。电子设备100根据电容的变化确定压力的强度。当有触摸操作作用于显示屏194,电子设备100根据压力传感器180A检测触摸操作强度。电子设备100也可以根据压力传感器180A的检测信号计算触摸的位置。在一些实施例中,作用于相同触摸位置,但不同触摸操作强度的触摸操作,可以对应不同的操作指令。例如:当有触摸操作强度小于第一压力阈值的触摸操作作用于短消息应用图标时,执行查看短消息的指令。当有触摸操作强度大于或等于第一压力阈值的触摸操作作用于短消息应用图标时,执行新建短消息的指令。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.

陀螺仪传感器180B可以用于确定电子设备100的运动姿态。在一些实施例中,可以通过陀螺仪传感器180B确定电子设备100围绕三个轴(即,x,y和z轴)的角速度。陀螺仪传感器180B可以用于拍摄防抖。示例性的,当按下快门,陀螺仪传感器180B检测电子设备100抖动的角度,根据角度计算出镜头模组需要补偿的距离,让镜头通过反向运动抵消电子设备100的抖动,实现防抖。陀螺仪传感器180B还可以用于导航,体感游戏场景。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.

气压传感器180C用于测量气压。在一些实施例中,电子设备100通过气压传感器180C测得的气压值计算海拔高度,辅助定位和导航。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.

磁传感器180D包括霍尔传感器。电子设备100可以利用磁传感器180D检测翻盖皮套的开合。在一些实施例中,当电子设备100是翻盖机时,电子设备100可以根据磁传感器180D检测翻盖的开合。进而根据检测到的皮套的开合状态或翻盖的开合状态,设置翻盖自动解锁等特性。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.

加速度传感器180E可检测电子设备100在各个方向上(一般为三轴)加速度的大小。当电子设备100静止时可检测出重力的大小及方向。还可以用于识别电子设备姿态, 应用于横竖屏切换,计步器等应用。The acceleration sensor 180E can detect the magnitude of the acceleration of the electronic device 100 in various 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. Applicable to applications such as horizontal and vertical screen switching, pedometer, etc.

距离传感器180F,用于测量距离。电子设备100可以通过红外或激光测量距离。在一些实施例中,拍摄场景,电子设备100可以利用距离传感器180F测距以实现快速对焦。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.

接近光传感器180G可以包括例如发光二极管(LED)和光检测器,例如光电二极管。发光二极管可以是红外发光二极管。电子设备100通过发光二极管向外发射红外光。电子设备100使用光电二极管检测来自附近物体的红外反射光。当检测到充分的反射光时,可以确定电子设备100附近有物体。当检测到不充分的反射光时,电子设备100可以确定电子设备100附近没有物体。电子设备100可以利用接近光传感器180G检测用户手持电子设备100贴近耳朵通话,以便自动熄灭屏幕达到省电的目的。接近光传感器180G也可用于皮套模式,口袋模式自动解锁与锁屏。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.

环境光传感器180L用于感知环境光亮度。电子设备100可以根据感知的环境光亮度自适应调节显示屏194亮度。环境光传感器180L也可用于拍照时自动调节白平衡。环境光传感器180L还可以与接近光传感器180G配合,检测电子设备100是否在口袋里,以防误触。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.

指纹传感器180H用于采集指纹。电子设备100可以利用采集的指纹特性实现指纹解锁,访问应用锁,指纹拍照,指纹接听来电等。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.

温度传感器180J用于检测温度。在一些实施例中,电子设备100利用温度传感器180J检测的温度,执行温度处理策略。例如,当温度传感器180J上报的温度超过阈值,电子设备100执行降低位于温度传感器180J附近的处理器的性能,以便降低功耗实施热保护。在另一些实施例中,当温度低于另一阈值时,电子设备100对电池142加热,以避免低温导致电子设备100异常关机。在其他一些实施例中,当温度低于又一阈值时,电子设备100对电池142的输出电压执行升压,以避免低温导致的异常关机。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.

触摸传感器180K,也称“触控器件”。触摸传感器180K可以设置于显示屏194,由触摸传感器180K与显示屏194组成触摸屏,也称“触控屏”。触摸传感器180K用于检测作用于其上或附近的触摸操作。触摸传感器可以将检测到的触摸操作传递给应用处理器,以确定触摸事件类型。可以通过显示屏194提供与触摸操作相关的视觉输出。在另一些实施例中,触摸传感器180K也可以设置于电子设备100的表面,与显示屏194所处的位置不同。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.

CFA器件180M的工作原理具体可参Quadra CFA器件的相关描述,此处不再赘述。The working principle of CFA device 180M can be found in the relevant description of Quadra CFA device, which will not be repeated here.

按键190包括开机键,音量键等。按键190可以是机械按键。也可以是触摸式按键。电子设备100可以接收按键输入,产生与电子设备100的用户设置以及功能控制有关的键信号输入。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.

马达191可以产生振动提示。马达191可以用于来电振动提示,也可以用于触摸振动反馈。例如,作用于不同应用(例如拍照,音频播放等)的触摸操作,可以对应不同的振动反馈效果。作用于显示屏194不同区域的触摸操作,马达191也可对应不同的振动反馈效果。不同的应用场景(例如:时间提醒,接收信息,闹钟,游戏等)也可以对应不同的振动反馈效果。触摸振动反馈效果还可以支持自定义。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.

指示器192可以是指示灯,可以用于指示充电状态,电量变化,也可以用于指示消息,未接来电,通知等。 Indicator 192 may be an indicator light, which may be used to indicate charging status, power changes, messages, missed calls, notifications, etc.

SIM卡接口195用于连接SIM卡。SIM卡可以通过插入SIM卡接口195,或从SIM卡接口195拔出,实现和电子设备100的接触和分离。电子设备100可以支持1个或N个SIM卡接口,N为大于1的正整数。SIM卡接口195可以支持Nano SIM卡,Micro SIM卡,SIM卡等。同一个SIM卡接口195可以同时插入多张卡。多张卡的类型可以相同,也可以不同。SIM卡接口195也可以兼容不同类型的SIM卡。SIM卡接口195也可以兼容外部存储卡。电子设备100通过SIM卡和网络交互,实现通话以及数据通信等功能。在一些实施例中,电子设备100采用eSIM,即:嵌入式SIM卡。eSIM卡可以嵌在电子设备100中,不能和电子设备100分离。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.

可以理解的是,本发明实施例示意的结构并不构成对电子设备的具体限定。在另一些实施例中,电子设备可以包括比图示更多或更少的部件,或者组合某些部件,或者拆分某些部件,或者不同的部件布置。图示的部件可以以硬件,软件或软件和硬件的组合实现。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.

本申请实施例还提供一种计算机可读存储介质,计算机可读存储介质存储有指令,当指令在计算机上运行时,使得计算机执行本申请实施例的相机应用的图像处理方法。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.

计算机可读存储介质包括在用于存储信息(诸如计算机可读指令、数据结构、程序模块或其它数据)的任何方法或技术中实施的易失性和非易失性、可移除和不可移除介质。计算机可读存储介质包括,但不限于随机存取存储器(Random Access Memory,RAM)、只读存储器(Read-Only Memory,ROM)、带电可擦可编程只读存储器(Electrically Erasable Programmable Read-Only Memory,EEPROM)、闪存或其它存储器、只读光盘(Compact Disc Read-Only Memory,CD-ROM)、数字通用光盘(Digital Versatile Disc,DVD)或其它光盘存储、磁盒、磁带、磁盘存储或其它磁存储装置、或者可以用于存储期望的信息并且可以被计算机访问的任何其它的介质。Computer-readable storage media include volatile and nonvolatile, removable and non-removable media implemented in any method or technology for storage of information such as computer-readable instructions, data structures, program modules or other data. Computer-readable storage media include, but are not limited to, random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory, compact disc read-only memory (CD-ROM), digital versatile disc (DVD) or other optical disk storage, magnetic cassettes, magnetic tapes, 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.

上面结合附图对本申请实施例已做详细说明,但是本申请不限于上述实施例,在所属技术领域普通技术人员所具备的知识范围内,还可以在不脱离本申请宗旨的前提下做出各种变化。 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 (14)

一种相机应用的图像处理方法,应用于电子设备,其特征在于,所述方法包括: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. 如权利要求1所述的相机应用的图像处理方法,其特征在于,所述方法还包括: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. 如权利要求1所述的相机应用的图像处理方法,其特征在于,基于所述第一分辨率大于所述第三分辨率,且感光度ISO值小于预设感光度阈值,所述第一预览图像的分辨率为所述第二分辨率。The image processing method for camera application according to claim 1, characterized in that, based on the first resolution being greater than the third resolution and the ISO value being less than a preset sensitivity threshold, the resolution of the first preview image is the second resolution. 如权利要求1所述的相机应用的图像处理方法,其特征在于,基于所述第一分辨率大于所述第三分辨率,且ISO值大于或等于预设感光度阈值,所述第二预览图像的分辨率为所述第三分辨率。The image processing method for camera application according to claim 1, characterized in that, based on the first resolution being greater than the third resolution and the ISO value being greater than or equal to a preset sensitivity threshold, the resolution of the second preview image is the third resolution. 如权利要求2所述的相机应用的图像处理方法,其特征在于,基于所述第四分辨率小于所述第三分辨率,且ISO值小于预设感光度阈值,所述第三预览图像的分辨率为所述第三分辨率。The image processing method for camera application according to claim 2, characterized in that, 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. 如权利要求2所述的相机应用的图像处理方法,其特征在于,基于所述第四分辨率小于所述第三分辨率,且ISO值大于或等于预设感光度阈值,所述第三预览图像的分辨率为所述第三分辨率。The image processing method for camera application according to claim 2, characterized in that, 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. 如权利要求1至6中任一项所述的相机应用的图像处理方法,其特征在于,在第一时间段显示第一预览图像之前,所述方法还包括:The image processing method for a 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 comprises: 所述第一相机应用通过所述电子设备的相机API向相机驱动发送配流请求,所述配流请求包括所述第一分辨率;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; 所述相机驱动基于所述配流请求,配置预览流并创建通道,以及确定色彩滤波阵列CFA器件的初始工作模式,所述初始工作模式包括装箱模式或非装箱模式;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; 所述第一分辨率为原始图像的分辨率,所述CFA器件用于将所述原始图像转换成预览图像;基于所述CFA器件的工作模式为所述装箱模式,所述第一相机应用显示的所述预览图像的分辨率为所述第三分辨率;基于所述CFA器件的工作模式为所述非装箱模式,所述第一相机应用显示的所述预览图像的分辨率为所述第二分辨率。 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. 如权利要求7所述的相机应用的图像处理方法,其特征在于,所述确定所述CFA器件的初始工作模式,包括:The image processing method for camera application according to claim 7, characterized in that the determining the initial working mode of the CFA device comprises: 基于所述第一分辨率大于所述第三分辨率,且ISO值小于预设感光度阈值,确定所述CFA器件的初始工作模式为所述非装箱模式;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; 基于所述第一分辨率小于或等于所述三分辨率,或所述ISO值大于或等于所述预设感光度阈值,确定所述CFA器件的初始工作模式为所述装箱模式。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. 如权利要求7或8所述的相机应用的图像处理方法,其特征在于,所述方法还包括:The image processing method for camera application according to claim 7 or 8, characterized in that the method further comprises: 基于配流成功,所述第一相机应用通过所述相机API向所述相机驱动发送帧处理请求,所述帧处理请求包括所述第一分辨率和所述原始图像;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. 如权利要求9所述的相机应用的图像处理方法,其特征在于,所述将所述原始图像转换成所述预览图像,包括:The image processing method for camera application according to claim 9, characterized in that converting the original image into the preview image comprises: 确定所述CFA器件的预设工作模式,所述预设工作模式包括所述装箱模式或所述非装箱模式;Determining a preset operating mode of the CFA device, the preset operating mode comprising the binning mode or the non-binning mode; 基于所述预设工作模式和参考工作模式确定所述CFA器件的工作模式,所述参考工作模式为所述CFA器件在处理上一个所述帧处理请求时的工作模式,或所述初始工作模式;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; 设置所述CFA器件的工作模式;Setting the operating mode of the CFA device; 驱动所述CFA器件来将所述原始图像转换成所述预览图像。The CFA device is driven to convert the original image into the preview image. 如权利要求10所述的相机应用的图像处理方法,其特征在于,所述基于所述预设工作模式和参考工作模式确定所述CFA器件的工作模式,包括:The image processing method for camera application according to claim 10, characterized in that the determining the working mode of the CFA device based on the preset working mode and the reference working mode comprises: 基于所述预设工作模式和所述参考工作模式相同,确定所述CFA器件的工作模式为所述参考工作模式;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; 基于所述预设工作模式和所述参考工作模式不同,确定所述CFA器件的工作模式为所述预设工作模式。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. 如权利要求10或11所述的相机应用的图像处理方法,其特征在于,所述设置所述CFA器件的工作模式,包括:The image processing method for camera application according to claim 10 or 11, characterized in that setting the working mode of the CFA device comprises: 基于所述CFA器件的工作模式被确定为所述预设工作模式,通过预配置的寄存器或寄存器组执行无缝切换,以将所述参考工作模式切换为所述预设工作模式。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. 一种电子设备,其特征在于,所述电子设备包括存储器、处理器、摄像头、传感器模块和显示屏,所述摄像头用于拍摄静态图像或视频,所述传感器模块包括色彩滤波阵列CFA器件和环境光传感器,所述CFA器件的工作模式包括装箱模式或非装箱模式,所述环境光传感器用于感测环境光亮度,所述显示屏用于显示界面,所述存储器用于存储指令,所述处理器用于运行存储于所述存储器中的指令,使得所述电子设备执行如权利要求1至12中任一项所述的相机应用的图像处理方法。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 as described in any one of claims 1 to 12. 一种计算机可读存储介质,其特征在于,所述计算机可读存储介质存储有指令,当所述指令在计算机上运行时,使得所述计算机执行如权利要求1至12中任一项所述的相机应用的图像处理方法。 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 executes the image processing method for camera application according to any one of claims 1 to 12.
PCT/CN2024/081180 2023-07-12 2024-03-12 Image processing method for camera application and related device Pending WO2025011069A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN202310854155.0A CN119316704A (en) 2023-07-12 2023-07-12 Image processing method and related equipment for camera application
CN202310854155.0 2023-07-12

Publications (1)

Publication Number Publication Date
WO2025011069A1 true WO2025011069A1 (en) 2025-01-16

Family

ID=94186747

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2024/081180 Pending WO2025011069A1 (en) 2023-07-12 2024-03-12 Image processing method for camera application and related device

Country Status (2)

Country Link
CN (1) CN119316704A (en)
WO (1) WO2025011069A1 (en)

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20160080707A1 (en) * 2014-09-16 2016-03-17 Samsung Electronics Co., Ltd. Image photographing apparatus and image photographing method thereof
CN110933302A (en) * 2019-11-27 2020-03-27 维沃移动通信有限公司 Shooting method and electronic equipment
CN112153293A (en) * 2020-09-28 2020-12-29 广东小天才科技有限公司 Image data display method, electronic device, and storage medium
CN112822413A (en) * 2020-12-30 2021-05-18 Oppo(重庆)智能科技有限公司 Shooting preview method, device, terminal and computer readable storage medium
CN113727016A (en) * 2021-06-15 2021-11-30 荣耀终端有限公司 Shooting method and electronic equipment
CN114727004A (en) * 2021-01-05 2022-07-08 北京小米移动软件有限公司 Image acquisition method and device, electronic device, storage medium

Family Cites Families (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112437237B (en) * 2020-12-16 2023-02-03 维沃移动通信有限公司 Shooting method and device
CN115706850B (en) * 2021-08-12 2024-04-05 荣耀终端有限公司 Image shooting method, device and storage medium
CN114422694B (en) * 2022-01-18 2024-03-26 杭州逗酷软件科技有限公司 Preview resolution adaptation method and device and electronic equipment

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20160080707A1 (en) * 2014-09-16 2016-03-17 Samsung Electronics Co., Ltd. Image photographing apparatus and image photographing method thereof
CN110933302A (en) * 2019-11-27 2020-03-27 维沃移动通信有限公司 Shooting method and electronic equipment
CN112153293A (en) * 2020-09-28 2020-12-29 广东小天才科技有限公司 Image data display method, electronic device, and storage medium
CN112822413A (en) * 2020-12-30 2021-05-18 Oppo(重庆)智能科技有限公司 Shooting preview method, device, terminal and computer readable storage medium
CN114727004A (en) * 2021-01-05 2022-07-08 北京小米移动软件有限公司 Image acquisition method and device, electronic device, storage medium
CN113727016A (en) * 2021-06-15 2021-11-30 荣耀终端有限公司 Shooting method and electronic equipment

Also Published As

Publication number Publication date
CN119316704A (en) 2025-01-14

Similar Documents

Publication Publication Date Title
CN112492193B (en) Method and equipment for processing callback stream
CN113810600B (en) Terminal image processing method and device and terminal equipment
WO2020244623A1 (en) Air-mouse mode implementation method and related device
US20250140143A1 (en) Full-Screen Display Method and Apparatus, and Electronic Device
CN113810601B (en) Terminal image processing method and device and terminal equipment
CN114880251B (en) Storage unit access method, access device and terminal equipment
WO2022033344A1 (en) Video stabilization method, and terminal device and computer-readable storage medium
WO2024078275A1 (en) Image processing method and apparatus, electronic device and storage medium
CN114466238B (en) Frame demultiplexing method, electronic device and storage medium
CN115706869A (en) Terminal image processing method and device and terminal equipment
CN112527220B (en) Electronic equipment display method and electronic equipment
CN119654873A (en) Image processing method and electronic device
CN114500901A (en) Double-scene video recording method and device and electronic equipment
CN112532508B (en) Video communication method and video communication device
CN113593567A (en) Method for converting video and sound into text and related equipment
CN117692693B (en) Multi-screen display method, device, program product and storage medium
CN115550714B (en) Subtitle display method and related equipment
CN116582743A (en) A shooting method, electronic device and medium
WO2025011069A1 (en) Image processing method for camera application and related device
CN115297269A (en) Method and electronic device for determining exposure parameters
CN117729420B (en) Continuous shooting method and electronic equipment
EP4589426A1 (en) Hardware device calling method and apparatus
WO2023020420A1 (en) Volume display method, electronic device, and storage medium
WO2025025997A1 (en) Camera request processing method, and related apparatus
WO2025119288A1 (en) Camera request processing method and related apparatus

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 24838330

Country of ref document: EP

Kind code of ref document: A1