Image preview method and device, electronic equipment and storage medium

By detecting startup instructions in electronic devices and determining the target image sensor, creating dedicated threads to independently configure resources, and using multi-threads to collect and correct images in parallel, the problem of long time-consuming startup from camera application startup to image preview in electronic devices is solved, improving user experience and Preview efficiency.

CN118540574APending Publication Date: 2024-08-23BEIJING XIAOMI MOBILE SOFTWARE CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202310188930.3
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2023-02-22
Publication Date
2024-08-23

AI Technical Summary

Technical Problem

In the existing technology, the process from starting the electronic device camera application to image preview takes a long time, causing user experience to be laggy, and resource configuration is complex, affecting preview efficiency.

Method used

By detecting the startup command, the target image sensor is determined and a dedicated thread is created to independently configure the resources of the target image sensor to avoid waiting for other image sensor resource configurations. Multi-threads are used to collect and correct images in parallel to reduce resource competition.

Benefits of technology

It significantly reduces the time between camera application startup and first frame image preview, improves user experience, reduces resource configuration complexity and waiting time, and improves preview efficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118540574A
    Figure CN118540574A
Patent Text Reader

Abstract

The invention relates to an image previewing method and device, electronic equipment and a storage medium, the image previewing method is applied to the electronic equipment comprising a display screen and a plurality of image sensors, and the image previewing method comprises the following steps: detecting a starting instruction for a camera application in the electronic equipment; determining a target image sensor from the plurality of image sensors according to the starting instruction, and creating a first thread; wherein the first thread is a thread corresponding to the target image sensor; and collecting a first image through the target image sensor based on the first thread, and outputting the first image to the display screen for previewing. Through the method, the time consumption from camera application starting to image preview can be reduced, and the user experience is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present disclosure relates to the field of image preview technology, and in particular to an image preview method and device, electronic equipment, and storage medium. Background Art

[0002] With the rapid development of technologies related to electronic devices including smart phones, smart bracelets, robots, etc., electronic devices are able to collect images based on multiple image sensors. For example, camera applications in electronic devices take photos based on multiple image sensors to improve imaging effects. How to improve the startup performance of camera applications in electronic devices has received widespread attention. Summary of the invention

[0003] The present invention provides an image preview method and device, an electronic device, and a storage medium.

[0004] According to a first aspect of an embodiment of the present disclosure, there is provided an image preview method, which is applied to an electronic device including a display screen and a plurality of image sensors, and includes:

[0005] Detecting a start instruction for a camera application in the electronic device;

[0006] According to the startup instruction, a target image sensor is determined from the multiple image sensors, and a first thread is created; wherein the first thread is a thread corresponding to the target image sensor;

[0007] Based on the first thread, a first image is captured through the target image sensor, and the first image is output to the display screen for preview.

[0008] In some embodiments, the method further comprises:

[0009] Creating a second thread according to the start instruction;

[0010] Based on the second thread, respectively collecting second images through image sensors other than the target image sensor;

[0011] Correcting the first image captured by the target image sensor using each of the second images;

[0012] Based on the first thread, the corrected first image is updated to the display screen for preview.

[0013] In some embodiments, creating a second thread according to the start instruction includes:

[0014] After the first image is output to the display screen for preview, the second thread is created according to the start instruction.

[0015] In some embodiments, the method further comprises:

[0016] Detect photo taking instructions;

[0017] According to the photographing instruction, a third thread is created;

[0018] Based on the third thread, respectively collect a third image through the target image sensor and an image sensor other than the target image sensor;

[0019] Based on each of the third images, an image corresponding to the photographing instruction is generated.

[0020] In some embodiments, creating a third thread according to the photo taking instruction includes:

[0021] After the first image is output to the display screen for preview, the third thread is created according to the photo taking instruction.

[0022] In some embodiments, the method further comprises:

[0023] Setting a mutex lock for a shared resource between the first thread and any thread other than the first thread;

[0024] After any thread among the first thread and threads other than the first threads finishes using the shared resource, the mutex lock is released.

[0025] In some embodiments, the method further comprises:

[0026] Get current environment information;

[0027] Obtaining image acquisition performances corresponding to the multiple image sensors respectively;

[0028] The step of determining a target image sensor from the plurality of image sensors according to the startup instruction comprises:

[0029] When the start instruction is detected, the target image sensor is determined from the multiple image sensors according to the environmental information and the image acquisition performances respectively corresponding to the multiple image sensors.

[0030] According to a second aspect of an embodiment of the present disclosure, there is provided an image preview device, which is applied to an electronic device including a display screen and a plurality of image sensors, and includes:

[0031] A first detection module, used to detect a start instruction for a camera application in the electronic device;

[0032] a determination module, configured to determine a target image sensor from the plurality of image sensors according to the start instruction, and create a first thread; wherein the first thread is a thread corresponding to the target image sensor;

[0033] The first preview module is used to collect a first image through the target image sensor based on the first thread, and output the first image to the display screen for preview.

[0034] In some embodiments, the apparatus further comprises:

[0035] A first creation module, used for creating a second thread according to the start instruction;

[0036] A first acquisition module, configured to respectively acquire second images through image sensors other than the target image sensor based on the second thread;

[0037] a correction module, configured to correct the first image captured by the target image sensor using each of the second images;

[0038] The second preview module is used to update the corrected first image to the display screen for preview based on the first thread.

[0039] In some embodiments, the first creation module is used to create the second thread according to the start instruction after the first image is output to the display screen for preview.

[0040] In some embodiments, the apparatus further comprises:

[0041] The second detection module is used to detect a photo taking instruction;

[0042] A second creation module, used for creating a third thread according to the photo taking instruction;

[0043] A second acquisition module, configured to respectively acquire a third image through the target image sensor and an image sensor other than the target image sensor based on the third thread;

[0044] A generating module is used to generate an image corresponding to the photographing instruction based on each of the third images.

[0045] In some embodiments, the second creation module is used to create the third thread according to the photo taking instruction after the first image is output to the display screen for preview.

[0046] In some embodiments, the apparatus further comprises:

[0047] A protection module, used for setting a mutex lock for a shared resource between the first thread and any thread other than the first thread;

[0048] A release module is used to release the mutex lock after the first thread and any thread other than the first threads have finished using the shared resource.

[0049] In some embodiments, the apparatus further comprises:

[0050] The first acquisition module is used to obtain current environment information;

[0051] A second acquisition module is used to acquire image acquisition performances corresponding to the multiple image sensors respectively;

[0052] The determination module is used to determine the target image sensor from the multiple image sensors according to the environmental information and the image acquisition performances respectively corresponding to the multiple image sensors when the start instruction is detected.

[0053] According to a third aspect of an embodiment of the present disclosure, there is provided an electronic device, including:

[0054] A processor; a memory for storing processor-executable instructions; wherein the processor is configured to execute the method as described in the first aspect above.

[0055] According to a fourth aspect of an embodiment of the present disclosure, there is provided a storage medium, including:

[0056] When the instructions in the storage medium are executed by a processor of an electronic device, the electronic device is enabled to execute the method as described in the first aspect above.

[0057] The technical solution provided by the embodiments of the present disclosure may have the following beneficial effects:

[0058] After the camera application is started, the embodiment of the present disclosure selects a target image sensor from multiple image sensors according to a startup instruction, and creates a first thread. Based on the first thread, a first image is collected through the target image sensor and output to the display screen for preview. Since the first thread is a dedicated thread for the target image sensor and is independent of threads running image sensors other than the target image sensor, resources required for the operation of the first thread (such as allocated memory resources, processor time resources, etc.) will not be occupied by other image sensors. Compared with the related art of previewing an image after configuring the resources of each image sensor in the same thread, the embodiment of the present disclosure is based on the first thread dedicated to the target image sensor, and there is no need to wait for the time-consuming configuration of resources of other image sensors, thereby reducing the time from the start of the camera application to the image preview, especially the time from the start of the camera application to the first frame image preview, and reducing the freeze problem in the user experience caused by the failure to display the preview image in time when the camera application is started.

[0059] It is to be understood that the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the present disclosure. BRIEF DESCRIPTION OF THE DRAWINGS

[0060] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present disclosure and, together with the description, serve to explain the principles of the present disclosure.

[0061] Figure 1 This is an example flow chart of an image preview method in the related art.

[0062] Figure 2 This is an example of an image preview method process shown in the embodiment of the present disclosure. Figure 1 .

[0063] Figure 3 This is an example of an image preview method process shown in the embodiment of the present disclosure. Figure 2 .

[0064] Figure 4 is a diagram of an image preview device shown in an embodiment of the present disclosure.

[0065] Figure 5 It is a block diagram of an electronic device shown in an embodiment of the present disclosure. DETAILED DESCRIPTION

[0066] Exemplary embodiments will be described in detail herein, examples of which are shown in the accompanying drawings. When the following description refers to the drawings, the same numbers in different drawings represent the same or similar elements unless otherwise indicated. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with the present disclosure. Instead, they are merely examples of devices and methods consistent with some aspects of the present disclosure as detailed in the appended claims.

[0067] Figure 1 This is an example flow chart of an image preview method in the related art, which is applied to a mobile phone including a display screen and multiple image sensors. Figure 1 It can be seen that the following steps are included:

[0068] S101, configuring resources of each sensor;

[0069] In the related art, when the processor in the mobile phone detects the startup instruction of the camera application, it creates a thread and configures the resources of each image sensor based on the thread; the processor includes a central processing unit (CPU), a microcontroller unit (MCU), etc.; the resources include the memory resources required for the operation of each image sensor, the algorithm instance for controlling the operation of the image sensor, etc.

[0070] S102, configuring resources for taking photos;

[0071] Based on the thread created in step S101, resources of each sensor for taking photos are configured.

[0072] S103, processing the preview request;

[0073] Based on the created thread, it is determined whether the received request is a preview request, and if the received request is a preview request, step S104 is executed.

[0074] S104, obtaining the current screen display sensor;

[0075] When a preview request is received, an image sensor identified as representing the screen display is determined as the screen display sensor.

[0076] S105, activating resources of the screen display sensor;

[0077] After obtaining the on-screen sensor, activate the resources corresponding to the on-screen sensor in the configured resources.

[0078] S106, send and display.

[0079] Based on the created thread and the resources corresponding to the screen display sensor after activation, the screen display sensor is used to collect images, and the collected images are output to the display screen for preview.

[0080] It is understandable that in the related technology, after the resource configuration of each image sensor is completed based on the thread, the image collected by the screen display sensor will be sent for display, and the resource configuration of each image sensor in the multi-image sensor scenario takes a long time. For example, the pipeline resource allocation of an image sensor takes about 20 to 40 milliseconds (ms), which causes the preview image to slow down after the camera application is started and the camera application to freeze when it is opened.

[0081] In this regard, an embodiment of the present disclosure provides an image preview method, the execution subject of which is an electronic device including a display screen and multiple image sensors, such as a user equipment (UE), a mobile device, a user terminal, a mobile phone, a tablet computer, a personal digital assistant (PDA), a camera, a vehicle-mounted device, a wearable device, an intelligent robot, etc. including a display screen and multiple image sensors. Among them, the display screen is such as a light emitting diode (LED) display screen, a liquid crystal (Liquid Crystal) display screen, etc.; the image sensor includes a charge coupled device (CCD) image sensor, a complementary metal oxide conductor (CMOS) image sensor, etc. In some possible implementations, the image preview method can be implemented by a processor in an electronic device calling a computer-readable instruction stored in a memory.

[0082] Figure 2 This is an example of an image preview method process shown in the embodiment of the present disclosure. Figure 1 , used in electronic devices including display screens and multiple image sensors, Figure 2 It can be seen that the following steps are included:

[0083] S201, detecting a start instruction for a camera application in the electronic device;

[0084] S202, according to the start instruction, determine a target image sensor from the multiple image sensors, and create a first thread; wherein the first thread is a thread corresponding to the target image sensor;

[0085] S203: Based on the first thread, collect a first image through the target image sensor, and output the first image to the display screen for preview.

[0086] In the disclosed embodiment, the electronic device includes a camera application, which is used to capture images based on one or more image sensors by starting the camera application, and preview and display the captured images through a display screen, thereby realizing the needs of taking photos, recording videos, etc. Taking a smartphone as an example, a smartphone usually has multiple cameras on the back, such as dual cameras, triple cameras, quad cameras, etc., and each camera corresponds to an image sensor; a user can open the camera application in the smartphone to start one or more image sensors to capture images, and choose to take photos or record videos through the images previewed in real time on the display screen.

[0087] In step S201, a start instruction for a camera application in the electronic device is detected. For example, an operation instruction of a user clicking on the camera application is obtained based on a display screen, and the operation instruction is determined as a start instruction for the camera application; or a voice instruction representing the start instruction of the camera application is received based on a built-in sound receiving component (such as a microphone) of the electronic device, and the voice instruction is determined as a start instruction for the camera application, etc.

[0088] In step S202, the electronic device determines a target image sensor from a plurality of image sensors according to the detected startup instruction; in some embodiments, when the startup instruction carries an image sensor identifier, the image sensor indicated by the image sensor identifier is determined as the target image sensor, wherein the image sensor identifier may be unique information consisting of numbers, letters, etc. In some embodiments, the electronic device obtains the image acquisition performance of each image sensor according to the startup instruction, and determines any image sensor whose image acquisition performance meets the preset image acquisition requirements as the target image sensor, wherein the image acquisition performance includes zoom capability, maximum exposure index, color depth, etc. The preset image acquisition requirements are requirements corresponding to the image acquisition performance. Taking the image acquisition performance including color depth as an example, the preset image acquisition requirements may include that the color depth exceeds a preset color depth threshold.

[0089] In addition, the electronic device of the embodiment of the present disclosure creates a first thread according to the detected startup instruction. Taking the creation of the first thread based on the Java algorithm as an example, the first thread can be created by inheriting the Thread class, based on the Runnable interface, using Callable and Future, or using a thread pool (such as using the Executor framework and other paradigms), etc. The present disclosure does not limit this.

[0090] It should be noted that the first thread created in the embodiment of the present disclosure is a thread corresponding to the target image sensor, that is, the first thread is only used for the target image sensor to perform work, and the threads corresponding to the image sensors other than the target image sensor to perform work are independent of the first thread. Among them, the threads corresponding to the image sensors other than the target image sensor can run synchronously with the first thread corresponding to the target image sensor, or can run after the first thread of the target image sensor is completed, and the present disclosure does not limit this.

[0091] After determining the target image sensor and creating the first thread, the electronic device of the disclosed embodiment executes step S203, collects the first image through the target image sensor based on the first thread, and outputs the first image to the display screen for preview. For example, after creating the first thread, the resources of the target image sensor are configured based on the first thread, so that the target image sensor performs image acquisition based on the configured resources; the electronic device outputs the image information stream corresponding to the collected image to the display screen based on the first thread, so that the display screen performs image preview display after receiving the image information stream. Among them, the resources of the target image sensor are configured, such as configuring the pipeline resources between the target image sensor and the controller in the electronic device, including software resources and hardware resources, wherein the configured software resources are such as memory resources allocated to the pipeline, CPU usage time, resources for creating instances, etc.; the configured hardware resources are such as hardware initialization of the target image sensor, pipeline input / output port (Input / Output, I / O) initialization, etc. Since the first thread of the disclosed embodiment does not configure the resources of the image sensor other than the target image sensor, taking the electronic device as an Android phone with three cameras as an example, after testing, the disclosed embodiment can reduce the time taken from opening the camera application to the first frame preview by about 90 to 130ms.

[0092] Furthermore, since the embodiment of the present disclosure is an image preview scenario after starting the camera application, when the first thread configures the resources of the target image sensor, it can only configure the resources of the target image sensor for preview. Compared with configuring all the resources of the target image sensor, the embodiment of the present disclosure can further reduce the time consumption of resource configuration, thereby reducing the time consumption from starting the camera application to image preview.

[0093] It can be understood that after the camera application is started, the embodiment of the present disclosure selects a target image sensor from multiple image sensors according to the startup instruction, and creates a first thread. Based on the first thread, the first image is collected through the target image sensor and output to the display screen for preview. Since the first thread is a dedicated thread for the target image sensor, it is independent of the threads running image sensors other than the target image sensor. Therefore, the resources required for the operation of the first thread (such as allocated memory resources, CPU time resources, etc.) will not be occupied by other image sensors. Compared with the related art of previewing the image after configuring the resources of each image sensor in the same thread, the embodiment of the present disclosure is based on the first thread dedicated to the target image sensor, and there is no need to wait for the time-consuming configuration of resources of other image sensors, thereby reducing the time from the startup of the camera application to the image preview, especially the time from the startup of the camera application to the first frame image preview, and reducing the jamming problem in the user experience caused by the failure to display the preview image in time when the camera application is started.

[0094] In some embodiments, the method further comprises:

[0095] Creating a second thread according to the start instruction;

[0096] Based on the second thread, respectively collecting second images through image sensors other than the target image sensor;

[0097] Correcting the first image captured by the target image sensor using each of the second images;

[0098] Based on the first thread, the corrected first image is updated to the display screen for preview.

[0099] In the embodiment of the present disclosure, after detecting the start instruction, the electronic device creates a second thread in a similar manner to the above-mentioned creation of the first thread, wherein the second thread is independent of the first thread.

[0100] After creating the second thread, the electronic device of the embodiment of the present disclosure configures the resources of each image sensor other than the target image sensor based on the second thread, and collects the second image through the image sensor based on the configured resources. Since the second thread is independent of the first thread, the process of collecting the second image through the image sensor other than the target image sensor based on the second thread does not affect the time consumed for collecting the first image based on the first thread.

[0101] After the image sensors other than the target image sensors respectively capture the second images, the electronic device uses the second images to correct the first image captured by the target image sensor, and then updates the corrected first image to the display screen for preview based on the first thread. In some embodiments, the electronic device can determine the distance between the target image sensor and the subject based on the first image, any second image, and the principle of triangulation between the camera of the image sensor corresponding to the target image sensor and the any second image and the subject, so as to adjust the focal length of the target image sensor to a target focal length that matches the distance, and then based on the first thread, update the image captured by the target image sensor according to the target focal length as the corrected first image to the display screen for preview.

[0102] In some embodiments, a histogram is performed on the grayscale of each pixel in the first image to determine the grayscale distribution of the first image; a histogram is performed on the grayscale of each pixel in each second image to determine the grayscale distribution of each second image; based on the grayscale distribution of the first image and the grayscale distribution corresponding to each second image, white balance processing is performed on the first image, and the first image after white balance processing is updated as the corrected first image to the display screen for preview.

[0103] It can be understood that, on the one hand, since the second thread is independent of the first thread, processes such as resource configuration and image acquisition of image sensors other than the target image sensor do not occupy the resources of the first thread, which can reduce the time consumption of acquiring the first image based on the first thread. On the other hand, the electronic device uses each second image to correct the first image, and updates the corrected first image to the display screen for preview based on the first thread, which can improve the quality of the preview image while reducing the time consumption of sending and displaying the first image based on the first thread.

[0104] In some embodiments, creating a second thread according to the start instruction includes:

[0105] After the first image is output to the display screen for preview, the second thread is created according to the start instruction.

[0106] In an embodiment of the present disclosure, after the first image is output to the display screen for preview, the electronic device creates a second thread when a startup instruction is detected; compared with creating the second thread based on the first thread during the preview of the first image, or before previewing the first image, the embodiment of the present disclosure can further reduce the occupation of resources such as CPU time by the creation of the second thread, thereby further reducing the time consumption of previewing the first image and improving the user experience.

[0107] In some embodiments, the method further comprises:

[0108] Detect photo taking instructions;

[0109] According to the photographing instruction, a third thread is created;

[0110] Based on the third thread, respectively collect a third image through the target image sensor and an image sensor other than the target image sensor;

[0111] Based on each of the third images, an image corresponding to the photographing instruction is generated.

[0112] In an embodiment of the present disclosure, the electronic device detects a photo-taking instruction, such as obtaining an operation instruction of a user clicking a button representing a photo-taking button in the camera application based on the aforementioned display screen, and determining the operation instruction as a photo-taking instruction; or receiving a voice instruction representing a photo-taking instruction based on a built-in audio receiving component of the electronic device, and determining the voice instruction as a photo-taking instruction, etc.

[0113] After detecting the photo-taking instruction, the electronic device creates a third thread according to the photo-taking instruction in a manner similar to the aforementioned creation of the first thread; wherein the third thread is independent of the first thread.

[0114] After the third thread is created, the electronic device configures the resources of each image sensor for taking pictures based on the third thread, thereby collecting third images through each image sensor based on the configured resources for taking pictures, and generating images corresponding to the photographing instructions based on each third image. Among them, the generation of images corresponding to the photographing instructions based on each third image can be based on the time of collecting each third image, and the image collected at the most recent time is used as the image corresponding to the photographing instruction; or based on methods such as histogram statistics, the color depth of each third image is counted, and the image corresponding to the maximum color depth is used as the image corresponding to the photographing instruction, etc. Since the resources of the target image sensor for taking pictures in the embodiment of the present disclosure are configured in the third thread, that is, the first thread does not configure the resources of the target image sensor for taking pictures, and the electronic device is still taken as an Android phone with three cameras as an example, after testing, the embodiment of the present disclosure can further reduce the time taken from opening the camera application to the first frame preview by about 50ms.

[0115] In addition, after the image corresponding to the photo-taking instruction is generated, the image can be sent to a display screen for preview, and / or the image can be saved in an electronic photo album, which is not limited in the present disclosure.

[0116] It can be understood that since the third thread is independent of the first thread, the embodiment of the present disclosure is based on the third thread collecting the third image through each image sensor including the target image sensor. Therefore, the resources of the target image sensor for taking pictures are configured in the third thread, and the first thread does not need to configure the resources of the target image sensor for taking pictures. Compared with configuring the resources of the target image sensor for previewing and the resources for taking pictures in the first thread and then previewing the collected image, the embodiment of the present disclosure can further reduce the time consumption of image preview.

[0117] Figure 3 This is an example of an image preview method process shown in the embodiment of the present disclosure. Figure 2 , used in electronic devices including display screens and multiple image sensors, Figure 3 It can be seen that the following steps are included:

[0118] S301, calling the multi-camera control logic to determine the current screen display sensor;

[0119] In the embodiments of the present disclosure, the screen display sensor corresponds to the aforementioned target image sensor; when the electronic device detects a startup instruction of a camera application, the electronic device calls the multi-camera control logic to determine the current screen display sensor. For example, when the startup instruction carries an image sensor identifier, the image sensor indicated by the image sensor identifier is determined as the screen display sensor; or the electronic device obtains the image acquisition performance of each image sensor according to the startup instruction, and determines any image sensor whose image acquisition performance meets the preset image acquisition requirements as the screen display sensor, etc.

[0120] S302, configuring resources of the screen display sensor;

[0121] In an embodiment of the present disclosure, after determining the screen display sensor, the electronic device creates a first thread according to the startup instruction, and configures the screen display sensor for preview resources based on the first thread. The first thread is a thread corresponding to the screen display sensor.

[0122] After configuring the screen display sensor for previewing resources based on the first thread, step S303, step S306 and step S307 are executed, wherein the execution order of step S303, step S306 and step S307 is not limited.

[0123] S303, processing the preview request;

[0124] In an embodiment of the present disclosure, the electronic device processes a preview request. For example, after the first thread runs to a code corresponding to the preview request, the preview request is detected, and resources of the screen display sensor configured above are processed for preview, for example, a mutex lock is set for resources shared by multiple threads including the first thread.

[0125] S304, activating resources of the screen display sensor;

[0126] In an embodiment of the present disclosure, the electronic device activates resources of a screen display sensor, and based on the first thread and the activated resources of the screen display sensor, collects a first image through the screen display sensor.

[0127] S305, sending and displaying;

[0128] In the embodiment of the present disclosure, after the electronic device captures the first image through the screen display sensor, it outputs the first image to the display screen for preview. It is understandable that since the first thread only configures the resources of the screen display sensor for preview, the time consumed from starting the camera application to image preview can be reduced, thereby improving the user experience.

[0129] S306, configuring resources of other sensors;

[0130] In the embodiment of the present disclosure, the remaining sensors correspond to image sensors other than the aforementioned target image sensor; the electronic device of the embodiment of the present disclosure creates a second thread according to the startup instruction, and configures the resources of the remaining sensors based on the second thread, so as to facilitate the subsequent acquisition of second images through the remaining sensors based on the second thread, and use the second images to correct the first image acquired by the screen display sensor, and then update the corrected first image to the display screen for preview based on the first thread, which can improve the quality of the preview image.

[0131] S307: Configure resources for taking photos.

[0132] In an embodiment of the present disclosure, when the electronic device detects a photo-taking instruction, it creates a third thread, and configures resources of each image sensor for taking photos based on the third thread, so as to facilitate the subsequent generation of an image corresponding to the photo-taking instruction through the third image collected by the screen display sensor and other sensors respectively, thereby improving the quality of the image corresponding to the photo-taking instruction.

[0133] In some embodiments, creating a third thread according to the photo taking instruction includes:

[0134] After the first image is output to the display screen for preview, the third thread is created according to the photo taking instruction.

[0135] In an embodiment of the present disclosure, after the first image is output to the display screen for preview, the electronic device creates a third thread when a photo-taking instruction is detected. Compared with creating the third thread based on the first thread during the preview of the first image, or before previewing the first image, the embodiment of the present disclosure can further reduce the occupation of resources such as CPU time by the creation of the third thread, thereby further reducing the time consumption of previewing the first image and improving the user experience.

[0136] In some embodiments, the method further comprises:

[0137] Setting a mutex lock for a shared resource between the first thread and any thread other than the first thread;

[0138] After any thread among the first thread and threads other than the first threads finishes using the shared resource, the mutex lock is released.

[0139] In the embodiment of the present disclosure, since there may be shared resources (including software resources and hardware resources) between the first thread and any thread other than the first thread (such as the aforementioned second thread and third thread), there is a problem that the shared resources are called or changed simultaneously in multiple threads. In this regard, the electronic device of the embodiment of the present disclosure sets a mutex lock for the shared resources between the first thread and any thread other than the first thread, and releases the mutex lock after the first thread and any thread other than the first threads have used up the shared resources. Therefore, after the first thread captures the first image through the target image sensor and sends it for display, the mutex lock corresponding to the shared resource between the first thread and the second thread is released, so that the second thread can use the shared resource after the first image is previewed, which can reduce the problem that the shared resources are called by different threads at the same time and / or the resources are rewritten, and help to improve the accuracy of capturing the first image through the target image sensor based on the shared resources corresponding to the first thread.

[0140] In some embodiments, the method further comprises:

[0141] Get current environment information;

[0142] Obtaining image acquisition performances corresponding to the multiple image sensors respectively;

[0143] The step of determining a target image sensor from the plurality of image sensors according to the startup instruction comprises:

[0144] When the start instruction is detected, the target image sensor is determined from the multiple image sensors according to the environmental information and the image acquisition performances respectively corresponding to the multiple image sensors.

[0145] In the embodiment of the present disclosure, the environmental information includes the intensity of ambient light, the distance between the electronic device and the subject, etc. The electronic device of the embodiment of the present disclosure obtains the current environmental information by obtaining the current ambient light intensity based on an ambient light sensor such as a photoresistor, a photodiode, or a phototransistor; and determines the distance between the electronic device and the subject based on a laser sensor such as a laser sensor, an ultrasonic sensor, or the like built into the electronic device and the time-of-flight method.

[0146] In addition, the electronic device of the embodiment of the present disclosure also obtains the stored image acquisition performance corresponding to each image sensor, including the aforementioned zoom capability, maximum exposure index, color depth, etc.

[0147] When the electronic device of the disclosed embodiment detects a start-up instruction, based on the acquired current environmental information and the image acquisition performances corresponding to each image sensor, the image sensor corresponding to the image acquisition performance matching the environmental information is determined as the target image sensor. In some embodiments, when the environmental information includes the ambient light intensity, based on the correspondence between the preset ambient light intensity and the exposure index, an image sensor that satisfies the exposure index corresponding to the current ambient light intensity is selected as the target image sensor, thereby improving the quality of the first image acquired by the target image sensor with a larger exposure index selected based on the aforementioned first thread when the ambient light intensity is large.

[0148] In some embodiments, when the environmental information includes the distance between the electronic device and the subject, based on the correspondence between the preset distance and the zoom capability, an image sensor that satisfies the focal length corresponding to the distance between the current electronic device and the subject is determined as the target image sensor, thereby improving the quality of the first image acquired by the target image sensor with a larger focal length selected based on the aforementioned first thread when, for example, the electronic device is far from the subject. It can be seen that through the above embodiment, the quality of the first image acquired by the target image sensor based on the first thread can be improved, thereby improving the visual experience of the user after the first image is sent to the display screen for preview.

[0149] Figure 4 is a diagram of an image preview device shown in an embodiment of the present disclosure, which is applied to an electronic device including a display screen and multiple image sensors. Figure 4 It is known that, including:

[0150] A first detection module 401 is used to detect a start instruction for a camera application in the electronic device;

[0151] A determination module 402 is used to determine a target image sensor from the multiple image sensors according to the start instruction, and create a first thread; wherein the first thread is a thread corresponding to the target image sensor;

[0152] The first preview module 403 is configured to capture a first image through the target image sensor based on the first thread, and output the first image to the display screen for preview.

[0153] In some embodiments, the apparatus further comprises:

[0154] A first creation module 404, configured to create a second thread according to the start instruction;

[0155] A first acquisition module 405, configured to acquire second images respectively through image sensors other than the target image sensor based on the second thread;

[0156] A correction module 406, configured to correct the first image captured by the target image sensor using each of the second images;

[0157] The second preview module 407 is used to update the corrected first image to the display screen for preview based on the first thread.

[0158] In some embodiments, the first creation module 404 is used to create the second thread according to the start instruction after the first image is output to the display screen for preview.

[0159] In some embodiments, the apparatus further comprises:

[0160] The second detection module 408 is used to detect a photo taking instruction;

[0161] A second creation module 409, used to create a third thread according to the photo taking instruction;

[0162] A second acquisition module 410, configured to respectively acquire a third image through the target image sensor and an image sensor other than the target image sensor based on the third thread;

[0163] The generating module 411 is used to generate an image corresponding to the photographing instruction based on each of the third images.

[0164] In some embodiments, the second creation module 409 is used to create the third thread according to the photo taking instruction after the first image is output to the display screen for preview.

[0165] In some embodiments, the apparatus further comprises:

[0166] A protection module 412, configured to set a mutex lock for a shared resource between the first thread and any thread other than the first thread;

[0167] The release module 413 is used to release the mutex after the first thread and any thread other than the first threads have finished using the shared resource.

[0168] In some embodiments, the apparatus further comprises:

[0169] A first acquisition module 414 is used to acquire current environment information;

[0170] A second acquisition module 415 is used to acquire image acquisition performances corresponding to the multiple image sensors respectively;

[0171] The determination module 402 is configured to determine the target image sensor from the multiple image sensors according to the environmental information and the image acquisition performances respectively corresponding to the multiple image sensors when the start instruction is detected.

[0172] Regarding the device in the above embodiment, the specific manner in which each module performs operations has been described in detail in the embodiment of the method, and will not be elaborated here.

[0173] Figure 5 8 is a block diagram of an electronic device 800 shown in an embodiment of the present disclosure. For example, the electronic device 800 may be a mobile phone, a mobile computer, a smart bracelet, a smart robot, etc.

[0174] Reference Figure 5 , the electronic device 800 may include one or more of the following components: a processing component 802 , a memory 804 , a power component 806 , a multimedia component 808 , an audio component 810 , an input / output (I / O) interface 812 , a sensor component 814 , and a communication component 816 .

[0175] The processing component 802 generally controls the overall operation of the electronic device 800, such as operations associated with display, phone calls, data communications, camera operations, and recording operations. The processing component 802 may include one or more processors 820 to execute instructions to complete all or part of the steps of the above-mentioned method. In addition, the processing component 802 may include one or more modules to facilitate the interaction between the processing component 802 and other components. For example, the processing component 802 may include a multimedia module to facilitate the interaction between the multimedia component 808 and the processing component 802.

[0176] The memory 804 is configured to store various types of data to support operations on the device 800. Examples of such data include instructions for any application or method operating on the electronic device 800, contact data, phone book data, messages, pictures, videos, etc. The memory 804 can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic memory, flash memory, magnetic disk or optical disk.

[0177] The power component 806 provides power to the various components of the electronic device 800. The power component 806 may include a power management system, one or more power supplies, and other components associated with generating, managing, and distributing power for the electronic device 800.

[0178] The multimedia component 808 includes a screen that provides an output interface between the electronic device 800 and the user. In some embodiments, the screen may include a liquid crystal display (LCD) and a touch panel (TP). If the screen includes a touch panel, the screen may be implemented as a touch screen to receive input signals from the user. The touch panel includes one or more touch sensors to sense touch, slide, and gestures on the touch panel. The touch sensor may not only sense the boundaries of the touch or slide action, but also detect the duration and pressure associated with the touch or slide operation. In some embodiments, the multimedia component 808 includes a front camera and / or a rear camera. When the device 800 is in an operating mode, such as a shooting mode or a video mode, the front camera and / or the rear camera may receive external multimedia data. Each front camera and the rear camera may be a fixed optical lens system or have a focal length and optical zoom capability.

[0179] The audio component 810 is configured to output and / or input audio signals. For example, the audio component 810 includes a microphone (MIC), and when the electronic device 800 is in an operating mode, such as a call mode, a recording mode, and a voice recognition mode, the microphone is configured to receive an external audio signal. The received audio signal can be further stored in the memory 804 or sent via the communication component 816. In some embodiments, the audio component 810 also includes a speaker for outputting audio signals.

[0180] I / O interface 812 provides an interface between processing component 802 and peripheral interface modules, such as keyboards, click wheels, buttons, etc. These buttons may include but are not limited to: home button, volume button, start button, and lock button.

[0181] The sensor assembly 814 includes one or more sensors for providing various aspects of status assessment for the electronic device 800. For example, the sensor assembly 814 can detect the open / closed state of the device 800, the relative positioning of components, such as the display and keypad of the electronic device 800, and the sensor assembly 814 can also detect the position change of the electronic device 800 or a component of the electronic device 800, the presence or absence of contact between the user and the electronic device 800, the orientation or acceleration / deceleration of the electronic device 800, and the temperature change of the electronic device 800. The sensor assembly 814 may include a proximity sensor configured to detect the presence of nearby objects without any physical contact. The sensor assembly 814 may also include an optical sensor, such as a CMOS or CCD image sensor, for use in imaging applications. In some embodiments, the sensor assembly 814 may also include an accelerometer, a gyroscope sensor, a magnetic sensor, a pressure sensor, or a temperature sensor.

[0182] The communication component 816 is configured to facilitate wired or wireless communication between the electronic device 800 and other devices. The electronic device 800 can access a wireless network based on a communication standard, such as Wi-Fi, 4G or 5G, or a combination thereof. In an exemplary embodiment, the communication component 816 receives a broadcast signal or broadcast-related information from an external broadcast management system via a broadcast channel. In an exemplary embodiment, the communication component 816 also includes a near field communication (NFC) module to facilitate short-range communication. For example, the NFC module can be implemented based on radio frequency identification (RFID) technology, infrared data association (IrDA) technology, ultra-wideband (UWB) technology, Bluetooth (BT) technology and other technologies.

[0183] In an exemplary embodiment, the electronic device 800 may be implemented by one or more application-specific integrated circuits (ASICs), digital signal processors (DSPs), digital signal processing devices (DSPDs), programmable logic devices (PLDs), field programmable gate arrays (FPGAs), controllers, microcontrollers, microprocessors, or other electronic components to perform the above methods.

[0184] In an exemplary embodiment, a non-transitory computer-readable storage medium including instructions is also provided, such as a memory 804 including instructions, and the instructions can be executed by a processor 820 of an electronic device 800 to perform the above method. For example, the non-transitory computer-readable storage medium can be a ROM, a random access memory (RAM), a CD-ROM, a magnetic tape, a floppy disk, an optical data storage device, etc.

[0185] A non-transitory computer-readable storage medium, when instructions in the storage medium are executed by a processor of an electronic device, enables the electronic device to execute the aforementioned image preview method.

[0186] Those skilled in the art will readily appreciate other embodiments of the present disclosure after considering the specification and practicing the invention disclosed herein. The present disclosure is intended to cover any variations, uses or adaptations of the present disclosure that follow the general principles of the present disclosure and include common knowledge or customary techniques in the art that are not disclosed in the present disclosure. The description and examples are to be considered exemplary only, and the true scope and spirit of the present disclosure are indicated by the claims above.

[0187] It should be understood that the present disclosure is not limited to the exact structures that have been described above and shown in the drawings, and that various modifications and changes may be made without departing from the scope thereof. The scope of the present disclosure is limited only by the appended claims.

Claims

1. An image preview method, characterized in that: Applied to an electronic device including a display screen and a plurality of image sensors, the method comprises: Detecting a start instruction for a camera application in the electronic device; According to the startup instruction, a target image sensor is determined from the multiple image sensors, and a first thread is created; wherein the first thread is a thread corresponding to the target image sensor; Based on the first thread, a first image is captured through the target image sensor, and the first image is output to the display screen for preview.

2. The method according to claim 1, characterized in that The method further comprises: Creating a second thread according to the start instruction; Based on the second thread, respectively collecting second images through image sensors other than the target image sensor; Correcting the first image captured by the target image sensor using each of the second images; Based on the first thread, the corrected first image is updated to the display screen for preview.

3. The method according to claim 2, characterized in that The step of creating a second thread according to the start instruction includes: After the first image is output to the display screen for preview, the second thread is created according to the start instruction.

4. The method according to claim 1, characterized in that: The method further comprises: Detecting photo taking instructions; According to the photographing instruction, a third thread is created; Based on the third thread, respectively collect a third image through the target image sensor and an image sensor other than the target image sensor; Based on each of the third images, an image corresponding to the photographing instruction is generated.

5. The method according to claim 4, characterized in that The step of creating a third thread according to the photographing instruction includes: After the first image is output to the display screen for preview, the third thread is created according to the photo taking instruction.

6. The method according to claim 1, characterized in that The method further comprises: Setting a mutex lock for a shared resource between the first thread and any thread other than the first thread; After any thread among the first thread and threads other than the first threads finishes using the shared resource, the mutex lock is released.

7. The method according to claim 1, characterized in that The method further comprises: Get current environment information; Obtaining image acquisition performances corresponding to the multiple image sensors respectively; The step of determining a target image sensor from the plurality of image sensors according to the startup instruction comprises: When the start instruction is detected, the target image sensor is determined from the multiple image sensors according to the environmental information and the image acquisition performances respectively corresponding to the multiple image sensors.

8. An image preview device, characterized in that: Applied to an electronic device including a display screen and a plurality of image sensors, the device includes: A first detection module, used to detect a start instruction for a camera application in the electronic device; a determination module, configured to determine a target image sensor from the plurality of image sensors according to the start instruction, and create a first thread; wherein the first thread is a thread corresponding to the target image sensor; The first preview module is used to collect a first image through the target image sensor based on the first thread, and output the first image to the display screen for preview.

9. An electronic device, characterized in that: include: processor; a memory for storing processor-executable instructions; The processor is configured to execute the method as claimed in any one of claims 1 to 7.

10. A computer-readable storage medium, characterized in that: When the instructions in the storage medium are executed by a processor of an electronic device, the electronic device is enabled to execute the method as claimed in any one of claims 1 to 7.